@jupyterlite/pyodide-kernel 0.7.1 → 0.7.2
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 +2 -2
- package/lib/coincident.worker.js.map +2 -2
- package/lib/comlink.worker.js.map +2 -2
- package/package.json +6 -6
- package/pypi/all.json +33 -33
- package/pypi/ipykernel-6.9.2-py3-none-any.whl +0 -0
- package/pypi/{piplite-0.7.1-py3-none-any.whl → piplite-0.7.2-py3-none-any.whl} +0 -0
- package/pypi/{pyodide_kernel-0.7.1-py3-none-any.whl → pyodide_kernel-0.7.2-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/_pypi.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as allJSONUrl from '../pypi/all.json';
|
|
2
2
|
export * as ipykernelWheelUrl from '../pypi/ipykernel-6.9.2-py3-none-any.whl';
|
|
3
|
-
export * as pipliteWheelUrl from '../pypi/piplite-0.7.
|
|
4
|
-
export * as pyodide_kernelWheelUrl from '../pypi/pyodide_kernel-0.7.
|
|
3
|
+
export * as pipliteWheelUrl from '../pypi/piplite-0.7.2-py3-none-any.whl';
|
|
4
|
+
export * as pyodide_kernelWheelUrl from '../pypi/pyodide_kernel-0.7.2-py3-none-any.whl';
|
|
5
5
|
export * as widgetsnbextensionWheelUrl from '../pypi/widgetsnbextension-3.6.999-py3-none-any.whl';
|
|
6
6
|
export * as widgetsnbextensionWheelUrl1 from '../pypi/widgetsnbextension-4.0.999-py3-none-any.whl';
|
package/lib/_pypi.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// this file is autogenerated from the wheels described in ../package.json
|
|
2
2
|
export * as allJSONUrl from '../pypi/all.json';
|
|
3
3
|
export * as ipykernelWheelUrl from '../pypi/ipykernel-6.9.2-py3-none-any.whl';
|
|
4
|
-
export * as pipliteWheelUrl from '../pypi/piplite-0.7.
|
|
5
|
-
export * as pyodide_kernelWheelUrl from '../pypi/pyodide_kernel-0.7.
|
|
4
|
+
export * as pipliteWheelUrl from '../pypi/piplite-0.7.2-py3-none-any.whl';
|
|
5
|
+
export * as pyodide_kernelWheelUrl from '../pypi/pyodide_kernel-0.7.2-py3-none-any.whl';
|
|
6
6
|
export * as widgetsnbextensionWheelUrl from '../pypi/widgetsnbextension-3.6.999-py3-none-any.whl';
|
|
7
7
|
export * as widgetsnbextensionWheelUrl1 from '../pypi/widgetsnbextension-4.0.999-py3-none-any.whl';
|
package/lib/coincident.worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Xe=Object.create;var he=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty;var Me=(d,e)=>()=>(d&&(e=d(d=0)),e);var Oe=(d,e)=>()=>(e||d((e={exports:{}}).exports,e),e.exports),it=(d,e)=>{for(var t in e)he(d,t,{get:e[t],enumerable:!0})},nt=(d,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Qe(e))!tt.call(d,a)&&a!==t&&he(d,a,{get:()=>e[a],enumerable:!(o=Ze(e,a))||o.enumerable});return d};var rt=(d,e,t)=>(t=d!=null?Xe(et(d)):{},nt(e||!d||!d.__esModule?he(t,"default",{value:d,enumerable:!0}):t,d));var Fe=Oe((oe,Ce)=>{(function(d,e){typeof oe=="object"&&typeof Ce!="undefined"?e(oe):typeof define=="function"&&define.amd?define(["exports"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d.lumino_algorithm={}))})(oe,function(d){"use strict";d.ArrayExt=void 0,function(u){function p(f,h,n=0,i=-1){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;i<n?m=i+1+(r-n):m=i-n+1;for(let P=0;P<m;++P){let F=(n+P)%r;if(f[F]===h)return F}return-1}u.firstIndexOf=p;function y(f,h,n=-1,i=0){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;n<i?m=n+1+(r-i):m=n-i+1;for(let P=0;P<m;++P){let F=(n-P+r)%r;if(f[F]===h)return F}return-1}u.lastIndexOf=y;function v(f,h,n=0,i=-1){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;i<n?m=i+1+(r-n):m=i-n+1;for(let P=0;P<m;++P){let F=(n+P)%r;if(h(f[F],F))return F}return-1}u.findFirstIndex=v;function C(f,h,n=-1,i=0){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;n<i?m=n+1+(r-i):m=n-i+1;for(let P=0;P<m;++P){let F=(n-P+r)%r;if(h(f[F],F))return F}return-1}u.findLastIndex=C;function U(f,h,n=0,i=-1){let r=v(f,h,n,i);return r!==-1?f[r]:void 0}u.findFirstValue=U;function I(f,h,n=-1,i=0){let r=C(f,h,n,i);return r!==-1?f[r]:void 0}u.findLastValue=I;function N(f,h,n,i=0,r=-1){let m=f.length;if(m===0)return 0;i<0?i=Math.max(0,i+m):i=Math.min(i,m-1),r<0?r=Math.max(0,r+m):r=Math.min(r,m-1);let P=i,F=r-i+1;for(;F>0;){let Y=F>>1,te=P+Y;n(f[te],h)<0?(P=te+1,F-=Y+1):F=Y}return P}u.lowerBound=N;function $(f,h,n,i=0,r=-1){let m=f.length;if(m===0)return 0;i<0?i=Math.max(0,i+m):i=Math.min(i,m-1),r<0?r=Math.max(0,r+m):r=Math.min(r,m-1);let P=i,F=r-i+1;for(;F>0;){let Y=F>>1,te=P+Y;n(f[te],h)>0?F=Y:(P=te+1,F-=Y+1)}return P}u.upperBound=$;function j(f,h,n){if(f===h)return!0;if(f.length!==h.length)return!1;for(let i=0,r=f.length;i<r;++i)if(n?!n(f[i],h[i]):f[i]!==h[i])return!1;return!0}u.shallowEqual=j;function H(f,h={}){let{start:n,stop:i,step:r}=h;if(r===void 0&&(r=1),r===0)throw new Error("Slice `step` cannot be zero.");let m=f.length;n===void 0?n=r<0?m-1:0:n<0?n=Math.max(n+m,r<0?-1:0):n>=m&&(n=r<0?m-1:m),i===void 0?i=r<0?-1:m:i<0?i=Math.max(i+m,r<0?-1:0):i>=m&&(i=r<0?m-1:m);let P;r<0&&i>=n||r>0&&n>=i?P=0:r<0?P=Math.floor((i-n+1)/r+1):P=Math.floor((i-n-1)/r+1);let F=[];for(let Y=0;Y<P;++Y)F[Y]=f[n+Y*r];return F}u.slice=H;function z(f,h,n){let i=f.length;if(i<=1||(h<0?h=Math.max(0,h+i):h=Math.min(h,i-1),n<0?n=Math.max(0,n+i):n=Math.min(n,i-1),h===n))return;let r=f[h],m=h<n?1:-1;for(let P=h;P!==n;P+=m)f[P]=f[P+m];f[n]=r}u.move=z;function V(f,h=0,n=-1){let i=f.length;if(!(i<=1))for(h<0?h=Math.max(0,h+i):h=Math.min(h,i-1),n<0?n=Math.max(0,n+i):n=Math.min(n,i-1);h<n;){let r=f[h],m=f[n];f[h++]=m,f[n--]=r}}u.reverse=V;function G(f,h,n=0,i=-1){let r=f.length;if(r<=1||(n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1),n>=i))return;let m=i-n+1;if(h>0?h=h%m:h<0&&(h=(h%m+m)%m),h===0)return;let P=n+h;V(f,n,P-1),V(f,P,i),V(f,n,i)}u.rotate=G;function X(f,h,n=0,i=-1){let r=f.length;if(r===0)return;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;i<n?m=i+1+(r-n):m=i-n+1;for(let P=0;P<m;++P)f[(n+P)%r]=h}u.fill=X;function He(f,h,n){let i=f.length;h<0?h=Math.max(0,h+i):h=Math.min(h,i);for(let r=i;r>h;--r)f[r]=f[r-1];f[h]=n}u.insert=He;function ee(f,h){let n=f.length;if(h<0&&(h+=n),h<0||h>=n)return;let i=f[h];for(let r=h+1;r<n;++r)f[r-1]=f[r];return f.length=n-1,i}u.removeAt=ee;function Ke(f,h,n=0,i=-1){let r=p(f,h,n,i);return r!==-1&&ee(f,r),r}u.removeFirstOf=Ke;function Be(f,h,n=-1,i=0){let r=y(f,h,n,i);return r!==-1&&ee(f,r),r}u.removeLastOf=Be;function Ve(f,h,n=0,i=-1){let r=f.length;if(r===0)return 0;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m=0;for(let P=0;P<r;++P)n<=i&&P>=n&&P<=i&&f[P]===h||i<n&&(P<=i||P>=n)&&f[P]===h?m++:m>0&&(f[P-m]=f[P]);return m>0&&(f.length=r-m),m}u.removeAllOf=Ve;function Ye(f,h,n=0,i=-1){let r,m=v(f,h,n,i);return m!==-1&&(r=ee(f,m)),{index:m,value:r}}u.removeFirstWhere=Ye;function Ge(f,h,n=-1,i=0){let r,m=C(f,h,n,i);return m!==-1&&(r=ee(f,m)),{index:m,value:r}}u.removeLastWhere=Ge;function Je(f,h,n=0,i=-1){let r=f.length;if(r===0)return 0;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m=0;for(let P=0;P<r;++P)n<=i&&P>=n&&P<=i&&h(f[P],P)||i<n&&(P<=i||P>=n)&&h(f[P],P)?m++:m>0&&(f[P-m]=f[P]);return m>0&&(f.length=r-m),m}u.removeAllWhere=Je}(d.ArrayExt||(d.ArrayExt={}));function*e(...u){for(let p of u)yield*p}function*t(){}function*o(u,p=0){for(let y of u)yield[p++,y]}function*a(u,p){let y=0;for(let v of u)p(v,y++)&&(yield v)}function c(u,p){let y=0;for(let v of u)if(p(v,y++))return v}function g(u,p){let y=0;for(let v of u)if(p(v,y++))return y-1;return-1}function k(u,p){let y;for(let v of u){if(y===void 0){y=v;continue}p(v,y)<0&&(y=v)}return y}function x(u,p){let y;for(let v of u){if(y===void 0){y=v;continue}p(v,y)>0&&(y=v)}return y}function M(u,p){let y=!0,v,C;for(let U of u)y?(v=U,C=U,y=!1):p(U,v)<0?v=U:p(U,C)>0&&(C=U);return y?void 0:[v,C]}function l(u){return Array.from(u)}function s(u){let p={};for(let[y,v]of u)p[y]=v;return p}function _(u,p){let y=0;for(let v of u)if(p(v,y++)===!1)return}function E(u,p){let y=0;for(let v of u)if(p(v,y++)===!1)return!1;return!0}function b(u,p){let y=0;for(let v of u)if(p(v,y++))return!0;return!1}function*T(u,p){let y=0;for(let v of u)yield p(v,y++)}function*O(u,p,y){p===void 0?(p=u,u=0,y=1):y===void 0&&(y=1);let v=D.rangeLength(u,p,y);for(let C=0;C<v;C++)yield u+y*C}var D;(function(u){function p(y,v,C){return C===0?1/0:y>v&&C>0||y<v&&C<0?0:Math.ceil((v-y)/C)}u.rangeLength=p})(D||(D={}));function A(u,p,y){let v=u[Symbol.iterator](),C=0,U=v.next();if(U.done&&y===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(U.done)return y;let I=v.next();if(I.done&&y===void 0)return U.value;if(I.done)return p(y,U.value,C++);let N;y===void 0?N=p(U.value,I.value,C++):N=p(p(y,U.value,C++),I.value,C++);let $;for(;!($=v.next()).done;)N=p(N,$.value,C++);return N}function*w(u,p){for(;0<p--;)yield u}function*R(u){yield u}function*S(u){if(typeof u.retro=="function")yield*u.retro();else for(let p=u.length-1;p>-1;p--)yield u[p]}function L(u){let p=[],y=new Set,v=new Map;for(let I of u)C(I);for(let[I]of v)U(I);return p;function C(I){let[N,$]=I,j=v.get($);j?j.push(N):v.set($,[N])}function U(I){if(y.has(I))return;y.add(I);let N=v.get(I);if(N)for(let $ of N)U($);p.push(I)}}function*K(u,p){let y=0;for(let v of u)y++%p===0&&(yield v)}d.StringExt=void 0,function(u){function p(I,N,$=0){let j=new Array(N.length);for(let H=0,z=$,V=N.length;H<V;++H,++z){if(z=I.indexOf(N[H],z),z===-1)return null;j[H]=z}return j}u.findIndices=p;function y(I,N,$=0){let j=p(I,N,$);if(!j)return null;let H=0;for(let z=0,V=j.length;z<V;++z){let G=j[z]-$;H+=G*G}return{score:H,indices:j}}u.matchSumOfSquares=y;function v(I,N,$=0){let j=p(I,N,$);if(!j)return null;let H=0,z=$-1;for(let V=0,G=j.length;V<G;++V){let X=j[V];H+=X-z-1,z=X}return{score:H,indices:j}}u.matchSumOfDeltas=v;function C(I,N,$){let j=[],H=0,z=0,V=N.length;for(;H<V;){let G=N[H],X=N[H];for(;++H<V&&N[H]===X+1;)X++;z<G&&j.push(I.slice(z,G)),G<X+1&&j.push($(I.slice(G,X+1))),z=X+1}return z<I.length&&j.push(I.slice(z)),j}u.highlight=C;function U(I,N){return I<N?-1:I>N?1:0}u.cmp=U}(d.StringExt||(d.StringExt={}));function*W(u,p){if(p<1)return;let y=u[Symbol.iterator](),v;for(;0<p--&&!(v=y.next()).done;)yield v.value}function*J(...u){let p=u.map(v=>v[Symbol.iterator]()),y=p.map(v=>v.next());for(;E(y,v=>!v.done);y=p.map(v=>v.next()))yield y.map(v=>v.value)}d.chain=e,d.each=_,d.empty=t,d.enumerate=o,d.every=E,d.filter=a,d.find=c,d.findIndex=g,d.map=T,d.max=x,d.min=k,d.minmax=M,d.once=R,d.range=O,d.reduce=A,d.repeat=w,d.retro=S,d.some=b,d.stride=K,d.take=W,d.toArray=l,d.toObject=s,d.topologicSort=L,d.zip=J})});var We=Oe((le,Le)=>{(function(d,e){typeof le=="object"&&typeof Le!="undefined"?e(le,Fe()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d.lumino_coreutils={},d.lumino_algorithm))})(le,function(d,e){"use strict";d.JSONExt=void 0,function(M){M.emptyObject=Object.freeze({}),M.emptyArray=Object.freeze([]);function l(w){return w===null||typeof w=="boolean"||typeof w=="number"||typeof w=="string"}M.isPrimitive=l;function s(w){return Array.isArray(w)}M.isArray=s;function _(w){return!l(w)&&!s(w)}M.isObject=_;function E(w,R){if(w===R)return!0;if(l(w)||l(R))return!1;let S=s(w),L=s(R);return S!==L?!1:S&&L?T(w,R):O(w,R)}M.deepEqual=E;function b(w){return l(w)?w:s(w)?D(w):A(w)}M.deepCopy=b;function T(w,R){if(w===R)return!0;if(w.length!==R.length)return!1;for(let S=0,L=w.length;S<L;++S)if(!E(w[S],R[S]))return!1;return!0}function O(w,R){if(w===R)return!0;for(let S in w)if(w[S]!==void 0&&!(S in R))return!1;for(let S in R)if(R[S]!==void 0&&!(S in w))return!1;for(let S in w){let L=w[S],K=R[S];if(!(L===void 0&&K===void 0)&&(L===void 0||K===void 0||!E(L,K)))return!1}return!0}function D(w){let R=new Array(w.length);for(let S=0,L=w.length;S<L;++S)R[S]=b(w[S]);return R}function A(w){let R={};for(let S in w){let L=w[S];L!==void 0&&(R[S]=b(L))}return R}}(d.JSONExt||(d.JSONExt={}));class t{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(l){return this._types.indexOf(l)!==-1}getData(l){let s=this._types.indexOf(l);return s!==-1?this._values[s]:void 0}setData(l,s){this.clearData(l),this._types.push(l),this._values.push(s)}clearData(l){let s=this._types.indexOf(l);s!==-1&&(this._types.splice(s,1),this._values.splice(s,1))}clear(){this._types.length=0,this._values.length=0}}class o{constructor(l={}){this._application=null,this._validatePlugin=()=>!0,this._plugins=new Map,this._services=new Map,l.validatePlugin&&(console.info("Plugins may be rejected by the custom validation plugin method."),this._validatePlugin=l.validatePlugin)}get application(){return this._application}set application(l){if(this._application!==null)throw Error("PluginRegistry.application is already set. It cannot be overridden.");this._application=l}get deferredPlugins(){return Array.from(this._plugins).filter(([l,s])=>s.autoStart==="defer").map(([l,s])=>l)}getPluginDescription(l){var s,_;return(_=(s=this._plugins.get(l))===null||s===void 0?void 0:s.description)!==null&&_!==void 0?_:""}hasPlugin(l){return this._plugins.has(l)}isPluginActivated(l){var s,_;return(_=(s=this._plugins.get(l))===null||s===void 0?void 0:s.activated)!==null&&_!==void 0?_:!1}listPlugins(){return Array.from(this._plugins.keys())}registerPlugin(l){if(this._plugins.has(l.id))throw new TypeError(`Plugin '${l.id}' is already registered.`);if(!this._validatePlugin(l))throw new Error(`Plugin '${l.id}' is not valid.`);let s=a.createPluginData(l);a.ensureNoCycle(s,this._plugins,this._services),s.provides&&this._services.set(s.provides,s.id),this._plugins.set(s.id,s)}registerPlugins(l){for(let s of l)this.registerPlugin(s)}deregisterPlugin(l,s){let _=this._plugins.get(l);if(_){if(_.activated&&!s)throw new Error(`Plugin '${l}' is still active.`);this._plugins.delete(l)}}async activatePlugin(l){let s=this._plugins.get(l);if(!s)throw new ReferenceError(`Plugin '${l}' is not registered.`);if(s.activated)return;if(s.promise)return s.promise;let _=s.requires.map(b=>this.resolveRequiredService(b)),E=s.optional.map(b=>this.resolveOptionalService(b));return s.promise=Promise.all([..._,...E]).then(b=>s.activate.apply(void 0,[this.application,...b])).then(b=>{s.service=b,s.activated=!0,s.promise=null}).catch(b=>{throw s.promise=null,b}),s.promise}async activatePlugins(l,s={}){switch(l){case"defer":{let _=this.deferredPlugins.filter(E=>this._plugins.get(E).autoStart).map(E=>this.activatePlugin(E));await Promise.all(_);break}case"startUp":{let E=a.collectStartupPlugins(this._plugins,s).map(async b=>{try{return await this.activatePlugin(b)}catch(T){console.error(`Plugin '${b}' failed to activate.`,T)}});await Promise.all(E);break}}}async deactivatePlugin(l){let s=this._plugins.get(l);if(!s)throw new ReferenceError(`Plugin '${l}' is not registered.`);if(!s.activated)return[];if(!s.deactivate)throw new TypeError(`Plugin '${l}'#deactivate() method missing`);let _=a.findDependents(l,this._plugins,this._services),E=_.map(b=>this._plugins.get(b));for(let b of E)if(!b.deactivate)throw new TypeError(`Plugin ${b.id}#deactivate() method missing (depends on ${l})`);for(let b of E){let T=[...b.requires,...b.optional].map(O=>{let D=this._services.get(O);return D?this._plugins.get(D).service:null});await b.deactivate(this.application,...T),b.service=null,b.activated=!1}return _.pop(),_}async resolveRequiredService(l){let s=this._services.get(l);if(!s)throw new TypeError(`No provider for: ${l.name}.`);let _=this._plugins.get(s);return _.activated||await this.activatePlugin(s),_.service}async resolveOptionalService(l){let s=this._services.get(l);if(!s)return null;let _=this._plugins.get(s);if(!_.activated)try{await this.activatePlugin(s)}catch(E){return console.error(E),null}return _.service}}var a;(function(M){class l{constructor(O){var D,A,w,R;this._activated=!1,this._promise=null,this._service=null,this.id=O.id,this.description=(D=O.description)!==null&&D!==void 0?D:"",this.activate=O.activate,this.deactivate=(A=O.deactivate)!==null&&A!==void 0?A:null,this.provides=(w=O.provides)!==null&&w!==void 0?w:null,this.autoStart=(R=O.autoStart)!==null&&R!==void 0?R:!1,this.requires=O.requires?O.requires.slice():[],this.optional=O.optional?O.optional.slice():[]}get activated(){return this._activated}set activated(O){this._activated=O}get service(){return this._service}set service(O){this._service=O}get promise(){return this._promise}set promise(O){this._promise=O}}function s(T){return new l(T)}M.createPluginData=s;function _(T,O,D){let A=[...T.requires,...T.optional],w=S=>{if(S===T.provides)return!0;let L=D.get(S);if(!L)return!1;let K=O.get(L),W=[...K.requires,...K.optional];return W.length===0?!1:(R.push(L),W.some(w)?!0:(R.pop(),!1))};if(!T.provides||A.length===0)return;let R=[T.id];if(A.some(w))throw new ReferenceError(`Cycle detected: ${R.join(" -> ")}.`)}M.ensureNoCycle=_;function E(T,O,D){let A=new Array,w=W=>{let J=O.get(W),u=[...J.requires,...J.optional];A.push(...u.reduce((p,y)=>{let v=D.get(y);return v&&p.push([W,v]),p},[]))};for(let W of O.keys())w(W);let R=A.filter(W=>W[1]===T),S=0;for(;R.length>S;){let W=R.length,J=new Set(R.map(u=>u[0]));for(let u of J)A.filter(p=>p[1]===u).forEach(p=>{R.includes(p)||R.push(p)});S=W}let L=e.topologicSort(R),K=L.findIndex(W=>W===T);return K===-1?[T]:L.slice(0,K+1)}M.findDependents=E;function b(T,O){let D=new Set;for(let A of T.keys())T.get(A).autoStart===!0&&D.add(A);if(O.startPlugins)for(let A of O.startPlugins)D.add(A);if(O.ignorePlugins)for(let A of O.ignorePlugins)D.delete(A);return Array.from(D)}M.collectStartupPlugins=b})(a||(a={}));class c{constructor(){this.promise=new Promise((l,s)=>{this._resolve=l,this._reject=s})}resolve(l){let s=this._resolve;s(l)}reject(l){let s=this._reject;s(l)}}class g{constructor(l,s){this.name=l,this.description=s!=null?s:"",this._tokenStructuralPropertyT=null}}function k(M){let l=0;for(let s=0,_=M.length;s<_;++s)s%4===0&&(l=Math.random()*4294967295>>>0),M[s]=l&255,l>>>=8}d.Random=void 0,function(M){M.getRandomValues=(()=>{let l=typeof window!="undefined"&&(window.crypto||window.msCrypto)||null;return l&&typeof l.getRandomValues=="function"?function(_){return l.getRandomValues(_)}:k})()}(d.Random||(d.Random={}));function x(M){let l=new Uint8Array(16),s=new Array(256);for(let _=0;_<16;++_)s[_]="0"+_.toString(16);for(let _=16;_<256;++_)s[_]=_.toString(16);return function(){return M(l),l[6]=64|l[6]&15,l[8]=128|l[8]&63,s[l[0]]+s[l[1]]+s[l[2]]+s[l[3]]+"-"+s[l[4]]+s[l[5]]+"-"+s[l[6]]+s[l[7]]+"-"+s[l[8]]+s[l[9]]+"-"+s[l[10]]+s[l[11]]+s[l[12]]+s[l[13]]+s[l[14]]+s[l[15]]}}d.UUID=void 0,function(M){M.uuid4=x(d.Random.getRandomValues)}(d.UUID||(d.UUID={})),d.MimeData=t,d.PluginRegistry=o,d.PromiseDelegate=c,d.Token=g})});function je(d){return"node"in d}var qe=Me(()=>{});var $e={};it($e,{BLOCK_SIZE:()=>ht,ContentsAPI:()=>Q,DRIVE_SEPARATOR:()=>ze,DriveFS:()=>se,DriveFSEmscriptenNodeOps:()=>ue,DriveFSEmscriptenStreamOps:()=>de,ServiceWorkerContentsAPI:()=>ce});var Ue,ze,ht,mt,pt,ae,de,ue,Q,ce,se,Ee=Me(()=>{Ue=rt(We());qe();ze=":",ht=4096,mt=new TextEncoder,pt=new TextDecoder("utf-8"),ae={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},de=class{constructor(e){this.fs=e}open(e){var t;let o=this.fs.realPath(e.node);if(this.fs.FS.isFile(e.node.mode))try{let a=this.fs.API.get(o);e.file=a}catch{let c=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,g=typeof c=="string"?parseInt(c,10):c;g&=8191;let k=!0;if(g in ae&&(k=ae[g]),k){e.node=this.fs.node_ops.mknod(e.node.parent,e.node.name,e.node.mode,0);let x=this.fs.API.get(o);e.file=x}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 o=this.fs.realPath(e.node),a=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,c=typeof a=="string"?parseInt(a,10):a;c&=8191;let g=!0;c in ae&&(g=ae[c]),g&&this.fs.API.put(o,e.file),e.file=void 0}read(e,t,o,a,c){if(a<=0||e.file===void 0||c>=(e.file.data.length||0))return 0;let g=Math.min(e.file.data.length-c,a);return t.set(e.file.data.subarray(c,c+g),o),g}write(e,t,o,a,c){var g;if(a<=0||e.file===void 0)return 0;let k=Date.now();if(e.node.timestamp=k,e.node.atime=k,e.node.mtime=k,e.node.ctime=k,c+a>(((g=e.file)===null||g===void 0?void 0:g.data.length)||0)){let x=e.file.data?e.file.data:new Uint8Array;e.file.data=new Uint8Array(c+a),e.file.data.set(x)}return e.file.data.set(t.subarray(o,o+a),c),a}llseek(e,t,o){var a;let c=t;if(o===1)c+=(a=e.position)!==null&&a!==void 0?a:e.shared.position;else if(o===2&&this.fs.FS.isFile(e.node.mode))if(e.file!==void 0)c+=e.file.data.length;else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);if(c<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return c}},ue=class{constructor(e){this.node=t=>je(t)?t.node:t,this.getattr=t=>{let o=this.node(t);return{...this.fs.API.getattr(this.fs.realPath(o)),mode:o.mode,ino:o.id}},this.setattr=(t,o)=>{let a=this.node(t);for(let[c,g]of Object.entries(o))switch(c){case"mode":a.mode=g;break;case"timestamp":a.timestamp=g;break;case"atime":a.atime=g;break;case"mtime":a.mtime=g;break;case"ctime":a.ctime=g;break;case"size":{let k=g,x=this.fs.realPath(a);if(this.fs.FS.isFile(a.mode)&&k>=0){let M;try{M=this.fs.API.get(x)}catch{break}let l=M.data?M.data:new Uint8Array;k!==l.length&&(k<l.length?M.data=M.data.slice(0,k):(M.data=new Uint8Array(k),M.data.set(l)),this.fs.API.put(x,M))}else console.warn("setattr size of",k,"on",a,"not yet implemented");break}case"dontFollow":break;default:console.warn("setattr",c,"of",g,"on",a,"not yet implemented");break}},this.lookup=(t,o)=>{let a=this.node(t),c=this.fs.PATH.join2(this.fs.realPath(a),o),g=this.fs.API.lookup(c);if(!g.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(a,o,g.mode,0)},this.mknod=(t,o,a,c)=>{let g=this.node(t),k=this.fs.PATH.join2(this.fs.realPath(g),o);return this.fs.API.mknod(k,a),this.fs.createNode(g,o,a,c)},this.rename=(t,o,a)=>{let c=this.node(t),g=this.node(o);this.fs.API.rename(c.parent?this.fs.PATH.join2(this.fs.realPath(c.parent),c.name):c.name,this.fs.PATH.join2(this.fs.realPath(g),a)),c.name=a,c.parent=g},this.unlink=(t,o)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),o)),this.rmdir=(t,o)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),o)),this.readdir=t=>this.fs.API.readdir(this.fs.realPath(this.node(t))),this.symlink=(t,o,a)=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.readlink=t=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL)},this.fs=e}},Q=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 o=t.content,a=t.format;switch(a){case"json":case"text":return{data:mt.encode(o),format:a};case"base64":{let c=atob(o),g=c.length,k=new Uint8Array(g);for(let x=0;x<g;x++)k[x]=c.charCodeAt(x);return{data:k,format:a}}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:pt.decode(t.data)}});case"base64":{let o="";for(let a=0;a<t.data.byteLength;a++)o+=String.fromCharCode(t.data[a]);return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:btoa(o)}})}}}getattr(e){let t=this.request({method:"getattr",path:this.normalizePath(e)}),o=new Date(0);return t.atime=t.atime?new Date(t.atime):o,t.mtime=t.mtime?new Date(t.mtime):o,t.ctime=t.ctime?new Date(t.ctime):o,t.size=t.size||0,t}normalizePath(e){return e.startsWith(this._mountpoint)&&(e=e.slice(this._mountpoint.length)),this._driveName&&(e=`${this._driveName}${ze}${e}`),e}},ce=class extends Q{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 o=Ue.UUID.uuid4(),a={data:{...e,requestId:o},browsingContextId:this._browsingContextId,requestId:o};try{t.send(JSON.stringify(a))}catch(c){console.error(c)}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`}},se=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 ue(this),this.stream_ops=new de(this)}createAPI(e){if(!e.browsingContextId||!e.baseUrl)throw new Error("Cannot create service-worker API without current browsingContextId");return new ce(e)}mount(e){return this.createNode(null,e.mountpoint,16895,0)}createNode(e,t,o,a){let c=this.FS;if(!c.isDir(o)&&!c.isFile(o))throw new c.ErrnoError(this.ERRNO_CODES.EINVAL);let g=c.createNode(e,t,o,a);return g.node_ops=this.node_ops,g.stream_ops=this.stream_ops,g}getMode(e){return this.API.getmode(e)}realPath(e){let t=[],o=e;for(t.push(o.name);o.parent!==o;)o=o.parent,t.push(o.name);return t.reverse(),this.PATH.join.apply(null,t)}}});var me="function";var Z="64e10b34-2bf7-4616-9668-f99de5aa046e",Pt="M"+Z,wt="T"+Z;var Se="get";var Ie="has";var Te="set";var{isArray:ie}=Array,{SharedArrayBuffer:ne,window:st}=globalThis,{notify:pe,wait:ge,waitAsync:re}=Atomics,_e=null;re||(re=d=>({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(d)})}));try{new ne(4)}catch{ne=ArrayBuffer;let e=new WeakMap;if(st){let t=new Map,{prototype:{postMessage:o}}=Worker,a=c=>{var k;let g=(k=c.data)==null?void 0:k[Z];if(!ie(g)){c.stopImmediatePropagation();let{id:x,sb:M}=g;t.get(x)(M)}};_e=function(c,...g){let k=c==null?void 0:c[Z];if(ie(k)){let[x,M]=k;e.set(M,x),this.addEventListener("message",a)}return o.call(this,c,...g)},re=c=>({value:new Promise(g=>{t.set(e.get(c),g)}).then(g=>{t.delete(e.get(c)),e.delete(c);for(let k=0;k<g.length;k++)c[k]=g[k];return"ok"})})}else{let t=(o,a)=>({[Z]:{id:o,sb:a}});pe=o=>{postMessage(t(e.get(o),o))},addEventListener("message",o=>{var c;let a=(c=o.data)==null?void 0:c[Z];if(ie(a)){let[g,k]=a;e.set(k,g)}})}}var{Int32Array:ve,Map:Ne,Uint16Array:Pe}=globalThis,{BYTES_PER_ELEMENT:De}=ve,{BYTES_PER_ELEMENT:ot}=Pe,lt=(d,e,t)=>{for(;ge(d,0,0,e)==="timed-out";)t()},we=new WeakSet,ye=new WeakMap,at={value:{then:d=>d()}},dt=0,Ae=(d,{parse:e=JSON.parse,stringify:t=JSON.stringify,transform:o,interrupt:a}=JSON)=>{if(!ye.has(d)){let c=_e||d.postMessage,g=(_,...E)=>c.call(d,{[Z]:E},{transfer:_}),k=typeof a===me?a:a==null?void 0:a.handler,x=(a==null?void 0:a.delay)||42,M=new TextDecoder("utf-16"),l=(_,E)=>_?re(E,0):(k?lt(E,x,k):ge(E,0),at),s=!1;ye.set(d,new Proxy(new Ne,{[Ie]:(_,E)=>typeof E=="string"&&!E.startsWith("_"),[Se]:(_,E)=>E==="then"?null:(...b)=>{let T=dt++,O=new ve(new ne(De*2)),D=[];we.has(b.at(-1)||D)&&we.delete(D=b.pop()),g(D,T,O,E,o?b.map(o):b);let A=d!==globalThis,w=0;return s&&A&&(w=setTimeout(console.warn,1e3,`\u{1F480}\u{1F512} - Possible deadlock if proxy.${E}(...args) is awaited`)),l(A,O).value.then(()=>{clearTimeout(w);let R=O[1];if(!R)return;let S=ot*R;return O=new ve(new ne(S+S%De)),g([],T,O),l(A,O).value.then(()=>e(M.decode(new Pe(O.buffer).slice(0,R))))})},[Te](_,E,b){let T=typeof b;if(T!==me)throw new Error(`Unable to assign ${E} as ${T}`);if(!_.size){let O=new Ne;d.addEventListener("message",async D=>{var w;let A=(w=D.data)==null?void 0:w[Z];if(ie(A)){D.stopImmediatePropagation();let[R,S,...L]=A,K;if(L.length){let[W,J]=L;if(_.has(W)){s=!0;try{let u=await _.get(W)(...J);if(u!==void 0){let p=t(o?o(u):u);O.set(R,p),S[1]=p.length}}catch(u){K=u}finally{s=!1}}else K=new Error(`Unsupported action: ${W}`);S[0]=1}else{let W=O.get(R);O.delete(R);for(let J=new Pe(S.buffer),u=0;u<W.length;u++)J[u]=W.charCodeAt(u)}if(pe(S,0),K)throw K}})}return!!_.set(E,b)}}))}return ye.get(d)};Ae.transfer=(...d)=>(we.add(d),d);var xe=Ae;Ee();var fe=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 o=e.location.split(":");this._driveName=o[0],this._localPath=o[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:o}=e,a;t.endsWith(".mjs")?a=(await import(t)).loadPyodide:(importScripts(t),a=self.loadPyodide),this._pyodide=await a({indexURL:o,stdout:c=>{console.log(c),this._logMessage({type:"text",level:"info",data:c})},stderr:c=>{console.error(c),this._logMessage({type:"text",level:"critical",data:c})},...e.loadPyodideOptions}),this._pyodide._api.on_fatal=async c=>{let g="";c.name==="Exit"?g="Pyodide has exited and can no longer be used.":g=`Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
|
|
1
|
+
var Xe=Object.create;var he=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty;var Me=(d,e)=>()=>(d&&(e=d(d=0)),e);var Se=(d,e)=>()=>(e||d((e={exports:{}}).exports,e),e.exports),it=(d,e)=>{for(var t in e)he(d,t,{get:e[t],enumerable:!0})},nt=(d,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Qe(e))!tt.call(d,a)&&a!==t&&he(d,a,{get:()=>e[a],enumerable:!(o=Ze(e,a))||o.enumerable});return d};var rt=(d,e,t)=>(t=d!=null?Xe(et(d)):{},nt(e||!d||!d.__esModule?he(t,"default",{value:d,enumerable:!0}):t,d));var Fe=Se((oe,Ce)=>{(function(d,e){typeof oe=="object"&&typeof Ce!="undefined"?e(oe):typeof define=="function"&&define.amd?define(["exports"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d.lumino_algorithm={}))})(oe,function(d){"use strict";d.ArrayExt=void 0,function(u){function p(f,h,n=0,i=-1){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;i<n?m=i+1+(r-n):m=i-n+1;for(let P=0;P<m;++P){let F=(n+P)%r;if(f[F]===h)return F}return-1}u.firstIndexOf=p;function y(f,h,n=-1,i=0){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;n<i?m=n+1+(r-i):m=n-i+1;for(let P=0;P<m;++P){let F=(n-P+r)%r;if(f[F]===h)return F}return-1}u.lastIndexOf=y;function v(f,h,n=0,i=-1){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;i<n?m=i+1+(r-n):m=i-n+1;for(let P=0;P<m;++P){let F=(n+P)%r;if(h(f[F],F))return F}return-1}u.findFirstIndex=v;function C(f,h,n=-1,i=0){let r=f.length;if(r===0)return-1;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;n<i?m=n+1+(r-i):m=n-i+1;for(let P=0;P<m;++P){let F=(n-P+r)%r;if(h(f[F],F))return F}return-1}u.findLastIndex=C;function U(f,h,n=0,i=-1){let r=v(f,h,n,i);return r!==-1?f[r]:void 0}u.findFirstValue=U;function I(f,h,n=-1,i=0){let r=C(f,h,n,i);return r!==-1?f[r]:void 0}u.findLastValue=I;function N(f,h,n,i=0,r=-1){let m=f.length;if(m===0)return 0;i<0?i=Math.max(0,i+m):i=Math.min(i,m-1),r<0?r=Math.max(0,r+m):r=Math.min(r,m-1);let P=i,F=r-i+1;for(;F>0;){let Y=F>>1,te=P+Y;n(f[te],h)<0?(P=te+1,F-=Y+1):F=Y}return P}u.lowerBound=N;function $(f,h,n,i=0,r=-1){let m=f.length;if(m===0)return 0;i<0?i=Math.max(0,i+m):i=Math.min(i,m-1),r<0?r=Math.max(0,r+m):r=Math.min(r,m-1);let P=i,F=r-i+1;for(;F>0;){let Y=F>>1,te=P+Y;n(f[te],h)>0?F=Y:(P=te+1,F-=Y+1)}return P}u.upperBound=$;function j(f,h,n){if(f===h)return!0;if(f.length!==h.length)return!1;for(let i=0,r=f.length;i<r;++i)if(n?!n(f[i],h[i]):f[i]!==h[i])return!1;return!0}u.shallowEqual=j;function H(f,h={}){let{start:n,stop:i,step:r}=h;if(r===void 0&&(r=1),r===0)throw new Error("Slice `step` cannot be zero.");let m=f.length;n===void 0?n=r<0?m-1:0:n<0?n=Math.max(n+m,r<0?-1:0):n>=m&&(n=r<0?m-1:m),i===void 0?i=r<0?-1:m:i<0?i=Math.max(i+m,r<0?-1:0):i>=m&&(i=r<0?m-1:m);let P;r<0&&i>=n||r>0&&n>=i?P=0:r<0?P=Math.floor((i-n+1)/r+1):P=Math.floor((i-n-1)/r+1);let F=[];for(let Y=0;Y<P;++Y)F[Y]=f[n+Y*r];return F}u.slice=H;function z(f,h,n){let i=f.length;if(i<=1||(h<0?h=Math.max(0,h+i):h=Math.min(h,i-1),n<0?n=Math.max(0,n+i):n=Math.min(n,i-1),h===n))return;let r=f[h],m=h<n?1:-1;for(let P=h;P!==n;P+=m)f[P]=f[P+m];f[n]=r}u.move=z;function V(f,h=0,n=-1){let i=f.length;if(!(i<=1))for(h<0?h=Math.max(0,h+i):h=Math.min(h,i-1),n<0?n=Math.max(0,n+i):n=Math.min(n,i-1);h<n;){let r=f[h],m=f[n];f[h++]=m,f[n--]=r}}u.reverse=V;function G(f,h,n=0,i=-1){let r=f.length;if(r<=1||(n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1),n>=i))return;let m=i-n+1;if(h>0?h=h%m:h<0&&(h=(h%m+m)%m),h===0)return;let P=n+h;V(f,n,P-1),V(f,P,i),V(f,n,i)}u.rotate=G;function X(f,h,n=0,i=-1){let r=f.length;if(r===0)return;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m;i<n?m=i+1+(r-n):m=i-n+1;for(let P=0;P<m;++P)f[(n+P)%r]=h}u.fill=X;function He(f,h,n){let i=f.length;h<0?h=Math.max(0,h+i):h=Math.min(h,i);for(let r=i;r>h;--r)f[r]=f[r-1];f[h]=n}u.insert=He;function ee(f,h){let n=f.length;if(h<0&&(h+=n),h<0||h>=n)return;let i=f[h];for(let r=h+1;r<n;++r)f[r-1]=f[r];return f.length=n-1,i}u.removeAt=ee;function Ke(f,h,n=0,i=-1){let r=p(f,h,n,i);return r!==-1&&ee(f,r),r}u.removeFirstOf=Ke;function Be(f,h,n=-1,i=0){let r=y(f,h,n,i);return r!==-1&&ee(f,r),r}u.removeLastOf=Be;function Ve(f,h,n=0,i=-1){let r=f.length;if(r===0)return 0;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m=0;for(let P=0;P<r;++P)n<=i&&P>=n&&P<=i&&f[P]===h||i<n&&(P<=i||P>=n)&&f[P]===h?m++:m>0&&(f[P-m]=f[P]);return m>0&&(f.length=r-m),m}u.removeAllOf=Ve;function Ye(f,h,n=0,i=-1){let r,m=v(f,h,n,i);return m!==-1&&(r=ee(f,m)),{index:m,value:r}}u.removeFirstWhere=Ye;function Ge(f,h,n=-1,i=0){let r,m=C(f,h,n,i);return m!==-1&&(r=ee(f,m)),{index:m,value:r}}u.removeLastWhere=Ge;function Je(f,h,n=0,i=-1){let r=f.length;if(r===0)return 0;n<0?n=Math.max(0,n+r):n=Math.min(n,r-1),i<0?i=Math.max(0,i+r):i=Math.min(i,r-1);let m=0;for(let P=0;P<r;++P)n<=i&&P>=n&&P<=i&&h(f[P],P)||i<n&&(P<=i||P>=n)&&h(f[P],P)?m++:m>0&&(f[P-m]=f[P]);return m>0&&(f.length=r-m),m}u.removeAllWhere=Je}(d.ArrayExt||(d.ArrayExt={}));function*e(...u){for(let p of u)yield*p}function*t(){}function*o(u,p=0){for(let y of u)yield[p++,y]}function*a(u,p){let y=0;for(let v of u)p(v,y++)&&(yield v)}function c(u,p){let y=0;for(let v of u)if(p(v,y++))return v}function g(u,p){let y=0;for(let v of u)if(p(v,y++))return y-1;return-1}function R(u,p){let y;for(let v of u){if(y===void 0){y=v;continue}p(v,y)<0&&(y=v)}return y}function x(u,p){let y;for(let v of u){if(y===void 0){y=v;continue}p(v,y)>0&&(y=v)}return y}function M(u,p){let y=!0,v,C;for(let U of u)y?(v=U,C=U,y=!1):p(U,v)<0?v=U:p(U,C)>0&&(C=U);return y?void 0:[v,C]}function l(u){return Array.from(u)}function s(u){let p={};for(let[y,v]of u)p[y]=v;return p}function _(u,p){let y=0;for(let v of u)if(p(v,y++)===!1)return}function E(u,p){let y=0;for(let v of u)if(p(v,y++)===!1)return!1;return!0}function b(u,p){let y=0;for(let v of u)if(p(v,y++))return!0;return!1}function*T(u,p){let y=0;for(let v of u)yield p(v,y++)}function*S(u,p,y){p===void 0?(p=u,u=0,y=1):y===void 0&&(y=1);let v=D.rangeLength(u,p,y);for(let C=0;C<v;C++)yield u+y*C}var D;(function(u){function p(y,v,C){return C===0?1/0:y>v&&C>0||y<v&&C<0?0:Math.ceil((v-y)/C)}u.rangeLength=p})(D||(D={}));function A(u,p,y){let v=u[Symbol.iterator](),C=0,U=v.next();if(U.done&&y===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(U.done)return y;let I=v.next();if(I.done&&y===void 0)return U.value;if(I.done)return p(y,U.value,C++);let N;y===void 0?N=p(U.value,I.value,C++):N=p(p(y,U.value,C++),I.value,C++);let $;for(;!($=v.next()).done;)N=p(N,$.value,C++);return N}function*w(u,p){for(;0<p--;)yield u}function*k(u){yield u}function*O(u){if(typeof u.retro=="function")yield*u.retro();else for(let p=u.length-1;p>-1;p--)yield u[p]}function L(u){let p=[],y=new Set,v=new Map;for(let I of u)C(I);for(let[I]of v)U(I);return p;function C(I){let[N,$]=I,j=v.get($);j?j.push(N):v.set($,[N])}function U(I){if(y.has(I))return;y.add(I);let N=v.get(I);if(N)for(let $ of N)U($);p.push(I)}}function*K(u,p){let y=0;for(let v of u)y++%p===0&&(yield v)}d.StringExt=void 0,function(u){function p(I,N,$=0){let j=new Array(N.length);for(let H=0,z=$,V=N.length;H<V;++H,++z){if(z=I.indexOf(N[H],z),z===-1)return null;j[H]=z}return j}u.findIndices=p;function y(I,N,$=0){let j=p(I,N,$);if(!j)return null;let H=0;for(let z=0,V=j.length;z<V;++z){let G=j[z]-$;H+=G*G}return{score:H,indices:j}}u.matchSumOfSquares=y;function v(I,N,$=0){let j=p(I,N,$);if(!j)return null;let H=0,z=$-1;for(let V=0,G=j.length;V<G;++V){let X=j[V];H+=X-z-1,z=X}return{score:H,indices:j}}u.matchSumOfDeltas=v;function C(I,N,$){let j=[],H=0,z=0,V=N.length;for(;H<V;){let G=N[H],X=N[H];for(;++H<V&&N[H]===X+1;)X++;z<G&&j.push(I.slice(z,G)),G<X+1&&j.push($(I.slice(G,X+1))),z=X+1}return z<I.length&&j.push(I.slice(z)),j}u.highlight=C;function U(I,N){return I<N?-1:I>N?1:0}u.cmp=U}(d.StringExt||(d.StringExt={}));function*W(u,p){if(p<1)return;let y=u[Symbol.iterator](),v;for(;0<p--&&!(v=y.next()).done;)yield v.value}function*J(...u){let p=u.map(v=>v[Symbol.iterator]()),y=p.map(v=>v.next());for(;E(y,v=>!v.done);y=p.map(v=>v.next()))yield y.map(v=>v.value)}d.chain=e,d.each=_,d.empty=t,d.enumerate=o,d.every=E,d.filter=a,d.find=c,d.findIndex=g,d.map=T,d.max=x,d.min=R,d.minmax=M,d.once=k,d.range=S,d.reduce=A,d.repeat=w,d.retro=O,d.some=b,d.stride=K,d.take=W,d.toArray=l,d.toObject=s,d.topologicSort=L,d.zip=J})});var We=Se((le,Le)=>{(function(d,e){typeof le=="object"&&typeof Le!="undefined"?e(le,Fe()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d.lumino_coreutils={},d.lumino_algorithm))})(le,function(d,e){"use strict";d.JSONExt=void 0,function(M){M.emptyObject=Object.freeze({}),M.emptyArray=Object.freeze([]);function l(w){return w===null||typeof w=="boolean"||typeof w=="number"||typeof w=="string"}M.isPrimitive=l;function s(w){return Array.isArray(w)}M.isArray=s;function _(w){return!l(w)&&!s(w)}M.isObject=_;function E(w,k){if(w===k)return!0;if(l(w)||l(k))return!1;let O=s(w),L=s(k);return O!==L?!1:O&&L?T(w,k):S(w,k)}M.deepEqual=E;function b(w){return l(w)?w:s(w)?D(w):A(w)}M.deepCopy=b;function T(w,k){if(w===k)return!0;if(w.length!==k.length)return!1;for(let O=0,L=w.length;O<L;++O)if(!E(w[O],k[O]))return!1;return!0}function S(w,k){if(w===k)return!0;for(let O in w)if(w[O]!==void 0&&!(O in k))return!1;for(let O in k)if(k[O]!==void 0&&!(O in w))return!1;for(let O in w){let L=w[O],K=k[O];if(!(L===void 0&&K===void 0)&&(L===void 0||K===void 0||!E(L,K)))return!1}return!0}function D(w){let k=new Array(w.length);for(let O=0,L=w.length;O<L;++O)k[O]=b(w[O]);return k}function A(w){let k={};for(let O in w){let L=w[O];L!==void 0&&(k[O]=b(L))}return k}}(d.JSONExt||(d.JSONExt={}));class t{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(l){return this._types.indexOf(l)!==-1}getData(l){let s=this._types.indexOf(l);return s!==-1?this._values[s]:void 0}setData(l,s){this.clearData(l),this._types.push(l),this._values.push(s)}clearData(l){let s=this._types.indexOf(l);s!==-1&&(this._types.splice(s,1),this._values.splice(s,1))}clear(){this._types.length=0,this._values.length=0}}class o{constructor(l={}){this._application=null,this._validatePlugin=()=>!0,this._plugins=new Map,this._services=new Map,l.validatePlugin&&(console.info("Plugins may be rejected by the custom validation plugin method."),this._validatePlugin=l.validatePlugin)}get application(){return this._application}set application(l){if(this._application!==null)throw Error("PluginRegistry.application is already set. It cannot be overridden.");this._application=l}get deferredPlugins(){return Array.from(this._plugins).filter(([l,s])=>s.autoStart==="defer").map(([l,s])=>l)}getPluginDescription(l){var s,_;return(_=(s=this._plugins.get(l))===null||s===void 0?void 0:s.description)!==null&&_!==void 0?_:""}hasPlugin(l){return this._plugins.has(l)}isPluginActivated(l){var s,_;return(_=(s=this._plugins.get(l))===null||s===void 0?void 0:s.activated)!==null&&_!==void 0?_:!1}listPlugins(){return Array.from(this._plugins.keys())}registerPlugin(l){if(this._plugins.has(l.id))throw new TypeError(`Plugin '${l.id}' is already registered.`);if(!this._validatePlugin(l))throw new Error(`Plugin '${l.id}' is not valid.`);let s=a.createPluginData(l);a.ensureNoCycle(s,this._plugins,this._services),s.provides&&this._services.set(s.provides,s.id),this._plugins.set(s.id,s)}registerPlugins(l){for(let s of l)this.registerPlugin(s)}deregisterPlugin(l,s){let _=this._plugins.get(l);if(_){if(_.activated&&!s)throw new Error(`Plugin '${l}' is still active.`);this._plugins.delete(l)}}async activatePlugin(l){let s=this._plugins.get(l);if(!s)throw new ReferenceError(`Plugin '${l}' is not registered.`);if(s.activated)return;if(s.promise)return s.promise;let _=s.requires.map(b=>this.resolveRequiredService(b)),E=s.optional.map(b=>this.resolveOptionalService(b));return s.promise=Promise.all([..._,...E]).then(b=>s.activate.apply(void 0,[this.application,...b])).then(b=>{s.service=b,s.activated=!0,s.promise=null}).catch(b=>{throw s.promise=null,b}),s.promise}async activatePlugins(l,s={}){switch(l){case"defer":{let _=this.deferredPlugins.filter(E=>this._plugins.get(E).autoStart).map(E=>this.activatePlugin(E));await Promise.all(_);break}case"startUp":{let E=a.collectStartupPlugins(this._plugins,s).map(async b=>{try{return await this.activatePlugin(b)}catch(T){console.error(`Plugin '${b}' failed to activate.`,T)}});await Promise.all(E);break}}}async deactivatePlugin(l){let s=this._plugins.get(l);if(!s)throw new ReferenceError(`Plugin '${l}' is not registered.`);if(!s.activated)return[];if(!s.deactivate)throw new TypeError(`Plugin '${l}'#deactivate() method missing`);let _=a.findDependents(l,this._plugins,this._services),E=_.map(b=>this._plugins.get(b));for(let b of E)if(!b.deactivate)throw new TypeError(`Plugin ${b.id}#deactivate() method missing (depends on ${l})`);for(let b of E){let T=[...b.requires,...b.optional].map(S=>{let D=this._services.get(S);return D?this._plugins.get(D).service:null});await b.deactivate(this.application,...T),b.service=null,b.activated=!1}return _.pop(),_}async resolveRequiredService(l){let s=this._services.get(l);if(!s)throw new TypeError(`No provider for: ${l.name}.`);let _=this._plugins.get(s);return _.activated||await this.activatePlugin(s),_.service}async resolveOptionalService(l){let s=this._services.get(l);if(!s)return null;let _=this._plugins.get(s);if(!_.activated)try{await this.activatePlugin(s)}catch(E){return console.error(E),null}return _.service}}var a;(function(M){class l{constructor(S){var D,A,w,k;this._activated=!1,this._promise=null,this._service=null,this.id=S.id,this.description=(D=S.description)!==null&&D!==void 0?D:"",this.activate=S.activate,this.deactivate=(A=S.deactivate)!==null&&A!==void 0?A:null,this.provides=(w=S.provides)!==null&&w!==void 0?w:null,this.autoStart=(k=S.autoStart)!==null&&k!==void 0?k:!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 s(T){return new l(T)}M.createPluginData=s;function _(T,S,D){let A=[...T.requires,...T.optional],w=O=>{if(O===T.provides)return!0;let L=D.get(O);if(!L)return!1;let K=S.get(L),W=[...K.requires,...K.optional];return W.length===0?!1:(k.push(L),W.some(w)?!0:(k.pop(),!1))};if(!T.provides||A.length===0)return;let k=[T.id];if(A.some(w))throw new ReferenceError(`Cycle detected: ${k.join(" -> ")}.`)}M.ensureNoCycle=_;function E(T,S,D){let A=new Array,w=W=>{let J=S.get(W),u=[...J.requires,...J.optional];A.push(...u.reduce((p,y)=>{let v=D.get(y);return v&&p.push([W,v]),p},[]))};for(let W of S.keys())w(W);let k=A.filter(W=>W[1]===T),O=0;for(;k.length>O;){let W=k.length,J=new Set(k.map(u=>u[0]));for(let u of J)A.filter(p=>p[1]===u).forEach(p=>{k.includes(p)||k.push(p)});O=W}let L=e.topologicSort(k),K=L.findIndex(W=>W===T);return K===-1?[T]:L.slice(0,K+1)}M.findDependents=E;function b(T,S){let D=new Set;for(let A of T.keys())T.get(A).autoStart===!0&&D.add(A);if(S.startPlugins)for(let A of S.startPlugins)D.add(A);if(S.ignorePlugins)for(let A of S.ignorePlugins)D.delete(A);return Array.from(D)}M.collectStartupPlugins=b})(a||(a={}));class c{constructor(){this.promise=new Promise((l,s)=>{this._resolve=l,this._reject=s})}resolve(l){let s=this._resolve;s(l)}reject(l){let s=this._reject;s(l)}}class g{constructor(l,s){this.name=l,this.description=s!=null?s:"",this._tokenStructuralPropertyT=null}}function R(M){let l=0;for(let s=0,_=M.length;s<_;++s)s%4===0&&(l=Math.random()*4294967295>>>0),M[s]=l&255,l>>>=8}d.Random=void 0,function(M){M.getRandomValues=(()=>{let l=typeof window!="undefined"&&(window.crypto||window.msCrypto)||null;return l&&typeof l.getRandomValues=="function"?function(_){return l.getRandomValues(_)}:R})()}(d.Random||(d.Random={}));function x(M){let l=new Uint8Array(16),s=new Array(256);for(let _=0;_<16;++_)s[_]="0"+_.toString(16);for(let _=16;_<256;++_)s[_]=_.toString(16);return function(){return M(l),l[6]=64|l[6]&15,l[8]=128|l[8]&63,s[l[0]]+s[l[1]]+s[l[2]]+s[l[3]]+"-"+s[l[4]]+s[l[5]]+"-"+s[l[6]]+s[l[7]]+"-"+s[l[8]]+s[l[9]]+"-"+s[l[10]]+s[l[11]]+s[l[12]]+s[l[13]]+s[l[14]]+s[l[15]]}}d.UUID=void 0,function(M){M.uuid4=x(d.Random.getRandomValues)}(d.UUID||(d.UUID={})),d.MimeData=t,d.PluginRegistry=o,d.PromiseDelegate=c,d.Token=g})});function je(d){return"node"in d}var qe=Me(()=>{});var $e={};it($e,{BLOCK_SIZE:()=>ht,ContentsAPI:()=>Q,DRIVE_SEPARATOR:()=>ze,DriveFS:()=>se,DriveFSEmscriptenNodeOps:()=>ue,DriveFSEmscriptenStreamOps:()=>de,ServiceWorkerContentsAPI:()=>ce});var Ue,ze,ht,mt,pt,ae,de,ue,Q,ce,se,Ee=Me(()=>{Ue=rt(We());qe();ze=":",ht=4096,mt=new TextEncoder,pt=new TextDecoder("utf-8"),ae={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},de=class{constructor(e){this.fs=e}open(e){var t;let o=this.fs.realPath(e.node);if(this.fs.FS.isFile(e.node.mode))try{let a=this.fs.API.get(o);e.file=a}catch{let c=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,g=typeof c=="string"?parseInt(c,10):c;g&=8191;let R=!0;if(g in ae&&(R=ae[g]),R){e.node=this.fs.node_ops.mknod(e.node.parent,e.node.name,e.node.mode,0);let x=this.fs.API.get(o);e.file=x}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 o=this.fs.realPath(e.node),a=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,c=typeof a=="string"?parseInt(a,10):a;c&=8191;let g=!0;c in ae&&(g=ae[c]),g&&this.fs.API.put(o,e.file),e.file=void 0}read(e,t,o,a,c){if(a<=0||e.file===void 0||c>=(e.file.data.length||0))return 0;let g=Math.min(e.file.data.length-c,a);return t.set(e.file.data.subarray(c,c+g),o),g}write(e,t,o,a,c){var g;if(a<=0||e.file===void 0)return 0;let R=Date.now();if(e.node.timestamp=R,e.node.atime=R,e.node.mtime=R,e.node.ctime=R,c+a>(((g=e.file)===null||g===void 0?void 0:g.data.length)||0)){let x=e.file.data?e.file.data:new Uint8Array;e.file.data=new Uint8Array(c+a),e.file.data.set(x)}return e.file.data.set(t.subarray(o,o+a),c),a}llseek(e,t,o){var a;let c=t;if(o===1)c+=(a=e.position)!==null&&a!==void 0?a:e.shared.position;else if(o===2&&this.fs.FS.isFile(e.node.mode))if(e.file!==void 0)c+=e.file.data.length;else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);if(c<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return c}},ue=class{constructor(e){this.node=t=>je(t)?t.node:t,this.getattr=t=>{let o=this.node(t);return{...this.fs.API.getattr(this.fs.realPath(o)),mode:o.mode,ino:o.id}},this.setattr=(t,o)=>{let a=this.node(t);for(let[c,g]of Object.entries(o))switch(c){case"mode":a.mode=g;break;case"timestamp":a.timestamp=g;break;case"atime":a.atime=g;break;case"mtime":a.mtime=g;break;case"ctime":a.ctime=g;break;case"size":{let R=g,x=this.fs.realPath(a);if(this.fs.FS.isFile(a.mode)&&R>=0){let M;try{M=this.fs.API.get(x)}catch{break}let l=M.data?M.data:new Uint8Array;R!==l.length&&(R<l.length?M.data=M.data.slice(0,R):(M.data=new Uint8Array(R),M.data.set(l)),this.fs.API.put(x,M))}else console.warn("setattr size of",R,"on",a,"not yet implemented");break}case"dontFollow":break;default:console.warn("setattr",c,"of",g,"on",a,"not yet implemented");break}},this.lookup=(t,o)=>{let a=this.node(t),c=this.fs.PATH.join2(this.fs.realPath(a),o),g=this.fs.API.lookup(c);if(!g.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(a,o,g.mode,0)},this.mknod=(t,o,a,c)=>{let g=this.node(t),R=this.fs.PATH.join2(this.fs.realPath(g),o);return this.fs.API.mknod(R,a),this.fs.createNode(g,o,a,c)},this.rename=(t,o,a)=>{let c=this.node(t),g=this.node(o);this.fs.API.rename(c.parent?this.fs.PATH.join2(this.fs.realPath(c.parent),c.name):c.name,this.fs.PATH.join2(this.fs.realPath(g),a)),c.name=a,c.parent=g},this.unlink=(t,o)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),o)),this.rmdir=(t,o)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),o)),this.readdir=t=>this.fs.API.readdir(this.fs.realPath(this.node(t))),this.symlink=(t,o,a)=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.readlink=t=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL)},this.fs=e}},Q=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 o=t.content,a=t.format;switch(a){case"json":case"text":return{data:mt.encode(o),format:a};case"base64":{let c=atob(o),g=c.length,R=new Uint8Array(g);for(let x=0;x<g;x++)R[x]=c.charCodeAt(x);return{data:R,format:a}}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:pt.decode(t.data)}});case"base64":{let o="";for(let a=0;a<t.data.byteLength;a++)o+=String.fromCharCode(t.data[a]);return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:btoa(o)}})}}}getattr(e){let t=this.request({method:"getattr",path:this.normalizePath(e)}),o=new Date(0);return t.atime=t.atime?new Date(t.atime):o,t.mtime=t.mtime?new Date(t.mtime):o,t.ctime=t.ctime?new Date(t.ctime):o,t.size=t.size||0,t}normalizePath(e){return e.startsWith(this._mountpoint)&&(e=e.slice(this._mountpoint.length)),this._driveName&&(e=`${this._driveName}${ze}${e}`),e}},ce=class extends Q{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 o=Ue.UUID.uuid4(),a={data:{...e,requestId:o},browsingContextId:this._browsingContextId,requestId:o};try{t.send(JSON.stringify(a))}catch(c){console.error(c)}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`}},se=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 ue(this),this.stream_ops=new de(this)}createAPI(e){if(!e.browsingContextId||!e.baseUrl)throw new Error("Cannot create service-worker API without current browsingContextId");return new ce(e)}mount(e){return this.createNode(null,e.mountpoint,16895,0)}createNode(e,t,o,a){let c=this.FS;if(!c.isDir(o)&&!c.isFile(o))throw new c.ErrnoError(this.ERRNO_CODES.EINVAL);let g=c.createNode(e,t,o,a);return g.node_ops=this.node_ops,g.stream_ops=this.stream_ops,g}getMode(e){return this.API.getmode(e)}realPath(e){let t=[],o=e;for(t.push(o.name);o.parent!==o;)o=o.parent,t.push(o.name);return t.reverse(),this.PATH.join.apply(null,t)}}});var me="function";var Z="64e10b34-2bf7-4616-9668-f99de5aa046e",Pt="M"+Z,wt="T"+Z;var Oe="get";var Ie="has";var Te="set";var{isArray:ie}=Array,{SharedArrayBuffer:ne,window:st}=globalThis,{notify:pe,wait:ge,waitAsync:re}=Atomics,_e=null;re||(re=d=>({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(d)})}));try{new ne(4)}catch{ne=ArrayBuffer;let e=new WeakMap;if(st){let t=new Map,{prototype:{postMessage:o}}=Worker,a=c=>{var R;let g=(R=c.data)==null?void 0:R[Z];if(!ie(g)){c.stopImmediatePropagation();let{id:x,sb:M}=g;t.get(x)(M)}};_e=function(c,...g){let R=c==null?void 0:c[Z];if(ie(R)){let[x,M]=R;e.set(M,x),this.addEventListener("message",a)}return o.call(this,c,...g)},re=c=>({value:new Promise(g=>{t.set(e.get(c),g)}).then(g=>{t.delete(e.get(c)),e.delete(c);for(let R=0;R<g.length;R++)c[R]=g[R];return"ok"})})}else{let t=(o,a)=>({[Z]:{id:o,sb:a}});pe=o=>{postMessage(t(e.get(o),o))},addEventListener("message",o=>{var c;let a=(c=o.data)==null?void 0:c[Z];if(ie(a)){let[g,R]=a;e.set(R,g)}})}}var{Int32Array:ve,Map:Ne,Uint16Array:Pe}=globalThis,{BYTES_PER_ELEMENT:De}=ve,{BYTES_PER_ELEMENT:ot}=Pe,lt=(d,e,t)=>{for(;ge(d,0,0,e)==="timed-out";)t()},we=new WeakSet,ye=new WeakMap,at={value:{then:d=>d()}},dt=0,Ae=(d,{parse:e=JSON.parse,stringify:t=JSON.stringify,transform:o,interrupt:a}=JSON)=>{if(!ye.has(d)){let c=_e||d.postMessage,g=(_,...E)=>c.call(d,{[Z]:E},{transfer:_}),R=typeof a===me?a:a==null?void 0:a.handler,x=(a==null?void 0:a.delay)||42,M=new TextDecoder("utf-16"),l=(_,E)=>_?re(E,0):(R?lt(E,x,R):ge(E,0),at),s=!1;ye.set(d,new Proxy(new Ne,{[Ie]:(_,E)=>typeof E=="string"&&!E.startsWith("_"),[Oe]:(_,E)=>E==="then"?null:(...b)=>{let T=dt++,S=new ve(new ne(De*2)),D=[];we.has(b.at(-1)||D)&&we.delete(D=b.pop()),g(D,T,S,E,o?b.map(o):b);let A=d!==globalThis,w=0;return s&&A&&(w=setTimeout(console.warn,1e3,`\u{1F480}\u{1F512} - Possible deadlock if proxy.${E}(...args) is awaited`)),l(A,S).value.then(()=>{clearTimeout(w);let k=S[1];if(!k)return;let O=ot*k;return S=new ve(new ne(O+O%De)),g([],T,S),l(A,S).value.then(()=>e(M.decode(new Pe(S.buffer).slice(0,k))))})},[Te](_,E,b){let T=typeof b;if(T!==me)throw new Error(`Unable to assign ${E} as ${T}`);if(!_.size){let S=new Ne;d.addEventListener("message",async D=>{var w;let A=(w=D.data)==null?void 0:w[Z];if(ie(A)){D.stopImmediatePropagation();let[k,O,...L]=A,K;if(L.length){let[W,J]=L;if(_.has(W)){s=!0;try{let u=await _.get(W)(...J);if(u!==void 0){let p=t(o?o(u):u);S.set(k,p),O[1]=p.length}}catch(u){K=u}finally{s=!1}}else K=new Error(`Unsupported action: ${W}`);O[0]=1}else{let W=S.get(k);S.delete(k);for(let J=new Pe(O.buffer),u=0;u<W.length;u++)J[u]=W.charCodeAt(u)}if(pe(O,0),K)throw K}})}return!!_.set(E,b)}}))}return ye.get(d)};Ae.transfer=(...d)=>(we.add(d),d);var xe=Ae;Ee();var fe=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 o=e.location.split(":");this._driveName=o[0],this._localPath=o[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:o}=e,a;t.endsWith(".mjs")?a=(await import(t)).loadPyodide:(importScripts(t),a=self.loadPyodide),this._pyodide=await a({indexURL:o,stdout:c=>{console.log(c),this._logMessage({type:"text",level:"info",data:c})},stderr:c=>{console.error(c),this._logMessage({type:"text",level:"critical",data:c})},...e.loadPyodideOptions}),this._pyodide._api.on_fatal=async c=>{let g="";c.name==="Exit"?g="Pyodide has exited and can no longer be used.":g=`Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
|
|
2
2
|
The cause of the error was: ${c.name}
|
|
3
3
|
${c.message}
|
|
4
4
|
Stack trace:
|
|
@@ -10,7 +10,7 @@ ${c.stack}`,this._logMessage({type:"text",level:"critical",data:g})}}async initP
|
|
|
10
10
|
piplite.piplite._PIPLITE_DISABLE_PYPI = ${o?"True":"False"}
|
|
11
11
|
piplite.piplite._PIPLITE_URLS = ${JSON.stringify(a)}
|
|
12
12
|
`)}async initKernel(e){let t=(e.loadPyodideOptions||{}).packages||[],o=["sqlite3","ipykernel","comm","pyodide_kernel","jedi","ipython"],a=[];for(let c of o)t.includes(c)||a.push(`await piplite.install('${c}', keep_going=True)`);a.push("import pyodide_kernel"),e.mountDrive&&this._localPath&&a.push("import os",`os.chdir("${this._localPath}")`),await this._pyodide.runPythonAsync(a.join(`
|
|
13
|
-
`))}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:o,PATH:a,ERRNO_CODES:c}=this._pyodide,{baseUrl:g}=e,{DriveFS:
|
|
13
|
+
`))}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:o,PATH:a,ERRNO_CODES:c}=this._pyodide,{baseUrl:g}=e,{DriveFS:R}=await Promise.resolve().then(()=>(Ee(),$e)),x=new R({FS:o,PATH:a,ERRNO_CODES:c,baseUrl:g,driveName:this._driveName,mountpoint:t,browsingContextId:this._browsingContextId});o.mkdirTree(t),o.mount(x,{},t),o.chdir(t),this._driveFS=x}}mapToObject(e){let t=e instanceof Array?[]:{},o=e instanceof Map?e.entries():Object.entries(e);for(let[a,c]of o)t[a]=c instanceof Map||c instanceof Array?this.mapToObject(c):c;return 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 o=(s,_,E)=>{let b={execution_count:s,data:this.formatResult(_),metadata:this.formatResult(E)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:b,type:"execute_result"})},a=(s,_,E)=>{let b={ename:s,evalue:_,traceback:E};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:b,type:"execute_error"})},c=s=>{let _={wait:this.formatResult(s)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"clear_output"})},g=(s,_,E)=>{let b={data:this.formatResult(s),metadata:this.formatResult(_),transient:this.formatResult(E)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:b,type:"display_data"})},R=(s,_,E)=>{let b={data:this.formatResult(s),metadata:this.formatResult(_),transient:this.formatResult(E)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:b,type:"update_display_data"})},x=(s,_)=>{let E={name:this.formatResult(s),text:this.formatResult(_)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:E,type:"stream"})};this._stdout_stream.publish_stream_callback=x,this._stderr_stream.publish_stream_callback=x,this._interpreter.display_pub.clear_output_callback=c,this._interpreter.display_pub.display_data_callback=g,this._interpreter.display_pub.update_display_data_callback=R,this._interpreter.displayhook.publish_execution_result=o,this._interpreter.input=this.input.bind(this),this._interpreter.getpass=this.getpass.bind(this);let M=await this._kernel.run(e.code),l=this.formatResult(M);return l.status==="error"&&a(l.ename,l.evalue,l.traceback),l}async complete(e,t){await this.setup(t);let o=this._kernel.complete(e.code,e.cursor_pos);return this.formatResult(o)}async inspect(e,t){await this.setup(t);let o=this._kernel.inspect(e.code,e.cursor_pos,e.detail_level);return this.formatResult(o)}async isComplete(e,t){await this.setup(t);let o=this._kernel.is_complete(e.code);return this.formatResult(o)}async commInfo(e,t){await this.setup(t);let o=this._kernel.comm_info(e.target_name);return{comms:this.formatResult(o),status:"ok"}}async commOpen(e,t){await this.setup(t);let o=this._kernel.comm_manager.comm_open(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(o)}async commMsg(e,t){await this.setup(t);let o=this._kernel.comm_manager.comm_msg(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(o)}async commClose(e,t){await this.setup(t);let o=this._kernel.comm_manager.comm_close(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(o)}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,o,a,c){this._sendWorkerMessage({type:e,content:this.formatResult(t),metadata:this.formatResult(o),ident:this.formatResult(a),buffers:this.formatResult(c),parentHeader:this.formatResult(this._kernel._parent_header).header})}};var B=xe(self),be=class extends Q{request(e){return B.processDriveRequest(e)}},Re=class extends se{createAPI(e){return new be(e)}},ke=class extends fe{async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:o,PATH:a,ERRNO_CODES:c}=this._pyodide,{baseUrl:g}=e,R=new Re({FS:o,PATH:a,ERRNO_CODES:c,baseUrl:g,driveName:this._driveName,mountpoint:t});o.mkdirTree(t),o.mount(R,{},t),o.chdir(t),this._driveFS=R}}sendInputRequest(e,t){return B.processStdinRequest({prompt:e,password:t})}},q=new ke,gt=B.processWorkerMessage.bind(B);q.registerWorkerMessageCallback(gt);var _t=B.processLogMessage.bind(B);q.registerLogMessageCallback(_t);B.initialize=q.initialize.bind(q);B.execute=q.execute.bind(q);B.complete=q.complete.bind(q);B.inspect=q.inspect.bind(q);B.isComplete=q.isComplete.bind(q);B.commInfo=q.commInfo.bind(q);B.commOpen=q.commOpen.bind(q);B.commMsg=q.commMsg.bind(q);B.commClose=q.commClose.bind(q);B.inputReply=q.inputReply.bind(q);export{ke as PyodideCoincidentKernel,be as SharedBufferContentsAPI};
|
|
14
14
|
/*! Bundled license information:
|
|
15
15
|
|
|
16
16
|
coincident/esm/index.js:
|