@legit-sdk/react 0.2.10 → 0.2.11

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.
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import { openLegitFsWithMemoryFs } from '@legit-sdk/core';
3
+ export interface LegitContextValue {
4
+ legitFs: Awaited<ReturnType<typeof openLegitFsWithMemoryFs>> | null;
5
+ loading: boolean;
6
+ head: string | null;
7
+ rollback: (commitHash: string) => Promise<void>;
8
+ error?: Error;
9
+ }
10
+ export declare const useLegitContext: () => LegitContextValue;
11
+ export interface LegitProviderProps {
12
+ children: ReactNode;
13
+ config?: LegitConfig;
14
+ }
15
+ export type LegitConfig = {
16
+ gitRoot: string;
17
+ initialBranch?: string;
18
+ serverUrl?: string;
19
+ publicKey?: string;
20
+ };
21
+ export declare const LegitProvider: ({ children, config, }: LegitProviderProps) => import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // legit-sdk browser bundle
1
+ // @legit-sdk/react - works in browser and Next.js SSR
2
2
 
3
3
  var HP=Object.defineProperty;var l=(o,i)=>HP(o,"name",{value:i,configurable:!0});import{createContext as s5,useContext as l5,useEffect as BP,useState as zd,useRef as f5}from"react";var qP=Object.create,Js=Object.defineProperty,GP=Object.getOwnPropertyDescriptor,VP=Object.getOwnPropertyNames,KP=Object.getPrototypeOf,JP=Object.prototype.hasOwnProperty,YP=l((o,i,f)=>i in o?Js(o,i,{enumerable:!0,configurable:!0,writable:!0,value:f}):o[i]=f,"i8"),e=l((o,i)=>Js(o,"name",{value:i,configurable:!0}),"o"),Xt=l((o,i)=>()=>(o&&(i=o(o=0)),i),"pt"),Ge=l((o,i)=>()=>(i||o((i={exports:{}}).exports,i),i.exports),"ge"),an=l((o,i)=>{for(var f in i)Js(o,f,{get:i[f],enumerable:!0})},"Wr"),dx=l((o,i,f,g)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of VP(i))!JP.call(o,a)&&a!==f&&Js(o,a,{get:l(()=>i[a],"get"),enumerable:!(g=GP(i,a))||g.enumerable});return o},"v1"),$t=l((o,i,f)=>(f=o!=null?qP(KP(o)):{},dx(i||!o||!o.__esModule?Js(f,"default",{value:o,enumerable:!0}):f,o)),"ut"),hr=l(o=>dx(Js({},"__esModule",{value:!0}),o),"Nt"),vt=l((o,i,f)=>YP(o,typeof i!="symbol"?i+"":i,f),"Ne");function px(){if(Wm)return ws;Wm=!0,ws.byteLength=u,ws.toByteArray=c,ws.fromByteArray=y;for(var o=[],i=[],f=typeof Uint8Array<"u"?Uint8Array:Array,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,n=g.length;a<n;++a)o[a]=g[a],i[g.charCodeAt(a)]=a;i[45]=62,i[95]=63;function r(w){var _=w.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=w.indexOf("=");S===-1&&(S=_);var T=S===_?0:4-S%4;return[S,T]}l(r,"i"),e(r,"getLens");function u(w){var _=r(w),S=_[0],T=_[1];return(S+T)*3/4-T}l(u,"f"),e(u,"byteLength");function p(w,_,S){return(_+S)*3/4-S}l(p,"h"),e(p,"_byteLength");function c(w){var _,S=r(w),T=S[0],k=S[1],E=new f(p(w,T,k)),j=0,A=k>0?T-4:T,I;for(I=0;I<A;I+=4)_=i[w.charCodeAt(I)]<<18|i[w.charCodeAt(I+1)]<<12|i[w.charCodeAt(I+2)]<<6|i[w.charCodeAt(I+3)],E[j++]=_>>16&255,E[j++]=_>>8&255,E[j++]=_&255;return k===2&&(_=i[w.charCodeAt(I)]<<2|i[w.charCodeAt(I+1)]>>4,E[j++]=_&255),k===1&&(_=i[w.charCodeAt(I)]<<10|i[w.charCodeAt(I+1)]<<4|i[w.charCodeAt(I+2)]>>2,E[j++]=_>>8&255,E[j++]=_&255),E}l(c,"c"),e(c,"toByteArray");function d(w){return o[w>>18&63]+o[w>>12&63]+o[w>>6&63]+o[w&63]}l(d,"d"),e(d,"tripletToBase64");function m(w,_,S){for(var T,k=[],E=_;E<S;E+=3)T=(w[E]<<16&16711680)+(w[E+1]<<8&65280)+(w[E+2]&255),k.push(d(T));return k.join("")}l(m,"y"),e(m,"encodeChunk");function y(w){for(var _,S=w.length,T=S%3,k=[],E=16383,j=0,A=S-T;j<A;j+=E)k.push(m(w,j,j+E>A?A:j+E));return T===1?(_=w[S-1],k.push(o[_>>2]+o[_<<4&63]+"==")):T===2&&(_=(w[S-2]<<8)+w[S-1],k.push(o[_>>10]+o[_>>4&63]+o[_<<2&63]+"=")),k.join("")}return l(y,"m"),e(y,"fromByteArray"),ws}l(px,"o8");function gx(){return zm||(zm=!0,Su.read=function(o,i,f,g,a){var n,r,u=a*8-g-1,p=(1<<u)-1,c=p>>1,d=-7,m=f?a-1:0,y=f?-1:1,w=o[i+m];for(m+=y,n=w&(1<<-d)-1,w>>=-d,d+=u;d>0;n=n*256+o[i+m],m+=y,d-=8);for(r=n&(1<<-d)-1,n>>=-d,d+=g;d>0;r=r*256+o[i+m],m+=y,d-=8);if(n===0)n=1-c;else{if(n===p)return r?NaN:(w?-1:1)*(1/0);r=r+Math.pow(2,g),n=n-c}return(w?-1:1)*r*Math.pow(2,n-g)},Su.write=function(o,i,f,g,a,n){var r,u,p,c=n*8-a-1,d=(1<<c)-1,m=d>>1,y=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=g?0:n-1,_=g?1:-1,S=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(u=isNaN(i)?1:0,r=d):(r=Math.floor(Math.log(i)/Math.LN2),i*(p=Math.pow(2,-r))<1&&(r--,p*=2),r+m>=1?i+=y/p:i+=y*Math.pow(2,1-m),i*p>=2&&(r++,p/=2),r+m>=d?(u=0,r=d):r+m>=1?(u=(i*p-1)*Math.pow(2,a),r=r+m):(u=i*Math.pow(2,m-1)*Math.pow(2,a),r=0));a>=8;o[f+w]=u&255,w+=_,u/=256,a-=8);for(r=r<<a|u,c+=a;c>0;o[f+w]=r&255,w+=_,r/=256,c-=8);o[f+w-_]|=S*128}),Su}l(gx,"a8");function YA(){if(Hm)return Ni;Hm=!0;let o=px(),i=gx(),f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ni.Buffer=r,Ni.SlowBuffer=k,Ni.INSPECT_MAX_BYTES=50;let g=2147483647;Ni.kMaxLength=g,r.TYPED_ARRAY_SUPPORT=a(),!r.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let t=new Uint8Array(1),s={foo:e(function(){return 42},"foo")};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(t,s),t.foo()===42}catch{return!1}}l(a,"a"),e(a,"typedArraySupport"),Object.defineProperty(r.prototype,"parent",{enumerable:!0,get:e(function(){if(r.isBuffer(this))return this.buffer},"get")}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:e(function(){if(r.isBuffer(this))return this.byteOffset},"get")});function n(t){if(t>g)throw new RangeError('The value "'+t+'" is invalid for option "size"');let s=new Uint8Array(t);return Object.setPrototypeOf(s,r.prototype),s}l(n,"s"),e(n,"createBuffer");function r(t,s,h){if(typeof t=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(t)}return u(t,s,h)}l(r,"i"),e(r,"Buffer2"),r.poolSize=8192;function u(t,s,h){if(typeof t=="string")return m(t,s);if(ArrayBuffer.isView(t))return w(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(xe(t,ArrayBuffer)||t&&xe(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xe(t,SharedArrayBuffer)||t&&xe(t.buffer,SharedArrayBuffer)))return _(t,s,h);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let v=t.valueOf&&t.valueOf();if(v!=null&&v!==t)return r.from(v,s,h);let R=S(t);if(R)return R;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return r.from(t[Symbol.toPrimitive]("string"),s,h);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}l(u,"f"),e(u,"from"),r.from=function(t,s,h){return u(t,s,h)},Object.setPrototypeOf(r.prototype,Uint8Array.prototype),Object.setPrototypeOf(r,Uint8Array);function p(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}l(p,"h"),e(p,"assertSize");function c(t,s,h){return p(t),t<=0?n(t):s!==void 0?typeof h=="string"?n(t).fill(s,h):n(t).fill(s):n(t)}l(c,"c"),e(c,"alloc"),r.alloc=function(t,s,h){return c(t,s,h)};function d(t){return p(t),n(t<0?0:T(t)|0)}l(d,"d"),e(d,"allocUnsafe"),r.allocUnsafe=function(t){return d(t)},r.allocUnsafeSlow=function(t){return d(t)};function m(t,s){if((typeof s!="string"||s==="")&&(s="utf8"),!r.isEncoding(s))throw new TypeError("Unknown encoding: "+s);let h=E(t,s)|0,v=n(h),R=v.write(t,s);return R!==h&&(v=v.slice(0,R)),v}l(m,"y"),e(m,"fromString");function y(t){let s=t.length<0?0:T(t.length)|0,h=n(s);for(let v=0;v<s;v+=1)h[v]=t[v]&255;return h}l(y,"m"),e(y,"fromArrayLike");function w(t){if(xe(t,Uint8Array)){let s=new Uint8Array(t);return _(s.buffer,s.byteOffset,s.byteLength)}return y(t)}l(w,"g"),e(w,"fromArrayView");function _(t,s,h){if(s<0||t.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<s+(h||0))throw new RangeError('"length" is outside of buffer bounds');let v;return s===void 0&&h===void 0?v=new Uint8Array(t):h===void 0?v=new Uint8Array(t,s):v=new Uint8Array(t,s,h),Object.setPrototypeOf(v,r.prototype),v}l(_,"v"),e(_,"fromArrayBuffer");function S(t){if(r.isBuffer(t)){let s=T(t.length)|0,h=n(s);return h.length===0||t.copy(h,0,0,s),h}if(t.length!==void 0)return typeof t.length!="number"||Oe(t.length)?n(0):y(t);if(t.type==="Buffer"&&Array.isArray(t.data))return y(t.data)}l(S,"_"),e(S,"fromObject");function T(t){if(t>=g)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+g.toString(16)+" bytes");return t|0}l(T,"b"),e(T,"checked");function k(t){return+t!=t&&(t=0),r.alloc(+t)}l(k,"E"),e(k,"SlowBuffer"),r.isBuffer=e(function(t){return t!=null&&t._isBuffer===!0&&t!==r.prototype},"isBuffer"),r.compare=e(function(t,s){if(xe(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),xe(s,Uint8Array)&&(s=r.from(s,s.offset,s.byteLength)),!r.isBuffer(t)||!r.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===s)return 0;let h=t.length,v=s.length;for(let R=0,P=Math.min(h,v);R<P;++R)if(t[R]!==s[R]){h=t[R],v=s[R];break}return h<v?-1:v<h?1:0},"compare"),r.isEncoding=e(function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding"),r.concat=e(function(t,s){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return r.alloc(0);let h;if(s===void 0)for(s=0,h=0;h<t.length;++h)s+=t[h].length;let v=r.allocUnsafe(s),R=0;for(h=0;h<t.length;++h){let P=t[h];if(xe(P,Uint8Array))R+P.length>v.length?(r.isBuffer(P)||(P=r.from(P)),P.copy(v,R)):Uint8Array.prototype.set.call(v,P,R);else if(r.isBuffer(P))P.copy(v,R);else throw new TypeError('"list" argument must be an Array of Buffers');R+=P.length}return v},"concat");function E(t,s){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||xe(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let h=t.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&h===0)return 0;let R=!1;for(;;)switch(s){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":return Ee(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h*2;case"hex":return h>>>1;case"base64":return ge(t).length;default:if(R)return v?-1:Ee(t).length;s=(""+s).toLowerCase(),R=!0}}l(E,"R"),e(E,"byteLength"),r.byteLength=E;function j(t,s,h){let v=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0,s>>>=0,h<=s))return"";for(t||(t="utf8");;)switch(t){case"hex":return se(this,s,h);case"utf8":case"utf-8":return ae(this,s,h);case"ascii":return Ie(this,s,h);case"latin1":case"binary":return je(this,s,h);case"base64":return re(this,s,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Te(this,s,h);default:if(v)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),v=!0}}l(j,"T"),e(j,"slowToString"),r.prototype._isBuffer=!0;function A(t,s,h){let v=t[s];t[s]=t[h],t[h]=v}l(A,"F"),e(A,"swap"),r.prototype.swap16=e(function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let s=0;s<t;s+=2)A(this,s,s+1);return this},"swap16"),r.prototype.swap32=e(function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let s=0;s<t;s+=4)A(this,s,s+3),A(this,s+1,s+2);return this},"swap32"),r.prototype.swap64=e(function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let s=0;s<t;s+=8)A(this,s,s+7),A(this,s+1,s+6),A(this,s+2,s+5),A(this,s+3,s+4);return this},"swap64"),r.prototype.toString=e(function(){let t=this.length;return t===0?"":arguments.length===0?ae(this,0,t):j.apply(this,arguments)},"toString"),r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=e(function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:r.compare(this,t)===0},"equals"),r.prototype.inspect=e(function(){let t="",s=Ni.INSPECT_MAX_BYTES;return t=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(t+=" ... "),"<Buffer "+t+">"},"inspect"),f&&(r.prototype[f]=r.prototype.inspect),r.prototype.compare=e(function(t,s,h,v,R){if(xe(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(s===void 0&&(s=0),h===void 0&&(h=t?t.length:0),v===void 0&&(v=0),R===void 0&&(R=this.length),s<0||h>t.length||v<0||R>this.length)throw new RangeError("out of range index");if(v>=R&&s>=h)return 0;if(v>=R)return-1;if(s>=h)return 1;if(s>>>=0,h>>>=0,v>>>=0,R>>>=0,this===t)return 0;let P=R-v,C=h-s,Z=Math.min(P,C),oe=this.slice(v,R),Ae=t.slice(s,h);for(let le=0;le<Z;++le)if(oe[le]!==Ae[le]){P=oe[le],C=Ae[le];break}return P<C?-1:C<P?1:0},"compare");function I(t,s,h,v,R){if(t.length===0)return-1;if(typeof h=="string"?(v=h,h=0):h>2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,Oe(h)&&(h=R?0:t.length-1),h<0&&(h=t.length+h),h>=t.length){if(R)return-1;h=t.length-1}else if(h<0)if(R)h=0;else return-1;if(typeof s=="string"&&(s=r.from(s,v)),r.isBuffer(s))return s.length===0?-1:U(t,s,h,v,R);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?R?Uint8Array.prototype.indexOf.call(t,s,h):Uint8Array.prototype.lastIndexOf.call(t,s,h):U(t,[s],h,v,R);throw new TypeError("val must be string, number or Buffer")}l(I,"S"),e(I,"bidirectionalIndexOf");function U(t,s,h,v,R){let P=1,C=t.length,Z=s.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(t.length<2||s.length<2)return-1;P=2,C/=2,Z/=2,h/=2}function oe(le,Fe){return P===1?le[Fe]:le.readUInt16BE(Fe*P)}l(oe,"re"),e(oe,"read");let Ae;if(R){let le=-1;for(Ae=h;Ae<C;Ae++)if(oe(t,Ae)===oe(s,le===-1?0:Ae-le)){if(le===-1&&(le=Ae),Ae-le+1===Z)return le*P}else le!==-1&&(Ae-=Ae-le),le=-1}else for(h+Z>C&&(h=C-Z),Ae=h;Ae>=0;Ae--){let le=!0;for(let Fe=0;Fe<Z;Fe++)if(oe(t,Ae+Fe)!==oe(s,Fe)){le=!1;break}if(le)return Ae}return-1}l(U,"B"),e(U,"arrayIndexOf"),r.prototype.includes=e(function(t,s,h){return this.indexOf(t,s,h)!==-1},"includes"),r.prototype.indexOf=e(function(t,s,h){return I(this,t,s,h,!0)},"indexOf"),r.prototype.lastIndexOf=e(function(t,s,h){return I(this,t,s,h,!1)},"lastIndexOf");function M(t,s,h,v){h=Number(h)||0;let R=t.length-h;v?(v=Number(v),v>R&&(v=R)):v=R;let P=s.length;v>P/2&&(v=P/2);let C;for(C=0;C<v;++C){let Z=parseInt(s.substr(C*2,2),16);if(Oe(Z))return C;t[h+C]=Z}return C}l(M,"I"),e(M,"hexWrite");function ee(t,s,h,v){return Ne(Ee(s,t.length-h),t,h,v)}l(ee,"D"),e(ee,"utf8Write");function V(t,s,h,v){return Ne(ke(s),t,h,v)}l(V,"L"),e(V,"asciiWrite");function q(t,s,h,v){return Ne(ge(s),t,h,v)}l(q,"C"),e(q,"base64Write");function G(t,s,h,v){return Ne(be(s,t.length-h),t,h,v)}l(G,"j"),e(G,"ucs2Write"),r.prototype.write=e(function(t,s,h,v){if(s===void 0)v="utf8",h=this.length,s=0;else if(h===void 0&&typeof s=="string")v=s,h=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(h)?(h=h>>>0,v===void 0&&(v="utf8")):(v=h,h=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let R=this.length-s;if((h===void 0||h>R)&&(h=R),t.length>0&&(h<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");v||(v="utf8");let P=!1;for(;;)switch(v){case"hex":return M(this,t,s,h);case"utf8":case"utf-8":return ee(this,t,s,h);case"ascii":case"latin1":case"binary":return V(this,t,s,h);case"base64":return q(this,t,s,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,t,s,h);default:if(P)throw new TypeError("Unknown encoding: "+v);v=(""+v).toLowerCase(),P=!0}},"write"),r.prototype.toJSON=e(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function re(t,s,h){return s===0&&h===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(s,h))}l(re,"q"),e(re,"base64Slice");function ae(t,s,h){h=Math.min(t.length,h);let v=[],R=s;for(;R<h;){let P=t[R],C=null,Z=P>239?4:P>223?3:P>191?2:1;if(R+Z<=h){let oe,Ae,le,Fe;switch(Z){case 1:P<128&&(C=P);break;case 2:oe=t[R+1],(oe&192)===128&&(Fe=(P&31)<<6|oe&63,Fe>127&&(C=Fe));break;case 3:oe=t[R+1],Ae=t[R+2],(oe&192)===128&&(Ae&192)===128&&(Fe=(P&15)<<12|(oe&63)<<6|Ae&63,Fe>2047&&(Fe<55296||Fe>57343)&&(C=Fe));break;case 4:oe=t[R+1],Ae=t[R+2],le=t[R+3],(oe&192)===128&&(Ae&192)===128&&(le&192)===128&&(Fe=(P&15)<<18|(oe&63)<<12|(Ae&63)<<6|le&63,Fe>65535&&Fe<1114112&&(C=Fe))}}C===null?(C=65533,Z=1):C>65535&&(C-=65536,v.push(C>>>10&1023|55296),C=56320|C&1023),v.push(C),R+=Z}return we(v)}l(ae,"Z"),e(ae,"utf8Slice");let de=4096;function we(t){let s=t.length;if(s<=de)return String.fromCharCode.apply(String,t);let h="",v=0;for(;v<s;)h+=String.fromCharCode.apply(String,t.slice(v,v+=de));return h}l(we,"se"),e(we,"decodeCodePointsArray");function Ie(t,s,h){let v="";h=Math.min(t.length,h);for(let R=s;R<h;++R)v+=String.fromCharCode(t[R]&127);return v}l(Ie,"_e"),e(Ie,"asciiSlice");function je(t,s,h){let v="";h=Math.min(t.length,h);for(let R=s;R<h;++R)v+=String.fromCharCode(t[R]);return v}l(je,"pe"),e(je,"latin1Slice");function se(t,s,h){let v=t.length;(!s||s<0)&&(s=0),(!h||h<0||h>v)&&(h=v);let R="";for(let P=s;P<h;++P)R+=Pe[t[P]];return R}l(se,"Q"),e(se,"hexSlice");function Te(t,s,h){let v=t.slice(s,h),R="";for(let P=0;P<v.length-1;P+=2)R+=String.fromCharCode(v[P]+v[P+1]*256);return R}l(Te,"he"),e(Te,"utf16leSlice"),r.prototype.slice=e(function(t,s){let h=this.length;t=~~t,s=s===void 0?h:~~s,t<0?(t+=h,t<0&&(t=0)):t>h&&(t=h),s<0?(s+=h,s<0&&(s=0)):s>h&&(s=h),s<t&&(s=t);let v=this.subarray(t,s);return Object.setPrototypeOf(v,r.prototype),v},"slice");function J(t,s,h){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+s>h)throw new RangeError("Trying to access beyond buffer length")}l(J,"U"),e(J,"checkOffset"),r.prototype.readUintLE=r.prototype.readUIntLE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=this[t],R=1,P=0;for(;++P<s&&(R*=256);)v+=this[t+P]*R;return v},"readUIntLE"),r.prototype.readUintBE=r.prototype.readUIntBE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=this[t+--s],R=1;for(;s>0&&(R*=256);)v+=this[t+--s]*R;return v},"readUIntBE"),r.prototype.readUint8=r.prototype.readUInt8=e(function(t,s){return t=t>>>0,s||J(t,1,this.length),this[t]},"readUInt8"),r.prototype.readUint16LE=r.prototype.readUInt16LE=e(function(t,s){return t=t>>>0,s||J(t,2,this.length),this[t]|this[t+1]<<8},"readUInt16LE"),r.prototype.readUint16BE=r.prototype.readUInt16BE=e(function(t,s){return t=t>>>0,s||J(t,2,this.length),this[t]<<8|this[t+1]},"readUInt16BE"),r.prototype.readUint32LE=r.prototype.readUInt32LE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},"readUInt32LE"),r.prototype.readUint32BE=r.prototype.readUInt32BE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},"readUInt32BE"),r.prototype.readBigUInt64LE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=s+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,R=this[++t]+this[++t]*2**8+this[++t]*2**16+h*2**24;return BigInt(v)+(BigInt(R)<<BigInt(32))},"readBigUInt64LE")),r.prototype.readBigUInt64BE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=s*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],R=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+h;return(BigInt(v)<<BigInt(32))+BigInt(R)},"readBigUInt64BE")),r.prototype.readIntLE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=this[t],R=1,P=0;for(;++P<s&&(R*=256);)v+=this[t+P]*R;return R*=128,v>=R&&(v-=Math.pow(2,8*s)),v},"readIntLE"),r.prototype.readIntBE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=s,R=1,P=this[t+--v];for(;v>0&&(R*=256);)P+=this[t+--v]*R;return R*=128,P>=R&&(P-=Math.pow(2,8*s)),P},"readIntBE"),r.prototype.readInt8=e(function(t,s){return t=t>>>0,s||J(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},"readInt8"),r.prototype.readInt16LE=e(function(t,s){t=t>>>0,s||J(t,2,this.length);let h=this[t]|this[t+1]<<8;return h&32768?h|4294901760:h},"readInt16LE"),r.prototype.readInt16BE=e(function(t,s){t=t>>>0,s||J(t,2,this.length);let h=this[t+1]|this[t]<<8;return h&32768?h|4294901760:h},"readInt16BE"),r.prototype.readInt32LE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},"readInt32LE"),r.prototype.readInt32BE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},"readInt32BE"),r.prototype.readBigInt64LE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(h<<24);return(BigInt(v)<<BigInt(32))+BigInt(s+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)},"readBigInt64LE")),r.prototype.readBigInt64BE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=(s<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(v)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+h)},"readBigInt64BE")),r.prototype.readFloatLE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),i.read(this,t,!0,23,4)},"readFloatLE"),r.prototype.readFloatBE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),i.read(this,t,!1,23,4)},"readFloatBE"),r.prototype.readDoubleLE=e(function(t,s){return t=t>>>0,s||J(t,8,this.length),i.read(this,t,!0,52,8)},"readDoubleLE"),r.prototype.readDoubleBE=e(function(t,s){return t=t>>>0,s||J(t,8,this.length),i.read(this,t,!1,52,8)},"readDoubleBE");function ue(t,s,h,v,R,P){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>R||s<P)throw new RangeError('"value" argument is out of bounds');if(h+v>t.length)throw new RangeError("Index out of range")}l(ue,"J"),e(ue,"checkInt"),r.prototype.writeUintLE=r.prototype.writeUIntLE=e(function(t,s,h,v){if(t=+t,s=s>>>0,h=h>>>0,!v){let C=Math.pow(2,8*h)-1;ue(this,t,s,h,C,0)}let R=1,P=0;for(this[s]=t&255;++P<h&&(R*=256);)this[s+P]=t/R&255;return s+h},"writeUIntLE"),r.prototype.writeUintBE=r.prototype.writeUIntBE=e(function(t,s,h,v){if(t=+t,s=s>>>0,h=h>>>0,!v){let C=Math.pow(2,8*h)-1;ue(this,t,s,h,C,0)}let R=h-1,P=1;for(this[s+R]=t&255;--R>=0&&(P*=256);)this[s+R]=t/P&255;return s+h},"writeUIntBE"),r.prototype.writeUint8=r.prototype.writeUInt8=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,1,255,0),this[s]=t&255,s+1},"writeUInt8"),r.prototype.writeUint16LE=r.prototype.writeUInt16LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,65535,0),this[s]=t&255,this[s+1]=t>>>8,s+2},"writeUInt16LE"),r.prototype.writeUint16BE=r.prototype.writeUInt16BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,65535,0),this[s]=t>>>8,this[s+1]=t&255,s+2},"writeUInt16BE"),r.prototype.writeUint32LE=r.prototype.writeUInt32LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,4294967295,0),this[s+3]=t>>>24,this[s+2]=t>>>16,this[s+1]=t>>>8,this[s]=t&255,s+4},"writeUInt32LE"),r.prototype.writeUint32BE=r.prototype.writeUInt32BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,4294967295,0),this[s]=t>>>24,this[s+1]=t>>>16,this[s+2]=t>>>8,this[s+3]=t&255,s+4},"writeUInt32BE");function te(t,s,h,v,R){ve(s,v,R,t,h,7);let P=Number(s&BigInt(4294967295));t[h++]=P,P=P>>8,t[h++]=P,P=P>>8,t[h++]=P,P=P>>8,t[h++]=P;let C=Number(s>>BigInt(32)&BigInt(4294967295));return t[h++]=C,C=C>>8,t[h++]=C,C=C>>8,t[h++]=C,C=C>>8,t[h++]=C,h}l(te,"z"),e(te,"wrtBigUInt64LE");function X(t,s,h,v,R){ve(s,v,R,t,h,7);let P=Number(s&BigInt(4294967295));t[h+7]=P,P=P>>8,t[h+6]=P,P=P>>8,t[h+5]=P,P=P>>8,t[h+4]=P;let C=Number(s>>BigInt(32)&BigInt(4294967295));return t[h+3]=C,C=C>>8,t[h+2]=C,C=C>>8,t[h+1]=C,C=C>>8,t[h]=C,h+8}l(X,"V"),e(X,"wrtBigUInt64BE"),r.prototype.writeBigUInt64LE=$e(e(function(t,s=0){return te(this,t,s,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE")),r.prototype.writeBigUInt64BE=$e(e(function(t,s=0){return X(this,t,s,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")),r.prototype.writeIntLE=e(function(t,s,h,v){if(t=+t,s=s>>>0,!v){let Z=Math.pow(2,8*h-1);ue(this,t,s,h,Z-1,-Z)}let R=0,P=1,C=0;for(this[s]=t&255;++R<h&&(P*=256);)t<0&&C===0&&this[s+R-1]!==0&&(C=1),this[s+R]=(t/P>>0)-C&255;return s+h},"writeIntLE"),r.prototype.writeIntBE=e(function(t,s,h,v){if(t=+t,s=s>>>0,!v){let Z=Math.pow(2,8*h-1);ue(this,t,s,h,Z-1,-Z)}let R=h-1,P=1,C=0;for(this[s+R]=t&255;--R>=0&&(P*=256);)t<0&&C===0&&this[s+R+1]!==0&&(C=1),this[s+R]=(t/P>>0)-C&255;return s+h},"writeIntBE"),r.prototype.writeInt8=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,1,127,-128),t<0&&(t=255+t+1),this[s]=t&255,s+1},"writeInt8"),r.prototype.writeInt16LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,32767,-32768),this[s]=t&255,this[s+1]=t>>>8,s+2},"writeInt16LE"),r.prototype.writeInt16BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,32767,-32768),this[s]=t>>>8,this[s+1]=t&255,s+2},"writeInt16BE"),r.prototype.writeInt32LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,2147483647,-2147483648),this[s]=t&255,this[s+1]=t>>>8,this[s+2]=t>>>16,this[s+3]=t>>>24,s+4},"writeInt32LE"),r.prototype.writeInt32BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[s]=t>>>24,this[s+1]=t>>>16,this[s+2]=t>>>8,this[s+3]=t&255,s+4},"writeInt32BE"),r.prototype.writeBigInt64LE=$e(e(function(t,s=0){return te(this,t,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE")),r.prototype.writeBigInt64BE=$e(e(function(t,s=0){return X(this,t,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function ye(t,s,h,v,R,P){if(h+v>t.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}l(ye,"G"),e(ye,"checkIEEE754");function Re(t,s,h,v,R){return s=+s,h=h>>>0,R||ye(t,s,h,4),i.write(t,s,h,v,23,4),h+4}l(Re,"fe"),e(Re,"writeFloat"),r.prototype.writeFloatLE=e(function(t,s,h){return Re(this,t,s,!0,h)},"writeFloatLE"),r.prototype.writeFloatBE=e(function(t,s,h){return Re(this,t,s,!1,h)},"writeFloatBE");function De(t,s,h,v,R){return s=+s,h=h>>>0,R||ye(t,s,h,8),i.write(t,s,h,v,52,8),h+8}l(De,"be"),e(De,"writeDouble"),r.prototype.writeDoubleLE=e(function(t,s,h){return De(this,t,s,!0,h)},"writeDoubleLE"),r.prototype.writeDoubleBE=e(function(t,s,h){return De(this,t,s,!1,h)},"writeDoubleBE"),r.prototype.copy=e(function(t,s,h,v){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(h||(h=0),!v&&v!==0&&(v=this.length),s>=t.length&&(s=t.length),s||(s=0),v>0&&v<h&&(v=h),v===h||t.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(h<0||h>=this.length)throw new RangeError("Index out of range");if(v<0)throw new RangeError("sourceEnd out of bounds");v>this.length&&(v=this.length),t.length-s<v-h&&(v=t.length-s+h);let R=v-h;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,h,v):Uint8Array.prototype.set.call(t,this.subarray(h,v),s),R},"copy"),r.prototype.fill=e(function(t,s,h,v){if(typeof t=="string"){if(typeof s=="string"?(v=s,s=0,h=this.length):typeof h=="string"&&(v=h,h=this.length),v!==void 0&&typeof v!="string")throw new TypeError("encoding must be a string");if(typeof v=="string"&&!r.isEncoding(v))throw new TypeError("Unknown encoding: "+v);if(t.length===1){let P=t.charCodeAt(0);(v==="utf8"&&P<128||v==="latin1")&&(t=P)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(s<0||this.length<s||this.length<h)throw new RangeError("Out of range index");if(h<=s)return this;s=s>>>0,h=h===void 0?this.length:h>>>0,t||(t=0);let R;if(typeof t=="number")for(R=s;R<h;++R)this[R]=t;else{let P=r.isBuffer(t)?t:r.from(t,v),C=P.length;if(C===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(R=0;R<h-s;++R)this[R+s]=P[R%C]}return this},"fill");let Y={};function H(t,s,h){var R;var v;Y[t]=(v=(R=class extends h{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(C){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:C,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}},l(R,"w"),R),e(v,"NodeError"),v)}l(H,"$"),e(H,"E"),H("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),H("ERR_INVALID_ARG_TYPE",function(t,s){return`The "${t}" argument must be of type number. Received type ${typeof s}`},TypeError),H("ERR_OUT_OF_RANGE",function(t,s,h){let v=`The value of "${t}" is out of range.`,R=h;return Number.isInteger(h)&&Math.abs(h)>2**32?R=Q(String(h)):typeof h=="bigint"&&(R=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(R=Q(R)),R+="n"),v+=` It must be ${s}. Received ${R}`,v},RangeError);function Q(t){let s="",h=t.length,v=t[0]==="-"?1:0;for(;h>=v+4;h-=3)s=`_${t.slice(h-3,h)}${s}`;return`${t.slice(0,h)}${s}`}l(Q,"H"),e(Q,"addNumericalSeparator");function fe(t,s,h){N(s,"offset"),(t[s]===void 0||t[s+h]===void 0)&&x(s,t.length-(h+1))}l(fe,"te"),e(fe,"checkBounds");function ve(t,s,h,v,R,P){if(t>h||t<s){let C=typeof s=="bigint"?"n":"",Z;throw s===0||s===BigInt(0)?Z=`>= 0${C} and < 2${C} ** ${(P+1)*8}${C}`:Z=`>= -(2${C} ** ${(P+1)*8-1}${C}) and < 2 ** ${(P+1)*8-1}${C}`,new Y.ERR_OUT_OF_RANGE("value",Z,t)}fe(v,R,P)}l(ve,"oe"),e(ve,"checkIntBI");function N(t,s){if(typeof t!="number")throw new Y.ERR_INVALID_ARG_TYPE(s,"number",t)}l(N,"P"),e(N,"validateNumber");function x(t,s,h){throw Math.floor(t)!==t?(N(t,h),new Y.ERR_OUT_OF_RANGE("offset","an integer",t)):s<0?new Y.ERR_BUFFER_OUT_OF_BOUNDS:new Y.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${s}`,t)}l(x,"x"),e(x,"boundsError");let D=/[^+/0-9A-Za-z-_]/g;function z(t){if(t=t.split("=")[0],t=t.trim().replace(D,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}l(z,"Y"),e(z,"base64clean");function Ee(t,s){s=s||1/0;let h,v=t.length,R=null,P=[];for(let C=0;C<v;++C){if(h=t.charCodeAt(C),h>55295&&h<57344){if(!R){if(h>56319){(s-=3)>-1&&P.push(239,191,189);continue}else if(C+1===v){(s-=3)>-1&&P.push(239,191,189);continue}R=h;continue}if(h<56320){(s-=3)>-1&&P.push(239,191,189),R=h;continue}h=(R-55296<<10|h-56320)+65536}else R&&(s-=3)>-1&&P.push(239,191,189);if(R=null,h<128){if((s-=1)<0)break;P.push(h)}else if(h<2048){if((s-=2)<0)break;P.push(h>>6|192,h&63|128)}else if(h<65536){if((s-=3)<0)break;P.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((s-=4)<0)break;P.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return P}l(Ee,"ue"),e(Ee,"utf8ToBytes");function ke(t){let s=[];for(let h=0;h<t.length;++h)s.push(t.charCodeAt(h)&255);return s}l(ke,"le"),e(ke,"asciiToBytes");function be(t,s){let h,v,R,P=[];for(let C=0;C<t.length&&!((s-=2)<0);++C)h=t.charCodeAt(C),v=h>>8,R=h%256,P.push(R),P.push(v);return P}l(be,"ee"),e(be,"utf16leToBytes");function ge(t){return o.toByteArray(z(t))}l(ge,"ie"),e(ge,"base64ToBytes");function Ne(t,s,h,v){let R;for(R=0;R<v&&!(R+h>=s.length||R>=t.length);++R)s[R+h]=t[R];return R}l(Ne,"me"),e(Ne,"blitBuffer");function xe(t,s){return t instanceof s||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===s.name}l(xe,"ye"),e(xe,"isInstance");function Oe(t){return t!==t}l(Oe,"ve"),e(Oe,"numberIsNaN");let Pe=function(){let t="0123456789abcdef",s=new Array(256);for(let h=0;h<16;++h){let v=h*16;for(let R=0;R<16;++R)s[v+R]=t[h]+t[R]}return s}();function $e(t){return typeof BigInt>"u"?Ke:t}l($e,"Be"),e($e,"defineBigIntMethod");function Ke(){throw new Error("BigInt not supported")}return l(Ke,"Xe"),e(Ke,"BufferBigIntNotDefined"),Ni}l(YA,"s8");var ws,Wm,Su,zm,Ni,Hm,ki,Gs,yx,mx,bE=Xt(()=>{ws={},Wm=!1,e(px,"dew$2"),Su={},zm=!1,e(gx,"dew$1"),Ni={},Hm=!1,e(YA,"dew"),ki=YA(),ki.Buffer,ki.SlowBuffer,ki.INSPECT_MAX_BYTES,ki.kMaxLength,Gs=ki.Buffer,yx=ki.INSPECT_MAX_BYTES,mx=ki.kMaxLength}),$n=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.constants=o.SEP=void 0,o.SEP="/",o.constants={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_DIRECTORY:65536,O_NOATIME:262144,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,O_DIRECT:16384,O_NONBLOCK:2048,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4}}),wx=Ge(o=>{"use strict";var y;Object.defineProperty(o,"__esModule",{value:!0}),o.Stats=void 0;var i=$n(),{S_IFMT:f,S_IFDIR:g,S_IFREG:a,S_IFBLK:n,S_IFCHR:r,S_IFLNK:u,S_IFIFO:p,S_IFSOCK:c}=i.constants,d=(y=class{static build(_,S=!1){let T=new y,{uid:k,gid:E,atime:j,mtime:A,ctime:I}=_,U=S?ee=>BigInt(ee):ee=>ee;T.uid=U(k),T.gid=U(E),T.rdev=U(_.rdev),T.blksize=U(4096),T.ino=U(_.ino),T.size=U(_.getSize()),T.blocks=U(1),T.atime=j,T.mtime=A,T.ctime=I,T.birthtime=I,T.atimeMs=U(j.getTime()),T.mtimeMs=U(A.getTime());let M=U(I.getTime());if(T.ctimeMs=M,T.birthtimeMs=M,S){T.atimeNs=BigInt(j.getTime())*BigInt(1e6),T.mtimeNs=BigInt(A.getTime())*BigInt(1e6);let ee=BigInt(I.getTime())*BigInt(1e6);T.ctimeNs=ee,T.birthtimeNs=ee}return T.dev=U(0),T.mode=U(_.mode),T.nlink=U(_.nlink),T}_checkModeProperty(_){return(Number(this.mode)&f)===_}isDirectory(){return this._checkModeProperty(g)}isFile(){return this._checkModeProperty(a)}isBlockDevice(){return this._checkModeProperty(n)}isCharacterDevice(){return this._checkModeProperty(r)}isSymbolicLink(){return this._checkModeProperty(u)}isFIFO(){return this._checkModeProperty(p)}isSocket(){return this._checkModeProperty(c)}},l(y,"Pu"),y);e(d,"Stats");var m=d;o.Stats=m,o.default=m});function bx(){if(qm)return bs;qm=!0,bs.byteLength=u,bs.toByteArray=c,bs.fromByteArray=y;for(var o=[],i=[],f=typeof Uint8Array<"u"?Uint8Array:Array,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,n=g.length;a<n;++a)o[a]=g[a],i[g.charCodeAt(a)]=a;i[45]=62,i[95]=63;function r(w){var _=w.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var S=w.indexOf("=");S===-1&&(S=_);var T=S===_?0:4-S%4;return[S,T]}l(r,"i"),e(r,"getLens");function u(w){var _=r(w),S=_[0],T=_[1];return(S+T)*3/4-T}l(u,"f"),e(u,"byteLength");function p(w,_,S){return(_+S)*3/4-S}l(p,"h"),e(p,"_byteLength");function c(w){var _,S=r(w),T=S[0],k=S[1],E=new f(p(w,T,k)),j=0,A=k>0?T-4:T,I;for(I=0;I<A;I+=4)_=i[w.charCodeAt(I)]<<18|i[w.charCodeAt(I+1)]<<12|i[w.charCodeAt(I+2)]<<6|i[w.charCodeAt(I+3)],E[j++]=_>>16&255,E[j++]=_>>8&255,E[j++]=_&255;return k===2&&(_=i[w.charCodeAt(I)]<<2|i[w.charCodeAt(I+1)]>>4,E[j++]=_&255),k===1&&(_=i[w.charCodeAt(I)]<<10|i[w.charCodeAt(I+1)]<<4|i[w.charCodeAt(I+2)]>>2,E[j++]=_>>8&255,E[j++]=_&255),E}l(c,"c"),e(c,"toByteArray");function d(w){return o[w>>18&63]+o[w>>12&63]+o[w>>6&63]+o[w&63]}l(d,"d"),e(d,"tripletToBase64");function m(w,_,S){for(var T,k=[],E=_;E<S;E+=3)T=(w[E]<<16&16711680)+(w[E+1]<<8&65280)+(w[E+2]&255),k.push(d(T));return k.join("")}l(m,"y"),e(m,"encodeChunk");function y(w){for(var _,S=w.length,T=S%3,k=[],E=16383,j=0,A=S-T;j<A;j+=E)k.push(m(w,j,j+E>A?A:j+E));return T===1?(_=w[S-1],k.push(o[_>>2]+o[_<<4&63]+"==")):T===2&&(_=(w[S-2]<<8)+w[S-1],k.push(o[_>>10]+o[_>>4&63]+o[_<<2&63]+"=")),k.join("")}return l(y,"m"),e(y,"fromByteArray"),bs}l(bx,"C6");function vx(){return Gm||(Gm=!0,Au.read=function(o,i,f,g,a){var n,r,u=a*8-g-1,p=(1<<u)-1,c=p>>1,d=-7,m=f?a-1:0,y=f?-1:1,w=o[i+m];for(m+=y,n=w&(1<<-d)-1,w>>=-d,d+=u;d>0;n=n*256+o[i+m],m+=y,d-=8);for(r=n&(1<<-d)-1,n>>=-d,d+=g;d>0;r=r*256+o[i+m],m+=y,d-=8);if(n===0)n=1-c;else{if(n===p)return r?NaN:(w?-1:1)*(1/0);r=r+Math.pow(2,g),n=n-c}return(w?-1:1)*r*Math.pow(2,n-g)},Au.write=function(o,i,f,g,a,n){var r,u,p,c=n*8-a-1,d=(1<<c)-1,m=d>>1,y=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=g?0:n-1,_=g?1:-1,S=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(u=isNaN(i)?1:0,r=d):(r=Math.floor(Math.log(i)/Math.LN2),i*(p=Math.pow(2,-r))<1&&(r--,p*=2),r+m>=1?i+=y/p:i+=y*Math.pow(2,1-m),i*p>=2&&(r++,p/=2),r+m>=d?(u=0,r=d):r+m>=1?(u=(i*p-1)*Math.pow(2,a),r=r+m):(u=i*Math.pow(2,m-1)*Math.pow(2,a),r=0));a>=8;o[f+w]=u&255,w+=_,u/=256,a-=8);for(r=r<<a|u,c+=a;c>0;o[f+w]=r&255,w+=_,r/=256,c-=8);o[f+w-_]|=S*128}),Au}l(vx,"L6");function ZA(){if(Vm)return Di;Vm=!0;let o=bx(),i=vx(),f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Di.Buffer=r,Di.SlowBuffer=k,Di.INSPECT_MAX_BYTES=50;let g=2147483647;Di.kMaxLength=g,r.TYPED_ARRAY_SUPPORT=a(),!r.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let t=new Uint8Array(1),s={foo:e(function(){return 42},"foo")};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(t,s),t.foo()===42}catch{return!1}}l(a,"a"),e(a,"typedArraySupport"),Object.defineProperty(r.prototype,"parent",{enumerable:!0,get:e(function(){if(r.isBuffer(this))return this.buffer},"get")}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:e(function(){if(r.isBuffer(this))return this.byteOffset},"get")});function n(t){if(t>g)throw new RangeError('The value "'+t+'" is invalid for option "size"');let s=new Uint8Array(t);return Object.setPrototypeOf(s,r.prototype),s}l(n,"s"),e(n,"createBuffer");function r(t,s,h){if(typeof t=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(t)}return u(t,s,h)}l(r,"i"),e(r,"Buffer2"),r.poolSize=8192;function u(t,s,h){if(typeof t=="string")return m(t,s);if(ArrayBuffer.isView(t))return w(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(xe(t,ArrayBuffer)||t&&xe(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xe(t,SharedArrayBuffer)||t&&xe(t.buffer,SharedArrayBuffer)))return _(t,s,h);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let v=t.valueOf&&t.valueOf();if(v!=null&&v!==t)return r.from(v,s,h);let R=S(t);if(R)return R;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return r.from(t[Symbol.toPrimitive]("string"),s,h);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}l(u,"f"),e(u,"from"),r.from=function(t,s,h){return u(t,s,h)},Object.setPrototypeOf(r.prototype,Uint8Array.prototype),Object.setPrototypeOf(r,Uint8Array);function p(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}l(p,"h"),e(p,"assertSize");function c(t,s,h){return p(t),t<=0?n(t):s!==void 0?typeof h=="string"?n(t).fill(s,h):n(t).fill(s):n(t)}l(c,"c"),e(c,"alloc"),r.alloc=function(t,s,h){return c(t,s,h)};function d(t){return p(t),n(t<0?0:T(t)|0)}l(d,"d"),e(d,"allocUnsafe"),r.allocUnsafe=function(t){return d(t)},r.allocUnsafeSlow=function(t){return d(t)};function m(t,s){if((typeof s!="string"||s==="")&&(s="utf8"),!r.isEncoding(s))throw new TypeError("Unknown encoding: "+s);let h=E(t,s)|0,v=n(h),R=v.write(t,s);return R!==h&&(v=v.slice(0,R)),v}l(m,"y"),e(m,"fromString");function y(t){let s=t.length<0?0:T(t.length)|0,h=n(s);for(let v=0;v<s;v+=1)h[v]=t[v]&255;return h}l(y,"m"),e(y,"fromArrayLike");function w(t){if(xe(t,Uint8Array)){let s=new Uint8Array(t);return _(s.buffer,s.byteOffset,s.byteLength)}return y(t)}l(w,"g"),e(w,"fromArrayView");function _(t,s,h){if(s<0||t.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<s+(h||0))throw new RangeError('"length" is outside of buffer bounds');let v;return s===void 0&&h===void 0?v=new Uint8Array(t):h===void 0?v=new Uint8Array(t,s):v=new Uint8Array(t,s,h),Object.setPrototypeOf(v,r.prototype),v}l(_,"v"),e(_,"fromArrayBuffer");function S(t){if(r.isBuffer(t)){let s=T(t.length)|0,h=n(s);return h.length===0||t.copy(h,0,0,s),h}if(t.length!==void 0)return typeof t.length!="number"||Oe(t.length)?n(0):y(t);if(t.type==="Buffer"&&Array.isArray(t.data))return y(t.data)}l(S,"_"),e(S,"fromObject");function T(t){if(t>=g)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+g.toString(16)+" bytes");return t|0}l(T,"b"),e(T,"checked");function k(t){return+t!=t&&(t=0),r.alloc(+t)}l(k,"E"),e(k,"SlowBuffer"),r.isBuffer=e(function(t){return t!=null&&t._isBuffer===!0&&t!==r.prototype},"isBuffer"),r.compare=e(function(t,s){if(xe(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),xe(s,Uint8Array)&&(s=r.from(s,s.offset,s.byteLength)),!r.isBuffer(t)||!r.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===s)return 0;let h=t.length,v=s.length;for(let R=0,P=Math.min(h,v);R<P;++R)if(t[R]!==s[R]){h=t[R],v=s[R];break}return h<v?-1:v<h?1:0},"compare"),r.isEncoding=e(function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding"),r.concat=e(function(t,s){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return r.alloc(0);let h;if(s===void 0)for(s=0,h=0;h<t.length;++h)s+=t[h].length;let v=r.allocUnsafe(s),R=0;for(h=0;h<t.length;++h){let P=t[h];if(xe(P,Uint8Array))R+P.length>v.length?(r.isBuffer(P)||(P=r.from(P)),P.copy(v,R)):Uint8Array.prototype.set.call(v,P,R);else if(r.isBuffer(P))P.copy(v,R);else throw new TypeError('"list" argument must be an Array of Buffers');R+=P.length}return v},"concat");function E(t,s){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||xe(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let h=t.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&h===0)return 0;let R=!1;for(;;)switch(s){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":return Ee(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h*2;case"hex":return h>>>1;case"base64":return ge(t).length;default:if(R)return v?-1:Ee(t).length;s=(""+s).toLowerCase(),R=!0}}l(E,"R"),e(E,"byteLength"),r.byteLength=E;function j(t,s,h){let v=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0,s>>>=0,h<=s))return"";for(t||(t="utf8");;)switch(t){case"hex":return se(this,s,h);case"utf8":case"utf-8":return ae(this,s,h);case"ascii":return Ie(this,s,h);case"latin1":case"binary":return je(this,s,h);case"base64":return re(this,s,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Te(this,s,h);default:if(v)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),v=!0}}l(j,"T"),e(j,"slowToString"),r.prototype._isBuffer=!0;function A(t,s,h){let v=t[s];t[s]=t[h],t[h]=v}l(A,"F"),e(A,"swap"),r.prototype.swap16=e(function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let s=0;s<t;s+=2)A(this,s,s+1);return this},"swap16"),r.prototype.swap32=e(function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let s=0;s<t;s+=4)A(this,s,s+3),A(this,s+1,s+2);return this},"swap32"),r.prototype.swap64=e(function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let s=0;s<t;s+=8)A(this,s,s+7),A(this,s+1,s+6),A(this,s+2,s+5),A(this,s+3,s+4);return this},"swap64"),r.prototype.toString=e(function(){let t=this.length;return t===0?"":arguments.length===0?ae(this,0,t):j.apply(this,arguments)},"toString"),r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=e(function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:r.compare(this,t)===0},"equals"),r.prototype.inspect=e(function(){let t="",s=Di.INSPECT_MAX_BYTES;return t=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(t+=" ... "),"<Buffer "+t+">"},"inspect"),f&&(r.prototype[f]=r.prototype.inspect),r.prototype.compare=e(function(t,s,h,v,R){if(xe(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(s===void 0&&(s=0),h===void 0&&(h=t?t.length:0),v===void 0&&(v=0),R===void 0&&(R=this.length),s<0||h>t.length||v<0||R>this.length)throw new RangeError("out of range index");if(v>=R&&s>=h)return 0;if(v>=R)return-1;if(s>=h)return 1;if(s>>>=0,h>>>=0,v>>>=0,R>>>=0,this===t)return 0;let P=R-v,C=h-s,Z=Math.min(P,C),oe=this.slice(v,R),Ae=t.slice(s,h);for(let le=0;le<Z;++le)if(oe[le]!==Ae[le]){P=oe[le],C=Ae[le];break}return P<C?-1:C<P?1:0},"compare");function I(t,s,h,v,R){if(t.length===0)return-1;if(typeof h=="string"?(v=h,h=0):h>2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,Oe(h)&&(h=R?0:t.length-1),h<0&&(h=t.length+h),h>=t.length){if(R)return-1;h=t.length-1}else if(h<0)if(R)h=0;else return-1;if(typeof s=="string"&&(s=r.from(s,v)),r.isBuffer(s))return s.length===0?-1:U(t,s,h,v,R);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?R?Uint8Array.prototype.indexOf.call(t,s,h):Uint8Array.prototype.lastIndexOf.call(t,s,h):U(t,[s],h,v,R);throw new TypeError("val must be string, number or Buffer")}l(I,"S"),e(I,"bidirectionalIndexOf");function U(t,s,h,v,R){let P=1,C=t.length,Z=s.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(t.length<2||s.length<2)return-1;P=2,C/=2,Z/=2,h/=2}function oe(le,Fe){return P===1?le[Fe]:le.readUInt16BE(Fe*P)}l(oe,"re"),e(oe,"read");let Ae;if(R){let le=-1;for(Ae=h;Ae<C;Ae++)if(oe(t,Ae)===oe(s,le===-1?0:Ae-le)){if(le===-1&&(le=Ae),Ae-le+1===Z)return le*P}else le!==-1&&(Ae-=Ae-le),le=-1}else for(h+Z>C&&(h=C-Z),Ae=h;Ae>=0;Ae--){let le=!0;for(let Fe=0;Fe<Z;Fe++)if(oe(t,Ae+Fe)!==oe(s,Fe)){le=!1;break}if(le)return Ae}return-1}l(U,"B"),e(U,"arrayIndexOf"),r.prototype.includes=e(function(t,s,h){return this.indexOf(t,s,h)!==-1},"includes"),r.prototype.indexOf=e(function(t,s,h){return I(this,t,s,h,!0)},"indexOf"),r.prototype.lastIndexOf=e(function(t,s,h){return I(this,t,s,h,!1)},"lastIndexOf");function M(t,s,h,v){h=Number(h)||0;let R=t.length-h;v?(v=Number(v),v>R&&(v=R)):v=R;let P=s.length;v>P/2&&(v=P/2);let C;for(C=0;C<v;++C){let Z=parseInt(s.substr(C*2,2),16);if(Oe(Z))return C;t[h+C]=Z}return C}l(M,"I"),e(M,"hexWrite");function ee(t,s,h,v){return Ne(Ee(s,t.length-h),t,h,v)}l(ee,"D"),e(ee,"utf8Write");function V(t,s,h,v){return Ne(ke(s),t,h,v)}l(V,"L"),e(V,"asciiWrite");function q(t,s,h,v){return Ne(ge(s),t,h,v)}l(q,"C"),e(q,"base64Write");function G(t,s,h,v){return Ne(be(s,t.length-h),t,h,v)}l(G,"j"),e(G,"ucs2Write"),r.prototype.write=e(function(t,s,h,v){if(s===void 0)v="utf8",h=this.length,s=0;else if(h===void 0&&typeof s=="string")v=s,h=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(h)?(h=h>>>0,v===void 0&&(v="utf8")):(v=h,h=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let R=this.length-s;if((h===void 0||h>R)&&(h=R),t.length>0&&(h<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");v||(v="utf8");let P=!1;for(;;)switch(v){case"hex":return M(this,t,s,h);case"utf8":case"utf-8":return ee(this,t,s,h);case"ascii":case"latin1":case"binary":return V(this,t,s,h);case"base64":return q(this,t,s,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,t,s,h);default:if(P)throw new TypeError("Unknown encoding: "+v);v=(""+v).toLowerCase(),P=!0}},"write"),r.prototype.toJSON=e(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function re(t,s,h){return s===0&&h===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(s,h))}l(re,"q"),e(re,"base64Slice");function ae(t,s,h){h=Math.min(t.length,h);let v=[],R=s;for(;R<h;){let P=t[R],C=null,Z=P>239?4:P>223?3:P>191?2:1;if(R+Z<=h){let oe,Ae,le,Fe;switch(Z){case 1:P<128&&(C=P);break;case 2:oe=t[R+1],(oe&192)===128&&(Fe=(P&31)<<6|oe&63,Fe>127&&(C=Fe));break;case 3:oe=t[R+1],Ae=t[R+2],(oe&192)===128&&(Ae&192)===128&&(Fe=(P&15)<<12|(oe&63)<<6|Ae&63,Fe>2047&&(Fe<55296||Fe>57343)&&(C=Fe));break;case 4:oe=t[R+1],Ae=t[R+2],le=t[R+3],(oe&192)===128&&(Ae&192)===128&&(le&192)===128&&(Fe=(P&15)<<18|(oe&63)<<12|(Ae&63)<<6|le&63,Fe>65535&&Fe<1114112&&(C=Fe))}}C===null?(C=65533,Z=1):C>65535&&(C-=65536,v.push(C>>>10&1023|55296),C=56320|C&1023),v.push(C),R+=Z}return we(v)}l(ae,"Z"),e(ae,"utf8Slice");let de=4096;function we(t){let s=t.length;if(s<=de)return String.fromCharCode.apply(String,t);let h="",v=0;for(;v<s;)h+=String.fromCharCode.apply(String,t.slice(v,v+=de));return h}l(we,"se"),e(we,"decodeCodePointsArray");function Ie(t,s,h){let v="";h=Math.min(t.length,h);for(let R=s;R<h;++R)v+=String.fromCharCode(t[R]&127);return v}l(Ie,"_e"),e(Ie,"asciiSlice");function je(t,s,h){let v="";h=Math.min(t.length,h);for(let R=s;R<h;++R)v+=String.fromCharCode(t[R]);return v}l(je,"pe"),e(je,"latin1Slice");function se(t,s,h){let v=t.length;(!s||s<0)&&(s=0),(!h||h<0||h>v)&&(h=v);let R="";for(let P=s;P<h;++P)R+=Pe[t[P]];return R}l(se,"Q"),e(se,"hexSlice");function Te(t,s,h){let v=t.slice(s,h),R="";for(let P=0;P<v.length-1;P+=2)R+=String.fromCharCode(v[P]+v[P+1]*256);return R}l(Te,"he"),e(Te,"utf16leSlice"),r.prototype.slice=e(function(t,s){let h=this.length;t=~~t,s=s===void 0?h:~~s,t<0?(t+=h,t<0&&(t=0)):t>h&&(t=h),s<0?(s+=h,s<0&&(s=0)):s>h&&(s=h),s<t&&(s=t);let v=this.subarray(t,s);return Object.setPrototypeOf(v,r.prototype),v},"slice");function J(t,s,h){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+s>h)throw new RangeError("Trying to access beyond buffer length")}l(J,"U"),e(J,"checkOffset"),r.prototype.readUintLE=r.prototype.readUIntLE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=this[t],R=1,P=0;for(;++P<s&&(R*=256);)v+=this[t+P]*R;return v},"readUIntLE"),r.prototype.readUintBE=r.prototype.readUIntBE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=this[t+--s],R=1;for(;s>0&&(R*=256);)v+=this[t+--s]*R;return v},"readUIntBE"),r.prototype.readUint8=r.prototype.readUInt8=e(function(t,s){return t=t>>>0,s||J(t,1,this.length),this[t]},"readUInt8"),r.prototype.readUint16LE=r.prototype.readUInt16LE=e(function(t,s){return t=t>>>0,s||J(t,2,this.length),this[t]|this[t+1]<<8},"readUInt16LE"),r.prototype.readUint16BE=r.prototype.readUInt16BE=e(function(t,s){return t=t>>>0,s||J(t,2,this.length),this[t]<<8|this[t+1]},"readUInt16BE"),r.prototype.readUint32LE=r.prototype.readUInt32LE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},"readUInt32LE"),r.prototype.readUint32BE=r.prototype.readUInt32BE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},"readUInt32BE"),r.prototype.readBigUInt64LE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=s+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,R=this[++t]+this[++t]*2**8+this[++t]*2**16+h*2**24;return BigInt(v)+(BigInt(R)<<BigInt(32))},"readBigUInt64LE")),r.prototype.readBigUInt64BE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=s*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],R=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+h;return(BigInt(v)<<BigInt(32))+BigInt(R)},"readBigUInt64BE")),r.prototype.readIntLE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=this[t],R=1,P=0;for(;++P<s&&(R*=256);)v+=this[t+P]*R;return R*=128,v>=R&&(v-=Math.pow(2,8*s)),v},"readIntLE"),r.prototype.readIntBE=e(function(t,s,h){t=t>>>0,s=s>>>0,h||J(t,s,this.length);let v=s,R=1,P=this[t+--v];for(;v>0&&(R*=256);)P+=this[t+--v]*R;return R*=128,P>=R&&(P-=Math.pow(2,8*s)),P},"readIntBE"),r.prototype.readInt8=e(function(t,s){return t=t>>>0,s||J(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},"readInt8"),r.prototype.readInt16LE=e(function(t,s){t=t>>>0,s||J(t,2,this.length);let h=this[t]|this[t+1]<<8;return h&32768?h|4294901760:h},"readInt16LE"),r.prototype.readInt16BE=e(function(t,s){t=t>>>0,s||J(t,2,this.length);let h=this[t+1]|this[t]<<8;return h&32768?h|4294901760:h},"readInt16BE"),r.prototype.readInt32LE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},"readInt32LE"),r.prototype.readInt32BE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},"readInt32BE"),r.prototype.readBigInt64LE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(h<<24);return(BigInt(v)<<BigInt(32))+BigInt(s+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)},"readBigInt64LE")),r.prototype.readBigInt64BE=$e(e(function(t){t=t>>>0,N(t,"offset");let s=this[t],h=this[t+7];(s===void 0||h===void 0)&&x(t,this.length-8);let v=(s<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(v)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+h)},"readBigInt64BE")),r.prototype.readFloatLE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),i.read(this,t,!0,23,4)},"readFloatLE"),r.prototype.readFloatBE=e(function(t,s){return t=t>>>0,s||J(t,4,this.length),i.read(this,t,!1,23,4)},"readFloatBE"),r.prototype.readDoubleLE=e(function(t,s){return t=t>>>0,s||J(t,8,this.length),i.read(this,t,!0,52,8)},"readDoubleLE"),r.prototype.readDoubleBE=e(function(t,s){return t=t>>>0,s||J(t,8,this.length),i.read(this,t,!1,52,8)},"readDoubleBE");function ue(t,s,h,v,R,P){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>R||s<P)throw new RangeError('"value" argument is out of bounds');if(h+v>t.length)throw new RangeError("Index out of range")}l(ue,"J"),e(ue,"checkInt"),r.prototype.writeUintLE=r.prototype.writeUIntLE=e(function(t,s,h,v){if(t=+t,s=s>>>0,h=h>>>0,!v){let C=Math.pow(2,8*h)-1;ue(this,t,s,h,C,0)}let R=1,P=0;for(this[s]=t&255;++P<h&&(R*=256);)this[s+P]=t/R&255;return s+h},"writeUIntLE"),r.prototype.writeUintBE=r.prototype.writeUIntBE=e(function(t,s,h,v){if(t=+t,s=s>>>0,h=h>>>0,!v){let C=Math.pow(2,8*h)-1;ue(this,t,s,h,C,0)}let R=h-1,P=1;for(this[s+R]=t&255;--R>=0&&(P*=256);)this[s+R]=t/P&255;return s+h},"writeUIntBE"),r.prototype.writeUint8=r.prototype.writeUInt8=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,1,255,0),this[s]=t&255,s+1},"writeUInt8"),r.prototype.writeUint16LE=r.prototype.writeUInt16LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,65535,0),this[s]=t&255,this[s+1]=t>>>8,s+2},"writeUInt16LE"),r.prototype.writeUint16BE=r.prototype.writeUInt16BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,65535,0),this[s]=t>>>8,this[s+1]=t&255,s+2},"writeUInt16BE"),r.prototype.writeUint32LE=r.prototype.writeUInt32LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,4294967295,0),this[s+3]=t>>>24,this[s+2]=t>>>16,this[s+1]=t>>>8,this[s]=t&255,s+4},"writeUInt32LE"),r.prototype.writeUint32BE=r.prototype.writeUInt32BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,4294967295,0),this[s]=t>>>24,this[s+1]=t>>>16,this[s+2]=t>>>8,this[s+3]=t&255,s+4},"writeUInt32BE");function te(t,s,h,v,R){ve(s,v,R,t,h,7);let P=Number(s&BigInt(4294967295));t[h++]=P,P=P>>8,t[h++]=P,P=P>>8,t[h++]=P,P=P>>8,t[h++]=P;let C=Number(s>>BigInt(32)&BigInt(4294967295));return t[h++]=C,C=C>>8,t[h++]=C,C=C>>8,t[h++]=C,C=C>>8,t[h++]=C,h}l(te,"z"),e(te,"wrtBigUInt64LE");function X(t,s,h,v,R){ve(s,v,R,t,h,7);let P=Number(s&BigInt(4294967295));t[h+7]=P,P=P>>8,t[h+6]=P,P=P>>8,t[h+5]=P,P=P>>8,t[h+4]=P;let C=Number(s>>BigInt(32)&BigInt(4294967295));return t[h+3]=C,C=C>>8,t[h+2]=C,C=C>>8,t[h+1]=C,C=C>>8,t[h]=C,h+8}l(X,"V"),e(X,"wrtBigUInt64BE"),r.prototype.writeBigUInt64LE=$e(e(function(t,s=0){return te(this,t,s,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE")),r.prototype.writeBigUInt64BE=$e(e(function(t,s=0){return X(this,t,s,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")),r.prototype.writeIntLE=e(function(t,s,h,v){if(t=+t,s=s>>>0,!v){let Z=Math.pow(2,8*h-1);ue(this,t,s,h,Z-1,-Z)}let R=0,P=1,C=0;for(this[s]=t&255;++R<h&&(P*=256);)t<0&&C===0&&this[s+R-1]!==0&&(C=1),this[s+R]=(t/P>>0)-C&255;return s+h},"writeIntLE"),r.prototype.writeIntBE=e(function(t,s,h,v){if(t=+t,s=s>>>0,!v){let Z=Math.pow(2,8*h-1);ue(this,t,s,h,Z-1,-Z)}let R=h-1,P=1,C=0;for(this[s+R]=t&255;--R>=0&&(P*=256);)t<0&&C===0&&this[s+R+1]!==0&&(C=1),this[s+R]=(t/P>>0)-C&255;return s+h},"writeIntBE"),r.prototype.writeInt8=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,1,127,-128),t<0&&(t=255+t+1),this[s]=t&255,s+1},"writeInt8"),r.prototype.writeInt16LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,32767,-32768),this[s]=t&255,this[s+1]=t>>>8,s+2},"writeInt16LE"),r.prototype.writeInt16BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,2,32767,-32768),this[s]=t>>>8,this[s+1]=t&255,s+2},"writeInt16BE"),r.prototype.writeInt32LE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,2147483647,-2147483648),this[s]=t&255,this[s+1]=t>>>8,this[s+2]=t>>>16,this[s+3]=t>>>24,s+4},"writeInt32LE"),r.prototype.writeInt32BE=e(function(t,s,h){return t=+t,s=s>>>0,h||ue(this,t,s,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[s]=t>>>24,this[s+1]=t>>>16,this[s+2]=t>>>8,this[s+3]=t&255,s+4},"writeInt32BE"),r.prototype.writeBigInt64LE=$e(e(function(t,s=0){return te(this,t,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE")),r.prototype.writeBigInt64BE=$e(e(function(t,s=0){return X(this,t,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function ye(t,s,h,v,R,P){if(h+v>t.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}l(ye,"G"),e(ye,"checkIEEE754");function Re(t,s,h,v,R){return s=+s,h=h>>>0,R||ye(t,s,h,4),i.write(t,s,h,v,23,4),h+4}l(Re,"fe"),e(Re,"writeFloat"),r.prototype.writeFloatLE=e(function(t,s,h){return Re(this,t,s,!0,h)},"writeFloatLE"),r.prototype.writeFloatBE=e(function(t,s,h){return Re(this,t,s,!1,h)},"writeFloatBE");function De(t,s,h,v,R){return s=+s,h=h>>>0,R||ye(t,s,h,8),i.write(t,s,h,v,52,8),h+8}l(De,"be"),e(De,"writeDouble"),r.prototype.writeDoubleLE=e(function(t,s,h){return De(this,t,s,!0,h)},"writeDoubleLE"),r.prototype.writeDoubleBE=e(function(t,s,h){return De(this,t,s,!1,h)},"writeDoubleBE"),r.prototype.copy=e(function(t,s,h,v){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(h||(h=0),!v&&v!==0&&(v=this.length),s>=t.length&&(s=t.length),s||(s=0),v>0&&v<h&&(v=h),v===h||t.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(h<0||h>=this.length)throw new RangeError("Index out of range");if(v<0)throw new RangeError("sourceEnd out of bounds");v>this.length&&(v=this.length),t.length-s<v-h&&(v=t.length-s+h);let R=v-h;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,h,v):Uint8Array.prototype.set.call(t,this.subarray(h,v),s),R},"copy"),r.prototype.fill=e(function(t,s,h,v){if(typeof t=="string"){if(typeof s=="string"?(v=s,s=0,h=this.length):typeof h=="string"&&(v=h,h=this.length),v!==void 0&&typeof v!="string")throw new TypeError("encoding must be a string");if(typeof v=="string"&&!r.isEncoding(v))throw new TypeError("Unknown encoding: "+v);if(t.length===1){let P=t.charCodeAt(0);(v==="utf8"&&P<128||v==="latin1")&&(t=P)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(s<0||this.length<s||this.length<h)throw new RangeError("Out of range index");if(h<=s)return this;s=s>>>0,h=h===void 0?this.length:h>>>0,t||(t=0);let R;if(typeof t=="number")for(R=s;R<h;++R)this[R]=t;else{let P=r.isBuffer(t)?t:r.from(t,v),C=P.length;if(C===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(R=0;R<h-s;++R)this[R+s]=P[R%C]}return this},"fill");let Y={};function H(t,s,h){var R;var v;Y[t]=(v=(R=class extends h{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(C){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:C,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}},l(R,"w"),R),e(v,"NodeError"),v)}l(H,"$"),e(H,"E"),H("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),H("ERR_INVALID_ARG_TYPE",function(t,s){return`The "${t}" argument must be of type number. Received type ${typeof s}`},TypeError),H("ERR_OUT_OF_RANGE",function(t,s,h){let v=`The value of "${t}" is out of range.`,R=h;return Number.isInteger(h)&&Math.abs(h)>2**32?R=Q(String(h)):typeof h=="bigint"&&(R=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(R=Q(R)),R+="n"),v+=` It must be ${s}. Received ${R}`,v},RangeError);function Q(t){let s="",h=t.length,v=t[0]==="-"?1:0;for(;h>=v+4;h-=3)s=`_${t.slice(h-3,h)}${s}`;return`${t.slice(0,h)}${s}`}l(Q,"H"),e(Q,"addNumericalSeparator");function fe(t,s,h){N(s,"offset"),(t[s]===void 0||t[s+h]===void 0)&&x(s,t.length-(h+1))}l(fe,"te"),e(fe,"checkBounds");function ve(t,s,h,v,R,P){if(t>h||t<s){let C=typeof s=="bigint"?"n":"",Z;throw s===0||s===BigInt(0)?Z=`>= 0${C} and < 2${C} ** ${(P+1)*8}${C}`:Z=`>= -(2${C} ** ${(P+1)*8-1}${C}) and < 2 ** ${(P+1)*8-1}${C}`,new Y.ERR_OUT_OF_RANGE("value",Z,t)}fe(v,R,P)}l(ve,"oe"),e(ve,"checkIntBI");function N(t,s){if(typeof t!="number")throw new Y.ERR_INVALID_ARG_TYPE(s,"number",t)}l(N,"P"),e(N,"validateNumber");function x(t,s,h){throw Math.floor(t)!==t?(N(t,h),new Y.ERR_OUT_OF_RANGE("offset","an integer",t)):s<0?new Y.ERR_BUFFER_OUT_OF_BOUNDS:new Y.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${s}`,t)}l(x,"x"),e(x,"boundsError");let D=/[^+/0-9A-Za-z-_]/g;function z(t){if(t=t.split("=")[0],t=t.trim().replace(D,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}l(z,"Y"),e(z,"base64clean");function Ee(t,s){s=s||1/0;let h,v=t.length,R=null,P=[];for(let C=0;C<v;++C){if(h=t.charCodeAt(C),h>55295&&h<57344){if(!R){if(h>56319){(s-=3)>-1&&P.push(239,191,189);continue}else if(C+1===v){(s-=3)>-1&&P.push(239,191,189);continue}R=h;continue}if(h<56320){(s-=3)>-1&&P.push(239,191,189),R=h;continue}h=(R-55296<<10|h-56320)+65536}else R&&(s-=3)>-1&&P.push(239,191,189);if(R=null,h<128){if((s-=1)<0)break;P.push(h)}else if(h<2048){if((s-=2)<0)break;P.push(h>>6|192,h&63|128)}else if(h<65536){if((s-=3)<0)break;P.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((s-=4)<0)break;P.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return P}l(Ee,"ue"),e(Ee,"utf8ToBytes");function ke(t){let s=[];for(let h=0;h<t.length;++h)s.push(t.charCodeAt(h)&255);return s}l(ke,"le"),e(ke,"asciiToBytes");function be(t,s){let h,v,R,P=[];for(let C=0;C<t.length&&!((s-=2)<0);++C)h=t.charCodeAt(C),v=h>>8,R=h%256,P.push(R),P.push(v);return P}l(be,"ee"),e(be,"utf16leToBytes");function ge(t){return o.toByteArray(z(t))}l(ge,"ie"),e(ge,"base64ToBytes");function Ne(t,s,h,v){let R;for(R=0;R<v&&!(R+h>=s.length||R>=t.length);++R)s[R+h]=t[R];return R}l(Ne,"me"),e(Ne,"blitBuffer");function xe(t,s){return t instanceof s||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===s.name}l(xe,"ye"),e(xe,"isInstance");function Oe(t){return t!==t}l(Oe,"ve"),e(Oe,"numberIsNaN");let Pe=function(){let t="0123456789abcdef",s=new Array(256);for(let h=0;h<16;++h){let v=h*16;for(let R=0;R<16;++R)s[v+R]=t[h]+t[R]}return s}();function $e(t){return typeof BigInt>"u"?Ke:t}l($e,"Be"),e($e,"defineBigIntMethod");function Ke(){throw new Error("BigInt not supported")}return l(Ke,"Xe"),e(Ke,"BufferBigIntNotDefined"),Di}l(ZA,"D6");var bs,qm,Au,Gm,Di,Vm,Oi,_x,Ex,Sx,ZP=Xt(()=>{bs={},qm=!1,e(bx,"dew$2"),Au={},Gm=!1,e(vx,"dew$1"),Di={},Vm=!1,e(ZA,"dew"),Oi=ZA(),Oi.Buffer,Oi.SlowBuffer,Oi.INSPECT_MAX_BYTES,Oi.kMaxLength,_x=Oi.Buffer,Ex=Oi.INSPECT_MAX_BYTES,Sx=Oi.kMaxLength}),Ax={};an(Ax,{Buffer:l(()=>_x,"Buffer"),INSPECT_MAX_BYTES:l(()=>Ex,"INSPECT_MAX_BYTES"),kMaxLength:l(()=>Sx,"kMaxLength")});var QP=Xt(()=>{ZP()}),XP=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=void 0;var i=(QP(),hr(Ax));Object.defineProperty(o,"Buffer",{enumerable:!0,get:e(function(){return i.Buffer},"get")})}),Ba=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.bufferFrom=o.bufferAllocUnsafe=o.Buffer=void 0;var i=XP();Object.defineProperty(o,"Buffer",{enumerable:!0,get:e(function(){return i.Buffer},"get")});function f(n,...r){return new i.Buffer(n,...r)}l(f,"L1"),e(f,"bufferV0P12Ponyfill");var g=i.Buffer.allocUnsafe||f;o.bufferAllocUnsafe=g;var a=i.Buffer.from||f;o.bufferFrom=a}),Rx=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.inherits=i,o.promisify=f,o.inspect=g,o.format=a;function i(n,r){if(n==null)throw new TypeError("The constructor to inherit from is not defined");if(r==null)throw new TypeError("The super constructor to inherit from is not defined");n.super_=r,n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}l(i,"W6"),e(i,"inherits");function f(n){if(typeof n!="function")throw new TypeError('The "original" argument must be of type function');return function(...r){return new Promise((u,p)=>{n.call(this,...r,(c,d)=>{c?p(c):u(d)})})}}l(f,"q6"),e(f,"promisify");function g(n){return n===null?"null":n===void 0?"undefined":typeof n=="string"?`'${n}'`:typeof n=="number"||typeof n=="boolean"?String(n):Array.isArray(n)?`[ ${n.map(r=>g(r)).join(", ")} ]`:typeof n=="object"?`{ ${Object.entries(n).map(([r,u])=>`${r}: ${g(u)}`).join(", ")} }`:String(n)}l(g,"dy"),e(g,"inspect");function a(n,...r){if(r.length===0)return n;let u=n,p=0;for(u=u.replace(/%[sdj%]/g,c=>{if(p>=r.length)return c;let d=r[p++];switch(c){case"%s":return String(d);case"%d":return Number(d).toString();case"%j":try{return JSON.stringify(d)}catch{return"[Circular]"}case"%%":return"%";default:return c}});p<r.length;)u+=" "+String(r[p++]);return u}l(a,"z6"),e(a,"format")}),vd=Ge(o=>{"use strict";var d;Object.defineProperty(o,"__esModule",{value:!0}),o.AssertionError=o.RangeError=o.TypeError=o.Error=void 0,o.message=p,o.E=c;var i=Rx(),f=typeof Symbol>"u"?"_kCode":Symbol("code"),g={};function a(m){var w;var y;return y=(w=class extends m{constructor(S,...T){super(p(S,T)),this.code=S,this[f]=S,this.name=`${super.name} [${this[f]}]`}},l(w,"t"),w),e(y,"NodeError"),y}l(a,"gy"),e(a,"makeNodeError");var n=globalThis,r=(d=class extends n.Error{constructor(y){if(typeof y!="object"||y===null)throw new o.TypeError("ERR_INVALID_ARG_TYPE","options","object");y.message?super(y.message):super(`${(0,i.inspect)(y.actual).slice(0,128)} ${y.operator} ${(0,i.inspect)(y.expected).slice(0,128)}`),this.generatedMessage=!y.message,this.name="AssertionError [ERR_ASSERTION]",this.code="ERR_ASSERTION",this.actual=y.actual,this.expected=y.expected,this.operator=y.operator,o.Error.captureStackTrace(this,y.stackStartFunction)}},l(d,"wy"),d);e(r,"AssertionError");var u=r;o.AssertionError=u;function p(m,y){if(typeof m!="string")throw new o.Error("Error message key must be a string");let w=g[m];if(!w)throw new o.Error(`An invalid error message key was used: ${m}.`);let _;if(typeof w=="function")_=w;else{if(_=i.format,y===void 0||y.length===0)return w;y.unshift(w)}return String(_.apply(null,y))}l(p,"$1"),e(p,"message");function c(m,y){g[m]=typeof y=="function"?y:String(y)}l(c,"Ni"),e(c,"E"),o.Error=a(n.Error),o.TypeError=a(n.TypeError),o.RangeError=a(n.RangeError),c("ERR_DIR_CLOSED","Directory handle was closed"),c("ERR_DIR_CONCURRENT_OPERATION","Cannot do synchronous work on directory handle with concurrent asynchronous operations"),c("ERR_INVALID_FILE_URL_HOST",'File URL host must be "localhost" or empty on %s'),c("ERR_INVALID_FILE_URL_PATH","File URL path %s"),c("ERR_INVALID_OPT_VALUE",(m,y)=>`The value "${String(y)}" is invalid for option "${m}"`),c("ERR_INVALID_OPT_VALUE_ENCODING",m=>`The value "${String(m)}" is invalid for option "encoding"`),c("ERR_INVALID_ARG_VALUE","Unable to open file as blob")}),_d=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.ENCODING_UTF8=void 0,o.assertEncoding=g,o.strToEncoding=a;var i=Ba(),f=vd();o.ENCODING_UTF8="utf8";function g(n){if(n&&!i.Buffer.isEncoding(n))throw new f.TypeError("ERR_INVALID_OPT_VALUE_ENCODING",n)}l(g,"G6"),e(g,"assertEncoding");function a(n,r){return!r||r===o.ENCODING_UTF8?n:r==="buffer"?new i.Buffer(n):new i.Buffer(n).toString(r)}l(a,"Y6"),e(a,"strToEncoding")}),vE=Ge(o=>{"use strict";var w;Object.defineProperty(o,"__esModule",{value:!0}),o.Dirent=void 0;var i=$n(),f=_d(),{S_IFMT:g,S_IFDIR:a,S_IFREG:n,S_IFBLK:r,S_IFCHR:u,S_IFLNK:p,S_IFIFO:c,S_IFSOCK:d}=i.constants,m=(w=class{constructor(){this.name="",this.path="",this.parentPath="",this.mode=0}static build(S,T){let k=new w,{mode:E}=S.getNode();return k.name=(0,f.strToEncoding)(S.getName(),T),k.mode=E,k.path=S.getParentPath(),k.parentPath=k.path,k}_checkModeProperty(S){return(this.mode&g)===S}isDirectory(){return this._checkModeProperty(a)}isFile(){return this._checkModeProperty(n)}isBlockDevice(){return this._checkModeProperty(r)}isCharacterDevice(){return this._checkModeProperty(u)}isSymbolicLink(){return this._checkModeProperty(p)}isFIFO(){return this._checkModeProperty(c)}isSocket(){return this._checkModeProperty(d)}},l(w,"Nu"),w);e(m,"Dirent");var y=m;o.Dirent=y,o.default=y});function ed(o){throw new Error("Node.js process "+o+" is not supported by JSPM core outside of Node.js")}l(ed,"Ay");function kx(){!ga||!oa||(ga=!1,oa.length?jn=oa.concat(jn):zl=-1,jn.length&&_E())}l(kx,"oM");function _E(){if(!ga){var o=setTimeout(kx,0);ga=!0;for(var i=jn.length;i;){for(oa=jn,jn=[];++zl<i;)oa&&oa[zl].run();zl=-1,i=jn.length}oa=null,ga=!1,clearTimeout(o)}}l(_E,"U1");function QA(o){var i=new Array(arguments.length-1);if(arguments.length>1)for(var f=1;f<arguments.length;f++)i[f-1]=arguments[f];jn.push(new Km(o,i)),jn.length===1&&!ga&&setTimeout(_E,0)}l(QA,"aM");function Km(o,i){this.fun=o,this.array=i}l(Km,"j1");function mr(){}l(mr,"Xt");function XA(o){ed("_linkedBinding")}l(XA,"SM");function eR(o){ed("dlopen")}l(eR,"FM");function tR(){return[]}l(tR,"xM");function rR(){return[]}l(rR,"OM");function nR(o,i){if(!o)throw new Error(i||"assertion error")}l(nR,"$M");function iR(){return!1}l(iR,"HM");function oR(){return fi.now()/1e3}l(oR,"oU");function Xf(o){var i=Math.floor((Date.now()-fi.now())*.001),f=fi.now()*.001,g=Math.floor(f)+i,a=Math.floor(f%1*1e9);return o&&(g=g-o[0],a=a-o[1],a<0&&(g--,a+=Ru)),[g,a]}l(Xf,"Sy");function Zn(){return EE}l(Zn,"Mi");function aR(o){return[]}l(aR,"gU");function sR(){if(Jm)return ku;Jm=!0;var o=EE;function i(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}l(i,"t"),e(i,"assertPath");function f(n,r){for(var u="",p=0,c=-1,d=0,m,y=0;y<=n.length;++y){if(y<n.length)m=n.charCodeAt(y);else{if(m===47)break;m=47}if(m===47){if(!(c===y-1||d===1))if(c!==y-1&&d===2){if(u.length<2||p!==2||u.charCodeAt(u.length-1)!==46||u.charCodeAt(u.length-2)!==46){if(u.length>2){var w=u.lastIndexOf("/");if(w!==u.length-1){w===-1?(u="",p=0):(u=u.slice(0,w),p=u.length-1-u.lastIndexOf("/")),c=y,d=0;continue}}else if(u.length===2||u.length===1){u="",p=0,c=y,d=0;continue}}r&&(u.length>0?u+="/..":u="..",p=2)}else u.length>0?u+="/"+n.slice(c+1,y):u=n.slice(c+1,y),p=y-c-1;c=y,d=0}else m===46&&d!==-1?++d:d=-1}return u}l(f,"r"),e(f,"normalizeStringPosix");function g(n,r){var u=r.dir||r.root,p=r.base||(r.name||"")+(r.ext||"");return u?u===r.root?u+p:u+n+p:p}l(g,"n"),e(g,"_format");var a={resolve:e(function(){for(var n="",r=!1,u,p=arguments.length-1;p>=-1&&!r;p--){var c;p>=0?c=arguments[p]:(u===void 0&&(u=o.cwd()),c=u),i(c),c.length!==0&&(n=c+"/"+n,r=c.charCodeAt(0)===47)}return n=f(n,!r),r?n.length>0?"/"+n:"/":n.length>0?n:"."},"resolve2"),normalize:e(function(n){if(i(n),n.length===0)return".";var r=n.charCodeAt(0)===47,u=n.charCodeAt(n.length-1)===47;return n=f(n,!r),n.length===0&&!r&&(n="."),n.length>0&&u&&(n+="/"),r?"/"+n:n},"normalize2"),isAbsolute:e(function(n){return i(n),n.length>0&&n.charCodeAt(0)===47},"isAbsolute2"),join:e(function(){if(arguments.length===0)return".";for(var n,r=0;r<arguments.length;++r){var u=arguments[r];i(u),u.length>0&&(n===void 0?n=u:n+="/"+u)}return n===void 0?".":a.normalize(n)},"join2"),relative:e(function(n,r){if(i(n),i(r),n===r||(n=a.resolve(n),r=a.resolve(r),n===r))return"";for(var u=1;u<n.length&&n.charCodeAt(u)===47;++u);for(var p=n.length,c=p-u,d=1;d<r.length&&r.charCodeAt(d)===47;++d);for(var m=r.length,y=m-d,w=c<y?c:y,_=-1,S=0;S<=w;++S){if(S===w){if(y>w){if(r.charCodeAt(d+S)===47)return r.slice(d+S+1);if(S===0)return r.slice(d+S)}else c>w&&(n.charCodeAt(u+S)===47?_=S:S===0&&(_=0));break}var T=n.charCodeAt(u+S),k=r.charCodeAt(d+S);if(T!==k)break;T===47&&(_=S)}var E="";for(S=u+_+1;S<=p;++S)(S===p||n.charCodeAt(S)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+r.slice(d+_):(d+=_,r.charCodeAt(d)===47&&++d,r.slice(d))},"relative2"),_makeLong:e(function(n){return n},"_makeLong2"),dirname:e(function(n){if(i(n),n.length===0)return".";for(var r=n.charCodeAt(0),u=r===47,p=-1,c=!0,d=n.length-1;d>=1;--d)if(r=n.charCodeAt(d),r===47){if(!c){p=d;break}}else c=!1;return p===-1?u?"/":".":u&&p===1?"//":n.slice(0,p)},"dirname2"),basename:e(function(n,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');i(n);var u=0,p=-1,c=!0,d;if(r!==void 0&&r.length>0&&r.length<=n.length){if(r.length===n.length&&r===n)return"";var m=r.length-1,y=-1;for(d=n.length-1;d>=0;--d){var w=n.charCodeAt(d);if(w===47){if(!c){u=d+1;break}}else y===-1&&(c=!1,y=d+1),m>=0&&(w===r.charCodeAt(m)?--m===-1&&(p=d):(m=-1,p=y))}return u===p?p=y:p===-1&&(p=n.length),n.slice(u,p)}else{for(d=n.length-1;d>=0;--d)if(n.charCodeAt(d)===47){if(!c){u=d+1;break}}else p===-1&&(c=!1,p=d+1);return p===-1?"":n.slice(u,p)}},"basename2"),extname:e(function(n){i(n);for(var r=-1,u=0,p=-1,c=!0,d=0,m=n.length-1;m>=0;--m){var y=n.charCodeAt(m);if(y===47){if(!c){u=m+1;break}continue}p===-1&&(c=!1,p=m+1),y===46?r===-1?r=m:d!==1&&(d=1):r!==-1&&(d=-1)}return r===-1||p===-1||d===0||d===1&&r===p-1&&r===u+1?"":n.slice(r,p)},"extname2"),format:e(function(n){if(n===null||typeof n!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof n);return g("/",n)},"format2"),parse:e(function(n){i(n);var r={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return r;var u=n.charCodeAt(0),p=u===47,c;p?(r.root="/",c=1):c=0;for(var d=-1,m=0,y=-1,w=!0,_=n.length-1,S=0;_>=c;--_){if(u=n.charCodeAt(_),u===47){if(!w){m=_+1;break}continue}y===-1&&(w=!1,y=_+1),u===46?d===-1?d=_:S!==1&&(S=1):d!==-1&&(S=-1)}return d===-1||y===-1||S===0||S===1&&d===y-1&&d===m+1?y!==-1&&(m===0&&p?r.base=r.name=n.slice(1,y):r.base=r.name=n.slice(m,y)):(m===0&&p?(r.name=n.slice(1,d),r.base=n.slice(1,y)):(r.name=n.slice(m,d),r.base=n.slice(m,y)),r.ext=n.slice(d,y)),m>0?r.dir=n.slice(0,m-1):p&&(r.dir="/"),r},"parse2"),sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,ku=a,ku}l(sR,"wU");var jn,ga,oa,zl,lR,fR,uR,cR,hR,dR,pR,gR,yR,mR,wR,bR,vR,_R,ER,SR,AR,RR,kR,OR,TR,eu,FR,BR,IR,xR,jR,CR,PR,LR,NR,DR,UR,MR,$R,WR,zR,HR,qR,GR,VR,KR,JR,YR,ZR,QR,XR,fi,hy,Ru,ek,tk,rk,nk,ik,ok,ak,sk,lk,fk,uk,EE,ku,Jm,Ar,Ox,Tx,Fx,Bx,Ix,xx,jx,Cx,Px,Lx,Nx,Dx,Ux,Mx,$x,eL=Xt(()=>{e(ed,"unimplemented"),jn=[],ga=!1,zl=-1,e(kx,"cleanUpNextTick"),e(_E,"drainQueue"),e(QA,"nextTick"),e(Km,"Item"),Km.prototype.run=function(){this.fun.apply(null,this.array)},lR="browser",fR="x64",uR="browser",cR={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},hR=["/usr/bin/node"],dR=[],pR="v16.8.0",gR={},yR=e(function(o,i){console.warn((i?i+": ":"")+o)},"emitWarning"),mR=e(function(o){ed("binding")},"binding"),wR=e(function(o){return 0},"umask"),bR=e(function(){return"/"},"cwd"),vR=e(function(o){},"chdir"),_R={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},e(mr,"noop"),ER=mr,SR=[],e(XA,"_linkedBinding"),AR={},RR=!1,kR={},e(eR,"dlopen"),e(tR,"_getActiveRequests"),e(rR,"_getActiveHandles"),OR=mr,TR=mr,eu=e(function(){return{}},"cpuUsage"),FR=eu,BR=eu,IR=mr,xR=mr,jR=mr,CR={},e(nR,"assert"),PR={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},LR=mr,NR=mr,e(iR,"hasUncaughtExceptionCaptureCallback"),DR=mr,UR=mr,MR=mr,$R=mr,WR=mr,zR=void 0,HR=void 0,qR=void 0,GR=mr,VR=2,KR=1,JR="/bin/usr/node",YR=9229,ZR="node",QR=[],XR=mr,fi={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},fi.now===void 0&&(hy=Date.now(),fi.timing&&fi.timing.navigationStart&&(hy=fi.timing.navigationStart),fi.now=()=>Date.now()-hy),e(oR,"uptime"),Ru=1e9,e(Xf,"hrtime"),Xf.bigint=function(o){var i=Xf(o);return typeof BigInt>"u"?i[0]*Ru+i[1]:BigInt(i[0]*Ru)+BigInt(i[1])},ek=10,tk={},rk=0,e(Zn,"on"),nk=Zn,ik=Zn,ok=Zn,ak=Zn,sk=Zn,lk=mr,fk=Zn,uk=Zn,e(aR,"listeners"),EE={version:pR,versions:gR,arch:fR,platform:uR,release:_R,_rawDebug:ER,moduleLoadList:SR,binding:mR,_linkedBinding:XA,_events:tk,_eventsCount:rk,_maxListeners:ek,on:Zn,addListener:nk,once:ik,off:ok,removeListener:ak,removeAllListeners:sk,emit:lk,prependListener:fk,prependOnceListener:uk,listeners:aR,domain:AR,_exiting:RR,config:kR,dlopen:eR,uptime:oR,_getActiveRequests:tR,_getActiveHandles:rR,reallyExit:OR,_kill:TR,cpuUsage:eu,resourceUsage:FR,memoryUsage:BR,kill:IR,exit:xR,openStdin:jR,allowedNodeEnvironmentFlags:CR,assert:nR,features:PR,_fatalExceptions:LR,setUncaughtExceptionCaptureCallback:NR,hasUncaughtExceptionCaptureCallback:iR,emitWarning:yR,nextTick:QA,_tickCallback:DR,_debugProcess:UR,_debugEnd:MR,_startProfilerIdleNotifier:$R,_stopProfilerIdleNotifier:WR,stdout:zR,stdin:qR,stderr:HR,abort:GR,umask:wR,chdir:vR,cwd:bR,env:cR,title:lR,argv:hR,execArgv:dR,pid:VR,ppid:KR,execPath:JR,debugPort:YR,hrtime:Xf,argv0:ZR,_preload_modules:QR,setSourceMapsEnabled:XR},ku={},Jm=!1,e(sR,"dew"),Ar=sR(),Ox=Ar._makeLong,Tx=Ar.basename,Fx=Ar.delimiter,Bx=Ar.dirname,Ix=Ar.extname,xx=Ar.format,jx=Ar.isAbsolute,Cx=Ar.join,Px=Ar.normalize,Lx=Ar.parse,Nx=Ar.posix,Dx=Ar.relative,Ux=Ar.resolve,Mx=Ar.sep,$x=Ar.win32}),Wx={};an(Wx,{_makeLong:l(()=>Ox,"_makeLong"),basename:l(()=>Tx,"basename"),delimiter:l(()=>Fx,"delimiter"),dirname:l(()=>Bx,"dirname"),extname:l(()=>Ix,"extname"),format:l(()=>xx,"format"),isAbsolute:l(()=>jx,"isAbsolute"),join:l(()=>Cx,"join"),normalize:l(()=>Px,"normalize"),parse:l(()=>Lx,"parse"),posix:l(()=>Nx,"posix"),relative:l(()=>Dx,"relative"),resolve:l(()=>Ux,"resolve"),sep:l(()=>Mx,"sep"),win32:l(()=>$x,"win32")});var tL=Xt(()=>{eL()}),yf=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.basename=o.isAbsolute=o.normalize=o.dirname=o.relative=o.join=o.posix=o.sep=o.resolve=void 0;var i=(tL(),hr(Wx));Object.defineProperty(o,"resolve",{enumerable:!0,get:e(function(){return i.resolve},"get")}),Object.defineProperty(o,"sep",{enumerable:!0,get:e(function(){return i.sep},"get")}),Object.defineProperty(o,"posix",{enumerable:!0,get:e(function(){return i.posix},"get")}),Object.defineProperty(o,"join",{enumerable:!0,get:e(function(){return i.join},"get")}),Object.defineProperty(o,"relative",{enumerable:!0,get:e(function(){return i.relative},"get")}),Object.defineProperty(o,"dirname",{enumerable:!0,get:e(function(){return i.dirname},"get")}),Object.defineProperty(o,"normalize",{enumerable:!0,get:e(function(){return i.normalize},"get")}),Object.defineProperty(o,"isAbsolute",{enumerable:!0,get:e(function(){return i.isAbsolute},"get")}),Object.defineProperty(o,"basename",{enumerable:!0,get:e(function(){return i.basename},"get")})}),SE={};an(SE,{__addDisposableResource:l(()=>v0,"__addDisposableResource"),__assign:l(()=>Tl,"__assign"),__asyncDelegator:l(()=>h0,"__asyncDelegator"),__asyncGenerator:l(()=>c0,"__asyncGenerator"),__asyncValues:l(()=>d0,"__asyncValues"),__await:l(()=>ka,"__await"),__awaiter:l(()=>o0,"__awaiter"),__classPrivateFieldGet:l(()=>m0,"__classPrivateFieldGet"),__classPrivateFieldIn:l(()=>b0,"__classPrivateFieldIn"),__classPrivateFieldSet:l(()=>w0,"__classPrivateFieldSet"),__createBinding:l(()=>df,"__createBinding"),__decorate:l(()=>Qm,"__decorate"),__disposeResources:l(()=>_0,"__disposeResources"),__esDecorate:l(()=>e0,"__esDecorate"),__exportStar:l(()=>s0,"__exportStar"),__extends:l(()=>Ym,"__extends"),__generator:l(()=>a0,"__generator"),__importDefault:l(()=>y0,"__importDefault"),__importStar:l(()=>g0,"__importStar"),__makeTemplateObject:l(()=>p0,"__makeTemplateObject"),__metadata:l(()=>i0,"__metadata"),__param:l(()=>Xm,"__param"),__propKey:l(()=>r0,"__propKey"),__read:l(()=>td,"__read"),__rest:l(()=>Zm,"__rest"),__rewriteRelativeImportExtension:l(()=>E0,"__rewriteRelativeImportExtension"),__runInitializers:l(()=>t0,"__runInitializers"),__setFunctionName:l(()=>n0,"__setFunctionName"),__spread:l(()=>l0,"__spread"),__spreadArray:l(()=>u0,"__spreadArray"),__spreadArrays:l(()=>f0,"__spreadArrays"),__values:l(()=>hf,"__values"),default:l(()=>qx,"default")});function Ym(o,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");Ou(o,i);function f(){this.constructor=o}l(f,"r"),e(f,"__"),o.prototype=i===null?Object.create(i):(f.prototype=i.prototype,new f)}l(Ym,"V1");function Zm(o,i){var f={};for(var g in o)Object.prototype.hasOwnProperty.call(o,g)&&i.indexOf(g)<0&&(f[g]=o[g]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,g=Object.getOwnPropertySymbols(o);a<g.length;a++)i.indexOf(g[a])<0&&Object.prototype.propertyIsEnumerable.call(o,g[a])&&(f[g[a]]=o[g[a]]);return f}l(Zm,"G1");function Qm(o,i,f,g){var a=arguments.length,n=a<3?i:g===null?g=Object.getOwnPropertyDescriptor(i,f):g,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,i,f,g);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(n=(a<3?r(n):a>3?r(i,f,n):r(i,f))||n);return a>3&&n&&Object.defineProperty(i,f,n),n}l(Qm,"Y1");function Xm(o,i){return function(f,g){i(f,g,o)}}l(Xm,"K1");function e0(o,i,f,g,a,n){function r(k){if(k!==void 0&&typeof k!="function")throw new TypeError("Function expected");return k}l(r,"i"),e(r,"accept");for(var u=g.kind,p=u==="getter"?"get":u==="setter"?"set":"value",c=!i&&o?g.static?o:o.prototype:null,d=i||(c?Object.getOwnPropertyDescriptor(c,g.name):{}),m,y=!1,w=f.length-1;w>=0;w--){var _={};for(var S in g)_[S]=S==="access"?{}:g[S];for(var S in g.access)_.access[S]=g.access[S];_.addInitializer=function(k){if(y)throw new TypeError("Cannot add initializers after decoration has completed");n.push(r(k||null))};var T=(0,f[w])(u==="accessor"?{get:d.get,set:d.set}:d[p],_);if(u==="accessor"){if(T===void 0)continue;if(T===null||typeof T!="object")throw new TypeError("Object expected");(m=r(T.get))&&(d.get=m),(m=r(T.set))&&(d.set=m),(m=r(T.init))&&a.unshift(m)}else(m=r(T))&&(u==="field"?a.unshift(m):d[p]=m)}c&&Object.defineProperty(c,g.name,d),y=!0}l(e0,"X1");function t0(o,i,f){for(var g=arguments.length>2,a=0;a<i.length;a++)f=g?i[a].call(o,f):i[a].call(o);return g?f:void 0}l(t0,"J1");function r0(o){return typeof o=="symbol"?o:"".concat(o)}l(r0,"Z1");function n0(o,i,f){return typeof i=="symbol"&&(i=i.description?"[".concat(i.description,"]"):""),Object.defineProperty(o,"name",{configurable:!0,value:f?"".concat(f," ",i):i})}l(n0,"Q1");function i0(o,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,i)}l(i0,"eE");function o0(o,i,f,g){function a(n){return n instanceof f?n:new f(function(r){r(n)})}return l(a,"a"),e(a,"adopt"),new(f||(f=Promise))(function(n,r){function u(d){try{c(g.next(d))}catch(m){r(m)}}l(u,"f"),e(u,"fulfilled");function p(d){try{c(g.throw(d))}catch(m){r(m)}}l(p,"h"),e(p,"rejected");function c(d){d.done?n(d.value):a(d.value).then(u,p)}l(c,"c"),e(c,"step"),c((g=g.apply(o,i||[])).next())})}l(o0,"tE");function a0(o,i){var f={label:0,sent:e(function(){if(n[0]&1)throw n[1];return n[1]},"sent"),trys:[],ops:[]},g,a,n,r=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return r.next=u(0),r.throw=u(1),r.return=u(2),typeof Symbol=="function"&&(r[Symbol.iterator]=function(){return this}),r;function u(c){return function(d){return p([c,d])}}function p(c){if(g)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(f=0)),f;)try{if(g=1,a&&(n=c[0]&2?a.return:c[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,c[1])).done)return n;switch(a=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return f.label++,{value:c[1],done:!1};case 5:f.label++,a=c[1],c=[0];continue;case 7:c=f.ops.pop(),f.trys.pop();continue;default:if(n=f.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){f=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){f.label=c[1];break}if(c[0]===6&&f.label<n[1]){f.label=n[1],n=c;break}if(n&&f.label<n[2]){f.label=n[2],f.ops.push(c);break}n[2]&&f.ops.pop(),f.trys.pop();continue}c=i.call(o,f)}catch(d){c=[6,d],a=0}finally{g=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}l(a0,"rE");function s0(o,i){for(var f in o)f!=="default"&&!Object.prototype.hasOwnProperty.call(i,f)&&df(i,o,f)}l(s0,"nE");function hf(o){var i=typeof Symbol=="function"&&Symbol.iterator,f=i&&o[i],g=0;if(f)return f.call(o);if(o&&typeof o.length=="number")return{next:e(function(){return o&&g>=o.length&&(o=void 0),{value:o&&o[g++],done:!o}},"next")};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}l(hf,"ju");function td(o,i){var f=typeof Symbol=="function"&&o[Symbol.iterator];if(!f)return o;var g=f.call(o),a,n=[],r;try{for(;(i===void 0||i-- >0)&&!(a=g.next()).done;)n.push(a.value)}catch(u){r={error:u}}finally{try{a&&!a.done&&(f=g.return)&&f.call(g)}finally{if(r)throw r.error}}return n}l(td,"xy");function l0(){for(var o=[],i=0;i<arguments.length;i++)o=o.concat(td(arguments[i]));return o}l(l0,"iE");function f0(){for(var o=0,i=0,f=arguments.length;i<f;i++)o+=arguments[i].length;for(var g=Array(o),a=0,i=0;i<f;i++)for(var n=arguments[i],r=0,u=n.length;r<u;r++,a++)g[a]=n[r];return g}l(f0,"oE");function u0(o,i,f){if(f||arguments.length===2)for(var g=0,a=i.length,n;g<a;g++)(n||!(g in i))&&(n||(n=Array.prototype.slice.call(i,0,g)),n[g]=i[g]);return o.concat(n||Array.prototype.slice.call(i))}l(u0,"aE");function ka(o){return this instanceof ka?(this.v=o,this):new ka(o)}l(ka,"Ya");function c0(o,i,f){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g=f.apply(o,i||[]),a,n=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",r),a[Symbol.asyncIterator]=function(){return this},a;function r(w){return function(_){return Promise.resolve(_).then(w,m)}}function u(w,_){g[w]&&(a[w]=function(S){return new Promise(function(T,k){n.push([w,S,T,k])>1||p(w,S)})},_&&(a[w]=_(a[w])))}function p(w,_){try{c(g[w](_))}catch(S){y(n[0][3],S)}}function c(w){w.value instanceof ka?Promise.resolve(w.value.v).then(d,m):y(n[0][2],w)}function d(w){p("next",w)}function m(w){p("throw",w)}function y(w,_){w(_),n.shift(),n.length&&p(n[0][0],n[0][1])}}l(c0,"sE");function h0(o){var i,f;return i={},g("next"),g("throw",function(a){throw a}),g("return"),i[Symbol.iterator]=function(){return this},i;function g(a,n){i[a]=o[a]?function(r){return(f=!f)?{value:ka(o[a](r)),done:!1}:n?n(r):r}:n}}l(h0,"lE");function d0(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=o[Symbol.asyncIterator],f;return i?i.call(o):(o=typeof hf=="function"?hf(o):o[Symbol.iterator](),f={},g("next"),g("throw"),g("return"),f[Symbol.asyncIterator]=function(){return this},f);function g(n){f[n]=o[n]&&function(r){return new Promise(function(u,p){r=o[n](r),a(u,p,r.done,r.value)})}}function a(n,r,u,p){Promise.resolve(p).then(function(c){n({value:c,done:u})},r)}}l(d0,"fE");function p0(o,i){return Object.defineProperty?Object.defineProperty(o,"raw",{value:i}):o.raw=i,o}l(p0,"uE");function g0(o){if(o&&o.__esModule)return o;var i={};if(o!=null)for(var f=Tu(o),g=0;g<f.length;g++)f[g]!=="default"&&df(i,o,f[g]);return zx(i,o),i}l(g0,"cE");function y0(o){return o&&o.__esModule?o:{default:o}}l(y0,"hE");function m0(o,i,f,g){if(f==="a"&&!g)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?o!==i||!g:!i.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return f==="m"?g:f==="a"?g.call(o):g?g.value:i.get(o)}l(m0,"dE");function w0(o,i,f,g,a){if(g==="m")throw new TypeError("Private method is not writable");if(g==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?o!==i||!a:!i.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g==="a"?a.call(o,f):a?a.value=f:i.set(o,f),f}l(w0,"pE");function b0(o,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof o=="function"?i===o:o.has(i)}l(b0,"yE");function v0(o,i,f){if(i!=null){if(typeof i!="object"&&typeof i!="function")throw new TypeError("Object expected.");var g,a;if(f){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");g=i[Symbol.asyncDispose]}if(g===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");g=i[Symbol.dispose],f&&(a=g)}if(typeof g!="function")throw new TypeError("Object not disposable.");a&&(g=e(function(){try{a.call(this)}catch(n){return Promise.reject(n)}},"dispose")),o.stack.push({value:i,dispose:g,async:f})}else f&&o.stack.push({async:!0});return i}l(v0,"mE");function _0(o){function i(n){o.error=o.hasError?new Hx(n,o.error,"An error was suppressed during disposal."):n,o.hasError=!0}l(i,"t"),e(i,"fail");var f,g=0;function a(){for(;f=o.stack.pop();)try{if(!f.async&&g===1)return g=0,o.stack.push(f),Promise.resolve().then(a);if(f.dispose){var n=f.dispose.call(f.value);if(f.async)return g|=2,Promise.resolve(n).then(a,function(r){return i(r),a()})}else g|=1}catch(r){i(r)}if(g===1)return o.hasError?Promise.reject(o.error):Promise.resolve();if(o.hasError)throw o.error}return l(a,"a"),e(a,"next"),a()}l(_0,"gE");function E0(o,i){return typeof o=="string"&&/^\.\.?\//.test(o)?o.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(f,g,a,n,r){return g?i?".jsx":".js":a&&(!n||!r)?f:a+n+"."+r.toLowerCase()+"js"}):o}l(E0,"wE");var Ou,Tl,df,zx,Tu,Hx,qx,Gx=Xt(()=>{Ou=e(function(o,i){return Ou=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,g){f.__proto__=g}||function(f,g){for(var a in g)Object.prototype.hasOwnProperty.call(g,a)&&(f[a]=g[a])},Ou(o,i)},"extendStatics"),e(Ym,"__extends"),Tl=e(function(){return Tl=Object.assign||e(function(o){for(var i,f=1,g=arguments.length;f<g;f++){i=arguments[f];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(o[a]=i[a])}return o},"__assign"),Tl.apply(this,arguments)},"__assign"),e(Zm,"__rest"),e(Qm,"__decorate"),e(Xm,"__param"),e(e0,"__esDecorate"),e(t0,"__runInitializers"),e(r0,"__propKey"),e(n0,"__setFunctionName"),e(i0,"__metadata"),e(o0,"__awaiter"),e(a0,"__generator"),df=Object.create?function(o,i,f,g){g===void 0&&(g=f);var a=Object.getOwnPropertyDescriptor(i,f);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:e(function(){return i[f]},"get")}),Object.defineProperty(o,g,a)}:function(o,i,f,g){g===void 0&&(g=f),o[g]=i[f]},e(s0,"__exportStar"),e(hf,"__values"),e(td,"__read"),e(l0,"__spread"),e(f0,"__spreadArrays"),e(u0,"__spreadArray"),e(ka,"__await"),e(c0,"__asyncGenerator"),e(h0,"__asyncDelegator"),e(d0,"__asyncValues"),e(p0,"__makeTemplateObject"),zx=Object.create?function(o,i){Object.defineProperty(o,"default",{enumerable:!0,value:i})}:function(o,i){o.default=i},Tu=e(function(o){return Tu=Object.getOwnPropertyNames||function(i){var f=[];for(var g in i)Object.prototype.hasOwnProperty.call(i,g)&&(f[f.length]=g);return f},Tu(o)},"ownKeys"),e(g0,"__importStar"),e(y0,"__importDefault"),e(m0,"__classPrivateFieldGet"),e(w0,"__classPrivateFieldSet"),e(b0,"__classPrivateFieldIn"),e(v0,"__addDisposableResource"),Hx=typeof SuppressedError=="function"?SuppressedError:function(o,i,f){var g=new Error(f);return g.name="SuppressedError",g.error=o,g.suppressed=i,g},e(_0,"__disposeResources"),e(E0,"__rewriteRelativeImportExtension"),qx={__extends:Ym,__assign:Tl,__rest:Zm,__decorate:Qm,__param:Xm,__esDecorate:e0,__runInitializers:t0,__propKey:r0,__setFunctionName:n0,__metadata:i0,__awaiter:o0,__generator:a0,__createBinding:df,__exportStar:s0,__values:hf,__read:td,__spread:l0,__spreadArrays:f0,__spreadArray:u0,__await:ka,__asyncGenerator:c0,__asyncDelegator:h0,__asyncValues:d0,__makeTemplateObject:p0,__importStar:g0,__importDefault:y0,__classPrivateFieldGet:m0,__classPrivateFieldSet:w0,__classPrivateFieldIn:b0,__addDisposableResource:v0,__disposeResources:_0,__rewriteRelativeImportExtension:E0}}),rL=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0})}),Vx=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.flattenJSON=void 0;var i=Ba(),f=yf(),g=f.posix?f.posix.join:f.join,a=e(n=>{let r={};function u(p,c){for(let d in c){let m=c[d],y=g(p,d);typeof m=="string"||m instanceof i.Buffer?r[y]=m:typeof m=="object"&&m!==null&&!(m instanceof i.Buffer)&&Object.keys(m).length>0?u(y,m):r[y]=null}}return l(u,"r"),e(u,"flatten"),u("",n),r},"flattenJSON");o.flattenJSON=a}),Kx=Ge(o=>{"use strict";var g;Object.defineProperty(o,"__esModule",{value:!0}),o.FanOut=void 0;var i=(g=class{constructor(){this.listeners=new Set}emit(n){this.listeners.forEach(r=>r(n))}listen(n){let r=this.listeners;return r.add(n),()=>r.delete(n)}},l(g,"Cy"),g);e(i,"FanOut");var f=i;o.FanOut=f});function rd(o){throw new Error("Node.js process "+o+" is not supported by JSPM core outside of Node.js")}l(rd,"$y");function Jx(){!ya||!aa||(ya=!1,aa.length?Cn=aa.concat(Cn):Hl=-1,Cn.length&&AE())}l(Jx,"MU");function AE(){if(!ya){var o=setTimeout(Jx,0);ya=!0;for(var i=Cn.length;i;){for(aa=Cn,Cn=[];++Hl<i;)aa&&aa[Hl].run();Hl=-1,i=Cn.length}aa=null,ya=!1,clearTimeout(o)}}l(AE,"EE");function S0(o){var i=new Array(arguments.length-1);if(arguments.length>1)for(var f=1;f<arguments.length;f++)i[f-1]=arguments[f];Cn.push(new A0(o,i)),Cn.length===1&&!ya&&setTimeout(AE,0)}l(S0,"SE");function A0(o,i){this.fun=o,this.array=i}l(A0,"AE");function wr(){}l(wr,"Jt");function R0(o){rd("_linkedBinding")}l(R0,"HE");function k0(o){rd("dlopen")}l(k0,"VE");function O0(){return[]}l(O0,"GE");function T0(){return[]}l(T0,"YE");function F0(o,i){if(!o)throw new Error(i||"assertion error")}l(F0,"nS");function B0(){return!1}l(B0,"sS");function I0(){return ui.now()/1e3}l(I0,"AS");function Fl(o){var i=Math.floor((Date.now()-ui.now())*.001),f=ui.now()*.001,g=Math.floor(f)+i,a=Math.floor(f%1*1e9);return o&&(g=g-o[0],a=a-o[1],a<0&&(g--,a+=Fu)),[g,a]}l(Fl,"Vu");function Tn(){return Yx}l(Tn,"Xn");function x0(o){return[]}l(x0,"DS");var Cn,ya,aa,Hl,j0,C0,P0,L0,N0,D0,U0,M0,$0,W0,z0,H0,q0,G0,V0,K0,J0,Y0,Z0,Q0,X0,ew,Bl,tw,rw,nw,iw,ow,aw,sw,lw,fw,uw,cw,hw,dw,pw,gw,yw,mw,ww,bw,vw,_w,Ew,Sw,Aw,Rw,ui,dy,Fu,kw,Ow,Tw,Fw,Bw,Iw,xw,jw,Cw,Pw,Lw,Yx,nL=Xt(()=>{e(rd,"unimplemented"),Cn=[],ya=!1,Hl=-1,e(Jx,"cleanUpNextTick"),e(AE,"drainQueue"),e(S0,"nextTick"),e(A0,"Item"),A0.prototype.run=function(){this.fun.apply(null,this.array)},j0="browser",C0="x64",P0="browser",L0={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},N0=["/usr/bin/node"],D0=[],U0="v16.8.0",M0={},$0=e(function(o,i){console.warn((i?i+": ":"")+o)},"emitWarning"),W0=e(function(o){rd("binding")},"binding"),z0=e(function(o){return 0},"umask"),H0=e(function(){return"/"},"cwd"),q0=e(function(o){},"chdir"),G0={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},e(wr,"noop"),V0=!0,K0=wr,J0=[],e(R0,"_linkedBinding"),Y0={},Z0=!1,Q0={},e(k0,"dlopen"),e(O0,"_getActiveRequests"),e(T0,"_getActiveHandles"),X0=wr,ew=wr,Bl=e(function(){return{}},"cpuUsage"),tw=Bl,rw=Bl,nw=wr,iw=wr,ow=wr,aw={},e(F0,"assert"),sw={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},lw=wr,fw=wr,e(B0,"hasUncaughtExceptionCaptureCallback"),uw=wr,cw=wr,hw=wr,dw=wr,pw=wr,gw=void 0,yw=void 0,mw=void 0,ww=wr,bw=2,vw=1,_w="/bin/usr/node",Ew=9229,Sw="node",Aw=[],Rw=wr,ui={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},ui.now===void 0&&(dy=Date.now(),ui.timing&&ui.timing.navigationStart&&(dy=ui.timing.navigationStart),ui.now=()=>Date.now()-dy),e(I0,"uptime"),Fu=1e9,e(Fl,"hrtime"),Fl.bigint=function(o){var i=Fl(o);return typeof BigInt>"u"?i[0]*Fu+i[1]:BigInt(i[0]*Fu)+BigInt(i[1])},kw=10,Ow={},Tw=0,e(Tn,"on"),Fw=Tn,Bw=Tn,Iw=Tn,xw=Tn,jw=Tn,Cw=wr,Pw=Tn,Lw=Tn,e(x0,"listeners"),Yx={version:U0,versions:M0,arch:C0,platform:P0,browser:V0,release:G0,_rawDebug:K0,moduleLoadList:J0,binding:W0,_linkedBinding:R0,_events:Ow,_eventsCount:Tw,_maxListeners:kw,on:Tn,addListener:Fw,once:Bw,off:Iw,removeListener:xw,removeAllListeners:jw,emit:Cw,prependListener:Pw,prependOnceListener:Lw,listeners:x0,domain:Y0,_exiting:Z0,config:Q0,dlopen:k0,uptime:I0,_getActiveRequests:O0,_getActiveHandles:T0,reallyExit:X0,_kill:ew,cpuUsage:Bl,resourceUsage:tw,memoryUsage:rw,kill:nw,exit:iw,openStdin:ow,allowedNodeEnvironmentFlags:aw,assert:F0,features:sw,_fatalExceptions:lw,setUncaughtExceptionCaptureCallback:fw,hasUncaughtExceptionCaptureCallback:B0,emitWarning:$0,nextTick:S0,_tickCallback:uw,_debugProcess:cw,_debugEnd:hw,_startProfilerIdleNotifier:dw,_stopProfilerIdleNotifier:pw,stdout:gw,stdin:mw,stderr:yw,abort:ww,umask:z0,chdir:q0,cwd:H0,env:L0,title:j0,argv:N0,execArgv:D0,pid:bw,ppid:vw,execPath:_w,debugPort:Ew,hrtime:Fl,argv0:Sw,_preload_modules:Aw,setSourceMapsEnabled:Rw}}),Zx={};an(Zx,{_debugEnd:l(()=>hw,"_debugEnd"),_debugProcess:l(()=>cw,"_debugProcess"),_events:l(()=>Ow,"_events"),_eventsCount:l(()=>Tw,"_eventsCount"),_exiting:l(()=>Z0,"_exiting"),_fatalExceptions:l(()=>lw,"_fatalExceptions"),_getActiveHandles:l(()=>T0,"_getActiveHandles"),_getActiveRequests:l(()=>O0,"_getActiveRequests"),_kill:l(()=>ew,"_kill"),_linkedBinding:l(()=>R0,"_linkedBinding"),_maxListeners:l(()=>kw,"_maxListeners"),_preload_modules:l(()=>Aw,"_preload_modules"),_rawDebug:l(()=>K0,"_rawDebug"),_startProfilerIdleNotifier:l(()=>dw,"_startProfilerIdleNotifier"),_stopProfilerIdleNotifier:l(()=>pw,"_stopProfilerIdleNotifier"),_tickCallback:l(()=>uw,"_tickCallback"),abort:l(()=>ww,"abort"),addListener:l(()=>Fw,"addListener"),allowedNodeEnvironmentFlags:l(()=>aw,"allowedNodeEnvironmentFlags"),arch:l(()=>C0,"arch"),argv:l(()=>N0,"argv"),argv0:l(()=>Sw,"argv0"),assert:l(()=>F0,"assert"),binding:l(()=>W0,"binding"),browser:l(()=>V0,"browser"),chdir:l(()=>q0,"chdir"),config:l(()=>Q0,"config"),cpuUsage:l(()=>Bl,"cpuUsage"),cwd:l(()=>H0,"cwd"),debugPort:l(()=>Ew,"debugPort"),dlopen:l(()=>k0,"dlopen"),domain:l(()=>Y0,"domain"),emit:l(()=>Cw,"emit"),emitWarning:l(()=>$0,"emitWarning"),env:l(()=>L0,"env"),execArgv:l(()=>D0,"execArgv"),execPath:l(()=>_w,"execPath"),exit:l(()=>iw,"exit"),features:l(()=>sw,"features"),hasUncaughtExceptionCaptureCallback:l(()=>B0,"hasUncaughtExceptionCaptureCallback"),hrtime:l(()=>Fl,"hrtime"),kill:l(()=>nw,"kill"),listeners:l(()=>x0,"listeners"),memoryUsage:l(()=>rw,"memoryUsage"),moduleLoadList:l(()=>J0,"moduleLoadList"),nextTick:l(()=>S0,"nextTick"),off:l(()=>Iw,"off"),on:l(()=>Tn,"on"),once:l(()=>Bw,"once"),openStdin:l(()=>ow,"openStdin"),pid:l(()=>bw,"pid"),platform:l(()=>P0,"platform"),ppid:l(()=>vw,"ppid"),prependListener:l(()=>Pw,"prependListener"),prependOnceListener:l(()=>Lw,"prependOnceListener"),reallyExit:l(()=>X0,"reallyExit"),release:l(()=>G0,"release"),removeAllListeners:l(()=>jw,"removeAllListeners"),removeListener:l(()=>xw,"removeListener"),resourceUsage:l(()=>tw,"resourceUsage"),setSourceMapsEnabled:l(()=>Rw,"setSourceMapsEnabled"),setUncaughtExceptionCaptureCallback:l(()=>fw,"setUncaughtExceptionCaptureCallback"),stderr:l(()=>yw,"stderr"),stdin:l(()=>mw,"stdin"),stdout:l(()=>gw,"stdout"),title:l(()=>j0,"title"),umask:l(()=>z0,"umask"),uptime:l(()=>I0,"uptime"),version:l(()=>U0,"version"),versions:l(()=>M0,"versions")});var iL=Xt(()=>{nL()}),RE=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.createProcess=f;var i=e(()=>{if(typeof process<"u")return process;try{return iL(),hr(Zx)}catch{return}},"maybeReturnProcess");function f(){let g=i()||{};return g.cwd||(g.cwd=()=>"/"),g.emitWarning||(g.emitWarning=(a,n)=>{console.warn(`${n}${n?": ":""}${a}`)}),g.env||(g.env={}),g}l(f,"US"),e(f,"createProcess"),o.default=f()}),Qx=Ge(o=>{"use strict";var _;Object.defineProperty(o,"__esModule",{value:!0}),o.Node=void 0;var i=Kx(),f=RE(),g=Ba(),a=$n(),{S_IFMT:n,S_IFDIR:r,S_IFREG:u,S_IFLNK:p,S_IFCHR:c}=a.constants,d=e(()=>f.default.getuid?.()??0,"getuid"),m=e(()=>f.default.getgid?.()??0,"getgid"),y=(_=class{constructor(T,k=438){this.changes=new i.FanOut,this._uid=d(),this._gid=m(),this._atime=new Date,this._mtime=new Date,this._ctime=new Date,this.rdev=0,this._nlink=1,this.mode=k,this.ino=T}set ctime(T){this._ctime=T}get ctime(){return this._ctime}set uid(T){this._uid=T,this.ctime=new Date}get uid(){return this._uid}set gid(T){this._gid=T,this.ctime=new Date}get gid(){return this._gid}set atime(T){this._atime=T}get atime(){return this._atime}set mtime(T){this._mtime=T,this.ctime=new Date}get mtime(){return this._mtime}get perm(){return this.mode&~n}set perm(T){this.mode=this.mode&n|T&~n,this.ctime=new Date}set nlink(T){this._nlink=T,this.ctime=new Date}get nlink(){return this._nlink}getString(T="utf8"){return this.atime=new Date,this.getBuffer().toString(T)}setString(T){this.buf=(0,g.bufferFrom)(T,"utf8"),this.touch()}getBuffer(){return this.atime=new Date,this.buf||(this.buf=(0,g.bufferAllocUnsafe)(0)),(0,g.bufferFrom)(this.buf)}setBuffer(T){this.buf=(0,g.bufferFrom)(T),this.touch()}getSize(){return this.buf?this.buf.length:0}setModeProperty(T){this.mode=T}isFile(){return(this.mode&n)===u}isDirectory(){return(this.mode&n)===r}isSymlink(){return(this.mode&n)===p}isCharacterDevice(){return(this.mode&n)===c}makeSymlink(T){this.mode=p|438,this.symlink=T}write(T,k=0,E=T.length,j=0){if(this.buf||(this.buf=(0,g.bufferAllocUnsafe)(0)),j+E>this.buf.length){let A=(0,g.bufferAllocUnsafe)(j+E);this.buf.copy(A,0,0,this.buf.length),this.buf=A}return T.copy(this.buf,j,k,k+E),this.touch(),E}read(T,k=0,E=T.byteLength,j=0){if(this.atime=new Date,this.buf||(this.buf=(0,g.bufferAllocUnsafe)(0)),j>=this.buf.length)return 0;let A=E;A>T.byteLength&&(A=T.byteLength),A+j>this.buf.length&&(A=this.buf.length-j);let I=T instanceof g.Buffer?T:g.Buffer.from(T.buffer,T.byteOffset,T.byteLength);return this.buf.copy(I,k,j,j+A),A}truncate(T=0){if(!T)this.buf=(0,g.bufferAllocUnsafe)(0);else if(this.buf||(this.buf=(0,g.bufferAllocUnsafe)(0)),T<=this.buf.length)this.buf=this.buf.slice(0,T);else{let k=(0,g.bufferAllocUnsafe)(T);this.buf.copy(k),k.fill(0,this.buf.length),this.buf=k}this.touch()}chmod(T){this.mode=this.mode&n|T&~n,this.touch()}chown(T,k){this.uid=T,this.gid=k,this.touch()}touch(){this.mtime=new Date,this.changes.emit(["modify"])}canRead(T=d(),k=m()){return!!(this.perm&4||k===this.gid&&this.perm&32||T===this.uid&&this.perm&256)}canWrite(T=d(),k=m()){return!!(this.perm&2||k===this.gid&&this.perm&16||T===this.uid&&this.perm&128)}canExecute(T=d(),k=m()){return!!(this.perm&1||k===this.gid&&this.perm&8||T===this.uid&&this.perm&64)}del(){this.changes.emit(["delete"])}toJSON(){return{ino:this.ino,uid:this.uid,gid:this.gid,atime:this.atime.getTime(),mtime:this.mtime.getTime(),ctime:this.ctime.getTime(),perm:this.perm,mode:this.mode,nlink:this.nlink,symlink:this.symlink,data:this.getString()}}},l(_,"Uy"),_);e(y,"Node");var w=y;o.Node=w}),Xx=Ge(o=>{"use strict";var r;Object.defineProperty(o,"__esModule",{value:!0}),o.Link=void 0;var i=$n(),f=Kx(),{S_IFREG:g}=i.constants,a=(r=class{get steps(){return this._steps}set steps(p){this._steps=p;for(let[c,d]of this.children.entries())c==="."||c===".."||d?.syncSteps()}constructor(p,c,d){this.changes=new f.FanOut,this.children=new Map,this._steps=[],this.ino=0,this.length=0,this.vol=p,this.parent=c,this.name=d,this.syncSteps()}setNode(p){this.node=p,this.ino=p.ino}getNode(){return this.node}createChild(p,c=this.vol.createNode(g|438)){let d=new r(this.vol,this,p);return d.setNode(c),c.isDirectory()&&(d.children.set(".",d),d.getNode().nlink++),this.setChild(p,d),d}setChild(p,c=new r(this.vol,this,p)){return this.children.set(p,c),c.parent=this,this.length++,c.getNode().isDirectory()&&(c.children.set("..",this),this.getNode().nlink++),this.getNode().mtime=new Date,this.changes.emit(["child:add",c,this]),c}deleteChild(p){p.getNode().isDirectory()&&(p.children.delete(".."),this.getNode().nlink--),this.children.delete(p.getName()),this.length--,this.getNode().mtime=new Date,this.changes.emit(["child:del",p,this])}getChild(p){return this.getNode().atime=new Date,this.children.get(p)}getPath(){return this.steps.join("/")}getParentPath(){return this.steps.slice(0,-1).join("/")}getName(){return this.steps[this.steps.length-1]}toJSON(){return{steps:this.steps,ino:this.ino,children:Array.from(this.children.keys())}}syncSteps(){this.steps=this.parent?this.parent.steps.concat([this.name]):[this.name]}},l(r,"$l"),r);e(a,"Link");var n=a;o.Link=n}),e6=Ge(o=>{"use strict";var n;Object.defineProperty(o,"__esModule",{value:!0}),o.File=void 0;var i=$n(),{O_APPEND:f}=i.constants,g=(n=class{constructor(u,p,c,d){this.link=u,this.node=p,this.flags=c,this.fd=d,this.position=0,this.flags&f&&(this.position=this.getSize())}getString(u="utf8"){return this.node.getString()}setString(u){this.node.setString(u)}getBuffer(){return this.node.getBuffer()}setBuffer(u){this.node.setBuffer(u)}getSize(){return this.node.getSize()}truncate(u){this.node.truncate(u)}seekTo(u){this.position=u}write(u,p=0,c=u.length,d){typeof d!="number"&&(d=this.position);let m=this.node.write(u,p,c,d);return this.position=d+m,m}read(u,p=0,c=u.byteLength,d){typeof d!="number"&&(d=this.position);let m=this.node.read(u,p,c,d);return this.position=d+m,m}chmod(u){this.node.chmod(u)}chown(u,p){this.node.chown(u,p)}},l(n,"zy"),n);e(g,"File");var a=g;o.File=a}),mf=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.FLAGS=o.ERRSTR=void 0;var i=$n();o.ERRSTR={PATH_STR:"path must be a string, Buffer, or Uint8Array",FD:"fd must be a file descriptor",MODE_INT:"mode must be an int",CB:"callback must be a function",UID:"uid must be an unsigned int",GID:"gid must be an unsigned int",LEN:"len must be an integer",ATIME:"atime must be an integer",MTIME:"mtime must be an integer",PREFIX:"filename prefix is required",BUFFER:"buffer must be an instance of Buffer or StaticBuffer",OFFSET:"offset must be an integer",LENGTH:"length must be an integer",POSITION:"position must be an integer"};var{O_RDONLY:f,O_WRONLY:g,O_RDWR:a,O_CREAT:n,O_EXCL:r,O_TRUNC:u,O_APPEND:p,O_SYNC:c}=i.constants,d;(function(m){m[m.r=f]="r",m[m["r+"]=a]="r+",m[m.rs=f|c]="rs",m[m.sr=m.rs]="sr",m[m["rs+"]=a|c]="rs+",m[m["sr+"]=m["rs+"]]="sr+",m[m.w=g|n|u]="w",m[m.wx=g|n|u|r]="wx",m[m.xw=m.wx]="xw",m[m["w+"]=a|n|u]="w+",m[m["wx+"]=a|n|u|r]="wx+",m[m["xw+"]=m["wx+"]]="xw+",m[m.a=g|p|n]="a",m[m.ax=g|p|n|r]="ax",m[m.xa=m.ax]="xa",m[m["a+"]=a|p|n]="a+",m[m["ax+"]=a|p|n|r]="ax+",m[m["xa+"]=m["ax+"]]="xa+"})(d||(o.FLAGS=d={}))}),t6=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=typeof queueMicrotask=="function"?queueMicrotask:i=>Promise.resolve().then(()=>i()).catch(()=>{})}),kE=Ge(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.filenameToSteps=o.resolve=o.unixify=o.isWin=void 0,o.isFd=_,o.validateFd=S,o.dataToBuffer=T;var i=yf(),f=Ba(),g=RE(),a=_d(),n=mf();o.isWin=g.default.platform==="win32";var r=i.resolve,u=i.posix?i.posix.sep:i.sep,p=e((k,E)=>{let j=k[E];return E>0&&(j==="/"||o.isWin&&j==="\\")},"isSeparator"),c=e(k=>{let E=k.length-1;if(E<2)return k;for(;p(k,E);)E--;return k.substr(0,E+1)},"removeTrailingSeparator"),d=e((k,E)=>{if(typeof k!="string")throw new TypeError("expected a string");return k=k.replace(/[\\\/]+/g,"/"),E!==!1&&(k=c(k)),k},"normalizePath"),m=e((k,E=!0)=>o.isWin?(k=d(k,E),k.replace(/^([a-zA-Z]+:|\.\/)/,"")):k,"unixify");o.unixify=m;var y=e((k,E=g.default.cwd())=>r(E,k),"resolve");if(o.resolve=y,o.isWin){let k=y;o.resolve=y=e((E,j)=>(0,o.unixify)(k(E,j)),"resolve")}var w=e((k,E)=>{let j=y(k,E).substring(1);return j?j.split(u):[]},"filenameToSteps");o.filenameToSteps=w;function _(k){return k>>>0===k}l(_,"GS"),e(_,"isFd");function S(k){if(!_(k))throw TypeError(n.ERRSTR.FD)}l(S,"l3"),e(S,"validateFd");function T(k,E=a.ENCODING_UTF8){return f.Buffer.isBuffer(k)?k:k instanceof Uint8Array?(0,f.bufferFrom)(k):E==="buffer"?(0,f.bufferFrom)(String(k),"utf8"):(0,f.bufferFrom)(String(k),E)}l(T,"f3"),e(T,"dataToBuffer")});function ck(){if(Mw)return Bu;Mw=!0;let o=2147483647,i=36,f=1,g=26,a=38,n=700,r=72,u=128,p="-",c=/^xn--/,d=/[^\0-\x7F]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=i-f,_=Math.floor,S=String.fromCharCode;function T(q){throw new RangeError(y[q])}l(T,"b"),e(T,"error");function k(q,G){let re=[],ae=q.length;for(;ae--;)re[ae]=G(q[ae]);return re}l(k,"E"),e(k,"map");function E(q,G){let re=q.split("@"),ae="";re.length>1&&(ae=re[0]+"@",q=re[1]),q=q.replace(m,".");let de=q.split("."),we=k(de,G).join(".");return ae+we}l(E,"R"),e(E,"mapDomain");function j(q){let G=[],re=0,ae=q.length;for(;re<ae;){let de=q.charCodeAt(re++);if(de>=55296&&de<=56319&&re<ae){let we=q.charCodeAt(re++);(we&64512)==56320?G.push(((de&1023)<<10)+(we&1023)+65536):(G.push(de),re--)}else G.push(de)}return G}l(j,"T"),e(j,"ucs2decode");let A=e(q=>String.fromCodePoint(...q),"ucs2encode"),I=e(function(q){return q>=48&&q<58?26+(q-48):q>=65&&q<91?q-65:q>=97&&q<123?q-97:i},"basicToDigit"),U=e(function(q,G){return q+22+75*(q<26)-((G!=0)<<5)},"digitToBasic"),M=e(function(q,G,re){let ae=0;for(q=re?_(q/n):q>>1,q+=_(q/G);q>w*g>>1;ae+=i)q=_(q/w);return _(ae+(w+1)*q/(q+a))},"adapt"),ee=e(function(q){let G=[],re=q.length,ae=0,de=u,we=r,Ie=q.lastIndexOf(p);Ie<0&&(Ie=0);for(let je=0;je<Ie;++je)q.charCodeAt(je)>=128&&T("not-basic"),G.push(q.charCodeAt(je));for(let je=Ie>0?Ie+1:0;je<re;){let se=ae;for(let J=1,ue=i;;ue+=i){je>=re&&T("invalid-input");let te=I(q.charCodeAt(je++));te>=i&&T("invalid-input"),te>_((o-ae)/J)&&T("overflow"),ae+=te*J;let X=ue<=we?f:ue>=we+g?g:ue-we;if(te<X)break;let ye=i-X;J>_(o/ye)&&T("overflow"),J*=ye}let Te=G.length+1;we=M(ae-se,Te,se==0),_(ae/Te)>o-de&&T("overflow"),de+=_(ae/Te),ae%=Te,G.splice(ae++,0,de)}return String.fromCodePoint(...G)},"decode2"),V=e(function(q){let G=[];q=j(q);let re=q.length,ae=u,de=0,we=r;for(let se of q)se<128&&G.push(S(se));let Ie=G.length,je=Ie;for(Ie&&G.push(p);je<re;){let se=o;for(let J of q)J>=ae&&J<se&&(se=J);let Te=je+1;se-ae>_((o-de)/Te)&&T("overflow"),de+=(se-ae)*Te,ae=se;for(let J of q)if(J<ae&&++de>o&&T("overflow"),J===ae){let ue=de;for(let te=i;;te+=i){let X=te<=we?f:te>=we+g?g:te-we;if(ue<X)break;let ye=ue-X,Re=i-X;G.push(S(U(X+ye%Re,0))),ue=_(ye/Re)}G.push(S(U(ue,0))),we=M(de,Te,je===Ie),de=0,++je}++de,++ae}return G.join("")},"encode2");return Bu={version:"2.3.1",ucs2:{decode:j,encode:A},decode:ee,encode:V,toASCII:e(function(q){return E(q,function(G){return d.test(G)?"xn--"+V(G):G})},"toASCII2"),toUnicode:e(function(q){return E(q,function(G){return c.test(G)?ee(G.slice(4).toLowerCase()):G})},"toUnicode2")},Bu}l(ck,"u3");function r6(){return Ww||(Ww=!0,$w=e(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var o={},i=Symbol("test"),f=Object(i);if(typeof i=="string"||Object.prototype.toString.call(i)!=="[object Symbol]"||Object.prototype.toString.call(f)!=="[object Symbol]")return!1;var g=42;o[i]=g;for(i in o)return!1;if(typeof Object.keys=="function"&&Object.keys(o).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(o).length!==0)return!1;var a=Object.getOwnPropertySymbols(o);if(a.length!==1||a[0]!==i||!Object.prototype.propertyIsEnumerable.call(o,i))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var n=Object.getOwnPropertyDescriptor(o,i);if(n.value!==g||n.enumerable!==!0)return!1}return!0},"hasSymbols")),$w}l(r6,"c3");function n6(){return Hw||(Hw=!0,zw=Error),zw}l(n6,"h3");function i6(){return Gw||(Gw=!0,qw=EvalError),qw}l(i6,"d3");function o6(){return Kw||(Kw=!0,Vw=RangeError),Vw}l(o6,"p3");function a6(){return Yw||(Yw=!0,Jw=ReferenceError),Jw}l(a6,"y3");function OE(){return Qw||(Qw=!0,Zw=SyntaxError),Zw}l(OE,"TA");function Ys(){return eb||(eb=!0,Xw=TypeError),Xw}l(Ys,"Ul");function s6(){return rb||(rb=!0,tb=URIError),tb}l(s6,"m3");function l6(){if(nb)return Iu;nb=!0;var o=typeof Symbol<"u"&&Symbol,i=r6();return Iu=e(function(){return typeof o!="function"||typeof Symbol!="function"||typeof o("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:i()},"hasNativeSymbols"),Iu}l(l6,"g3");function f6(){if(ib)return xu;ib=!0;var o={__proto__:null,foo:{}},i=Object;return xu=e(function(){return{__proto__:o}.foo===o.foo&&!(o instanceof i)},"hasProto"),xu}l(f6,"w3");function u6(){if(ob)return ju;ob=!0;var o="Function.prototype.bind called on incompatible ",i=Object.prototype.toString,f=Math.max,g="[object Function]",a=e(function(u,p){for(var c=[],d=0;d<u.length;d+=1)c[d]=u[d];for(var m=0;m<p.length;m+=1)c[m+u.length]=p[m];return c},"concatty2"),n=e(function(u,p){for(var c=[],d=p,m=0;d<u.length;d+=1,m+=1)c[m]=u[d];return c},"slicy2"),r=e(function(u,p){for(var c="",d=0;d<u.length;d+=1)c+=u[d],d+1<u.length&&(c+=p);return c},"joiny");return ju=e(function(u){var p=this;if(typeof p!="function"||i.apply(p)!==g)throw new TypeError(o+p);for(var c=n(arguments,1),d,m=e(function(){if(this instanceof d){var T=p.apply(this,a(c,arguments));return Object(T)===T?T:this}return p.apply(u,a(c,arguments))},"binder"),y=f(0,p.length-c.length),w=[],_=0;_<y;_++)w[_]="$"+_;if(d=Function("binder","return function ("+r(w,",")+"){ return binder.apply(this,arguments); }")(m),p.prototype){var S=e(function(){},"Empty2");S.prototype=p.prototype,d.prototype=new S,S.prototype=null}return d},"bind"),ju}l(u6,"v3");function Ed(){if(ab)return Cu;ab=!0;var o=u6();return Cu=Function.prototype.bind||o,Cu}l(Ed,"Om");function c6(){if(sb)return Pu;sb=!0;var o=Function.prototype.call,i=Object.prototype.hasOwnProperty,f=Ed();return Pu=f.call(o,i),Pu}l(c6,"b3");function Ia(){if(lb)return Lu;lb=!0;var o,i=n6(),f=i6(),g=o6(),a=a6(),n=OE(),r=Ys(),u=s6(),p=Function,c=e(function(je){try{return p('"use strict"; return ('+je+").constructor;")()}catch{}},"getEvalledConstructor"),d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch{d=null}var m=e(function(){throw new r},"throwTypeError"),y=d?function(){try{return arguments.callee,m}catch{try{return d(arguments,"callee").get}catch{return m}}}():m,w=l6()(),_=f6()(),S=Object.getPrototypeOf||(_?function(je){return je.__proto__}:null),T={},k=typeof Uint8Array>"u"||!S?o:S(Uint8Array),E={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?o:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?o:ArrayBuffer,"%ArrayIteratorPrototype%":w&&S?S([][Symbol.iterator]()):o,"%AsyncFromSyncIteratorPrototype%":o,"%AsyncFunction%":T,"%AsyncGenerator%":T,"%AsyncGeneratorFunction%":T,"%AsyncIteratorPrototype%":T,"%Atomics%":typeof Atomics>"u"?o:Atomics,"%BigInt%":typeof BigInt>"u"?o:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?o:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?o:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?o:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":f,"%Float32Array%":typeof Float32Array>"u"?o:Float32Array,"%Float64Array%":typeof Float64Array>"u"?o:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?o:FinalizationRegistry,"%Function%":p,"%GeneratorFunction%":T,"%Int8Array%":typeof Int8Array>"u"?o:Int8Array,"%Int16Array%":typeof Int16Array>"u"?o:Int16Array,"%Int32Array%":typeof Int32Array>"u"?o:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&S?S(S([][Symbol.iterator]())):o,"%JSON%":typeof JSON=="object"?JSON:o,"%Map%":typeof Map>"u"?o:Map,"%MapIteratorPrototype%":typeof Map>"u"||!w||!S?o:S(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?o:Promise,"%Proxy%":typeof Proxy>"u"?o:Proxy,"%RangeError%":g,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?o:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?o:Set,"%SetIteratorPrototype%":typeof Set>"u"||!w||!S?o:S(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?o:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&S?S(""[Symbol.iterator]()):o,"%Symbol%":w?Symbol:o,"%SyntaxError%":n,"%ThrowTypeError%":y,"%TypedArray%":k,"%TypeError%":r,"%Uint8Array%":typeof Uint8Array>"u"?o:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?o:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?o:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?o:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>"u"?o:WeakMap,"%WeakRef%":typeof WeakRef>"u"?o:WeakRef,"%WeakSet%":typeof WeakSet>"u"?o:WeakSet};if(S)try{null.error}catch(je){var j=S(S(je));E["%Error.prototype%"]=j}var A=e(l(function je(se){var Te;if(se==="%AsyncFunction%")Te=c("async function () {}");else if(se==="%GeneratorFunction%")Te=c("function* () {}");else if(se==="%AsyncGeneratorFunction%")Te=c("async function* () {}");else if(se==="%AsyncGenerator%"){var J=je("%AsyncGeneratorFunction%");J&&(Te=J.prototype)}else if(se==="%AsyncIteratorPrototype%"){var ue=je("%AsyncGenerator%");ue&&S&&(Te=S(ue.prototype))}return E[se]=Te,Te},"pe"),"doEval2"),I={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},U=Ed(),M=c6(),ee=U.call(Function.call,Array.prototype.concat),V=U.call(Function.apply,Array.prototype.splice),q=U.call(Function.call,String.prototype.replace),G=U.call(Function.call,String.prototype.slice),re=U.call(Function.call,RegExp.prototype.exec),ae=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,de=/\\(\\)?/g,we=e(function(je){var se=G(je,0,1),Te=G(je,-1);if(se==="%"&&Te!=="%")throw new n("invalid intrinsic syntax, expected closing `%`");if(Te==="%"&&se!=="%")throw new n("invalid intrinsic syntax, expected opening `%`");var J=[];return q(je,ae,function(ue,te,X,ye){J[J.length]=X?q(ye,de,"$1"):te||ue}),J},"stringToPath2"),Ie=e(function(je,se){var Te=je,J;if(M(I,Te)&&(J=I[Te],Te="%"+J[0]+"%"),M(E,Te)){var ue=E[Te];if(ue===T&&(ue=A(Te)),typeof ue>"u"&&!se)throw new r("intrinsic "+je+" exists, but is not available. Please file an issue!");return{alias:J,name:Te,value:ue}}throw new n("intrinsic "+je+" does not exist!")},"getBaseIntrinsic2");return Lu=e(function(je,se){if(typeof je!="string"||je.length===0)throw new r("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof se!="boolean")throw new r('"allowMissing" argument must be a boolean');if(re(/^%?[^%]*%?$/,je)===null)throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Te=we(je),J=Te.length>0?Te[0]:"",ue=Ie("%"+J+"%",se),te=ue.name,X=ue.value,ye=!1,Re=ue.alias;Re&&(J=Re[0],V(Te,ee([0,1],Re)));for(var De=1,Y=!0;De<Te.length;De+=1){var H=Te[De],Q=G(H,0,1),fe=G(H,-1);if((Q==='"'||Q==="'"||Q==="`"||fe==='"'||fe==="'"||fe==="`")&&Q!==fe)throw new n("property names with quotes must have matching quotes");if((H==="constructor"||!Y)&&(ye=!0),J+="."+H,te="%"+J+"%",M(E,te))X=E[te];else if(X!=null){if(!(H in X)){if(!se)throw new r("base intrinsic for "+je+" exists, but the property is not available.");return}if(d&&De+1>=Te.length){var ve=d(X,H);Y=!!ve,Y&&"get"in ve&&!("originalValue"in ve.get)?X=ve.get:X=X[H]}else Y=M(X,H),X=X[H];Y&&!ye&&(E[te]=X)}}return X},"GetIntrinsic"),Lu}l(Ia,"es");function Sd(){if(fb)return Nu;fb=!0;var o=Ia(),i=o("%Object.defineProperty%",!0)||!1;if(i)try{i({},"a",{value:1})}catch{i=!1}return Nu=i,Nu}l(Sd,"Im");function TE(){if(ub)return Du;ub=!0;var o=Ia(),i=o("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch{i=null}return Du=i,Du}l(TE,"FA");function h6(){if(cb)return Uu;cb=!0;var o=Sd(),i=OE(),f=Ys(),g=TE();return Uu=e(function(a,n,r){if(!a||typeof a!="object"&&typeof a!="function")throw new f("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new f("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new f("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new f("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new f("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new f("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,p=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,m=!!g&&g(a,n);if(o)o(a,n,{configurable:c===null&&m?m.configurable:!c,enumerable:u===null&&m?m.enumerable:!u,value:r,writable:p===null&&m?m.writable:!p});else if(d||!u&&!p&&!c)a[n]=r;else throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty"),Uu}l(h6,"_3");function d6(){if(hb)return Mu;hb=!0;var o=Sd(),i=e(function(){return!!o},"hasPropertyDescriptors2");return i.hasArrayLengthDefineBug=e(function(){if(!o)return null;try{return o([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug"),Mu=i,Mu}l(d6,"E3");function p6(){if(db)return $u;db=!0;var o=Ia(),i=h6(),f=d6()(),g=TE(),a=Ys(),n=o("%Math.floor%");return $u=e(function(r,u){if(typeof r!="function")throw new a("`fn` is not a function");if(typeof u!="number"||u<0||u>4294967295||n(u)!==u)throw new a("`length` must be a positive 32-bit integer");var p=arguments.length>2&&!!arguments[2],c=!0,d=!0;if("length"in r&&g){var m=g(r,"length");m&&!m.configurable&&(c=!1),m&&!m.writable&&(d=!1)}return(c||d||!p)&&(f?i(r,"length",u,!0,!0):i(r,"length",u)),r},"setFunctionLength"),$u}l(p6,"S3");function g6(){if(pb)return vs;pb=!0;var o=Ed(),i=Ia(),f=p6(),g=Ys(),a=i("%Function.prototype.apply%"),n=i("%Function.prototype.call%"),r=i("%Reflect.apply%",!0)||o.call(n,a),u=Sd(),p=i("%Math.max%");vs=e(function(d){if(typeof d!="function")throw new g("a function is required");var m=r(o,n,arguments);return f(m,1+p(0,d.length-(arguments.length-1)),!0)},"callBind");var c=e(function(){return r(o,a,arguments)},"applyBind2");return u?u(vs,"apply",{value:c}):vs.apply=c,vs}l(g6,"A3");function y6(){if(gb)return Wu;gb=!0;var o=Ia(),i=g6(),f=i(o("String.prototype.indexOf"));return Wu=e(function(g,a){var n=o(g,!!a);return typeof n=="function"&&f(g,".prototype.")>-1?i(n):n},"callBoundIntrinsic"),Wu}l(y6,"R3");function nd(o){throw new Error("Node.js process "+o+" is not supported by JSPM core outside of Node.js")}l(nd,"Pm");function m6(){!ma||!sa||(ma=!1,sa.length?Pn=sa.concat(Pn):ql=-1,Pn.length&&FE())}l(m6,"T3");function FE(){if(!ma){var o=setTimeout(m6,0);ma=!0;for(var i=Pn.length;i;){for(sa=Pn,Pn=[];++ql<i;)sa&&sa[ql].run();ql=-1,i=Pn.length}sa=null,ma=!1,clearTimeout(o)}}l(FE,"xA");function hk(o){var i=new Array(arguments.length-1);if(arguments.length>1)for(var f=1;f<arguments.length;f++)i[f-1]=arguments[f];Pn.push(new Nw(o,i)),Pn.length===1&&!ma&&setTimeout(FE,0)}l(hk,"F3");function Nw(o,i){this.fun=o,this.array=i}l(Nw,"OA");function br(){}l(br,"Zt");function dk(o){nd("_linkedBinding")}l(dk,"q3");function pk(o){nd("dlopen")}l(pk,"Y3");function gk(){return[]}l(gk,"K3");function yk(){return[]}l(yk,"X3");function mk(o,i){if(!o)throw new Error(i||"assertion error")}l(mk,"oj");function wk(){return!1}l(wk,"fj");function bk(){return ci.now()/1e3}l(bk,"Tj");function tu(o){var i=Math.floor((Date.now()-ci.now())*.001),f=ci.now()*.001,g=Math.floor(f)+i,a=Math.floor(f%1*1e9);return o&&(g=g-o[0],a=a-o[1],a<0&&(g--,a+=zu)),[g,a]}l(tu,"Fm");function Qn(){return IE}l(Qn,"Wi");function vk(o){return[]}l(vk,"$j");function _k(){if(yb)return Hu;yb=!0;var o=IE;function i(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}l(i,"t"),e(i,"assertPath");function f(n,r){for(var u="",p=0,c=-1,d=0,m,y=0;y<=n.length;++y){if(y<n.length)m=n.charCodeAt(y);else{if(m===47)break;m=47}if(m===47){if(!(c===y-1||d===1))if(c!==y-1&&d===2){if(u.length<2||p!==2||u.charCodeAt(u.length-1)!==46||u.charCodeAt(u.length-2)!==46){if(u.length>2){var w=u.lastIndexOf("/");if(w!==u.length-1){w===-1?(u="",p=0):(u=u.slice(0,w),p=u.length-1-u.lastIndexOf("/")),c=y,d=0;continue}}else if(u.length===2||u.length===1){u="",p=0,c=y,d=0;continue}}r&&(u.length>0?u+="/..":u="..",p=2)}else u.length>0?u+="/"+n.slice(c+1,y):u=n.slice(c+1,y),p=y-c-1;c=y,d=0}else m===46&&d!==-1?++d:d=-1}return u}l(f,"r"),e(f,"normalizeStringPosix");function g(n,r){var u=r.dir||r.root,p=r.base||(r.name||"")+(r.ext||"");return u?u===r.root?u+p:u+n+p:p}l(g,"n"),e(g,"_format");var a={resolve:e(function(){for(var n="",r=!1,u,p=arguments.length-1;p>=-1&&!r;p--){var c;p>=0?c=arguments[p]:(u===void 0&&(u=o.cwd()),c=u),i(c),c.length!==0&&(n=c+"/"+n,r=c.charCodeAt(0)===47)}return n=f(n,!r),r?n.length>0?"/"+n:"/":n.length>0?n:"."},"resolve2"),normalize:e(function(n){if(i(n),n.length===0)return".";var r=n.charCodeAt(0)===47,u=n.charCodeAt(n.length-1)===47;return n=f(n,!r),n.length===0&&!r&&(n="."),n.length>0&&u&&(n+="/"),r?"/"+n:n},"normalize"),isAbsolute:e(function(n){return i(n),n.length>0&&n.charCodeAt(0)===47},"isAbsolute"),join:e(function(){if(arguments.length===0)return".";for(var n,r=0;r<arguments.length;++r){var u=arguments[r];i(u),u.length>0&&(n===void 0?n=u:n+="/"+u)}return n===void 0?".":a.normalize(n)},"join"),relative:e(function(n,r){if(i(n),i(r),n===r||(n=a.resolve(n),r=a.resolve(r),n===r))return"";for(var u=1;u<n.length&&n.charCodeAt(u)===47;++u);for(var p=n.length,c=p-u,d=1;d<r.length&&r.charCodeAt(d)===47;++d);for(var m=r.length,y=m-d,w=c<y?c:y,_=-1,S=0;S<=w;++S){if(S===w){if(y>w){if(r.charCodeAt(d+S)===47)return r.slice(d+S+1);if(S===0)return r.slice(d+S)}else c>w&&(n.charCodeAt(u+S)===47?_=S:S===0&&(_=0));break}var T=n.charCodeAt(u+S),k=r.charCodeAt(d+S);if(T!==k)break;T===47&&(_=S)}var E="";for(S=u+_+1;S<=p;++S)(S===p||n.charCodeAt(S)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+r.slice(d+_):(d+=_,r.charCodeAt(d)===47&&++d,r.slice(d))},"relative"),_makeLong:e(function(n){return n},"_makeLong"),dirname:e(function(n){if(i(n),n.length===0)return".";for(var r=n.charCodeAt(0),u=r===47,p=-1,c=!0,d=n.length-1;d>=1;--d)if(r=n.charCodeAt(d),r===47){if(!c){p=d;break}}else c=!1;return p===-1?u?"/":".":u&&p===1?"//":n.slice(0,p)},"dirname"),basename:e(function(n,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');i(n);var u=0,p=-1,c=!0,d;if(r!==void 0&&r.length>0&&r.length<=n.length){if(r.length===n.length&&r===n)return"";var m=r.length-1,y=-1;for(d=n.length-1;d>=0;--d){var w=n.charCodeAt(d);if(w===47){if(!c){u=d+1;break}}else y===-1&&(c=!1,y=d+1),m>=0&&(w===r.charCodeAt(m)?--m===-1&&(p=d):(m=-1,p=y))}return u===p?p=y:p===-1&&(p=n.length),n.slice(u,p)}else{for(d=n.length-1;d>=0;--d)if(n.charCodeAt(d)===47){if(!c){u=d+1;break}}else p===-1&&(c=!1,p=d+1);return p===-1?"":n.slice(u,p)}},"basename"),extname:e(function(n){i(n);for(var r=-1,u=0,p=-1,c=!0,d=0,m=n.length-1;m>=0;--m){var y=n.charCodeAt(m);if(y===47){if(!c){u=m+1;break}continue}p===-1&&(c=!1,p=m+1),y===46?r===-1?r=m:d!==1&&(d=1):r!==-1&&(d=-1)}return r===-1||p===-1||d===0||d===1&&r===p-1&&r===u+1?"":n.slice(r,p)},"extname"),format:e(function(n){if(n===null||typeof n!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof n);return g("/",n)},"format2"),parse:e(function(n){i(n);var r={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return r;var u=n.charCodeAt(0),p=u===47,c;p?(r.root="/",c=1):c=0;for(var d=-1,m=0,y=-1,w=!0,_=n.length-1,S=0;_>=c;--_){if(u=n.charCodeAt(_),u===47){if(!w){m=_+1;break}continue}y===-1&&(w=!1,y=_+1),u===46?d===-1?d=_:S!==1&&(S=1):d!==-1&&(S=-1)}return d===-1||y===-1||S===0||S===1&&d===y-1&&d===m+1?y!==-1&&(m===0&&p?r.base=r.name=n.slice(1,y):r.base=r.name=n.slice(m,y)):(m===0&&p?(r.name=n.slice(1,d),r.base=n.slice(1,y)):(r.name=n.slice(m,d),r.base=n.slice(m,y)),r.ext=n.slice(d,y)),m>0?r.dir=n.slice(0,m-1):p&&(r.dir="/"),r},"parse2"),sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Hu=a,Hu}l(_k,"Mj");function w6(){if(wb)return qu;wb=!0;var o=typeof Map=="function"&&Map.prototype,i=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,f=o&&i&&typeof i.get=="function"?i.get:null,g=o&&Map.prototype.forEach,a=typeof Set=="function"&&Set.prototype,n=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,r=a&&n&&typeof n.get=="function"?n.get:null,u=a&&Set.prototype.forEach,p=typeof WeakMap=="function"&&WeakMap.prototype,c=p?WeakMap.prototype.has:null,d=typeof WeakSet=="function"&&WeakSet.prototype,m=d?WeakSet.prototype.has:null,y=typeof WeakRef=="function"&&WeakRef.prototype,w=y?WeakRef.prototype.deref:null,_=Boolean.prototype.valueOf,S=Object.prototype.toString,T=Function.prototype.toString,k=String.prototype.match,E=String.prototype.slice,j=String.prototype.replace,A=String.prototype.toUpperCase,I=String.prototype.toLowerCase,U=RegExp.prototype.test,M=Array.prototype.concat,ee=Array.prototype.join,V=Array.prototype.slice,q=Math.floor,G=typeof BigInt=="function"?BigInt.prototype.valueOf:null,re=Object.getOwnPropertySymbols,ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,de=typeof Symbol=="function"&&typeof Symbol.iterator=="object",we=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===de||!0)?Symbol.toStringTag:null,Ie=Object.prototype.propertyIsEnumerable,je=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(Z){return Z.__proto__}:null);function se(Z,oe){if(Z===1/0||Z===-1/0||Z!==Z||Z&&Z>-1e3&&Z<1e3||U.call(/e/,oe))return oe;var Ae=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof Z=="number"){var le=Z<0?-q(-Z):q(Z);if(le!==Z){var Fe=String(le),ie=E.call(oe,Fe.length+1);return j.call(Fe,Ae,"$&_")+"."+j.call(j.call(ie,/([0-9]{3})/g,"$&_"),/_$/,"")}}return j.call(oe,Ae,"$&_")}l(se,"Q"),e(se,"addNumericSeparator");var Te=R6,J=Te.custom,ue=ve(J)?J:null;qu=e(l(function Z(oe,Ae,le,Fe){var ie=Ae||{};if(D(ie,"quoteStyle")&&ie.quoteStyle!=="single"&&ie.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(D(ie,"maxStringLength")&&(typeof ie.maxStringLength=="number"?ie.maxStringLength<0&&ie.maxStringLength!==1/0:ie.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Je=D(ie,"customInspect")?ie.customInspect:!0;if(typeof Je!="boolean"&&Je!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(D(ie,"indent")&&ie.indent!==null&&ie.indent!==" "&&!(parseInt(ie.indent,10)===ie.indent&&ie.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(D(ie,"numericSeparator")&&typeof ie.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var dt=ie.numericSeparator;if(typeof oe>"u")return"undefined";if(oe===null)return"null";if(typeof oe=="boolean")return oe?"true":"false";if(typeof oe=="string")return $e(oe,ie);if(typeof oe=="number"){if(oe===0)return 1/0/oe>0?"0":"-0";var W=String(oe);return dt?se(oe,W):W}if(typeof oe=="bigint"){var qe=String(oe)+"n";return dt?se(oe,qe):qe}var Ve=typeof ie.depth>"u"?5:ie.depth;if(typeof le>"u"&&(le=0),le>=Ve&&Ve>0&&typeof oe=="object")return ye(oe)?"[Array]":"[Object]";var pe=R(ie,le);if(typeof Fe>"u")Fe=[];else if(ke(Fe,oe)>=0)return"[Circular]";function Le(Nt,Ut,pr){if(Ut&&(Fe=V.call(Fe),Fe.push(Ut)),pr){var nl={depth:ie.depth};return D(ie,"quoteStyle")&&(nl.quoteStyle=ie.quoteStyle),Z(Nt,nl,le+1,Fe)}return Z(Nt,ie,le+1,Fe)}if(l(Le,"or"),e(Le,"inspect"),typeof oe=="function"&&!De(oe)){var He=Ee(oe),me=C(oe,Le);return"[Function"+(He?": "+He:" (anonymous)")+"]"+(me.length>0?" { "+ee.call(me,", ")+" }":"")}if(ve(oe)){var Se=de?j.call(String(oe),/^(Symbol\(.*\))_[^)]*$/,"$1"):ae.call(oe);return typeof oe=="object"&&!de?t(Se):Se}if(Pe(oe)){for(var We="<"+I.call(String(oe.nodeName)),Qe=oe.attributes||[],lt=0;lt<Qe.length;lt++)We+=" "+Qe[lt].name+"="+te(X(Qe[lt].value),"double",ie);return We+=">",oe.childNodes&&oe.childNodes.length&&(We+="..."),We+="</"+I.call(String(oe.nodeName))+">",We}if(ye(oe)){if(oe.length===0)return"[]";var bt=C(oe,Le);return pe&&!v(bt)?"["+P(bt,pe)+"]":"[ "+ee.call(bt,", ")+" ]"}if(Y(oe)){var ht=C(oe,Le);return!("cause"in Error.prototype)&&"cause"in oe&&!Ie.call(oe,"cause")?"{ ["+String(oe)+"] "+ee.call(M.call("[cause]: "+Le(oe.cause),ht),", ")+" }":ht.length===0?"["+String(oe)+"]":"{ ["+String(oe)+"] "+ee.call(ht,", ")+" }"}if(typeof oe=="object"&&Je){if(ue&&typeof oe[ue]=="function"&&Te)return Te(oe,{depth:Ve-le});if(Je!=="symbol"&&typeof oe.inspect=="function")return oe.inspect()}if(be(oe)){var kt=[];return g&&g.call(oe,function(Nt,Ut){kt.push(Le(Ut,oe,!0)+" => "+Le(Nt,oe))}),h("Map",f.call(oe),kt,pe)}if(xe(oe)){var zt=[];return u&&u.call(oe,function(Nt){zt.push(Le(Nt,oe))}),h("Set",r.call(oe),zt,pe)}if(ge(oe))return s("WeakMap");if(Oe(oe))return s("WeakSet");if(Ne(oe))return s("WeakRef");if(Q(oe))return t(Le(Number(oe)));if(N(oe))return t(Le(G.call(oe)));if(fe(oe))return t(_.call(oe));if(H(oe))return t(Le(String(oe)));if(typeof window<"u"&&oe===window)return"{ [object Window] }";if(typeof globalThis<"u"&&oe===globalThis||typeof Gu<"u"&&oe===Gu)return"{ [object globalThis] }";if(!Re(oe)&&!De(oe)){var Wt=C(oe,Le),ir=je?je(oe)===Object.prototype:oe instanceof Object||oe.constructor===Object,kr=oe instanceof Object?"":"null prototype",et=!ir&&we&&Object(oe)===oe&&we in oe?E.call(z(oe),8,-1):kr?"Object":"",er=ir||typeof oe.constructor!="function"?"":oe.constructor.name?oe.constructor.name+" ":"",Tt=er+(et||kr?"["+ee.call(M.call([],et||[],kr||[]),": ")+"] ":"");return Wt.length===0?Tt+"{}":pe?Tt+"{"+P(Wt,pe)+"}":Tt+"{ "+ee.call(Wt,", ")+" }"}return String(oe)},"W"),"inspect_");function te(Z,oe,Ae){var le=(Ae.quoteStyle||oe)==="double"?'"':"'";return le+Z+le}l(te,"z"),e(te,"wrapQuotes");function X(Z){return j.call(String(Z),/"/g,"&quot;")}l(X,"V"),e(X,"quote");function ye(Z){return z(Z)==="[object Array]"&&(!we||!(typeof Z=="object"&&we in Z))}l(ye,"G"),e(ye,"isArray");function Re(Z){return z(Z)==="[object Date]"&&(!we||!(typeof Z=="object"&&we in Z))}l(Re,"fe"),e(Re,"isDate");function De(Z){return z(Z)==="[object RegExp]"&&(!we||!(typeof Z=="object"&&we in Z))}l(De,"be"),e(De,"isRegExp");function Y(Z){return z(Z)==="[object Error]"&&(!we||!(typeof Z=="object"&&we in Z))}l(Y,"N"),e(Y,"isError");function H(Z){return z(Z)==="[object String]"&&(!we||!(typeof Z=="object"&&we in Z))}l(H,"$"),e(H,"isString");function Q(Z){return z(Z)==="[object Number]"&&(!we||!(typeof Z=="object"&&we in Z))}l(Q,"H"),e(Q,"isNumber");function fe(Z){return z(Z)==="[object Boolean]"&&(!we||!(typeof Z=="object"&&we in Z))}l(fe,"te"),e(fe,"isBoolean");function ve(Z){if(de)return Z&&typeof Z=="object"&&Z instanceof Symbol;if(typeof Z=="symbol")return!0;if(!Z||typeof Z!="object"||!ae)return!1;try{return ae.call(Z),!0}catch{}return!1}l(ve,"oe"),e(ve,"isSymbol");function N(Z){if(!Z||typeof Z!="object"||!G)return!1;try{return G.call(Z),!0}catch{}return!1}l(N,"P"),e(N,"isBigInt");var x=Object.prototype.hasOwnProperty||function(Z){return Z in(this||Gu)};function D(Z,oe){return x.call(Z,oe)}l(D,"M"),e(D,"has");function z(Z){return S.call(Z)}l(z,"Y"),e(z,"toStr");function Ee(Z){if(Z.name)return Z.name;var oe=k.call(T.call(Z),/^function\s*([\w$]+)/);return oe?oe[1]:null}l(Ee,"ue"),e(Ee,"nameOf");function ke(Z,oe){if(Z.indexOf)return Z.indexOf(oe);for(var Ae=0,le=Z.length;Ae<le;Ae++)if(Z[Ae]===oe)return Ae;return-1}l(ke,"le"),e(ke,"indexOf");function be(Z){if(!f||!Z||typeof Z!="object")return!1;try{f.call(Z);try{r.call(Z)}catch{return!0}return Z instanceof Map}catch{}return!1}l(be,"ee"),e(be,"isMap");function ge(Z){if(!c||!Z||typeof Z!="object")return!1;try{c.call(Z,c);try{m.call(Z,m)}catch{return!0}return Z instanceof WeakMap}catch{}return!1}l(ge,"ie"),e(ge,"isWeakMap");function Ne(Z){if(!w||!Z||typeof Z!="object")return!1;try{return w.call(Z),!0}catch{}return!1}l(Ne,"me"),e(Ne,"isWeakRef");function xe(Z){if(!r||!Z||typeof Z!="object")return!1;try{r.call(Z);try{f.call(Z)}catch{return!0}return Z instanceof Set}catch{}return!1}l(xe,"ye"),e(xe,"isSet");function Oe(Z){if(!m||!Z||typeof Z!="object")return!1;try{m.call(Z,m);try{c.call(Z,c)}catch{return!0}return Z instanceof WeakSet}catch{}return!1}l(Oe,"ve"),e(Oe,"isWeakSet");function Pe(Z){return!Z||typeof Z!="object"?!1:typeof HTMLElement<"u"&&Z instanceof HTMLElement?!0:typeof Z.nodeName=="string"&&typeof Z.getAttribute=="function"}l(Pe,"Me"),e(Pe,"isElement");function $e(Z,oe){if(Z.length>oe.maxStringLength){var Ae=Z.length-oe.maxStringLength,le="... "+Ae+" more character"+(Ae>1?"s":"");return $e(E.call(Z,0,oe.maxStringLength),oe)+le}var Fe=j.call(j.call(Z,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Ke);return te(Fe,"single",oe)}l($e,"Be"),e($e,"inspectString");function Ke(Z){var oe=Z.charCodeAt(0),Ae={8:"b",9:"t",10:"n",12:"f",13:"r"}[oe];return Ae?"\\"+Ae:"\\x"+(oe<16?"0":"")+A.call(oe.toString(16))}l(Ke,"Xe"),e(Ke,"lowbyte");function t(Z){return"Object("+Z+")"}l(t,"p"),e(t,"markBoxed");function s(Z){return Z+" { ? }"}l(s,"l"),e(s,"weakCollectionOf");function h(Z,oe,Ae,le){var Fe=le?P(Ae,le):ee.call(Ae,", ");return Z+" ("+oe+") {"+Fe+"}"}l(h,"u"),e(h,"collectionOf");function v(Z){for(var oe=0;oe<Z.length;oe++)if(ke(Z[oe],`
4
4
  `)>=0)return!1;return!0}l(v,"w"),e(v,"singleLineValues");function R(Z,oe){var Ae;if(Z.indent===" ")Ae=" ";else if(typeof Z.indent=="number"&&Z.indent>0)Ae=ee.call(Array(Z.indent+1)," ");else return null;return{base:Ae,prev:ee.call(Array(oe+1),Ae)}}l(R,"A"),e(R,"getIndent");function P(Z,oe){if(Z.length===0)return"";var Ae=`
@@ -143,7 +143,7 @@ gpgsig`+Nf(K)+`
143
143
 
144
144
  ${p}
145
145
 
146
- `)},"createFsOperationFileLogger");import{jsx as d5}from"react/jsx-runtime";var IP=s5({legitFs:null,loading:!0,head:null,rollback:l(async()=>{},"rollback")}),R2=l(()=>l5(IP),"useLegitContext"),u5={gitRoot:"/"},c5=100,h5=l(({children:o,config:i=u5})=>{let[f,g]=zd(!0),[a,n]=zd(null),r=f5(null),[u,p]=zd(),[c,d]=zd(null);BP(()=>{if(!f)return;l(async()=>{try{let w=await A2({gitRoot:i.gitRoot,serverUrl:i.serverUrl,publicKey:i.publicKey});i.publicKey&&(await w.auth.addAccessToken(i.publicKey),w.sync.start()),w&&n(w)}catch(w){p(w)}},"init")(),g(!1)},[]),BP(()=>{if(!a)return;window.legitFs=a;let y=setInterval(async()=>{let w=await a.getCurrentBranch();try{let _=await a.promises.readFile(`/.legit/branches/${w}/.legit/head`,"utf8");_!==r.current&&(r.current=_,d(_))}catch{}},c5);return()=>{clearInterval(y)}},[a]);let m=l(async y=>{if(!a){console.error("No legitFs instance available");return}try{let w=await a.getCurrentBranch();await a.promises.writeFile(`/.legit/branches/${w}/.legit/head`,y,"utf8")}catch(w){p(w)}},"rollback");return d5(IP.Provider,{value:{legitFs:a,loading:a===null,head:c,rollback:m,error:u},children:o})},"LegitProvider");import{useEffect as xP,useState as Hd,useRef as k2,useCallback as jP,useMemo as p5}from"react";function g5(o,i){let{legitFs:f,error:g,head:a}=R2(),[n,r]=Hd(null),[u,p]=Hd([]),[c,d]=Hd(!0),[m,y]=Hd(),w=k2(null),_=k2(!1),S=k2(!1);xP(()=>{if(!f)return;let E=!1;return l(async()=>{d(!0);try{let A=await f.getCurrentBranch(),I=`/.legit/branches/${A}${o}`,U=`/.legit/branches/${A}/.legit/history`,M=await f.promises.readFile(I,"utf8"),ee=await f.promises.readFile(U,"utf8").catch(()=>"");if(E)return;let V=[],q=ee;q&&(V=JSON.parse(q)),w.current===M&&(w.current=null),r(M),p(V),y(void 0)}catch(A){A?.code!=="ENOENT"?y(A):(r(null),p([]))}finally{E||d(!1)}},"load")(),()=>{E=!0}},[f,o,a]);let T=jP(async E=>{if(f)try{w.current=E;let j=await f.getCurrentBranch();await f.promises.writeFile(`/.legit/branches/${j}${o}`,E,"utf8"),r(E)}catch(j){throw w.current=null,y(j),j}},[f,o]);xP(()=>{_.current||S.current||!c&&n===null&&f&&i?.initialData&&(S.current=!0,_.current=!0,l(async()=>{try{await T(i.initialData)}catch(j){console.error("Failed to initialize file:",j),_.current=!1}finally{S.current=!1}},"initialize")())},[c,n,f,i?.initialData,T]);let k=jP(async E=>{if(!f)return"";try{let j=o.startsWith("/")?o.slice(1):o;return await f.promises.readFile(`/.legit/commits/${E.slice(0,2)}/${E.slice(2)}/${j}`,"utf8")}catch{return""}},[f,o]);return{data:n,setData:T,history:p5(()=>u,[u]),getPastState:k,loading:c,error:m??g,legitFs:f}}l(g5,"useLegitFile");export{h5 as LegitProvider,R2 as useLegitContext,g5 as useLegitFile};
146
+ `)},"createFsOperationFileLogger");import{jsx as d5}from"react/jsx-runtime";var IP=s5({legitFs:null,loading:!0,head:null,rollback:l(async()=>{},"rollback")}),R2=l(()=>l5(IP),"useLegitContext"),u5={gitRoot:"/"},c5=100,h5=l(({children:o,config:i=u5})=>{let[f,g]=zd(!0),[a,n]=zd(null),r=f5(null),[u,p]=zd(),[c,d]=zd(null);BP(()=>{if(!f)return;if(typeof window>"u"){g(!1);return}l(async()=>{try{let w=await A2({gitRoot:i.gitRoot,serverUrl:i.serverUrl,publicKey:i.publicKey});i.publicKey&&(await w.auth.addAccessToken(i.publicKey),w.sync.start()),w&&n(w)}catch(w){p(w)}},"init")(),g(!1)},[]),BP(()=>{if(!a||typeof window>"u")return;window.legitFs=a;let y=setInterval(async()=>{let w=await a.getCurrentBranch();try{let _=await a.promises.readFile(`/.legit/branches/${w}/.legit/head`,"utf8");_!==r.current&&(r.current=_,d(_))}catch{}},c5);return()=>{clearInterval(y)}},[a]);let m=l(async y=>{if(!(typeof window>"u")){if(!a){console.error("No legitFs instance available");return}try{let w=await a.getCurrentBranch();await a.promises.writeFile(`/.legit/branches/${w}/.legit/head`,y,"utf8")}catch(w){p(w)}}},"rollback");return d5(IP.Provider,{value:{legitFs:a,loading:a===null,head:c,rollback:m,error:u},children:o})},"LegitProvider");import{useEffect as xP,useState as Hd,useRef as k2,useCallback as jP,useMemo as p5}from"react";function g5(o,i){let{legitFs:f,error:g,head:a}=R2(),[n,r]=Hd(null),[u,p]=Hd([]),[c,d]=Hd(!0),[m,y]=Hd(),w=k2(null),_=k2(!1),S=k2(!1);xP(()=>{if(typeof window>"u"){d(!1);return}if(!f)return;let E=!1;return l(async()=>{d(!0);try{let A=await f.getCurrentBranch(),I=`/.legit/branches/${A}${o}`,U=`/.legit/branches/${A}/.legit/history`,M=await f.promises.readFile(I,"utf8"),ee=await f.promises.readFile(U,"utf8").catch(()=>"");if(E)return;let V=[],q=ee;q&&(V=JSON.parse(q)),w.current===M&&(w.current=null),r(M),p(V),y(void 0)}catch(A){A?.code!=="ENOENT"?y(A):(r(null),p([]))}finally{E||d(!1)}},"load")(),()=>{E=!0}},[f,o,a]);let T=jP(async E=>{if(!(typeof window>"u")&&f)try{w.current=E;let j=await f.getCurrentBranch();await f.promises.writeFile(`/.legit/branches/${j}${o}`,E,"utf8"),r(E)}catch(j){throw w.current=null,y(j),j}},[f,o]);xP(()=>{_.current||S.current||!c&&n===null&&f&&i?.initialData&&(S.current=!0,_.current=!0,l(async()=>{try{await T(i.initialData)}catch(j){console.error("Failed to initialize file:",j),_.current=!1}finally{S.current=!1}},"initialize")())},[c,n,f,i?.initialData,T]);let k=jP(async E=>{if(typeof window>"u"||!f)return"";try{let j=o.startsWith("/")?o.slice(1):o;return await f.promises.readFile(`/.legit/commits/${E.slice(0,2)}/${E.slice(2)}/${j}`,"utf8")}catch{return""}},[f,o]);return{data:n,setData:T,history:p5(()=>u,[u]),getPastState:k,loading:c,error:m??g,legitFs:f}}l(g5,"useLegitFile");export{h5 as LegitProvider,R2 as useLegitContext,g5 as useLegitFile};
147
147
  /*! Bundled license information:
148
148
 
149
149
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js:
@@ -0,0 +1,14 @@
1
+ import { HistoryItem, openLegitFs } from '@legit-sdk/core';
2
+ export interface UseLegitFileOptions {
3
+ initialData?: string;
4
+ }
5
+ export type UseLegitFileReturn = {
6
+ data: string | null;
7
+ setData: (newText: string) => Promise<void>;
8
+ history: HistoryItem[];
9
+ getPastState: (commitHash: string) => Promise<string>;
10
+ loading: boolean;
11
+ error?: Error;
12
+ legitFs: Awaited<ReturnType<typeof openLegitFs>> | null;
13
+ };
14
+ export declare function useLegitFile(path: string, options?: UseLegitFileOptions): UseLegitFileReturn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legit-sdk/react",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "React wrapper for @legit-sdk/core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,11 +11,6 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.js"
14
- },
15
- "./server": {
16
- "types": "./dist/server.d.ts",
17
- "import": "./dist/server.js",
18
- "require": "./dist/server.js"
19
14
  }
20
15
  },
21
16
  "keywords": [],
@@ -24,8 +19,8 @@
24
19
  "files": [
25
20
  "dist/index.js",
26
21
  "dist/index.d.ts",
27
- "dist/server.js",
28
- "dist/server.d.ts",
22
+ "dist/LegitProvider.d.ts",
23
+ "dist/useLegitFile.d.ts",
29
24
  "LICENSE"
30
25
  ],
31
26
  "peerDependencies": {
package/dist/server.d.ts DELETED
@@ -1,40 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
3
- import { openLegitFsWithMemoryFs, HistoryItem, openLegitFs } from '@legit-sdk/core';
4
-
5
- interface LegitContextValue {
6
- legitFs: Awaited<ReturnType<typeof openLegitFsWithMemoryFs>> | null;
7
- loading: boolean;
8
- head: string | null;
9
- rollback: (commitHash: string) => Promise<void>;
10
- error?: Error;
11
- }
12
- declare const useLegitContext: () => LegitContextValue;
13
- interface LegitProviderProps {
14
- children: ReactNode;
15
- config?: LegitConfig;
16
- }
17
- type LegitConfig = {
18
- gitRoot: string;
19
- initialBranch?: string;
20
- serverUrl?: string;
21
- publicKey?: string;
22
- };
23
- declare const LegitProvider: ({ children, config, }: LegitProviderProps) => react_jsx_runtime.JSX.Element;
24
-
25
- interface UseLegitFileOptions {
26
- initialData?: string;
27
- }
28
- type UseLegitFileReturn = {
29
- data: string | null;
30
- setData: (newText: string) => Promise<void>;
31
- history: HistoryItem[];
32
- getPastState: (commitHash: string) => Promise<string>;
33
- loading: boolean;
34
- error?: Error;
35
- legitFs: Awaited<ReturnType<typeof openLegitFs>> | null;
36
- };
37
- declare function useLegitFile(path: string, options?: UseLegitFileOptions): UseLegitFileReturn;
38
-
39
- export { LegitProvider, useLegitContext, useLegitFile };
40
- export type { LegitConfig, LegitContextValue, LegitProviderProps, UseLegitFileOptions, UseLegitFileReturn };
package/dist/server.js DELETED
@@ -1,12 +0,0 @@
1
- // legit-sdk server bundle (Node.js)
2
-
3
- var Ft=Object.defineProperty;var w=(s,e)=>Ft(s,"name",{value:e,configurable:!0});import{createContext as Wt,useContext as Kt,useEffect as mt,useState as he,useRef as Gt}from"react";import*as ue from"path";import*as Ve from"path";import{createFsFromVolume as yt,Volume as bt}from"memfs";import*as Ge from"path";import{createFsFromVolume as St,Volume as Dt}from"memfs";import kt from"ignore";import*as ae from"path";import{createFsFromVolume as Pt,Volume as Rt}from"memfs";import Nt from"ignore";import Oe from"isomorphic-git";import*as Fe from"path";import{createFsFromVolume as $t,Volume as Bt}from"memfs";import Te from"isomorphic-git";import I from"isomorphic-git";import S from"isomorphic-git";import be from"isomorphic-git";import M from"isomorphic-git";import me from"isomorphic-git";import fe from"isomorphic-git";import pe from"isomorphic-git";import B from"isomorphic-git";import xt from"isomorphic-git";import U from"isomorphic-git";import ee from"isomorphic-git";import Le from"isomorphic-git";import L from"isomorphic-git";import $ from"isomorphic-git";import we from"isomorphic-git/http/node";import R from"isomorphic-git";import{createFsFromVolume as Ut,Volume as jt}from"memfs";import ze from"isomorphic-git";var _e=Object.defineProperty,gt=w((s,e,t)=>e in s?_e(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"ot"),n=w((s,e)=>_e(s,"name",{value:e,configurable:!0}),"n"),F=w((s,e,t)=>gt(s,typeof e!="symbol"?e+"":e,t),"p"),V,He=(V=class{constructor(e,t){F(this,"entries",[]),F(this,"currentIndex",0),F(this,"closed",!1),F(this,"compositFs"),F(this,"dirPath"),F(this,"initialized",!1),this.compositFs=e,this.dirPath=t}async initialize(){if(this.initialized)return;let e=new Set;for(let t of[...this.compositFs.subFilesystems].reverse()){let r=await t.readdir(this.dirPath);for(let i of r)e.add(i)}for(let t of Array.from(e)){let r=this.dirPath+"/"+t;await this.compositFs.hiddenFilesFileSystem?.responsible(r)||this.entries.push({name:t,path:r})}this.initialized=!0}async*[Symbol.asyncIterator](){for(await this.initialize();this.currentIndex<this.entries.length&&!this.closed;){let e=this.entries[this.currentIndex++];try{let t=await this.compositFs.stat(e.path);yield{name:e.name,isFile:n(()=>t.isFile(),"isFile"),isDirectory:n(()=>t.isDirectory(),"isDirectory"),isBlockDevice:n(()=>t.isBlockDevice(),"isBlockDevice"),isCharacterDevice:n(()=>t.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:n(()=>t.isSymbolicLink(),"isSymbolicLink"),isFIFO:n(()=>t.isFIFO(),"isFIFO"),isSocket:n(()=>t.isSocket(),"isSocket")}}catch(t){console.debug(`Failed to stat ${e.path}:`,t)}}}async read(){if(this.closed)throw new Error("Directory handle is closed");if(await this.initialize(),this.currentIndex>=this.entries.length)return null;let e=this.entries[this.currentIndex++];try{let t=await this.compositFs.stat(e.path);return{name:e.name,isFile:n(()=>t.isFile(),"isFile"),isDirectory:n(()=>t.isDirectory(),"isDirectory"),isBlockDevice:n(()=>t.isBlockDevice(),"isBlockDevice"),isCharacterDevice:n(()=>t.isCharacterDevice(),"isCharacterDevice"),isSymbolicLink:n(()=>t.isSymbolicLink(),"isSymbolicLink"),isFIFO:n(()=>t.isFIFO(),"isFIFO"),isSocket:n(()=>t.isSocket(),"isSocket")}}catch{return this.read()}}async close(){this.closed=!0,this.entries=[]}get path(){return this.dirPath}},w(V,"he"),V);n(He,"CompositeFsDir");var Ue=He,W,je=(W=class{constructor(e){F(this,"delegate"),F(this,"compositeFs"),F(this,"_subFsFileDescriptor"),F(this,"handleType","file"),F(this,"_compositFsFileDescriptor",-1),this.delegate=e.fs,this._subFsFileDescriptor=e.subFsFileDescriptor,this._compositFsFileDescriptor=-1,this.compositeFs=e.compositeFs;let t=this._subFsFileDescriptor}get fsType(){return this.delegate.fileType()}get subFsFileDescriptor(){return this._subFsFileDescriptor}get fd(){return this._compositFsFileDescriptor}realize(e){if(this._compositFsFileDescriptor!==-1)throw new Error("was already realized");this._compositFsFileDescriptor=e}readableWebStream(e){throw new Error("Method not implemented.")}async appendFile(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"appendFile",{data:e,options:t}),await this.delegate.appendFile(this,e,t)}async chmod(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chmod",{mode:e}),this.delegate.fchmod(this,e)}async chown(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"chown",{uid:e,gid:t}),this.delegate.fchown(this,e,t)}async close(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"close",{}),this.compositeFs.close(this)}async datasync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"datasync",{}),this.delegate.dataSync(this)}async read(e,t,r,i){return await this.compositeFs.logOperationOnFileDescsriptor(this,"read",{targetBufferLength:e.length,offset:t,length:r,position:i}),await this.delegate.read(this,e,t,r,i)}async readv(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"readv",{buffers:e,position:t}),this.delegate.readv(this,e,t)}async stat(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"stat",{options:e}),this.delegate.fstat(this,e)}async truncate(e){return await this.compositeFs.logOperationOnFileDescsriptor(this,"truncate",{len:e}),this.delegate.ftruncate(this,e)}async utimes(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"utimes",{atime:e,mtime:t}),this.delegate.futimes(this,e,t)}async write(e,t,r,i){return await this.compositeFs.logOperationOnFileDescsriptor(this,"write",{buffer:e,offset:t,length:r,position:i}),this.delegate.write(this,e,t,r,i)}async writev(e,t){return await this.compositeFs.logOperationOnFileDescsriptor(this,"writev",{buffers:e,position:t}),this.delegate.writev(this,e,t)}async sync(){return await this.compositeFs.logOperationOnFileDescsriptor(this,"sync",{}),this.delegate.dataSync(this)}},w(W,"pe"),W);n(je,"CompositFsFileHandle");var le=je,K,We=(K=class{constructor({name:e,parentFs:t,gitRoot:r}){F(this,"compositFs"),F(this,"gitRoot"),F(this,"name"),this.name=e,this.compositFs=t,this.gitRoot=r}toStr(e){return typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e&&typeof e=="object"&&"fd"in e?`FileHandle(fd=${e.fd})`:String(e)}async open(e,t,r){throw new Error(`open not implemented for: ${this.toStr(e)}`)}async access(e,t){throw new Error(`access not implemented for: ${this.toStr(e)}`)}async stat(e,t){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async lstat(e,t){throw new Error(`lstat not implemented for: ${this.toStr(e)}`)}async opendir(e,t){throw new Error(`opendir not implemented for: ${this.toStr(e)}`)}async link(e,t){throw new Error(`link not implemented for: ${this.toStr(e)}`)}async mkdir(e,t){throw new Error(`mkdir not implemented for: ${this.toStr(e)}`)}async readdir(e,t){throw new Error(`readdir not implemented for: ${this.toStr(e)}`)}async readlink(e,...t){throw new Error(`readlink not implemented for: ${this.toStr(e)}`)}async unlink(e){throw new Error(`unlink not implemented for: ${this.toStr(e)}`)}async rename(e,t){throw new Error(`rename not implemented for: ${this.toStr(e)}`)}async rmdir(e,...t){throw new Error(`rmdir not implemented for: ${this.toStr(e)}`)}async symlink(e,t,r){throw new Error(`symlink not implemented for: ${this.toStr(t)}`)}async lookup(e){throw new Error(`lookup not implemented for: ${this.toStr(e)}`)}resolvePath(e){throw new Error(`resolvePath not implemented for fd: ${e}`)}async close(e){this.compositFs.close(e)}async dataSync(e){throw new Error(`dataSync not implemented for: ${e.subFsFileDescriptor}`)}async read(e,t,r,i,a){throw new Error(`read not implemented for: ${e.subFsFileDescriptor}`)}async appendFile(e,t,r){throw new Error(`appendFile not implemented for: ${e.subFsFileDescriptor}`)}async fchmod(e,t){throw new Error(`fchmod not implemented for: ${e.subFsFileDescriptor}`)}async fchown(e,t,r){throw new Error(`fchown not implemented for: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){throw new Error(`ftruncate not implemented for: ${e.subFsFileDescriptor}`)}async fstat(e,t){throw new Error(`fstat not implemented for: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){throw new Error(`futimes not implemented for: ${e.subFsFileDescriptor}`)}async write(e,t,r,i,a){throw new Error(`write not implemented for: ${e.subFsFileDescriptor}`)}async writev(e,t,r){throw new Error(`writev not implemented for: ${e.subFsFileDescriptor}`)}async readv(e,t,r){throw new Error(`readv not implemented for: ${e.subFsFileDescriptor}`)}async readFile(e,t){throw new Error(`readFile not implemented for: ${this.toStr(e)}`)}async writeFile(e,t,r){throw new Error(`writeFile not implemented for: ${this.toStr(e)}`)}},w(K,"ue"),K);n(We,"BaseCompositeSubFs");var te=We,G,Ke=(G=class extends te{constructor({name:e,parentFs:t,gitRoot:r}){if(super({name:e,parentFs:t,gitRoot:r}),F(this,"openFh",new Map),F(this,"memFs",yt(new bt)),F(this,"targetFs"),this.compositFs=t,this.gitRoot=r,this.compositFs.parentFs===void 0)throw new Error("PassThroughSubFs not allowed in root fs");this.targetFs=this.compositFs.parentFs}async responsible(e){return!0}fileType(){return 4}async open(e,t,r){let i=Ve.dirname(e),a=await this.targetFs.promises.open(e,t,r);return this.openFh.set(a.fd,a),new le({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:a.fd,parentFsFileDescriptors:[a.fd]})}async access(e,t){return await this.targetFs.promises.access(e,t)}async stat(e,t){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,t){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,t){return await this.targetFs.promises.opendir(e,t)}async link(e,t){return await this.targetFs.promises.link(e,t)}async mkdir(e,t){let r=typeof e=="string"?e:e.toString();return await this.targetFs.promises.mkdir(r,t)}async readdir(e,...t){return this.targetFs.promises.readdir(e,...t)}async readlink(e,...t){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,t){return await this.targetFs.promises.rename(e,t)}async rmdir(e,t){return await this.targetFs.promises.rmdir(e,t)}async symlink(e,t,r){return await this.targetFs.promises.symlink(e,t,r)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let t=this.openFh.get(e.subFsFileDescriptor);t&&(await t.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let t=this.openFh.get(e.subFsFileDescriptor);if(t)return await t.sync()}async read(e,t,r,i,a){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(t,r,i,a);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.chmod(t)}async fchown(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chown(t,r)}async write(e,t,r,i,a){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(t,r,i,a);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.truncate(t)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.stat(t);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.utimes(t,r)}async writev(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.writev(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.readv(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,t){return typeof e=="string"||Buffer.isBuffer(e)?this.targetFs.readFile(e.toString(),t):super.readFile(e,t)}async writeFile(e,t,r){let i=typeof r=="object"&&r.flag?r.flag:"w",a=await this.targetFs.open(e,i);try{let o;if(typeof t=="string"){let l=typeof r=="object"&&r.encoding?r.encoding:"utf8";o=Buffer.from(t,l)}else Buffer.isBuffer(t)?o=t:o=Buffer.from(t);await a.write(o,0,o.length,0)}finally{await this.targetFs.close(a)}}},w(G,"Fe"),G);n(Ke,"PassThroughSubFs");var vt=Ke,J,Je=(J=class extends te{constructor({name:e,parentFs:t,gitRoot:r,passThroughFs:i}){super({name:e,parentFs:t,gitRoot:r}),F(this,"openFh",new Map),F(this,"memFs",St(new Dt)),F(this,"targetFs"),this.compositFs=t,this.gitRoot=r,this.targetFs=i}async responsible(e){return!0}fileType(){return 4}async open(e,t,r){let i=Ge.dirname(e),a=await this.targetFs.promises.open(e,t,r);return this.openFh.set(a.fd,a),new le({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:a.fd,parentFsFileDescriptors:[]})}async access(e,t){return await this.targetFs.promises.access(e,t)}async stat(e,...t){return this.targetFs.promises.stat(e,{bigint:!1})}async lstat(e,...t){return this.targetFs.promises.lstat(e,{bigint:!1})}async opendir(e,t){let r=await this.targetFs.promises.opendir(e,t);return new Ue(this.compositFs,e.toString())}async link(e,t){return await this.targetFs.promises.link(e,t)}async mkdir(e,t){await this.targetFs.promises.mkdir(e,t)}async readdir(e,...t){return this.targetFs.promises.readdir(e,...t)}async readlink(e,...t){throw new Error("not implemented")}async unlink(e){return await this.targetFs.promises.unlink(e)}async rename(e,t){return await this.targetFs.promises.rename(e,t)}async rmdir(e,t){return await this.targetFs.promises.rmdir(e,t)}async symlink(e,t,r){return await this.targetFs.promises.symlink(e,t,r)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let t=this.openFh.get(e.subFsFileDescriptor);t&&(this.openFh.delete(e.subFsFileDescriptor),await t.close())}async dataSync(e){let t=this.openFh.get(e.subFsFileDescriptor);if(t)return await t.sync()}async read(e,t,r,i,a){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(t,r,i,a);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.chmod(t)}async fchown(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chown(t,r)}async write(e,t,r,i,a){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(t,r,i,a);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.truncate(t)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.stat(t);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.utimes(t,r)}async writev(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.writev(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.readv(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,t){return this.targetFs.promises.readFile(e,t)}async writeFile(e,t,r){return this.targetFs.promises.writeFile(e,t,r)}},w(J,"ge"),J);n(Je,"PassThroughToAsyncFsSubFs");var Et=Je,q,qe=(q=class{constructor({name:e,parentFs:t,storageFs:r,gitRoot:i,defaultBranch:a="main"}){if(F(this,"promises"),F(this,"gitRoot"),F(this,"ephemeralFilesFileSystem"),F(this,"hiddenFilesFileSystem"),F(this,"passThroughFileSystem"),F(this,"subFilesystems",[]),F(this,"parentFs"),F(this,"name"),F(this,"defaultBranch"),F(this,"pathToFileDescriptors",new Map),F(this,"openFileHandles",new Map),F(this,"logOperation"),this.name=e,this.parentFs=t,this.gitRoot=i,this.defaultBranch=a,this.promises={access:this.access.bind(this),opendir:this.opendir.bind(this),mkdir:this.mkdir.bind(this),readdir:this.readdir.bind(this),open:this.open.bind(this),stat:this.stat.bind(this),lstat:this.lstat.bind(this),link:this.link.bind(this),readlink:this.readlink.bind(this),unlink:this.unlink.bind(this),rename:this.rename.bind(this),rmdir:this.rmdir.bind(this),symlink:this.symlink.bind(this),readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),getFilehandle:this.getFilehandle.bind(this)},!t&&r){this.passThroughFileSystem=new Et({name:e+"-passthrough",passThroughFs:r,gitRoot:i,parentFs:this});return}if(!r&&t){this.passThroughFileSystem=new vt({name:e+"-passthrough",parentFs:this,gitRoot:i});return}throw new Error("invalid configuration")}getNextFileDescriptor(){let e=Array.from(this.openFileHandles.keys());return e.length===0?1:Math.max(...e)+1}setLoggger(e){this.logOperation=e}async logOperationOnFileDescsriptor(e,t,r){if(!this.logOperation)return;let i=[];for(let[a,o]of this.pathToFileDescriptors.entries())o.includes(e.fd)&&i.push(a);if(i.length!==0)return this.logOperation?.({fsName:e.delegate.name,fd:e,path:i[0],operation:t,operationArgs:r})}getFilehandle(e){return this.openFileHandles.get(e)}setEphemeralFilesSubFs(e){this.ephemeralFilesFileSystem=e}setHiddenFilesSubFs(e){this.hiddenFilesFileSystem=e}addSubFs(e){this.subFilesystems.push(e)}async getResponsibleFs(e){if(!e.toString().startsWith(this.gitRoot)&&this.gitRoot!=="./")throw new Error("tried to access a file ("+e+") outside of the legit folder: "+this.gitRoot);if(!this.hiddenFilesFileSystem)throw new Error(this.name+" intialize hidden fs first!");if(!this.ephemeralFilesFileSystem)throw new Error(this.name+" intialize ephemeral fs first!");if(await this.hiddenFilesFileSystem.responsible(e.toString()))return this.hiddenFilesFileSystem;if(await this.ephemeralFilesFileSystem.responsible(e.toString()))return this.ephemeralFilesFileSystem;for(let t of this.subFilesystems)if(await t.responsible(e.toString()))return t;return this.passThroughFileSystem}async access(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e,operation:"access",operationArgs:{mode:t}}),r.access(e,t)}async opendir(e,t){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"opendir",operationArgs:{options:t}});let r=e.toString();if(!r.startsWith(this.gitRoot))throw new Error("tried to access a directory ("+r+") outside of the legit folder: "+this.gitRoot);return new Ue(this,r)}async mkdir(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"mkdir",operationArgs:{options:t}}),r.mkdir(e,t)}async readdir(e,t){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readdir",operationArgs:{options:t}});let r=new Set;for(let i of[...this.subFilesystems].reverse()){let a=await i.readdir(e,t);for(let o of a)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+o)||r.add(o)}try{let i=await this.passThroughFileSystem.readdir(e,t);for(let a of i)await this.ephemeralFilesFileSystem?.responsible((e=="/"?"":e)+"/"+a)||r.add(a)}catch(i){if(i.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+i)}try{let i=await this.ephemeralFilesFileSystem.readdir(e,t);for(let a of i)r.add(a)}catch(i){if(i.code!=="ENOENT")throw new Error("error reading ephemeral fs: "+i)}for(let i of r){let a=(e=="/"?"":e)+"/"+i;await this.hiddenFilesFileSystem.responsible(a)&&r.delete(i)}return Array.from(r)}async open(e,t,r){let i=await this.getResponsibleFs(e);await this.logOperation?.({fsName:i.name,path:e,operation:"open",operationArgs:{flags:t,mode:r}});let a=await i.open(e,t,r),o=this.getNextFileDescriptor();return a.realize(o),this.openFileHandles.set(o,a),this.pathToFileDescriptors.get(e)||this.pathToFileDescriptors.set(e,[]),this.pathToFileDescriptors.get(e).push(o),a}async close(e){try{await e.delegate.close(e)}catch(t){throw t}finally{for(let[t,r]of this.pathToFileDescriptors.entries()){let i=r.indexOf(e.fd);if(i!==-1){r.splice(i,1),r.length===0&&this.pathToFileDescriptors.delete(t);break}}this.openFileHandles.delete(e.fd)}}async stat(e,t){let r=e.toString(),i=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:i.name,path:r,operation:"stat",operationArgs:{opts:t}}),i.stat(e)}async lstat(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"lstat",operationArgs:{opts:t}}),r.lstat(e,t)}async link(e,t){throw new Error("not implemented")}async readlink(e,t){throw new Error("not implemented")}async unlink(e){let t=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:t.name,path:e.toString(),operation:"unlink",operationArgs:{}}),t.unlink(e)}async rename(e,t){if(this.hiddenFilesFileSystem){if(await this.hiddenFilesFileSystem.responsible(ue.basename(e.toString())))throw new Error("Renaming of hidden Files is not allowed "+e);if(await this.hiddenFilesFileSystem.responsible(ue.basename(t.toString())))throw new Error("Renaming to hidden Files is not allowed "+t)}let r=await this.getResponsibleFs(e),i=await this.getResponsibleFs(t);if(r===i)return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"rename",operationArgs:{oldPath:e,newPath:t}}),r.rename(e,t);let a=await r.open(e.toString(),"r");try{let o=await r.fstat(a),l=Buffer.alloc(o.size);await r.read(a,l,0,o.size,0),await r.close(a),await i.writeFile(t.toString(),l,"utf8"),await r.unlink(e)}catch(o){try{await r.close(a)}catch{}throw o}}async rmdir(e,t){let r=await this.getResponsibleFs(e);return await this.logOperation?.({fsName:r.name,path:e.toString(),operation:"rmdir",operationArgs:{dirPath:e,options:t}}),r.rmdir(e,t)}async symlink(e,t,r){throw new Error("not implemented")}async readFile(e,t){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"readFile",operationArgs:{path:e,options:t}});let r=!0,i;if(typeof e=="number"){r=!1;let a=this.getFilehandle(e);if(!a)throw new Error("Invalid file descriptor");i=a}else if(typeof e=="string")i=await this.open(e,"r");else throw new Error("only filehandle and path are supported atm");try{let a=(await i.stat()).size;if(typeof a=="bigint"){if(a>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("File too large to read into buffer");a=Number(a)}let o=Buffer.alloc(a),{bytesRead:l}=await i.read(o,0,a,0);if(t&&typeof t.encoding=="string")return o.slice(0,l).toString(t.encoding);if(typeof t=="string"){if(t==="utf8"||t==="utf-8")return o.slice(0,l).toString(t);throw new Error("Unsupported encoding: "+t)}return o.slice(0,l)}finally{i&&r&&await i.close()}}async writeFile(e,t,r){await this.logOperation?.({fsName:this.name,path:e.toString(),operation:"writeFile",operationArgs:{data:t,options:r}});let i=typeof e!="number",a,o,l,h="w";if(typeof r=="string"?o=r:r&&typeof r=="object"&&(o=r.encoding,l=r.mode,h=r.flag||"w"),typeof e=="number"){let c=this.getFilehandle(e);if(!c)throw new Error("Invalid file descriptor");a=c}else if(typeof e=="string")a=await this.open(e,h,l);else throw new Error("only filehandle and path are supported atm");try{let c;if(typeof t=="string")c=Buffer.from(t,o||"utf8");else if(t instanceof Buffer)c=t;else if(t instanceof Uint8Array)c=Buffer.from(t);else throw new Error("Invalid data type for writeFile");let d=0;for(;d<c.length;){let{bytesWritten:m}=await a.write(c,d,c.length-d,d);d+=m}}finally{a&&i&&await a.close()}}},w(q,"ye"),q);n(qe,"CompositeFs");var Ne=qe,X,Xe=(X=class extends te{constructor({name:e,parentFs:t,gitRoot:r,hiddenFiles:i}){super({name:e,parentFs:t,gitRoot:r}),F(this,"ig"),this.ig=kt(),this.ig.add(i)}async responsible(e){let t=e.replace(/\\/g,"/"),r=t.startsWith("./")?t.slice(2):t;return r=r.startsWith("/")?r.slice(1):r,r===""||r==="."?!1:this.ig.ignores(r)}fileType(){return 255}error(e){return new Error(`Access to hidden file is not allowed: ${this.toStr(e)}`)}async open(e,t,r){throw this.error(e)}async access(e){throw this.error(e)}async stat(e){throw this.error(e)}async lstat(e){throw this.error(e)}async opendir(e){throw this.error(e)}async link(e){throw this.error(e)}async mkdir(e){throw this.error(e)}async readdir(e){throw this.error(e)}async readlink(e){throw this.error(e)}async unlink(e){throw this.error(e)}async rename(e){throw this.error(e)}async rmdir(e){throw this.error(e)}async symlink(e,t){throw this.error(t)}async lookup(e){throw this.error(e)}resolvePath(e){throw new Error(`Access to hidden file is not allowed: resolvePath(${e})`)}async close(e){throw new Error("Access to hidden file is not allowed: close: "+e.subFsFileDescriptor)}async dataSync(e){throw new Error("Access to hidden file is not allowed: dataSync: "+e.subFsFileDescriptor)}async read(e,t,r,i,a){throw new Error("Access to hidden file is not allowed: readFileHandle: "+e.subFsFileDescriptor)}},w(X,"be"),X);n(Xe,"HiddenFileSubFs");var $e=Xe,Y,Ye=(Y=class extends te{constructor({name:e,parentFs:t,gitRoot:r,ephemeralPatterns:i}){super({name:e,parentFs:t,gitRoot:r}),F(this,"openFh",new Map),F(this,"memFs",Pt(new Rt)),F(this,"ig"),F(this,"patterns"),this.compositFs=t,this.gitRoot=r,this.ig=Nt(),this.ig.add(i),this.patterns=i}normalizePath(e){let t=typeof e=="string"?e:e.toString();return t.startsWith("/")?t:"/"+t}async responsible(e){let t=e.replace(/\\/g,"/"),r=t.startsWith("./")?t.slice(2):t;return r=r.startsWith("/")?r.slice(1):r,r===""||r==="."?!1:this.ig.ignores(r)}fileType(){return 5}async open(e,t,r){let i=this.normalizePath(e),a=ae.dirname(i);a&&a!=="/"&&a!=="."&&await this.memFs.promises.mkdir(a,{recursive:!0});let o=await this.memFs.promises.open(i,t,r);return this.openFh.set(o.fd,o),new le({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:o.fd,parentFsFileDescriptors:[o.fd]})}async access(e,t){let r=this.normalizePath(e);return await this.memFs.promises.access(r,t)}async stat(e,t){let r=this.normalizePath(e);return this.memFs.promises.stat(r,{bigint:!1})}async lstat(e,t){let r=this.normalizePath(e);return this.memFs.promises.lstat(r,{bigint:!1})}async opendir(e,t){let r=this.normalizePath(e);return await this.memFs.promises.opendir(r,t)}async link(e,t){let r=this.normalizePath(e),i=this.normalizePath(t);return await this.memFs.promises.link(r,i)}async mkdir(e,t){let r=this.normalizePath(e);if(!(typeof t=="object"&&t&&"recursive"in t&&t.recursive)){let i=ae.dirname(r);if(i&&i!=="/"&&i!==".")try{await this.memFs.promises.stat(i)}catch{await this.memFs.promises.mkdir(i,{recursive:!0})}}await this.memFs.promises.mkdir(r,t)}async readdir(e,...t){let r=this.normalizePath(e),i=await this.memFs.promises.readdir(r,...t);return console.log("EPHEMERAL: READDIR: ",i),i}async readlink(e){throw new Error("readlink is not implemented for EphemeralFileSubFs")}async unlink(e){let t=this.normalizePath(e);return await this.memFs.promises.unlink(t)}async rename(e,t){let r=this.normalizePath(e),i=this.normalizePath(t);return await this.memFs.promises.rename(r,i)}async rmdir(e,t){let r=this.normalizePath(e);return await this.memFs.promises.rmdir(r,t)}async symlink(e,t,r){let i=this.normalizePath(e),a=this.normalizePath(t);return await this.memFs.promises.symlink(i,a,r)}async lookup(e){throw new Error(`lookup is not implemented for: ${this.toStr(e)}`)}async close(e){let t=this.openFh.get(e.subFsFileDescriptor);t&&(await t.close(),this.openFh.delete(e.subFsFileDescriptor))}async dataSync(e){let t=this.openFh.get(e.subFsFileDescriptor);if(t)return await t.datasync()}async read(e,t,r,i,a){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.read(t,r,i,a);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async fchmod(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.chmod(t)}async fchown(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.chown(t,r)}async write(e,t,r,i,a){let o=this.openFh.get(e.subFsFileDescriptor);if(o)return await o.write(t,r,i,a);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async ftruncate(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.truncate(t)}resolvePath(e){throw new Error(`resolvePath is not implemented: resolvePath(${e})`)}async fstat(e,t){let r=this.openFh.get(e.subFsFileDescriptor);if(r)return await r.stat(t);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async futimes(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.utimes(t,r)}async writev(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.writev(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readv(e,t,r){let i=this.openFh.get(e.subFsFileDescriptor);if(i)return await i.readv(t,r??void 0);throw new Error(`File handle not found: ${e.subFsFileDescriptor}`)}async readFile(e,t){if(typeof e=="string"||Buffer.isBuffer(e)){let r=this.normalizePath(e);return this.memFs.promises.readFile(r,t)}return super.readFile(e,t)}async writeFile(e,t,r){let i=this.normalizePath(e),a=ae.dirname(i);return a&&a!=="/"&&a!=="."&&await this.memFs.promises.mkdir(a,{recursive:!0}),this.memFs.promises.writeFile(i,t,r)}},w(Y,"ve"),Y);n(Ye,"EphemeralSubFs");var Be=Ye,Ot=new Set([" ","~","^",":","?","*","[","\\"]),Tt=[/^\/|\/$/,/\/\//,/\.$/,/\.lock$/,/^@$/,/@\{/],Ze="\u2002";function ge(s){let e=s.codePointAt(0);return!(e>=0&&e<=31||e===127||Ot.has(s))}w(ge,"xe");n(ge,"isValidChar");function Qe(s){let e="";for(let t of s)t===" "?e+=Ze:ge(t)?e+=t:e+="%"+t.codePointAt(0);for(let t of Tt)if(t.test(e))return Array.from(e).map(r=>ge(r)?r:"%"+r.codePointAt(0)).join("");return e}w(Qe,"Me");n(Qe,"encodeName");function et(s){return s.replace(/%(\d+)/g,(e,t)=>String.fromCodePoint(parseInt(t,10))).replace(new RegExp(Ze,"g")," ")}w(et,"ze");n(et,"decodeName");function oe(s){return s.replace(/\./g,"%2E").replace(/\//g,".")}w(oe,"Q");n(oe,"encodeBranchNameForVfs");function T(s){return s.replace(/\./g,"/").replace(/%2E/g,".")}w(T,"N");n(T,"decodeBranchNameFromVfs");async function P(s,e,t){try{return await I.resolveRef({fs:s,dir:e,ref:`refs/heads/${T(t)}`})}catch{return}}w(P,"D");n(P,"tryResolveRef");async function A({dir:s,fs:e,treeOid:t,deletePathParts:r,addPathParts:i,addObj:a,addKeepIfEmpty:o,deleteKeepIfNotEmpty:l,keepFilename:h=".keep"}){let[c,...d]=i??[],[m,...u]=r??[],f=[];if(t){let{tree:v}=await I.readTree({fs:e,dir:s,oid:t});f=[...v]}if(c===m){let v=c;if(v===void 0)throw new Error("illegal arguement - called with out a path part");if(d.length===0)throw new Error("can not move into it self");if(u.length===0)throw new Error("can not move from it self");let k=f.findIndex(g=>g.path===v),y=(k!==-1?f[k]:void 0)?.oid,b=await A({dir:s,fs:e,treeOid:y,addPathParts:d,deletePathParts:u,addObj:a,addKeepIfEmpty:o,deleteKeepIfNotEmpty:l});if(b===void 0)throw new Error("on the same path we expect an update - respectivly a newly created subTreeOid");let p=!1;if(b!==y){p=!0;let g={mode:"040000",path:v,oid:b,type:"tree"};k!==-1?f[k]=g:f.push(g)}if(t==null&&!p)throw new Error("Illegal state - if the currentOid is undefined - a new tree should have been created (an update should have happened)");if(p)return await I.writeTree({fs:e,dir:s,tree:f});if(t===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return t}else{let v=!1,k;if(m){let y=f.findIndex(p=>p.path===m),b=y!==-1?f[y]:void 0;if(b===void 0)throw new Error("Element doesnt exist in tree");if(u.length>0){if(b&&b.type!=="tree")throw new Error("SubPart of the path for the obj to delete is not a tree");let p=await A({dir:s,fs:e,treeOid:b.oid,addPathParts:void 0,deletePathParts:u,addObj:a,addKeepIfEmpty:o,deleteKeepIfNotEmpty:l});if(p===b.oid)throw new Error("in case of a delete we expect a different subtree oid");v=!0,p===void 0?f.splice(y,1):f[y]={mode:"040000",path:m,oid:p,type:"tree"}}else if(v=!0,f.splice(y,1),f.length===0&&o){let p=new Uint8Array(0),g=await I.writeBlob({fs:e,dir:s,blob:p});f.push({mode:"100644",oid:g,path:h,type:"blob"})}k=b}if(c){let y=f.findIndex(p=>p.path===c),b=y!==-1?f[y]:void 0;if(d.length>0){if(b&&b.type!=="tree")throw new Error("SubPart of the path for the obj to add is not a tree");let p=await A({dir:s,fs:e,treeOid:b?.oid,addPathParts:d,deletePathParts:void 0,addObj:a,addKeepIfEmpty:o,deleteKeepIfNotEmpty:l});if(p===void 0)throw new Error("in case we add, we expect an update - respectivly a newly created subTreeOid");if(p!==b?.oid){v=!0;let g={mode:"040000",path:c,oid:p,type:"tree"};if(y!==-1)f[y]=g;else if(f.push(g),l&&f.length>1){let E=f.findIndex(N=>N.path===h);E!==-1&&f.splice(E,1)}}}else{if(v=!0,a){let p={mode:a.type==="tree"?"040000":"100644",path:c,oid:a.oid,type:a.type};if(y!==-1)f[y]=p;else{if(l&&f.length>0){let g=f.findIndex(E=>E.path===h);g!==-1&&f.splice(g,1)}f.push(p)}}if(o&&f.length===0){let p=new Uint8Array(0),g=await I.writeBlob({fs:e,dir:s,blob:p});f.push({mode:"100644",oid:g,path:h,type:"blob"})}}}if(f.length===0)return;if(v)return await I.writeTree({fs:e,dir:s,tree:f});if(t===void 0)throw new Error("currentOid should be set - since the sub tree didn't exist and ");return t}}w(A,"x");n(A,"buildUpdatedTree");async function j({filePath:s,gitRoot:e,nodeFs:t,commitSha:r,pathParams:i}){if(!i.filePath){let a=await I.readTree({fs:t,dir:e,oid:r});return{type:"tree",entries:a.tree.map(o=>H({parent:s,name:o.path,isDir:o.type==="tree"})),oid:a.oid}}return(await I.walk({fs:t,dir:e,trees:[I.TREE({ref:r})],map:n(async(a,[o])=>{if(a===i.filePath&&o){let l=await o.type();if(l==="blob")return{type:"blob",oid:await o.oid()};if(l=="tree"){let h=await I.readTree({fs:t,dir:e,oid:await o.oid()});return{type:"tree",entries:h.tree.map(c=>H({parent:s,name:c.path,isDir:c.type==="tree"})),oid:h.oid}}}},"map")})).find(a=>a!==void 0)}w(j,"_");n(j,"resolveGitObjAtPath");function H(s){return{name:s.name,isFile:n(()=>!s.isDir,"isFile"),isDirectory:n(()=>s.isDir,"isDirectory"),isBlockDevice:n(()=>!0,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isFIFO:n(()=>!1,"isFIFO"),isSocket:n(()=>!1,"isSocket"),parentPath:s.parent,path:s.parent}}w(H,"$");n(H,"toDirEntry");var tt={type:"gitBranchesListVirtualFile",rootType:"folder",getStats:n(async({gitRoot:s,nodeFs:e})=>{let t=s+"/.git";try{return await e.stat(t)}catch{throw new Error(`ENOENT: no such file or directory, stat '${t}'`)}},"getStats"),getFile:n(async({gitRoot:s,nodeFs:e,filePath:t})=>{try{let r=await Te.listBranches({fs:e,dir:s}),i=await Promise.all(r.map(async a=>{let o=await Te.resolveRef({fs:e,dir:s,ref:a});return H({parent:t,name:oe(a),isDir:!0})}));return{type:"directory",content:i,mode:493,size:i}}catch(r){throw r}},"getFile"),rename:n(async s=>{throw new Error("not implemented")},"rename"),mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},_,rt=(_=class extends Error{constructor(e,t){super(e),F(this,"code","ENOENT"),F(this,"path"),this.name="ENOENTError",this.path=t,Object.setPrototypeOf(this,_.prototype)}},w(_,"ne"),_);n(rt,"ENOENTError");var ye=rt;async function D(s,e){try{let t=await be.getConfig({fs:e,dir:s,path:"user.legit-current-branch"});if(t)return oe(t)}catch{}try{let t=await be.getConfig({fs:e,dir:s,path:"init.defaultBranch"});return oe(t)||"main"}catch{return"main"}}w(D,"b");n(D,"getCurrentBranch");async function it(s,e,t){await be.setConfig({fs:e,dir:s,path:"user.legit-current-branch",value:T(t)})}w(it,"We");n(it,"setCurrentBranch");var ne={type:"gitBranchFileVirtualFile",rootType:"folder",getStats:n(async({gitRoot:s,nodeFs:e,filePath:t,cacheFs:r,pathParams:i})=>{i.branchName===void 0&&(i.branchName=await D(s,e));let a=await P(e,s,i.branchName);if(!a)throw new ye(`ENOENT: no such file or directory, stat '${t}'`,t);let o=await j({filePath:t,gitRoot:s,nodeFs:e,commitSha:a,pathParams:i});if(!o)throw new ye(`ENOENT: no such file or directory, stat '${t}'`,t);let l=await S.readCommit({fs:e,dir:s,oid:a}),{commit:h}=l,c=await S.log({fs:e,dir:s,ref:a,filepath:i.filePath,depth:1}),d=h.committer.timestamp*1e3,m=c.length>0?c[0].commit.committer.timestamp*1e3:d;if(o.type==="tree")return{mode:420,size:0,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!0,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:m,mtimeMs:m,ctimeMs:m,birthtimeMs:d,atime:new Date(m),mtime:new Date(m),ctime:new Date(m),birthtime:new Date(m)};{let{blob:u}=await S.readBlob({fs:e,dir:s,oid:o.oid});return{mode:420,size:u.length,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(u.length/4096),atimeMs:m,mtimeMs:m,ctimeMs:m,birthtimeMs:m,atime:new Date(m),mtime:new Date(m),ctime:new Date(m),birthtime:new Date(m)}}},"getStats"),getFile:n(async({filePath:s,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:i})=>{i.branchName===void 0&&(i.branchName=await D(e,t));try{let a=await P(t,e,i.branchName);if(!a){let l=await S.resolveRef({fs:t,dir:e,ref:"HEAD"});await S.branch({fs:t,dir:e,ref:i.branchName,object:l}),a=await S.resolveRef({fs:t,ref:`refs/heads/${i.branchName}`,dir:e})}let o=await j({filePath:s,gitRoot:e,nodeFs:t,commitSha:a,pathParams:i});if(!o)return;if(o.type==="blob"){let{blob:l}=await S.readBlob({fs:t,dir:e,oid:o.oid});return{type:"file",content:Buffer.from(l),mode:420,size:l.length,oid:o.oid}}else{let l=[];try{let h=await r.promises.stat(s);if(h&&h.isDirectory()){let c=await r.promises.readdir(s,{withFileTypes:!0});l.push(...c)}}catch{}return{type:"directory",content:Array.from(new Set([...l,...o.entries])).map(h=>({...h,name:h.name.toString(),path:`${s}`,parentPath:`${s}`})),mode:493}}}catch{return}},"getFile"),unlink:n(async({filePath:s,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:i,author:a})=>{if(i.branchName===void 0&&(i.branchName=await D(e,t)),!i.filePath)throw new Error("filePath should be in pathParams");let o=await P(t,e,i.branchName);if(!o)throw new Error("Invalid branch file path - branch must exist");let l=await S.readTree({fs:t,dir:e,oid:o}),h=await A({dir:e,fs:t,treeOid:l.oid,deletePathParts:i.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(h!==l.oid){let c=await S.commit({fs:t,dir:e,message:`Delete ${i.filePath}`,tree:h,noUpdateBranch:!0,parent:[o],author:a});await S.writeRef({fs:t,dir:e,ref:`refs/heads/${T(i.branchName)}`,value:c,force:!0})}},"unlink"),writeFile:n(async({filePath:s,gitRoot:e,nodeFs:t,content:r,cacheFs:i,pathParams:a,author:o})=>{if(a.branchName===void 0&&(a.branchName=await D(e,t)),a.filePath===void 0)throw new Error("filePath should be in pathParams");let l;typeof r=="string"?l=new TextEncoder().encode(r):l=new Uint8Array(r);let h=await S.writeBlob({fs:t,dir:e,blob:l}),c=await P(t,e,a.branchName);if(!c){let u=await S.resolveRef({fs:t,dir:e,ref:"HEAD"});if(await S.branch({fs:t,dir:e,ref:T(a.branchName),object:u}),c=await P(t,e,a.branchName),!c)throw new Error("Could not create branch for writeFile")}let d=await S.readTree({fs:t,dir:e,oid:c}),m=await A({dir:e,fs:t,treeOid:d.oid,deletePathParts:void 0,addPathParts:a.filePath.split("/"),addObj:{type:"blob",oid:h},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!1,keepFilename:".keep"});if(m!==d.oid){let u=await S.commit({fs:t,dir:e,message:`\u{1F4BE} Change '${a.filePath}'`,tree:m,noUpdateBranch:!0,parent:[c],author:o});await S.writeRef({fs:t,dir:e,ref:`refs/heads/${T(a.branchName)}`,value:u,force:!0})}},"writeFile"),rename:n(async function({filePath:s,newPath:e,gitRoot:t,nodeFs:r,pathParams:i,newPathParams:a,author:o}){if(i.branchName===void 0&&(i.branchName=await D(t,r)),i.filePath===void 0)throw new Error("filePath should be in pathParams");if(a.branchName===void 0&&(a.branchName=await D(t,r)),a.filePath===void 0)throw new Error("filePath should be in newPathParams");let l=await P(r,t,i.branchName);if(!l)throw new Error("Invalid branch file path - source branch must exist");let h=await P(r,t,a.branchName);if(!h){let u=await S.resolveRef({fs:r,dir:t,ref:"HEAD"});if(await S.branch({fs:r,dir:t,ref:T(a.branchName),object:u}),h=await P(r,t,a.branchName),h===void 0)throw new Error("Could not create branch for rename operation")}if(a.branchName!==i.branchName)throw new Error("cross branch move not implemented yet");let c=await j({gitRoot:t,nodeFs:r,commitSha:l,filePath:s,pathParams:i});if(c===void 0)throw new Error("no obj at path exists");let d=await A({dir:t,fs:r,deletePathParts:i.filePath.split("/"),addPathParts:a.filePath.split("/"),addObj:c.type==="blob"?{type:"blob",oid:c.oid}:{type:"tree",oid:c.oid,entries:c.entries.map(u=>u.name.toString())},treeOid:h,addKeepIfEmpty:!0,deleteKeepIfNotEmpty:!0}),m=await S.readTree({fs:r,dir:t,oid:l});if(d!==m.oid){let u=await S.commit({fs:r,dir:t,message:`\u{1F500} Rename '${i.filePath}' to '${a.filePath}'`,tree:d,noUpdateBranch:!0,parent:[h],author:o});await S.writeRef({fs:r,dir:t,ref:`refs/heads/${T(a.branchName)}`,value:u,force:!0})}},"rename"),mkdir:n(async function(s){if(s.pathParams.branchName===void 0&&(s.pathParams.branchName=await D(s.gitRoot,s.nodeFs)),s.pathParams.filePath===void 0)throw new Error("filePath should be in pathParams");try{throw await ne.getStats(s),new Error("Folder exists")}catch{}s.filePath.endsWith("/")&&(s.filePath=s.filePath.replace(/\/+$/,"")),s.pathParams&&typeof s.pathParams.filePath=="string"&&(s.pathParams.filePath=s.pathParams.filePath.replace(/\/+$/,""));let e=await P(s.nodeFs,s.gitRoot,s.pathParams.branchName);if(!e){let o=await S.resolveRef({fs:s.nodeFs,dir:s.gitRoot,ref:"HEAD"});if(await S.branch({fs:s.nodeFs,dir:s.gitRoot,ref:T(s.pathParams.branchName),object:o}),e=await P(s.nodeFs,s.gitRoot,s.pathParams.branchName),e===void 0)throw new Error("Could not create branch for mkdir operation")}let t=await S.readTree({fs:s.nodeFs,dir:s.gitRoot,oid:e}),r=new Uint8Array(0),i=await S.writeBlob({fs:s.nodeFs,dir:s.gitRoot,blob:r}),a=await A({dir:s.gitRoot,fs:s.nodeFs,treeOid:t.oid,deletePathParts:void 0,addPathParts:[...s.pathParams.filePath.split("/"),".keep"],addObj:{type:"blob",oid:i},deleteKeepIfNotEmpty:!0,addKeepIfEmpty:!0,keepFilename:".keep"});if(a!==t.oid){let o=await S.commit({fs:s.nodeFs,dir:s.gitRoot,message:`\u{1F4BE} Change '${s.pathParams.filePath}'`,tree:a,noUpdateBranch:!0,parent:[e],author:s.author});await S.writeRef({fs:s.nodeFs,dir:s.gitRoot,ref:`refs/heads/${T(s.pathParams.branchName)}`,value:o,force:!0})}},"mkdir"),rmdir:n(async({filePath:s,gitRoot:e,nodeFs:t,cacheFs:r,pathParams:i,author:a})=>{if(i.branchName===void 0&&(i.branchName=await D(e,t)),!i.filePath)throw new Error("filePath should be in pathParams");let o=await P(t,e,i.branchName);if(!o)throw new Error("Invalid branch file path - branch must exist");let l=await S.readTree({fs:t,dir:e,oid:o}),h=await A({dir:e,fs:t,treeOid:l.oid,deletePathParts:i.filePath.split("/"),addPathParts:void 0,addObj:void 0,deleteKeepIfNotEmpty:!1,addKeepIfEmpty:!0,keepFilename:".keep"});if(h!==l.oid){let c=await S.commit({fs:t,dir:e,message:`Delete ${i.filePath}`,tree:h,noUpdateBranch:!0,parent:[o],author:a});await S.writeRef({fs:t,dir:e,ref:`refs/heads/${T(i.branchName)}`,value:c,force:!0})}},"rmdir")},ve={type:"gitBranchHeadVirtualFile",rootType:"file",getStats:n(async({gitRoot:s,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await D(s,e));let r;try{r=await M.resolveRef({fs:e,dir:s,ref:t.branchName})}catch{r=await M.resolveRef({fs:e,dir:s,ref:`refs/heads/${t.branchName}`})}let i=await M.readCommit({fs:e,dir:s,oid:r}),{commit:a}=i,o=a.committer.timestamp*1e3;return{mode:420,size:40,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:new Date(o),mtime:new Date(o),ctime:new Date(o),birthtime:new Date(o)}},"getStats"),getFile:n(async({gitRoot:s,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await D(s,e));try{let r;try{r=await M.resolveRef({fs:e,dir:s,ref:t.branchName})}catch{r=await M.resolveRef({fs:e,dir:s,ref:`refs/heads/${t.branchName}`})}return{type:"file",content:r+`
4
- `,mode:420,size:r.length}}catch{return}},"getFile"),writeFile:n(async({filePath:s,gitRoot:e,nodeFs:t,content:r,cacheFs:i,pathParams:a})=>{console.log("gitBranchHeadVirtualFile writeFile called",{pathParams:a,content:r}),a.branchName===void 0&&(a.branchName=await D(e,t));let o=r.toString().trim();try{await M.readCommit({fs:t,dir:e,oid:o})}catch{throw new Error(`Commit ${o} does not exist in the repository`)}await M.writeRef({fs:t,dir:e,ref:"refs/heads/"+a.branchName,value:o,force:!0})},"writeFile"),rename(s){throw new Error("not implementsd")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},Ct={type:"gitBranchTipVirtualFile",rootType:"file",getStats:n(async s=>{let e=s.gitRoot+"/.git";try{return await s.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:n(async({filePath:s,gitRoot:e,nodeFs:t,pathParams:r})=>{if(!r.branchName)throw new Error("branchName should be in pathParams");let i=await P(t,e,r.branchName);if(i!==void 0)return{type:"file",content:i+`
5
- `,mode:420,size:i.length+1}},"getFile"),rename(s){throw new Error("not implementsd")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},at={type:"gitCommitFileVirtualFile",rootType:"file",getStats:n(async({filePath:s,gitRoot:e,nodeFs:t,pathParams:r})=>{if(!r.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!r.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let i=r.sha_1_1_2+r.sha1_3__40,a=await j({filePath:s,gitRoot:e,nodeFs:t,commitSha:i,pathParams:r});if(!a)throw new ye(`ENOENT: no such file or directory, stat '${s}'`,s);let o=await me.readCommit({fs:t,dir:e,oid:i}),{commit:l}=o,h=l.committer.timestamp*1e3;if(a.type==="tree")return{mode:420,size:0,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!0,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0,atimeMs:h,mtimeMs:h,ctimeMs:h,birthtimeMs:h,atime:new Date(h),mtime:new Date(h),ctime:new Date(h),birthtime:new Date(h)};{let{blob:c}=await me.readBlob({fs:t,dir:e,oid:a.oid});return{mode:420,size:c.length,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(c.length/4096),atimeMs:h,mtimeMs:h,ctimeMs:h,birthtimeMs:h,atime:new Date(h),mtime:new Date(h),ctime:new Date(h),birthtime:new Date(h)}}},"getStats"),getFile:n(async({filePath:s,gitRoot:e,nodeFs:t,pathParams:r})=>{if(!r.sha_1_1_2)throw new Error("sha_1_1_2 should be in pathParams");if(!r.sha1_3__40)throw new Error("sha1_3__40 should be in pathParams");let i=r.sha_1_1_2+r.sha1_3__40;try{let a=await j({filePath:s,gitRoot:e,nodeFs:t,commitSha:i,pathParams:r});if(!a)return;if(a.type==="blob"){let{blob:o}=await me.readBlob({fs:t,dir:e,oid:a.oid});return{type:"file",content:Buffer.from(o),mode:420,size:o.length,oid:a.oid}}else return{type:"directory",content:Array.from(new Set([...a.entries.filter(o=>o.name!==".keep")])).map(o=>({...o,name:o.name.toString(),path:`${s}`,parentPath:`${s}`})),mode:493}}catch{return}},"getFile"),rename(s){throw new Error("not implementsd")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")};function st(s,e,t){return s===0&&e===2&&t===0?"untracked":s===1&&e===0&&t===0?"deleted":s===1&&e===2&&t!==0?"modified":s===0&&e===2&&t===2?"added":"unknown"}w(st,"gt");n(st,"getFileStatus");var It={type:"gitStatusVirtualFile",rootType:"file",getStats:n(async s=>{let e=s.gitRoot+"/.git";try{return await s.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:n(async({gitRoot:s,nodeFs:e})=>{try{let t=await fe.currentBranch({fs:e,dir:s})||"HEAD",r=await fe.resolveRef({fs:e,dir:s,ref:"HEAD"}),i=(await fe.statusMatrix({fs:e,dir:s})).filter(([,o,l,h])=>o!==l||l!==h).map(([o,l,h,c])=>({path:o,status:st(l,h,c)})),a=JSON.stringify({branch:t,commit:r,clean:i.length===0,files:i},null,2);return{type:"file",content:a,mode:33188,size:Buffer.byteLength(a)}}catch(t){throw console.error(t),t}},"getFile"),rename(s){throw new Error("not implementsd")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},Se={type:"legitVirtualFile",rootType:"folder",getStats:n(async({gitRoot:s,nodeFs:e})=>{let t=s+"/.git";try{return await e.stat(t)}catch{throw new Error(`ENOENT: no such file or directory, stat '${t}'`)}},"getStats"),getFile:n(async({gitRoot:s,nodeFs:e})=>{throw new Error("not implemented")},"getFile"),rename(s){throw new Error("not implemented")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},Lt=[Se,It,at,tt,ne,ve,Ct],Z,ot=(Z=class{constructor(e){this.routes=e,F(this,"compiledRoutes");let t={},r=n((i,a)=>{if(typeof i.type=="string"){t[a]={handler:i,siblings:[]};let o=i}else{let o=[];for(let[l,h]of Object.entries(i))if(l==="."){if(t[a])throw new Error(`Conflict: multiple handlers for path '${a}', '.' and optional '[[parameter_name]]' defined?`);t[a]={handler:h,siblings:o}}else if(l.startsWith("[[")&&l.endsWith("]]")){if(t[a])throw new Error(`Conflict: multiple handlers for path '${a}', '.' and optional '[[parameter_name]]' defined?`);t[a]={handler:h,siblings:o},l.startsWith("[[...")?t[a?`${a}/${l}`:l]={handler:h,siblings:[]}:r(h,a?`${a}/${l}`:l)}else l.startsWith("[")&&l.endsWith("]")?l.startsWith("[...")?t[a?`${a}/${l}`:l]={handler:h,siblings:[]}:r(h,a?`${a}/${l}`:l):(o.push({segment:l,type:h["."]?"folder":"file"}),r(h,a?`${a}/${l}`:l))}},"walk");r(e,""),this.compiledRoutes=Object.entries(t).map(([i,a])=>{let o=[],l=i.split("/").map(h=>{if(h.startsWith("[[")&&h.endsWith("]]")){let c=h.slice(2,-2).replace(/^\.\.\./,"");return o.push(c),"(.*)"}if(h.startsWith("[")&&h.endsWith("]")){let c=h.slice(1,-1);return o.push(c),"([^/]+)"}return h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("/");return{regex:new RegExp(`^${l}$`),paramNames:o,staticSiblings:a.siblings,handler:a.handler}})}match(e){e.length>1&&e.endsWith("/")&&(e=e.replace(/\/+$/,""));for(let{regex:t,paramNames:r,handler:i,staticSiblings:a}of this.compiledRoutes){let o=e.match(t);if(!o)continue;let l={};for(let h=0;h<r.length;h++)l[r[h]]=decodeURIComponent(o[h+1]||"");return{handler:i,params:l,staticSiblings:a}}}},w(Z,"Se"),Z);n(ot,"LegitPathRouter");var At=ot,Ce={type:"gitCommitVirtualFolder",rootType:"folder",getStats:n(async s=>{let e=s.gitRoot+"/.git";try{return await s.nodeFs.stat(e)}catch{throw new Error(`ENOENT: no such file or directory, stat '${e}'`)}},"getStats"),getFile:n(async({filePath:s,gitRoot:e,nodeFs:t,pathParams:r})=>{let i=await pe.listBranches({fs:t,dir:e}),a=new Set,o=new Set;for(let c of i){let d=`refs/heads/${c}`;try{let m=await pe.resolveRef({fs:t,dir:e,ref:d});a.add(m)}catch{}}for(let c of a){let d=await pe.log({fs:t,dir:e,ref:c});for(let m of d)o.add(m.oid)}if(!r.sha_1_1_2){let c=new Set;for(let m of o)if(c.add(m.slice(0,2)),c.size>=256)break;let d=Array.from(c).sort().map(m=>H({parent:s,name:m,isDir:!0}));return{type:"directory",content:d,mode:493,size:d}}let l=new Set;for(let c of o)c.startsWith(r.sha_1_1_2)&&l.add(c.slice(2,40));let h=Array.from(l).sort().map(c=>H({parent:s,name:c,isDir:!0}));return{type:"directory",content:h,mode:493,size:h.length}},"getFile"),rename(s){throw new Error("not implementsd")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},nt="-operation";async function O(s,e,t){return(await xt.listBranches({fs:s,dir:e})).filter(r=>r.endsWith("__"+t+nt))[0]}w(O,"O");n(O,"resolveOperationBranchName");var Ie={type:"gitBranchOperationVirtualFile",rootType:"file",getStats:n(async s=>{let{gitRoot:e,nodeFs:t,pathParams:r}=s;r.branchName===void 0&&(r.branchName=await D(e,t));let i;try{i=await B.resolveRef({fs:t,dir:e,ref:`refs/heads/${r.branchName}`})}catch{throw new Error(`Base Branch ${r.branchName} for operations does not exis`)}let a=await O(t,e,r.branchName),o=!1;if(a)try{i=await B.resolveRef({fs:t,dir:e,ref:a}),o=!0}catch{try{i=await B.resolveRef({fs:t,dir:e,ref:`refs/heads/${a}`}),o=!0}catch{}}let l=await B.readCommit({fs:t,dir:e,oid:i}),{commit:h}=l,c=h.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:n(async s=>{let{gitRoot:e,nodeFs:t,pathParams:r}=s;r.branchName===void 0&&(r.branchName=await D(e,t));let i=await O(t,e,r.branchName),a,o=!1;return i?(a=await B.resolveRef({fs:t,dir:e,ref:`refs/heads/${i}`}),o=!0):a=await B.resolveRef({fs:t,dir:e,ref:`refs/heads/${r.branchName}`}),{type:"file",content:Buffer.from(a),mode:420,size:a.length}},"getFile"),writeFile:n(async({filePath:s,gitRoot:e,nodeFs:t,content:r,cacheFs:i,pathParams:a,author:o})=>{a.branchName===void 0&&(a.branchName=await D(e,t));let l;typeof r=="string"?l=new TextEncoder().encode(r):l=new Uint8Array(r);let h=await B.writeBlob({fs:t,dir:e,blob:l}),c=await P(t,e,a.branchName);if(!c)throw new Error("Invalid branch file path - branch doesn't exist");let d=await O(t,e,a.branchName),m=!1;d||(d="legit/__"+a.branchName+nt,await B.branch({fs:t,dir:e,ref:d,object:c}),m=!0);let u=await B.resolveRef({fs:t,dir:e,ref:`refs/heads/${d}`}),f=await B.readTree({fs:t,dir:e,oid:c}),v;r instanceof ArrayBuffer?v=Buffer.from(r).toString("utf-8"):typeof r=="string"?v=r:r instanceof Uint8Array?v=Buffer.from(r).toString("utf-8"):v=String(r);let k=!1;if(!m){let b=await B.findMergeBase({fs:t,dir:e,oids:k?[u]:[u,c]});b.length===1&&b[0]===c&&(k=!0)}let y=await B.commit({fs:t,dir:e,message:v,tree:f.oid,noUpdateBranch:!0,author:o,parent:k?m?[c,c]:[u]:[u,c]});await B.writeRef({fs:t,dir:e,ref:`refs/heads/${d}`,value:y,force:!0})},"writeFile"),rename:n(async function({filePath:s,newPath:e,gitRoot:t,nodeFs:r,pathParams:i,newPathParams:a}){throw new Error("not implemented")},"rename"),mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},De={type:"gitBranchOperationsVirtualFile",rootType:"file",getStats:n(async s=>{let{gitRoot:e,nodeFs:t,pathParams:r}=s;r.branchName===void 0&&(r.branchName=await D(e,t));let i=await O(t,e,r.branchName),a,o=!1;if(i)try{a=await U.resolveRef({fs:t,dir:e,ref:i}),o=!0}catch{try{a=await U.resolveRef({fs:t,dir:e,ref:`refs/heads/${i}`}),o=!0}catch{throw new Error(`Base Branch ${r.branchName} for operations does not exis`)}}else try{a=await U.resolveRef({fs:t,dir:e,ref:`refs/heads/${r.branchName}`})}catch{throw new Error(`Base Branch ${r.branchName} for operations does not exis`)}let l=await U.readCommit({fs:t,dir:e,oid:a}),{commit:h}=l,c=h.committer.timestamp*1e3;try{return{mode:420,size:(o?await De.getFile(s):void 0)?.content?.length??0,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:n(async s=>{let{gitRoot:e,nodeFs:t,pathParams:r}=s;r.branchName===void 0&&(r.branchName=await D(e,t));let i=await O(t,e,r.branchName),a=[];if(i){let h=await U.resolveRef({fs:t,dir:e,ref:`refs/heads/${i}`}),c=!1,d=h;for(;d&&!c;){let m=await U.readCommit({fs:t,dir:e,oid:d});a.push({oid:m.oid,parentOids:m.commit.parent,message:m.commit.message,originBranchOid:"unset"}),d=m.commit.parent&&m.commit.parent.length>0?m.commit.parent[0]:null,m.commit.parent.length===2&&m.commit.parent[0]===m.commit.parent[1]&&(c=!0)}}let o;for(let h=a.length-1;h>=0;h--){let c=a[h];if(o===void 0){if(c.parentOids.length!==2&&c.parentOids[0]!==c.parentOids[1])throw new Error(`Operation commit ${c.oid} does not have two parents as expected`);o=c.parentOids[1]}c.parentOids.length===2&&(o=c.parentOids[1]),c.originBranchOid=o}let l=Buffer.from(JSON.stringify(a,null,2),"utf-8");return{type:"file",content:l,mode:420,size:l.length}},"getFile"),rename:n(async function(s){throw new Error("not implemented")},"rename"),mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},zt={type:"getThreadName",rootType:"file",getStats:n(async s=>{let{gitRoot:e,nodeFs:t,pathParams:r}=s,i;try{i=await ee.resolveRef({fs:t,dir:e,ref:`refs/heads/${r.branchName}`})}catch{throw new Error(`Base Branch ${r.branchName} for operations does not exis`)}let a=await O(t,e,r.branchName),o=!1;if(a)try{i=await ee.resolveRef({fs:t,dir:e,ref:a}),o=!0}catch{try{i=await ee.resolveRef({fs:t,dir:e,ref:`refs/heads/${a}`}),o=!0}catch{}}let l=await ee.readCommit({fs:t,dir:e,oid:i}),{commit:h}=l,c=h.committer.timestamp*1e3;try{return{mode:420,size:40,atimeMs:c,mtimeMs:c,ctimeMs:c,birthtimeMs:c,atime:new Date(c),mtime:new Date(c),ctime:new Date(c),birthtime:new Date(c),isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:0}}catch{throw new Error("ENOENT: no such file or directory, stat operationHistory")}},"getStats"),getFile:n(async s=>{let{gitRoot:e,nodeFs:t,pathParams:r}=s,i=await O(t,e,r.branchName),a;if(i){let o="legit/",l=`__${r.branchName}-operation`;return i.startsWith(o)&&i.endsWith(l)?a=i.slice(o.length,i.length-l.length):a=i,{type:"file",content:Buffer.from(et(a)),mode:420,size:a.length}}return{type:"file",content:Buffer.from(""),mode:420,size:0}},"getFile"),writeFile:n(async({filePath:s,gitRoot:e,nodeFs:t,content:r,cacheFs:i,pathParams:a})=>{if(a.branchName===void 0)throw new Error("branchName should be in pathParams");let o=await O(t,e,a.branchName);if(o){let l=`legit/${Qe(r.toString())}__${a.branchName}-operation`;await ee.renameBranch({fs:t,dir:e,oldref:o,ref:l}),o=l}},"writeFile"),rename:n(async function({filePath:s,newPath:e,gitRoot:t,nodeFs:r,pathParams:i,newPathParams:a}){throw new Error("not implemented")},"rename"),mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},Ae={type:"gitBranchHistory",rootType:"file",getStats:n(async({gitRoot:s,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await D(s,e));let r=await P(e,s,t.branchName);if(!r)throw new Error(`Branch ${t.branchName} does not exist`);let i=await Le.readCommit({fs:e,dir:s,oid:r}),{commit:a}=i,o=a.committer.timestamp*1e3;return{mode:420,size:1e5,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:o,mtimeMs:o,ctimeMs:o,birthtimeMs:o,atime:new Date(o),mtime:new Date(o),ctime:new Date(o),birthtime:new Date(o)}},"getStats"),getFile:n(async s=>{let{gitRoot:e,nodeFs:t,pathParams:r}=s,i=r.branchName;i===void 0&&(i=await D(e,t));let a=[];if(i){let l=await P(t,e,i),h=!1,c=l;for(;c&&!h;){let d=await Le.readCommit({fs:t,dir:e,oid:c});a.push({oid:d.oid,...d.commit}),c=d.commit.parent[0]}}let o=Buffer.from(JSON.stringify(a,null,2),"utf-8");return{type:"file",content:o,mode:420,size:o.length}},"getFile"),rename:n(async s=>{throw new Error("not implemented")},"rename"),mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},xe={type:"gitBranchOperationHeadVirtualFile",rootType:"file",getStats:n(async({gitRoot:s,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await D(s,e));let r=await O(e,s,t.branchName);if(!r){let h=new Date(0);return{mode:420,size:0,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:h.getTime(),mtimeMs:h.getTime(),ctimeMs:h.getTime(),birthtimeMs:h.getTime(),atime:h,mtime:h,ctime:h,birthtime:h}}let i;try{i=await L.resolveRef({fs:e,dir:s,ref:r})}catch{i=await L.resolveRef({fs:e,dir:s,ref:`refs/heads/${r}`})}let a=await L.readCommit({fs:e,dir:s,oid:i}),{commit:o}=a,l=o.committer.timestamp*1e3;return{mode:420,size:40,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(40/4096),atimeMs:l,mtimeMs:l,ctimeMs:l,birthtimeMs:l,atime:new Date(l),mtime:new Date(l),ctime:new Date(l),birthtime:new Date(l)}},"getStats"),getFile:n(async({gitRoot:s,nodeFs:e,pathParams:t})=>{t.branchName===void 0&&(t.branchName=await D(s,e));let r=await O(e,s,t.branchName);if(!r)return{type:"file",content:"",mode:420,size:0};try{let i;try{i=await L.resolveRef({fs:e,dir:s,ref:r})}catch{i=await L.resolveRef({fs:e,dir:s,ref:`refs/heads/${r}`})}return{type:"file",content:i+`
6
- `,mode:420,size:i.length}}catch{return}},"getFile"),writeFile:n(async({filePath:s,gitRoot:e,nodeFs:t,content:r,cacheFs:i,pathParams:a})=>{a.branchName===void 0&&(a.branchName=await D(e,t));let o=await O(t,e,a.branchName),l=await L.resolveRef({fs:t,dir:e,ref:`refs/heads/${o}`});if(!o)throw new Error(`Operation branch name could not be resolved for branch ${a.branchName}`);let h=r.toString().trim(),c,d,m=!1;if(!l)throw new Error(`Operation branch ref could not be resolved for branch ${o}`);let u=l;for(;u&&!m;){let f=await L.readCommit({fs:t,dir:e,oid:u});if(f.oid===h&&(c=f.oid),u=f.commit.parent&&f.commit.parent.length>0?f.commit.parent[0]:null,f.commit.parent.length===2){if(f.commit.parent[0]===f.commit.parent[1])m=!0;else if(c!==void 0){d=f.commit.parent[1];break}}}if(c===void 0)throw new Error(`Cant rollback to ${h} couldn't find newOperationBranchHead ${c}`);if(d===void 0)throw new Error(`Cant rollback to ${h} couldn't find newBranchHead ${d}`);await L.writeRef({fs:t,dir:e,ref:"refs/heads/"+o,value:c,force:!0}),await L.writeRef({fs:t,dir:e,ref:"refs/heads/"+a.branchName,value:d,force:!0})},"writeFile"),rename(s){throw new Error("not implementsd")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},Mt={type:"gitCurrentBranchVirtualFile",rootType:"folder",getStats:n(async({gitRoot:s,nodeFs:e})=>{let t=(await D(s,e)).length;return{mode:420,size:t,isFile:n(()=>!0,"isFile"),isDirectory:n(()=>!1,"isDirectory"),isSymbolicLink:n(()=>!1,"isSymbolicLink"),isBlockDevice:n(()=>!1,"isBlockDevice"),isCharacterDevice:n(()=>!1,"isCharacterDevice"),isSocket:n(()=>!1,"isSocket"),isFIFO:n(()=>!1,"isFIFO"),isFileSync:n(()=>!0,"isFileSync"),isDirectorySync:n(()=>!1,"isDirectorySync"),dev:0,ino:0,nlink:1,uid:0,gid:0,rdev:0,blksize:4096,blocks:Math.ceil(t/4096),atimeMs:Date.now(),mtimeMs:Date.now(),ctimeMs:Date.now(),birthtimeMs:Date.now(),atime:new Date,mtime:new Date,ctime:new Date,birthtime:new Date}},"getStats"),getFile:n(async({gitRoot:s,nodeFs:e})=>{let t=await D(s,e);return{type:"file",content:t+`
7
- `,mode:420,size:t.length+1}},"getFile"),writeFile:n(async({gitRoot:s,nodeFs:e,content:t})=>{let r=t.toString().trim();if(!await P(e,s,r))throw new Error(`Branch ${r} does not exist in the repository`);await it(s,e,r)},"writeFile"),rename(s){throw new Error("not implemented")},mkdir:n(async function(s){throw new Error("not implemented")},"mkdir")},C,se=(C=class extends te{constructor({name:e,parentFs:t,gitStorageFs:r,gitRoot:i,virtualFiles:a=Lt}){super({name:e,parentFs:t,gitRoot:i}),F(this,"memFs"),F(this,"openFh",{}),F(this,"virtualFiles"),F(this,"legitFileNames"),F(this,"storageFs"),this.gitRoot=i,this.storageFs=r,this.memFs=$t(new Bt),this.virtualFiles=a,this.legitFileNames=["branches","commits"]}async getAuthor(){let e=await Oe.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.name"}),t=await Oe.getConfig({fs:this.storageFs,dir:this.gitRoot,path:"user.email"}),r=Math.floor(Date.now()/1e3),i=new Date().getTimezoneOffset();return{name:e,email:t,date:r,timezoneOffset:i}}async responsible(e){return!0}isLegitPath(e){return e.includes(`/${C.LEGIT_DIR}/`)||e.includes(`/${C.LEGIT_DIR}`)}getRouteHandler(e){let t=e;this.gitRoot&&e.startsWith(this.gitRoot)&&(this.gitRoot==="/"?t=e.slice(this.gitRoot.length):t=e.slice(this.gitRoot.length+1));let r=t.indexOf(`/${C.LEGIT_DIR}`);if(r===-1)return C.pathRouter.match(t);let i=t.slice(r+1);return C.pathRouter.match(t)}async open(e,t,r){let i=this.getRouteHandler(e);if(!i)throw new Error("Not a virtual legit file");if(i?.handler.writeFile===void 0&&(t.includes("w")||t.includes("a")))throw new Error(`Write operations not allowed for ${i?.handler.type}`);if(t.includes("x")&&i?.handler.type!=="gitBranchFileVirtualFile")throw new Error(`Exclusive operations not allowed for ${i?.handler.type}`);let a=await i.handler.getFile({cacheFs:this.memFs,filePath:e,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:i.params,author:await this.getAuthor()}),o=!1;for(let m of Object.values(this.openFh))m.path===e&&(o=!0);if((a||o)&&t.includes("x"))throw Object.assign(new Error(`EEXIST: file already exists, open '${e}'`),{code:"EEXIST",errno:-17,syscall:"open",path:e});if(!a&&!o&&!(t.includes("w")||t.includes("a")))throw Object.assign(new Error(`ENOENT: no such file or directory, open '${e}'`),{code:"ENOENT",errno:-2,syscall:"open",path:e});let l=Fe.dirname(e);if(await this.memFs.promises.mkdir(l,{recursive:!0}),a===void 0&&!t.includes("x")||a&&a.type==="file")try{let m=await this.memFs.promises.access(e)}catch{await this.memFs.promises.writeFile(e,"")}let h=await this.memFs.promises.open(e,t,r),c=h.fd,d=new le({fs:this,compositeFs:this.compositFs,subFsFileDescriptor:c,parentFsFileDescriptors:[]});return this.openFh[c]={path:e,mode:t,fh:h,openSha:a?.oid,readSha:void 0,unflushed:[]},(t.includes("x")||t.includes("w"))&&this.openFh[c].unflushed.push({length:0,start:0}),d}async mkdir(e,t){let r=e.toString(),i=this.getRouteHandler(r),a=t?{options:t}:{};try{await i?.handler.mkdir({cacheFs:this.memFs,filePath:e.toString(),nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:i.params,...a,author:await this.getAuthor()});let o=typeof t=="object"?{...t,recursive:!0}:{recursive:!0};await this.memFs.promises.mkdir(e,o);let l=r.split("/"),h="";for(let c=1;c<=l.length;c++){h=l.slice(0,c).join("/");try{if((await this.memFs.promises.stat(h)).isDirectory()){let d=await this.memFs.promises.open(h,"r");this.openFh[d.fd]={path:h,mode:"r",fh:d,openSha:void 0,readSha:void 0,unflushed:[]}}}catch{}}}catch(o){throw o}}async access(e,t){await this.stat(e)}async futimes(e,t,r){let i=this.openFh[e.subFsFileDescriptor];if(!i)throw new Error("Invalid file handle");return await i.fh.utimes(t,r)}async fstat(e,t){let r=this.openFh[e.subFsFileDescriptor];if(!r)throw new Error("Invalid file handle");return this.stat(r.path,t)}async ftruncate(e,t){let r=this.openFh[e.subFsFileDescriptor];if(!r)throw new Error("Invalid file handle");return r.unflushed.push({length:0,start:0}),await r.fh.truncate(t)}async stat(e,t){let r=e.toString(),i=Object.values(this.openFh).find(o=>o.path===r&&o.unflushed.length>0);if(i&&i.unflushed.length>0)return await i.fh.stat(t);let a=this.getRouteHandler(r);if(!a)throw new Error(`ENOENT: no such file or directory, stat '${r}'`);return await a.handler.getStats({cacheFs:this.memFs,filePath:r,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:a.params,author:await this.getAuthor()})}async lstat(e,t){return this.stat(e,t)}async readdir(e,t){let r=e.toString(),i=this.getRouteHandler(r);if(!i)throw new Error(`ENOENT: no such file or directory, scandir '${r}'`);let a=await i?.handler.getFile({cacheFs:this.memFs,filePath:r,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:i.params,author:await this.getAuthor()});if(a){if(a.type!=="directory")throw new Error("not a folder");let o=i?.staticSiblings??[],l=Array.from(new Set([...a.content,...o.map(h=>H({name:h.segment,parent:r,isDir:h.type==="folder"}))])).sort((h,c)=>h.name.localeCompare(c.name,void 0,{numeric:!0,sensitivity:"base"}));return t?.withFileTypes?l:l.map(h=>h.name)}return[]}async read(e,t,r,i,a){let o=e.subFsFileDescriptor,l=this.openFh[o];if(!l)throw new Error("Invalid file handle");if(l.unflushed.length===0){let h=this.getRouteHandler(l.path),c=await h.handler.getFile({cacheFs:this.memFs,filePath:l.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:h?.params,author:await this.getAuthor()});if(!c?.content)throw new Error("couldnt access content");if(c.type!=="file")throw new Error("not a file");let d=typeof c.content=="string"?Buffer.from(c.content):c.content,m=typeof a=="number"?a:0,u=Math.min(m+i,d.length),f=Math.max(0,u-m);return d.copy(t,r,m,m+f),{bytesRead:f,buffer:t}}return await l.fh.read(t,r,i,a)}async write(e,t,r,i,a){let o=this.openFh[e.subFsFileDescriptor];if(!o)throw new Error("Invalid file handle");let l=o.mode;if(!l.includes("w")&&!l.includes("a")&&!l.includes("+"))throw Object.assign(new Error("EBADF: bad file descriptor, write"),{code:"EBADF",errno:-9,syscall:"write"});if(o.unflushed.length===0){let m=this.getRouteHandler(o.path),u=await m.handler.getFile({cacheFs:this.memFs,filePath:o.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,pathParams:m.params,author:await this.getAuthor()});u&&u.oid&&(await this.memFs.promises.writeFile(o.path,u.content),o.readSha=u.oid)}let h=await o.fh.write(t,r,i,a),c=r??0,d=a??0;return o.unflushed.push({start:d,length:i||t.byteLength-c+d}),h}async close(e){let t=e.subFsFileDescriptor,r=this.openFh[t];if(!r)throw new Error("Invalid file handle");try{await this.dataSync(e),await r.fh.close()}finally{delete this.openFh[t]}}async dataSync(e){let t=e.subFsFileDescriptor,r=this.openFh[t];if(!r)throw new Error("Invalid file handle");if(r.unflushed.length>0){let i=this.getRouteHandler(r.path);if(i&&i.handler.writeFile){let a=await this.memFs.promises.readFile(r.path);await i.handler.writeFile({cacheFs:this.memFs,filePath:r.path,gitRoot:this.gitRoot,nodeFs:this.storageFs,content:a,pathParams:i.params,author:await this.getAuthor()})}r.unflushed=[]}}async readFile(e,t){let r=typeof e=="string"?e:Buffer.isBuffer(e)?e.toString():e.fd?`FileHandle(${e.fd})`:e.toString(),i=null;typeof t=="string"?i=t:t&&typeof t=="object"&&t.encoding&&(i=t.encoding);let a=await this.open(r,"r");try{let o=(await this.fstat(a)).size,l=Buffer.alloc(o);return await this.read(a,l,0,o,0),await this.close(a),i?l.toString(i):l}catch(o){try{await this.close(a)}catch{}throw o}}async writeFile(e,t,r){let i="w",a="utf8",o;typeof r=="string"?a=r:r&&typeof r=="object"&&(r.flag&&(i=String(r.flag)),r.encoding&&(a=r.encoding),r.mode&&(o=typeof r.mode=="string"?parseInt(r.mode,8):r.mode));let l=await this.open(e,i,o);try{let h;typeof t=="string"?h=Buffer.from(t,a):Buffer.isBuffer(t)?h=t:t instanceof Uint8Array?h=Buffer.from(t):ArrayBuffer.isView(t)?h=Buffer.from(t.buffer,t.byteOffset,t.byteLength):h=Buffer.from(t),await this.write(l,h,0,h.length,0)}finally{await this.close(l)}}async rename(e,t){let r=e.toString(),i=t.toString(),a=this.getRouteHandler(r),o=this.getRouteHandler(i);if(a?.handler.type==="gitBranchFileVirtualFile"&&o?.handler.type==="gitBranchFileVirtualFile"){let l=!0;try{await this.memFs.promises.access(i)}catch{l=!1}let h=!0;try{await this.stat(i)}catch{h=!1}let c=!0;try{await this.stat(r)}catch{c=!1}let d=!0;try{await this.memFs.promises.access(r)}catch{d=!1}if(d){let f=Fe.dirname(i);try{await this.memFs.promises.access(f)}catch{await this.memFs.promises.mkdir(f,{recursive:!0})}await this.memFs.promises.rename(e,t)}let m=this.getRouteHandler(r);if(!m)throw new Error("VF not found");let u=await m.handler.rename({cacheFs:this.memFs,filePath:r,gitRoot:this.gitRoot,nodeFs:this.storageFs,newPath:i,pathParams:m?.params??{},newPathParams:o?.params??{},author:await this.getAuthor()})}else throw new Error(`Unsupported rename operation from ${a?.handler.type} to ${o?.handler.type}`)}async fchmod(e,t){}async unlink(e){let t=e.toString(),r=this.getRouteHandler(t);if(r?.handler.unlink!==void 0)try{await r.handler.unlink({cacheFs:this.memFs,filePath:t,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:r.params,author:await this.getAuthor()})}catch(i){let a=!1;for(let[o,l]of Object.entries(this.openFh))l.path===t&&l.unflushed.length>0&&(a=!0);if(!a)throw i}finally{let i=!1;for(let[a,o]of Object.entries(this.openFh))o.path===t&&(i=!0,await o.fh.close(),delete this.openFh[Number(a)]);i&&await this.memFs.promises.unlink(t)}else throw new Error(`Cannot unlink ${r?.handler.type} files`)}async rmdir(e,...t){let r=e.toString(),i=this.getRouteHandler(r);if(i?.handler.rmdir!==void 0){await i.handler.rmdir({cacheFs:this.memFs,filePath:r,nodeFs:this.storageFs,gitRoot:this.gitRoot,pathParams:i.params,author:await this.getAuthor()});let a=!1;for(let[o,l]of Object.entries(this.openFh))l.path===r&&(a=!0,await l.fh.close(),delete this.openFh[Number(o)]);a&&await this.memFs.promises.rmdir(r,{recursive:!0})}else throw new Error(`Cannot rmdir
8
- ${i?.handler.type} directories`)}fileType(){return 10}},w(C,"V"),C);n(se,"GitSubFs"),F(se,"LEGIT_DIR",".legit"),F(se,"pathRouter",new At({".legit":{".":Se,operation:Ie,head:ve,operationHead:xe,operationHistory:De,history:Ae,currentBranch:Mt,branches:{".":tt,"[branchName]":{".legit":{".":Se,operation:Ie,head:ve,operationHead:xe,operationHistory:De,history:Ae,threadName:zt},"[[...filePath]]":ne}},commits:{".":Ce,"[sha_1_1_2]":{".":Ce,"[sha1_3__40]":{"[[...filePath]]":at}}}},"[[...filePath]]":ne}));var _t=se,z="legit",Ht=n(({fs:s,gitRepoPath:e,serverUrl:t="https://hub.legitcontrol.com",auth:r,anonymousBranch:i,authHeaderPrefix:a="Bearer "})=>{let o=!1;async function l(y){let b=await r.getMaxAccessTokenForBranch(y);if(!b)throw new Error(`No access token for branch ${y}`);await $.fetch({fs:s,http:we,dir:e,singleBranch:!0,ref:`${y}`,remote:z,url:t,headers:{Authorization:`${a}${b}`}});let p=await $.resolveRef({fs:s,dir:e,ref:`${z}/${y}`});await $.writeRef({fs:s,dir:e,ref:`refs/heads/${y}`,value:p})}w(l,"l"),n(l,"loadBranch");let h=[];async function c(){let y=await r.getMaxAccessTokenForBranch("todo");await $.fetch({fs:s,http:we,dir:e,remote:z,url:t,headers:{Authorization:`${a}${y}`}});let b=await $.listBranches({fs:s,dir:e});for(let p of b){if(p===i)continue;let g=`${z}/${p}`,E,N;try{E=await $.resolveRef({fs:s,dir:e,ref:p})}catch(x){console.log(`Could not resolve local ref ${p}:`,x)}try{N=await $.resolveRef({fs:s,dir:e,ref:g})}catch{N=void 0}if(E&&N){if(E!==N){let x=await $.findMergeBase({fs:s,dir:e,oids:[E,N]});if(x[0]!==E&&x[0]!==N){let re=await $.merge({fs:s,dir:e,ours:E,theirs:N,fastForwardOnly:!1,abortOnConflict:!1,author:{name:"Your Name",email:"your.email@example.com"},mergeDriver:n(async({branches:ie,contents:Q,path:de})=>{let[er,ut,Re]=Q;return console.log(`Merging ${ie[0]} with ${ie[1]}...`),console.log("merged:"),console.log(Q),{cleanMerge:!0,mergedText:Re===void 0?ut:Re}},"mergeDriver")});await $.writeRef({fs:s,dir:e,ref:`refs/heads/${p}`,value:re.oid,force:!0})}x[0]===E?(console.log(`branch ${p} differs - remote ahaed, not behind`),await $.writeRef({fs:s,dir:e,ref:`refs/heads/${p}`,value:N,force:!0})):x[0]===N?(console.log(`branch ${p} differs - local ahead, not behind`),h.push(p)):(console.log(`branch ${p} differs - both changed`),h.push(p))}}else E&&!N&&h.push(p)}}w(c,"m"),n(c,"pull");async function d(y){if((await r.getUser()).type!=="local")for(let b of y){let p=await r.getMaxAccessTokenForBranch(b);await $.push({fs:s,http:we,dir:e,remote:z,url:t,ref:b,headers:{Authorization:`Bearer ${p}`}})}}w(d,"c"),n(d,"push");let m=Promise.resolve();async function u(y){m=m.then(()=>d(y)),await m}w(u,"u"),n(u,"sequentialPush");async function f(){await $.getConfig({fs:s,dir:e,path:`remote.${z}.fetch`})||await $.setConfig({fs:s,dir:e,path:`remote.${z}.fetch`,value:`+refs/heads/*:refs/remotes/${z}/*`});try{await c();let y=[...new Set(h)].filter(b=>b.indexOf(i)===-1);await u(y),h=[]}catch(y){console.error("Error monitoring changes:",y)}finally{o&&setTimeout(f,1e3)}}w(f,"h"),n(f,"pullPushTick");function v(){o=!0,f()}w(v,"g"),n(v,"startSync");function k(){o=!1}return w(k,"T"),n(k,"stopSync"),{start:n(()=>{o||(v(),o=!0)},"start"),stop:n(()=>{k()},"stop"),isRunning:n(()=>o,"isRunning"),loadBranch:l,sequentialPush:u}},"createLegitSyncService"),Vt=n((s,e)=>{let t={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"};return{getUser:n(async()=>t,"getUser"),signInAnonymously:n(async()=>{t.type="anonymous",t.id=crypto.randomUUID(),t.email=`anonymous-sha1-${t.id}-@legitcontrol.com`},"signInAnonymously"),addAccessToken:n(async r=>{let i=await s.getUserTokens(t.id);i.accessTokens.push(r),await s.setUserTokens(t.id,i)},"addAccessToken"),getMaxAccessTokenForBranch:n(async r=>{let i=await s.getUserTokens(t.id);if(!(i.accessTokens===void 0||i.accessTokens.length===0))return i.accessTokens[0]},"getMaxAccessTokenForBranch")}},"createSessionManager");function lt(s){let e=JSON.stringify(s),t=new TextEncoder().encode(e),r="";return typeof btoa=="function"?r=btoa(String.fromCharCode(...t)):r=Buffer.from(t).toString("base64"),r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}w(lt,"Ze");n(lt,"encodeConfigJson");function ht(s){let e=s.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((s.length+3)%4),t;typeof atob=="function"?t=atob(e):t=Buffer.from(e,"base64").toString("binary");let r=Uint8Array.from(t,a=>a.charCodeAt(0)),i=new TextDecoder().decode(r);return JSON.parse(i)}w(ht,"et");n(ht,"decodeConfigJson");var Me="user.legit-tokens";function ct({storageFs:s,gitRoot:e}){return{getUserTokens:n(async t=>{let r=await ze.getConfig({fs:s,dir:e,path:Me});return r?ht(r):{accessTokens:[]}},"getUserTokens"),setUserTokens:n(async(t,r)=>await ze.setConfig({fs:s,dir:e,path:Me,value:lt(r)}),"setUserTokens")}}w(ct,"rt");n(ct,"createGitConfigTokenStore");async function Ee(s){let e=new jt,t=Ut(e);return dt({...s,storageFs:s?.storageFs?s.storageFs:t,gitRoot:s?.gitRoot||"/"})}w(Ee,"$s");n(Ee,"openLegitFsWithMemoryFs");async function dt({storageFs:s,gitRoot:e,anonymousBranch:t="anonymous",showKeepFiles:r=!1,initialAuthor:i={type:"local",id:"local",name:"Local User",email:"local@legitcontrol.com"},serverUrl:a="https://sync.legitcontrol.com",publicKey:o}){await s.promises.readdir(e+"/.git").then(()=>!0).catch(()=>!1)||(await R.init({fs:s,dir:"/",defaultBranch:t}),await s.promises.writeFile(e+"/.keep",""),await R.add({fs:s,dir:"/",filepath:".keep"}),await R.commit({fs:s,dir:"/",message:"Initial commit",author:{name:"Test",email:"test@example.com"}}),await R.setConfig({fs:s,dir:e,path:"init.defaultBranch",value:t})),await R.getConfig({fs:s,dir:e,path:"user.legit_user_id"})||await R.setConfig({fs:s,dir:e,path:"user.legit_user_id",value:i.name}),await R.getConfig({fs:s,dir:e,path:"user.name"})||await R.setConfig({fs:s,dir:e,path:"user.name",value:i.name}),await R.getConfig({fs:s,dir:e,path:"user.email"})||await R.setConfig({fs:s,dir:e,path:"user.email",value:i.email});let l=new Ne({name:"root",parentFs:void 0,storageFs:s,gitRoot:e}),h=new Be({name:"root-ephemeral",parentFs:l,gitRoot:e,ephemeralPatterns:[]}),c=new $e({name:"root-hidden",parentFs:l,gitRoot:e,hiddenFiles:[]});l.setHiddenFilesSubFs(c),l.setEphemeralFilesSubFs(h);let d=new Ne({name:"git",parentFs:l,storageFs:void 0,gitRoot:e,defaultBranch:t}),m=new _t({name:"git-subfs",parentFs:d,gitRoot:e,gitStorageFs:l}),u=r?[".git"]:[".git",".keep"],f=new $e({name:"git-hidden-subfs",parentFs:d,gitRoot:e,hiddenFiles:u}),v=new Be({name:"git-ephemeral-subfs",parentFs:d,gitRoot:e,ephemeralPatterns:["**/._*","**/.DS_Store","**/.AppleDouble/","**/.AppleDB","**/.AppleDesktop","**/.Spotlight-V100","**/.TemporaryItems","**/.Trashes","**/.fseventsd","**/.VolumeIcon.icns","**/.ql_disablethumbnails","**/.~lock.*","**/lu[0-9a-zA-Z]*.tmp","**/.metaentries.json.tmp","**/**.sb-**"]});d.addSubFs(m),d.setHiddenFilesSubFs(f),d.setEphemeralFilesSubFs(v);let k=ct({storageFs:s,gitRoot:e}),y=Vt(k,o),b=Ht({fs:s,gitRepoPath:e,serverUrl:a,auth:y,anonymousBranch:t}),p=Object.assign(d,{auth:y,sync:b,setLogger(g){l.setLoggger(g),d.setLoggger(g)},push:n(async g=>{},"push"),shareCurrentBranch:n(async()=>{if((await y.getUser()).type==="local")throw new Error("login first - for example anonymously using legitfs.auth.signInAnonymously()");let g=await p.getCurrentBranch();return g===t&&(g=(await y.getUser()).id,await R.renameBranch({fs:s,dir:e,oldref:t,ref:g})),await b.sequentialPush([g]),p.setCurrentBranch(g),g},"shareCurrentBranch"),setCurrentBranch:n(async g=>{(await R.listBranches({fs:s,dir:e})).includes(g)||await b?.loadBranch(g);let E=(await R.listBranches({fs:s,dir:e})).includes(g);if(console.log("branchExistsAfter",E),!E)throw new Error(`Branch ${g} does not exist`);await R.setConfig({fs:s,dir:e,path:"init.defaultBranch",value:g})},"setCurrentBranch"),getCurrentBranch:n(async()=>{let g=await R.getConfig({fs:s,dir:e,path:"init.defaultBranch"});if(!g)throw new Error("No current branch set");return g},"getCurrentBranch")});return p}w(dt,"kt");n(dt,"openLegitFs");var Nr=n(s=>async e=>{if(!e.path.includes(".legit/branches/")||(e.path.match(/\.legit/g)||[]).length>1)return;let[t,r]=e.path.split(".legit/branches/"),[i,...a]=r.split("/"),o=a.join("/"),l=t+".legit/branches/"+i+"/.legit/operation",h=JSON.stringify(e.operationArgs,(c,d)=>Buffer.isBuffer(d)?{__buffer__:d.toString("base64")}:d);await s.writeFile(l,`[${e.fsName}].${e.operation}(${e.fd?e.fd.fd+" - ":""}${e.path})
9
-
10
- ${h}
11
-
12
- `)},"createFsOperationFileLogger");import{jsx as Yt}from"react/jsx-runtime";var ft=Wt({legitFs:null,loading:!0,head:null,rollback:w(async()=>{},"rollback")}),ke=w(()=>Kt(ft),"useLegitContext"),Jt={gitRoot:"/"},qt=100,Xt=w(({children:s,config:e=Jt})=>{let[t,r]=he(!0),[i,a]=he(null),o=Gt(null),[l,h]=he(),[c,d]=he(null);mt(()=>{if(!t)return;w(async()=>{try{let f=await Ee({gitRoot:e.gitRoot,serverUrl:e.serverUrl,publicKey:e.publicKey});e.publicKey&&(await f.auth.addAccessToken(e.publicKey),f.sync.start()),f&&a(f)}catch(f){h(f)}},"init")(),r(!1)},[]),mt(()=>{if(!i)return;window.legitFs=i;let u=setInterval(async()=>{let f=await i.getCurrentBranch();try{let v=await i.promises.readFile(`/.legit/branches/${f}/.legit/head`,"utf8");v!==o.current&&(o.current=v,d(v))}catch{}},qt);return()=>{clearInterval(u)}},[i]);let m=w(async u=>{if(!i){console.error("No legitFs instance available");return}try{let f=await i.getCurrentBranch();await i.promises.writeFile(`/.legit/branches/${f}/.legit/head`,u,"utf8")}catch(f){h(f)}},"rollback");return Yt(ft.Provider,{value:{legitFs:i,loading:i===null,head:c,rollback:m,error:l},children:s})},"LegitProvider");import{useEffect as pt,useState as ce,useRef as Pe,useCallback as wt,useMemo as Zt}from"react";function Qt(s,e){let{legitFs:t,error:r,head:i}=ke(),[a,o]=ce(null),[l,h]=ce([]),[c,d]=ce(!0),[m,u]=ce(),f=Pe(null),v=Pe(!1),k=Pe(!1);pt(()=>{if(!t)return;let p=!1;return w(async()=>{d(!0);try{let E=await t.getCurrentBranch(),N=`/.legit/branches/${E}${s}`,x=`/.legit/branches/${E}/.legit/history`,re=await t.promises.readFile(N,"utf8"),ie=await t.promises.readFile(x,"utf8").catch(()=>"");if(p)return;let Q=[],de=ie;de&&(Q=JSON.parse(de)),f.current===re&&(f.current=null),o(re),h(Q),u(void 0)}catch(E){E?.code!=="ENOENT"?u(E):(o(null),h([]))}finally{p||d(!1)}},"load")(),()=>{p=!0}},[t,s,i]);let y=wt(async p=>{if(t)try{f.current=p;let g=await t.getCurrentBranch();await t.promises.writeFile(`/.legit/branches/${g}${s}`,p,"utf8"),o(p)}catch(g){throw f.current=null,u(g),g}},[t,s]);pt(()=>{v.current||k.current||!c&&a===null&&t&&e?.initialData&&(k.current=!0,v.current=!0,w(async()=>{try{await y(e.initialData)}catch(g){console.error("Failed to initialize file:",g),v.current=!1}finally{k.current=!1}},"initialize")())},[c,a,t,e?.initialData,y]);let b=wt(async p=>{if(!t)return"";try{let g=s.startsWith("/")?s.slice(1):s;return await t.promises.readFile(`/.legit/commits/${p.slice(0,2)}/${p.slice(2)}/${g}`,"utf8")}catch{return""}},[t,s]);return{data:a,setData:y,history:Zt(()=>l,[l]),getPastState:b,loading:c,error:m??r,legitFs:t}}w(Qt,"useLegitFile");export{Xt as LegitProvider,ke as useLegitContext,Qt as useLegitFile};