@jupyterlite/pyodide-kernel 0.7.0-alpha.1 → 0.7.0-alpha.3
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.
- package/lib/_pypi.d.ts +2 -2
- package/lib/_pypi.js +2 -2
- package/lib/coincident.worker.js +6 -6
- package/lib/coincident.worker.js.map +4 -4
- package/lib/comlink.worker.js +6 -6
- package/lib/comlink.worker.js.map +4 -4
- package/package.json +8 -8
- package/pypi/all.json +33 -33
- package/pypi/ipykernel-6.9.2-py3-none-any.whl +0 -0
- package/pypi/{piplite-0.7.0a1-py3-none-any.whl → piplite-0.7.0a3-py3-none-any.whl} +0 -0
- package/pypi/{pyodide_kernel-0.7.0a1-py3-none-any.whl → pyodide_kernel-0.7.0a3-py3-none-any.whl} +0 -0
- package/pypi/widgetsnbextension-3.6.999-py3-none-any.whl +0 -0
- package/pypi/widgetsnbextension-4.0.999-py3-none-any.whl +0 -0
package/lib/coincident.worker.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var So=Object.create;var Gn=Object.defineProperty;var xo=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,Po=Object.prototype.hasOwnProperty;var nt=(i,e)=>()=>(i&&(e=i(i=0)),e);var I=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Eo=(i,e)=>{for(var t in e)Gn(i,t,{get:e[t],enumerable:!0})},Mo=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Co(e))!Po.call(i,s)&&s!==t&&Gn(i,s,{get:()=>e[s],enumerable:!(n=xo(e,s))||n.enumerable});return i};var $e=(i,e,t)=>(t=i!=null?So(ko(i)):{},Mo(e||!i||!i.__esModule?Gn(t,"default",{value:i,enumerable:!0}):t,i));var si=I(($t,Rs)=>{(function(i,e){typeof $t=="object"&&typeof Rs!="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(x,P,m=0,f=-1){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let M;f<m?M=f+1+(v-m):M=f-m+1;for(let j=0;j<M;++j){let K=(m+j)%v;if(x[K]===P)return K}return-1}h.firstIndexOf=y;function C(x,P,m=-1,f=0){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let M;m<f?M=m+1+(v-f):M=m-f+1;for(let j=0;j<M;++j){let K=(m-j+v)%v;if(x[K]===P)return K}return-1}h.lastIndexOf=C;function k(x,P,m=0,f=-1){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let M;f<m?M=f+1+(v-m):M=f-m+1;for(let j=0;j<M;++j){let K=(m+j)%v;if(P(x[K],K))return K}return-1}h.findFirstIndex=k;function N(x,P,m=-1,f=0){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let M;m<f?M=m+1+(v-f):M=m-f+1;for(let j=0;j<M;++j){let K=(m-j+v)%v;if(P(x[K],K))return K}return-1}h.findLastIndex=N;function G(x,P,m=0,f=-1){let v=k(x,P,m,f);return v!==-1?x[v]:void 0}h.findFirstValue=G;function z(x,P,m=-1,f=0){let v=N(x,P,m,f);return v!==-1?x[v]:void 0}h.findLastValue=z;function F(x,P,m,f=0,v=-1){let M=x.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),v<0?v=Math.max(0,v+M):v=Math.min(v,M-1);let j=f,K=v-f+1;for(;K>0;){let Se=K>>1,ft=j+Se;m(x[ft],P)<0?(j=ft+1,K-=Se+1):K=Se}return j}h.lowerBound=F;function Z(x,P,m,f=0,v=-1){let M=x.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),v<0?v=Math.max(0,v+M):v=Math.min(v,M-1);let j=f,K=v-f+1;for(;K>0;){let Se=K>>1,ft=j+Se;m(x[ft],P)>0?K=Se:(j=ft+1,K-=Se+1)}return j}h.upperBound=Z;function $(x,P,m){if(x===P)return!0;if(x.length!==P.length)return!1;for(let f=0,v=x.length;f<v;++f)if(m?!m(x[f],P[f]):x[f]!==P[f])return!1;return!0}h.shallowEqual=$;function te(x,P={}){let{start:m,stop:f,step:v}=P;if(v===void 0&&(v=1),v===0)throw new Error("Slice `step` cannot be zero.");let M=x.length;m===void 0?m=v<0?M-1:0:m<0?m=Math.max(m+M,v<0?-1:0):m>=M&&(m=v<0?M-1:M),f===void 0?f=v<0?-1:M:f<0?f=Math.max(f+M,v<0?-1:0):f>=M&&(f=v<0?M-1:M);let j;v<0&&f>=m||v>0&&m>=f?j=0:v<0?j=Math.floor((f-m+1)/v+1):j=Math.floor((f-m-1)/v+1);let K=[];for(let Se=0;Se<j;++Se)K[Se]=x[m+Se*v];return K}h.slice=te;function Y(x,P,m){let f=x.length;if(f<=1||(P<0?P=Math.max(0,P+f):P=Math.min(P,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1),P===m))return;let v=x[P],M=P<m?1:-1;for(let j=P;j!==m;j+=M)x[j]=x[j+M];x[m]=v}h.move=Y;function ue(x,P=0,m=-1){let f=x.length;if(!(f<=1))for(P<0?P=Math.max(0,P+f):P=Math.min(P,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1);P<m;){let v=x[P],M=x[m];x[P++]=M,x[m--]=v}}h.reverse=ue;function Pe(x,P,m=0,f=-1){let v=x.length;if(v<=1||(m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1),m>=f))return;let M=f-m+1;if(P>0?P=P%M:P<0&&(P=(P%M+M)%M),P===0)return;let j=m+P;ue(x,m,j-1),ue(x,j,f),ue(x,m,f)}h.rotate=Pe;function Ie(x,P,m=0,f=-1){let v=x.length;if(v===0)return;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let M;f<m?M=f+1+(v-m):M=f-m+1;for(let j=0;j<M;++j)x[(m+j)%v]=P}h.fill=Ie;function mo(x,P,m){let f=x.length;P<0?P=Math.max(0,P+f):P=Math.min(P,f);for(let v=f;v>P;--v)x[v]=x[v-1];x[P]=m}h.insert=mo;function ht(x,P){let m=x.length;if(P<0&&(P+=m),P<0||P>=m)return;let f=x[P];for(let v=P+1;v<m;++v)x[v-1]=x[v];return x.length=m-1,f}h.removeAt=ht;function go(x,P,m=0,f=-1){let v=y(x,P,m,f);return v!==-1&&ht(x,v),v}h.removeFirstOf=go;function _o(x,P,m=-1,f=0){let v=C(x,P,m,f);return v!==-1&&ht(x,v),v}h.removeLastOf=_o;function vo(x,P,m=0,f=-1){let v=x.length;if(v===0)return 0;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let M=0;for(let j=0;j<v;++j)m<=f&&j>=m&&j<=f&&x[j]===P||f<m&&(j<=f||j>=m)&&x[j]===P?M++:M>0&&(x[j-M]=x[j]);return M>0&&(x.length=v-M),M}h.removeAllOf=vo;function yo(x,P,m=0,f=-1){let v,M=k(x,P,m,f);return M!==-1&&(v=ht(x,M)),{index:M,value:v}}h.removeFirstWhere=yo;function wo(x,P,m=-1,f=0){let v,M=N(x,P,m,f);return M!==-1&&(v=ht(x,M)),{index:M,value:v}}h.removeLastWhere=wo;function bo(x,P,m=0,f=-1){let v=x.length;if(v===0)return 0;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let M=0;for(let j=0;j<v;++j)m<=f&&j>=m&&j<=f&&P(x[j],j)||f<m&&(j<=f||j>=m)&&P(x[j],j)?M++:M>0&&(x[j-M]=x[j]);return M>0&&(x.length=v-M),M}h.removeAllWhere=bo}(i.ArrayExt||(i.ArrayExt={}));function*e(...h){for(let y of h)yield*y}function*t(){}function*n(h,y=0){for(let C of h)yield[y++,C]}function*s(h,y){let C=0;for(let k of h)y(k,C++)&&(yield k)}function r(h,y){let C=0;for(let k of h)if(y(k,C++))return k}function a(h,y){let C=0;for(let k of h)if(y(k,C++))return C-1;return-1}function o(h,y){let C;for(let k of h){if(C===void 0){C=k;continue}y(k,C)<0&&(C=k)}return C}function u(h,y){let C;for(let k of h){if(C===void 0){C=k;continue}y(k,C)>0&&(C=k)}return C}function c(h,y){let C=!0,k,N;for(let G of h)C?(k=G,N=G,C=!1):y(G,k)<0?k=G:y(G,N)>0&&(N=G);return C?void 0:[k,N]}function d(h){return Array.from(h)}function l(h){let y={};for(let[C,k]of h)y[C]=k;return y}function p(h,y){let C=0;for(let k of h)if(y(k,C++)===!1)return}function _(h,y){let C=0;for(let k of h)if(y(k,C++)===!1)return!1;return!0}function g(h,y){let C=0;for(let k of h)if(y(k,C++))return!0;return!1}function*E(h,y){let C=0;for(let k of h)yield y(k,C++)}function*S(h,y,C){y===void 0?(y=h,h=0,C=1):C===void 0&&(C=1);let k=O.rangeLength(h,y,C);for(let N=0;N<k;N++)yield h+C*N}var O;(function(h){function y(C,k,N){return N===0?1/0:C>k&&N>0||C<k&&N<0?0:Math.ceil((k-C)/N)}h.rangeLength=y})(O||(O={}));function q(h,y,C){let k=h[Symbol.iterator](),N=0,G=k.next();if(G.done&&C===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(G.done)return C;let z=k.next();if(z.done&&C===void 0)return G.value;if(z.done)return y(C,G.value,N++);let F;C===void 0?F=y(G.value,z.value,N++):F=y(y(C,G.value,N++),z.value,N++);let Z;for(;!(Z=k.next()).done;)F=y(F,Z.value,N++);return F}function*b(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=[],C=new Set,k=new Map;for(let z of h)N(z);for(let[z]of k)G(z);return y;function N(z){let[F,Z]=z,$=k.get(Z);$?$.push(F):k.set(Z,[F])}function G(z){if(C.has(z))return;C.add(z);let F=k.get(z);if(F)for(let Z of F)G(Z);y.push(z)}}function*T(h,y){let C=0;for(let k of h)C++%y===0&&(yield k)}i.StringExt=void 0,function(h){function y(z,F,Z=0){let $=new Array(F.length);for(let te=0,Y=Z,ue=F.length;te<ue;++te,++Y){if(Y=z.indexOf(F[te],Y),Y===-1)return null;$[te]=Y}return $}h.findIndices=y;function C(z,F,Z=0){let $=y(z,F,Z);if(!$)return null;let te=0;for(let Y=0,ue=$.length;Y<ue;++Y){let Pe=$[Y]-Z;te+=Pe*Pe}return{score:te,indices:$}}h.matchSumOfSquares=C;function k(z,F,Z=0){let $=y(z,F,Z);if(!$)return null;let te=0,Y=Z-1;for(let ue=0,Pe=$.length;ue<Pe;++ue){let Ie=$[ue];te+=Ie-Y-1,Y=Ie}return{score:te,indices:$}}h.matchSumOfDeltas=k;function N(z,F,Z){let $=[],te=0,Y=0,ue=F.length;for(;te<ue;){let Pe=F[te],Ie=F[te];for(;++te<ue&&F[te]===Ie+1;)Ie++;Y<Pe&&$.push(z.slice(Y,Pe)),Pe<Ie+1&&$.push(Z(z.slice(Pe,Ie+1))),Y=Ie+1}return Y<z.length&&$.push(z.slice(Y)),$}h.highlight=N;function G(z,F){return z<F?-1:z>F?1:0}h.cmp=G}(i.StringExt||(i.StringExt={}));function*D(h,y){if(y<1)return;let C=h[Symbol.iterator](),k;for(;0<y--&&!(k=C.next()).done;)yield k.value}function*A(...h){let y=h.map(k=>k[Symbol.iterator]()),C=y.map(k=>k.next());for(;_(C,k=>!k.done);C=y.map(k=>k.next()))yield C.map(k=>k.value)}i.chain=e,i.each=p,i.empty=t,i.enumerate=n,i.every=_,i.filter=s,i.find=r,i.findIndex=a,i.map=E,i.max=u,i.min=o,i.minmax=c,i.once=w,i.range=S,i.reduce=q,i.repeat=b,i.retro=R,i.some=g,i.stride=T,i.take=D,i.toArray=d,i.toObject=l,i.topologicSort=U,i.zip=A})});var ne=I((Vt,Os)=>{(function(i,e){typeof Vt=="object"&&typeof Os!="undefined"?e(Vt,si()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_coreutils={},i.lumino_algorithm))})(Vt,function(i,e){"use strict";i.JSONExt=void 0,function(c){c.emptyObject=Object.freeze({}),c.emptyArray=Object.freeze([]);function d(b){return b===null||typeof b=="boolean"||typeof b=="number"||typeof b=="string"}c.isPrimitive=d;function l(b){return Array.isArray(b)}c.isArray=l;function p(b){return!d(b)&&!l(b)}c.isObject=p;function _(b,w){if(b===w)return!0;if(d(b)||d(w))return!1;let R=l(b),U=l(w);return R!==U?!1:R&&U?E(b,w):S(b,w)}c.deepEqual=_;function g(b){return d(b)?b:l(b)?O(b):q(b)}c.deepCopy=g;function E(b,w){if(b===w)return!0;if(b.length!==w.length)return!1;for(let R=0,U=b.length;R<U;++R)if(!_(b[R],w[R]))return!1;return!0}function S(b,w){if(b===w)return!0;for(let R in b)if(b[R]!==void 0&&!(R in w))return!1;for(let R in w)if(w[R]!==void 0&&!(R in b))return!1;for(let R in b){let U=b[R],T=w[R];if(!(U===void 0&&T===void 0)&&(U===void 0||T===void 0||!_(U,T)))return!1}return!0}function O(b){let w=new Array(b.length);for(let R=0,U=b.length;R<U;++R)w[R]=g(b[R]);return w}function q(b){let w={};for(let R in b){let U=b[R];U!==void 0&&(w[R]=g(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(g=>this.resolveRequiredService(g)),_=l.optional.map(g=>this.resolveOptionalService(g));return l.promise=Promise.all([...p,..._]).then(g=>l.activate.apply(void 0,[this.application,...g])).then(g=>{l.service=g,l.activated=!0,l.promise=null}).catch(g=>{throw l.promise=null,g}),l.promise}async activatePlugins(d,l={}){switch(d){case"defer":{let p=this.deferredPlugins.filter(_=>this._plugins.get(_).autoStart).map(_=>this.activatePlugin(_));await Promise.all(p);break}case"startUp":{let _=s.collectStartupPlugins(this._plugins,l).map(async g=>{try{return await this.activatePlugin(g)}catch(E){console.error(`Plugin '${g}' failed to activate.`,E)}});await Promise.all(_);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),_=p.map(g=>this._plugins.get(g));for(let g of _)if(!g.deactivate)throw new TypeError(`Plugin ${g.id}#deactivate() method missing (depends on ${d})`);for(let g of _){let E=[...g.requires,...g.optional].map(S=>{let O=this._services.get(S);return O?this._plugins.get(O).service:null});await g.deactivate(this.application,...E),g.service=null,g.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(_){return console.error(_),null}return p.service}}var s;(function(c){class d{constructor(S){var O,q,b,w;this._activated=!1,this._promise=null,this._service=null,this.id=S.id,this.description=(O=S.description)!==null&&O!==void 0?O:"",this.activate=S.activate,this.deactivate=(q=S.deactivate)!==null&&q!==void 0?q:null,this.provides=(b=S.provides)!==null&&b!==void 0?b:null,this.autoStart=(w=S.autoStart)!==null&&w!==void 0?w:!1,this.requires=S.requires?S.requires.slice():[],this.optional=S.optional?S.optional.slice():[]}get activated(){return this._activated}set activated(S){this._activated=S}get service(){return this._service}set service(S){this._service=S}get promise(){return this._promise}set promise(S){this._promise=S}}function l(E){return new d(E)}c.createPluginData=l;function p(E,S,O){let q=[...E.requires,...E.optional],b=R=>{if(R===E.provides)return!0;let U=O.get(R);if(!U)return!1;let T=S.get(U),D=[...T.requires,...T.optional];return D.length===0?!1:(w.push(U),D.some(b)?!0:(w.pop(),!1))};if(!E.provides||q.length===0)return;let w=[E.id];if(q.some(b))throw new ReferenceError(`Cycle detected: ${w.join(" -> ")}.`)}c.ensureNoCycle=p;function _(E,S,O){let q=new Array,b=D=>{let A=S.get(D),h=[...A.requires,...A.optional];q.push(...h.reduce((y,C)=>{let k=O.get(C);return k&&y.push([D,k]),y},[]))};for(let D of S.keys())b(D);let w=q.filter(D=>D[1]===E),R=0;for(;w.length>R;){let D=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=D}let U=e.topologicSort(w),T=U.findIndex(D=>D===E);return T===-1?[E]:U.slice(0,T+1)}c.findDependents=_;function g(E,S){let O=new Set;for(let q of E.keys())E.get(q).autoStart===!0&&O.add(q);if(S.startPlugins)for(let q of S.startPlugins)O.add(q);if(S.ignorePlugins)for(let q of S.ignorePlugins)O.delete(q);return Array.from(O)}c.collectStartupPlugins=g})(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 Q=I((Wt,Ds)=>{(function(i,e){typeof Wt=="object"&&typeof Ds!="undefined"?e(Wt,si(),ne()):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))})(Wt,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(g,E){r.disconnectBetween(g,E)}a.disconnectBetween=o;function u(g){r.disconnectSender(g)}a.disconnectSender=u;function c(g){r.disconnectReceiver(g)}a.disconnectReceiver=c;function d(g){r.disconnectAll(g)}a.disconnectAll=d;function l(g){r.disconnectAll(g)}a.clearData=l;function p(){return r.exceptionHandler}a.getExceptionHandler=p;function _(g){let E=r.exceptionHandler;return r.exceptionHandler=g,E}a.setExceptionHandler=_})(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=D=>{console.error(D)};function o(D,A,h){h=h||void 0;let y=g.get(D.sender);if(y||(y=[],g.set(D.sender,y)),q(y,D,A,h))return!1;let C=h||A,k=E.get(C);k||(k=[],E.set(C,k));let N={signal:D,slot:A,thisArg:h};return y.push(N),k.push(N),!0}a.connect=o;function u(D,A,h){h=h||void 0;let y=g.get(D.sender);if(!y||y.length===0)return!1;let C=q(y,D,A,h);if(!C)return!1;let k=h||A,N=E.get(k);return C.signal=null,w(y),w(N),!0}a.disconnect=u;function c(D,A){let h=g.get(D);if(!h||h.length===0)return;let y=E.get(A);if(!(!y||y.length===0)){for(let C of y)C.signal&&C.signal.sender===D&&(C.signal=null);w(h),w(y)}}a.disconnectBetween=c;function d(D){let A=g.get(D);if(!(!A||A.length===0)){for(let h of A){if(!h.signal)continue;let y=h.thisArg||h.slot;h.signal=null,w(E.get(y))}w(A)}}a.disconnectSender=d;function l(D){let A=E.get(D);if(!(!A||A.length===0)){for(let h of A){if(!h.signal)continue;let y=h.signal.sender;h.signal=null,w(g.get(y))}w(A)}}a.disconnectReceiver=l;function p(D){d(D),l(D)}a.disconnectAll=p;function _(D,A){let h=g.get(D.sender);if(!(!h||h.length===0))for(let y=0,C=h.length;y<C;++y){let k=h[y];k.signal===D&&b(k,A)}}a.emit=_;let g=new WeakMap,E=new WeakMap,S=new Set,O=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;function q(D,A,h,y){return e.find(D,C=>C.signal===A&&C.slot===h&&C.thisArg===y)}function b(D,A){let{signal:h,slot:y,thisArg:C}=D;try{y.call(C,h.sender,A)}catch(k){a.exceptionHandler(k)}}function w(D){S.size===0&&O(R),S.add(D)}function R(){S.forEach(U),S.clear()}function U(D){e.ArrayExt.removeAllWhere(D,T)}function T(D){return D.signal===null}})(r||(r={})),i.Signal=n,i.Stream=s})});var Ts=I(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.ActivityMonitor=void 0;var js=Q(),ri=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new js.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,js.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)}};Jt.ActivityMonitor=ri});var As=I(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0})});var Us=I(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.LruCache=void 0;var To=128,ai=class{constructor(e={}){this._map=new Map,this._maxSize=(e==null?void 0:e.maxSize)||To}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)}};Ht.LruCache=ai});var Ls=I(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.MarkdownCodeBlocks=void 0;var Ns;(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 Do=Object.create;var Zn=Object.defineProperty;var jo=Object.getOwnPropertyDescriptor;var To=Object.getOwnPropertyNames;var qo=Object.getPrototypeOf,Uo=Object.prototype.hasOwnProperty;var it=(i,e)=>()=>(i&&(e=i(i=0)),e);var E=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Ao=(i,e)=>{for(var t in e)Zn(i,t,{get:e[t],enumerable:!0})},No=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of To(e))!Uo.call(i,s)&&s!==t&&Zn(i,s,{get:()=>e[s],enumerable:!(n=jo(e,s))||n.enumerable});return i};var Ve=(i,e,t)=>(t=i!=null?Do(qo(i)):{},No(e||!i||!i.__esModule?Zn(t,"default",{value:i,enumerable:!0}):t,i));var oi=E((Vt,qs)=>{(function(i,e){typeof Vt=="object"&&typeof qs!="undefined"?e(Vt):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_algorithm={}))})(Vt,function(i){"use strict";i.ArrayExt=void 0,function(h){function y(x,P,m=0,f=-1){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let I;f<m?I=f+1+(v-m):I=f-m+1;for(let j=0;j<I;++j){let K=(m+j)%v;if(x[K]===P)return K}return-1}h.firstIndexOf=y;function C(x,P,m=-1,f=0){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let I;m<f?I=m+1+(v-f):I=m-f+1;for(let j=0;j<I;++j){let K=(m-j+v)%v;if(x[K]===P)return K}return-1}h.lastIndexOf=C;function k(x,P,m=0,f=-1){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let I;f<m?I=f+1+(v-m):I=f-m+1;for(let j=0;j<I;++j){let K=(m+j)%v;if(P(x[K],K))return K}return-1}h.findFirstIndex=k;function N(x,P,m=-1,f=0){let v=x.length;if(v===0)return-1;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let I;m<f?I=m+1+(v-f):I=m-f+1;for(let j=0;j<I;++j){let K=(m-j+v)%v;if(P(x[K],K))return K}return-1}h.findLastIndex=N;function G(x,P,m=0,f=-1){let v=k(x,P,m,f);return v!==-1?x[v]:void 0}h.findFirstValue=G;function z(x,P,m=-1,f=0){let v=N(x,P,m,f);return v!==-1?x[v]:void 0}h.findLastValue=z;function F(x,P,m,f=0,v=-1){let I=x.length;if(I===0)return 0;f<0?f=Math.max(0,f+I):f=Math.min(f,I-1),v<0?v=Math.max(0,v+I):v=Math.min(v,I-1);let j=f,K=v-f+1;for(;K>0;){let xe=K>>1,mt=j+xe;m(x[mt],P)<0?(j=mt+1,K-=xe+1):K=xe}return j}h.lowerBound=F;function Z(x,P,m,f=0,v=-1){let I=x.length;if(I===0)return 0;f<0?f=Math.max(0,f+I):f=Math.min(f,I-1),v<0?v=Math.max(0,v+I):v=Math.min(v,I-1);let j=f,K=v-f+1;for(;K>0;){let xe=K>>1,mt=j+xe;m(x[mt],P)>0?K=xe:(j=mt+1,K-=xe+1)}return j}h.upperBound=Z;function $(x,P,m){if(x===P)return!0;if(x.length!==P.length)return!1;for(let f=0,v=x.length;f<v;++f)if(m?!m(x[f],P[f]):x[f]!==P[f])return!1;return!0}h.shallowEqual=$;function te(x,P={}){let{start:m,stop:f,step:v}=P;if(v===void 0&&(v=1),v===0)throw new Error("Slice `step` cannot be zero.");let I=x.length;m===void 0?m=v<0?I-1:0:m<0?m=Math.max(m+I,v<0?-1:0):m>=I&&(m=v<0?I-1:I),f===void 0?f=v<0?-1:I:f<0?f=Math.max(f+I,v<0?-1:0):f>=I&&(f=v<0?I-1:I);let j;v<0&&f>=m||v>0&&m>=f?j=0:v<0?j=Math.floor((f-m+1)/v+1):j=Math.floor((f-m-1)/v+1);let K=[];for(let xe=0;xe<j;++xe)K[xe]=x[m+xe*v];return K}h.slice=te;function Y(x,P,m){let f=x.length;if(f<=1||(P<0?P=Math.max(0,P+f):P=Math.min(P,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1),P===m))return;let v=x[P],I=P<m?1:-1;for(let j=P;j!==m;j+=I)x[j]=x[j+I];x[m]=v}h.move=Y;function ue(x,P=0,m=-1){let f=x.length;if(!(f<=1))for(P<0?P=Math.max(0,P+f):P=Math.min(P,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1);P<m;){let v=x[P],I=x[m];x[P++]=I,x[m--]=v}}h.reverse=ue;function Ee(x,P,m=0,f=-1){let v=x.length;if(v<=1||(m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1),m>=f))return;let I=f-m+1;if(P>0?P=P%I:P<0&&(P=(P%I+I)%I),P===0)return;let j=m+P;ue(x,m,j-1),ue(x,j,f),ue(x,m,f)}h.rotate=Ee;function Oe(x,P,m=0,f=-1){let v=x.length;if(v===0)return;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let I;f<m?I=f+1+(v-m):I=f-m+1;for(let j=0;j<I;++j)x[(m+j)%v]=P}h.fill=Oe;function ko(x,P,m){let f=x.length;P<0?P=Math.max(0,P+f):P=Math.min(P,f);for(let v=f;v>P;--v)x[v]=x[v-1];x[P]=m}h.insert=ko;function ft(x,P){let m=x.length;if(P<0&&(P+=m),P<0||P>=m)return;let f=x[P];for(let v=P+1;v<m;++v)x[v-1]=x[v];return x.length=m-1,f}h.removeAt=ft;function Po(x,P,m=0,f=-1){let v=y(x,P,m,f);return v!==-1&&ft(x,v),v}h.removeFirstOf=Po;function Eo(x,P,m=-1,f=0){let v=C(x,P,m,f);return v!==-1&&ft(x,v),v}h.removeLastOf=Eo;function Mo(x,P,m=0,f=-1){let v=x.length;if(v===0)return 0;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let I=0;for(let j=0;j<v;++j)m<=f&&j>=m&&j<=f&&x[j]===P||f<m&&(j<=f||j>=m)&&x[j]===P?I++:I>0&&(x[j-I]=x[j]);return I>0&&(x.length=v-I),I}h.removeAllOf=Mo;function Io(x,P,m=0,f=-1){let v,I=k(x,P,m,f);return I!==-1&&(v=ft(x,I)),{index:I,value:v}}h.removeFirstWhere=Io;function Oo(x,P,m=-1,f=0){let v,I=N(x,P,m,f);return I!==-1&&(v=ft(x,I)),{index:I,value:v}}h.removeLastWhere=Oo;function Ro(x,P,m=0,f=-1){let v=x.length;if(v===0)return 0;m<0?m=Math.max(0,m+v):m=Math.min(m,v-1),f<0?f=Math.max(0,f+v):f=Math.min(f,v-1);let I=0;for(let j=0;j<v;++j)m<=f&&j>=m&&j<=f&&P(x[j],j)||f<m&&(j<=f||j>=m)&&P(x[j],j)?I++:I>0&&(x[j-I]=x[j]);return I>0&&(x.length=v-I),I}h.removeAllWhere=Ro}(i.ArrayExt||(i.ArrayExt={}));function*e(...h){for(let y of h)yield*y}function*t(){}function*n(h,y=0){for(let C of h)yield[y++,C]}function*s(h,y){let C=0;for(let k of h)y(k,C++)&&(yield k)}function r(h,y){let C=0;for(let k of h)if(y(k,C++))return k}function a(h,y){let C=0;for(let k of h)if(y(k,C++))return C-1;return-1}function o(h,y){let C;for(let k of h){if(C===void 0){C=k;continue}y(k,C)<0&&(C=k)}return C}function u(h,y){let C;for(let k of h){if(C===void 0){C=k;continue}y(k,C)>0&&(C=k)}return C}function c(h,y){let C=!0,k,N;for(let G of h)C?(k=G,N=G,C=!1):y(G,k)<0?k=G:y(G,N)>0&&(N=G);return C?void 0:[k,N]}function d(h){return Array.from(h)}function l(h){let y={};for(let[C,k]of h)y[C]=k;return y}function p(h,y){let C=0;for(let k of h)if(y(k,C++)===!1)return}function _(h,y){let C=0;for(let k of h)if(y(k,C++)===!1)return!1;return!0}function g(h,y){let C=0;for(let k of h)if(y(k,C++))return!0;return!1}function*M(h,y){let C=0;for(let k of h)yield y(k,C++)}function*S(h,y,C){y===void 0?(y=h,h=0,C=1):C===void 0&&(C=1);let k=R.rangeLength(h,y,C);for(let N=0;N<k;N++)yield h+C*N}var R;(function(h){function y(C,k,N){return N===0?1/0:C>k&&N>0||C<k&&N<0?0:Math.ceil((k-C)/N)}h.rangeLength=y})(R||(R={}));function q(h,y,C){let k=h[Symbol.iterator](),N=0,G=k.next();if(G.done&&C===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(G.done)return C;let z=k.next();if(z.done&&C===void 0)return G.value;if(z.done)return y(C,G.value,N++);let F;C===void 0?F=y(G.value,z.value,N++):F=y(y(C,G.value,N++),z.value,N++);let Z;for(;!(Z=k.next()).done;)F=y(F,Z.value,N++);return F}function*b(h,y){for(;0<y--;)yield h}function*w(h){yield h}function*O(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=[],C=new Set,k=new Map;for(let z of h)N(z);for(let[z]of k)G(z);return y;function N(z){let[F,Z]=z,$=k.get(Z);$?$.push(F):k.set(Z,[F])}function G(z){if(C.has(z))return;C.add(z);let F=k.get(z);if(F)for(let Z of F)G(Z);y.push(z)}}function*T(h,y){let C=0;for(let k of h)C++%y===0&&(yield k)}i.StringExt=void 0,function(h){function y(z,F,Z=0){let $=new Array(F.length);for(let te=0,Y=Z,ue=F.length;te<ue;++te,++Y){if(Y=z.indexOf(F[te],Y),Y===-1)return null;$[te]=Y}return $}h.findIndices=y;function C(z,F,Z=0){let $=y(z,F,Z);if(!$)return null;let te=0;for(let Y=0,ue=$.length;Y<ue;++Y){let Ee=$[Y]-Z;te+=Ee*Ee}return{score:te,indices:$}}h.matchSumOfSquares=C;function k(z,F,Z=0){let $=y(z,F,Z);if(!$)return null;let te=0,Y=Z-1;for(let ue=0,Ee=$.length;ue<Ee;++ue){let Oe=$[ue];te+=Oe-Y-1,Y=Oe}return{score:te,indices:$}}h.matchSumOfDeltas=k;function N(z,F,Z){let $=[],te=0,Y=0,ue=F.length;for(;te<ue;){let Ee=F[te],Oe=F[te];for(;++te<ue&&F[te]===Oe+1;)Oe++;Y<Ee&&$.push(z.slice(Y,Ee)),Ee<Oe+1&&$.push(Z(z.slice(Ee,Oe+1))),Y=Oe+1}return Y<z.length&&$.push(z.slice(Y)),$}h.highlight=N;function G(z,F){return z<F?-1:z>F?1:0}h.cmp=G}(i.StringExt||(i.StringExt={}));function*D(h,y){if(y<1)return;let C=h[Symbol.iterator](),k;for(;0<y--&&!(k=C.next()).done;)yield k.value}function*U(...h){let y=h.map(k=>k[Symbol.iterator]()),C=y.map(k=>k.next());for(;_(C,k=>!k.done);C=y.map(k=>k.next()))yield C.map(k=>k.value)}i.chain=e,i.each=p,i.empty=t,i.enumerate=n,i.every=_,i.filter=s,i.find=r,i.findIndex=a,i.map=M,i.max=u,i.min=o,i.minmax=c,i.once=w,i.range=S,i.reduce=q,i.repeat=b,i.retro=O,i.some=g,i.stride=T,i.take=D,i.toArray=d,i.toObject=l,i.topologicSort=A,i.zip=U})});var ne=E((Wt,Us)=>{(function(i,e){typeof Wt=="object"&&typeof Us!="undefined"?e(Wt,oi()):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(b){return b===null||typeof b=="boolean"||typeof b=="number"||typeof b=="string"}c.isPrimitive=d;function l(b){return Array.isArray(b)}c.isArray=l;function p(b){return!d(b)&&!l(b)}c.isObject=p;function _(b,w){if(b===w)return!0;if(d(b)||d(w))return!1;let O=l(b),A=l(w);return O!==A?!1:O&&A?M(b,w):S(b,w)}c.deepEqual=_;function g(b){return d(b)?b:l(b)?R(b):q(b)}c.deepCopy=g;function M(b,w){if(b===w)return!0;if(b.length!==w.length)return!1;for(let O=0,A=b.length;O<A;++O)if(!_(b[O],w[O]))return!1;return!0}function S(b,w){if(b===w)return!0;for(let O in b)if(b[O]!==void 0&&!(O in w))return!1;for(let O in w)if(w[O]!==void 0&&!(O in b))return!1;for(let O in b){let A=b[O],T=w[O];if(!(A===void 0&&T===void 0)&&(A===void 0||T===void 0||!_(A,T)))return!1}return!0}function R(b){let w=new Array(b.length);for(let O=0,A=b.length;O<A;++O)w[O]=g(b[O]);return w}function q(b){let w={};for(let O in b){let A=b[O];A!==void 0&&(w[O]=g(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(g=>this.resolveRequiredService(g)),_=l.optional.map(g=>this.resolveOptionalService(g));return l.promise=Promise.all([...p,..._]).then(g=>l.activate.apply(void 0,[this.application,...g])).then(g=>{l.service=g,l.activated=!0,l.promise=null}).catch(g=>{throw l.promise=null,g}),l.promise}async activatePlugins(d,l={}){switch(d){case"defer":{let p=this.deferredPlugins.filter(_=>this._plugins.get(_).autoStart).map(_=>this.activatePlugin(_));await Promise.all(p);break}case"startUp":{let _=s.collectStartupPlugins(this._plugins,l).map(async g=>{try{return await this.activatePlugin(g)}catch(M){console.error(`Plugin '${g}' failed to activate.`,M)}});await Promise.all(_);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),_=p.map(g=>this._plugins.get(g));for(let g of _)if(!g.deactivate)throw new TypeError(`Plugin ${g.id}#deactivate() method missing (depends on ${d})`);for(let g of _){let M=[...g.requires,...g.optional].map(S=>{let R=this._services.get(S);return R?this._plugins.get(R).service:null});await g.deactivate(this.application,...M),g.service=null,g.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(_){return console.error(_),null}return p.service}}var s;(function(c){class d{constructor(S){var R,q,b,w;this._activated=!1,this._promise=null,this._service=null,this.id=S.id,this.description=(R=S.description)!==null&&R!==void 0?R:"",this.activate=S.activate,this.deactivate=(q=S.deactivate)!==null&&q!==void 0?q:null,this.provides=(b=S.provides)!==null&&b!==void 0?b:null,this.autoStart=(w=S.autoStart)!==null&&w!==void 0?w:!1,this.requires=S.requires?S.requires.slice():[],this.optional=S.optional?S.optional.slice():[]}get activated(){return this._activated}set activated(S){this._activated=S}get service(){return this._service}set service(S){this._service=S}get promise(){return this._promise}set promise(S){this._promise=S}}function l(M){return new d(M)}c.createPluginData=l;function p(M,S,R){let q=[...M.requires,...M.optional],b=O=>{if(O===M.provides)return!0;let A=R.get(O);if(!A)return!1;let T=S.get(A),D=[...T.requires,...T.optional];return D.length===0?!1:(w.push(A),D.some(b)?!0:(w.pop(),!1))};if(!M.provides||q.length===0)return;let w=[M.id];if(q.some(b))throw new ReferenceError(`Cycle detected: ${w.join(" -> ")}.`)}c.ensureNoCycle=p;function _(M,S,R){let q=new Array,b=D=>{let U=S.get(D),h=[...U.requires,...U.optional];q.push(...h.reduce((y,C)=>{let k=R.get(C);return k&&y.push([D,k]),y},[]))};for(let D of S.keys())b(D);let w=q.filter(D=>D[1]===M),O=0;for(;w.length>O;){let D=w.length,U=new Set(w.map(h=>h[0]));for(let h of U)q.filter(y=>y[1]===h).forEach(y=>{w.includes(y)||w.push(y)});O=D}let A=e.topologicSort(w),T=A.findIndex(D=>D===M);return T===-1?[M]:A.slice(0,T+1)}c.findDependents=_;function g(M,S){let R=new Set;for(let q of M.keys())M.get(q).autoStart===!0&&R.add(q);if(S.startPlugins)for(let q of S.startPlugins)R.add(q);if(S.ignorePlugins)for(let q of S.ignorePlugins)R.delete(q);return Array.from(R)}c.collectStartupPlugins=g})(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 Q=E((Jt,As)=>{(function(i,e){typeof Jt=="object"&&typeof As!="undefined"?e(Jt,oi(),ne()):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(g,M){r.disconnectBetween(g,M)}a.disconnectBetween=o;function u(g){r.disconnectSender(g)}a.disconnectSender=u;function c(g){r.disconnectReceiver(g)}a.disconnectReceiver=c;function d(g){r.disconnectAll(g)}a.disconnectAll=d;function l(g){r.disconnectAll(g)}a.clearData=l;function p(){return r.exceptionHandler}a.getExceptionHandler=p;function _(g){let M=r.exceptionHandler;return r.exceptionHandler=g,M}a.setExceptionHandler=_})(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=D=>{console.error(D)};function o(D,U,h){h=h||void 0;let y=g.get(D.sender);if(y||(y=[],g.set(D.sender,y)),q(y,D,U,h))return!1;let C=h||U,k=M.get(C);k||(k=[],M.set(C,k));let N={signal:D,slot:U,thisArg:h};return y.push(N),k.push(N),!0}a.connect=o;function u(D,U,h){h=h||void 0;let y=g.get(D.sender);if(!y||y.length===0)return!1;let C=q(y,D,U,h);if(!C)return!1;let k=h||U,N=M.get(k);return C.signal=null,w(y),w(N),!0}a.disconnect=u;function c(D,U){let h=g.get(D);if(!h||h.length===0)return;let y=M.get(U);if(!(!y||y.length===0)){for(let C of y)C.signal&&C.signal.sender===D&&(C.signal=null);w(h),w(y)}}a.disconnectBetween=c;function d(D){let U=g.get(D);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.thisArg||h.slot;h.signal=null,w(M.get(y))}w(U)}}a.disconnectSender=d;function l(D){let U=M.get(D);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.signal.sender;h.signal=null,w(g.get(y))}w(U)}}a.disconnectReceiver=l;function p(D){d(D),l(D)}a.disconnectAll=p;function _(D,U){let h=g.get(D.sender);if(!(!h||h.length===0))for(let y=0,C=h.length;y<C;++y){let k=h[y];k.signal===D&&b(k,U)}}a.emit=_;let g=new WeakMap,M=new WeakMap,S=new Set,R=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;function q(D,U,h,y){return e.find(D,C=>C.signal===U&&C.slot===h&&C.thisArg===y)}function b(D,U){let{signal:h,slot:y,thisArg:C}=D;try{y.call(C,h.sender,U)}catch(k){a.exceptionHandler(k)}}function w(D){S.size===0&&R(O),S.add(D)}function O(){S.forEach(A),S.clear()}function A(D){e.ArrayExt.removeAllWhere(D,T)}function T(D){return D.signal===null}})(r||(r={})),i.Signal=n,i.Stream=s})});var Ls=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.ActivityMonitor=void 0;var Ns=Q(),li=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new Ns.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,Ns.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=li});var Fs=E(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0})});var Ks=E(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.LruCache=void 0;var $o=128,ci=class{constructor(e={}){this._map=new Map,this._maxSize=(e==null?void 0:e.maxSize)||$o}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=ci});var $s=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MarkdownCodeBlocks=void 0;var Bs;(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 _=d.indexOf(i.CODE_BLOCK_MARKER),g=d.lastIndexOf(i.CODE_BLOCK_MARKER);_!==g&&(u.code=d.substring(_+i.CODE_BLOCK_MARKER.length,g),u.endLine=c,o.push(u),u=null)}}return o}i.findMarkdownCodeBlocks=s})(Ns||(Gt.MarkdownCodeBlocks=Ns={}))});var Bs=I((ru,Ks)=>{"use strict";function qo(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 zs(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function Fs(i,e){return e==="constructor"&&typeof i[e]=="function"||e==="__proto__"}Ks.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,D=0;D<R.length-1;D++){var A=R[D];if(Fs(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];Fs(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]&&zs(R)?Number(R):R;u(a,w.split("."),T),(n[w]||[]).forEach(function(D){u(a,D.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],_,g;if(/^--.+=/.test(p)){var E=p.match(/^--([^=]+)=([\s\S]*)$/);_=E[1];var S=E[2];t.bools[_]&&(S=S!=="false"),c(_,S,p)}else if(/^--no-.+/.test(p))_=p.match(/^--no-(.+)/)[1],c(_,!1,p);else if(/^--.+/.test(p))_=p.match(/^--(.+)/)[1],g=i[l+1],g!==void 0&&!/^(-|--)[^-]/.test(g)&&!t.bools[_]&&!t.allBools&&(!n[_]||!s(_))?(c(_,g,p),l+=1):/^(true|false)$/.test(g)?(c(_,g==="true",p),l+=1):c(_,t.strings[_]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var O=p.slice(1,-1).split(""),q=!1,b=0;b<O.length;b++){if(g=p.slice(b+2),g==="-"){c(O[b],g,p);continue}if(/[A-Za-z]/.test(O[b])&&g[0]==="="){c(O[b],g.slice(1),p),q=!0;break}if(/[A-Za-z]/.test(O[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(g)){c(O[b],g,p),q=!0;break}if(O[b+1]&&O[b+1].match(/\W/)){c(O[b],p.slice(b+2),p),q=!0;break}else c(O[b],t.strings[O[b]]?"":!0,p)}_=p.slice(-1)[0],!q&&_!=="-"&&(i[l+1]&&!/^(-|--)[^-]/.test(i[l+1])&&!t.bools[_]&&(!n[_]||!s(_))?(c(_,i[l+1],p),l+=1):i[l+1]&&/^(true|false)$/.test(i[l+1])?(c(_,i[l+1]==="true",p),l+=1):c(_,t.strings[_]?"":!0,p))}else if((!t.unknownFn||t.unknownFn(p)!==!1)&&a._.push(t.strings._||!zs(p)?p:Number(p)),e.stopEarly){a._.push.apply(a._,i.slice(l+1));break}}return Object.keys(r).forEach(function(w){qo(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 Yt=I((au,Vs)=>{"use strict";function Oe(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function $s(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),Oe(r),r.length!==0&&(e=r+"/"+e,t=r.charCodeAt(0)===47)}return e=$s(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Oe(e),e.length===0)return".";var t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=$s(e,!t),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return Oe(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];Oe(n),n.length>0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":it.normalize(e)},relative:function(e,t){if(Oe(e),Oe(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),_=t.charCodeAt(a+l);if(p!==_)break;p===47&&(d=l)}var g="";for(l=n+d+1;l<=s;++l)(l===s||e.charCodeAt(l)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(a+d):(a+=d,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(Oe(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');Oe(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){Oe(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){Oe(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;Vs.exports=it});var Js=I((ou,Ws)=>{"use strict";Ws.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 Ys=I(oi=>{"use strict";var Uo=Object.prototype.hasOwnProperty,No;function Hs(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function Gs(i){try{return encodeURIComponent(i)}catch{return null}}function Lo(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var s=Hs(n[1]),r=Hs(n[2]);s===null||r===null||s in t||(t[s]=r)}return t}function zo(i,e){e=e||"";var t=[],n,s;typeof e!="string"&&(e="?");for(s in i)if(Uo.call(i,s)){if(n=i[s],!n&&(n===null||n===No||isNaN(n))&&(n=""),s=Gs(s),n=Gs(n),s===null||n===null)continue;t.push(s+"="+n)}return t.length?e+t.join("&"):""}oi.stringify=zo;oi.parse=Lo});var sr=I((cu,ir)=>{"use strict";var Zs=Js(),Xt=Ys(),Fo=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Qs=/[\n\r\t]/g,Ko=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,er=/:\d+$/,Bo=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,$o=/^[a-zA-Z]:/;function ci(i){return(i||"").toString().replace(Fo,"")}var li=[["#","hash"],["?","query"],function(e,t){return De(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]],Xs={hash:1,query:1};function tr(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 je(unescape(i.pathname),{});else if(s==="string"){n=new je(i,{});for(r in Xs)delete n[r]}else if(s==="object"){for(r in i)r in Xs||(n[r]=i[r]);n.slashes===void 0&&(n.slashes=Ko.test(i.href))}return n}function De(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function nr(i,e){i=ci(i),i=i.replace(Qs,""),e=e||{};var t=Bo.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)):De(n)?o=t[4]:n?s&&(o=o.slice(2)):a>=2&&De(e.protocol)&&(o=t[4]),{protocol:n,slashes:s||De(n),slashesCount:a,rest:o}}function Vo(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 je(i,e,t){if(i=ci(i),i=i.replace(Qs,""),!(this instanceof je))return new je(i,e,t);var n,s,r,a,o,u,c=li.slice(),d=typeof e,l=this,p=0;for(d!=="object"&&d!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=Xt.parse),e=tr(e),s=nr(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||!De(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=Vo(l.pathname,e.pathname)),l.pathname.charAt(0)!=="/"&&De(l.protocol)&&(l.pathname="/"+l.pathname),Zs(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:"&&De(l.protocol)&&l.host?l.protocol+"//"+l.host:"null",l.href=l.toString()}function Wo(i,e,t){var n=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||Xt.parse)(e)),n[i]=e;break;case"port":n[i]=e,Zs(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,er.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<li.length;a++){var o=li[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:"&&De(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Jo(i){(!i||typeof i!="function")&&(i=Xt.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||De(t.protocol)?"//":"");return t.username?(r+=t.username,t.password&&(r+=":"+t.password),r+="@"):t.password?(r+=":"+t.password,r+="@"):t.protocol!=="file:"&&De(t.protocol)&&!n&&t.pathname!=="/"&&(r+="@"),(n[n.length-1]===":"||er.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}je.prototype={set:Wo,toString:Jo};je.extractProtocol=nr;je.location=tr;je.trimLeft=ci;je.qs=Xt;ir.exports=je});var di=I(st=>{"use strict";var Ho=st&&st.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(st,"__esModule",{value:!0});st.URLExt=void 0;var Go=Yt(),Zt=Ho(sr()),rr;(function(i){function e(c){if(typeof document!="undefined"&&document){let d=document.createElement("a");return d.href=c,d}return(0,Zt.default)(c)}i.parse=e;function t(c){return(0,Zt.default)(c).hostname}i.getHostName=t;function n(c){return c&&e(c).toString()}i.normalize=n;function s(...c){let d=(0,Zt.default)(c[0],{}),l=d.protocol===""&&d.slashes;l&&(d=(0,Zt.default)(c[0],"https:"+c[0]));let p=`${l?"":d.protocol}${d.slashes?"//":""}${d.auth}${d.auth?"@":""}${d.host}`,_=Go.posix.join(`${p&&d.pathname[0]!=="/"?"/":""}${d.pathname}`,...c.slice(1));return`${p}${_==="."?"":_}`}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,_]=l.split("=");return p.length>0&&(d[p]=decodeURIComponent(_||"")),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})(rr||(st.URLExt=rr={}))});var ar=I((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=ne(),minimist_1=__importDefault(Bs()),url_1=di(),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=Yt(),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 lr=I(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.PathExt=void 0;var Ve=Yt(),or;(function(i){function e(...l){let p=Ve.posix.join(...l);return p==="."?"":d(p)}i.join=e;function t(...l){let p=Ve.posix.join(...l);return p==="."?"":p}i.joinWithLeadingSlash=t;function n(l,p){return Ve.posix.basename(l,p)}i.basename=n;function s(l){let p=d(Ve.posix.dirname(l));return p==="."?"":p}i.dirname=s;function r(l){return Ve.posix.extname(l)}i.extname=r;function a(l){return l===""?"":d(Ve.posix.normalize(l))}i.normalize=a;function o(...l){return d(Ve.posix.resolve(...l))}i.resolve=o;function u(l,p){return d(Ve.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})(or||(Qt.PathExt=or={}))});var cr=I(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.signalToPromise=Xo;var Yo=ne();function Xo(i,e){let t=new Yo.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 ur=I(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.Text=void 0;var dr;(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})(dr||(en.Text=dr={}))});var hr=I(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Time=void 0;var Zo=[{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}],pr;(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 Zo){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})(pr||(tn.Time=pr={}))});var X=I(oe=>{"use strict";var Qo=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]}),Te=oe&&oe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Qo(e,i,t)};Object.defineProperty(oe,"__esModule",{value:!0});Te(Ts(),oe);Te(As(),oe);Te(Us(),oe);Te(Ls(),oe);Te(ar(),oe);Te(lr(),oe);Te(cr(),oe);Te(ur(),oe);Te(hr(),oe);Te(di(),oe)});var rt=I(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.supportedKernelWebSocketProtocols=void 0;B.createMessage=tl;B.isStreamMsg=nl;B.isDisplayDataMsg=il;B.isUpdateDisplayDataMsg=sl;B.isExecuteInputMsg=rl;B.isExecuteResultMsg=al;B.isErrorMsg=ol;B.isStatusMsg=ll;B.isClearOutputMsg=cl;B.isDebugEventMsg=dl;B.isCommOpenMsg=ul;B.isCommCloseMsg=pl;B.isCommMsgMsg=hl;B.isInfoRequestMsg=fl;B.isExecuteReplyMsg=ml;B.isDebugRequestMsg=gl;B.isDebugReplyMsg=_l;B.isInputRequestMsg=vl;B.isInputReplyMsg=yl;var el=ne();function tl(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:el.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 nl(i){return i.header.msg_type==="stream"}function il(i){return i.header.msg_type==="display_data"}function sl(i){return i.header.msg_type==="update_display_data"}function rl(i){return i.header.msg_type==="execute_input"}function al(i){return i.header.msg_type==="execute_result"}function ol(i){return i.header.msg_type==="error"}function ll(i){return i.header.msg_type==="status"}function cl(i){return i.header.msg_type==="clear_output"}function dl(i){return i.header.msg_type==="debug_event"}function ul(i){return i.header.msg_type==="comm_open"}function pl(i){return i.header.msg_type==="comm_close"}function hl(i){return i.header.msg_type==="comm_msg"}function fl(i){return i.header.msg_type==="kernel_info_request"}function ml(i){return i.header.msg_type==="execute_reply"}function gl(i){return i.header.msg_type==="debug_request"}function _l(i){return i.header.msg_type==="debug_reply"}function vl(i){return i.header.msg_type==="input_request"}function yl(i){return i.header.msg_type==="input_reply"}var fr;(function(i){i.v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"})(fr||(B.supportedKernelWebSocketProtocols=fr={}))});var gr=I(qe=>{"use strict";var wl=qe&&qe.__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]}),bl=qe&&qe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Sl=qe&&qe.__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)&&wl(e,i,t);return bl(e,i),e};Object.defineProperty(qe,"__esModule",{value:!0});qe.serialize=xl;qe.deserialize=Cl;var mr=Sl(rt());function xl(i,e=""){switch(e){case mr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return at.serializeV1KernelWebsocketJupyterOrg(i);default:return at.serializeDefault(i)}}function Cl(i,e=""){switch(e){case mr.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 b=0;b<d;b++)l.push(Number(c.getBigUint64(8*(b+1),!0)));let p=new TextDecoder("utf8"),_=p.decode(o.slice(l[0],l[1])),g=JSON.parse(p.decode(o.slice(l[1],l[2]))),E=JSON.parse(p.decode(o.slice(l[2],l[3]))),S=JSON.parse(p.decode(o.slice(l[3],l[4]))),O=JSON.parse(p.decode(o.slice(l[4],l[5]))),q=[];for(let b=5;b<l.length-1;b++)q.push(new DataView(o.slice(l[b],l[b+1])));return u={channel:_,header:g,parent_header:E,metadata:S,content:O,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:[],_=5+p.length+1,g=[];g.push(8*(1+_)),g.push(o.channel.length+g[g.length-1]);let E=new TextEncoder,S=E.encode(o.channel),O=E.encode(u),q=E.encode(c),b=E.encode(d),w=E.encode(l),R=new Uint8Array(S.length+O.length+q.length+b.length+w.length);R.set(S),R.set(O,S.length),R.set(q,S.length+O.length),R.set(b,S.length+O.length+q.length),R.set(w,S.length+O.length+q.length+b.length);for(let h of[O.length,q.length,b.length,w.length])g.push(h+g[g.length-1]);let U=0;for(let h of p){let y=h.byteLength;g.push(y+g[g.length-1]),U+=y}let T=new Uint8Array(8*(1+_)+R.byteLength+U),D=new ArrayBuffer(8),A=new DataView(D);A.setBigUint64(0,BigInt(_),!0),T.set(new Uint8Array(D),0);for(let h=0;h<g.length;h++)A.setBigUint64(0,BigInt(g[h]),!0),T.set(new Uint8Array(D),8*(h+1));T.set(R,g[0]);for(let h=0;h<p.length;h++){let y=p[h];T.set(new Uint8Array(ArrayBuffer.isView(y)?y.buffer:y),g[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 _=1;_<=c;_++)d.push(u.getUint32(_*4));let l=new Uint8Array(o.slice(d[0],d[1])),p=JSON.parse(new TextDecoder("utf8").decode(l));p.buffers=[];for(let _=1;_<c;_++){let g=d[_],E=d[_+1]||o.byteLength;p.buffers.push(new DataView(o.slice(g,E)))}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 S=0;S<l.length;S++){let O=l[S];c.push(ArrayBuffer.isView(O)?O.buffer:O)}let _=c.length;u.push(4*(_+1));for(let S=0;S+1<c.length;S++)u.push(u[u.length-1]+c[S].byteLength);let g=new Uint8Array(u[u.length-1]+c[c.length-1].byteLength),E=new DataView(g.buffer);E.setUint32(0,_);for(let S=0;S<u.length;S++)E.setUint32(4*(S+1),u[S]);for(let S=0;S<c.length;S++)g.set(new Uint8Array(c[S]),u[S]);return g.buffer}})(at||(at={}))});var _r=I(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.default=WebSocket});var pe=I(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.ServerConnection=void 0;var We=X(),vr=gr(),hi;typeof window=="undefined"?hi=_r():hi=WebSocket;var fi;(function(i){function e(r){return nn.makeSettings(r)}i.makeSettings=e;function t(r,a,o){return nn.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})(fi||(sn.ServerConnection=fi={}));var nn;(function(i){function e(s={}){var r;let a=We.PageConfig.getBaseUrl(),o=We.PageConfig.getWsUrl(),u=We.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=We.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||We.URLExt.getHostName(a)!==We.URLExt.getHostName(c):l=d==="true",{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:hi,token:We.PageConfig.getToken(),appUrl:We.PageConfig.getOption("appUrl"),appendToken:l,serializer:{serialize:vr.serialize,deserialize:vr.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 fi.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]}})(nn||(nn={}))});var Ze=I(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.BaseManager=void 0;var yr=Q(),kl=pe(),mi=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new yr.Signal(this),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:kl.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),yr.Signal.clearData(this))}};rn.BaseManager=mi});var br=I(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.ConfigWithDefaults=Je.ConfigSection=Je.ConfigSectionManager=void 0;var Pl=X(),ot=Ke(),El="api/config",gi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ot.ServerConnection.makeSettings()}async create(e){let t=new an({...e,serverSettings:this.serverSettings});return await t.load(),t}};Je.ConfigSectionManager=gi;var wr;(function(i){async function e(s){if(!t){let a=new an(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})(wr||(Je.ConfigSection=wr={}));var an=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=Pl.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}},_i=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}};Je.ConfigWithDefaults=_i});var Sr=I(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.ConnectionStatus=void 0;var vi=class{constructor(){this.isConnected=!0}};on.ConnectionStatus=vi});var cn=I((ln,xr)=>{(function(i,e){typeof ln=="object"&&typeof xr!="undefined"?e(ln,Q()):typeof define=="function"&&define.amd?define(["exports","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_disposable={},i.lumino_signaling))})(ln,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 vt=I(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.validateProperty=Ml;function Ml(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 Cr=I(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.validateContentsModel=Il;dn.validateCheckpointModel=Rl;var Ae=vt();function Il(i){(0,Ae.validateProperty)(i,"name","string"),(0,Ae.validateProperty)(i,"path","string"),(0,Ae.validateProperty)(i,"type","string"),(0,Ae.validateProperty)(i,"created","string"),(0,Ae.validateProperty)(i,"last_modified","string"),(0,Ae.validateProperty)(i,"mimetype","object"),(0,Ae.validateProperty)(i,"content","object"),(0,Ae.validateProperty)(i,"format","object")}function Rl(i){(0,Ae.validateProperty)(i,"id","string"),(0,Ae.validateProperty)(i,"last_modified","string")}});var xi=I(le=>{"use strict";var Ol=le&&le.__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]}),Dl=le&&le.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),jl=le&&le.__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)&&Ol(e,i,t);return Dl(e,i),e};Object.defineProperty(le,"__esModule",{value:!0});le.RestContentProvider=le.Drive=le.ContentsManager=le.Contents=void 0;var he=X(),Tl=cn(),yt=Q(),V=Ke(),Be=jl(Cr()),ql="api/contents",Al="files",kr;(function(i){function e(n){Be.validateContentsModel(n)}i.validateContentsModel=e;function t(n){Be.validateCheckpointModel(n)}i.validateCheckpointModel=t})(kr||(le.Contents=kr={}));var wi=class{constructor(e={}){var t,n;this._isDisposed=!1,this._additionalDrives=new Map,this._fileChanged=new yt.Signal(this);let s=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:V.ServerConnection.makeSettings();this._defaultDrive=(n=e.defaultDrive)!==null&&n!==void 0?n:new un({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,yt.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])?he.PathExt.removeSlash(e):he.PathExt.join(n.slice(1).join(":"),...t.slice(1))}normalize(e){let t=e.split(":");return t.length===1?he.PathExt.normalize(e):`${t[0]}:${he.PathExt.normalize(t.slice(1).join(":"))}`}resolvePath(e,t){let n=this.driveName(e),s=this.localPath(e),r=he.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:he.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?he.PathExt.removeSlash(t):`${e.name}:${he.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})}}};le.ContentsManager=wi;var un=class{constructor(e={}){var t,n,s;this._isDisposed=!1,this._fileChanged=new yt.Signal(this),this.name=(t=e.name)!==null&&t!==void 0?t:"Default",this._apiEndpoint=(n=e.apiEndpoint)!==null&&n!==void 0?n:ql,this.serverSettings=(s=e.serverSettings)!==null&&s!==void 0?s:V.ServerConnection.makeSettings();let r=new pn({apiEndpoint:this._apiEndpoint,serverSettings:this.serverSettings});this.contentProviderRegistry=new Si({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,yt.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=he.URLExt.join(t,Al,he.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=bi.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 V.ServerConnection.makeRequest(r,a,s);if(o.status!==201)throw await V.ServerConnection.ResponseError.create(o);let u=await o.json();return Be.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 V.ServerConnection.makeRequest(t,s,n);if(r.status!==204)throw await V.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 V.ServerConnection.makeRequest(s,r,n);if(a.status!==200)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return Be.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 V.ServerConnection.makeRequest(s,r,n);if(a.status!==201)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return Be.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 V.ServerConnection.makeRequest(t,n,this.serverSettings);if(s.status!==201)throw await V.ServerConnection.ResponseError.create(s);let r=await s.json();return Be.validateCheckpointModel(r),r}async listCheckpoints(e){let t=this._getUrl(e,"checkpoints"),n=await V.ServerConnection.makeRequest(t,{},this.serverSettings);if(n.status!==200)throw await V.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++)Be.validateCheckpointModel(s[r]);return s}async restoreCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"POST"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}async deleteCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"DELETE"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}_getUrl(...e){let t=e.map(s=>he.URLExt.encodeParts(s)),n=this.serverSettings.baseUrl;return he.URLExt.join(n,this._apiEndpoint,...t)}};le.Drive=un;var bi;(function(i){function e(t){return t.length>0&&t.indexOf(".")!==0&&(t=`.${t}`),t}i.normalizeExtension=e})(bi||(bi={}));var Si=class{constructor(e){this._providers=new Map,this._fileChanged=new yt.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 Tl.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}},pn=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+=he.URLExt.objectToQueryString(c)}let s=this._options.serverSettings,r=await V.ServerConnection.makeRequest(n,{},s);if(r.status!==200)throw await V.ServerConnection.ResponseError.create(r);let a=await r.json();return Be.validateContentsModel(a),a}async save(e,t={}){let n=this._options.serverSettings,s=this._getUrl(e),a={method:"PUT",body:new File([JSON.stringify(t)],"data.json",{type:"application/json"})},o=await V.ServerConnection.makeRequest(s,a,n);if(o.status!==200&&o.status!==201)throw await V.ServerConnection.ResponseError.create(o);let u=await o.json();return Be.validateContentsModel(u),u}_getUrl(...e){let t=e.map(s=>he.URLExt.encodeParts(s)),n=this._options.serverSettings.baseUrl;return he.URLExt.join(n,this._options.apiEndpoint,...t)}};le.RestContentProvider=pn});var Qe=I((hn,Pr)=>{(function(i,e){typeof hn=="object"&&typeof Pr!="undefined"?e(hn,ne(),Q()):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))})(hn,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 _=()=>{this.isDisposed||this.tick!==l.promise||this._execute()};this._timeout=setTimeout(_,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:_,interval:g,max:E}=l;if(g===n.NEVER)return g;let S=_===!0?u.DEFAULT_BACKOFF:_===!1?1:_,O=d(g,p.interval*S);return Math.min(E,O)}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:_}=this;if(p.phase==="resolved"){this.payload=new e.PromiseDelegate,_.resolve(p.payload);return}if(p.phase==="rejected"||p.phase==="stopped"){this.payload=new e.PromiseDelegate,_.promise.catch(g=>{}),_.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 ki=I(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.EventManager=void 0;var Er=X(),Ul=Qe(),Mr=Q(),Ir=pe(),Rr="api/events",Ci=class{constructor(e={}){var t,n;this._socket=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ir.ServerConnection.makeSettings(),this._poll=new Ul.Poll({factory:()=>this._subscribe(),standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._stream=new Mr.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()),Mr.Signal.clearData(this),this._stream.stop()}async emit(e){let{serverSettings:t}=this,{baseUrl:n}=t,{makeRequest:s,ResponseError:r}=Ir.ServerConnection,a=Er.URLExt.join(n,Rr),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=Er.URLExt.join(a,Rr,"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))})}};fn.EventManager=Ci});var Pi=I(xe=>{"use strict";var Nl=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]}),Ll=xe&&xe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),zl=xe&&xe.__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)&&Nl(e,i,t);return Ll(e,i),e};Object.defineProperty(xe,"__esModule",{value:!0});xe.CommHandler=xe.CommsOverSubshells=void 0;var Fl=ne(),Kl=cn(),mn=zl(rt()),lt;(function(i){i.Disabled="disabled",i.PerComm="perComm",i.PerCommTarget="perCommTarget"})(lt||(xe.CommsOverSubshells=lt={}));var gn=class i extends Kl.DisposableDelegate{constructor(e,t,n,s,r){super(s),this._subshellStarted=new Fl.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:lt.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===lt.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=mn.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=mn.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=mn.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=mn.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(){let e=this._kernel.id;i._commTargetSubShellsId.hasOwnProperty(e)&&delete i._commTargetSubShellsId[e]}async _maybeStartSubshell(){if(await this._kernel.info,!this._kernel.supportsSubshells)return;if(this._commsOverSubshells===lt.PerComm){let n=await this._kernel.requestCreateSubshell({}).done;this._subshellId=n.content.subshell_id,this._subshellStarted.resolve();return}let e=this._kernel.id;i._commTargetSubShellsId.hasOwnProperty(e)||(i._commTargetSubShellsId[e]={});let t=i._commTargetSubShellsId[e];t[this._target]?(this._subshellId=await t[this._target],this._subshellStarted.resolve()):(t[this._target]=this._kernel.requestCreateSubshell({}).done.then(n=>(this._subshellId=n.content.subshell_id,this._subshellId)),await t[this._target],this._subshellStarted.resolve())}_maybeCloseSubshell(){if(this._commsOverSubshells!==lt.PerComm){this._subshellId=null;return}this._subshellId&&this._kernel.status!=="dead"&&this._kernel.requestDeleteSubshell({subshell_id:this._subshellId},!0),this._subshellId=null}};xe.CommHandler=gn;gn._commTargetSubShellsId={}});var Dr=I(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0})});var _n=I(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.validateMessage=Vl;wt.validateModel=Tr;wt.validateModels=Jl;var et=vt(),jr=["username","version","session","msg_id","msg_type"],Bl={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<jr.length;e++)(0,et.validateProperty)(i,jr[e],"string")}function Vl(i){(0,et.validateProperty)(i,"metadata","object"),(0,et.validateProperty)(i,"content","object"),(0,et.validateProperty)(i,"channel","string"),$l(i.header),i.channel==="iopub"&&Wl(i)}function Wl(i){if(i.channel==="iopub"){let e=Bl[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 Tr(i){(0,et.validateProperty)(i,"name","string"),(0,et.validateProperty)(i,"id","string")}function Jl(i){if(!Array.isArray(i))throw new Error("Invalid kernel list");i.forEach(e=>Tr(e))}});var yn=I(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.KernelAPIClient=ie.KERNEL_SERVICE_URL=void 0;ie.listRunning=qr;ie.startNew=Ar;ie.restartKernel=Ur;ie.interruptKernel=Nr;ie.shutdownKernel=Lr;ie.getKernelModel=zr;var ee=pe(),ct=X(),vn=_n();ie.KERNEL_SERVICE_URL="api/kernels";async function qr(i=ee.ServerConnection.makeSettings()){let e=ct.URLExt.join(i.baseUrl,ie.KERNEL_SERVICE_URL),t=await ee.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await ee.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,vn.validateModels)(n),n}async function Ar(i={},e=ee.ServerConnection.makeSettings()){let t=ct.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await ee.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await ee.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,vn.validateModel)(r),r}async function Ur(i,e=ee.ServerConnection.makeSettings()){let t=ct.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i),"restart"),n={method:"POST"},s=await ee.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await ee.ServerConnection.ResponseError.create(s);let r=await s.json();(0,vn.validateModel)(r)}async function Nr(i,e=ee.ServerConnection.makeSettings()){let t=ct.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i),"interrupt"),n={method:"POST"},s=await ee.ServerConnection.makeRequest(t,n,e);if(s.status!==204)throw await ee.ServerConnection.ResponseError.create(s)}async function Lr(i,e=ee.ServerConnection.makeSettings()){let t=ct.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i)),n={method:"DELETE"},s=await ee.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 ee.ServerConnection.ResponseError.create(s)}async function zr(i,e=ee.ServerConnection.makeSettings()){let t=ct.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i)),n=await ee.ServerConnection.makeRequest(t,{},e);if(n.status===404)return;if(n.status!==200)throw await ee.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,vn.validateModel)(s),s}var Ei=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ee.ServerConnection.makeSettings()}async listRunning(){return qr(this.serverSettings)}async getModel(e){return zr(e,this.serverSettings)}async startNew(e={}){return Ar(e,this.serverSettings)}async restart(e){return Ur(e,this.serverSettings)}async interrupt(e){return Nr(e,this.serverSettings)}async shutdown(e){return Lr(e,this.serverSettings)}};ie.KernelAPIClient=Ei});var Kr=I(ye=>{"use strict";var Hl=ye&&ye.__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=ye&&ye.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Yl=ye&&ye.__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(ye,"__esModule",{value:!0});ye.KernelShellFutureHandler=ye.KernelControlFutureHandler=ye.KernelFutureHandler=void 0;var Fr=ne(),Xl=cn(),Zl=Yl(rt()),bt=class extends Xl.DisposableDelegate{constructor(e,t,n,s,r){super(e),this._status=0,this._stdin=se.noOp,this._iopub=se.noOp,this._reply=se.noOp,this._done=new Fr.PromiseDelegate,this._hooks=new se.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(se.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=se.noOp,this._iopub=se.noOp,this._reply=se.noOp,this._hooks=null,this._testFlag(se.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(se.KernelFutureFlag.GotReply),this._testFlag(se.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(se.KernelFutureFlag.GotIdle),this._testFlag(se.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(se.KernelFutureFlag.IsDone)||(this._setFlag(se.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return(this._status&e)!==0}_setFlag(e){this._status|=e}};ye.KernelFutureHandler=bt;var Mi=class extends bt{};ye.KernelControlFutureHandler=Mi;var Ii=class extends bt{};ye.KernelShellFutureHandler=Ii;var se;(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 Fr.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={}))})(se||(se={}))});var $r=I(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.validateSpecModel=Br;wn.validateSpecModels=Ql;var tt=vt();function Br(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]]=Br(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 xt=I(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.KernelSpecAPIClient=void 0;St.getSpecs=Vr;var bn=pe(),ec=$r(),tc=X(),nc="api/kernelspecs";async function Vr(i=bn.ServerConnection.makeSettings()){let e=tc.URLExt.join(i.baseUrl,nc),t=await bn.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await bn.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,ec.validateSpecModels)(n)}var Ri=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:bn.ServerConnection.makeSettings()}async get(){return Vr(this.serverSettings)}};St.KernelSpecAPIClient=Ri});var Di=I(Ue=>{"use strict";var ic=Ue&&Ue.__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]}),sc=Ue&&Ue.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Yr=Ue&&Ue.__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)&&ic(e,i,t);return sc(e,i),e};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.KernelConnection=void 0;var Wr=X(),He=ne(),Ge=Q(),Ct=Ke(),Jr=Pi(),re=Yr(rt()),Hr=Kr(),rc=Yr(_n()),Gr=yn(),ac=xt(),oc=3e3,dt="_RESTARTING_",lc="",Oi=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=Wr.URLExt.join(l.wsUrl,Gr.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),_=p.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${_}`);let g=Wr.URLExt.join(p,"channels?session_id="+encodeURIComponent(this._clientId)),E=l.token;l.appendToken&&E!==""&&(g=g+`&token=${encodeURIComponent(E)}`);let S=d?this._supportedProtocols:[];this._ws=new l.WebSocket(g,S),this._ws.binaryType="arraybuffer";let O=!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 Ct.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 D=Ce.getRandomIntInclusive(10,30)*1e3;setTimeout(q,D,w)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},b=async w=>{O||(O=!0,await q(w))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=b,this._ws.onerror=b},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),rc.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(re.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._commsOverSubshells=Ct.CommsOverSubshells.PerCommTarget,this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new He.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new Ge.Signal(this),this._connectionStatusChanged=new Ge.Signal(this),this._disposed=new Ge.Signal(this),this._iopubMessage=new Ge.Signal(this),this._anyMessage=new Ge.Signal(this),this._pendingInput=new Ge.Signal(this),this._unhandledMessage=new Ge.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:Ct.ServerConnection.makeSettings(),this._kernelAPIClient=(n=e.kernelAPIClient)!==null&&n!==void 0?n:new Gr.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(s=e.kernelSpecAPIClient)!==null&&s!==void 0?s:new ac.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._clientId=(r=e.clientId)!==null&&r!==void 0?r:He.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:Ct.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:Ct.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(),Ge.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(Hr.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Hr.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===lc||this._kernelSession===dt)&&re.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!==dt)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=dt,await this._kernelAPIClient.restart(this.id),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();let e=new He.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=re.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{}}),t;try{t=await Ce.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=re.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Ce.handleShellMessage(this,t)}requestInspect(e){let t=re.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Ce.handleShellMessage(this,t)}requestHistory(e){let t=re.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Ce.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=re.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=re.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=re.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=re.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=re.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=re.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Ce.handleShellMessage(this,t)}requestCommInfo(e){let t=re.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Ce.handleShellMessage(this,t)}sendInputReply(e,t){let n=re.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=He.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 Jr.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:He.JSONExt.deepCopy(t.header),parent_header:He.JSONExt.deepCopy(t.parent_header),metadata:He.JSONExt.deepCopy(t.metadata),content:He.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,Ce.logKernelStatus(this),this._statusChanged.emit(e),e==="dead"&&this.dispose())}_sendPending(){for(;this.connectionStatus==="connected"&&this._kernelSession!==dt&&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 Jr.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 Ce.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===dt,n=this.requestKernelInfo(),s=!1,r=()=>{s||(s=!0,t&&this._kernelSession===dt&&(this._kernelSession=""),clearTimeout(a),this._pendingMessages.length>0&&this._sendPending())};n.then(r);let a=setTimeout(r,oc)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let s=!1;if(e.parent_header&&e.channel==="iopub"&&(re.isDisplayDataMsg(e)||re.isUpdateDisplayDataMsg(e)||re.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=Ce.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)}};Ue.KernelConnection=Oi;var Ce;(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})(Ce||(Ce={}))});var Qr=I(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.KernelManager=void 0;var cc=Qe(),Xr=Q(),Zr=Ke(),dc=Ze(),uc=yn(),pc=Di(),hc=xt(),kt=class extends dc.BaseManager{constructor(e={}){var t,n,s;super(e),this._commsOverSubshells=Zr.CommsOverSubshells.PerCommTarget,this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new Xr.Signal(this),this._connectionFailure=new Xr.Signal(this),this._kernelAPIClient=(t=e.kernelAPIClient)!==null&&t!==void 0?t:new uc.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(n=e.kernelSpecAPIClient)!==null&&n!==void 0?n:new hc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._pollModels=new cc.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 pc.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 Zr.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(()=>{})}};Pt.KernelManager=kt;(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})(kt||(Pt.KernelManager=kt={}))});var Ti=I(H=>{"use strict";var ea=H&&H.__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]}),fc=H&&H.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ji=H&&H.__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)&&ea(e,i,t);return fc(e,i),e},mc=H&&H.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ea(e,i,t)};Object.defineProperty(H,"__esModule",{value:!0});H.CommsOverSubshells=H.KernelConnection=H.KernelAPI=H.KernelMessage=H.Kernel=void 0;var gc=Pi();Object.defineProperty(H,"CommsOverSubshells",{enumerable:!0,get:function(){return gc.CommsOverSubshells}});var _c=ji(Dr());H.Kernel=_c;var vc=ji(rt());H.KernelMessage=vc;var yc=ji(yn());H.KernelAPI=yc;var wc=Di();Object.defineProperty(H,"KernelConnection",{enumerable:!0,get:function(){return wc.KernelConnection}});mc(Qr(),H)});var na=I(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0})});var sa=I(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.KernelSpecManager=void 0;var bc=ne(),Sc=Qe(),ia=Q(),xc=Ze(),Cc=xt(),qi=class extends xc.BaseManager{constructor(e={}){var t,n;super(e),this._isReady=!1,this._connectionFailure=new ia.Signal(this),this._specs=null,this._specsChanged=new ia.Signal(this),this._kernelSpecAPIClient=(t=e.kernelSpecAPIClient)!==null&&t!==void 0?t:new Cc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._ready=Promise.all([this.requestSpecs()]).then(s=>{}).catch(s=>{}).then(()=>{this.isDisposed||(this._isReady=!0)}),this._pollSpecs=new Sc.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||bc.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}};Sn.KernelSpecManager=qi});var Ai=I(fe=>{"use strict";var ra=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]}),kc=fe&&fe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),aa=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)&&ra(e,i,t);return kc(e,i),e},Pc=fe&&fe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ra(e,i,t)};Object.defineProperty(fe,"__esModule",{value:!0});fe.KernelSpecAPI=fe.KernelSpec=void 0;var Ec=aa(na());fe.KernelSpec=Ec;var Mc=aa(xt());fe.KernelSpecAPI=Mc;Pc(sa(),fe)});var oa=I(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.BuildManager=void 0;var Ui=X(),Ye=pe(),Ic="api/build",Ni=class{constructor(e={}){var t;this._url="",this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ye.ServerConnection.makeSettings();let{baseUrl:n,appUrl:s}=this.serverSettings;this._url=Ui.URLExt.join(n,s,Ic)}get isAvailable(){return Ui.PageConfig.getOption("buildAvailable").toLowerCase()==="true"}get shouldCheck(){return Ui.PageConfig.getOption("buildCheck").toLowerCase()==="true"}getStatus(){let{_url:e,serverSettings:t}=this;return Ye.ServerConnection.makeRequest(e,{},t).then(s=>{if(s.status!==200)throw new Ye.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 Ye.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status===400)throw new Ye.ServerConnection.ResponseError(r,"Build aborted");if(r.status!==200){let a=`Build failed with ${r.status}.
|
|
3
|
+
`);else{u=new t(c);let _=d.indexOf(i.CODE_BLOCK_MARKER),g=d.lastIndexOf(i.CODE_BLOCK_MARKER);_!==g&&(u.code=d.substring(_+i.CODE_BLOCK_MARKER.length,g),u.endLine=c,o.push(u),u=null)}}return o}i.findMarkdownCodeBlocks=s})(Bs||(Yt.MarkdownCodeBlocks=Bs={}))});var Hs=E((yu,Js)=>{"use strict";function Vo(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 Vs(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function Ws(i,e){return e==="constructor"&&typeof i[e]=="function"||e==="__proto__"}Js.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(O){return t.bools[O]})}Object.keys(e.alias||{}).forEach(function(w){n[w]=[].concat(e.alias[w]),n[w].forEach(function(O){n[O]=[w].concat(n[w].filter(function(A){return O!==A}))})}),[].concat(e.string).filter(Boolean).forEach(function(w){t.strings[w]=!0,n[w]&&[].concat(n[w]).forEach(function(O){t.strings[O]=!0})});var r=e.default||{},a={_:[]};function o(w,O){return t.allBools&&/^--[^=]+$/.test(O)||t.strings[w]||t.bools[w]||n[w]}function u(w,O,A){for(var T=w,D=0;D<O.length-1;D++){var U=O[D];if(Ws(T,U))return;T[U]===void 0&&(T[U]={}),(T[U]===Object.prototype||T[U]===Number.prototype||T[U]===String.prototype)&&(T[U]={}),T[U]===Array.prototype&&(T[U]=[]),T=T[U]}var h=O[O.length-1];Ws(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]=A:Array.isArray(T[h])?T[h].push(A):T[h]=[T[h],A])}function c(w,O,A){if(!(A&&t.unknownFn&&!o(w,A)&&t.unknownFn(A)===!1)){var T=!t.strings[w]&&Vs(O)?Number(O):O;u(a,w.split("."),T),(n[w]||[]).forEach(function(D){u(a,D.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],_,g;if(/^--.+=/.test(p)){var M=p.match(/^--([^=]+)=([\s\S]*)$/);_=M[1];var S=M[2];t.bools[_]&&(S=S!=="false"),c(_,S,p)}else if(/^--no-.+/.test(p))_=p.match(/^--no-(.+)/)[1],c(_,!1,p);else if(/^--.+/.test(p))_=p.match(/^--(.+)/)[1],g=i[l+1],g!==void 0&&!/^(-|--)[^-]/.test(g)&&!t.bools[_]&&!t.allBools&&(!n[_]||!s(_))?(c(_,g,p),l+=1):/^(true|false)$/.test(g)?(c(_,g==="true",p),l+=1):c(_,t.strings[_]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var R=p.slice(1,-1).split(""),q=!1,b=0;b<R.length;b++){if(g=p.slice(b+2),g==="-"){c(R[b],g,p);continue}if(/[A-Za-z]/.test(R[b])&&g[0]==="="){c(R[b],g.slice(1),p),q=!0;break}if(/[A-Za-z]/.test(R[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(g)){c(R[b],g,p),q=!0;break}if(R[b+1]&&R[b+1].match(/\W/)){c(R[b],p.slice(b+2),p),q=!0;break}else c(R[b],t.strings[R[b]]?"":!0,p)}_=p.slice(-1)[0],!q&&_!=="-"&&(i[l+1]&&!/^(-|--)[^-]/.test(i[l+1])&&!t.bools[_]&&(!n[_]||!s(_))?(c(_,i[l+1],p),l+=1):i[l+1]&&/^(true|false)$/.test(i[l+1])?(c(_,i[l+1]==="true",p),l+=1):c(_,t.strings[_]?"":!0,p))}else if((!t.unknownFn||t.unknownFn(p)!==!1)&&a._.push(t.strings._||!Vs(p)?p:Number(p)),e.stopEarly){a._.push.apply(a._,i.slice(l+1));break}}return Object.keys(r).forEach(function(w){Vo(a,w.split("."))||(u(a,w.split("."),r[w]),(n[w]||[]).forEach(function(O){u(a,O.split("."),r[w])}))}),e["--"]?a["--"]=d.slice():d.forEach(function(w){a._.push(w)}),a}});var Xt=E((wu,Ys)=>{"use strict";function De(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function Gs(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 Wo(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 st={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),De(r),r.length!==0&&(e=r+"/"+e,t=r.charCodeAt(0)===47)}return e=Gs(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(De(e),e.length===0)return".";var t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Gs(e,!t),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return De(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];De(n),n.length>0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":st.normalize(e)},relative:function(e,t){if(De(e),De(t),e===t||(e=st.resolve(e),t=st.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),_=t.charCodeAt(a+l);if(p!==_)break;p===47&&(d=l)}var g="";for(l=n+d+1;l<=s;++l)(l===s||e.charCodeAt(l)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(a+d):(a+=d,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(De(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');De(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){De(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 Wo("/",e)},parse:function(e){De(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};st.posix=st;Ys.exports=st});var Zs=E((bu,Xs)=>{"use strict";Xs.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 tr=E(di=>{"use strict";var Jo=Object.prototype.hasOwnProperty,Ho;function Qs(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function er(i){try{return encodeURIComponent(i)}catch{return null}}function Go(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var s=Qs(n[1]),r=Qs(n[2]);s===null||r===null||s in t||(t[s]=r)}return t}function Yo(i,e){e=e||"";var t=[],n,s;typeof e!="string"&&(e="?");for(s in i)if(Jo.call(i,s)){if(n=i[s],!n&&(n===null||n===Ho||isNaN(n))&&(n=""),s=er(s),n=er(n),s===null||n===null)continue;t.push(s+"="+n)}return t.length?e+t.join("&"):""}di.stringify=Yo;di.parse=Go});var cr=E((xu,lr)=>{"use strict";var ir=Zs(),Zt=tr(),Xo=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,sr=/[\n\r\t]/g,Zo=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,rr=/:\d+$/,Qo=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,el=/^[a-zA-Z]:/;function pi(i){return(i||"").toString().replace(Xo,"")}var ui=[["#","hash"],["?","query"],function(e,t){return je(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]],nr={hash:1,query:1};function ar(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 Te(unescape(i.pathname),{});else if(s==="string"){n=new Te(i,{});for(r in nr)delete n[r]}else if(s==="object"){for(r in i)r in nr||(n[r]=i[r]);n.slashes===void 0&&(n.slashes=Zo.test(i.href))}return n}function je(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function or(i,e){i=pi(i),i=i.replace(sr,""),e=e||{};var t=Qo.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)):je(n)?o=t[4]:n?s&&(o=o.slice(2)):a>=2&&je(e.protocol)&&(o=t[4]),{protocol:n,slashes:s||je(n),slashesCount:a,rest:o}}function tl(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 Te(i,e,t){if(i=pi(i),i=i.replace(sr,""),!(this instanceof Te))return new Te(i,e,t);var n,s,r,a,o,u,c=ui.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=ar(e),s=or(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||el.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!je(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=tl(l.pathname,e.pathname)),l.pathname.charAt(0)!=="/"&&je(l.protocol)&&(l.pathname="/"+l.pathname),ir(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:"&&je(l.protocol)&&l.host?l.protocol+"//"+l.host:"null",l.href=l.toString()}function nl(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,ir(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,rr.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<ui.length;a++){var o=ui[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:"&&je(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function il(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||je(t.protocol)?"//":"");return t.username?(r+=t.username,t.password&&(r+=":"+t.password),r+="@"):t.password?(r+=":"+t.password,r+="@"):t.protocol!=="file:"&&je(t.protocol)&&!n&&t.pathname!=="/"&&(r+="@"),(n[n.length-1]===":"||rr.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}Te.prototype={set:nl,toString:il};Te.extractProtocol=or;Te.location=ar;Te.trimLeft=pi;Te.qs=Zt;lr.exports=Te});var hi=E(rt=>{"use strict";var sl=rt&&rt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(rt,"__esModule",{value:!0});rt.URLExt=void 0;var rl=Xt(),Qt=sl(cr()),dr;(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}`,_=rl.posix.join(`${p&&d.pathname[0]!=="/"?"/":""}${d.pathname}`,...c.slice(1));return`${p}${_==="."?"":_}`}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,_]=l.split("=");return p.length>0&&(d[p]=decodeURIComponent(_||"")),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})(dr||(rt.URLExt=dr={}))});var ur=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=ne(),minimist_1=__importDefault(Hs()),url_1=hi(),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 hr=E(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.PathExt=void 0;var We=Xt(),pr;(function(i){function e(...l){let p=We.posix.join(...l);return p==="."?"":d(p)}i.join=e;function t(...l){let p=We.posix.join(...l);return p==="."?"":p}i.joinWithLeadingSlash=t;function n(l,p){return We.posix.basename(l,p)}i.basename=n;function s(l){let p=d(We.posix.dirname(l));return p==="."?"":p}i.dirname=s;function r(l){return We.posix.extname(l)}i.extname=r;function a(l){return l===""?"":d(We.posix.normalize(l))}i.normalize=a;function o(...l){return d(We.posix.resolve(...l))}i.resolve=o;function u(l,p){return d(We.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})(pr||(en.PathExt=pr={}))});var fr=E(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.signalToPromise=ol;var al=ne();function ol(i,e){let t=new al.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 gr=E(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Text=void 0;var mr;(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})(mr||(tn.Text=mr={}))});var vr=E(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.Time=void 0;var ll=[{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}],_r;(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 ll){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})(_r||(nn.Time=_r={}))});var X=E(oe=>{"use strict";var cl=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]}),qe=oe&&oe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&cl(e,i,t)};Object.defineProperty(oe,"__esModule",{value:!0});qe(Ls(),oe);qe(Fs(),oe);qe(Ks(),oe);qe($s(),oe);qe(ur(),oe);qe(hr(),oe);qe(fr(),oe);qe(gr(),oe);qe(vr(),oe);qe(hi(),oe)});var at=E(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.supportedKernelWebSocketProtocols=void 0;B.createMessage=ul;B.isStreamMsg=pl;B.isDisplayDataMsg=hl;B.isUpdateDisplayDataMsg=fl;B.isExecuteInputMsg=ml;B.isExecuteResultMsg=gl;B.isErrorMsg=_l;B.isStatusMsg=vl;B.isClearOutputMsg=yl;B.isDebugEventMsg=wl;B.isCommOpenMsg=bl;B.isCommCloseMsg=Sl;B.isCommMsgMsg=xl;B.isInfoRequestMsg=Cl;B.isExecuteReplyMsg=kl;B.isDebugRequestMsg=Pl;B.isDebugReplyMsg=El;B.isInputRequestMsg=Ml;B.isInputReplyMsg=Il;var dl=ne();function ul(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:dl.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 pl(i){return i.header.msg_type==="stream"}function hl(i){return i.header.msg_type==="display_data"}function fl(i){return i.header.msg_type==="update_display_data"}function ml(i){return i.header.msg_type==="execute_input"}function gl(i){return i.header.msg_type==="execute_result"}function _l(i){return i.header.msg_type==="error"}function vl(i){return i.header.msg_type==="status"}function yl(i){return i.header.msg_type==="clear_output"}function wl(i){return i.header.msg_type==="debug_event"}function bl(i){return i.header.msg_type==="comm_open"}function Sl(i){return i.header.msg_type==="comm_close"}function xl(i){return i.header.msg_type==="comm_msg"}function Cl(i){return i.header.msg_type==="kernel_info_request"}function kl(i){return i.header.msg_type==="execute_reply"}function Pl(i){return i.header.msg_type==="debug_request"}function El(i){return i.header.msg_type==="debug_reply"}function Ml(i){return i.header.msg_type==="input_request"}function Il(i){return i.header.msg_type==="input_reply"}var yr;(function(i){i.v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"})(yr||(B.supportedKernelWebSocketProtocols=yr={}))});var br=E(Ue=>{"use strict";var Ol=Ue&&Ue.__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]}),Rl=Ue&&Ue.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Dl=Ue&&Ue.__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)&&Ol(e,i,t);return Rl(e,i),e};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.serialize=jl;Ue.deserialize=Tl;var wr=Dl(at());function jl(i,e=""){switch(e){case wr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return ot.serializeV1KernelWebsocketJupyterOrg(i);default:return ot.serializeDefault(i)}}function Tl(i,e=""){switch(e){case wr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return ot.deserializeV1KernelWebsocketJupyterOrg(i);default:return ot.deserializeDefault(i)}}var ot;(function(i){function e(o){let u,c=new DataView(o),d=Number(c.getBigUint64(0,!0)),l=[];for(let b=0;b<d;b++)l.push(Number(c.getBigUint64(8*(b+1),!0)));let p=new TextDecoder("utf8"),_=p.decode(o.slice(l[0],l[1])),g=JSON.parse(p.decode(o.slice(l[1],l[2]))),M=JSON.parse(p.decode(o.slice(l[2],l[3]))),S=JSON.parse(p.decode(o.slice(l[3],l[4]))),R=JSON.parse(p.decode(o.slice(l[4],l[5]))),q=[];for(let b=5;b<l.length-1;b++)q.push(new DataView(o.slice(l[b],l[b+1])));return u={channel:_,header:g,parent_header:M,metadata:S,content:R,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:[],_=5+p.length+1,g=[];g.push(8*(1+_)),g.push(o.channel.length+g[g.length-1]);let M=new TextEncoder,S=M.encode(o.channel),R=M.encode(u),q=M.encode(c),b=M.encode(d),w=M.encode(l),O=new Uint8Array(S.length+R.length+q.length+b.length+w.length);O.set(S),O.set(R,S.length),O.set(q,S.length+R.length),O.set(b,S.length+R.length+q.length),O.set(w,S.length+R.length+q.length+b.length);for(let h of[R.length,q.length,b.length,w.length])g.push(h+g[g.length-1]);let A=0;for(let h of p){let y=h.byteLength;g.push(y+g[g.length-1]),A+=y}let T=new Uint8Array(8*(1+_)+O.byteLength+A),D=new ArrayBuffer(8),U=new DataView(D);U.setBigUint64(0,BigInt(_),!0),T.set(new Uint8Array(D),0);for(let h=0;h<g.length;h++)U.setBigUint64(0,BigInt(g[h]),!0),T.set(new Uint8Array(D),8*(h+1));T.set(O,g[0]);for(let h=0;h<p.length;h++){let y=p[h];T.set(new Uint8Array(ArrayBuffer.isView(y)?y.buffer:y),g[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 _=1;_<=c;_++)d.push(u.getUint32(_*4));let l=new Uint8Array(o.slice(d[0],d[1])),p=JSON.parse(new TextDecoder("utf8").decode(l));p.buffers=[];for(let _=1;_<c;_++){let g=d[_],M=d[_+1]||o.byteLength;p.buffers.push(new DataView(o.slice(g,M)))}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 S=0;S<l.length;S++){let R=l[S];c.push(ArrayBuffer.isView(R)?R.buffer:R)}let _=c.length;u.push(4*(_+1));for(let S=0;S+1<c.length;S++)u.push(u[u.length-1]+c[S].byteLength);let g=new Uint8Array(u[u.length-1]+c[c.length-1].byteLength),M=new DataView(g.buffer);M.setUint32(0,_);for(let S=0;S<u.length;S++)M.setUint32(4*(S+1),u[S]);for(let S=0;S<c.length;S++)g.set(new Uint8Array(c[S]),u[S]);return g.buffer}})(ot||(ot={}))});var Sr=E(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.default=WebSocket});var pe=E(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.ServerConnection=void 0;var Je=X(),xr=br(),gi;typeof window=="undefined"?gi=Sr():gi=WebSocket;var _i;(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})(_i||(rn.ServerConnection=_i={}));var sn;(function(i){function e(s={}){var r;let a=Je.PageConfig.getBaseUrl(),o=Je.PageConfig.getWsUrl(),u=Je.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=Je.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||Je.URLExt.getHostName(a)!==Je.URLExt.getHostName(c):l=d==="true",{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:gi,token:Je.PageConfig.getToken(),appUrl:Je.PageConfig.getOption("appUrl"),appendToken:l,serializer:{serialize:xr.serialize,deserialize:xr.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 _i.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 Qe=E(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.BaseManager=void 0;var Cr=Q(),ql=pe(),vi=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new Cr.Signal(this),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ql.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),Cr.Signal.clearData(this))}};an.BaseManager=vi});var Pr=E(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.ConfigWithDefaults=He.ConfigSection=He.ConfigSectionManager=void 0;var Ul=X(),lt=Be(),Al="api/config",yi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:lt.ServerConnection.makeSettings()}async create(e){let t=new on({...e,serverSettings:this.serverSettings});return await t.load(),t}};He.ConfigSectionManager=yi;var kr;(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})(kr||(He.ConfigSection=kr={}));var on=class{constructor(e){var t;this._url="unknown";let n=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:lt.ServerConnection.makeSettings();this._url=Ul.URLExt.join(n.baseUrl,Al,encodeURIComponent(e.name))}get data(){return this._data}async load(){let e=await lt.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(e.status!==200)throw await lt.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 lt.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(n.status!==200)throw await lt.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}},wi=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}};He.ConfigWithDefaults=wi});var Er=E(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ConnectionStatus=void 0;var bi=class{constructor(){this.isConnected=!0}};ln.ConnectionStatus=bi});var dn=E((cn,Mr)=>{(function(i,e){typeof cn=="object"&&typeof Mr!="undefined"?e(cn,Q()):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 yt=E(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.validateProperty=Nl;function Nl(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 Ir=E(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.validateContentsModel=Ll;un.validateCheckpointModel=zl;var Ae=yt();function Ll(i){(0,Ae.validateProperty)(i,"name","string"),(0,Ae.validateProperty)(i,"path","string"),(0,Ae.validateProperty)(i,"type","string"),(0,Ae.validateProperty)(i,"created","string"),(0,Ae.validateProperty)(i,"last_modified","string"),(0,Ae.validateProperty)(i,"mimetype","object"),(0,Ae.validateProperty)(i,"content","object"),(0,Ae.validateProperty)(i,"format","object")}function zl(i){(0,Ae.validateProperty)(i,"id","string"),(0,Ae.validateProperty)(i,"last_modified","string")}});var Pi=E(le=>{"use strict";var Fl=le&&le.__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]}),Kl=le&&le.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Bl=le&&le.__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)&&Fl(e,i,t);return Kl(e,i),e};Object.defineProperty(le,"__esModule",{value:!0});le.RestContentProvider=le.Drive=le.ContentsManager=le.Contents=void 0;var he=X(),$l=dn(),wt=Q(),V=Be(),$e=Bl(Ir()),Vl="api/contents",Wl="files",Or;(function(i){function e(n){$e.validateContentsModel(n)}i.validateContentsModel=e;function t(n){$e.validateCheckpointModel(n)}i.validateCheckpointModel=t})(Or||(le.Contents=Or={}));var xi=class{constructor(e={}){var t,n;this._isDisposed=!1,this._additionalDrives=new Map,this._fileChanged=new wt.Signal(this);let s=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:V.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,wt.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])?he.PathExt.removeSlash(e):he.PathExt.join(n.slice(1).join(":"),...t.slice(1))}normalize(e){let t=e.split(":");return t.length===1?he.PathExt.normalize(e):`${t[0]}:${he.PathExt.normalize(t.slice(1).join(":"))}`}resolvePath(e,t){let n=this.driveName(e),s=this.localPath(e),r=he.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:he.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?he.PathExt.removeSlash(t):`${e.name}:${he.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})}}};le.ContentsManager=xi;var pn=class{constructor(e={}){var t,n,s;this._isDisposed=!1,this._fileChanged=new wt.Signal(this),this.name=(t=e.name)!==null&&t!==void 0?t:"Default",this._apiEndpoint=(n=e.apiEndpoint)!==null&&n!==void 0?n:Vl,this.serverSettings=(s=e.serverSettings)!==null&&s!==void 0?s:V.ServerConnection.makeSettings();let r=new hn({apiEndpoint:this._apiEndpoint,serverSettings:this.serverSettings});this.contentProviderRegistry=new ki({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,wt.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=he.URLExt.join(t,Wl,he.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=Ci.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 V.ServerConnection.makeRequest(r,a,s);if(o.status!==201)throw await V.ServerConnection.ResponseError.create(o);let u=await o.json();return $e.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 V.ServerConnection.makeRequest(t,s,n);if(r.status!==204)throw await V.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 V.ServerConnection.makeRequest(s,r,n);if(a.status!==200)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return $e.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 V.ServerConnection.makeRequest(s,r,n);if(a.status!==201)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return $e.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 V.ServerConnection.makeRequest(t,n,this.serverSettings);if(s.status!==201)throw await V.ServerConnection.ResponseError.create(s);let r=await s.json();return $e.validateCheckpointModel(r),r}async listCheckpoints(e){let t=this._getUrl(e,"checkpoints"),n=await V.ServerConnection.makeRequest(t,{},this.serverSettings);if(n.status!==200)throw await V.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++)$e.validateCheckpointModel(s[r]);return s}async restoreCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"POST"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}async deleteCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"DELETE"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}_getUrl(...e){let t=e.map(s=>he.URLExt.encodeParts(s)),n=this.serverSettings.baseUrl;return he.URLExt.join(n,this._apiEndpoint,...t)}};le.Drive=pn;var Ci;(function(i){function e(t){return t.length>0&&t.indexOf(".")!==0&&(t=`.${t}`),t}i.normalizeExtension=e})(Ci||(Ci={}));var ki=class{constructor(e){this._providers=new Map,this._fileChanged=new wt.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 $l.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+=he.URLExt.objectToQueryString(c)}let s=this._options.serverSettings,r=await V.ServerConnection.makeRequest(n,{},s);if(r.status!==200)throw await V.ServerConnection.ResponseError.create(r);let a=await r.json();return $e.validateContentsModel(a),a}async save(e,t={}){let n=this._options.serverSettings,s=this._getUrl(e),a={method:"PUT",body:new File([JSON.stringify(t)],"data.json",{type:"application/json"})},o=await V.ServerConnection.makeRequest(s,a,n);if(o.status!==200&&o.status!==201)throw await V.ServerConnection.ResponseError.create(o);let u=await o.json();return $e.validateContentsModel(u),u}_getUrl(...e){let t=e.map(s=>he.URLExt.encodeParts(s)),n=this._options.serverSettings.baseUrl;return he.URLExt.join(n,this._options.apiEndpoint,...t)}};le.RestContentProvider=hn});var et=E((fn,Rr)=>{(function(i,e){typeof fn=="object"&&typeof Rr!="undefined"?e(fn,ne(),Q()):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 _=()=>{this.isDisposed||this.tick!==l.promise||this._execute()};this._timeout=setTimeout(_,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:_,interval:g,max:M}=l;if(g===n.NEVER)return g;let S=_===!0?u.DEFAULT_BACKOFF:_===!1?1:_,R=d(g,p.interval*S);return Math.min(M,R)}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:_}=this;if(p.phase==="resolved"){this.payload=new e.PromiseDelegate,_.resolve(p.payload);return}if(p.phase==="rejected"||p.phase==="stopped"){this.payload=new e.PromiseDelegate,_.promise.catch(g=>{}),_.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 Mi=E(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.EventManager=void 0;var Dr=X(),Jl=et(),jr=Q(),Tr=pe(),qr="api/events",Ei=class{constructor(e={}){var t,n;this._socket=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Tr.ServerConnection.makeSettings(),this._poll=new Jl.Poll({factory:()=>this._subscribe(),standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._stream=new jr.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()),jr.Signal.clearData(this),this._stream.stop()}async emit(e){let{serverSettings:t}=this,{baseUrl:n}=t,{makeRequest:s,ResponseError:r}=Tr.ServerConnection,a=Dr.URLExt.join(n,qr),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=Dr.URLExt.join(a,qr,"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=Ei});var Ii=E(Ce=>{"use strict";var Hl=Ce&&Ce.__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=Ce&&Ce.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Yl=Ce&&Ce.__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(Ce,"__esModule",{value:!0});Ce.CommHandler=Ce.CommsOverSubshells=void 0;var Xl=ne(),Zl=dn(),gn=Yl(at()),ct;(function(i){i.Disabled="disabled",i.PerComm="perComm",i.PerCommTarget="perCommTarget"})(ct||(Ce.CommsOverSubshells=ct={}));var _n=class i extends Zl.DisposableDelegate{constructor(e,t,n,s,r){super(s),this._subshellStarted=new Xl.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:ct.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===ct.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(){let e=this._kernel.id;i._commTargetSubShellsId.hasOwnProperty(e)&&delete i._commTargetSubShellsId[e]}async _maybeStartSubshell(){if(await this._kernel.info,!this._kernel.supportsSubshells)return;if(this._commsOverSubshells===ct.PerComm){let n=await this._kernel.requestCreateSubshell({}).done;this._subshellId=n.content.subshell_id,this._subshellStarted.resolve();return}let e=this._kernel.id;i._commTargetSubShellsId.hasOwnProperty(e)||(i._commTargetSubShellsId[e]={});let t=i._commTargetSubShellsId[e];t[this._target]?(this._subshellId=await t[this._target],this._subshellStarted.resolve()):(t[this._target]=this._kernel.requestCreateSubshell({}).done.then(n=>(this._subshellId=n.content.subshell_id,this._subshellId)),await t[this._target],this._subshellStarted.resolve())}_maybeCloseSubshell(){if(this._commsOverSubshells!==ct.PerComm){this._subshellId=null;return}this._subshellId&&this._kernel.status!=="dead"&&this._kernel.requestDeleteSubshell({subshell_id:this._subshellId},!0),this._subshellId=null}};Ce.CommHandler=_n;_n._commTargetSubShellsId={}});var Ar=E(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0})});var vn=E(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.validateMessage=tc;bt.validateModel=Lr;bt.validateModels=ic;var tt=yt(),Nr=["username","version","session","msg_id","msg_type"],Ql={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 ec(i){for(let e=0;e<Nr.length;e++)(0,tt.validateProperty)(i,Nr[e],"string")}function tc(i){(0,tt.validateProperty)(i,"metadata","object"),(0,tt.validateProperty)(i,"content","object"),(0,tt.validateProperty)(i,"channel","string"),ec(i.header),i.channel==="iopub"&&nc(i)}function nc(i){if(i.channel==="iopub"){let e=Ql[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,tt.validateProperty)(n,t[s],...r)}}}function Lr(i){(0,tt.validateProperty)(i,"name","string"),(0,tt.validateProperty)(i,"id","string")}function ic(i){if(!Array.isArray(i))throw new Error("Invalid kernel list");i.forEach(e=>Lr(e))}});var wn=E(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.KernelAPIClient=ie.KERNEL_SERVICE_URL=void 0;ie.listRunning=zr;ie.startNew=Fr;ie.restartKernel=Kr;ie.interruptKernel=Br;ie.shutdownKernel=$r;ie.getKernelModel=Vr;var ee=pe(),dt=X(),yn=vn();ie.KERNEL_SERVICE_URL="api/kernels";async function zr(i=ee.ServerConnection.makeSettings()){let e=dt.URLExt.join(i.baseUrl,ie.KERNEL_SERVICE_URL),t=await ee.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await ee.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,yn.validateModels)(n),n}async function Fr(i={},e=ee.ServerConnection.makeSettings()){let t=dt.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await ee.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await ee.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,yn.validateModel)(r),r}async function Kr(i,e=ee.ServerConnection.makeSettings()){let t=dt.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i),"restart"),n={method:"POST"},s=await ee.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await ee.ServerConnection.ResponseError.create(s);let r=await s.json();(0,yn.validateModel)(r)}async function Br(i,e=ee.ServerConnection.makeSettings()){let t=dt.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i),"interrupt"),n={method:"POST"},s=await ee.ServerConnection.makeRequest(t,n,e);if(s.status!==204)throw await ee.ServerConnection.ResponseError.create(s)}async function $r(i,e=ee.ServerConnection.makeSettings()){let t=dt.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i)),n={method:"DELETE"},s=await ee.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 ee.ServerConnection.ResponseError.create(s)}async function Vr(i,e=ee.ServerConnection.makeSettings()){let t=dt.URLExt.join(e.baseUrl,ie.KERNEL_SERVICE_URL,encodeURIComponent(i)),n=await ee.ServerConnection.makeRequest(t,{},e);if(n.status===404)return;if(n.status!==200)throw await ee.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,yn.validateModel)(s),s}var Oi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ee.ServerConnection.makeSettings()}async listRunning(){return zr(this.serverSettings)}async getModel(e){return Vr(e,this.serverSettings)}async startNew(e={}){return Fr(e,this.serverSettings)}async restart(e){return Kr(e,this.serverSettings)}async interrupt(e){return Br(e,this.serverSettings)}async shutdown(e){return $r(e,this.serverSettings)}};ie.KernelAPIClient=Oi});var Jr=E(we=>{"use strict";var sc=we&&we.__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=we&&we.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ac=we&&we.__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(we,"__esModule",{value:!0});we.KernelShellFutureHandler=we.KernelControlFutureHandler=we.KernelFutureHandler=void 0;var Wr=ne(),oc=dn(),lc=ac(at()),St=class extends oc.DisposableDelegate{constructor(e,t,n,s,r){super(e),this._status=0,this._stdin=se.noOp,this._iopub=se.noOp,this._reply=se.noOp,this._done=new Wr.PromiseDelegate,this._hooks=new se.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(se.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=se.noOp,this._iopub=se.noOp,this._reply=se.noOp,this._hooks=null,this._testFlag(se.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(se.KernelFutureFlag.GotReply),this._testFlag(se.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),lc.isStatusMsg(e)&&e.content.execution_state==="idle"&&(this._setFlag(se.KernelFutureFlag.GotIdle),this._testFlag(se.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(se.KernelFutureFlag.IsDone)||(this._setFlag(se.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return(this._status&e)!==0}_setFlag(e){this._status|=e}};we.KernelFutureHandler=St;var Ri=class extends St{};we.KernelControlFutureHandler=Ri;var Di=class extends St{};we.KernelShellFutureHandler=Di;var se;(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 Wr.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={}))})(se||(se={}))});var Gr=E(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.validateSpecModel=Hr;bn.validateSpecModels=cc;var nt=yt();function Hr(i){let e=i.spec;if(!e)throw new Error("Invalid kernel spec");(0,nt.validateProperty)(i,"name","string"),(0,nt.validateProperty)(i,"resources","object"),(0,nt.validateProperty)(e,"language","string"),(0,nt.validateProperty)(e,"display_name","string"),(0,nt.validateProperty)(e,"argv","array");let t=null;e.hasOwnProperty("metadata")&&((0,nt.validateProperty)(e,"metadata","object"),t=e.metadata);let n=null;return e.hasOwnProperty("env")&&((0,nt.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 cc(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]]=Hr(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 Ct=E(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.KernelSpecAPIClient=void 0;xt.getSpecs=Yr;var Sn=pe(),dc=Gr(),uc=X(),pc="api/kernelspecs";async function Yr(i=Sn.ServerConnection.makeSettings()){let e=uc.URLExt.join(i.baseUrl,pc),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,dc.validateSpecModels)(n)}var ji=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Sn.ServerConnection.makeSettings()}async get(){return Yr(this.serverSettings)}};xt.KernelSpecAPIClient=ji});var qi=E(Ne=>{"use strict";var hc=Ne&&Ne.__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]}),fc=Ne&&Ne.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ta=Ne&&Ne.__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)&&hc(e,i,t);return fc(e,i),e};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.KernelConnection=void 0;var Xr=X(),Ge=ne(),Ye=Q(),kt=Be(),Zr=Ii(),re=ta(at()),Qr=Jr(),mc=ta(vn()),ea=wn(),gc=Ct(),_c=3e3,ut="_RESTARTING_",vc="",Ti=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=Xr.URLExt.join(l.wsUrl,ea.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),_=p.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${_}`);let g=Xr.URLExt.join(p,"channels?session_id="+encodeURIComponent(this._clientId)),M=l.token;l.appendToken&&M!==""&&(g=g+`&token=${encodeURIComponent(M)}`);let S=d?this._supportedProtocols:[];this._ws=new l.WebSocket(g,S),this._ws.binaryType="arraybuffer";let R=!1,q=async w=>{var O,A;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 kt.ServerConnection.NetworkError||((O=T.response)===null||O===void 0?void 0:O.status)===503||((A=T.response)===null||A===void 0?void 0:A.status)===424){let D=ke.getRandomIntInclusive(10,30)*1e3;setTimeout(q,D,w)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},b=async w=>{R||(R=!0,await q(w))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=b,this._ws.onerror=b},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),mc.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(re.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._commsOverSubshells=kt.CommsOverSubshells.PerCommTarget,this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new Ge.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new Ye.Signal(this),this._connectionStatusChanged=new Ye.Signal(this),this._disposed=new Ye.Signal(this),this._iopubMessage=new Ye.Signal(this),this._anyMessage=new Ye.Signal(this),this._pendingInput=new Ye.Signal(this),this._unhandledMessage=new Ye.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:kt.ServerConnection.makeSettings(),this._kernelAPIClient=(n=e.kernelAPIClient)!==null&&n!==void 0?n:new ea.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(s=e.kernelSpecAPIClient)!==null&&s!==void 0?s:new gc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._clientId=(r=e.clientId)!==null&&r!==void 0?r:Ge.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:kt.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:kt.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(),Ye.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(Qr.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Qr.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===vc||this._kernelSession===ut)&&re.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!==ut)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=ut,await this._kernelAPIClient.restart(this.id),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();let e=new Ge.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=re.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{}}),t;try{t=await ke.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=re.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return ke.handleShellMessage(this,t)}requestInspect(e){let t=re.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return ke.handleShellMessage(this,t)}requestHistory(e){let t=re.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return ke.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=re.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=re.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=re.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=re.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=re.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=re.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return ke.handleShellMessage(this,t)}requestCommInfo(e){let t=re.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return ke.handleShellMessage(this,t)}sendInputReply(e,t){let n=re.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=Ge.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 Zr.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:Ge.JSONExt.deepCopy(t.header),parent_header:Ge.JSONExt.deepCopy(t.parent_header),metadata:Ge.JSONExt.deepCopy(t.metadata),content:Ge.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,ke.logKernelStatus(this),this._statusChanged.emit(e),e==="dead"&&this.dispose())}_sendPending(){for(;this.connectionStatus==="connected"&&this._kernelSession!==ut&&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 Zr.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 ke.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===ut,n=this.requestKernelInfo(),s=!1,r=()=>{s||(s=!0,t&&this._kernelSession===ut&&(this._kernelSession=""),clearTimeout(a),this._pendingMessages.length>0&&this._sendPending())};n.then(r);let a=setTimeout(r,_c)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let s=!1;if(e.parent_header&&e.channel==="iopub"&&(re.isDisplayDataMsg(e)||re.isUpdateDisplayDataMsg(e)||re.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=ke.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)}};Ne.KernelConnection=Ti;var ke;(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})(ke||(ke={}))});var sa=E(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.KernelManager=void 0;var yc=et(),na=Q(),ia=Be(),wc=Qe(),bc=wn(),Sc=qi(),xc=Ct(),Pt=class extends wc.BaseManager{constructor(e={}){var t,n,s;super(e),this._commsOverSubshells=ia.CommsOverSubshells.PerCommTarget,this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new na.Signal(this),this._connectionFailure=new na.Signal(this),this._kernelAPIClient=(t=e.kernelAPIClient)!==null&&t!==void 0?t:new bc.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(n=e.kernelSpecAPIClient)!==null&&n!==void 0?n:new xc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._pollModels=new yc.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 Sc.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 ia.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(()=>{})}};Et.KernelManager=Pt;(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})(Pt||(Et.KernelManager=Pt={}))});var Ai=E(H=>{"use strict";var ra=H&&H.__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]}),Cc=H&&H.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Ui=H&&H.__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)&&ra(e,i,t);return Cc(e,i),e},kc=H&&H.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ra(e,i,t)};Object.defineProperty(H,"__esModule",{value:!0});H.CommsOverSubshells=H.KernelConnection=H.KernelAPI=H.KernelMessage=H.Kernel=void 0;var Pc=Ii();Object.defineProperty(H,"CommsOverSubshells",{enumerable:!0,get:function(){return Pc.CommsOverSubshells}});var Ec=Ui(Ar());H.Kernel=Ec;var Mc=Ui(at());H.KernelMessage=Mc;var Ic=Ui(wn());H.KernelAPI=Ic;var Oc=qi();Object.defineProperty(H,"KernelConnection",{enumerable:!0,get:function(){return Oc.KernelConnection}});kc(sa(),H)});var oa=E(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0})});var ca=E(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.KernelSpecManager=void 0;var Rc=ne(),Dc=et(),la=Q(),jc=Qe(),Tc=Ct(),Ni=class extends jc.BaseManager{constructor(e={}){var t,n;super(e),this._isReady=!1,this._connectionFailure=new la.Signal(this),this._specs=null,this._specsChanged=new la.Signal(this),this._kernelSpecAPIClient=(t=e.kernelSpecAPIClient)!==null&&t!==void 0?t:new Tc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._ready=Promise.all([this.requestSpecs()]).then(s=>{}).catch(s=>{}).then(()=>{this.isDisposed||(this._isReady=!0)}),this._pollSpecs=new Dc.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||Rc.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}};xn.KernelSpecManager=Ni});var Li=E(fe=>{"use strict";var da=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]}),qc=fe&&fe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ua=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)&&da(e,i,t);return qc(e,i),e},Uc=fe&&fe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&da(e,i,t)};Object.defineProperty(fe,"__esModule",{value:!0});fe.KernelSpecAPI=fe.KernelSpec=void 0;var Ac=ua(oa());fe.KernelSpec=Ac;var Nc=ua(Ct());fe.KernelSpecAPI=Nc;Uc(ca(),fe)});var pa=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.BuildManager=void 0;var zi=X(),Xe=pe(),Lc="api/build",Fi=class{constructor(e={}){var t;this._url="",this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Xe.ServerConnection.makeSettings();let{baseUrl:n,appUrl:s}=this.serverSettings;this._url=zi.URLExt.join(n,s,Lc)}get isAvailable(){return zi.PageConfig.getOption("buildAvailable").toLowerCase()==="true"}get shouldCheck(){return zi.PageConfig.getOption("buildCheck").toLowerCase()==="true"}getStatus(){let{_url:e,serverSettings:t}=this;return Xe.ServerConnection.makeRequest(e,{},t).then(s=>{if(s.status!==200)throw new Xe.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 Xe.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status===400)throw new Xe.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 Ye.ServerConnection.ResponseError(r,a)}})}cancel(){let{_url:e,serverSettings:t}=this,n={method:"DELETE"};return Ye.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status!==204)throw new Ye.ServerConnection.ResponseError(r)})}};xn.BuildManager=Ni});var Ki=I(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.NbConvertManager=void 0;var Li=X(),zi=pe(),Rc=ne(),Oc="api/nbconvert",Dc="nbconvert",Fi=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:zi.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new Rc.PromiseDelegate,this._exportFormats=null;let e=this.serverSettings.baseUrl,t=Li.URLExt.join(e,Oc),{serverSettings:n}=this,s=await zi.ServerConnection.makeRequest(t,{},n);if(s.status!==200)throw await zi.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}async exportAs(e){let{format:t,path:n}=e,{download:s=!1}=e.exporterOptions||{},r=this.serverSettings.baseUrl,a=Li.URLExt.encodeParts(n),o=Li.URLExt.join(r,Dc,t,a);s&&(o+="?download=true"),window==null||window.open(o,"_blank","noopener")}};Cn.NbConvertManager=Fi});var ca=I(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0})});var ua=I(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.validateModel=da;Mt.updateLegacySessionModel=Tc;Mt.validateModels=qc;var jc=_n(),Et=vt();function da(i){(0,Et.validateProperty)(i,"id","string"),(0,Et.validateProperty)(i,"type","string"),(0,Et.validateProperty)(i,"name","string"),(0,Et.validateProperty)(i,"path","string"),(0,Et.validateProperty)(i,"kernel","object"),(0,jc.validateModel)(i.kernel)}function Tc(i){i.path===void 0&&i.notebook!==void 0&&(i.path=i.notebook.path,i.type="notebook",i.name="")}function qc(i){if(!Array.isArray(i))throw new Error("Invalid session list");i.forEach(e=>da(e))}});var En=I(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.SessionAPIClient=me.SESSION_SERVICE_URL=void 0;me.listRunning=pa;me.getSessionUrl=Pn;me.shutdownSession=ha;me.getSessionModel=fa;me.startSession=ma;me.updateSession=ga;var ae=pe(),kn=X(),Xe=ua();me.SESSION_SERVICE_URL="api/sessions";async function pa(i=ae.ServerConnection.makeSettings()){let e=kn.URLExt.join(i.baseUrl,me.SESSION_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 Session list");return n.forEach(s=>{(0,Xe.updateLegacySessionModel)(s),(0,Xe.validateModel)(s)}),n}function Pn(i,e){let t=kn.URLExt.join(i,me.SESSION_SERVICE_URL),n=kn.URLExt.join(t,e);if(!n.startsWith(t))throw new Error("Can only be used for services requests");return n}async function ha(i,e=ae.ServerConnection.makeSettings()){var t;let n=Pn(e.baseUrl,i),s={method:"DELETE"},r=await ae.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 ae.ServerConnection.ResponseError(r,"The kernel was deleted but the session was not");if(r.status!==204)throw await ae.ServerConnection.ResponseError.create(r)}}async function fa(i,e=ae.ServerConnection.makeSettings()){let t=Pn(e.baseUrl,i),n=await ae.ServerConnection.makeRequest(t,{},e);if(n.status!==200)throw await ae.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,Xe.updateLegacySessionModel)(s),(0,Xe.validateModel)(s),s}async function ma(i,e=ae.ServerConnection.makeSettings()){let t=kn.URLExt.join(e.baseUrl,me.SESSION_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await ae.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await ae.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,Xe.updateLegacySessionModel)(r),(0,Xe.validateModel)(r),r}async function ga(i,e=ae.ServerConnection.makeSettings()){let t=Pn(e.baseUrl,i.id),n={method:"PATCH",body:JSON.stringify(i)},s=await ae.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await ae.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,Xe.updateLegacySessionModel)(r),(0,Xe.validateModel)(r),r}var Bi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ae.ServerConnection.makeSettings()}async listRunning(){return pa(this.serverSettings)}async getModel(e){return fa(e,this.serverSettings)}async startNew(e){return ma(e,this.serverSettings)}async shutdown(e){return ha(e,this.serverSettings)}async update(e){return ga(e,this.serverSettings)}};me.SessionAPIClient=Bi});var _a=I(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.SessionConnection=void 0;var Ne=Q(),Ac=Ke(),Uc=ne(),Nc=En(),$i=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 Ne.Signal(this),this._kernelChanged=new Ne.Signal(this),this._statusChanged=new Ne.Signal(this),this._connectionStatusChanged=new Ne.Signal(this),this._pendingInput=new Ne.Signal(this),this._iopubMessage=new Ne.Signal(this),this._unhandledMessage=new Ne.Signal(this),this._anyMessage=new Ne.Signal(this),this._propertyChanged=new Ne.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:Uc.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:Ac.ServerConnection.makeSettings(),this._sessionAPIClient=(a=e.sessionAPIClient)!==null&&a!==void 0?a:new Nc.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})}Ne.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=$i});var ya=I(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.SessionManager=void 0;var Lc=Qe(),va=Q(),zc=pe(),Fc=Ze(),Kc=_a(),Bc=En(),It=class extends Fc.BaseManager{constructor(e){var t,n;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new va.Signal(this),this._connectionFailure=new va.Signal(this),this._connectToKernel=s=>this._kernelManager.connectTo(s),this._kernelManager=e.kernelManager,this._sessionAPIClient=(t=e.sessionAPIClient)!==null&&t!==void 0?t:new Bc.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 Kc.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 zc.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(()=>{})}};Rt.SessionManager=It;(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})(It||(Rt.SessionManager=It={}))});var Vi=I(ge=>{"use strict";var wa=ge&&ge.__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=ge&&ge.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ba=ge&&ge.__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)&&wa(e,i,t);return $c(e,i),e},Vc=ge&&ge.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&wa(e,i,t)};Object.defineProperty(ge,"__esModule",{value:!0});ge.SessionAPI=ge.Session=void 0;var Wc=ba(ca());ge.Session=Wc;var Jc=ba(En());ge.SessionAPI=Jc;Vc(ya(),ge)});var Sa=I(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.DataConnector=void 0;var Wi=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.")}};In.DataConnector=Wi});var Ca=I(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0})});var Pa=I((Rn,ka)=>{(function(i,e){typeof Rn=="object"&&typeof ka!="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 Ma=I(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.RestorablePool=void 0;var Hc=ne(),Ea=Pa(),On=Q(),Ji=class{constructor(e){this._added=new On.Signal(this),this._current=null,this._currentChanged=new On.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new Hc.PromiseDelegate,this._updated=new On.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),!Le.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);Le.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(),On.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 Le.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],_=p&&p.data;return _===void 0?n.remove(d):s.execute(t,_).catch(()=>n.remove(d))}));return this._restored.resolve(),c}async save(e){var t,n;let s=Le.injectedProperty.get(e);if(!this._restore||!this.has(e)||s)return;let{connector:r}=this._restore,a=this._restore.name(e),o=Le.nameProperty.get(e),u=a?`${this.namespace}:${a}`:"";if(o&&o!==u&&await r.remove(o),Le.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)),Le.injectedProperty.get(e)||!this._restore)return;let{connector:t}=this._restore,n=Le.nameProperty.get(e);n&&t.remove(n)}};Dn.RestorablePool=Ji;var Le;(function(i){i.injectedProperty=new Ea.AttachedProperty({name:"injected",create:()=>!1}),i.nameProperty=new Ea.AttachedProperty({name:"name",create:()=>""})})(Le||(Le={}))});var Ia=I(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.StateDB=void 0;var Gc=Q(),Ot=class i{constructor(e={}){this._changed=new Gc.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}))}};Dt.StateDB=Ot;(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})(Ot||(Dt.StateDB=Ot={}))});var Ra=I(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.IStateDB=void 0;var Yc=ne();jn.IStateDB=new Yc.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 Xe.ServerConnection.ResponseError(r,a)}})}cancel(){let{_url:e,serverSettings:t}=this,n={method:"DELETE"};return Xe.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status!==204)throw new Xe.ServerConnection.ResponseError(r)})}};Cn.BuildManager=Fi});var Vi=E(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.NbConvertManager=void 0;var Ki=X(),Bi=pe(),zc=ne(),Fc="api/nbconvert",Kc="nbconvert",$i=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Bi.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new zc.PromiseDelegate,this._exportFormats=null;let e=this.serverSettings.baseUrl,t=Ki.URLExt.join(e,Fc),{serverSettings:n}=this,s=await Bi.ServerConnection.makeRequest(t,{},n);if(s.status!==200)throw await Bi.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}async exportAs(e){let{format:t,path:n}=e,{download:s=!1}=e.exporterOptions||{},r=this.serverSettings.baseUrl,a=Ki.URLExt.encodeParts(n),o=Ki.URLExt.join(r,Kc,t,a);s&&(o+="?download=true"),window==null||window.open(o,"_blank","noopener")}};kn.NbConvertManager=$i});var fa=E(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0})});var ga=E(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateModel=ma;It.updateLegacySessionModel=$c;It.validateModels=Vc;var Bc=vn(),Mt=yt();function ma(i){(0,Mt.validateProperty)(i,"id","string"),(0,Mt.validateProperty)(i,"type","string"),(0,Mt.validateProperty)(i,"name","string"),(0,Mt.validateProperty)(i,"path","string"),(0,Mt.validateProperty)(i,"kernel","object"),(0,Bc.validateModel)(i.kernel)}function $c(i){i.path===void 0&&i.notebook!==void 0&&(i.path=i.notebook.path,i.type="notebook",i.name="")}function Vc(i){if(!Array.isArray(i))throw new Error("Invalid session list");i.forEach(e=>ma(e))}});var Mn=E(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.SessionAPIClient=me.SESSION_SERVICE_URL=void 0;me.listRunning=_a;me.getSessionUrl=En;me.shutdownSession=va;me.getSessionModel=ya;me.startSession=wa;me.updateSession=ba;var ae=pe(),Pn=X(),Ze=ga();me.SESSION_SERVICE_URL="api/sessions";async function _a(i=ae.ServerConnection.makeSettings()){let e=Pn.URLExt.join(i.baseUrl,me.SESSION_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 Session list");return n.forEach(s=>{(0,Ze.updateLegacySessionModel)(s),(0,Ze.validateModel)(s)}),n}function En(i,e){let t=Pn.URLExt.join(i,me.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 va(i,e=ae.ServerConnection.makeSettings()){var t;let n=En(e.baseUrl,i),s={method:"DELETE"},r=await ae.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 ae.ServerConnection.ResponseError(r,"The kernel was deleted but the session was not");if(r.status!==204)throw await ae.ServerConnection.ResponseError.create(r)}}async function ya(i,e=ae.ServerConnection.makeSettings()){let t=En(e.baseUrl,i),n=await ae.ServerConnection.makeRequest(t,{},e);if(n.status!==200)throw await ae.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,Ze.updateLegacySessionModel)(s),(0,Ze.validateModel)(s),s}async function wa(i,e=ae.ServerConnection.makeSettings()){let t=Pn.URLExt.join(e.baseUrl,me.SESSION_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await ae.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await ae.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,Ze.updateLegacySessionModel)(r),(0,Ze.validateModel)(r),r}async function ba(i,e=ae.ServerConnection.makeSettings()){let t=En(e.baseUrl,i.id),n={method:"PATCH",body:JSON.stringify(i)},s=await ae.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await ae.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,Ze.updateLegacySessionModel)(r),(0,Ze.validateModel)(r),r}var Wi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ae.ServerConnection.makeSettings()}async listRunning(){return _a(this.serverSettings)}async getModel(e){return ya(e,this.serverSettings)}async startNew(e){return wa(e,this.serverSettings)}async shutdown(e){return va(e,this.serverSettings)}async update(e){return ba(e,this.serverSettings)}};me.SessionAPIClient=Wi});var Sa=E(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.SessionConnection=void 0;var Le=Q(),Wc=Be(),Jc=ne(),Hc=Mn(),Ji=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 Le.Signal(this),this._kernelChanged=new Le.Signal(this),this._statusChanged=new Le.Signal(this),this._connectionStatusChanged=new Le.Signal(this),this._pendingInput=new Le.Signal(this),this._iopubMessage=new Le.Signal(this),this._unhandledMessage=new Le.Signal(this),this._anyMessage=new Le.Signal(this),this._propertyChanged=new Le.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:Jc.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:Wc.ServerConnection.makeSettings(),this._sessionAPIClient=(a=e.sessionAPIClient)!==null&&a!==void 0?a:new Hc.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})}Le.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=Ji});var Ca=E(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.SessionManager=void 0;var Gc=et(),xa=Q(),Yc=pe(),Xc=Qe(),Zc=Sa(),Qc=Mn(),Ot=class extends Xc.BaseManager{constructor(e){var t,n;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new xa.Signal(this),this._connectionFailure=new xa.Signal(this),this._connectToKernel=s=>this._kernelManager.connectTo(s),this._kernelManager=e.kernelManager,this._sessionAPIClient=(t=e.sessionAPIClient)!==null&&t!==void 0?t:new Qc.SessionAPIClient({serverSettings:e.serverSettings}),this._pollModels=new Gc.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 Zc.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 Yc.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(()=>{})}};Rt.SessionManager=Ot;(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})(Ot||(Rt.SessionManager=Ot={}))});var Hi=E(ge=>{"use strict";var ka=ge&&ge.__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]}),ed=ge&&ge.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Pa=ge&&ge.__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)&&ka(e,i,t);return ed(e,i),e},td=ge&&ge.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ka(e,i,t)};Object.defineProperty(ge,"__esModule",{value:!0});ge.SessionAPI=ge.Session=void 0;var nd=Pa(fa());ge.Session=nd;var id=Pa(Mn());ge.SessionAPI=id;td(Ca(),ge)});var Ea=E(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.DataConnector=void 0;var Gi=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.")}};On.DataConnector=Gi});var Ia=E(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0})});var Ra=E((Rn,Oa)=>{(function(i,e){typeof Rn=="object"&&typeof Oa!="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 ja=E(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.RestorablePool=void 0;var sd=ne(),Da=Ra(),Dn=Q(),Yi=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 sd.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),!ze.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);ze.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 ze.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],_=p&&p.data;return _===void 0?n.remove(d):s.execute(t,_).catch(()=>n.remove(d))}));return this._restored.resolve(),c}async save(e){var t,n;let s=ze.injectedProperty.get(e);if(!this._restore||!this.has(e)||s)return;let{connector:r}=this._restore,a=this._restore.name(e),o=ze.nameProperty.get(e),u=a?`${this.namespace}:${a}`:"";if(o&&o!==u&&await r.remove(o),ze.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)),ze.injectedProperty.get(e)||!this._restore)return;let{connector:t}=this._restore,n=ze.nameProperty.get(e);n&&t.remove(n)}};jn.RestorablePool=Yi;var ze;(function(i){i.injectedProperty=new Da.AttachedProperty({name:"injected",create:()=>!1}),i.nameProperty=new Da.AttachedProperty({name:"name",create:()=>""})})(ze||(ze={}))});var Ta=E(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.StateDB=void 0;var rd=Q(),Dt=class i{constructor(e={}){this._changed=new rd.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}))}};jt.StateDB=Dt;(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})(Dt||(jt.StateDB=Dt={}))});var qa=E(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.IStateDB=void 0;var ad=ne();Tn.IStateDB=new ad.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 Hi=I(Ee=>{"use strict";var Xc=Ee&&Ee.__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]}),jt=Ee&&Ee.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Xc(e,i,t)};Object.defineProperty(Ee,"__esModule",{value:!0});jt(Sa(),Ee);jt(Ca(),Ee);jt(Ma(),Ee);jt(Ia(),Ee);jt(Ra(),Ee)});var Xi=I(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.SettingManager=void 0;var Gi=X(),Zc=Hi(),Tn=pe(),Qc="api/settings",Yi=class extends Zc.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Tn.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}=Tn.ServerConnection,o=n+s,u=Tt.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}=Tn.ServerConnection,l=o+u,p=Tt.url(l,"",e==="ids"),_=await c(p,{},a);if(_.status!==200)throw new d(_);let g=await _.json(),E=(n=(t=g==null?void 0:g.settings)===null||t===void 0?void 0:t.map(O=>O.id))!==null&&n!==void 0?n:[],S=[];return e||(S=(r=(s=g==null?void 0:g.settings)===null||s===void 0?void 0:s.map(O=>(O.data={composite:{},user:{}},O)))!==null&&r!==void 0?r:[]),{ids:E,values:S}}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=Tn.ServerConnection,u=s+r,c=Tt.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)}};qn.SettingManager=Yi;var Tt;(function(i){function e(t,n,s){let r=s?Gi.URLExt.objectToQueryString({ids_only:!0}):"",a=Gi.URLExt.join(t,Qc),o=Gi.URLExt.join(a,n);if(!o.startsWith(a))throw new Error("Can only be used for workspaces requests");return`${o}${r}`}i.url=e})(Tt||(Tt={}))});var Ut=I(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.TerminalAPIClient=we.TERMINAL_SERVICE_URL=void 0;we.isAvailable=Qi;we.startNew=Oa;we.listRunning=Da;we.shutdownTerminal=ja;var qt=X(),ze=pe();we.TERMINAL_SERVICE_URL="api/terminals";function Qi(){return String(qt.PageConfig.getOption("terminalsAvailable")).toLowerCase()==="true"}async function Oa(i=ze.ServerConnection.makeSettings(),e,t){At.errorIfNotAvailable();let n=qt.URLExt.join(i.baseUrl,we.TERMINAL_SERVICE_URL),s={method:"POST",body:JSON.stringify({name:e,cwd:t})},r=await ze.ServerConnection.makeRequest(n,s,i);if(r.status!==200)throw await ze.ServerConnection.ResponseError.create(r);return await r.json()}async function Da(i=ze.ServerConnection.makeSettings()){At.errorIfNotAvailable();let e=qt.URLExt.join(i.baseUrl,we.TERMINAL_SERVICE_URL),t=await ze.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await ze.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid terminal list");return n}async function ja(i,e=ze.ServerConnection.makeSettings()){var t;At.errorIfNotAvailable();let n=qt.URLExt.join(e.baseUrl,we.TERMINAL_SERVICE_URL),s=qt.URLExt.join(n,i);if(!s.startsWith(n))throw new Error("Can only be used for terminal requests");let r={method:"DELETE"},a=await ze.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 ze.ServerConnection.ResponseError.create(a)}var Zi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ze.ServerConnection.makeSettings()}get isAvailable(){return Qi()}async startNew(e={}){let{name:t,cwd:n}=e;return Oa(this.serverSettings,t,n)}async listRunning(){return Da(this.serverSettings)}async shutdown(e){return ja(e,this.serverSettings)}};we.TerminalAPIClient=Zi;var At;(function(i){function e(){if(!Qi())throw new Error("Terminals Unavailable")}i.errorIfNotAvailable=e})(At||(At={}))});var Ta=I(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.isAvailable=void 0;var ed=Ut();Object.defineProperty(An,"isAvailable",{enumerable:!0,get:function(){return ed.isAvailable}})});var qa=I(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.TerminalConnection=void 0;var td=X(),nd=ne(),Un=Q(),id=Ke(),sd=Ut(),es=class i{constructor(e){var t,n;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let s=this._name,r=this.serverSettings,a=td.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 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:id.ServerConnection.makeSettings(),this._terminalAPIClient=(n=e.terminalAPIClient)!==null&&n!==void 0?n:new sd.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(),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 nd.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=ts.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}};Nn.TerminalConnection=es;var ts;(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})(ts||(ts={}))});var Ua=I(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.TerminalManager=void 0;var rd=Qe(),Aa=Q(),ad=Ke(),od=Ze(),ld=Ut(),cd=qa(),Nt=class extends od.BaseManager{constructor(e={}){var t,n;if(super(e),this._isReady=!1,this._names=[],this._terminalConnections=new Set,this._runningChanged=new Aa.Signal(this),this._connectionFailure=new Aa.Signal(this),this._terminalAPIClient=(t=e.terminalAPIClient)!==null&&t!==void 0?t:new ld.TerminalAPIClient({serverSettings:this.serverSettings}),!this.isAvailable()){this._ready=Promise.reject("Terminals unavailable"),this._ready.catch(s=>{});return}this._pollModels=new rd.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 cd.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 ad.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}))}};Lt.TerminalManager=Nt;(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})(Nt||(Lt.TerminalManager=Nt={}))});var ns=I(_e=>{"use strict";var Na=_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]}),dd=_e&&_e.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),La=_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)&&Na(e,i,t);return dd(e,i),e},ud=_e&&_e.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Na(e,i,t)};Object.defineProperty(_e,"__esModule",{value:!0});_e.TerminalAPI=_e.Terminal=void 0;var pd=La(Ta());_e.Terminal=pd;var hd=La(Ut());_e.TerminalAPI=hd;ud(Ua(),_e)});var as=I(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.UserManager=void 0;var fd=X(),md=ne(),gd=Qe(),za=Q(),_d=pe(),vd=Ze(),yd="api/me",is="@jupyterlab/services:UserManager#user",ss=class extends vd.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new za.Signal(this),this._connectionFailure=new za.Signal(this),this._ready=this.requestUser().then(()=>{this.isDisposed||(this._isReady=!0)}).catch(n=>new Promise(()=>{})),this._pollSpecs=new gd.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:is,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}=_d.ServerConnection,s=fd.URLExt.join(e,yd),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(is);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||rs.getRandomColor()}md.JSONExt.deepEqual(o,a)||(this._identity=u,this._permissions=o.permissions,c.setItem(is,JSON.stringify(u)),this._userChanged.emit(o))}};Ln.UserManager=ss;var rs;(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)]})(rs||(rs={}))});var ls=I(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.WorkspaceManager=void 0;var Fa=X(),wd=Hi(),zt=pe(),bd="api/workspaces",os=class extends wd.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:zt.ServerConnection.makeSettings()}async fetch(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=zt.ServerConnection,o=n+s,u=ut.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}=zt.ServerConnection,a=t+n,o=ut.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}=zt.ServerConnection,o=n+s,u=ut.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}=zt.ServerConnection,u=s+r,c=ut.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)}};zn.WorkspaceManager=os;var ut;(function(i){function e(t,n){let s=Fa.URLExt.join(t,bd),r=Fa.URLExt.join(s,n);if(!r.startsWith(s))throw new Error("Can only be used for workspaces requests");return r}i.url=e})(ut||(ut={}))});var Ba=I(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ServiceManager=void 0;var Ka=Q(),Sd=oa(),xd=xi(),Cd=ki(),kd=Ti(),Pd=Ai(),Ed=Ki(),Md=pe(),Id=Vi(),Rd=Xi(),Od=ns(),Dd=as(),jd=ls(),cs=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new Ka.Signal(this),this._isReady=!1;let s=e.defaultDrive,r=(t=e.serverSettings)!==null&&t!==void 0?t:Md.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 xd.ContentsManager(o),this.events=e.events||new Cd.EventManager(o),this.kernels=e.kernels||new kd.KernelManager(o),this.sessions=e.sessions||new Id.SessionManager({...o,kernelManager:this.kernels}),this.settings=e.settings||new Rd.SettingManager(o),this.terminals=e.terminals||new Od.TerminalManager(o),this.builder=e.builder||new Sd.BuildManager(o),this.workspaces=e.workspaces||new jd.WorkspaceManager(o),this.nbconvert=e.nbconvert||new Ed.NbConvertManager(o),this.kernelspecs=e.kernelspecs||new Pd.KernelSpecManager(o),this.user=e.user||new Dd.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,Ka.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)}};Fn.ServiceManager=cs});var $a=I(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 ve=ne();L.IConnectionStatus=new ve.Token("@jupyterlab/application:IConnectionStatus","A service providing the application connection status.");L.IConfigSectionManager=new ve.Token("@jupyterlab/services:IConfigSectionManager","A service providing the config section manager.");L.IContentsManager=new ve.Token("@jupyterlab/services:IContentsManager","The contents manager token.");L.IDefaultDrive=new ve.Token("@jupyterlab/services:IDefaultDrive","The default drive for the contents manager.");L.IEventManager=new ve.Token("@jupyterlab/services:IEventManager","The event manager token.");L.IKernelManager=new ve.Token("@jupyterlab/services:IKernelManager","The kernel manager token.");L.IKernelSpecManager=new ve.Token("@jupyterlab/services:IKernelSpecManager","The kernel spec manager token.");L.INbConvertManager=new ve.Token("@jupyterlab/services:INbConvertManager","The nbconvert manager token.");L.IServerSettings=new ve.Token("@jupyterlab/services:IServerSettings","The server settings for the application.");L.ISessionManager=new ve.Token("@jupyterlab/services:ISessionManager","The session manager token.");L.ISettingManager=new ve.Token("@jupyterlab/services:ISettingManager","The setting manager token.");L.IServiceManager=new ve.Token("@jupyterlab/services:IServiceManager","The service manager for the application.");L.ITerminalManager=new ve.Token("@jupyterlab/services:ITerminalManager","The terminal manager token.");L.IUserManager=new ve.Token("@jupyterlab/services:IUserManager","The user manager token.");L.IWorkspaceManager=new ve.Token("@jupyterlab/services:IWorkspaceManager","The workspace manager token.")});var Ke=I(W=>{"use strict";var Td=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]}),ce=W&&W.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Td(e,i,t)};Object.defineProperty(W,"__esModule",{value:!0});ce(Ze(),W);ce(br(),W);ce(Sr(),W);ce(xi(),W);ce(ki(),W);ce(Ti(),W);ce(Ai(),W);ce(Ba(),W);ce(pe(),W);ce(Vi(),W);ce(Xi(),W);ce(ns(),W);ce($a(),W);ce(as(),W);ce(ls(),W);ce(Ki(),W)});var Wa=I((up,Va)=>{"use strict";function Kn(){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)}Kn.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)}}};Kn.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};Kn.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};Va.exports=Kn});var Ha=I((pp,Ja)=>{Ja.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 Ya=I((hp,Ga)=>{Ga.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 Za=I((fp,Xa)=>{"use strict";var qd=Wa();Xa.exports=new qd(Ha(),Ya())});var Qa,eo,be,Fe,ds=nt(()=>{Qa=$e(X()),eo=$e(Za());(function(i){i.JSON="application/json",i.PLAIN_TEXT="text/plain",i.OCTET_STREAM="octet/stream"})(be||(be={}));(function(i){let e=JSON.parse(Qa.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 eo.default.getType(s)||r||be.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})(Fe||(Fe={}))});var Me,io,ke,so,ps,to,ro,no,Ft,us,hs,Bn,ao=nt(()=>{Me=$e(X()),io=$e(Ke()),ke=$e(X()),so=$e(ne()),ps=$e(Q());ds();to="JupyterLite Storage",ro="BrowserStorage",no=5,Ft=new TextEncoder,us=new TextDecoder("utf-8"),hs=class{constructor(e){var t;this.reduceBytesToString=(n,s)=>n+String.fromCharCode(s),this._serverContents=new Map,this._isDisposed=!1,this._fileChanged=new ps.Signal(this),this._storageName=to,this._storageDrivers=null,this._localforage=e.localforage,this._storageName=e.storageName||to,this._storageDrivers=e.storageDrivers||null,this._serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:io.ServerConnection.makeSettings(),this._ready=new so.PromiseDelegate,this.initialize().catch(console.warn)}dispose(){this.isDisposed||(this._isDisposed=!0,ps.Signal.clearData(this))}get isDisposed(){return this._isDisposed}get name(){return ro}get serverSettings(){return this._serverSettings}get fileChanged(){return this._fileChanged}async getDownloadUrl(e){e=decodeURIComponent(e.replace(/^\//,""));let n=await(await this.storage).getItem(e);if(n&&n.content!==null){let a;if(n.format==="base64"){let o=atob(n.content),u=new Uint8Array(o.length);for(let c=0;c<o.length;c++)u[c]=o.charCodeAt(c);a=new Blob([u],{type:n.mimetype})}else if(n.format==="json"){let o=JSON.stringify(n.content);a=new Blob([o],{type:n.mimetype})}else a=new Blob([n.content],{type:n.mimetype});return URL.createObjectURL(a)}let s=this.serverSettings.baseUrl;return Me.URLExt.join(s,"files",Me.URLExt.encodeParts(e))}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 clearStorage(){await Promise.all([(await this.storage).clear(),(await this.counters).clear(),(await this.checkpoints).clear()])}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=ke.PathExt.dirname(r),c=ke.PathExt.basename(r),d=ke.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 _;switch(a){case"directory":{p=`Untitled Folder${await this._incrementCounter("directory")||""}`,_={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 E=await this._incrementCounter("notebook");p=p||`Untitled${E||""}.ipynb`,_={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:be.JSON,content:Bn.EMPTY_NB,size:Ft.encode(JSON.stringify(Bn.EMPTY_NB)).length,writable:!0,type:"notebook"};break}default:{let E=(s=e==null?void 0:e.ext)!==null&&s!==void 0?s:".txt";E.startsWith(".")||(E=`.${E}`);let S=await this._incrementCounter("file"),O=Fe.getType(E)||be.OCTET_STREAM,q;Fe.hasFormat(E,"text")||O.indexOf("text")!==-1?q="text":E.indexOf("json")!==-1||E.indexOf("ipynb")!==-1?q="json":q="base64",p=p||`untitled${S||""}${E}`,_={name:p,path:`${u}${p}`,last_modified:o,created:o,format:q,mimetype:O,content:"",size:0,writable:!0,type:"file"};break}}let g=_.path;return await(await this.storage).setItem(g,_),this._fileChanged.emit({type:"new",oldValue:null,newValue:_}),_}async copy(e,t){let n=ke.PathExt.basename(e);for(t=t===""?"":`${ke.PathExt.removeSlash(t)}/`;await this.get(`${t}${n}`,{content:!0}).then(()=>!0).catch(()=>!1);){let a=ke.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:ke.PathExt.basename(e),path:e,last_modified:a.last_modified,created:a.created,format:"json",mimetype:be.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=ke.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(Me.URLExt.join(e,c.name),Me.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=ke.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(us.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"notebook",size:l.length}}else if(Fe.hasFormat(s,"json")){let p=d?JSON.parse(us.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"file",size:l.length}}else if(Fe.hasFormat(s,"text")){let p=d?us.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:Ft.encode(JSON.stringify(o.content)).length};break}case"text":{o={...o,size:Ft.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>no&&r.splice(0,r.length-no),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:be.JSON,content:Array.from(t.values()),size:0,writable:!0,type:"directory"}}async _getServerContents(e,t){let n=ke.PathExt.basename(e),r=(await this._getServerDirectory(Me.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:be.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=Me.URLExt.join(Me.PageConfig.getBaseUrl(),"files",e),o=await fetch(a);if(!o.ok)return null;let u=r.mimetype||o.headers.get("Content-Type"),c=ke.PathExt.extname(n);if(r.type==="notebook"||Fe.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||be.JSON,size:Ft.encode(d).length}}else if(Fe.hasFormat(c,"text")||u.indexOf("text")!==-1){let d=await o.text();r={...r,content:d,format:"text",mimetype:u||be.PLAIN_TEXT,size:Ft.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||be.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=Me.URLExt.join(Me.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:[]}})(Bn||(Bn={}))});function fs(i){return"node"in i}var Kt,oo,lo,co,ms=nt(()=>{Kt=16895,oo=33206,lo=1,co=2});var po,Jn,Ad,Ud,uo,$n,Vn,pt,Wn,Bt,gs=nt(()=>{ms();po=":",Jn=4096,Ad=new TextEncoder,Ud=new TextDecoder("utf-8"),uo={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 uo&&(r=uo[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.node=t=>fs(t)?t.node:t,this.getattr=t=>{let n=this.node(t);return{...this.fs.API.getattr(this.fs.realPath(n)),mode:n.mode,ino:n.id}},this.setattr=(t,n)=>{let s=this.node(t);for(let[r,a]of Object.entries(n))switch(r){case"mode":s.mode=a;break;case"timestamp":s.timestamp=a;break;case"size":{let o=a,u=this.fs.realPath(s);if(this.fs.FS.isFile(s.mode)&&o>=0){let c=this.fs.API.get(u),d=c.data?c.data:new Uint8Array;o!==d.length&&(o<d.length?c.data=c.data.slice(0,o):(c.data=new Uint8Array(o),c.data.set(d)),this.fs.API.put(u,c))}else console.warn("setattr size of",o,"on",s,"not yet implemented");break}case"ctime":case"dontFollow":break;default:console.warn("setattr",r,"of",a,"on",s,"not yet implemented");break}},this.lookup=(t,n)=>{let s=this.node(t),r=this.fs.PATH.join2(this.fs.realPath(s),n),a=this.fs.API.lookup(r);if(!a.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(s,n,a.mode,0)},this.mknod=(t,n,s,r)=>{let a=this.node(t),o=this.fs.PATH.join2(this.fs.realPath(a),n);return this.fs.API.mknod(o,s),this.fs.createNode(a,n,s,r)},this.rename=(t,n,s)=>{let r=this.node(t),a=this.node(n);this.fs.API.rename(r.parent?this.fs.PATH.join2(this.fs.realPath(r.parent),r.name):r.name,this.fs.PATH.join2(this.fs.realPath(a),s)),r.name=s,r.parent=a},this.unlink=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.rmdir=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.readdir=t=>this.fs.API.readdir(this.fs.realPath(this.node(t))),this.symlink=(t,n,s)=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.readlink=t=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.fs=e}},pt=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:Ad.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:Ud.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}${po}${e}`),e}},Wn=class extends pt{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`}},Bt=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 $n(this)}createAPI(e){if(!e.browsingContextId||!e.baseUrl)throw new Error("Cannot create service-worker API without current browsingContextId");return new Wn(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 _s,vs,ho=nt(()=>{_s=$e(X());gs();vs=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:_s.PathExt.dirname(e.path),type:e.data.mode===16895?"directory":"file",ext:_s.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:Jn,blocks:Math.ceil(t.size||0/Jn),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 fo={};Eo(fo,{BLOCK_SIZE:()=>Jn,BrowserStorageDrive:()=>hs,ContentsAPI:()=>pt,DIR_MODE:()=>Kt,DRIVE_NAME:()=>ro,DRIVE_SEPARATOR:()=>po,DriveContentsProcessor:()=>vs,DriveFS:()=>Bt,DriveFSEmscriptenNodeOps:()=>Vn,DriveFSEmscriptenStreamOps:()=>$n,FILE:()=>Fe,FILE_MODE:()=>oo,MIME:()=>be,SEEK_CUR:()=>lo,SEEK_END:()=>co,ServiceWorkerContentsAPI:()=>Wn,instanceOfStream:()=>fs});var ys=nt(()=>{ao();gs();ds();ms();ho()});var Yn="function";var Re="64e10b34-2bf7-4616-9668-f99de5aa046e",Kd="M"+Re,Bd="T"+Re;var xs="get";var Cs="has";var ks="set";var{isArray:mt}=Array,{SharedArrayBuffer:gt,window:Io}=globalThis,{notify:Xn,wait:Zn,waitAsync:_t}=Atomics,Qn=null;_t||(_t=i=>({value:new Promise(e=>{let t=new Worker("data:application/javascript,onmessage%3D(%7Bdata%3Ab%7D)%3D%3E(Atomics.wait(b%2C0)%2CpostMessage(0))");t.onmessage=e,t.postMessage(i)})}));try{new gt(4)}catch{gt=ArrayBuffer;let e=new WeakMap;if(Io){let t=new Map,{prototype:{postMessage:n}}=Worker,s=r=>{var o;let a=(o=r.data)==null?void 0:o[Re];if(!mt(a)){r.stopImmediatePropagation();let{id:u,sb:c}=a;t.get(u)(c)}};Qn=function(r,...a){let o=r==null?void 0:r[Re];if(mt(o)){let[u,c]=o;e.set(c,u),this.addEventListener("message",s)}return n.call(this,r,...a)},_t=r=>({value:new Promise(a=>{t.set(e.get(r),a)}).then(a=>{t.delete(e.get(r)),e.delete(r);for(let o=0;o<a.length;o++)r[o]=a[o];return"ok"})})}else{let t=(n,s)=>({[Re]:{id:n,sb:s}});Xn=n=>{postMessage(t(e.get(n),n))},addEventListener("message",n=>{var r;let s=(r=n.data)==null?void 0:r[Re];if(mt(s)){let[a,o]=s;e.set(o,a)}})}}var{Int32Array:ti,Map:Ps,Uint16Array:ni}=globalThis,{BYTES_PER_ELEMENT:Es}=ti,{BYTES_PER_ELEMENT:Ro}=ni,Oo=(i,e,t)=>{for(;Zn(i,0,0,e)==="timed-out";)t()},ii=new WeakSet,ei=new WeakMap,Do={value:{then:i=>i()}},jo=0,Ms=(i,{parse:e=JSON.parse,stringify:t=JSON.stringify,transform:n,interrupt:s}=JSON)=>{if(!ei.has(i)){let r=Qn||i.postMessage,a=(p,..._)=>r.call(i,{[Re]:_},{transfer:p}),o=typeof s===Yn?s:s==null?void 0:s.handler,u=(s==null?void 0:s.delay)||42,c=new TextDecoder("utf-16"),d=(p,_)=>p?_t(_,0):(o?Oo(_,u,o):Zn(_,0),Do),l=!1;ei.set(i,new Proxy(new Ps,{[Cs]:(p,_)=>typeof _=="string"&&!_.startsWith("_"),[xs]:(p,_)=>_==="then"?null:(...g)=>{let E=jo++,S=new ti(new gt(Es*2)),O=[];ii.has(g.at(-1)||O)&&ii.delete(O=g.pop()),a(O,E,S,_,n?g.map(n):g);let q=i!==globalThis,b=0;return l&&q&&(b=setTimeout(console.warn,1e3,`\u{1F480}\u{1F512} - Possible deadlock if proxy.${_}(...args) is awaited`)),d(q,S).value.then(()=>{clearTimeout(b);let w=S[1];if(!w)return;let R=Ro*w;return S=new ti(new gt(R+R%Es)),a([],E,S),d(q,S).value.then(()=>e(c.decode(new ni(S.buffer).slice(0,w))))})},[ks](p,_,g){let E=typeof g;if(E!==Yn)throw new Error(`Unable to assign ${_} as ${E}`);if(!p.size){let S=new Ps;i.addEventListener("message",async O=>{var b;let q=(b=O.data)==null?void 0:b[Re];if(mt(q)){O.stopImmediatePropagation();let[w,R,...U]=q,T;if(U.length){let[D,A]=U;if(p.has(D)){l=!0;try{let h=await p.get(D)(...A);if(h!==void 0){let y=t(n?n(h):h);S.set(w,y),R[1]=y.length}}catch(h){T=h}finally{l=!1}}else T=new Error(`Unsupported action: ${D}`);R[0]=1}else{let D=S.get(w);S.delete(w);for(let A=new ni(R.buffer),h=0;h<D.length;h++)A[h]=D.charCodeAt(h)}if(Xn(R,0),T)throw T}})}return!!p.set(_,g)}}))}return ei.get(i)};Ms.transfer=(...i)=>(ii.add(i),i);var Is=Ms;ys();var Hn=class{constructor(){this._options=null;this._initializer=null;this._pyodide=null;this._localPath="";this._driveName="";this._driveFS=null;this._sendWorkerMessage=()=>{};this._logMessage=()=>{};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,stdout:r=>{console.log(r),this._logMessage({type:"text",level:"info",data:r})},stderr:r=>{console.error(r),this._logMessage({type:"text",level:"critical",data:r})},...e.loadPyodideOptions}),this._pyodide._api.on_fatal=async r=>{let a="";r.name==="Exit"?a="Pyodide has exited and can no longer be used.":a=`Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
|
|
9
|
+
See "state database" for more information.`)});var Xi=E(Me=>{"use strict";var od=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]}),Tt=Me&&Me.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&od(e,i,t)};Object.defineProperty(Me,"__esModule",{value:!0});Tt(Ea(),Me);Tt(Ia(),Me);Tt(ja(),Me);Tt(Ta(),Me);Tt(qa(),Me)});var es=E(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.SettingManager=void 0;var Zi=X(),ld=Xi(),qn=pe(),cd="api/settings",Qi=class extends ld.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=qt.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=qt.url(l,"",e==="ids"),_=await c(p,{},a);if(_.status!==200)throw new d(_);let g=await _.json(),M=(n=(t=g==null?void 0:g.settings)===null||t===void 0?void 0:t.map(R=>R.id))!==null&&n!==void 0?n:[],S=[];return e||(S=(r=(s=g==null?void 0:g.settings)===null||s===void 0?void 0:s.map(R=>(R.data={composite:{},user:{}},R)))!==null&&r!==void 0?r:[]),{ids:M,values:S}}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=qn.ServerConnection,u=s+r,c=qt.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)}};Un.SettingManager=Qi;var qt;(function(i){function e(t,n,s){let r=s?Zi.URLExt.objectToQueryString({ids_only:!0}):"",a=Zi.URLExt.join(t,cd),o=Zi.URLExt.join(a,n);if(!o.startsWith(a))throw new Error("Can only be used for workspaces requests");return`${o}${r}`}i.url=e})(qt||(qt={}))});var Nt=E(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.TerminalAPIClient=be.TERMINAL_SERVICE_URL=void 0;be.isAvailable=ns;be.startNew=Ua;be.listRunning=Aa;be.shutdownTerminal=Na;var Ut=X(),Fe=pe();be.TERMINAL_SERVICE_URL="api/terminals";function ns(){return String(Ut.PageConfig.getOption("terminalsAvailable")).toLowerCase()==="true"}async function Ua(i=Fe.ServerConnection.makeSettings(),e,t){At.errorIfNotAvailable();let n=Ut.URLExt.join(i.baseUrl,be.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 Aa(i=Fe.ServerConnection.makeSettings()){At.errorIfNotAvailable();let e=Ut.URLExt.join(i.baseUrl,be.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 Na(i,e=Fe.ServerConnection.makeSettings()){var t;At.errorIfNotAvailable();let n=Ut.URLExt.join(e.baseUrl,be.TERMINAL_SERVICE_URL),s=Ut.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 ts=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Fe.ServerConnection.makeSettings()}get isAvailable(){return ns()}async startNew(e={}){let{name:t,cwd:n}=e;return Ua(this.serverSettings,t,n)}async listRunning(){return Aa(this.serverSettings)}async shutdown(e){return Na(e,this.serverSettings)}};be.TerminalAPIClient=ts;var At;(function(i){function e(){if(!ns())throw new Error("Terminals Unavailable")}i.errorIfNotAvailable=e})(At||(At={}))});var La=E(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.isAvailable=void 0;var dd=Nt();Object.defineProperty(An,"isAvailable",{enumerable:!0,get:function(){return dd.isAvailable}})});var za=E(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.TerminalConnection=void 0;var ud=X(),pd=ne(),Nn=Q(),hd=Be(),fd=Nt(),is=class i{constructor(e){var t,n;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let s=this._name,r=this.serverSettings,a=ud.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:hd.ServerConnection.makeSettings(),this._terminalAPIClient=(n=e.terminalAPIClient)!==null&&n!==void 0?n:new fd.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 pd.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=ss.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}};Ln.TerminalConnection=is;var ss;(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})(ss||(ss={}))});var Ka=E(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.TerminalManager=void 0;var md=et(),Fa=Q(),gd=Be(),_d=Qe(),vd=Nt(),yd=za(),Lt=class extends _d.BaseManager{constructor(e={}){var t,n;if(super(e),this._isReady=!1,this._names=[],this._terminalConnections=new Set,this._runningChanged=new Fa.Signal(this),this._connectionFailure=new Fa.Signal(this),this._terminalAPIClient=(t=e.terminalAPIClient)!==null&&t!==void 0?t:new vd.TerminalAPIClient({serverSettings:this.serverSettings}),!this.isAvailable()){this._ready=Promise.reject("Terminals unavailable"),this._ready.catch(s=>{});return}this._pollModels=new md.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 yd.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 gd.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}))}};zt.TerminalManager=Lt;(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})(Lt||(zt.TerminalManager=Lt={}))});var rs=E(_e=>{"use strict";var Ba=_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]}),wd=_e&&_e.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),$a=_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)&&Ba(e,i,t);return wd(e,i),e},bd=_e&&_e.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ba(e,i,t)};Object.defineProperty(_e,"__esModule",{value:!0});_e.TerminalAPI=_e.Terminal=void 0;var Sd=$a(La());_e.Terminal=Sd;var xd=$a(Nt());_e.TerminalAPI=xd;bd(Ka(),_e)});var Wa=E(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0})});var os=E(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.UserAPIClient=void 0;var Ja=pe(),Cd=X(),kd="api/me",as=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ja.ServerConnection.makeSettings()}async get(){let{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=Ja.ServerConnection,s=Cd.URLExt.join(e,kd),r=await t(s,{},this.serverSettings);if(r.status!==200)throw await n.create(r);return await r.json()}};zn.UserAPIClient=as});var Ga=E(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.UserManager=void 0;var Pd=ne(),Ed=et(),Ha=Q(),Md=Qe(),Id=os(),ls="@jupyterlab/services:UserManager#user",cs=class extends Md.BaseManager{constructor(e={}){var t,n;super(e),this._isReady=!1,this._userChanged=new Ha.Signal(this),this._connectionFailure=new Ha.Signal(this),this._userApiClient=(t=e.userApiClient)!==null&&t!==void 0?t:new Id.UserAPIClient({serverSettings:this.serverSettings}),this._ready=this.requestUser().then(()=>{this.isDisposed||(this._isReady=!0)}).catch(s=>new Promise(()=>{})),this._pollUser=new Ed.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:ls,standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this.ready.then(()=>{this._pollUser.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._pollUser.dispose(),super.dispose()}async refreshUser(){await this._pollUser.refresh(),await this._pollUser.tick}async requestUser(){if(this.isDisposed)return;let e={identity:this._identity,permissions:this._permissions},t=await this._userApiClient.get(),n=t.identity,{localStorage:s}=window,r=s.getItem(ls);if(r&&(!n.initials||!n.color)){let a=JSON.parse(r);n.initials=n.initials||a.initials||n.name.substring(0,1),n.color=n.color||a.color||ds.getRandomColor()}Pd.JSONExt.deepEqual(t,e)||(this._identity=n,this._permissions=t.permissions,s.setItem(ls,JSON.stringify(n)),this._userChanged.emit(t))}};Fn.UserManager=cs;var ds;(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)]})(ds||(ds={}))});var us=E(ve=>{"use strict";var Ya=ve&&ve.__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]}),Od=ve&&ve.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Xa=ve&&ve.__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)&&Ya(e,i,t);return Od(e,i),e},Rd=ve&&ve.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ya(e,i,t)};Object.defineProperty(ve,"__esModule",{value:!0});ve.UserAPI=ve.User=void 0;var Dd=Xa(Wa());ve.User=Dd;var jd=Xa(os());ve.UserAPI=jd;Rd(Ga(),ve)});var hs=E(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.WorkspaceManager=void 0;var Za=X(),Td=Xi(),Ft=pe(),qd="api/workspaces",ps=class extends Td.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ft.ServerConnection.makeSettings()}async fetch(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=Ft.ServerConnection,o=n+s,u=pt.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}=Ft.ServerConnection,a=t+n,o=pt.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}=Ft.ServerConnection,o=n+s,u=pt.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}=Ft.ServerConnection,u=s+r,c=pt.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)}};Kn.WorkspaceManager=ps;var pt;(function(i){function e(t,n){let s=Za.URLExt.join(t,qd),r=Za.URLExt.join(s,n);if(!r.startsWith(s))throw new Error("Can only be used for workspaces requests");return r}i.url=e})(pt||(pt={}))});var eo=E(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.ServiceManager=void 0;var Qa=Q(),Ud=pa(),Ad=Pi(),Nd=Mi(),Ld=Ai(),zd=Li(),Fd=Vi(),Kd=pe(),Bd=Hi(),$d=es(),Vd=rs(),Wd=us(),Jd=hs(),fs=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:Kd.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 Ad.ContentsManager(o),this.events=e.events||new Nd.EventManager(o),this.kernels=e.kernels||new Ld.KernelManager(o),this.sessions=e.sessions||new Bd.SessionManager({...o,kernelManager:this.kernels}),this.settings=e.settings||new $d.SettingManager(o),this.terminals=e.terminals||new Vd.TerminalManager(o),this.builder=e.builder||new Ud.BuildManager(o),this.workspaces=e.workspaces||new Jd.WorkspaceManager(o),this.nbconvert=e.nbconvert||new Fd.NbConvertManager(o),this.kernelspecs=e.kernelspecs||new zd.KernelSpecManager(o),this.user=e.user||new Wd.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)}};Bn.ServiceManager=fs});var to=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 ye=ne();L.IConnectionStatus=new ye.Token("@jupyterlab/application:IConnectionStatus","A service providing the application connection status.");L.IConfigSectionManager=new ye.Token("@jupyterlab/services:IConfigSectionManager","A service providing the config section manager.");L.IContentsManager=new ye.Token("@jupyterlab/services:IContentsManager","The contents manager token.");L.IDefaultDrive=new ye.Token("@jupyterlab/services:IDefaultDrive","The default drive for the contents manager.");L.IEventManager=new ye.Token("@jupyterlab/services:IEventManager","The event manager token.");L.IKernelManager=new ye.Token("@jupyterlab/services:IKernelManager","The kernel manager token.");L.IKernelSpecManager=new ye.Token("@jupyterlab/services:IKernelSpecManager","The kernel spec manager token.");L.INbConvertManager=new ye.Token("@jupyterlab/services:INbConvertManager","The nbconvert manager token.");L.IServerSettings=new ye.Token("@jupyterlab/services:IServerSettings","The server settings for the application.");L.ISessionManager=new ye.Token("@jupyterlab/services:ISessionManager","The session manager token.");L.ISettingManager=new ye.Token("@jupyterlab/services:ISettingManager","The setting manager token.");L.IServiceManager=new ye.Token("@jupyterlab/services:IServiceManager","The service manager for the application.");L.ITerminalManager=new ye.Token("@jupyterlab/services:ITerminalManager","The terminal manager token.");L.IUserManager=new ye.Token("@jupyterlab/services:IUserManager","The user manager token.");L.IWorkspaceManager=new ye.Token("@jupyterlab/services:IWorkspaceManager","The workspace manager token.")});var Be=E(W=>{"use strict";var Hd=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]}),ce=W&&W.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Hd(e,i,t)};Object.defineProperty(W,"__esModule",{value:!0});ce(Qe(),W);ce(Pr(),W);ce(Er(),W);ce(Pi(),W);ce(Mi(),W);ce(Ai(),W);ce(Li(),W);ce(eo(),W);ce(pe(),W);ce(Hi(),W);ce(es(),W);ce(rs(),W);ce(to(),W);ce(us(),W);ce(hs(),W);ce(Vi(),W)});var io=E((Mp,no)=>{"use strict";function $n(){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)}$n.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)}}};$n.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};$n.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};no.exports=$n});var ro=E((Ip,so)=>{so.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 oo=E((Op,ao)=>{ao.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 co=E((Rp,lo)=>{"use strict";var Gd=io();lo.exports=new Gd(ro(),oo())});var uo,po,Se,Ke,ms=it(()=>{uo=Ve(X()),po=Ve(co());(function(i){i.JSON="application/json",i.PLAIN_TEXT="text/plain",i.OCTET_STREAM="octet/stream"})(Se||(Se={}));(function(i){let e=JSON.parse(uo.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 po.default.getType(s)||r||Se.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})(Ke||(Ke={}))});var Ie,mo,Pe,go,_s,ho,_o,fo,Kt,gs,vs,Vn,vo=it(()=>{Ie=Ve(X()),mo=Ve(Be()),Pe=Ve(X()),go=Ve(ne()),_s=Ve(Q());ms();ho="JupyterLite Storage",_o="BrowserStorage",fo=5,Kt=new TextEncoder,gs=new TextDecoder("utf-8"),vs=class{constructor(e){var t;this.reduceBytesToString=(n,s)=>n+String.fromCharCode(s),this._serverContents=new Map,this._isDisposed=!1,this._fileChanged=new _s.Signal(this),this._storageName=ho,this._storageDrivers=null,this._localforage=e.localforage,this._storageName=e.storageName||ho,this._storageDrivers=e.storageDrivers||null,this._serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:mo.ServerConnection.makeSettings(),this._ready=new go.PromiseDelegate,this.initialize().catch(console.warn)}dispose(){this.isDisposed||(this._isDisposed=!0,_s.Signal.clearData(this))}get isDisposed(){return this._isDisposed}get name(){return _o}get serverSettings(){return this._serverSettings}get fileChanged(){return this._fileChanged}async getDownloadUrl(e){e=decodeURIComponent(e.replace(/^\//,""));let n=await(await this.storage).getItem(e);if(n&&n.content!==null){let a;if(n.format==="base64"){let o=atob(n.content),u=new Uint8Array(o.length);for(let c=0;c<o.length;c++)u[c]=o.charCodeAt(c);a=new Blob([u],{type:n.mimetype})}else if(n.format==="json"){let o=JSON.stringify(n.content);a=new Blob([o],{type:n.mimetype})}else a=new Blob([n.content],{type:n.mimetype});return URL.createObjectURL(a)}let s=this.serverSettings.baseUrl;return Ie.URLExt.join(s,"files",Ie.URLExt.encodeParts(e))}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 clearStorage(){await Promise.all([(await this.storage).clear(),(await this.counters).clear(),(await this.checkpoints).clear()])}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=Pe.PathExt.dirname(r),c=Pe.PathExt.basename(r),d=Pe.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 _;switch(a){case"directory":{p=`Untitled Folder${await this._incrementCounter("directory")||""}`,_={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 M=await this._incrementCounter("notebook");p=p||`Untitled${M||""}.ipynb`,_={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:Se.JSON,content:Vn.EMPTY_NB,size:Kt.encode(JSON.stringify(Vn.EMPTY_NB)).length,writable:!0,type:"notebook"};break}default:{let M=(s=e==null?void 0:e.ext)!==null&&s!==void 0?s:".txt";M.startsWith(".")||(M=`.${M}`);let S=await this._incrementCounter("file"),R=Ke.getType(M)||Se.OCTET_STREAM,q;Ke.hasFormat(M,"text")||R.indexOf("text")!==-1?q="text":M.indexOf("json")!==-1||M.indexOf("ipynb")!==-1?q="json":q="base64",p=p||`untitled${S||""}${M}`,_={name:p,path:`${u}${p}`,last_modified:o,created:o,format:q,mimetype:R,content:"",size:0,writable:!0,type:"file"};break}}let g=_.path;return await(await this.storage).setItem(g,_),this._fileChanged.emit({type:"new",oldValue:null,newValue:_}),_}async copy(e,t){let n=Pe.PathExt.basename(e);for(t=t===""?"":`${Pe.PathExt.removeSlash(t)}/`;await this.get(`${t}${n}`,{content:!0}).then(()=>!0).catch(()=>!1);){let a=Pe.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:Pe.PathExt.basename(e),path:e,last_modified:a.last_modified,created:a.created,format:"json",mimetype:Se.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=Pe.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(Ie.URLExt.join(e,c.name),Ie.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=Pe.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(gs.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"notebook",size:l.length}}else if(Ke.hasFormat(s,"json")){let p=d?JSON.parse(gs.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"file",size:l.length}}else if(Ke.hasFormat(s,"text")){let p=d?gs.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:Kt.encode(JSON.stringify(o.content)).length};break}case"text":{o={...o,size:Kt.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>fo&&r.splice(0,r.length-fo),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:Se.JSON,content:Array.from(t.values()),size:0,writable:!0,type:"directory"}}async _getServerContents(e,t){let n=Pe.PathExt.basename(e),r=(await this._getServerDirectory(Ie.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:Se.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=Ie.URLExt.join(Ie.PageConfig.getBaseUrl(),"files",e),o=await fetch(a);if(!o.ok)return null;let u=r.mimetype||o.headers.get("Content-Type"),c=Pe.PathExt.extname(n);if(r.type==="notebook"||Ke.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||Se.JSON,size:Kt.encode(d).length}}else if(Ke.hasFormat(c,"text")||u.indexOf("text")!==-1){let d=await o.text();r={...r,content:d,format:"text",mimetype:u||Se.PLAIN_TEXT,size:Kt.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||Se.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=Ie.URLExt.join(Ie.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 ys(i){return"node"in i}var Bt,yo,wo,bo,ws=it(()=>{Bt=16895,yo=33206,wo=1,bo=2});var So,Yn,Yd,Xd,Wn,Jn,Hn,ht,Gn,$t,bs=it(()=>{ws();So=":",Yn=4096,Yd=new TextEncoder,Xd=new TextDecoder("utf-8"),Wn={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},Jn=class{constructor(e){this.fs=e}open(e){var t;let n=this.fs.realPath(e.node);if(this.fs.FS.isFile(e.node.mode))try{let s=this.fs.API.get(n);e.file=s}catch{let r=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,a=typeof r=="string"?parseInt(r,10):r;a&=8191;let o=!0;if(a in Wn&&(o=Wn[a]),o){e.node=this.fs.node_ops.mknod(e.node.parent,e.node.name,e.node.mode,0);let u=this.fs.API.get(n);e.file=u}else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT)}}close(e){var t;if(!this.fs.FS.isFile(e.node.mode)||!e.file)return;let n=this.fs.realPath(e.node),s=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,r=typeof s=="string"?parseInt(s,10):s;r&=8191;let a=!0;r in Wn&&(a=Wn[r]),a&&this.fs.API.put(n,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){var s;let r=t;if(n===1)r+=(s=e.position)!==null&&s!==void 0?s:e.shared.position;else if(n===2&&this.fs.FS.isFile(e.node.mode))if(e.file!==void 0)r+=e.file.data.length;else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);if(r<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return r}},Hn=class{constructor(e){this.node=t=>ys(t)?t.node:t,this.getattr=t=>{let n=this.node(t);return{...this.fs.API.getattr(this.fs.realPath(n)),mode:n.mode,ino:n.id}},this.setattr=(t,n)=>{let s=this.node(t);for(let[r,a]of Object.entries(n))switch(r){case"mode":s.mode=a;break;case"timestamp":s.timestamp=a;break;case"size":{let o=a,u=this.fs.realPath(s);if(this.fs.FS.isFile(s.mode)&&o>=0){let c;try{c=this.fs.API.get(u)}catch{break}let d=c.data?c.data:new Uint8Array;o!==d.length&&(o<d.length?c.data=c.data.slice(0,o):(c.data=new Uint8Array(o),c.data.set(d)),this.fs.API.put(u,c))}else console.warn("setattr size of",o,"on",s,"not yet implemented");break}case"ctime":case"dontFollow":break;default:console.warn("setattr",r,"of",a,"on",s,"not yet implemented");break}},this.lookup=(t,n)=>{let s=this.node(t),r=this.fs.PATH.join2(this.fs.realPath(s),n),a=this.fs.API.lookup(r);if(!a.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(s,n,a.mode,0)},this.mknod=(t,n,s,r)=>{let a=this.node(t),o=this.fs.PATH.join2(this.fs.realPath(a),n);return this.fs.API.mknod(o,s),this.fs.createNode(a,n,s,r)},this.rename=(t,n,s)=>{let r=this.node(t),a=this.node(n);this.fs.API.rename(r.parent?this.fs.PATH.join2(this.fs.realPath(r.parent),r.name):r.name,this.fs.PATH.join2(this.fs.realPath(a),s)),r.name=s,r.parent=a},this.unlink=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.rmdir=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.readdir=t=>this.fs.API.readdir(this.fs.realPath(this.node(t))),this.symlink=(t,n,s)=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.readlink=t=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAR)},this.fs=e}},ht=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:Yd.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:Xd.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}},Gn=class extends ht{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`}},$t=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 Hn(this),this.stream_ops=new Jn(this)}createAPI(e){if(!e.browsingContextId||!e.baseUrl)throw new Error("Cannot create service-worker API without current browsingContextId");return new Gn(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 Ss,xs,xo=it(()=>{Ss=Ve(X());bs();xs=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:Ss.PathExt.dirname(e.path),type:e.data.mode===16895?"directory":"file",ext:Ss.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:Yn,blocks:Math.ceil(t.size||0/Yn),atime:t.last_modified||n,mtime:t.last_modified||n,ctime:t.created||n,timestamp:0}}async get(e){let t;try{t=await this.contentsManager.get(e.path,{content:!0})}catch{return null}let n=null;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"&&e.data.data?JSON.parse(e.data.data):e.data.data,type:"file",format:e.data.format}),null}}});var Co={};Ao(Co,{BLOCK_SIZE:()=>Yn,BrowserStorageDrive:()=>vs,ContentsAPI:()=>ht,DIR_MODE:()=>Bt,DRIVE_NAME:()=>_o,DRIVE_SEPARATOR:()=>So,DriveContentsProcessor:()=>xs,DriveFS:()=>$t,DriveFSEmscriptenNodeOps:()=>Hn,DriveFSEmscriptenStreamOps:()=>Jn,FILE:()=>Ke,FILE_MODE:()=>yo,MIME:()=>Se,SEEK_CUR:()=>wo,SEEK_END:()=>bo,ServiceWorkerContentsAPI:()=>Gn,instanceOfStream:()=>ys});var Cs=it(()=>{vo();bs();ms();ws();xo()});var Qn="function";var Re="64e10b34-2bf7-4616-9668-f99de5aa046e",nu="M"+Re,iu="T"+Re;var Ms="get";var Is="has";var Os="set";var{isArray:gt}=Array,{SharedArrayBuffer:_t,window:Lo}=globalThis,{notify:ei,wait:ti,waitAsync:vt}=Atomics,ni=null;vt||(vt=i=>({value:new Promise(e=>{let t=new Worker("data:application/javascript,onmessage%3D(%7Bdata%3Ab%7D)%3D%3E(Atomics.wait(b%2C0)%2CpostMessage(0))");t.onmessage=e,t.postMessage(i)})}));try{new _t(4)}catch{_t=ArrayBuffer;let e=new WeakMap;if(Lo){let t=new Map,{prototype:{postMessage:n}}=Worker,s=r=>{var o;let a=(o=r.data)==null?void 0:o[Re];if(!gt(a)){r.stopImmediatePropagation();let{id:u,sb:c}=a;t.get(u)(c)}};ni=function(r,...a){let o=r==null?void 0:r[Re];if(gt(o)){let[u,c]=o;e.set(c,u),this.addEventListener("message",s)}return n.call(this,r,...a)},vt=r=>({value:new Promise(a=>{t.set(e.get(r),a)}).then(a=>{t.delete(e.get(r)),e.delete(r);for(let o=0;o<a.length;o++)r[o]=a[o];return"ok"})})}else{let t=(n,s)=>({[Re]:{id:n,sb:s}});ei=n=>{postMessage(t(e.get(n),n))},addEventListener("message",n=>{var r;let s=(r=n.data)==null?void 0:r[Re];if(gt(s)){let[a,o]=s;e.set(o,a)}})}}var{Int32Array:si,Map:Rs,Uint16Array:ri}=globalThis,{BYTES_PER_ELEMENT:Ds}=si,{BYTES_PER_ELEMENT:zo}=ri,Fo=(i,e,t)=>{for(;ti(i,0,0,e)==="timed-out";)t()},ai=new WeakSet,ii=new WeakMap,Ko={value:{then:i=>i()}},Bo=0,js=(i,{parse:e=JSON.parse,stringify:t=JSON.stringify,transform:n,interrupt:s}=JSON)=>{if(!ii.has(i)){let r=ni||i.postMessage,a=(p,..._)=>r.call(i,{[Re]:_},{transfer:p}),o=typeof s===Qn?s:s==null?void 0:s.handler,u=(s==null?void 0:s.delay)||42,c=new TextDecoder("utf-16"),d=(p,_)=>p?vt(_,0):(o?Fo(_,u,o):ti(_,0),Ko),l=!1;ii.set(i,new Proxy(new Rs,{[Is]:(p,_)=>typeof _=="string"&&!_.startsWith("_"),[Ms]:(p,_)=>_==="then"?null:(...g)=>{let M=Bo++,S=new si(new _t(Ds*2)),R=[];ai.has(g.at(-1)||R)&&ai.delete(R=g.pop()),a(R,M,S,_,n?g.map(n):g);let q=i!==globalThis,b=0;return l&&q&&(b=setTimeout(console.warn,1e3,`\u{1F480}\u{1F512} - Possible deadlock if proxy.${_}(...args) is awaited`)),d(q,S).value.then(()=>{clearTimeout(b);let w=S[1];if(!w)return;let O=zo*w;return S=new si(new _t(O+O%Ds)),a([],M,S),d(q,S).value.then(()=>e(c.decode(new ri(S.buffer).slice(0,w))))})},[Os](p,_,g){let M=typeof g;if(M!==Qn)throw new Error(`Unable to assign ${_} as ${M}`);if(!p.size){let S=new Rs;i.addEventListener("message",async R=>{var b;let q=(b=R.data)==null?void 0:b[Re];if(gt(q)){R.stopImmediatePropagation();let[w,O,...A]=q,T;if(A.length){let[D,U]=A;if(p.has(D)){l=!0;try{let h=await p.get(D)(...U);if(h!==void 0){let y=t(n?n(h):h);S.set(w,y),O[1]=y.length}}catch(h){T=h}finally{l=!1}}else T=new Error(`Unsupported action: ${D}`);O[0]=1}else{let D=S.get(w);S.delete(w);for(let U=new ri(O.buffer),h=0;h<D.length;h++)U[h]=D.charCodeAt(h)}if(ei(O,0),T)throw T}})}return!!p.set(_,g)}}))}return ii.get(i)};js.transfer=(...i)=>(ai.add(i),i);var Ts=js;Cs();var Xn=class{constructor(){this._options=null;this._initializer=null;this._pyodide=null;this._localPath="";this._driveName="";this._driveFS=null;this._sendWorkerMessage=()=>{};this._logMessage=()=>{};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,stdout:r=>{console.log(r),this._logMessage({type:"text",level:"info",data:r})},stderr:r=>{console.error(r),this._logMessage({type:"text",level:"critical",data:r})},...e.loadPyodideOptions}),this._pyodide._api.on_fatal=async r=>{let a="";r.name==="Exit"?a="Pyodide has exited and can no longer be used.":a=`Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
|
|
11
11
|
The cause of the error was: ${r.name}
|
|
12
12
|
${r.message}
|
|
13
13
|
Stack trace:
|
|
@@ -19,7 +19,7 @@ ${r.stack}`,this._logMessage({type:"text",level:"critical",data:a})}}async initP
|
|
|
19
19
|
piplite.piplite._PIPLITE_DISABLE_PYPI = ${n?"True":"False"}
|
|
20
20
|
piplite.piplite._PIPLITE_URLS = ${JSON.stringify(s)}
|
|
21
21
|
`)}async initKernel(e){let t=(e.loadPyodideOptions||{}).packages||[],n=["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(`
|
|
22
|
-
`))}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(()=>(
|
|
22
|
+
`))}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(()=>(Cs(),Co)),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)}registerWorkerMessageCallback(e){this._sendWorkerMessage=e}registerLogMessageCallback(e){this._logMessage=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,_)=>{let g={execution_count:l,data:this.formatResult(p),metadata:this.formatResult(_)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:g,type:"execute_result"})},s=(l,p,_)=>{let g={ename:l,evalue:p,traceback:_};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:g,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,_)=>{let g={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(_)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:g,type:"display_data"})},o=(l,p,_)=>{let g={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(_)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:g,type:"update_display_data"})},u=(l,p)=>{let _={name:this.formatResult(l),text:this.formatResult(p)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,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){}getpass(e){return e=typeof e=="undefined"?"":e,this.sendInputRequest(e,!0)}input(e){return e=typeof e=="undefined"?"":e,this.sendInputRequest(e,!1)}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 de=Ts(self),ks=class extends ht{request(e){return de.processDriveRequest(e)}},Ps=class extends $t{createAPI(e){return new ks(e)}},Es=class extends Xn{async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a}=e,o=new Ps({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}}sendInputRequest(e,t){return de.processStdinRequest({prompt:e,password:t})}},J=new Es,Zd=de.processWorkerMessage.bind(de);J.registerWorkerMessageCallback(Zd);var Qd=de.processLogMessage.bind(de);J.registerLogMessageCallback(Qd);de.initialize=J.initialize.bind(J);de.execute=J.execute.bind(J);de.complete=J.complete.bind(J);de.inspect=J.inspect.bind(J);de.isComplete=J.isComplete.bind(J);de.commInfo=J.commInfo.bind(J);de.commOpen=J.commOpen.bind(J);de.commMsg=J.commMsg.bind(J);de.commClose=J.commClose.bind(J);de.inputReply=J.inputReply.bind(J);export{Es as PyodideCoincidentKernel,ks as SharedBufferContentsAPI};
|
|
23
23
|
/*! Bundled license information:
|
|
24
24
|
|
|
25
25
|
coincident/esm/index.js:
|