brsh 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/Readme.md +128 -0
- package/dist/shell.es.js +614 -453
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +18 -18
- package/dist/shell.min.js.map +1 -1
- package/dist/wbt.es.js +607 -446
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +10 -10
- package/dist/wbt.min.js.map +1 -1
- package/lib/Readme.md +23 -1
- package/lib/WasmCommand.js +370 -36
- package/package.json +1 -1
- package/test/wasm-cli.test.js +64 -0
- package/test/wbt.test.js +4 -4
package/dist/shell.min.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";var Shell=(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function n(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function r(e){var t=n(e),r=t[0],i=t[1];return(r+i)*3/4-i}function i(e,t,n){return(t+n)*3/4-n}function a(e){var t,r=n(e),a=r[0],o=r[1],s=new p(i(e,a,o)),c=0,l=o>0?a-4:a,u;for(u=0;u<l;u+=4)t=f[e.charCodeAt(u)]<<18|f[e.charCodeAt(u+1)]<<12|f[e.charCodeAt(u+2)]<<6|f[e.charCodeAt(u+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=t&255;return o===2&&(t=f[e.charCodeAt(u)]<<2|f[e.charCodeAt(u+1)]>>4,s[c++]=t&255),o===1&&(t=f[e.charCodeAt(u)]<<10|f[e.charCodeAt(u+1)]<<4|f[e.charCodeAt(u+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function o(e){return d[e>>18&63]+d[e>>12&63]+d[e>>6&63]+d[e&63]}function s(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(o(r));return i.join(``)}function c(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,c=n-r;o<c;o+=a)i.push(s(e,o,o+a>c?c:o+a));return r===1?(t=e[n-1],i.push(d[t>>2]+d[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(d[t>>10]+d[t>>4&63]+d[t<<2&63]+`=`)),i.join(``)}var l,u,d,f,p,m,h,g,_,v,y=e((()=>{for(l={},u={},u.byteLength=r,u.toByteArray=a,u.fromByteArray=c,d=[],f=[],p=typeof Uint8Array<`u`?Uint8Array:Array,m=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,h=0,g=m.length;h<g;++h)d[h]=m[h],f[m.charCodeAt(h)]=h;f[45]=62,f[95]=63,_={},_.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},_.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=u,n=_,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=d,e.SlowBuffer=C,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i;let{Uint8Array:a,ArrayBuffer:o,SharedArrayBuffer:s}=globalThis;d.TYPED_ARRAY_SUPPORT=c(),!d.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 c(){try{let e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function l(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new a(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return h(e)}return f(e,t,n)}d.poolSize=8192;function f(e,t,n){if(typeof e==`string`)return g(e,t);if(o.isView(e))return y(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(pe(e,o)||e&&pe(e.buffer,o)||s!==void 0&&(pe(e,s)||e&&pe(e.buffer,s)))return b(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,t,n);let i=x(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return d.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}d.from=function(e,t,n){return f(e,t,n)},Object.setPrototypeOf(d.prototype,a.prototype),Object.setPrototypeOf(d,a);function p(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function m(e,t,n){return p(e),e<=0||t===void 0?l(e):typeof n==`string`?l(e).fill(t,n):l(e).fill(t)}d.alloc=function(e,t,n){return m(e,t,n)};function h(e){return p(e),l(e<0?0:S(e)|0)}d.allocUnsafe=function(e){return h(e)},d.allocUnsafeSlow=function(e){return h(e)};function g(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=w(e,t)|0,r=l(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function v(e){let t=e.length<0?0:S(e.length)|0,n=l(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function y(e){if(pe(e,a)){let t=new a(e);return b(t.buffer,t.byteOffset,t.byteLength)}return v(e)}function b(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new a(e):n===void 0?new a(e,t):new a(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function x(e){if(d.isBuffer(e)){let t=S(e.length)|0,n=l(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||me(e.length)?l(0):v(e);if(e.type===`Buffer`&&Array.isArray(e.data))return v(e.data)}function S(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function C(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,t){if(pe(e,a)&&(e=d.from(e,e.offset,e.byteLength)),pe(t,a)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},d.isEncoding=function(e){switch(String(e).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}},d.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=d.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(pe(t,a))i+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,i)):a.prototype.set.call(r,t,i);else if(d.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function w(e,t){if(d.isBuffer(e))return e.length;if(o.isView(e)||pe(e,o))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return ce(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return de(e).length;default:if(i)return r?-1:ce(e).length;t=(``+t).toLowerCase(),i=!0}}d.byteLength=w;function T(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return z(this,t,n);case`utf8`:case`utf-8`:return F(this,t,n);case`ascii`:return L(this,t,n);case`latin1`:case`binary`:return R(this,t,n);case`base64`:return P(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return B(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function E(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}d.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)E(this,t,t+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)E(this,t,t+3),E(this,t+1,t+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)E(this,t,t+7),E(this,t+1,t+6),E(this,t+2,t+5),E(this,t+3,t+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?F(this,0,e):T.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:d.compare(this,e)===0},d.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(d.prototype[r]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,i){if(pe(e,a)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let o=i-r,s=n-t,c=Math.min(o,s),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){o=l[e],s=u[e];break}return o<s?-1:+(s<o)};function D(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,me(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:O(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof a.prototype.indexOf==`function`?i?a.prototype.indexOf.call(e,t,n):a.prototype.lastIndexOf.call(e,t,n):O(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function O(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},d.prototype.indexOf=function(e,t,n){return D(this,e,t,n,!0)},d.prototype.lastIndexOf=function(e,t,n){return D(this,e,t,n,!1)};function k(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(me(r))return o;e[n+o]=r}return o}function A(e,t,n,r){return fe(ce(t,e.length-n),e,n,r)}function j(e,t,n,r){return fe(le(t),e,n,r)}function M(e,t,n,r){return fe(de(t),e,n,r)}function N(e,t,n,r){return fe(ue(t,e.length-n),e,n,r)}d.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return k(this,e,t,n);case`utf8`:case`utf-8`:return A(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return j(this,e,t,n);case`base64`:return M(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return N(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},d.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function P(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function F(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return ee(r)}let I=4096;function ee(e){let t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}function L(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function R(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function z(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=he[e[r]];return i}function B(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,d.prototype),r};function V(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||V(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||V(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||V(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||V(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||V(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||V(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||V(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=X(function(e){e>>>=0,ie(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),d.prototype.readBigUInt64BE=X(function(e){e>>>=0,ie(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),d.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||V(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},d.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||V(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},d.prototype.readInt8=function(e,t){return e>>>=0,t||V(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||V(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||V(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||V(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||V(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=X(function(e){e>>>=0,ie(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=X(function(e){e>>>=0,ie(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ae(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||V(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||V(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||V(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||V(e,8,this.length),n.read(this,e,!1,52,8)};function H(e,t,n,r,i,a){if(!d.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;H(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;H(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,1,255,0),this[t]=e&255,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function U(e,t,n,r,i){Y(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function W(e,t,n,r,i){Y(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}d.prototype.writeBigUInt64LE=X(function(e,t=0){return U(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=X(function(e,t=0){return W(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);H(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);H(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},d.prototype.writeBigInt64LE=X(function(e,t=0){return U(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=X(function(e,t=0){return W(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function G(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function K(e,t,r,i,a){return t=+t,r>>>=0,a||G(e,t,r,4),n.write(e,t,r,i,23,4),r+4}d.prototype.writeFloatLE=function(e,t,n){return K(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return K(this,e,t,!1,n)};function te(e,t,r,i,a){return t=+t,r>>>=0,a||G(e,t,r,8),n.write(e,t,r,i,52,8),r+8}d.prototype.writeDoubleLE=function(e,t,n){return te(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return te(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof a.prototype.copyWithin==`function`?this.copyWithin(t,n,r):a.prototype.set.call(e,this.subarray(n,r),t),i},d.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!d.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=d.isBuffer(e)?e:d.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let q={};function ne(e,t,n){q[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}ne(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),ne(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),ne(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=re(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=re(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function re(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function J(e,t,n){ie(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&ae(t,e.length-(n+1))}function Y(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new q.ERR_OUT_OF_RANGE(`value`,i,e)}J(r,i,a)}function ie(e,t){if(typeof e!=`number`)throw new q.ERR_INVALID_ARG_TYPE(t,`number`,e)}function ae(e,t,n){throw Math.floor(e)===e?t<0?new q.ERR_BUFFER_OUT_OF_BOUNDS:new q.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ie(e,n),new q.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let oe=/[^+/0-9A-Za-z-_]/g;function se(e){if(e=e.split(`=`)[0],e=e.trim().replace(oe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function ce(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function le(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ue(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function de(e){return t.toByteArray(se(e))}function fe(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function pe(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function me(e){return e!==e}let he=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function X(e){return typeof BigInt>`u`?ge:e}function ge(){throw Error(`BigInt not supported`)}})(l),v=l.Buffer,l.Blob,l.BlobOptions,l.Buffer,l.File,l.FileOptions,l.INSPECT_MAX_BYTES,l.SlowBuffer,l.TranscodeEncoding,l.atob,l.btoa,l.constants,l.isAscii,l.isUtf8,l.kMaxLength,l.kStringMaxLength,l.resolveObjectURL,l.transcode})),b=t(((e,t)=>{y();var n=new Set([`cwd`,`getFileByPath`,`setFileByPath`,`deleteFileByPath`,`exists`,`stat`,`absolutePath`,`getMode`,`setMode`,`isReadable`,`isWritable`,`isExecutable`,`getSize`,`autoComplete`,`isRealFilesystem`,`isSymlink`,`readSymlink`,`createSymlink`]),r=class{isReadable(e){let t=this.getMode(e);return t===null?!1:(t&256)!=0}isWritable(e){let t=this.getMode(e);return t===null?!1:(t&128)!=0}isExecutable(e){let t=this.getMode(e);return t===null?!1:(t&64)!=0}sandbox(){let e=this;return new Proxy(Object.create(null),{get(t,r){if(!n.has(r))return;let i=e[r];return typeof i==`function`?i.bind(e):i},set(){return!1},has(e,t){return n.has(t)}})}_triggerChange(){!this._onChange||this._changeScheduled||(this._changeScheduled=!0,Promise.resolve().then(()=>{this._changeScheduled=!1,typeof this._onChange==`function`&&this._onChange(this.getRaw(),this.getRawPermissions())}))}},i=class extends Uint8Array{constructor(e,t){super(e),Object.defineProperty(this,"mimeType",{value:t,enumerable:!1,configurable:!1,writable:!1})}toString(){if(v!==void 0)return`data:${this.mimeType};base64,${v.from(this).toString(`base64`)}`;let e=``,t=8192;for(let n=0;n<this.length;n+=t)e+=String.fromCharCode(...this.subarray(n,n+t));return`data:${this.mimeType};base64,${btoa(e)}`}},a=class{constructor(e){this.target=e}};t.exports=r,t.exports.BinaryFile=i,t.exports.SymlinkRef=a}));function x(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function S(){throw Error(`setTimeout has not been defined`)}function C(){throw Error(`clearTimeout has not been defined`)}function w(e){if(M===setTimeout)return setTimeout(e,0);if((M===S||!M)&&setTimeout)return M=setTimeout,setTimeout(e,0);try{return M(e,0)}catch{try{return M.call(null,e,0)}catch{return M.call(this,e,0)}}}function T(e){if(N===clearTimeout)return clearTimeout(e);if((N===C||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(e);try{return N(e)}catch{try{return N.call(null,e)}catch{return N.call(this,e)}}}function E(){!F||!I||(F=!1,I.length?P=I.concat(P):ee=-1,P.length&&D())}function D(){if(!F){var e=w(E);F=!0;for(var t=P.length;t;){for(I=P,P=[];++ee<t;)I&&I[ee].run();ee=-1,t=P.length}I=null,F=!1,T(e)}}function O(e,t){this.fun=e,this.array=t}function k(){}var A,j,M,N,P,F,I,ee,L,R,z=e((()=>{A={exports:{}},j=A.exports={},(function(){try{M=typeof setTimeout==`function`?setTimeout:S}catch{M=S}try{N=typeof clearTimeout==`function`?clearTimeout:C}catch{N=C}})(),P=[],F=!1,ee=-1,j.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];P.push(new O(e,t)),P.length===1&&!F&&w(D)},O.prototype.run=function(){this.fun.apply(null,this.array)},j.title=`browser`,j.browser=!0,j.env={},j.argv=[],j.version=``,j.versions={},j.on=k,j.addListener=k,j.once=k,j.off=k,j.removeListener=k,j.removeAllListeners=k,j.emit=k,j.prependListener=k,j.prependOnceListener=k,j.listeners=function(e){return[]},j.binding=function(e){throw Error(`process.binding is not supported`)},j.cwd=function(){return`/`},j.chdir=function(e){throw Error(`process.chdir is not supported`)},j.umask=function(){return 0},L=A.exports,R=x(L)})),B=t(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),V=t(((e,t)=>{var n=[`out`,`err`];t.exports=class{constructor(e,t){if(!n.includes(e))throw Error(`incorrect std output type`);this.type=e,this.string=t}}})),H=t(((e,t)=>{var n=V();t.exports=class{constructor(e=[],t=0){if(typeof t!=`number`)throw Error(`Command Result ExitCode must be a number`);if(!Array.isArray(e))throw Error(`Command Result be array`);this.std=e,this.exitCode=t}addStdOutLine(e){this.std.push(new n(`out`,e))}addStdErrLine(e){this.std.push(new n(`err`,e))}getStdOutput(){return this.std}getExitCode(){return this.exitCode}flush(){let e=this.std;return this.std=[],e}}})),U=t(((e,t)=>{y();var n=B(),r=n.EventEmitter||n.default||n;function i(e){if(!e)return[];let t=typeof e==`string`?e:e instanceof Uint8Array||v!==void 0&&v.isBuffer(e)?new TextDecoder().decode(e):String(e),n=[],r=0;for(;r<t.length;){let e=t[r],i=t.charCodeAt(r);if(i===27){if(t.charCodeAt(r+1)===127||t.charCodeAt(r+1)===8){n.push(`^W`),r+=2;continue}if(t[r+1]===`[`||t[r+1]===`O`){let e=r+2;for(;e<t.length&&t.charCodeAt(e)>=32&&t.charCodeAt(e)<=63;)e++;if(e<t.length){let i=t.slice(r+2,e+1),a={A:`ArrowUp`,B:`ArrowDown`,C:`ArrowRight`,D:`ArrowLeft`,H:`Home`,F:`End`,"1~":`Home`,"3~":`Delete`,"4~":`End`,"5~":`PageUp`,"6~":`PageDown`,"7~":`Home`,"8~":`End`};a[i]&&n.push(a[i]),r=e+1;continue}}n.push(`Escape`),r++;continue}if(i===13||i===10){n.push(`Enter`),i===13&&t[r+1]===`
|
|
2
|
-
`&&r++,r++;continue}if(i===127||i===8){n.push(`Backspace`),r++;continue}if(i===9){n.push(`Tab`),r++;continue}if(i>=1&&i<=26){n.push(`^`+String.fromCharCode(i+64)),r++;continue}n.push(e),r++}return n}t.exports={TtyStream:class extends r{constructor(e={}){super(),this.isTTY=e.isTTY!==!1,this.readable=!0,this.writable=!0,this.columns=e.columns||80,this.rows=e.rows||24,this.isRaw=!1,this._encoding=null,this._onWrite=e.onWrite||null}write(e,t,n){return e==null?!0:(typeof this._onWrite==`function`&&this._onWrite(e),this.emit(`data`,this._formatChunk(e)),typeof t==`function`?t():typeof n==`function`&&n(),!0)}pushData(e){e!=null&&this.emit(`data`,this._formatChunk(e))}_formatChunk(e){return this._encoding?typeof e==`string`?e:e instanceof Uint8Array||v!==void 0&&v.isBuffer(e)?new TextDecoder().decode(e):String(e):e}setRawMode(e){return this.isRaw=!!e,this}setEncoding(e){return this._encoding=e,this}getWindowSize(){return[this.columns,this.rows]}resize(e,t){this.columns=e,this.rows=t,this.emit(`resize`)}resume(){return this}pause(){return this}pipe(e){return this.on(`data`,t=>e.write(t)),e}unpipe(){return this}end(e,t,n){return e!=null&&this.write(e,typeof t==`string`?t:void 0),this.emit(`end`),typeof t==`function`?t():typeof n==`function`&&n(),this}destroy(){this.removeAllListeners()}toString(){return``}valueOf(){return``}},parseVtKeys:i}})),
|
|
3
|
-
`):e===`Backspace`?this.stdout.write(`\b \b`):e.length===1&&this.stdout.write(e)),this.onInput(e)})}get name(){return`unnamed`}run(){return Promise.reject(`Command not implemented...`)}runCommand(){return Promise.resolve().then(()=>this.run()).then(e=>(e&&e.split(/\r?\n/).forEach(e=>this.stdOut=e),this.result)).catch(e=>{if(e&&e.__type)throw e;return e&&(this.stdErr=e.message||e),this.exitCode=127,this.result})}onInput(e){}set exitCode(e){this.result.exitCode=e}set stdOut(e){this.result.addStdOutLine(e)}set stdErr(e){this.result.addStdErrLine(e)}flush(){this.emit(`flush`,this.result.flush())}}})),G=t(((e,t)=>{var n=W();t.exports=class extends n{get captureInput(){return!0}get interactive(){return!0}get terminalSize(){return this.stdout&&this.stdout.columns&&this.stdout.rows?{cols:parseInt(this.context&&this.context.getVar&&this.context.getVar(`COLUMNS`),10)||this.stdout.columns||80,rows:parseInt(this.context&&this.context.getVar&&this.context.getVar(`LINES`),10)||this.stdout.rows||24}:{cols:parseInt(this.context.getVar(`COLUMNS`),10)||80,rows:parseInt(this.context.getVar(`LINES`),10)||24}}_enterAltScreen(){this._inAltScreen||(this._inAltScreen=!0,this.stdinStream&&this.stdinStream.setRawMode(!0),this.stdout&&this.stdout.write(`\x1B[?1049h\x1B[2J\x1B[H`))}_exitAltScreen(){this._inAltScreen&&(this._inAltScreen=!1,this.stdinStream&&this.stdinStream.setRawMode(!1),this.stdout&&this.stdout.write(`\x1B[?1049l\x1B[?25h`))}runCommand(){return this.interactive&&this._enterAltScreen(),super.runCommand().finally(()=>{this._exitAltScreen()})}}})),K=t(((e,t)=>{y(),z();var{BinaryFile:n,SymlinkRef:r}=b(),i=new Uint8Array([66,82,70,83]),a=2;function o(e){if(!e)return!1;let t=e instanceof Uint8Array?e:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?new Uint8Array(e.buffer||e,e.byteOffset||0,e.byteLength):null;return!t||t.length<12?!1:t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]}function s(e={},t={},n={}){let o=new TextEncoder,s=[],c=0,l=e=>{let t=e instanceof Uint8Array?e:new Uint8Array(e),n=c;return s.push(t),c+=t.byteLength,[n,t.byteLength]},u={},d=(e,t)=>{if(e==null)return null;if(e instanceof r)return{$l:e.target};if(e instanceof Uint8Array||v!==void 0&&v.isBuffer(e)){let n=e instanceof Uint8Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),r=e.mimeType||(t.endsWith(`.wasm`)?`application/wasm`:`application/octet-stream`),[i,a]=l(n);return{$b:[i,a,r]}}if(typeof e==`function`)return n.commandsBundle||(u[t]=e.toString()),{$c:t};if(typeof e==`string`){if(e.startsWith(`data:`)){let t=e.indexOf(`;`),n=e.indexOf(`,`,t);if(t!==-1&&n!==-1&&e.slice(t+1,n)===`base64`){let r=e.slice(5,t),i=e.slice(n+1),a;if(v!==void 0)a=new Uint8Array(v.from(i,`base64`));else{let e=atob(i);a=new Uint8Array(e.length);for(let t=0;t<e.length;t++)a[t]=e.charCodeAt(t)}let[o,s]=l(a);return{$b:[o,s,r]}}}let[t,n]=l(o.encode(e));return{$t:[t,n]}}if(typeof e==`object`){let n={};for(let r of Object.keys(e)){let i=`${t}/${r}`,a=d(e[r],i);a!==null&&(n[r]=a)}return{$d:n}}return null},f=d(e,``)||{$d:{}},p=null;n.commandsBundle&&typeof n.commandsBundle==`string`&&(p=l(o.encode(n.commandsBundle)));let m={v:a,tree:f,permissions:Object.assign({},t)};p&&(m.commandsSlice=p),Object.keys(u).length>0&&(m.inlineCommands=u);let h=o.encode(JSON.stringify(m)),g=12+h.byteLength+c,_=new Uint8Array(g);_.set(i,0);let y=new DataView(_.buffer,_.byteOffset,_.byteLength);y.setUint32(4,a,!0),y.setUint32(8,h.byteLength,!0),_.set(h,12);let b=12+h.byteLength;for(let e of s)_.set(e,b),b+=e.byteLength;return _}function c(e,t={}){let i=e instanceof Uint8Array?e:new Uint8Array(e.buffer||e,e.byteOffset||0,e.byteLength);if(!o(i))throw Error(`Invalid BRFS binary container (missing BRFS magic header)`);let s=new DataView(i.buffer,i.byteOffset,i.byteLength),c=s.getUint32(4,!0);if(c>a)throw Error(`Unsupported BRFS container version: ${c}`);let l=12+s.getUint32(8,!0);if(l>i.byteLength)throw Error(`Corrupt BRFS binary container (header length exceeds buffer)`);let u=new TextDecoder,d=u.decode(i.subarray(12,l)),f=JSON.parse(d),p=i.subarray(l),m=Object.assign({},t);if(Array.isArray(f.commandsSlice)){let[e,t]=f.commandsSlice,n=u.decode(p.subarray(e,e+t));try{let e=Function(n)();e&&typeof e==`object`&&Object.assign(m,e)}catch{}}let h=e=>{if(!e||typeof e!=`object`)return e;if(`$t`in e){let[t,n]=e.$t;return u.decode(p.subarray(t,t+n))}if(`$b`in e){let[t,r,i]=e.$b;return new n(p.slice(t,t+r).buffer,i||`application/octet-stream`)}if(`$l`in e)return new r(e.$l);if(`$c`in e){let t=e.$c;if(m[t])return m[t];if(f.inlineCommands&&f.inlineCommands[t])try{let e=W(),n=G();return Function(`Command`,`InteractiveCommand`,`return (${f.inlineCommands[t]});`)(e,n)}catch{return null}return null}if(`$d`in e){let t={};for(let[n,r]of Object.entries(e.$d)){let e=h(r);e!==null&&(t[n]=e)}return t}return e};return{filesystem:h(f.tree)||{},permissions:Object.assign({},f.permissions||{})}}function l(e){if(!e)return!1;let t=e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null;return!!(t&&t.byteLength>=2&&t[0]===31&&t[1]===139)}async function u(e){if(typeof DecompressionStream<`u`&&typeof Response<`u`){let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t),r=await new Response(n).arrayBuffer();return new Uint8Array(r)}if(R!==void 0&&typeof R.getBuiltinModule==`function`){let t=R.getBuiltinModule(`zlib`);if(t)return new Uint8Array(t.gunzipSync(v.from(e.buffer,e.byteOffset,e.byteLength)))}throw Error(`Gzip decompression is not supported in this environment`)}function d(e){return e?!!(typeof e==`string`||typeof e.then==`function`||typeof e.arrayBuffer==`function`||l(e)):!1}async function f(e,t={}){if(!e)return{filesystem:{},permissions:t};if(typeof e.then==`function`)return f(await e,t);if(typeof e.arrayBuffer==`function`){let n=await e.arrayBuffer();return f(new Uint8Array(n),t)}if(typeof e==`string`){if(!/^https?:\/\//i.test(e)&&R!==void 0&&typeof R.getBuiltinModule==`function`&&typeof window>`u`)try{let n=R.getBuiltinModule(`fs`);if(n&&n.existsSync(e)){let r=await n.promises.readFile(e);return f(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),t)}}catch{}let n=await fetch(e);if(!n.ok)throw Error(`Failed to load filesystem from ${e}: HTTP ${n.status}`);let r=await n.arrayBuffer();return f(new Uint8Array(r),t)}if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){let n=e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(l(n)&&(n=await u(n)),o(n)){let e=c(n);return{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}}let r=new TextDecoder(`utf-8`).decode(n);try{let e=JSON.parse(r);return e&&typeof e==`object`&&e.filesystem&&typeof e.permissions==`object`?{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}:{filesystem:e,permissions:t}}catch{let e=Function(`return `+r)();return e&&typeof e==`object`&&e.filesystem&&typeof e.permissions==`object`?{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}:{filesystem:e||{},permissions:t}}}return typeof e==`object`&&e.filesystem&&typeof e.permissions==`object`?d(e.filesystem)||o(e.filesystem)?f(e.filesystem,Object.assign({},e.permissions,t)):{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}:{filesystem:e,permissions:t}}t.exports={MAGIC:i,FORMAT_VERSION:a,isBinaryContainer:o,isGzipBytes:l,isAsyncFilesystemSource:d,resolveFilesystemSource:f,serializeBinaryFilesystem:s,deserializeBinaryFilesystem:c,FilesystemStorage:class{static async save(e,t=`brsh-rootfs`){let n=e.context?e.context.fs:e,r=s(n.getRaw(),n.getRawPermissions());return typeof indexedDB<`u`&&await this._idbPut(t,r),r}static async load(e=`brsh-rootfs`){if(e instanceof Uint8Array||e instanceof ArrayBuffer||typeof e==`string`&&(/^https?:\/\//i.test(e)||e.endsWith(`.brfs`)))return f(e);if(typeof indexedDB<`u`&&typeof e==`string`){let t=await this._idbGet(e);if(t&&o(t))return c(t)}return null}static async loadOrFetch(e=`brsh-rootfs`,t={}){return await this.load(e)||f(t)}static createAutoSave(e=`brsh-rootfs`,t=null){return(n,r)=>{let i=s(n,r);typeof indexedDB<`u`&&this._idbPut(e,i).catch(()=>{}),typeof t==`function`&&t(i,n,r)}}static _openIdb(){return new Promise((e,t)=>{let n=indexedDB.open(`brsh_fs_storage`,1);n.onupgradeneeded=()=>{n.result.createObjectStore(`snapshots`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}static async _idbPut(e,t){let n=await this._openIdb();return new Promise((r,i)=>{let a=n.transaction(`snapshots`,`readwrite`);a.objectStore(`snapshots`).put(t,e),a.oncomplete=()=>{n.close(),r()},a.onerror=()=>{n.close(),i(a.error)}})}static async _idbGet(e){let t=await this._openIdb();return new Promise((n,r)=>{let i=t.transaction(`snapshots`,`readonly`).objectStore(`snapshots`).get(e);i.onsuccess=()=>{t.close(),n(i.result||null)},i.onerror=()=>{t.close(),r(i.error)}})}}}})),te=t(((e,t)=>{y();var n=b(),{BinaryFile:r,SymlinkRef:i}=n;function a(e){for(let t of Object.keys(e)){let n=e[t];if(typeof n==`object`&&n&&!(n instanceof Uint8Array)&&!(n instanceof i))a(n);else if(typeof n==`string`&&n.startsWith(`data:`)){let i=n.indexOf(`;`),a=n.indexOf(`,`,i);if(i!==-1&&a!==-1&&n.slice(i+1,a)===`base64`){let o=n.slice(5,i),s=n.slice(a+1),c;if(v!==void 0)c=new Uint8Array(v.from(s,`base64`));else{let e=atob(s);c=new Uint8Array(e.length);for(let t=0;t<e.length;t++)c[t]=e.charCodeAt(t)}e[t]=new r(c.buffer,o)}}}}t.exports=class extends n{constructor(e=`/`,t={},n={},r=null){if(super(),t instanceof Uint8Array||t instanceof ArrayBuffer){let{deserializeBinaryFilesystem:e}=K(),r=e(t);t=r.filesystem,n=Object.assign({},r.permissions,n)}else if(t&&typeof t==`object`&&t.filesystem&&(t.filesystem instanceof Uint8Array||typeof t.filesystem==`object`)&&(n=Object.assign({},t.permissions||{},n),t=t.filesystem,t instanceof Uint8Array||t instanceof ArrayBuffer)){let{deserializeBinaryFilesystem:e}=K(),r=e(t);t=r.filesystem,n=Object.assign({},r.permissions,n)}a(t),this.fileSystem=t,this.permissions=Object.assign({},n),this.cwd=e.endsWith(`/`)?e:e+`/`,this._onChange=r,this._changeScheduled=!1}toBinaryContainer(e={}){let{serializeBinaryFilesystem:t}=K();return t(this.fileSystem,this.permissions,e)}static fromBinaryContainer(e,t={}){let{deserializeBinaryFilesystem:n}=K();return n(e,t)}getFileByPath(e){let t=this._resolveByAbsolutePath(this._pathToAbsolute(e),!0);return t==null||!this.isReadable(e)?null:t}_getFileRaw(e){return this._getFileByAbsolutePath(this._pathToAbsolute(e))}exists(e){return this._resolveByAbsolutePath(this._pathToAbsolute(e),!0)!=null}isSymlink(e){return this._resolveByAbsolutePath(this._pathToAbsolute(e),!1)instanceof i}readSymlink(e){let t=this._resolveByAbsolutePath(this._pathToAbsolute(e),!1);return t instanceof i?t.target:null}createSymlink(e,t){this._setFileRaw(t,new i(e))}stat(e){let t=this._resolveByAbsolutePath(this._pathToAbsolute(e),!1);return t==null?null:t instanceof i?{isDirectory:!1,isFile:!1,isCommand:!1,isBinary:!1,isSymlink:!0}:{isDirectory:t.constructor===Object,isFile:typeof t==`string`||t instanceof Uint8Array,isCommand:typeof t==`function`,isBinary:t instanceof Uint8Array,isSymlink:!1}}_pathToAbsolute(e){return e.startsWith(`./`)&&(e=e.substring(2)),e.startsWith(`/`)||(e=(this.cwd&&this.cwd.endsWith(`/`)?this.cwd:this.cwd?this.cwd+`/`:`/`)+e),this._traverseComplexAbsolutePath(e)}_traverseComplexAbsolutePath(e){let t=e.split(`/`);for(;t.includes(`..`);){let e=t.indexOf(`..`)-1;t.splice(e,2)}return t.join(`/`)}absolutePath(e){return this._pathToAbsolute(e)}setFileByPath(e,t,n=!1){let r=this._pathToAbsolute(e);if(this._getFileByAbsolutePath(r)!=null){if(!this.isWritable(e))throw Error(`Permission denied`)}else{let e=r.split(`/`);e.pop();let t=e.join(`/`)||`/`,n=this.getMode(t);if(n!==null&&!(n&128))throw Error(`Permission denied`)}this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileRaw(e,t,n=!1){let r=this._pathToAbsolute(e);this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileByAbsolutePath(e,t,n=!0){let r=e.split(`/`);r.shift();let a=r.pop(),o=this.fileSystem,s=[];for(let e of r){if(s.push(e),!Object.prototype.hasOwnProperty.call(o,e)){if(!n)throw Error(`${e}: No such file or directory`);o[e]={}}let t=o[e];if(t instanceof i){let n=`/`+s.slice(0,-1).join(`/`),r=t.target.startsWith(`/`)?this._traverseComplexAbsolutePath(t.target):this._traverseComplexAbsolutePath(n+`/`+t.target);if(t=this._resolveByAbsolutePath(r,!0),typeof t!=`object`||!t||t instanceof i)throw Error(`${e}: Not a directory`)}o=t}o[a]=t}_resolveByAbsolutePath(e,t=!0,n=0){if(n>10)return null;let r=e.split(`/`);r.shift(),r.length>0&&r[r.length-1].length<1&&r.pop();let a=this.fileSystem,o=[];for(let e=0;e<r.length;e++){let s=r[e],c=e===r.length-1;if(typeof a!=`object`||!a||a instanceof i||!Object.prototype.hasOwnProperty.call(a,s))return null;if(a=a[s],o.push(s),a instanceof i&&(!c||t)){let e=`/`+o.slice(0,-1).join(`/`),t=a.target.startsWith(`/`)?this._traverseComplexAbsolutePath(a.target):this._traverseComplexAbsolutePath(e+`/`+a.target);if(a=this._resolveByAbsolutePath(t,!0,n+1),a==null)return null}}return a}_getFileByAbsolutePath(e){let t=e.split(`/`);return t.shift(),t[t.length-1].length<1&&t.pop(),t.reduce((e,t)=>typeof e!=`object`||!e||!Object.prototype.hasOwnProperty.call(e,t)?null:e[t],this.fileSystem)}deleteFileByPath(e){let t=this._pathToAbsolute(e),n=t.split(`/`);n.pop();let r=n.join(`/`)||`/`,i=this.getMode(r);if(i!==null&&!(i&128))throw Error(`${e}: Permission denied`);this._deleteByAbsolutePath(t);let a=t+`/`;Object.keys(this.permissions).forEach(e=>{(e===t||e.startsWith(a))&&delete this.permissions[e]}),this._triggerChange()}_deleteByAbsolutePath(e){let t=e.split(`/`);t.shift(),t[t.length-1]===``&&t.pop();let n=t.pop();if(!n)return;let r=this.fileSystem,a=[];for(let e of t){if(a.push(e),!Object.prototype.hasOwnProperty.call(r,e))return;let t=r[e];if(t instanceof i){let e=`/`+a.slice(0,-1).join(`/`),n=t.target.startsWith(`/`)?this._traverseComplexAbsolutePath(t.target):this._traverseComplexAbsolutePath(e+`/`+t.target);if(t=this._resolveByAbsolutePath(n,!0),typeof t!=`object`||!t||t instanceof i)return}r=t}r&&n in r&&delete r[n]}getMode(e){let t=this._pathToAbsolute(e);if(this.permissions[t]!==void 0)return this.permissions[t];let n=this._resolveByAbsolutePath(t,!0);return n==null?null:n.constructor===Object?493:typeof n==`function`?365:420}setMode(e,t){let n=this._pathToAbsolute(e);this.permissions[n]=t,this._triggerChange()}getSize(e){let t=this._pathToAbsolute(e),n=this._resolveByAbsolutePath(t,!0);return n==null?0:n.constructor===Object?JSON.stringify(n).length:n instanceof Uint8Array?n.length:n.toString().length}getRawPermissions(){return Object.assign({},this.permissions)}setCwd(e){this.cwd=this._pathToAbsolute(e.endsWith(`/`)?e:e+`/`)}getRaw(){return this.fileSystem}addFiles(e){Object.entries(e).forEach(([e,t])=>{this._setFileRaw(e,t,!0)})}autoComplete(e,t){let n=this._pathToAbsolute(e).split(`/`),r=n.pop(),i=this._getFileRaw(n.length>1?n.join(`/`):`/`),a=this._getFileRaw(t);if(i&&i.constructor===Object){let t=Object.keys(i).filter(e=>e.startsWith(r));r.length<1&&(t=t.filter(e=>!e.startsWith(`.`)));let n=e.split(`/`);n.pop();let o=i;if(t.length<1&&n.length<1&&a&&(t=Object.keys(a).filter(e=>e.startsWith(r)),o=a),t.length)return{path:n.length?n.join(`/`):null,options:t.map(e=>o[e]&&o[e].constructor===Object?e.concat(`/`):e)}}return null}},t.exports.BinaryFile=r,t.exports.SymlinkRef=i})),q=t(((e,t)=>{t.exports=null})),ne=t(((e,t)=>{z();function n(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function r(e,t){for(var n=``,r=0,i=-1,a=0,o,s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var c=n.lastIndexOf(`/`);if(c!==n.length-1){c===-1?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function i(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}var a={resolve:function(){for(var e=``,t=!1,i,a=arguments.length-1;a>=-1&&!t;a--){var o;a>=0?o=arguments[a]:(i===void 0&&(i=R.cwd()),o=i),n(o),o.length!==0&&(e=o+`/`+e,t=o.charCodeAt(0)===47)}return e=r(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`},normalize:function(e){if(n(e),e.length===0)return`.`;var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=r(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&i&&(e+=`/`),t?`/`+e:e},isAbsolute:function(e){return n(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,t=0;t<arguments.length;++t){var r=arguments[t];n(r),r.length>0&&(e===void 0?e=r:e+=`/`+r)}return e===void 0?`.`:a.normalize(e)},relative:function(e,t){if(n(e),n(t),e===t||(e=a.resolve(e),t=a.resolve(t),e===t))return``;for(var r=1;r<e.length&&e.charCodeAt(r)===47;++r);for(var i=e.length,o=i-r,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var c=t.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(t.charCodeAt(s+d)===47)return t.slice(s+d+1);if(d===0)return t.slice(s+d)}else o>l&&(e.charCodeAt(r+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(r+d);if(f!==t.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=r+u+1;d<=i;++d)(d===i||e.charCodeAt(d)===47)&&(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+t.slice(s+u):(s+=u,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(n(e),e.length===0)return`.`;for(var t=e.charCodeAt(0),r=t===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);n(e);var r=0,i=-1,a=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;var s=t.length-1,c=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!a){r=o+1;break}}else c===-1&&(a=!1,c=o+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(i=o):(s=-1,i=c))}return r===i?i=c:i===-1&&(i=e.length),e.slice(r,i)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!a){r=o+1;break}}else i===-1&&(a=!1,i=o+1);return i===-1?``:e.slice(r,i)}},extname:function(e){n(e);for(var t=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c===47){if(!a){r=s+1;break}continue}i===-1&&(a=!1,i=s+1),c===46?t===-1?t=s:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return i(`/`,e)},parse:function(e){n(e);var t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;var r=e.charCodeAt(0),i=r===47,a;i?(t.root=`/`,a=1):a=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=a;--u){if(r=e.charCodeAt(u),r===47){if(!l){s=u+1;break}continue}c===-1&&(l=!1,c=u+1),r===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1)}return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(s===0&&i?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(s,c)):(s===0&&i?(t.name=e.slice(1,o),t.base=e.slice(1,c)):(t.name=e.slice(s,o),t.base=e.slice(s,c)),t.ext=e.slice(o,c)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir=`/`),t},sep:`/`,delimiter:`:`,win32:null,posix:null};a.posix=a,t.exports=a})),re=t(((e,t)=>{z();var n=q(),r=ne(),i=b();t.exports=class extends i{constructor(e,t=null){super(),this._onChange=t,this._changeScheduled=!1,this._virtualFiles={},this.cwd=this._normalizeCwd(e||R.cwd())}get isRealFilesystem(){return!0}_normalizeCwd(e){let t=r.resolve(e);return t===`/`?`/`:t+`/`}absolutePath(e){e.startsWith(`./`)&&(e=e.slice(2));let t=e.startsWith(`/`)?e:r.join(this.cwd,e);return r.normalize(t)}setCwd(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=this.absolutePath(t);this.cwd=n===`/`?`/`:n+`/`}getFileByPath(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return this._virtualFiles[t];let i;try{i=n.statSync(t)}catch{return null}if(i.isDirectory()){let e={};try{for(let i of n.readdirSync(t)){let a=r.join(t,i);if(this._virtualFiles[a]!==void 0)e[i]=this._virtualFiles[a];else try{e[i]=n.statSync(a).isDirectory()?{}:``}catch{}}}catch{}let i=t===`/`?`/`:t+`/`;for(let t of Object.keys(this._virtualFiles))if(t.startsWith(i)&&!t.slice(i.length).includes(`/`)){let n=t.slice(i.length);n in e||(e[n]=this._virtualFiles[t])}return e}try{return n.readFileSync(t,`utf8`)}catch{return null}}setFileByPath(e,t,i=!1){let a=this.absolutePath(e);if(typeof t==`function`||t instanceof Uint8Array){this._virtualFiles[a]=t;return}if(t!=null&&t.constructor===Object){try{n.mkdirSync(a,{recursive:i}),this._triggerChange()}catch{this._virtualFiles[a]=t}return}try{i&&n.mkdirSync(r.dirname(a),{recursive:!0}),n.writeFileSync(a,String(t)),this._triggerChange()}catch{this._virtualFiles[a]=String(t)}}deleteFileByPath(e){let t=this.absolutePath(e);delete this._virtualFiles[t];try{n.lstatSync(t).isDirectory()?n.rmdirSync(t):n.unlinkSync(t),this._triggerChange()}catch{}}getMode(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return typeof this._virtualFiles[t]==`function`?493:420;try{return n.statSync(t).mode&511}catch{return null}}setMode(e,t){let r=this.absolutePath(e);if(this._virtualFiles[r]===void 0)try{n.chmodSync(r,t),this._triggerChange()}catch{}}getSize(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return 0;try{return n.statSync(t).size}catch{return 0}}isSymlink(e){let t=this.absolutePath(e);try{return n.lstatSync(t).isSymbolicLink()}catch{return!1}}readSymlink(e){let t=this.absolutePath(e);try{return n.readlinkSync(t)}catch{return null}}createSymlink(e,t){let i=this.absolutePath(t);n.mkdirSync(r.dirname(i),{recursive:!0}),n.symlinkSync(e,i),this._triggerChange()}getRaw(){return null}getRawPermissions(){return{}}addFiles(e){Object.entries(e).forEach(([e,t])=>{this.setFileByPath(e,t,!0)})}autoComplete(e,t){let i=this.absolutePath(e).split(`/`),a=i.pop(),o=i.join(`/`)||`/`,s=[];try{s=n.readdirSync(o)}catch{}let c=o===`/`?`/`:o+`/`;for(let e of Object.keys(this._virtualFiles))if(e.startsWith(c)&&!e.slice(c.length).includes(`/`)){let t=e.slice(c.length);s.includes(t)||s.push(t)}let l=s.filter(e=>e.startsWith(a));if(l.length===0&&!e.includes(`/`)){let n=this.getFileByPath(t);if(n&&n.constructor===Object&&(l=Object.keys(n).filter(t=>t.startsWith(e)),l.length))return{path:null,options:l}}if(!l.length)return null;let u=e.split(`/`);return u.pop(),{path:u.length?u.join(`/`):null,options:l.map(e=>{let t=r.join(o,e);if(this._virtualFiles[t]!==void 0)return e;try{return n.statSync(t).isDirectory()?e+`/`:e}catch{return e}})}}_getFileRaw(e){return this.getFileByPath(e)}_setFileRaw(e,t,n=!1){return this.setFileByPath(e,t,n)}exists(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return!0;try{return n.statSync(t),!0}catch{return!1}}stat(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0){let e=this._virtualFiles[t];return{isDirectory:e!=null&&e.constructor===Object,isFile:typeof e==`string`||e instanceof Uint8Array,isCommand:typeof e==`function`,isBinary:e instanceof Uint8Array}}try{let e=n.statSync(t);return{isDirectory:e.isDirectory(),isFile:e.isFile(),isCommand:!1}}catch{return null}}}})),J=t(((e,t)=>{var n=te();t.exports=class{constructor(e){this.options=e;let{cwd:t=`/`,clearFn:r,destroyFn:i,onFsChange:a}=this.options;this.vars={},this.aliases={},this.fs=new n(t,{},{},a||null),this._clearFn=r,this._destroyFn=i}setVar(e,t){t?this.vars[e]=t:delete this.vars[e]}unsetVar(e){this.setVar(e)}getVar(e){return this.vars[e]||``}setAlias(e,t){t?this.aliases[e]=t:delete this.aliases[e]}unsetAlias(e){this.setAlias(e)}getAlias(e){return this.aliases[e]||null}setCommand(e){let t=`${this.getVar(`PATH`)}/${e.name.toLowerCase()}`;this.fs.addFiles({[t]:e}),this.fs.setMode(t,365)}getCommand(e){let t=`${this.getVar(`PATH`)}/${e}`;return this.fs._getFileRaw(t)||null}setNodeFilesystem(e){let t=re(),n=this.fs._onChange;this.fs=new t(e,n)}setFilesystem(e,t={}){let r=this.fs._getFileRaw(this.getVar(`PATH`))||{},i=this.fs.getRawPermissions(),a=this.fs._onChange;this.fs=new n(this.fs.cwd,e,Object.assign({},i,t),a),this.fs.addFiles(r)}setCwd(e){this.fs.setCwd(e)}source(e){this.vars=Object.assign({},this.vars,e.vars),this.aliases=Object.assign({},this.aliases,e.aliases)}clear(){typeof this._clearFn==`function`&&this._clearFn()}destroy(e=0){typeof this._destroyFn==`function`&&this._destroyFn(e)}}})),Y=t(((e,t)=>{var n=W();t.exports=class extends n{constructor(e,t){super(e,t)}}})),ie=t(((e,t)=>{var n=Y();function r(e){return/^#!\/(sh\.js|bin\/(sh|brsh))/.test(e)}t.exports=class extends n{constructor(e,t,n,r=!1){super(t,n),this.script=e,this.source=r}get captureInput(){return!!(this.sandbox&&this.sandbox.runningCommand&&this.sandbox.runningCommand.captureInput)}onInput(e){this.sandbox&&this.sandbox.onInput(e)}run(){let e=this.context&&this.context.fs||this.fs,t=e&&e.isRealFilesystem?{useRealFilesystem:!0}:{filesystem:e&&e.getRaw()||{},permissions:e&&e.getRawPermissions()||{}};this.sandbox=new globalThis.shell({cwd:e&&e.cwd||`/`,...t,subshell:!0}),this.sandbox.context.source(this.context),Array.isArray(this.arguments)&&(this.arguments.forEach((e,t)=>this.sandbox.context.setVar(String(t+1),e)),this.sandbox.context.setVar(`#`,String(this.arguments.length)),this.sandbox.context.setVar(`@`,this.arguments.join(` `)),this.sandbox.context.setVar(`*`,this.arguments.join(` `))),this.sandbox.on(`stdOut`,e=>{this.stdOut=e,this.flush()}),this.sandbox.on(`stdErr`,e=>{this.stdErr=e,this.flush()}),this._scriptFunctions={};let n=this.script.split(/\r?\n/);if(!r(n[0])){let e=n[0].startsWith(`#!`)?n[0].slice(2).split(/\s/)[0]:n[0];return Promise.reject(`${e}: bad interpreter: No such file or directory`)}let i=this._parseLines(n.slice(1));return this._executeNodes(i).catch(e=>{if(e&&e.__type===`return`)this.sandbox.lastCode=e.code;else if(e&&e.__type===`errexit`)this.sandbox.lastCode=e.code;else if(e&&(e.__type===`break`||e.__type===`continue`))this.stdErr=`${e.__type}: only meaningful in a for or while loop`,this.sandbox.lastCode=1;else return Promise.reject(e)}).then(()=>{this.exitCode=this.sandbox.lastCode,this.source&&this.context.source(this.sandbox.context)})}_accumulateLines(e){let t=[],n=null,r=!1,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];n===null?n=s:a?n+=s:r||i?n+=`
|
|
4
|
-
`+s:n+=s;let c=0,l=!1,u=!1;for(;c<s.length;){let e=s[c];if(r)e===`'`&&(r=!1),c++;else if(i)e===`\\`&&c+1<s.length?c+=2:e===`\\`&&c+1===s.length?(l=!0,c++):(e===`"`&&(i=!1),c++);else{if(e===`#`&&(c===0||/\s/.test(s[c-1]))){u=!0;break}e===`\\`&&c+1<s.length?c+=2:e===`\\`&&c+1===s.length?(l=!0,c++):e===`'`?(r=!0,c++):(e===`"`&&(i=!0),c++)}}if(!r&&!l&&!u){let e=s.match(/(\\+)\s*$/);e&&e[1].length%2==1&&(l=!0)}a=l,l&&(n=n.replace(/\\\s*$/,``)),!r&&!i&&!l&&(t.push(n),n=null,a=!1)}return n!==null&&t.push(n),t}_parseLines(e){e=this._accumulateLines(e);let t=[],n=0;for(;n<e.length;){let r=e[n].trim();if(!r||r.startsWith(`#`)){n++;continue}if(r.startsWith(`if `)||r===`if`){let r=this._parseIf(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`while `)){let r=this._parseWhile(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`for `)){let r=this._parseFor(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`case `)||r===`case`){let r=this._parseCase(e,n);t.push(r.node),n+=r.consumed;continue}if(/^(?:function\s+[\w\d_]+|[\w\d_]+\s*\(\s*\))\s*(?:\{.*)?$/.test(r)){let r=this._parseFunction(e,n);t.push(r.node),n+=r.consumed;continue}t.push({type:`command`,line:r}),n++}return t}_parseIf(e,t){let n=e=>e.replace(/^(?:if|elif)\s+/,``).replace(/\s*;\s*then\s*$/,``).replace(/\s+then\s*$/,``).trim(),r=[{condition:n(e[t].trim()),bodyLines:[]}],i=[],a=r[0],o=!1,s=1,c=t+1;for(c<e.length&&e[c].trim()===`then`&&c++;c<e.length;){let t=e[c].trim();if((t.startsWith(`if `)||t===`if`)&&s++,t===`fi`&&(s--,s===0)){c++;break}if(s===1&&t.startsWith(`elif `)){let i={condition:n(t),bodyLines:[]};r.push(i),a=i,c++,c<e.length&&e[c].trim()===`then`&&c++;continue}if(s===1&&t===`else`){o=!0,c++;continue}o?i.push(e[c]):a.bodyLines.push(e[c]),c++}return{node:{type:`if`,clauses:r,elseLines:i},consumed:c-t}}_parseWhile(e,t){let n=e[t].trim().replace(/^while\s+/,``).replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).trim(),r=t+1;r<e.length&&e[r].trim()===`do`&&r++;let i=[],a=1;for(;r<e.length;){let t=e[r].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&a++,t===`done`&&(a--,a===0)){r++;break}i.push(e[r]),r++}return{node:{type:`while`,condition:n,bodyLines:i},consumed:r-t}}_parseFor(e,t){let n=e[t].trim().replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).match(/^for\s+(\w+)\s+in\s+(.+)$/),r=n?n[1]:``,i=n?n[2].trim():``,a=t+1;a<e.length&&e[a].trim()===`do`&&a++;let o=[],s=1;for(;a<e.length;){let t=e[a].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&s++,t===`done`&&(s--,s===0)){a++;break}o.push(e[a]),a++}return{node:{type:`for`,variable:r,list:i,bodyLines:o},consumed:a-t}}async _executeNodes(e){for(let t of e)await this._executeNode(t)}_executeNode(e){if(e.type===`function`){let t=e.name,n=e.bodyLines,r=this,i=Y(),a=class extends i{static get name(){return t}run(){let e=this.arguments.map((e,t)=>({key:String(t+1),prev:r.sandbox.context.getVar(String(t+1))}));this.arguments.forEach((e,t)=>r.sandbox.context.setVar(String(t+1),e));let t=()=>e.forEach(({key:e,prev:t})=>t?r.sandbox.context.setVar(e,t):r.sandbox.context.unsetVar(e));return r._executeFunctionBody(n).then(()=>{t()}).catch(e=>{if(t(),e&&e.__type===`return`){this.exitCode=e.code;return}return Promise.reject(e)})}};return this.sandbox.context.setCommand(a),Promise.resolve()}if(e.type===`command`){if(/^return(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^return\s+(\d+)/),n=t?parseInt(t[1],10):0;return Promise.reject({__type:`return`,code:n})}if(/^break(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^break\s+(\d+)/),n=t?parseInt(t[1],10):1;return Promise.reject({__type:`break`,count:n})}if(/^continue(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^continue\s+(\d+)/),n=t?parseInt(t[1],10):1;return Promise.reject({__type:`continue`,count:n})}return(this.sandbox.context.getVar(`-`)||``).includes(`x`)&&(this.stdErr=`+ ${e.line.trim()}`,this.flush()),this.sandbox.onCommand(e.line,!1).then(()=>{if((this.sandbox.context.getVar(`-`)||``).includes(`e`)&&this.sandbox.lastCode!==0)return Promise.reject({__type:`errexit`,code:this.sandbox.lastCode})})}return e.type===`if`?this._executeIf(e):e.type===`while`?this._executeWhile(e):e.type===`for`?this._executeFor(e):e.type===`case`?this._executeCase(e):Promise.resolve()}async _executeIf(e){for(let t of e.clauses)if(await this.sandbox.onCommand(t.condition,!1),this.sandbox.lastCode===0)return this._executeNodes(this._parseLines(t.bodyLines));if(e.elseLines.length>0)return this._executeNodes(this._parseLines(e.elseLines))}async _executeWhile(e){for(;await this.sandbox.onCommand(e.condition,!1),this.sandbox.lastCode===0;)try{await this._executeNodes(this._parseLines(e.bodyLines))}catch(e){if(e&&e.__type===`break`){if(e.count<=1)break;throw{__type:`break`,count:e.count-1}}if(e&&e.__type===`continue`){if(e.count<=1)continue;throw{__type:`continue`,count:e.count-1}}throw e}}async _executeFor(e){let t=e.list.replace(/\${?([\w\d]+)}?/g,(e,t)=>this.sandbox.context.getVar(t)||``).split(/\s+/).filter(Boolean);for(let n of t){this.sandbox.context.setVar(e.variable,n);try{await this._executeNodes(this._parseLines(e.bodyLines))}catch(e){if(e&&e.__type===`break`){if(e.count<=1)break;throw{__type:`break`,count:e.count-1}}if(e&&e.__type===`continue`){if(e.count<=1)continue;throw{__type:`continue`,count:e.count-1}}throw e}}}_parseFunction(e,t){let n=e[t].trim(),r=n.match(/^function\s+([\w\d_]+)/)||n.match(/^([\w\d_]+)\s*\(/),i=r?r[1]:``,a=t+1;if(!n.includes(`{`)){for(;a<e.length&&!e[a].includes(`{`);)a++;a++}let o=[],s=1;for(;a<e.length;){if(e[a].trim()===`}`){a++;break}let t=(e[a].match(/\{/g)||[]).length,n=(e[a].match(/\}/g)||[]).length;if(s+=t-n,s<=0){a++;break}o.push(e[a]),a++}return{node:{type:`function`,name:i,bodyLines:o},consumed:a-t}}_parseCase(e,t){let n=e[t].trim().match(/^case\s+(.+?)\s+in\s*$/),r=n?n[1]:``,i=t+1,a=[],o=null,s=[];for(;i<e.length;){let t=e[i],n=t.trim();if(i++,!(!n||n.startsWith(`#`))){if(n===`esac`)break;if(o===null){let e=n.match(/^(.+?)\)\s*(.*)$/);if(e){o=e[1].trim();let t=e[2].trim();if(t===`;;`)a.push({pattern:o,bodyLines:[]}),o=null;else if(t.endsWith(`;;`)){let e=t.slice(0,-2).trim();a.push({pattern:o,bodyLines:e?[e]:[]}),o=null}else s=t?[t]:[]}}else n===`;;`?(a.push({pattern:o,bodyLines:s}),o=null,s=[]):n.endsWith(`;;`)?(s.push(n.slice(0,-2).trim()),a.push({pattern:o,bodyLines:s}),o=null,s=[]):s.push(t)}}return o!==null&&a.push({pattern:o,bodyLines:s}),{node:{type:`case`,word:r,clauses:a},consumed:i-t}}_executeFunctionBody(e){return this._executeNodes(this._parseLines(e))}async _executeCase(e){let t=await this.sandbox._replaceVariables(e.word),n=t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t;for(let t of e.clauses)if(this._matchPattern(t.pattern,n))return this._executeNodes(this._parseLines(t.bodyLines))}_matchPattern(e,t){let n=``,r=0;for(;r<e.length;){let t=e[r];if(t===`[`){let t=e.indexOf(`]`,r+1);t===-1?(n+=`\\[`,r++):(n+=e.slice(r,t+1),r=t+1)}else t===`*`?(n+=`.*`,r++):t===`?`?(n+=`.`,r++):/[.+^${}()|\\]/.test(t)?(n+=`\\`+t,r++):(n+=t,r++)}try{return RegExp(`^`+n+`$`).test(t)}catch{return!1}}},t.exports.isKnownInterpreter=r})),ae=t(((e,t)=>{y();var n=ie(),{BinaryFile:r}=te(),i=0,a=8,o=20,s=28,c=31,l=44,u=54,d=70,f=0,p=2,m=3,h=4,g=1,_=2,b=4,x=8,S=1,C=class extends n{get name(){return`wasm`}get requiresFilesystem(){return!0}get interactive(){if((this.arguments||[]).some(e=>e===`--help`||e===`-h`||e===`--version`||e===`-V`||e===`-v`))return!1;if(this._isInteractive!==void 0)return!!this._isInteractive;if(this._pkgMeta&&this._pkgMeta.interactive!==void 0)return!!this._pkgMeta.interactive;let e=(this.script||this.name||``).toLowerCase();return e===`nano`||e.endsWith(`/nano`)||e.endsWith(`nano.wasm`)}get captureInput(){return this.interactive}_enterAltScreen(){this._inAltScreen||(this._inAltScreen=!0,this.stdinStream&&typeof this.stdinStream.setRawMode==`function`&&this.stdinStream.setRawMode(!0),this.stdout&&typeof this.stdout.write==`function`&&this.stdout.write(`\x1B[?1049h\x1B[2J\x1B[H`))}_exitAltScreen(){this._inAltScreen&&(this._inAltScreen=!1,this.stdinStream&&typeof this.stdinStream.setRawMode==`function`&&this.stdinStream.setRawMode(!1),this.stdout&&typeof this.stdout.write==`function`&&this.stdout.write(`\x1B[?1049l\x1B[?25h`))}_keyToBytes(e){if(!e)return null;if(typeof e!=`string`)return e instanceof Uint8Array?e:new Uint8Array([Number(e)&255]);let t=e.match(/^\^([A-Za-z@\[\\\]^_?])$/);if(t){let e=t[1].toUpperCase();return e===`?`?new Uint8Array([127]):new Uint8Array([e.charCodeAt(0)-64])}let n={Enter:`\r`,Return:`\r`,Backspace:``,Tab:` `,Escape:`\x1B`,ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Home:`\x1B[H`,End:`\x1B[F`,PageUp:`\x1B[5~`,PageDown:`\x1B[6~`,Delete:`\x1B[3~`,Insert:`\x1B[2~`};return n[e]?new TextEncoder().encode(n[e]):new TextEncoder().encode(e)}onInput(e){if(!this._handlingStreamData){if(typeof this._externalKeyHandler==`function`){this._externalKeyHandler(e);return}this.stdinStream&&this.stdinStream.isRaw}}runCommand(){return super.runCommand().finally(()=>{this._inAltScreen&&this._exitAltScreen()})}run(){let e=this.script,t=(()=>{try{return q()}catch{return null}})();return this._loadBytes(e,t).then(({bytes:e,isWat:t})=>t?this._runWat(e):this._runWasm(e)).catch(e=>{this.stdErr=e.message||String(e),this.exitCode=1})}_loadBytes(e,t){let n=this.context&&this.context.fs||this.fs;if(!n)return Promise.reject(Error(`${e}: Filesystem is not available`));if(n.isRealFilesystem&&t)try{let r=t.readFileSync(n.absolutePath(e)),i=new Uint8Array(r);return Promise.resolve({bytes:i,isWat:this._isWat(e,i)})}catch(t){return Promise.reject(Error(`${e}: ${t.message}`))}let r=n.getFileByPath(e);if(r==null)return Promise.reject(Error(`${e}: No such file or directory`));let i=this._contentToBytes(r);return Promise.resolve({bytes:i,isWat:this._isWat(e,i)})}_isWat(e,t){return e.endsWith(`.wat`)?!0:t.length>0&&t[0]===40}_contentToBytes(e){if(e instanceof Uint8Array)return e;if(v!==void 0&&v.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}async _runWat(e){let t=new TextDecoder().decode(e),n,r;try{r=await import(`wabt`)}catch{this.stdErr=`${this.script}: WAT execution requires the 'wabt' package\nInstall it with: npm install wabt`,this.exitCode=1;return}try{let e=r.default??r,{buffer:i}=(typeof e==`function`?await e():e).parseWat(this.script,t,{mutable_globals:!0}).toBinary({});n=new Uint8Array(i)}catch(e){this.stdErr=`${this.script}: WAT compilation error: ${e.message}`,this.exitCode=1;return}return this._runWasm(n)}async _runWasm(e){if(typeof WebAssembly>`u`){this.stdErr=`${this.script}: WebAssembly is not available in this environment`,this.exitCode=1;return}let t={1:``,2:``},n=new TextDecoder,y=new TextEncoder,C=null,w=null,T=!1,E=0,D=null,O=null,j=null,M=null,N=!!(this.interactive&&(this.stdin===void 0||this.stdin===null||this.stdin===this.stdinStream||this.stdin&&this.stdin.isTTY)),P=(e,n)=>{if(N&&(e===1||e===2)){if(e===1&&this.stdout){this.stdout.write(n);return}if(e===2&&this.stderr){this.stderr.write(n);return}}t[e]=(t[e]||``)+n;let r=t[e].split(`
|
|
5
|
-
`);t[e]=r.pop();for(let t of r)e===1?this.stdOut=t:this.stdErr=t},F=()=>{t[1]&&=(N&&this.stdout?this.stdout.write(t[1]):this.stdOut=t[1],``),t[2]&&=(N&&this.stderr?this.stderr.write(t[2]):this.stdErr=t[2],``)},I=[],ee=e=>{if(!(!e||e.length===0)){for(let t=0;t<e.length;t++)I.push(e[t]);if(O){let e=O;O=null,e()}}};M=e=>{this._handlingStreamData=!0;try{ee(typeof e==`string`?y.encode(e):e instanceof Uint8Array?e:v!==void 0&&v.isBuffer(e)?new Uint8Array(e):y.encode(String(e??``)))}finally{this._handlingStreamData=!1}},this._externalKeyHandler=e=>{if(this._handlingStreamData)return;let t=this._keyToBytes(e);t&&ee(t)},N&&this.stdinStream&&typeof this.stdinStream.on==`function`&&this.stdinStream.on(`data`,M),N&&this.stdin&&this.stdin!==this.stdinStream&&typeof this.stdin.on==`function`&&this.stdin.on(`data`,M);let L=!N&&typeof this.stdin==`string`?y.encode(this.stdin):!N&&this.stdin instanceof Uint8Array?this.stdin:!N&&v!==void 0&&v.isBuffer(this.stdin)?new Uint8Array(this.stdin):new Uint8Array,R=0,z=this.context&&this.context.fs?this.context.fs:this.fs,B=this.context&&this.context.fs&&this.context.fs.cwd||this.fs&&this.fs.cwd||this.context&&typeof this.context.getVar==`function`&&this.context.getVar(`PWD`)||z&&z.cwd||`/`,V=B.length>1&&B.endsWith(`/`)?B.slice(0,-1):B,H=5,U=new Map([[3,{type:`preopen`,path:`/`,guestName:`/`}],[4,{type:`preopen`,path:V,guestName:`.`}]]),W=e=>{let t=e.split(`/`).filter(Boolean);return t.pop(),`/`+t.join(`/`)},G=(e,t)=>{let n=U.get(e);if(!n||n.type!==`preopen`&&n.type!==`dir`)return null;if(t.startsWith(`/`))return z.absolutePath(t);if(!t||t===`.`)return z.absolutePath(n.path);let r=n.path.endsWith(`/`)?n.path:n.path+`/`,i=z.absolutePath(r+t),a=z.absolutePath(`/`+t);if(n.path!==`/`){if(z.exists(i))return i;if(z.exists(a))return a;let e=z.exists(W(i));return z.exists(W(a))&&!e?a:i}if(z.exists(i))return i;let o=z.absolutePath(t);return z.exists(o)?o:i},K=e=>{if(!(!e||e.type!==`file`||!e.dirty||!z))try{let t=!0;for(let n=0;n<e.bytes.length;n++)if(e.bytes[n]===0){t=!1;break}if(t){let t=n.decode(e.bytes);z.setFileByPath(e.path,t,!0)}else{let t=new Uint8Array(e.bytes.length);t.set(e.bytes),z.setFileByPath(e.path,new r(t.buffer,`application/octet-stream`),!0)}e.dirty=!1}catch{}},te={TERM:`xterm-256color`,COLORTERM:`truecolor`,COLUMNS:String(this.stdout&&this.stdout.columns||this.context&&typeof this.context.getVar==`function`&&this.context.getVar(`COLUMNS`)||80),LINES:String(this.stdout&&this.stdout.rows||this.context&&typeof this.context.getVar==`function`&&this.context.getVar(`LINES`)||24),...this.context&&this.context.vars||{}},q=Object.entries(te).map(([e,t])=>`${e}=${t}`),ne=new Proxy({fd_write:(e,t,r,o)=>{if(!C)return a;let s=new DataView(C.buffer);if(e===1||e===2){let a=0;for(let i=0;i<r;i++){let r=s.getUint32(t+i*8,!0),o=s.getUint32(t+i*8+4,!0);o>0&&P(e,n.decode(new Uint8Array(C.buffer,r,o))),a+=o}return s.setUint32(o,a,!0),i}let c=U.get(e);if(!c||c.type!==`file`)return a;let l=0;for(let e=0;e<r;e++){let n=s.getUint32(t+e*8,!0),r=s.getUint32(t+e*8+4,!0);if(r>0){let e=new Uint8Array(C.buffer,n,r),t=c.append?c.bytes.length:c.pos,i=t+r;if(i>c.bytes.length){let e=new Uint8Array(i);e.set(c.bytes),c.bytes=e}c.bytes.set(e,t),c.pos=t+r,c.dirty=!0,l+=r}}return s.setUint32(o,l,!0),i},fd_read:(e,t,n,r)=>{if(!C)return a;let o=new DataView(C.buffer);if(e===0){if(N&&T){if((typeof w?.exports?.asyncify_get_state==`function`?w.exports.asyncify_get_state():0)===2){w.exports.asyncify_stop_rewind();let e=0;for(let r=0;r<n&&I.length>0;r++){let n=o.getUint32(t+r*8,!0),i=o.getUint32(t+r*8+4,!0),a=Math.min(i,I.length),s=I.splice(0,a);new Uint8Array(C.buffer).set(s,n),e+=a}return o.setUint32(r,e,!0),i}if(I.length>0){let e=0;for(let r=0;r<n&&I.length>0;r++){let n=o.getUint32(t+r*8,!0),i=o.getUint32(t+r*8+4,!0),a=Math.min(i,I.length),s=I.splice(0,a);new Uint8Array(C.buffer).set(s,n),e+=a}return o.setUint32(r,e,!0),i}return w.exports.asyncify_start_unwind(E),D=new Promise(e=>{O=e}),o.setUint32(r,0,!0),i}let e=0;for(let r=0;r<n&&R<L.length;r++){let n=o.getUint32(t+r*8,!0),i=o.getUint32(t+r*8+4,!0),a=Math.min(i,L.length-R);new Uint8Array(C.buffer).set(L.slice(R,R+a),n),R+=a,e+=a}return o.setUint32(r,e,!0),i}let s=U.get(e);if(!s||s.type!==`file`)return a;let c=0;for(let e=0;e<n&&s.pos<s.bytes.length;e++){let n=o.getUint32(t+e*8,!0),r=o.getUint32(t+e*8+4,!0),i=Math.min(r,s.bytes.length-s.pos);new Uint8Array(C.buffer).set(s.bytes.subarray(s.pos,s.pos+i),n),s.pos+=i,c+=i}return o.setUint32(r,c,!0),i},fd_seek:(e,t,n,r,o)=>{if(!C)return a;if(e<=2)return d;let c=U.get(e);if(!c||c.type!==`file`)return a;let l,u,f;typeof t==`bigint`?(l=Number(t),u=n,f=r):(l=t,u=r,f=o);let p=c.pos;if(u===0)p=l;else if(u===1)p=c.pos+l;else if(u===2)p=c.bytes.length+l;else return s;return p<0?s:(c.pos=p,f&&new DataView(C.buffer).setBigUint64(f,BigInt(c.pos),!0),i)},fd_tell:(e,t)=>{if(!C)return a;let n=U.get(e);return!n||n.type!==`file`?a:(new DataView(C.buffer).setBigUint64(t,BigInt(n.pos),!0),i)},fd_close:e=>{if(e<=2)return i;let t=U.get(e);return t?(K(t),U.delete(e),i):a},fd_sync:e=>{let t=U.get(e);return t&&K(t),i},fd_datasync:e=>{let t=U.get(e);return t&&K(t),i},fd_prestat_get:(e,t)=>{if(!C)return a;let n=U.get(e);if(!n||n.type!==`preopen`)return a;let r=new DataView(C.buffer),o=y.encode(n.guestName);return r.setUint8(t,0),r.setUint32(t+4,o.length,!0),i},fd_prestat_dir_name:(e,t,n)=>{if(!C)return a;let r=U.get(e);if(!r||r.type!==`preopen`)return a;let o=y.encode(r.guestName);return new Uint8Array(C.buffer,t,Math.min(n,o.length)).set(o.subarray(0,n)),i},fd_fdstat_get:(e,t)=>{if(!C)return a;let n=new DataView(C.buffer),r=f;if(e<=2)r=p;else{let t=U.get(e);if(!t)return a;r=t.type===`preopen`||t.type===`dir`?m:h}for(let e=0;e<24;e++)n.setUint8(t+e,0);return n.setUint8(t,r),n.setBigUint64(t+8,18446744073709551615n,!0),n.setBigUint64(t+16,18446744073709551615n,!0),i},fd_fdstat_set_flags:()=>i,fd_filestat_get:(e,t)=>{if(!C)return a;let n=new DataView(C.buffer);for(let e=0;e<64;e++)n.setUint8(t+e,0);if(e<=2)return n.setUint8(t+16,p),i;let r=U.get(e);if(!r)return a;let o=r.type===`preopen`||r.type===`dir`;return n.setUint8(t+16,o?m:h),n.setBigUint64(t+24,1n,!0),n.setBigUint64(t+32,BigInt(r.bytes?r.bytes.length:0),!0),i},path_open:(e,t,r,s,d,f,p,m,h)=>{if(!C||!z)return a;let v=G(e,n.decode(new Uint8Array(C.buffer,r,s)));if(!v)return a;let w=z.stat(v),T=w!==null;if(d&b&&d&g&&T)return o;if(d&_){if(!T)return l;if(!w.isDirectory)return u;let e=H++;return U.set(e,{type:`dir`,path:v}),new DataView(C.buffer).setUint32(h,e,!0),i}if(T&&w.isDirectory)return c;if(!T&&!(d&g))return l;let E=new Uint8Array,D=!1;if(T&&!(d&x)){let e=z.getFileByPath(v);e!=null&&(E=typeof e==`string`?y.encode(e):new Uint8Array(this._contentToBytes(e)))}else D=!0;let O=H++;return U.set(O,{type:`file`,path:v,bytes:E,pos:m&S?E.length:0,append:!!(m&S),dirty:D}),new DataView(C.buffer).setUint32(h,O,!0),i},path_filestat_get:(e,t,r,o,s)=>{if(!C||!z)return a;let c=G(e,n.decode(new Uint8Array(C.buffer,r,o)));if(!c)return a;let u=z.stat(c);if(!u)return l;let d=new DataView(C.buffer);for(let e=0;e<64;e++)d.setUint8(s+e,0);return d.setUint8(s+16,u.isDirectory?m:h),d.setBigUint64(s+24,1n,!0),d.setBigUint64(s+32,BigInt(z.getSize(c)||0),!0),i},path_create_directory:(e,t,r)=>{if(!C||!z)return a;let o=G(e,n.decode(new Uint8Array(C.buffer,t,r)));if(!o)return a;try{return z.setFileByPath(o,{},!0),i}catch{return s}},path_unlink_file:(e,t,r)=>{if(!C||!z)return a;let o=G(e,n.decode(new Uint8Array(C.buffer,t,r)));if(!o||!z.exists(o))return l;try{return z.deleteFileByPath(o),i}catch{return s}},path_remove_directory:(e,t,r)=>{if(!C||!z)return a;let o=G(e,n.decode(new Uint8Array(C.buffer,t,r)));if(!o||!z.exists(o))return l;try{return z.deleteFileByPath(o),i}catch{return s}},path_rename:(e,t,r,o,c,u)=>{if(!C||!z)return a;let d=n.decode(new Uint8Array(C.buffer,t,r)),f=n.decode(new Uint8Array(C.buffer,c,u)),p=G(e,d),m=G(o,f);if(!p||!m)return a;if(!z.exists(p))return l;for(let e of U.values())e.path===p&&(K(e),e.path=m);try{let e=z.getFileByPath(p);return z.setFileByPath(m,e,!0),z.deleteFileByPath(p),i}catch{return s}},proc_exit:e=>{throw e!==0&&(this.exitCode=e),{_wasmExit:!0,code:e}},args_sizes_get:(e,t)=>{if(!C)return s;let n=[this.script,...this.arguments||[]],r=new DataView(C.buffer);return r.setUint32(e,n.length,!0),r.setUint32(t,n.reduce((e,t)=>e+y.encode(t).length+1,0),!0),i},args_get:(e,t)=>{if(!C)return s;let n=[this.script,...this.arguments||[]],r=new DataView(C.buffer),a=t;for(let t=0;t<n.length;t++){r.setUint32(e+t*4,a,!0);let i=y.encode(n[t]+`\0`);new Uint8Array(C.buffer).set(i,a),a+=i.length}return i},environ_sizes_get:(e,t)=>{if(!C)return s;let n=new DataView(C.buffer);n.setUint32(e,q.length,!0);let r=q.reduce((e,t)=>e+y.encode(t).length+1,0);return n.setUint32(t,r,!0),i},environ_get:(e,t)=>{if(!C)return s;let n=new DataView(C.buffer),r=t;for(let t=0;t<q.length;t++){n.setUint32(e+t*4,r,!0);let i=y.encode(q[t]+`\0`);new Uint8Array(C.buffer).set(i,r),r+=i.length}return i},clock_time_get:(e,t,n)=>{if(C){let e=BigInt(Date.now())*1000000n;new DataView(C.buffer).setBigUint64(n,e,!0)}return i},random_get:(e,t)=>{if(C){let n=new Uint8Array(C.buffer,e,t);for(let e=0;e<t;e++)n[e]=Math.random()*256|0}return i}},{get(e,t){return t in e?e[t]:()=>0}}),re=e=>{if(!C||!e)return``;try{let t=new DataView(C.buffer).getUint32(e-4,!0),n=new Uint16Array(C.buffer,e,t>>>1);return String.fromCharCode(...n)}catch{return``}},J={wasi_snapshot_preview1:ne,wasi_unstable:ne,env:new Proxy({print:(e,t)=>{C&&P(1,n.decode(new Uint8Array(C.buffer,e,t)))},eprint:(e,t)=>{C&&P(2,n.decode(new Uint8Array(C.buffer,e,t)))},log:e=>{P(1,re(e)+`
|
|
6
|
-
`)},logi:e=>{
|
|
7
|
-
`)},logf:e=>{
|
|
8
|
-
`)},trace:(e,t,...n)=>{let r=t>0?` `+n.slice(0,t).join(`, `):``;
|
|
9
|
-
`),!0);t.usage=i.usage,t.options=i.options}catch{}return t}function
|
|
10
|
-
`),o=r?O(n):null,s=r&&!!(o&&(o.usage||o.options.length>0)||t.some(e=>/\b(usage|options):/i.test(e.string))),c=t.filter(e=>e.type===`out`).map(e=>e.string),l=a&&c.length>0&&(this.exitCode===0||this.exitCode===void 0);if(r)if(s){let e=t.map(e=>e.string);this.result&&Array.isArray(this.result.std)&&(this.result.std.length=0),this.exitCode=0;for(let t of e)this.stdOut=t}else{this.result&&Array.isArray(this.result.std)&&(this.result.std.length=0),this.exitCode=0;for(let t of A(i,e,this._inspectedWasm))this.stdOut=t}else a&&!l?(this.result&&Array.isArray(this.result.std)&&(this.result.std.length=0),this.exitCode=0,this.stdOut=`${i} (${e.name} ${e.version||`wasm`} wasm)`):this.exitCode=0}}async _fetchWasmBytes(e){if(w.has(e))return w.get(e);let n=t.fetch||(typeof fetch==`function`?fetch:null);if(!n)throw Error(`fetch is not available in this environment`);let r=await n(e);if(!r||!r.ok)throw Error(`HTTP ${r?r.status:`error`} fetching ${e}`);let i=new Uint8Array(await r.arrayBuffer());return w.set(e,i),i}async _runRawWasmBytes(t,n){let r=new C(i,n,this.context);r.script=i,r.arguments=n,r.context=this.context,r.fs=this.fs,r._pkgMeta=e,this.stdin!==void 0&&(r.stdin=this.stdin),await r._runWasm(t);for(let e of r.result.getStdOutput())e.type===`out`?this.stdOut=e.string:e.type===`err`&&(this.stdErr=e.string);this.exitCode=r.result.getExitCode()}_createIoBridge(t,n,r){let a=e=>({write(t){(t instanceof Uint8Array?new TextDecoder().decode(t):String(t??``)).replace(/\r?\n$/,``).split(/\r?\n/).forEach(t=>e.push(t))}});return{binName:i,args:t,stdin:this.stdin!==void 0&&this.stdin!==null?String(this.stdin):``,fs:this.fs,context:this.context,wasmPath:e.wasmPath||null,wasmBytes:this._persistedWasmBytes||null,stdout:Object.assign(e=>n.push(String(e)),a(n)),stderr:Object.assign(e=>r.push(String(e)),a(r)),readFile:(e,t)=>{if(!this.fs)return null;let n=t&&t!==`.`&&!e.startsWith(`/`)?`${t.replace(/\/+$/,``)}/${e}`:e,r=this.fs.getFileByPath(n)??this.fs.getFileByPath(e);return r==null?null:typeof r==`string`?r:new TextDecoder().decode(r)},readBytes:e=>T(this.fs,e),writeFile:(e,t,n)=>{if(!this.fs)return;let r=n&&n!==`.`&&!e.startsWith(`/`)?`${n.replace(/\/+$/,``)}/${e}`:e;if(t instanceof Uint8Array||ArrayBuffer.isView(t)){let e=r.endsWith(`.wasm`)?`application/wasm`:`application/octet-stream`;E(this.fs,r,t,e)}else this.fs.setFileByPath(r,String(t),!0);if(r.endsWith(`.wasm`)||r.endsWith(`.wat`))try{this.context&&this.context.fs?this.context.fs.setMode(r,493):this.fs.setMode(r,493)}catch{}},listFiles:(e,t)=>{if(!this.fs)return[];let n=t&&t!==`.`&&!e.startsWith(`/`)?`${t.replace(/\/+$/,``)}/${e}`:e,r=this.fs.getFileByPath(n);return r&&typeof r==`object`&&!(r instanceof Uint8Array)?Object.keys(r):[]}}}async _runFunctionOrEmscripten(t,n,r=!1){let i=[],a=[],o=new TextEncoder().encode(this.stdin||``),s=0,c=new Set,l={arguments:n,noInitialRun:!0,...this._persistedWasmBytes&&this._persistedWasmBytes.byteLength>0?{wasmBinary:this._persistedWasmBytes}:{},...e.wasmUrl?{locateFile:t=>t.endsWith(`.wasm`)?e.wasmUrl:t}:{},print:e=>{i.push(String(e))},printErr:e=>{a.push(String(e))},stdin:()=>s<o.length?o[s++]:null,preRun:[e=>{e&&e.FS&&(c=this._syncBrshToEmscriptenFs(e.FS,n))}]},u=this._createIoBridge(n,i,a),d;try{d=t.prototype&&t.prototype.constructor===t&&Object.getOwnPropertyNames(t.prototype).length>1?new t(l,u):await t(l,u)}catch(e){if(e&&typeof e.status==`number`)this.exitCode=e.status;else throw e}if(d&&typeof d==`object`)if(r&&(d.wasmBinary instanceof Uint8Array||d.HEAPU8 instanceof Uint8Array)&&(this._inspectedWasm=k(d.wasmBinary||d.HEAPU8)),typeof d.callMain==`function`){d.FS&&c.size===0&&(c=this._syncBrshToEmscriptenFs(d.FS,n));try{let e=await d.callMain(n);typeof e==`number`&&e!==0&&(this.exitCode=e)}catch(e){e&&typeof e.status==`number`?this.exitCode=e.status:(a.push(e.message||String(e)),this.exitCode=1)}d.FS&&this._syncEmscriptenFsToBrsh(d.FS,n,c)}else if(typeof d.exec==`function`&&typeof d.writeFile==`function`)await this._runVirtualFsInstance(d,n,i,a);else if(typeof d.main==`function`||typeof d.run==`function`){let e=(d.main||d.run).bind(d);await this._invokeCliFunction(e,n,i,a)}else !r&&!isVersion&&typeof d.Database==`function`?this._runSqlJsDatabase(d,n,u,i):(typeof d.stdout==`string`&&d.stdout&&d.stdout.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)),typeof d.stderr==`string`&&d.stderr&&d.stderr.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>a.push(e)),d.error&&a.length===0&&(a.push(d.error.message||String(d.error)),this.exitCode=1),typeof d.exitCode==`number`&&(this.exitCode=d.exitCode));else typeof d==`string`?d.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)):typeof d==`number`&&(this.exitCode=d);i.forEach(e=>{this.stdOut=e}),a.forEach(e=>{this.stdErr=e})}_runSqlJsDatabase(e,t,n,r){let i=`list`,a=`:memory:`,o=null,s=[];for(let e=0;e<t.length;e++){let n=t[e];n===`-table`||n===`--table`||n===`-box`?i=`table`:n===`-csv`||n===`--csv`?i=`csv`:n===`-cmd`&&e+1<t.length?o=t[++e]:n.startsWith(`-`)||s.push(n)}if(s.length===1?/^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|PRAGMA|WITH|BEGIN|EXPLAIN|\.)\b/i.test(s[0])?o=s[0]:a=s[0]:s.length>=2&&(a=s[0],o=s.slice(1).join(` `)),!o&&n.stdin&&n.stdin.trim()&&(o=n.stdin.trim()),!o)return;let c=a===`:memory:`?null:n.readBytes(a),l=c&&c.byteLength>0?new e.Database(c):new e.Database;try{if(o.trim()===`.tables`){let e=l.exec(`SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name`),t=e[0]&&e[0].values?e[0].values.map(e=>e[0]):[];t.length>0&&r.push(t.join(` `))}else{let e=l.exec(o);for(let t of e){let e=(t.columns||[]).map(String),n=t.values||[];if(i===`table`&&e.length>0){let t=e.map(e=>e.length),i=n.map(n=>e.map((e,r)=>{let i=n[r]==null?`NULL`:String(n[r]);return i.length>t[r]&&(t[r]=i.length),i}));r.push(e.map((e,n)=>` `+e.padEnd(t[n])+` `).join(`|`)),r.push(t.map(e=>`-`.repeat(e+2)).join(`+`)),i.forEach(e=>r.push(e.map((e,n)=>` `+e.padEnd(t[n])+` `).join(`|`)))}else if(i===`csv`){let t=e=>{let t=e==null?``:String(e);return/[",\r\n]/.test(t)?`"`+t.replace(/"/g,`""`)+`"`:t};e.length>0&&r.push(e.map(t).join(`,`)),n.forEach(n=>r.push(e.map((e,r)=>t(n[r])).join(`,`)))}else n.forEach(t=>r.push(e.map((e,n)=>t[n]==null?``:String(t[n])).join(`|`)))}}a!==`:memory:`&&n.writeFile(a,l.export())}finally{l.close()}}async _runVirtualFsInstance(t,n,r,i){typeof t.on==`function`&&t.on(`log`,({message:e})=>{e&&r.push(e)}),!t.loaded&&typeof t.load==`function`&&await t.load(e.coreUrl?{coreURL:e.coreUrl}:void 0);let a=new Set,o=[];for(let e of n)if(!e.startsWith(`-`)&&(o.push(e),this.fs.exists(e))){let n=T(this.fs,e);n&&(await t.writeFile(e,n),a.add(e))}let s=await t.exec(n);for(let e of o)if(!a.has(e))try{if(typeof t.readFile==`function`){let n=await t.readFile(e);n&&E(this.fs,e,n)}}catch{}typeof s==`number`&&s!==0&&(this.exitCode=s,i.length===0&&r.length>0&&i.push(...r.splice(0,r.length)))}async _invokeCliFunction(e,t,n=null,r=null){let i=n||[],a=r||[],o=await e(t,this._createIoBridge(t,i,a));typeof o==`string`?o.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)):typeof o==`number`?this.exitCode=o:o&&typeof o==`object`&&(typeof o.stdout==`string`&&o.stdout&&o.stdout.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)),typeof o.stderr==`string`&&o.stderr&&o.stderr.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>a.push(e)),o.error?(a.length===0&&a.push(o.error.message||String(o.error)),this.exitCode=typeof o.exitCode==`number`?o.exitCode:1):typeof o.exitCode==`number`&&(this.exitCode=o.exitCode)),n||(i.forEach(e=>{this.stdOut=e}),a.forEach(e=>{this.stdErr=e}))}_syncBrshToEmscriptenFs(e,t){let n=new Set;if(!this.fs||!e||typeof e.writeFile!=`function`)return n;for(let r of t)if(!r.startsWith(`-`)&&this.fs.exists(r)){let t=T(this.fs,r);if(t)try{e.writeFile(r,t),n.add(r)}catch{}}return n}_syncEmscriptenFsToBrsh(e,t,n){if(!(!this.fs||!e||typeof e.readFile!=`function`)){for(let r of t)if(!(r.startsWith(`-`)||n.has(r)))try{let t=e.readFile(r);if(t){let e=r.endsWith(`.wasm`)?`application/wasm`:`application/octet-stream`;if(E(this.fs,r,t,e),r.endsWith(`.wasm`)||r.endsWith(`.wat`))try{this.context&&this.context.fs?this.context.fs.setMode(r,493):this.fs.setMode(r,493)}catch{}}}catch{}}}}return a}C.readBytesFromFs=T,C.writeBytesToFs=E,C.loadModule=D,C.extractHelpFromText=O,C.inspectWasmBytes=k,C.formatWasmHelp=A,C.createGenericWasmCommand=j,C.createCommand=j,t.exports=C})),oe=t(((e,t)=>{var n=W(),r=class extends n{static get name(){return`test`}get requiresFilesystem(){return!0}run(){let e=[...this.arguments];return e[e.length-1]===`]`&&e.pop(),this._evaluate(e)||(this.exitCode=1),Promise.resolve()}_evaluate(e){if(e.length===0)return!1;let t=e.indexOf(`-o`);if(t!==-1)return this._evaluate(e.slice(0,t))||this._evaluate(e.slice(t+1));let n=e.indexOf(`-a`);if(n!==-1)return this._evaluate(e.slice(0,n))&&this._evaluate(e.slice(n+1));if(e[0]===`!`)return!this._evaluate(e.slice(1));if(e.length===1)return e[0].length>0;if(e.length===2){let[t,n]=e;switch(t){case`-n`:return n.length>0;case`-z`:return n.length===0;case`-e`:return this.fs?this.fs.getFileByPath(n)!=null:!1;case`-f`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e!=null&&e.constructor!==Object}case`-d`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e!=null&&e.constructor===Object}case`-r`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&292)!=0}case`-w`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&146)!=0}case`-x`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&73)!=0}case`-s`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e==null||e.constructor===Object?!1:e.toString().length>0}default:return!1}}if(e.length===3){let[t,n,r]=e;switch(n){case`=`:case`==`:return t===r;case`!=`:return t!==r;case`-eq`:return parseInt(t)===parseInt(r);case`-ne`:return parseInt(t)!==parseInt(r);case`-lt`:return parseInt(t)<parseInt(r);case`-le`:return parseInt(t)<=parseInt(r);case`-gt`:return parseInt(t)>parseInt(r);case`-ge`:return parseInt(t)>=parseInt(r);default:return!1}}return!1}};t.exports={Test:r,TestBracket:class extends r{static get name(){return`[`}}}})),se=t(((e,t)=>{var n=W();t.exports=class extends n{static get name(){return`cat`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=!1,r=[];for(let i of this.arguments)if(i.startsWith(`-`)&&i.length>1)for(let r of i.slice(1))r===`n`?e=!0:r===`b`?(t=!0,e=!1):r===`s`&&(n=!0);else r.push(i);let i=[];if(r.length===0){let e=typeof this.stdin==`string`?this.stdin:null;if(e==null)return this.stdErr=`cat: no file specified`,this.exitCode=1,Promise.resolve();i.push(e)}else for(let e of r){if(e===`-`){i.push(typeof this.stdin==`string`?this.stdin:``);continue}let t=this.fs.getFileByPath(e);if(t==null){let t=this.fs.exists(e)?`Permission denied`:`No such file or directory`;return this.stdErr=`${e}: ${t}`,this.exitCode=1,Promise.resolve()}if(t.constructor===Object)return this.stdErr=`${e}: Is a directory`,this.exitCode=1,Promise.resolve();i.push(t.toString())}let a=i.join(``);a.endsWith(`
|
|
1
|
+
"use strict";var Shell=(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function n(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function r(e){var t=n(e),r=t[0],i=t[1];return(r+i)*3/4-i}function i(e,t,n){return(t+n)*3/4-n}function a(e){var t,r=n(e),a=r[0],o=r[1],s=new p(i(e,a,o)),c=0,l=o>0?a-4:a,u;for(u=0;u<l;u+=4)t=f[e.charCodeAt(u)]<<18|f[e.charCodeAt(u+1)]<<12|f[e.charCodeAt(u+2)]<<6|f[e.charCodeAt(u+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=t&255;return o===2&&(t=f[e.charCodeAt(u)]<<2|f[e.charCodeAt(u+1)]>>4,s[c++]=t&255),o===1&&(t=f[e.charCodeAt(u)]<<10|f[e.charCodeAt(u+1)]<<4|f[e.charCodeAt(u+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function o(e){return d[e>>18&63]+d[e>>12&63]+d[e>>6&63]+d[e&63]}function s(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(o(r));return i.join(``)}function c(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,c=n-r;o<c;o+=a)i.push(s(e,o,o+a>c?c:o+a));return r===1?(t=e[n-1],i.push(d[t>>2]+d[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(d[t>>10]+d[t>>4&63]+d[t<<2&63]+`=`)),i.join(``)}var l,u,d,f,p,m,h,g,_,v,y=e((()=>{for(l={},u={},u.byteLength=r,u.toByteArray=a,u.fromByteArray=c,d=[],f=[],p=typeof Uint8Array<`u`?Uint8Array:Array,m=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,h=0,g=m.length;h<g;++h)d[h]=m[h],f[m.charCodeAt(h)]=h;f[45]=62,f[95]=63,_={},_.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},_.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=u,n=_,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=d,e.SlowBuffer=C,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i;let{Uint8Array:a,ArrayBuffer:o,SharedArrayBuffer:s}=globalThis;d.TYPED_ARRAY_SUPPORT=c(),!d.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 c(){try{let e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function l(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new a(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return h(e)}return f(e,t,n)}d.poolSize=8192;function f(e,t,n){if(typeof e==`string`)return g(e,t);if(o.isView(e))return y(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(fe(e,o)||e&&fe(e.buffer,o)||s!==void 0&&(fe(e,s)||e&&fe(e.buffer,s)))return b(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,t,n);let i=x(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return d.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}d.from=function(e,t,n){return f(e,t,n)},Object.setPrototypeOf(d.prototype,a.prototype),Object.setPrototypeOf(d,a);function p(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function m(e,t,n){return p(e),e<=0||t===void 0?l(e):typeof n==`string`?l(e).fill(t,n):l(e).fill(t)}d.alloc=function(e,t,n){return m(e,t,n)};function h(e){return p(e),l(e<0?0:S(e)|0)}d.allocUnsafe=function(e){return h(e)},d.allocUnsafeSlow=function(e){return h(e)};function g(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=w(e,t)|0,r=l(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function v(e){let t=e.length<0?0:S(e.length)|0,n=l(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function y(e){if(fe(e,a)){let t=new a(e);return b(t.buffer,t.byteOffset,t.byteLength)}return v(e)}function b(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new a(e):n===void 0?new a(e,t):new a(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function x(e){if(d.isBuffer(e)){let t=S(e.length)|0,n=l(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||pe(e.length)?l(0):v(e);if(e.type===`Buffer`&&Array.isArray(e.data))return v(e.data)}function S(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function C(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,t){if(fe(e,a)&&(e=d.from(e,e.offset,e.byteLength)),fe(t,a)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},d.isEncoding=function(e){switch(String(e).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}},d.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=d.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(fe(t,a))i+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,i)):a.prototype.set.call(r,t,i);else if(d.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function w(e,t){if(d.isBuffer(e))return e.length;if(o.isView(e)||fe(e,o))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return se(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ue(e).length;default:if(i)return r?-1:se(e).length;t=(``+t).toLowerCase(),i=!0}}d.byteLength=w;function T(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return B(this,t,n);case`utf8`:case`utf-8`:return F(this,t,n);case`ascii`:return R(this,t,n);case`latin1`:case`binary`:return z(this,t,n);case`base64`:return P(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return V(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function E(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}d.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)E(this,t,t+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)E(this,t,t+3),E(this,t+1,t+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)E(this,t,t+7),E(this,t+1,t+6),E(this,t+2,t+5),E(this,t+3,t+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?F(this,0,e):T.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:d.compare(this,e)===0},d.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(d.prototype[r]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,i){if(fe(e,a)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let o=i-r,s=n-t,c=Math.min(o,s),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){o=l[e],s=u[e];break}return o<s?-1:+(s<o)};function D(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,pe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:O(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof a.prototype.indexOf==`function`?i?a.prototype.indexOf.call(e,t,n):a.prototype.lastIndexOf.call(e,t,n):O(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function O(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},d.prototype.indexOf=function(e,t,n){return D(this,e,t,n,!0)},d.prototype.lastIndexOf=function(e,t,n){return D(this,e,t,n,!1)};function k(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(pe(r))return o;e[n+o]=r}return o}function A(e,t,n,r){return de(se(t,e.length-n),e,n,r)}function j(e,t,n,r){return de(ce(t),e,n,r)}function M(e,t,n,r){return de(ue(t),e,n,r)}function N(e,t,n,r){return de(le(t,e.length-n),e,n,r)}d.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return k(this,e,t,n);case`utf8`:case`utf-8`:return A(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return j(this,e,t,n);case`base64`:return M(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return N(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},d.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function P(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function F(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return L(r)}let I=4096;function L(e){let t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}function R(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function z(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function B(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=me[e[r]];return i}function V(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,d.prototype),r};function H(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=Z(function(e){e>>>=0,re(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ie(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),d.prototype.readBigUInt64BE=Z(function(e){e>>>=0,re(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ie(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),d.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},d.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||H(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},d.prototype.readInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||H(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||H(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=Z(function(e){e>>>=0,re(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ie(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=Z(function(e){e>>>=0,re(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ie(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||H(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||H(e,8,this.length),n.read(this,e,!1,52,8)};function U(e,t,n,r,i,a){if(!d.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;U(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;U(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,255,0),this[t]=e&255,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function W(e,t,n,r,i){X(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function G(e,t,n,r,i){X(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}d.prototype.writeBigUInt64LE=Z(function(e,t=0){return W(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=Z(function(e,t=0){return G(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);U(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);U(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},d.prototype.writeBigInt64LE=Z(function(e,t=0){return W(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=Z(function(e,t=0){return G(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ee(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function K(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,4),n.write(e,t,r,i,23,4),r+4}d.prototype.writeFloatLE=function(e,t,n){return K(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return K(this,e,t,!1,n)};function q(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,8),n.write(e,t,r,i,52,8),r+8}d.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof a.prototype.copyWithin==`function`?this.copyWithin(t,n,r):a.prototype.set.call(e,this.subarray(n,r),t),i},d.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!d.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=d.isBuffer(e)?e:d.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let J={};function te(e,t,n){J[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}te(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),te(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),te(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ne(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ne(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ne(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function Y(e,t,n){re(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&ie(t,e.length-(n+1))}function X(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new J.ERR_OUT_OF_RANGE(`value`,i,e)}Y(r,i,a)}function re(e,t){if(typeof e!=`number`)throw new J.ERR_INVALID_ARG_TYPE(t,`number`,e)}function ie(e,t,n){throw Math.floor(e)===e?t<0?new J.ERR_BUFFER_OUT_OF_BOUNDS:new J.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(re(e,n),new J.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ae=/[^+/0-9A-Za-z-_]/g;function oe(e){if(e=e.split(`=`)[0],e=e.trim().replace(ae,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function se(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ce(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function le(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function ue(e){return t.toByteArray(oe(e))}function de(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function fe(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function pe(e){return e!==e}let me=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function Z(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}})(l),v=l.Buffer,l.Blob,l.BlobOptions,l.Buffer,l.File,l.FileOptions,l.INSPECT_MAX_BYTES,l.SlowBuffer,l.TranscodeEncoding,l.atob,l.btoa,l.constants,l.isAscii,l.isUtf8,l.kMaxLength,l.kStringMaxLength,l.resolveObjectURL,l.transcode})),b=t(((e,t)=>{y();var n=new Set([`cwd`,`getFileByPath`,`setFileByPath`,`deleteFileByPath`,`exists`,`stat`,`absolutePath`,`getMode`,`setMode`,`isReadable`,`isWritable`,`isExecutable`,`getSize`,`autoComplete`,`isRealFilesystem`,`isSymlink`,`readSymlink`,`createSymlink`]),r=class{isReadable(e){let t=this.getMode(e);return t===null?!1:(t&256)!=0}isWritable(e){let t=this.getMode(e);return t===null?!1:(t&128)!=0}isExecutable(e){let t=this.getMode(e);return t===null?!1:(t&64)!=0}sandbox(){let e=this;return new Proxy(Object.create(null),{get(t,r){if(!n.has(r))return;let i=e[r];return typeof i==`function`?i.bind(e):i},set(){return!1},has(e,t){return n.has(t)}})}_triggerChange(){!this._onChange||this._changeScheduled||(this._changeScheduled=!0,Promise.resolve().then(()=>{this._changeScheduled=!1,typeof this._onChange==`function`&&this._onChange(this.getRaw(),this.getRawPermissions())}))}},i=class extends Uint8Array{constructor(e,t){super(e),Object.defineProperty(this,"mimeType",{value:t,enumerable:!1,configurable:!1,writable:!1})}toString(){if(v!==void 0)return`data:${this.mimeType};base64,${v.from(this).toString(`base64`)}`;let e=``,t=8192;for(let n=0;n<this.length;n+=t)e+=String.fromCharCode(...this.subarray(n,n+t));return`data:${this.mimeType};base64,${btoa(e)}`}},a=class{constructor(e){this.target=e}};t.exports=r,t.exports.BinaryFile=i,t.exports.SymlinkRef=a}));function x(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function S(){throw Error(`setTimeout has not been defined`)}function C(){throw Error(`clearTimeout has not been defined`)}function w(e){if(M===setTimeout)return setTimeout(e,0);if((M===S||!M)&&setTimeout)return M=setTimeout,setTimeout(e,0);try{return M(e,0)}catch{try{return M.call(null,e,0)}catch{return M.call(this,e,0)}}}function T(e){if(N===clearTimeout)return clearTimeout(e);if((N===C||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(e);try{return N(e)}catch{try{return N.call(null,e)}catch{return N.call(this,e)}}}function E(){!F||!I||(F=!1,I.length?P=I.concat(P):L=-1,P.length&&D())}function D(){if(!F){var e=w(E);F=!0;for(var t=P.length;t;){for(I=P,P=[];++L<t;)I&&I[L].run();L=-1,t=P.length}I=null,F=!1,T(e)}}function O(e,t){this.fun=e,this.array=t}function k(){}var A,j,M,N,P,F,I,L,R,z,B=e((()=>{A={exports:{}},j=A.exports={},(function(){try{M=typeof setTimeout==`function`?setTimeout:S}catch{M=S}try{N=typeof clearTimeout==`function`?clearTimeout:C}catch{N=C}})(),P=[],F=!1,L=-1,j.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];P.push(new O(e,t)),P.length===1&&!F&&w(D)},O.prototype.run=function(){this.fun.apply(null,this.array)},j.title=`browser`,j.browser=!0,j.env={},j.argv=[],j.version=``,j.versions={},j.on=k,j.addListener=k,j.once=k,j.off=k,j.removeListener=k,j.removeAllListeners=k,j.emit=k,j.prependListener=k,j.prependOnceListener=k,j.listeners=function(e){return[]},j.binding=function(e){throw Error(`process.binding is not supported`)},j.cwd=function(){return`/`},j.chdir=function(e){throw Error(`process.chdir is not supported`)},j.umask=function(){return 0},R=A.exports,z=x(R)})),V=t(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),H=t(((e,t)=>{var n=[`out`,`err`];t.exports=class{constructor(e,t){if(!n.includes(e))throw Error(`incorrect std output type`);this.type=e,this.string=t}}})),U=t(((e,t)=>{var n=H();t.exports=class{constructor(e=[],t=0){if(typeof t!=`number`)throw Error(`Command Result ExitCode must be a number`);if(!Array.isArray(e))throw Error(`Command Result be array`);this.std=e,this.exitCode=t}addStdOutLine(e){this.std.push(new n(`out`,e))}addStdErrLine(e){this.std.push(new n(`err`,e))}getStdOutput(){return this.std}getExitCode(){return this.exitCode}flush(){let e=this.std;return this.std=[],e}}})),W=t(((e,t)=>{y();var n=V(),r=n.EventEmitter||n.default||n;function i(e){if(!e)return[];let t=typeof e==`string`?e:e instanceof Uint8Array||v!==void 0&&v.isBuffer(e)?new TextDecoder().decode(e):String(e),n=[],r=0;for(;r<t.length;){let e=t[r],i=t.charCodeAt(r);if(i===27){if(t.charCodeAt(r+1)===127||t.charCodeAt(r+1)===8){n.push(`^W`),r+=2;continue}if(t[r+1]===`[`||t[r+1]===`O`){let e=r+2;for(;e<t.length&&t.charCodeAt(e)>=32&&t.charCodeAt(e)<=63;)e++;if(e<t.length){let i=t.slice(r+2,e+1),a={A:`ArrowUp`,B:`ArrowDown`,C:`ArrowRight`,D:`ArrowLeft`,H:`Home`,F:`End`,"1~":`Home`,"3~":`Delete`,"4~":`End`,"5~":`PageUp`,"6~":`PageDown`,"7~":`Home`,"8~":`End`};a[i]&&n.push(a[i]),r=e+1;continue}}n.push(`Escape`),r++;continue}if(i===13||i===10){n.push(`Enter`),i===13&&t[r+1]===`
|
|
2
|
+
`&&r++,r++;continue}if(i===127||i===8){n.push(`Backspace`),r++;continue}if(i===9){n.push(`Tab`),r++;continue}if(i>=1&&i<=26){n.push(`^`+String.fromCharCode(i+64)),r++;continue}n.push(e),r++}return n}t.exports={TtyStream:class extends r{constructor(e={}){super(),this.isTTY=e.isTTY!==!1,this.readable=!0,this.writable=!0,this.columns=e.columns||80,this.rows=e.rows||24,this.isRaw=!1,this._encoding=null,this._onWrite=e.onWrite||null}write(e,t,n){return e==null?!0:(typeof this._onWrite==`function`&&this._onWrite(e),this.emit(`data`,this._formatChunk(e)),typeof t==`function`?t():typeof n==`function`&&n(),!0)}pushData(e){e!=null&&this.emit(`data`,this._formatChunk(e))}_formatChunk(e){return this._encoding?typeof e==`string`?e:e instanceof Uint8Array||v!==void 0&&v.isBuffer(e)?new TextDecoder().decode(e):String(e):e}setRawMode(e){return this.isRaw=!!e,this}setEncoding(e){return this._encoding=e,this}getWindowSize(){return[this.columns,this.rows]}resize(e,t){this.columns=e,this.rows=t,this.emit(`resize`)}resume(){return this}pause(){return this}pipe(e){return this.on(`data`,t=>e.write(t)),e}unpipe(){return this}end(e,t,n){return e!=null&&this.write(e,typeof t==`string`?t:void 0),this.emit(`end`),typeof t==`function`?t():typeof n==`function`&&n(),this}destroy(){this.removeAllListeners()}toString(){return``}valueOf(){return``}},parseVtKeys:i}})),G=t(((e,t)=>{var n=V(),r=U(),{TtyStream:i,parseVtKeys:a}=W(),o=n.EventEmitter||n.default||n;t.exports=class extends o{constructor(e,t){super(),this.arguments=e,this.result=new r,this.context=t||null;let n=this.context&&typeof this.context.getVar==`function`&&parseInt(this.context.getVar(`COLUMNS`),10)||80,o=this.context&&typeof this.context.getVar==`function`&&parseInt(this.context.getVar(`LINES`),10)||24;this.stdinStream=new i({columns:n,rows:o}),this.stdin=this.stdinStream,this.stdout=new i({columns:n,rows:o,onWrite:e=>this.emit(`stdout`,e)}),this.stderr=new i({columns:n,rows:o,onWrite:e=>this.emit(`stderr`,e)}),this.stdinStream.on(`data`,e=>{if(!this.captureInput)return;let t=a(e);for(let e of t)!this.interactive&&!this.stdinStream.isRaw&&(e===`Enter`?this.stdout.write(`\r
|
|
3
|
+
`):e===`Backspace`?this.stdout.write(`\b \b`):e.length===1&&this.stdout.write(e)),this.onInput(e)})}get name(){return`unnamed`}run(){return Promise.reject(`Command not implemented...`)}runCommand(){return Promise.resolve().then(()=>this.run()).then(e=>(e&&e.split(/\r?\n/).forEach(e=>this.stdOut=e),this.result)).catch(e=>{if(e&&e.__type)throw e;return e&&(this.stdErr=e.message||e),this.exitCode=127,this.result})}onInput(e){}set exitCode(e){this.result.exitCode=e}set stdOut(e){this.result.addStdOutLine(e)}set stdErr(e){this.result.addStdErrLine(e)}flush(){this.emit(`flush`,this.result.flush())}}})),ee=t(((e,t)=>{var n=G();t.exports=class extends n{get captureInput(){return!0}get interactive(){return!0}get terminalSize(){return this.stdout&&this.stdout.columns&&this.stdout.rows?{cols:parseInt(this.context&&this.context.getVar&&this.context.getVar(`COLUMNS`),10)||this.stdout.columns||80,rows:parseInt(this.context&&this.context.getVar&&this.context.getVar(`LINES`),10)||this.stdout.rows||24}:{cols:parseInt(this.context.getVar(`COLUMNS`),10)||80,rows:parseInt(this.context.getVar(`LINES`),10)||24}}_enterAltScreen(){this._inAltScreen||(this._inAltScreen=!0,this.stdinStream&&this.stdinStream.setRawMode(!0),this.stdout&&this.stdout.write(`\x1B[?1049h\x1B[2J\x1B[H`))}_exitAltScreen(){this._inAltScreen&&(this._inAltScreen=!1,this.stdinStream&&this.stdinStream.setRawMode(!1),this.stdout&&this.stdout.write(`\x1B[?1049l\x1B[?25h`))}runCommand(){return this.interactive&&this._enterAltScreen(),super.runCommand().finally(()=>{this._exitAltScreen()})}}})),K=t(((e,t)=>{y(),B();var{BinaryFile:n,SymlinkRef:r}=b(),i=new Uint8Array([66,82,70,83]),a=2;function o(e){if(!e)return!1;let t=e instanceof Uint8Array?e:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?new Uint8Array(e.buffer||e,e.byteOffset||0,e.byteLength):null;return!t||t.length<12?!1:t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]}function s(e={},t={},n={}){let o=new TextEncoder,s=[],c=0,l=e=>{let t=e instanceof Uint8Array?e:new Uint8Array(e),n=c;return s.push(t),c+=t.byteLength,[n,t.byteLength]},u={},d=(e,t)=>{if(e==null)return null;if(e instanceof r)return{$l:e.target};if(e instanceof Uint8Array||v!==void 0&&v.isBuffer(e)){let n=e instanceof Uint8Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),r=e.mimeType||(t.endsWith(`.wasm`)?`application/wasm`:`application/octet-stream`),[i,a]=l(n);return{$b:[i,a,r]}}if(typeof e==`function`)return n.commandsBundle||(u[t]=e.toString()),{$c:t};if(typeof e==`string`){if(e.startsWith(`data:`)){let t=e.indexOf(`;`),n=e.indexOf(`,`,t);if(t!==-1&&n!==-1&&e.slice(t+1,n)===`base64`){let r=e.slice(5,t),i=e.slice(n+1),a;if(v!==void 0)a=new Uint8Array(v.from(i,`base64`));else{let e=atob(i);a=new Uint8Array(e.length);for(let t=0;t<e.length;t++)a[t]=e.charCodeAt(t)}let[o,s]=l(a);return{$b:[o,s,r]}}}let[t,n]=l(o.encode(e));return{$t:[t,n]}}if(typeof e==`object`){let n={};for(let r of Object.keys(e)){let i=`${t}/${r}`,a=d(e[r],i);a!==null&&(n[r]=a)}return{$d:n}}return null},f=d(e,``)||{$d:{}},p=null;n.commandsBundle&&typeof n.commandsBundle==`string`&&(p=l(o.encode(n.commandsBundle)));let m={v:a,tree:f,permissions:Object.assign({},t)};p&&(m.commandsSlice=p),Object.keys(u).length>0&&(m.inlineCommands=u);let h=o.encode(JSON.stringify(m)),g=12+h.byteLength+c,_=new Uint8Array(g);_.set(i,0);let y=new DataView(_.buffer,_.byteOffset,_.byteLength);y.setUint32(4,a,!0),y.setUint32(8,h.byteLength,!0),_.set(h,12);let b=12+h.byteLength;for(let e of s)_.set(e,b),b+=e.byteLength;return _}function c(e,t={}){let i=e instanceof Uint8Array?e:new Uint8Array(e.buffer||e,e.byteOffset||0,e.byteLength);if(!o(i))throw Error(`Invalid BRFS binary container (missing BRFS magic header)`);let s=new DataView(i.buffer,i.byteOffset,i.byteLength),c=s.getUint32(4,!0);if(c>a)throw Error(`Unsupported BRFS container version: ${c}`);let l=12+s.getUint32(8,!0);if(l>i.byteLength)throw Error(`Corrupt BRFS binary container (header length exceeds buffer)`);let u=new TextDecoder,d=u.decode(i.subarray(12,l)),f=JSON.parse(d),p=i.subarray(l),m=Object.assign({},t);if(Array.isArray(f.commandsSlice)){let[e,t]=f.commandsSlice,n=u.decode(p.subarray(e,e+t));try{let e=Function(n)();e&&typeof e==`object`&&Object.assign(m,e)}catch{}}let h=e=>{if(!e||typeof e!=`object`)return e;if(`$t`in e){let[t,n]=e.$t;return u.decode(p.subarray(t,t+n))}if(`$b`in e){let[t,r,i]=e.$b;return new n(p.slice(t,t+r).buffer,i||`application/octet-stream`)}if(`$l`in e)return new r(e.$l);if(`$c`in e){let t=e.$c;if(m[t])return m[t];if(f.inlineCommands&&f.inlineCommands[t])try{let e=G(),n=ee();return Function(`Command`,`InteractiveCommand`,`return (${f.inlineCommands[t]});`)(e,n)}catch{return null}return null}if(`$d`in e){let t={};for(let[n,r]of Object.entries(e.$d)){let e=h(r);e!==null&&(t[n]=e)}return t}return e};return{filesystem:h(f.tree)||{},permissions:Object.assign({},f.permissions||{})}}function l(e){if(!e)return!1;let t=e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null;return!!(t&&t.byteLength>=2&&t[0]===31&&t[1]===139)}async function u(e){if(typeof DecompressionStream<`u`&&typeof Response<`u`){let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t),r=await new Response(n).arrayBuffer();return new Uint8Array(r)}if(z!==void 0&&typeof z.getBuiltinModule==`function`){let t=z.getBuiltinModule(`zlib`);if(t)return new Uint8Array(t.gunzipSync(v.from(e.buffer,e.byteOffset,e.byteLength)))}throw Error(`Gzip decompression is not supported in this environment`)}function d(e){return e?!!(typeof e==`string`||typeof e.then==`function`||typeof e.arrayBuffer==`function`||l(e)):!1}async function f(e,t={}){if(!e)return{filesystem:{},permissions:t};if(typeof e.then==`function`)return f(await e,t);if(typeof e.arrayBuffer==`function`){let n=await e.arrayBuffer();return f(new Uint8Array(n),t)}if(typeof e==`string`){if(!/^https?:\/\//i.test(e)&&z!==void 0&&typeof z.getBuiltinModule==`function`&&typeof window>`u`)try{let n=z.getBuiltinModule(`fs`);if(n&&n.existsSync(e)){let r=await n.promises.readFile(e);return f(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),t)}}catch{}let n=await fetch(e);if(!n.ok)throw Error(`Failed to load filesystem from ${e}: HTTP ${n.status}`);let r=await n.arrayBuffer();return f(new Uint8Array(r),t)}if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){let n=e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(l(n)&&(n=await u(n)),o(n)){let e=c(n);return{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}}let r=new TextDecoder(`utf-8`).decode(n);try{let e=JSON.parse(r);return e&&typeof e==`object`&&e.filesystem&&typeof e.permissions==`object`?{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}:{filesystem:e,permissions:t}}catch{let e=Function(`return `+r)();return e&&typeof e==`object`&&e.filesystem&&typeof e.permissions==`object`?{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}:{filesystem:e||{},permissions:t}}}return typeof e==`object`&&e.filesystem&&typeof e.permissions==`object`?d(e.filesystem)||o(e.filesystem)?f(e.filesystem,Object.assign({},e.permissions,t)):{filesystem:e.filesystem,permissions:Object.assign({},e.permissions,t)}:{filesystem:e,permissions:t}}t.exports={MAGIC:i,FORMAT_VERSION:a,isBinaryContainer:o,isGzipBytes:l,isAsyncFilesystemSource:d,resolveFilesystemSource:f,serializeBinaryFilesystem:s,deserializeBinaryFilesystem:c,FilesystemStorage:class{static async save(e,t=`brsh-rootfs`){let n=e.context?e.context.fs:e,r=s(n.getRaw(),n.getRawPermissions());return typeof indexedDB<`u`&&await this._idbPut(t,r),r}static async load(e=`brsh-rootfs`){if(e instanceof Uint8Array||e instanceof ArrayBuffer||typeof e==`string`&&(/^https?:\/\//i.test(e)||e.endsWith(`.brfs`)))return f(e);if(typeof indexedDB<`u`&&typeof e==`string`){let t=await this._idbGet(e);if(t&&o(t))return c(t)}return null}static async loadOrFetch(e=`brsh-rootfs`,t={}){return await this.load(e)||f(t)}static createAutoSave(e=`brsh-rootfs`,t=null){return(n,r)=>{let i=s(n,r);typeof indexedDB<`u`&&this._idbPut(e,i).catch(()=>{}),typeof t==`function`&&t(i,n,r)}}static _openIdb(){return new Promise((e,t)=>{let n=indexedDB.open(`brsh_fs_storage`,1);n.onupgradeneeded=()=>{n.result.createObjectStore(`snapshots`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}static async _idbPut(e,t){let n=await this._openIdb();return new Promise((r,i)=>{let a=n.transaction(`snapshots`,`readwrite`);a.objectStore(`snapshots`).put(t,e),a.oncomplete=()=>{n.close(),r()},a.onerror=()=>{n.close(),i(a.error)}})}static async _idbGet(e){let t=await this._openIdb();return new Promise((n,r)=>{let i=t.transaction(`snapshots`,`readonly`).objectStore(`snapshots`).get(e);i.onsuccess=()=>{t.close(),n(i.result||null)},i.onerror=()=>{t.close(),r(i.error)}})}}}})),q=t(((e,t)=>{y();var n=b(),{BinaryFile:r,SymlinkRef:i}=n;function a(e){for(let t of Object.keys(e)){let n=e[t];if(typeof n==`object`&&n&&!(n instanceof Uint8Array)&&!(n instanceof i))a(n);else if(typeof n==`string`&&n.startsWith(`data:`)){let i=n.indexOf(`;`),a=n.indexOf(`,`,i);if(i!==-1&&a!==-1&&n.slice(i+1,a)===`base64`){let o=n.slice(5,i),s=n.slice(a+1),c;if(v!==void 0)c=new Uint8Array(v.from(s,`base64`));else{let e=atob(s);c=new Uint8Array(e.length);for(let t=0;t<e.length;t++)c[t]=e.charCodeAt(t)}e[t]=new r(c.buffer,o)}}}}t.exports=class extends n{constructor(e=`/`,t={},n={},r=null){if(super(),t instanceof Uint8Array||t instanceof ArrayBuffer){let{deserializeBinaryFilesystem:e}=K(),r=e(t);t=r.filesystem,n=Object.assign({},r.permissions,n)}else if(t&&typeof t==`object`&&t.filesystem&&(t.filesystem instanceof Uint8Array||typeof t.filesystem==`object`)&&(n=Object.assign({},t.permissions||{},n),t=t.filesystem,t instanceof Uint8Array||t instanceof ArrayBuffer)){let{deserializeBinaryFilesystem:e}=K(),r=e(t);t=r.filesystem,n=Object.assign({},r.permissions,n)}a(t),this.fileSystem=t,this.permissions=Object.assign({},n),this.cwd=e.endsWith(`/`)?e:e+`/`,this._onChange=r,this._changeScheduled=!1}toBinaryContainer(e={}){let{serializeBinaryFilesystem:t}=K();return t(this.fileSystem,this.permissions,e)}static fromBinaryContainer(e,t={}){let{deserializeBinaryFilesystem:n}=K();return n(e,t)}getFileByPath(e){let t=this._resolveByAbsolutePath(this._pathToAbsolute(e),!0);return t==null||!this.isReadable(e)?null:t}_getFileRaw(e){return this._getFileByAbsolutePath(this._pathToAbsolute(e))}exists(e){return this._resolveByAbsolutePath(this._pathToAbsolute(e),!0)!=null}isSymlink(e){return this._resolveByAbsolutePath(this._pathToAbsolute(e),!1)instanceof i}readSymlink(e){let t=this._resolveByAbsolutePath(this._pathToAbsolute(e),!1);return t instanceof i?t.target:null}createSymlink(e,t){this._setFileRaw(t,new i(e))}stat(e){let t=this._resolveByAbsolutePath(this._pathToAbsolute(e),!1);return t==null?null:t instanceof i?{isDirectory:!1,isFile:!1,isCommand:!1,isBinary:!1,isSymlink:!0}:{isDirectory:t.constructor===Object,isFile:typeof t==`string`||t instanceof Uint8Array,isCommand:typeof t==`function`,isBinary:t instanceof Uint8Array,isSymlink:!1}}_pathToAbsolute(e){return e.startsWith(`./`)&&(e=e.substring(2)),e.startsWith(`/`)||(e=(this.cwd&&this.cwd.endsWith(`/`)?this.cwd:this.cwd?this.cwd+`/`:`/`)+e),this._traverseComplexAbsolutePath(e)}_traverseComplexAbsolutePath(e){let t=e.split(`/`);for(;t.includes(`..`);){let e=t.indexOf(`..`)-1;t.splice(e,2)}return t.join(`/`)}absolutePath(e){return this._pathToAbsolute(e)}setFileByPath(e,t,n=!1){let r=this._pathToAbsolute(e);if(this._getFileByAbsolutePath(r)!=null){if(!this.isWritable(e))throw Error(`Permission denied`)}else{let e=r.split(`/`);e.pop();let t=e.join(`/`)||`/`,n=this.getMode(t);if(n!==null&&!(n&128))throw Error(`Permission denied`)}this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileRaw(e,t,n=!1){let r=this._pathToAbsolute(e);this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileByAbsolutePath(e,t,n=!0){let r=e.split(`/`);r.shift();let a=r.pop(),o=this.fileSystem,s=[];for(let e of r){if(s.push(e),!Object.prototype.hasOwnProperty.call(o,e)){if(!n)throw Error(`${e}: No such file or directory`);o[e]={}}let t=o[e];if(t instanceof i){let n=`/`+s.slice(0,-1).join(`/`),r=t.target.startsWith(`/`)?this._traverseComplexAbsolutePath(t.target):this._traverseComplexAbsolutePath(n+`/`+t.target);if(t=this._resolveByAbsolutePath(r,!0),typeof t!=`object`||!t||t instanceof i)throw Error(`${e}: Not a directory`)}o=t}o[a]=t}_resolveByAbsolutePath(e,t=!0,n=0){if(n>10)return null;let r=e.split(`/`);r.shift(),r.length>0&&r[r.length-1].length<1&&r.pop();let a=this.fileSystem,o=[];for(let e=0;e<r.length;e++){let s=r[e],c=e===r.length-1;if(typeof a!=`object`||!a||a instanceof i||!Object.prototype.hasOwnProperty.call(a,s))return null;if(a=a[s],o.push(s),a instanceof i&&(!c||t)){let e=`/`+o.slice(0,-1).join(`/`),t=a.target.startsWith(`/`)?this._traverseComplexAbsolutePath(a.target):this._traverseComplexAbsolutePath(e+`/`+a.target);if(a=this._resolveByAbsolutePath(t,!0,n+1),a==null)return null}}return a}_getFileByAbsolutePath(e){let t=e.split(`/`);return t.shift(),t[t.length-1].length<1&&t.pop(),t.reduce((e,t)=>typeof e!=`object`||!e||!Object.prototype.hasOwnProperty.call(e,t)?null:e[t],this.fileSystem)}deleteFileByPath(e){let t=this._pathToAbsolute(e),n=t.split(`/`);n.pop();let r=n.join(`/`)||`/`,i=this.getMode(r);if(i!==null&&!(i&128))throw Error(`${e}: Permission denied`);this._deleteByAbsolutePath(t);let a=t+`/`;Object.keys(this.permissions).forEach(e=>{(e===t||e.startsWith(a))&&delete this.permissions[e]}),this._triggerChange()}_deleteByAbsolutePath(e){let t=e.split(`/`);t.shift(),t[t.length-1]===``&&t.pop();let n=t.pop();if(!n)return;let r=this.fileSystem,a=[];for(let e of t){if(a.push(e),!Object.prototype.hasOwnProperty.call(r,e))return;let t=r[e];if(t instanceof i){let e=`/`+a.slice(0,-1).join(`/`),n=t.target.startsWith(`/`)?this._traverseComplexAbsolutePath(t.target):this._traverseComplexAbsolutePath(e+`/`+t.target);if(t=this._resolveByAbsolutePath(n,!0),typeof t!=`object`||!t||t instanceof i)return}r=t}r&&n in r&&delete r[n]}getMode(e){let t=this._pathToAbsolute(e);if(this.permissions[t]!==void 0)return this.permissions[t];let n=this._resolveByAbsolutePath(t,!0);return n==null?null:n.constructor===Object?493:typeof n==`function`?365:420}setMode(e,t){let n=this._pathToAbsolute(e);this.permissions[n]=t,this._triggerChange()}getSize(e){let t=this._pathToAbsolute(e),n=this._resolveByAbsolutePath(t,!0);return n==null?0:n.constructor===Object?JSON.stringify(n).length:n instanceof Uint8Array?n.length:n.toString().length}getRawPermissions(){return Object.assign({},this.permissions)}setCwd(e){this.cwd=this._pathToAbsolute(e.endsWith(`/`)?e:e+`/`)}getRaw(){return this.fileSystem}addFiles(e){Object.entries(e).forEach(([e,t])=>{this._setFileRaw(e,t,!0)})}autoComplete(e,t){let n=this._pathToAbsolute(e).split(`/`),r=n.pop(),i=this._getFileRaw(n.length>1?n.join(`/`):`/`),a=this._getFileRaw(t);if(i&&i.constructor===Object){let t=Object.keys(i).filter(e=>e.startsWith(r));r.length<1&&(t=t.filter(e=>!e.startsWith(`.`)));let n=e.split(`/`);n.pop();let o=i;if(t.length<1&&n.length<1&&a&&(t=Object.keys(a).filter(e=>e.startsWith(r)),o=a),t.length)return{path:n.length?n.join(`/`):null,options:t.map(e=>o[e]&&o[e].constructor===Object?e.concat(`/`):e)}}return null}},t.exports.BinaryFile=r,t.exports.SymlinkRef=i})),J=t(((e,t)=>{t.exports=null})),te=t(((e,t)=>{B();function n(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function r(e,t){for(var n=``,r=0,i=-1,a=0,o,s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var c=n.lastIndexOf(`/`);if(c!==n.length-1){c===-1?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function i(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}var a={resolve:function(){for(var e=``,t=!1,i,a=arguments.length-1;a>=-1&&!t;a--){var o;a>=0?o=arguments[a]:(i===void 0&&(i=z.cwd()),o=i),n(o),o.length!==0&&(e=o+`/`+e,t=o.charCodeAt(0)===47)}return e=r(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`},normalize:function(e){if(n(e),e.length===0)return`.`;var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=r(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&i&&(e+=`/`),t?`/`+e:e},isAbsolute:function(e){return n(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,t=0;t<arguments.length;++t){var r=arguments[t];n(r),r.length>0&&(e===void 0?e=r:e+=`/`+r)}return e===void 0?`.`:a.normalize(e)},relative:function(e,t){if(n(e),n(t),e===t||(e=a.resolve(e),t=a.resolve(t),e===t))return``;for(var r=1;r<e.length&&e.charCodeAt(r)===47;++r);for(var i=e.length,o=i-r,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var c=t.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(t.charCodeAt(s+d)===47)return t.slice(s+d+1);if(d===0)return t.slice(s+d)}else o>l&&(e.charCodeAt(r+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(r+d);if(f!==t.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=r+u+1;d<=i;++d)(d===i||e.charCodeAt(d)===47)&&(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+t.slice(s+u):(s+=u,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(n(e),e.length===0)return`.`;for(var t=e.charCodeAt(0),r=t===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);n(e);var r=0,i=-1,a=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;var s=t.length-1,c=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!a){r=o+1;break}}else c===-1&&(a=!1,c=o+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(i=o):(s=-1,i=c))}return r===i?i=c:i===-1&&(i=e.length),e.slice(r,i)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!a){r=o+1;break}}else i===-1&&(a=!1,i=o+1);return i===-1?``:e.slice(r,i)}},extname:function(e){n(e);for(var t=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c===47){if(!a){r=s+1;break}continue}i===-1&&(a=!1,i=s+1),c===46?t===-1?t=s:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return i(`/`,e)},parse:function(e){n(e);var t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;var r=e.charCodeAt(0),i=r===47,a;i?(t.root=`/`,a=1):a=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=a;--u){if(r=e.charCodeAt(u),r===47){if(!l){s=u+1;break}continue}c===-1&&(l=!1,c=u+1),r===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1)}return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(s===0&&i?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(s,c)):(s===0&&i?(t.name=e.slice(1,o),t.base=e.slice(1,c)):(t.name=e.slice(s,o),t.base=e.slice(s,c)),t.ext=e.slice(o,c)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir=`/`),t},sep:`/`,delimiter:`:`,win32:null,posix:null};a.posix=a,t.exports=a})),ne=t(((e,t)=>{B();var n=J(),r=te(),i=b();t.exports=class extends i{constructor(e,t=null){super(),this._onChange=t,this._changeScheduled=!1,this._virtualFiles={},this.cwd=this._normalizeCwd(e||z.cwd())}get isRealFilesystem(){return!0}_normalizeCwd(e){let t=r.resolve(e);return t===`/`?`/`:t+`/`}absolutePath(e){e.startsWith(`./`)&&(e=e.slice(2));let t=e.startsWith(`/`)?e:r.join(this.cwd,e);return r.normalize(t)}setCwd(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=this.absolutePath(t);this.cwd=n===`/`?`/`:n+`/`}getFileByPath(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return this._virtualFiles[t];let i;try{i=n.statSync(t)}catch{return null}if(i.isDirectory()){let e={};try{for(let i of n.readdirSync(t)){let a=r.join(t,i);if(this._virtualFiles[a]!==void 0)e[i]=this._virtualFiles[a];else try{e[i]=n.statSync(a).isDirectory()?{}:``}catch{}}}catch{}let i=t===`/`?`/`:t+`/`;for(let t of Object.keys(this._virtualFiles))if(t.startsWith(i)&&!t.slice(i.length).includes(`/`)){let n=t.slice(i.length);n in e||(e[n]=this._virtualFiles[t])}return e}try{return n.readFileSync(t,`utf8`)}catch{return null}}setFileByPath(e,t,i=!1){let a=this.absolutePath(e);if(typeof t==`function`||t instanceof Uint8Array){this._virtualFiles[a]=t;return}if(t!=null&&t.constructor===Object){try{n.mkdirSync(a,{recursive:i}),this._triggerChange()}catch{this._virtualFiles[a]=t}return}try{i&&n.mkdirSync(r.dirname(a),{recursive:!0}),n.writeFileSync(a,String(t)),this._triggerChange()}catch{this._virtualFiles[a]=String(t)}}deleteFileByPath(e){let t=this.absolutePath(e);delete this._virtualFiles[t];try{n.lstatSync(t).isDirectory()?n.rmdirSync(t):n.unlinkSync(t),this._triggerChange()}catch{}}getMode(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return typeof this._virtualFiles[t]==`function`?493:420;try{return n.statSync(t).mode&511}catch{return null}}setMode(e,t){let r=this.absolutePath(e);if(this._virtualFiles[r]===void 0)try{n.chmodSync(r,t),this._triggerChange()}catch{}}getSize(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return 0;try{return n.statSync(t).size}catch{return 0}}isSymlink(e){let t=this.absolutePath(e);try{return n.lstatSync(t).isSymbolicLink()}catch{return!1}}readSymlink(e){let t=this.absolutePath(e);try{return n.readlinkSync(t)}catch{return null}}createSymlink(e,t){let i=this.absolutePath(t);n.mkdirSync(r.dirname(i),{recursive:!0}),n.symlinkSync(e,i),this._triggerChange()}getRaw(){return null}getRawPermissions(){return{}}addFiles(e){Object.entries(e).forEach(([e,t])=>{this.setFileByPath(e,t,!0)})}autoComplete(e,t){let i=this.absolutePath(e).split(`/`),a=i.pop(),o=i.join(`/`)||`/`,s=[];try{s=n.readdirSync(o)}catch{}let c=o===`/`?`/`:o+`/`;for(let e of Object.keys(this._virtualFiles))if(e.startsWith(c)&&!e.slice(c.length).includes(`/`)){let t=e.slice(c.length);s.includes(t)||s.push(t)}let l=s.filter(e=>e.startsWith(a));if(l.length===0&&!e.includes(`/`)){let n=this.getFileByPath(t);if(n&&n.constructor===Object&&(l=Object.keys(n).filter(t=>t.startsWith(e)),l.length))return{path:null,options:l}}if(!l.length)return null;let u=e.split(`/`);return u.pop(),{path:u.length?u.join(`/`):null,options:l.map(e=>{let t=r.join(o,e);if(this._virtualFiles[t]!==void 0)return e;try{return n.statSync(t).isDirectory()?e+`/`:e}catch{return e}})}}_getFileRaw(e){return this.getFileByPath(e)}_setFileRaw(e,t,n=!1){return this.setFileByPath(e,t,n)}exists(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return!0;try{return n.statSync(t),!0}catch{return!1}}stat(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0){let e=this._virtualFiles[t];return{isDirectory:e!=null&&e.constructor===Object,isFile:typeof e==`string`||e instanceof Uint8Array,isCommand:typeof e==`function`,isBinary:e instanceof Uint8Array}}try{let e=n.statSync(t);return{isDirectory:e.isDirectory(),isFile:e.isFile(),isCommand:!1}}catch{return null}}}})),Y=t(((e,t)=>{var n=q();t.exports=class{constructor(e){this.options=e;let{cwd:t=`/`,clearFn:r,destroyFn:i,onFsChange:a}=this.options;this.vars={},this.aliases={},this.fs=new n(t,{},{},a||null),this._clearFn=r,this._destroyFn=i}setVar(e,t){t?this.vars[e]=t:delete this.vars[e]}unsetVar(e){this.setVar(e)}getVar(e){return this.vars[e]||``}setAlias(e,t){t?this.aliases[e]=t:delete this.aliases[e]}unsetAlias(e){this.setAlias(e)}getAlias(e){return this.aliases[e]||null}setCommand(e){let t=`${this.getVar(`PATH`)}/${e.name.toLowerCase()}`;this.fs.addFiles({[t]:e}),this.fs.setMode(t,365)}getCommand(e){let t=`${this.getVar(`PATH`)}/${e}`;return this.fs._getFileRaw(t)||null}setNodeFilesystem(e){let t=ne(),n=this.fs._onChange;this.fs=new t(e,n)}setFilesystem(e,t={}){let r=this.fs._getFileRaw(this.getVar(`PATH`))||{},i=this.fs.getRawPermissions(),a=this.fs._onChange;this.fs=new n(this.fs.cwd,e,Object.assign({},i,t),a),this.fs.addFiles(r)}setCwd(e){this.fs.setCwd(e)}source(e){this.vars=Object.assign({},this.vars,e.vars),this.aliases=Object.assign({},this.aliases,e.aliases)}clear(){typeof this._clearFn==`function`&&this._clearFn()}destroy(e=0){typeof this._destroyFn==`function`&&this._destroyFn(e)}}})),X=t(((e,t)=>{var n=G();t.exports=class extends n{constructor(e,t){super(e,t)}}})),re=t(((e,t)=>{var n=X();function r(e){return/^#!\/(sh\.js|bin\/(sh|brsh))/.test(e)}t.exports=class extends n{constructor(e,t,n,r=!1){super(t,n),this.script=e,this.source=r}get captureInput(){return!!(this.sandbox&&this.sandbox.runningCommand&&this.sandbox.runningCommand.captureInput)}onInput(e){this.sandbox&&this.sandbox.onInput(e)}run(){let e=this.context&&this.context.fs||this.fs,t=e&&e.isRealFilesystem?{useRealFilesystem:!0}:{filesystem:e&&e.getRaw()||{},permissions:e&&e.getRawPermissions()||{}};this.sandbox=new globalThis.shell({cwd:e&&e.cwd||`/`,...t,subshell:!0}),this.sandbox.context.source(this.context),Array.isArray(this.arguments)&&(this.arguments.forEach((e,t)=>this.sandbox.context.setVar(String(t+1),e)),this.sandbox.context.setVar(`#`,String(this.arguments.length)),this.sandbox.context.setVar(`@`,this.arguments.join(` `)),this.sandbox.context.setVar(`*`,this.arguments.join(` `))),this.sandbox.on(`stdOut`,e=>{this.stdOut=e,this.flush()}),this.sandbox.on(`stdErr`,e=>{this.stdErr=e,this.flush()}),this._scriptFunctions={};let n=this.script.split(/\r?\n/);if(!r(n[0])){let e=n[0].startsWith(`#!`)?n[0].slice(2).split(/\s/)[0]:n[0];return Promise.reject(`${e}: bad interpreter: No such file or directory`)}let i=this._parseLines(n.slice(1));return this._executeNodes(i).catch(e=>{if(e&&e.__type===`return`)this.sandbox.lastCode=e.code;else if(e&&e.__type===`errexit`)this.sandbox.lastCode=e.code;else if(e&&(e.__type===`break`||e.__type===`continue`))this.stdErr=`${e.__type}: only meaningful in a for or while loop`,this.sandbox.lastCode=1;else return Promise.reject(e)}).then(()=>{this.exitCode=this.sandbox.lastCode,this.source&&this.context.source(this.sandbox.context)})}_accumulateLines(e){let t=[],n=null,r=!1,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];n===null?n=s:a?n+=s:r||i?n+=`
|
|
4
|
+
`+s:n+=s;let c=0,l=!1,u=!1;for(;c<s.length;){let e=s[c];if(r)e===`'`&&(r=!1),c++;else if(i)e===`\\`&&c+1<s.length?c+=2:e===`\\`&&c+1===s.length?(l=!0,c++):(e===`"`&&(i=!1),c++);else{if(e===`#`&&(c===0||/\s/.test(s[c-1]))){u=!0;break}e===`\\`&&c+1<s.length?c+=2:e===`\\`&&c+1===s.length?(l=!0,c++):e===`'`?(r=!0,c++):(e===`"`&&(i=!0),c++)}}if(!r&&!l&&!u){let e=s.match(/(\\+)\s*$/);e&&e[1].length%2==1&&(l=!0)}a=l,l&&(n=n.replace(/\\\s*$/,``)),!r&&!i&&!l&&(t.push(n),n=null,a=!1)}return n!==null&&t.push(n),t}_parseLines(e){e=this._accumulateLines(e);let t=[],n=0;for(;n<e.length;){let r=e[n].trim();if(!r||r.startsWith(`#`)){n++;continue}if(r.startsWith(`if `)||r===`if`){let r=this._parseIf(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`while `)){let r=this._parseWhile(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`for `)){let r=this._parseFor(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`case `)||r===`case`){let r=this._parseCase(e,n);t.push(r.node),n+=r.consumed;continue}if(/^(?:function\s+[\w\d_]+|[\w\d_]+\s*\(\s*\))\s*(?:\{.*)?$/.test(r)){let r=this._parseFunction(e,n);t.push(r.node),n+=r.consumed;continue}t.push({type:`command`,line:r}),n++}return t}_parseIf(e,t){let n=e=>e.replace(/^(?:if|elif)\s+/,``).replace(/\s*;\s*then\s*$/,``).replace(/\s+then\s*$/,``).trim(),r=[{condition:n(e[t].trim()),bodyLines:[]}],i=[],a=r[0],o=!1,s=1,c=t+1;for(c<e.length&&e[c].trim()===`then`&&c++;c<e.length;){let t=e[c].trim();if((t.startsWith(`if `)||t===`if`)&&s++,t===`fi`&&(s--,s===0)){c++;break}if(s===1&&t.startsWith(`elif `)){let i={condition:n(t),bodyLines:[]};r.push(i),a=i,c++,c<e.length&&e[c].trim()===`then`&&c++;continue}if(s===1&&t===`else`){o=!0,c++;continue}o?i.push(e[c]):a.bodyLines.push(e[c]),c++}return{node:{type:`if`,clauses:r,elseLines:i},consumed:c-t}}_parseWhile(e,t){let n=e[t].trim().replace(/^while\s+/,``).replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).trim(),r=t+1;r<e.length&&e[r].trim()===`do`&&r++;let i=[],a=1;for(;r<e.length;){let t=e[r].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&a++,t===`done`&&(a--,a===0)){r++;break}i.push(e[r]),r++}return{node:{type:`while`,condition:n,bodyLines:i},consumed:r-t}}_parseFor(e,t){let n=e[t].trim().replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).match(/^for\s+(\w+)\s+in\s+(.+)$/),r=n?n[1]:``,i=n?n[2].trim():``,a=t+1;a<e.length&&e[a].trim()===`do`&&a++;let o=[],s=1;for(;a<e.length;){let t=e[a].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&s++,t===`done`&&(s--,s===0)){a++;break}o.push(e[a]),a++}return{node:{type:`for`,variable:r,list:i,bodyLines:o},consumed:a-t}}async _executeNodes(e){for(let t of e)await this._executeNode(t)}_executeNode(e){if(e.type===`function`){let t=e.name,n=e.bodyLines,r=this,i=X(),a=class extends i{static get name(){return t}run(){let e=this.arguments.map((e,t)=>({key:String(t+1),prev:r.sandbox.context.getVar(String(t+1))}));this.arguments.forEach((e,t)=>r.sandbox.context.setVar(String(t+1),e));let t=()=>e.forEach(({key:e,prev:t})=>t?r.sandbox.context.setVar(e,t):r.sandbox.context.unsetVar(e));return r._executeFunctionBody(n).then(()=>{t()}).catch(e=>{if(t(),e&&e.__type===`return`){this.exitCode=e.code;return}return Promise.reject(e)})}};return this.sandbox.context.setCommand(a),Promise.resolve()}if(e.type===`command`){if(/^return(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^return\s+(\d+)/),n=t?parseInt(t[1],10):0;return Promise.reject({__type:`return`,code:n})}if(/^break(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^break\s+(\d+)/),n=t?parseInt(t[1],10):1;return Promise.reject({__type:`break`,count:n})}if(/^continue(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^continue\s+(\d+)/),n=t?parseInt(t[1],10):1;return Promise.reject({__type:`continue`,count:n})}return(this.sandbox.context.getVar(`-`)||``).includes(`x`)&&(this.stdErr=`+ ${e.line.trim()}`,this.flush()),this.sandbox.onCommand(e.line,!1).then(()=>{if((this.sandbox.context.getVar(`-`)||``).includes(`e`)&&this.sandbox.lastCode!==0)return Promise.reject({__type:`errexit`,code:this.sandbox.lastCode})})}return e.type===`if`?this._executeIf(e):e.type===`while`?this._executeWhile(e):e.type===`for`?this._executeFor(e):e.type===`case`?this._executeCase(e):Promise.resolve()}async _executeIf(e){for(let t of e.clauses)if(await this.sandbox.onCommand(t.condition,!1),this.sandbox.lastCode===0)return this._executeNodes(this._parseLines(t.bodyLines));if(e.elseLines.length>0)return this._executeNodes(this._parseLines(e.elseLines))}async _executeWhile(e){for(;await this.sandbox.onCommand(e.condition,!1),this.sandbox.lastCode===0;)try{await this._executeNodes(this._parseLines(e.bodyLines))}catch(e){if(e&&e.__type===`break`){if(e.count<=1)break;throw{__type:`break`,count:e.count-1}}if(e&&e.__type===`continue`){if(e.count<=1)continue;throw{__type:`continue`,count:e.count-1}}throw e}}async _executeFor(e){let t=e.list.replace(/\${?([\w\d]+)}?/g,(e,t)=>this.sandbox.context.getVar(t)||``).split(/\s+/).filter(Boolean);for(let n of t){this.sandbox.context.setVar(e.variable,n);try{await this._executeNodes(this._parseLines(e.bodyLines))}catch(e){if(e&&e.__type===`break`){if(e.count<=1)break;throw{__type:`break`,count:e.count-1}}if(e&&e.__type===`continue`){if(e.count<=1)continue;throw{__type:`continue`,count:e.count-1}}throw e}}}_parseFunction(e,t){let n=e[t].trim(),r=n.match(/^function\s+([\w\d_]+)/)||n.match(/^([\w\d_]+)\s*\(/),i=r?r[1]:``,a=t+1;if(!n.includes(`{`)){for(;a<e.length&&!e[a].includes(`{`);)a++;a++}let o=[],s=1;for(;a<e.length;){if(e[a].trim()===`}`){a++;break}let t=(e[a].match(/\{/g)||[]).length,n=(e[a].match(/\}/g)||[]).length;if(s+=t-n,s<=0){a++;break}o.push(e[a]),a++}return{node:{type:`function`,name:i,bodyLines:o},consumed:a-t}}_parseCase(e,t){let n=e[t].trim().match(/^case\s+(.+?)\s+in\s*$/),r=n?n[1]:``,i=t+1,a=[],o=null,s=[];for(;i<e.length;){let t=e[i],n=t.trim();if(i++,!(!n||n.startsWith(`#`))){if(n===`esac`)break;if(o===null){let e=n.match(/^(.+?)\)\s*(.*)$/);if(e){o=e[1].trim();let t=e[2].trim();if(t===`;;`)a.push({pattern:o,bodyLines:[]}),o=null;else if(t.endsWith(`;;`)){let e=t.slice(0,-2).trim();a.push({pattern:o,bodyLines:e?[e]:[]}),o=null}else s=t?[t]:[]}}else n===`;;`?(a.push({pattern:o,bodyLines:s}),o=null,s=[]):n.endsWith(`;;`)?(s.push(n.slice(0,-2).trim()),a.push({pattern:o,bodyLines:s}),o=null,s=[]):s.push(t)}}return o!==null&&a.push({pattern:o,bodyLines:s}),{node:{type:`case`,word:r,clauses:a},consumed:i-t}}_executeFunctionBody(e){return this._executeNodes(this._parseLines(e))}async _executeCase(e){let t=await this.sandbox._replaceVariables(e.word),n=t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t;for(let t of e.clauses)if(this._matchPattern(t.pattern,n))return this._executeNodes(this._parseLines(t.bodyLines))}_matchPattern(e,t){let n=``,r=0;for(;r<e.length;){let t=e[r];if(t===`[`){let t=e.indexOf(`]`,r+1);t===-1?(n+=`\\[`,r++):(n+=e.slice(r,t+1),r=t+1)}else t===`*`?(n+=`.*`,r++):t===`?`?(n+=`.`,r++):/[.+^${}()|\\]/.test(t)?(n+=`\\`+t,r++):(n+=t,r++)}try{return RegExp(`^`+n+`$`).test(t)}catch{return!1}}},t.exports.isKnownInterpreter=r})),ie=t(((e,t)=>{y();var n=re(),{BinaryFile:r}=q(),i=0,a=6,o=8,s=20,c=28,l=31,u=44,d=54,f=70,p=0,m=2,h=3,g=4,_=1,b=2,x=4,S=8,C=1,w=4,T=class extends n{get name(){return`wasm`}get requiresFilesystem(){return!0}get interactive(){if((this.arguments||[]).some(e=>e===`--help`||e===`-h`||e===`--version`||e===`-V`||e===`-v`))return!1;if(this._isInteractive!==void 0)return!!this._isInteractive;if(this._pkgMeta&&this._pkgMeta.interactive!==void 0)return!!this._pkgMeta.interactive;let e=(this.script||this.name||``).toLowerCase();return e===`nano`||e.endsWith(`/nano`)||e.endsWith(`nano.wasm`)}get captureInput(){return this.interactive}_enterAltScreen(){this._inAltScreen||(this._inAltScreen=!0,this.stdinStream&&typeof this.stdinStream.setRawMode==`function`&&this.stdinStream.setRawMode(!0),this.stdout&&typeof this.stdout.write==`function`&&this.stdout.write(`\x1B[?1049h\x1B[2J\x1B[H`))}_exitAltScreen(){this._inAltScreen&&(this._inAltScreen=!1,this.stdinStream&&typeof this.stdinStream.setRawMode==`function`&&this.stdinStream.setRawMode(!1),this.stdout&&typeof this.stdout.write==`function`&&this.stdout.write(`\x1B[?1049l\x1B[?25h`))}_keyToBytes(e){if(!e)return null;if(typeof e!=`string`)return e instanceof Uint8Array?e:new Uint8Array([Number(e)&255]);let t=e.match(/^\^([A-Za-z@\[\\\]^_?])$/);if(t){let e=t[1].toUpperCase();return e===`?`?new Uint8Array([127]):new Uint8Array([e.charCodeAt(0)-64])}let n={Enter:`\r`,Return:`\r`,Backspace:``,Tab:` `,Escape:`\x1B`,ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Home:`\x1B[H`,End:`\x1B[F`,PageUp:`\x1B[5~`,PageDown:`\x1B[6~`,Delete:`\x1B[3~`,Insert:`\x1B[2~`};return n[e]?new TextEncoder().encode(n[e]):new TextEncoder().encode(e)}onInput(e){if(!this._handlingStreamData){if(typeof this._externalKeyHandler==`function`){this._externalKeyHandler(e);return}this.stdinStream&&this.stdinStream.isRaw}}runCommand(){return super.runCommand().finally(()=>{this._inAltScreen&&this._exitAltScreen()})}run(){let e=this.script,t=(()=>{try{return J()}catch{return null}})();return this._loadBytes(e,t).then(({bytes:e,isWat:t})=>t?this._runWat(e):this._runWasm(e)).catch(e=>{this.stdErr=e.message||String(e),this.exitCode=1})}_loadBytes(e,t){let n=this.context&&this.context.fs||this.fs;if(!n)return Promise.reject(Error(`${e}: Filesystem is not available`));if(n.isRealFilesystem&&t)try{let r=t.readFileSync(n.absolutePath(e)),i=new Uint8Array(r);return Promise.resolve({bytes:i,isWat:this._isWat(e,i)})}catch(t){return Promise.reject(Error(`${e}: ${t.message}`))}let r=n.getFileByPath(e);if(r==null)return Promise.reject(Error(`${e}: No such file or directory`));let i=this._contentToBytes(r);return Promise.resolve({bytes:i,isWat:this._isWat(e,i)})}_isWat(e,t){return e.endsWith(`.wat`)?!0:t.length>0&&t[0]===40}_contentToBytes(e){if(e instanceof Uint8Array)return e;if(v!==void 0&&v.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}async _runWat(e){let t=new TextDecoder().decode(e),n,r;try{r=await import(`wabt`)}catch{this.stdErr=`${this.script}: WAT execution requires the 'wabt' package\nInstall it with: npm install wabt`,this.exitCode=1;return}try{let e=r.default??r,{buffer:i}=(typeof e==`function`?await e():e).parseWat(this.script,t,{mutable_globals:!0}).toBinary({});n=new Uint8Array(i)}catch(e){this.stdErr=`${this.script}: WAT compilation error: ${e.message}`,this.exitCode=1;return}return this._runWasm(n)}async _runWasm(e){if(typeof WebAssembly>`u`){this.stdErr=`${this.script}: WebAssembly is not available in this environment`,this.exitCode=1;return}let t={1:``,2:``},n=new TextDecoder,y=new TextEncoder,T=null,E=null,D=!1,O=0,k=null,A=null,N=null,P=null,F=this.stdin===void 0||this.stdin===null||this.stdin===this.stdinStream||this.stdin&&this.stdin.isTTY,I=!!(this.interactive&&F),L=()=>{I||!F||(I=!0,this._isInteractive=!0,t[1]&&=(this.stdout&&typeof this.stdout.write==`function`&&this.stdout.write(t[1]),``),t[2]&&=(this.stderr&&typeof this.stderr.write==`function`&&this.stderr.write(t[2]),``),this.stdinStream&&typeof this.stdinStream.setRawMode==`function`&&this.stdinStream.setRawMode(!0))},R=(e,n)=>{if(I&&(e===1||e===2)){if(e===1&&this.stdout){this.stdout.write(n);return}if(e===2&&this.stderr){this.stderr.write(n);return}}t[e]=(t[e]||``)+n;let r=t[e].split(`
|
|
5
|
+
`);t[e]=r.pop();for(let t of r)e===1?this.stdOut=t:this.stdErr=t},z=()=>{t[1]&&=(I&&this.stdout?this.stdout.write(t[1]):this.stdOut=t[1],``),t[2]&&=(I&&this.stderr?this.stderr.write(t[2]):this.stdErr=t[2],``)},B=[],V=e=>{if(!(!e||e.length===0)){for(let t=0;t<e.length;t++)B.push(e[t]);if(A){let e=A;A=null,e()}}};P=e=>{this._handlingStreamData=!0;try{V(typeof e==`string`?y.encode(e):e instanceof Uint8Array?e:v!==void 0&&v.isBuffer(e)?new Uint8Array(e):y.encode(String(e??``)))}finally{this._handlingStreamData=!1}},this._externalKeyHandler=e=>{if(this._handlingStreamData)return;let t=this._keyToBytes(e);t&&V(t)},F&&this.stdinStream&&typeof this.stdinStream.on==`function`&&this.stdinStream.on(`data`,P),F&&this.stdin&&this.stdin!==this.stdinStream&&typeof this.stdin.on==`function`&&this.stdin.on(`data`,P);let H=!F&&typeof this.stdin==`string`?y.encode(this.stdin):!F&&this.stdin instanceof Uint8Array?this.stdin:!F&&v!==void 0&&v.isBuffer(this.stdin)?new Uint8Array(this.stdin):new Uint8Array,U=0,W=this.context&&this.context.fs?this.context.fs:this.fs,G=this.context&&this.context.fs&&this.context.fs.cwd||this.fs&&this.fs.cwd||this.context&&typeof this.context.getVar==`function`&&this.context.getVar(`PWD`)||W&&W.cwd||`/`,ee=G.length>1&&G.endsWith(`/`)?G.slice(0,-1):G,K=5,q=new Map([[3,{type:`preopen`,path:`/`,guestName:`/`}],[4,{type:`preopen`,path:ee,guestName:`.`}]]),J=new Map([[0,0],[1,0],[2,0]]),te=e=>{let t=e.split(`/`).filter(Boolean);return t.pop(),`/`+t.join(`/`)},ne=(e,t)=>{let n=q.get(e);if(!n||n.type!==`preopen`&&n.type!==`dir`)return null;if(t.startsWith(`/`))return W.absolutePath(t);if(!t||t===`.`)return W.absolutePath(n.path);let r=n.path.endsWith(`/`)?n.path:n.path+`/`,i=W.absolutePath(r+t),a=W.absolutePath(`/`+t);if(n.path!==`/`){if(W.exists(i))return i;if(W.exists(a))return a;let e=W.exists(te(i));return W.exists(te(a))&&!e?a:i}if(W.exists(i))return i;let o=W.absolutePath(t);return W.exists(o)?o:i},Y=e=>{if(!(!e||e.type!==`file`||!e.dirty||!W))try{let t=!0;for(let n=0;n<e.bytes.length;n++)if(e.bytes[n]===0){t=!1;break}if(t){let t=n.decode(e.bytes);W.setFileByPath(e.path,t,!0)}else{let t=new Uint8Array(e.bytes.length);t.set(e.bytes),W.setFileByPath(e.path,new r(t.buffer,`application/octet-stream`),!0)}e.dirty=!1}catch{}},X={TERM:`xterm-256color`,COLORTERM:`truecolor`,COLUMNS:String(this.stdout&&this.stdout.columns||this.context&&typeof this.context.getVar==`function`&&this.context.getVar(`COLUMNS`)||80),LINES:String(this.stdout&&this.stdout.rows||this.context&&typeof this.context.getVar==`function`&&this.context.getVar(`LINES`)||24),...this.context&&this.context.vars||{}},re=Object.entries(X).map(([e,t])=>`${e}=${t}`),ie=new Proxy({fd_write:(e,t,r,a)=>{if(!T)return o;let s=new DataView(T.buffer);if(e===1||e===2){let o=0;for(let i=0;i<r;i++){let r=s.getUint32(t+i*8,!0),a=s.getUint32(t+i*8+4,!0);a>0&&R(e,n.decode(new Uint8Array(T.buffer,r,a))),o+=a}return s.setUint32(a,o,!0),i}let c=q.get(e);if(!c)return o;if(c.type===`dev_null`||c.type===`dev_zero`){let e=0;for(let n=0;n<r;n++)e+=s.getUint32(t+n*8+4,!0);return s.setUint32(a,e,!0),i}if(c.type===`dev_tty`){let e=0;for(let i=0;i<r;i++){let r=s.getUint32(t+i*8,!0),a=s.getUint32(t+i*8+4,!0);a>0&&R(1,n.decode(new Uint8Array(T.buffer,r,a))),e+=a}return s.setUint32(a,e,!0),i}if(c.type!==`file`)return o;let l=0;for(let e=0;e<r;e++){let n=s.getUint32(t+e*8,!0),r=s.getUint32(t+e*8+4,!0);if(r>0){let e=new Uint8Array(T.buffer,n,r),t=c.append?c.bytes.length:c.pos,i=t+r;if(i>c.bytes.length){let e=new Uint8Array(i);e.set(c.bytes),c.bytes=e}c.bytes.set(e,t),c.pos=t+r,c.dirty=!0,l+=r}}return s.setUint32(a,l,!0),i},fd_read:(e,t,n,r)=>{if(!T)return o;let s=new DataView(T.buffer),c=q.get(e),l=!!(c&&c.type===`dev_tty`);if(e===0||I&&e===2||l){(l||e===2)&&L();let o=!!((J.get(e)||0)&w);if(D){if((typeof E?.exports?.asyncify_get_state==`function`?E.exports.asyncify_get_state():0)===2){E.exports.asyncify_stop_rewind();let e=0;for(let r=0;r<n&&B.length>0;r++){let n=s.getUint32(t+r*8,!0),i=s.getUint32(t+r*8+4,!0),a=Math.min(i,B.length),o=B.splice(0,a);new Uint8Array(T.buffer).set(o,n),e+=a}return s.setUint32(r,e,!0),i}if(B.length>0){let e=0;for(let r=0;r<n&&B.length>0;r++){let n=s.getUint32(t+r*8,!0),i=s.getUint32(t+r*8+4,!0),a=Math.min(i,B.length),o=B.splice(0,a);new Uint8Array(T.buffer).set(o,n),e+=a}return s.setUint32(r,e,!0),i}return o?(s.setUint32(r,0,!0),a):(E.exports.asyncify_start_unwind(O),k=new Promise(e=>{A=e}),s.setUint32(r,0,!0),i)}if(B.length>0){let e=0;for(let r=0;r<n&&B.length>0;r++){let n=s.getUint32(t+r*8,!0),i=s.getUint32(t+r*8+4,!0),a=Math.min(i,B.length),o=B.splice(0,a);new Uint8Array(T.buffer).set(o,n),e+=a}return s.setUint32(r,e,!0),i}let c=0;for(let e=0;e<n&&U<H.length;e++){let n=s.getUint32(t+e*8,!0),r=s.getUint32(t+e*8+4,!0),i=Math.min(r,H.length-U);new Uint8Array(T.buffer).set(H.slice(U,U+i),n),U+=i,c+=i}return c===0&&o&&U>=H.length?(s.setUint32(r,0,!0),a):(s.setUint32(r,c,!0),i)}if(!c)return o;if(c.type===`dev_null`)return s.setUint32(r,0,!0),i;if(c.type===`dev_zero`){let e=0;for(let r=0;r<n;r++){let n=s.getUint32(t+r*8,!0),i=s.getUint32(t+r*8+4,!0);new Uint8Array(T.buffer,n,i).fill(0),e+=i}return s.setUint32(r,e,!0),i}if(c.type===`dev_urandom`){let e=0;for(let r=0;r<n;r++){let n=s.getUint32(t+r*8,!0),i=s.getUint32(t+r*8+4,!0),a=new Uint8Array(T.buffer,n,i);if(typeof crypto<`u`&&crypto.getRandomValues)crypto.getRandomValues(a);else for(let e=0;e<i;e++)a[e]=Math.floor(Math.random()*256);e+=i}return s.setUint32(r,e,!0),i}if(c.type!==`file`)return o;let u=0;for(let e=0;e<n&&c.pos<c.bytes.length;e++){let n=s.getUint32(t+e*8,!0),r=s.getUint32(t+e*8+4,!0),i=Math.min(r,c.bytes.length-c.pos);new Uint8Array(T.buffer).set(c.bytes.subarray(c.pos,c.pos+i),n),c.pos+=i,u+=i}return s.setUint32(r,u,!0),i},fd_seek:(e,t,n,r,a)=>{if(!T)return o;if(e<=2)return f;let s=q.get(e);if(!s)return o;if(s.type===`dev_tty`||s.type===`dev_null`||s.type===`dev_zero`||s.type===`dev_urandom`)return f;if(s.type!==`file`)return o;let l,u,d;typeof t==`bigint`?(l=Number(t),u=n,d=r):(l=t,u=r,d=a);let p=s.pos;if(u===0)p=l;else if(u===1)p=s.pos+l;else if(u===2)p=s.bytes.length+l;else return c;return p<0?c:(s.pos=p,d&&new DataView(T.buffer).setBigUint64(d,BigInt(s.pos),!0),i)},fd_tell:(e,t)=>{if(!T)return o;let n=q.get(e);return!n||n.type!==`file`?o:(new DataView(T.buffer).setBigUint64(t,BigInt(n.pos),!0),i)},fd_close:e=>{if(e<=2)return i;let t=q.get(e);return t?(t.type===`file`&&Y(t),q.delete(e),J.delete(e),i):o},fd_sync:e=>{let t=q.get(e);return t&&Y(t),i},fd_datasync:e=>{let t=q.get(e);return t&&Y(t),i},fd_prestat_get:(e,t)=>{if(!T)return o;let n=q.get(e);if(!n||n.type!==`preopen`)return o;let r=new DataView(T.buffer),a=y.encode(n.guestName);return r.setUint8(t,0),r.setUint32(t+4,a.length,!0),i},fd_prestat_dir_name:(e,t,n)=>{if(!T)return o;let r=q.get(e);if(!r||r.type!==`preopen`)return o;let a=y.encode(r.guestName);return new Uint8Array(T.buffer,t,Math.min(n,a.length)).set(a.subarray(0,n)),i},fd_fdstat_get:(e,t)=>{if(!T)return o;let n=new DataView(T.buffer),r=p;if(e<=2)r=m;else{let t=q.get(e);if(!t)return o;r=t.type===`dev_null`||t.type===`dev_zero`||t.type===`dev_urandom`||t.type===`dev_tty`?m:t.type===`preopen`||t.type===`dir`?h:g}for(let e=0;e<24;e++)n.setUint8(t+e,0);n.setUint8(t,r);let a=J.get(e)||(q.get(e)?.append?C:0);return n.setUint16(t+2,a,!0),n.setBigUint64(t+8,18446744073709551615n,!0),n.setBigUint64(t+16,18446744073709551615n,!0),i},fd_fdstat_set_flags:(e,t)=>{if(!T||e>2&&!q.has(e))return o;J.set(e,t);let n=q.get(e);return n&&(n.append=!!(t&C)),(e===0||e===2||n&&n.type===`dev_tty`)&&t&w&&L(),i},fd_filestat_get:(e,t)=>{if(!T)return o;let n=new DataView(T.buffer);for(let e=0;e<64;e++)n.setUint8(t+e,0);if(e<=2)return n.setUint8(t+16,m),i;let r=q.get(e);if(!r)return o;if(r.type===`dev_null`||r.type===`dev_zero`||r.type===`dev_urandom`||r.type===`dev_tty`)return n.setUint8(t+16,m),n.setBigUint64(t+24,1n,!0),i;let a=r.type===`preopen`||r.type===`dir`;return n.setUint8(t+16,a?h:g),n.setBigUint64(t+24,1n,!0),n.setBigUint64(t+32,BigInt(r.bytes?r.bytes.length:0),!0),i},path_open:(e,t,r,a,c,f,p,m,h)=>{if(!T||!W)return o;let g=ne(e,n.decode(new Uint8Array(T.buffer,r,a)));if(!g)return o;let v=g.replace(/\/+/g,`/`).replace(/\/$/,``)||`/`;if(v===`/dev/null`){let e=K++;return q.set(e,{type:`dev_null`,path:`/dev/null`}),new DataView(T.buffer).setUint32(h,e,!0),i}if(v===`/dev/zero`){let e=K++;return q.set(e,{type:`dev_zero`,path:`/dev/zero`}),new DataView(T.buffer).setUint32(h,e,!0),i}if(v===`/dev/urandom`||v===`/dev/random`){let e=K++;return q.set(e,{type:`dev_urandom`,path:v}),new DataView(T.buffer).setUint32(h,e,!0),i}if(v===`/dev/tty`){L();let e=K++;return q.set(e,{type:`dev_tty`,path:`/dev/tty`}),new DataView(T.buffer).setUint32(h,e,!0),i}let w=W.stat(g),E=w!==null;if(c&x&&c&_&&E)return s;if(c&b){if(!E)return u;if(!w.isDirectory)return d;let e=K++;return q.set(e,{type:`dir`,path:g}),new DataView(T.buffer).setUint32(h,e,!0),i}if(E&&w.isDirectory)return l;if(!E&&!(c&_))return u;let D=new Uint8Array,O=!1;if(E&&!(c&S)){let e=W.getFileByPath(g);e!=null&&(D=typeof e==`string`?y.encode(e):new Uint8Array(this._contentToBytes(e)))}else O=!0;let k=K++;return q.set(k,{type:`file`,path:g,bytes:D,pos:m&C?D.length:0,append:!!(m&C),dirty:O}),new DataView(T.buffer).setUint32(h,k,!0),i},path_filestat_get:(e,t,r,a,s)=>{if(!T||!W)return o;let c=ne(e,n.decode(new Uint8Array(T.buffer,r,a)));if(!c)return o;let l=c.replace(/\/+/g,`/`).replace(/\/$/,``)||`/`;if(l===`/dev/null`||l===`/dev/zero`||l===`/dev/urandom`||l===`/dev/random`||l===`/dev/tty`){let e=new DataView(T.buffer);for(let t=0;t<64;t++)e.setUint8(s+t,0);return e.setUint8(s+16,m),e.setBigUint64(s+24,1n,!0),i}let d=W.stat(c);if(!d)return u;let f=new DataView(T.buffer);for(let e=0;e<64;e++)f.setUint8(s+e,0);return f.setUint8(s+16,d.isDirectory?h:g),f.setBigUint64(s+24,1n,!0),f.setBigUint64(s+32,BigInt(W.getSize(c)||0),!0),i},path_create_directory:(e,t,r)=>{if(!T||!W)return o;let a=ne(e,n.decode(new Uint8Array(T.buffer,t,r)));if(!a)return o;try{return W.setFileByPath(a,{},!0),i}catch{return c}},path_unlink_file:(e,t,r)=>{if(!T||!W)return o;let a=ne(e,n.decode(new Uint8Array(T.buffer,t,r)));if(!a||!W.exists(a))return u;try{return W.deleteFileByPath(a),i}catch{return c}},path_remove_directory:(e,t,r)=>{if(!T||!W)return o;let a=ne(e,n.decode(new Uint8Array(T.buffer,t,r)));if(!a||!W.exists(a))return u;try{return W.deleteFileByPath(a),i}catch{return c}},path_rename:(e,t,r,a,s,l)=>{if(!T||!W)return o;let d=n.decode(new Uint8Array(T.buffer,t,r)),f=n.decode(new Uint8Array(T.buffer,s,l)),p=ne(e,d),m=ne(a,f);if(!p||!m)return o;if(!W.exists(p))return u;for(let e of q.values())e.path===p&&(Y(e),e.path=m);try{let e=W.getFileByPath(p);return W.setFileByPath(m,e,!0),W.deleteFileByPath(p),i}catch{return c}},proc_exit:e=>{throw e!==0&&(this.exitCode=e),{_wasmExit:!0,code:e}},args_sizes_get:(e,t)=>{if(!T)return c;let n=[this.script,...this.arguments||[]],r=new DataView(T.buffer);return r.setUint32(e,n.length,!0),r.setUint32(t,n.reduce((e,t)=>e+y.encode(t).length+1,0),!0),i},args_get:(e,t)=>{if(!T)return c;let n=[this.script,...this.arguments||[]],r=new DataView(T.buffer),a=t;for(let t=0;t<n.length;t++){r.setUint32(e+t*4,a,!0);let i=y.encode(n[t]+`\0`);new Uint8Array(T.buffer).set(i,a),a+=i.length}return i},environ_sizes_get:(e,t)=>{if(!T)return c;let n=new DataView(T.buffer);n.setUint32(e,re.length,!0);let r=re.reduce((e,t)=>e+y.encode(t).length+1,0);return n.setUint32(t,r,!0),i},environ_get:(e,t)=>{if(!T)return c;let n=new DataView(T.buffer),r=t;for(let t=0;t<re.length;t++){n.setUint32(e+t*4,r,!0);let i=y.encode(re[t]+`\0`);new Uint8Array(T.buffer).set(i,r),r+=i.length}return i},clock_time_get:(e,t,n)=>{if(T){let e=BigInt(Date.now())*1000000n;new DataView(T.buffer).setBigUint64(n,e,!0)}return i},random_get:(e,t)=>{if(T){let n=new Uint8Array(T.buffer,e,t);for(let e=0;e<t;e++)n[e]=Math.random()*256|0}return i},clock_nanosleep:(e,t,n,r,a)=>{if(!T)return o;let s=new DataView(T.buffer).getBigUint64(n,!0),c=0;if(t&1){let e=BigInt(Date.now())*1000000n;c=s>e?Number((s-e)/1000000n):0}else c=Number(s/1000000n);return D&&c>0?(typeof E?.exports?.asyncify_get_state==`function`?E.exports.asyncify_get_state():0)===2?(E.exports.asyncify_stop_rewind(),i):(E.exports.asyncify_start_unwind(O),k=new Promise(e=>setTimeout(e,Math.max(1,c))),i):i},poll_oneoff:(e,t,n,r)=>{if(!T)return o;let a=new DataView(T.buffer);if(D){if((typeof E?.exports?.asyncify_get_state==`function`?E.exports.asyncify_get_state():0)===2){E.exports.asyncify_stop_rewind();let o=0;for(let r=0;r<n;r++){let n=e+r*48,s=a.getBigUint64(n,!0),c=a.getUint8(n+8),l=t+o*32;a.setBigUint64(l,s,!0),a.setUint16(l+8,i,!0),a.setUint8(l+10,c);for(let e=11;e<32;e++)a.setUint8(l+e,0);c===1&&a.setBigUint64(l+16,BigInt(B.length),!0),o++}return a.setUint32(r,o,!0),i}let o=0,s=1/0;for(let t=0;t<n;t++){let n=e+t*48,r=a.getUint8(n+8);if(r===0){let e=a.getBigUint64(n+24,!0),t=a.getUint16(n+40,!0),r=0;if(t&1){let t=BigInt(Date.now())*1000000n;r=e>t?Number((e-t)/1000000n):0}else r=Number(e/1000000n);r<s&&(s=r)}else if(r===1){let e=a.getUint32(n+16,!0),t=q.get(e),r=!!(t&&t.type===`dev_tty`);(e===0||e===2||r)&&L(),(e===0||I&&e===2||r)&&B.length>0&&o++}else r===2&&o++}if(o>0||s===0){let o=0;for(let r=0;r<n;r++){let n=e+r*48,c=a.getBigUint64(n,!0),l=a.getUint8(n+8),u=!1;if(l===0&&s===0)u=!0;else if(l===1){let e=a.getUint32(n+16,!0),t=q.get(e),r=!!(t&&t.type===`dev_tty`);(e===0||I&&e===2||r)&&B.length>0&&(u=!0)}else l===2&&(u=!0);if(u){let e=t+o*32;a.setBigUint64(e,c,!0),a.setUint16(e+8,i,!0),a.setUint8(e+10,l);for(let t=11;t<32;t++)a.setUint8(e+t,0);l===1&&a.setBigUint64(e+16,BigInt(B.length),!0),o++}}return a.setUint32(r,o,!0),i}return E.exports.asyncify_start_unwind(O),k=new Promise(e=>{let t=null;A=()=>{t&&clearTimeout(t),A=null,e()},s!==1/0&&(t=setTimeout(()=>{A=null,e()},Math.max(1,s)))}),a.setUint32(r,0,!0),i}return a.setUint32(r,0,!0),i}},{get(e,t){return t in e?e[t]:()=>0}}),ae=e=>{if(!T||!e)return``;try{let t=new DataView(T.buffer).getUint32(e-4,!0),n=new Uint16Array(T.buffer,e,t>>>1);return String.fromCharCode(...n)}catch{return``}},oe={wasi_snapshot_preview1:ie,wasi_unstable:ie,env:new Proxy({print:(e,t)=>{T&&R(1,n.decode(new Uint8Array(T.buffer,e,t)))},eprint:(e,t)=>{T&&R(2,n.decode(new Uint8Array(T.buffer,e,t)))},log:e=>{R(1,ae(e)+`
|
|
6
|
+
`)},logi:e=>{R(1,String(e)+`
|
|
7
|
+
`)},logf:e=>{R(1,String(e)+`
|
|
8
|
+
`)},trace:(e,t,...n)=>{let r=t>0?` `+n.slice(0,t).join(`, `):``;R(1,`trace: ${ae(e)}${r}\n`)},seed:()=>Date.now()*Math.random(),abort:(e,t,n,r)=>{let i=ae(e),a=ae(t);throw(i||a)&&R(2,`abort: ${i||`aborted`} at ${a||this.script}:${n||0}:${r||0}\n`),this.exitCode=134,{_wasmExit:!0,code:134}}},{get(e,t){return t in e?e[t]:()=>0}})};try{let t=await WebAssembly.compile(e);for(let e of WebAssembly.Module.imports(t))if(e.kind===`memory`){let t=new WebAssembly.Memory({initial:1,maximum:256});T=t,oe[e.module]||(oe[e.module]={}),oe[e.module][e.name]=t}if(E=await WebAssembly.instantiate(t,oe),E.exports.memory&&(T=E.exports.memory),D=!!(E.exports.asyncify_start_unwind&&E.exports.asyncify_stop_unwind),D&&T){try{O=T.grow(1)*65536}catch{O=16}let e=O+8,t=O+65536-8;new Int32Array(T.buffer,O,2).set([e,t])}typeof E.exports.set_terminal_size==`function`&&L(),I&&this._enterAltScreen();let n=this.stdout&&this.stdout.columns||this.context&&typeof this.context.getVar==`function`&&parseInt(this.context.getVar(`COLUMNS`),10)||80,r=this.stdout&&this.stdout.rows||this.context&&typeof this.context.getVar==`function`&&parseInt(this.context.getVar(`LINES`),10)||24;if(typeof E.exports.set_terminal_size==`function`)try{E.exports.set_terminal_size(n,r)}catch{}N=()=>{let e=this.stdout&&this.stdout.columns||this.context&&typeof this.context.getVar==`function`&&parseInt(this.context.getVar(`COLUMNS`),10)||80,t=this.stdout&&this.stdout.rows||this.context&&typeof this.context.getVar==`function`&&parseInt(this.context.getVar(`LINES`),10)||24;if(typeof E?.exports?.set_terminal_size==`function`)try{E.exports.set_terminal_size(e,t)}catch{}},this.stdout&&typeof this.stdout.on==`function`&&this.stdout.on(`resize`,N),this.stdinStream&&typeof this.stdinStream.on==`function`&&this.stdinStream.on(`resize`,N);let i=E.exports._start||E.exports.__wasi_command||E.exports.main||E.exports.run;if(i)try{let e=i();for(e&&typeof e.then==`function`&&(e=await e);D&&typeof E.exports.asyncify_get_state==`function`&&E.exports.asyncify_get_state()===1;)E.exports.asyncify_stop_unwind(),k&&=(await k,null),E.exports.asyncify_start_rewind(O),e=i(),e&&typeof e.then==`function`&&(e=await e)}catch(e){(!e||!e._wasmExit)&&(this.stdErr=`${this.script}: runtime error: ${e?.message||String(e)}`,this.exitCode=1)}else{let e=Object.entries(E.exports).filter(([,e])=>typeof e==`function`).map(([e])=>e),t=e.length>0?` (module is a library exporting: ${e.join(`, `)})`:``;this.stdErr=`${this.script}: no CLI entry point found (expected _start, main, or run)${t}`,this.exitCode=1}}catch(e){(!e||!e._wasmExit)&&(this.stdErr=`${this.script}: ${e?.message||String(e)}`,this.exitCode=1)}finally{I&&this._exitAltScreen(),I&&P&&(this.stdinStream&&typeof this.stdinStream.off==`function`&&this.stdinStream.off(`data`,P),this.stdin&&typeof this.stdin.off==`function`&&this.stdin.off(`data`,P)),N&&(this.stdout&&typeof this.stdout.off==`function`&&this.stdout.off(`resize`,N),this.stdinStream&&typeof this.stdinStream.off==`function`&&this.stdinStream.off(`resize`,N)),this._externalKeyHandler=null;for(let e of q.values())Y(e)}z();let se=this.arguments||[];if(!(this.result&&this.result.getStdOutput&&this.result.getStdOutput().length>0)&&(this.exitCode===0||this.exitCode===void 0)){let t=(this.script||`wasm`).split(`/`).pop(),n=Object.assign({name:t,version:`wasi`,description:`WebAssembly WASI binary (${this.script})`},this._pkgMeta||{});if(se.includes(`--help`)||se.includes(`-h`)){let r=j(e);for(let e of M(t,n,r))this.stdOut=e}else (se.includes(`--version`)||se.includes(`-V`)||se.includes(`-v`))&&(this.stdOut=`${t} (${n.name} ${n.version} wasm)`)}}},E=new Map;function D(e,t){if(!e||!e.exists(t))return null;if(e.isRealFilesystem)try{let n=J();return new Uint8Array(n.readFileSync(e.absolutePath(t)))}catch{}let n=e.getFileByPath(t);if(n==null)return null;if(n instanceof Uint8Array||v!==void 0&&v.isBuffer(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(n instanceof ArrayBuffer)return new Uint8Array(n);if(typeof n==`string`){if(n.startsWith(`data:`)){let e=n.indexOf(`,`);if(e!==-1){let t=n.slice(e+1);if(v!==void 0)return new Uint8Array(v.from(t,`base64`));let r=atob(t),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i}}let e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t)&255;return e}return null}function O(e,t,n,i=`application/octet-stream`){let a=n instanceof Uint8Array?n:new Uint8Array(n),o=new Uint8Array(a.byteLength);o.set(a);let s=new r(o.buffer,i);if(e.isRealFilesystem)try{let n=J(),r=te(),i=e.absolutePath(t);n.mkdirSync(r.dirname(i),{recursive:!0}),n.writeFileSync(i,v.from(a.buffer,a.byteOffset,a.byteLength));return}catch{if(typeof e._setFileRaw==`function`){e._setFileRaw(t,s,!0);return}}if(typeof e._setFileRaw==`function`&&t.startsWith(`/var/lib/wbt/`)){e._setFileRaw(t,s,!0);return}e.setFileByPath(t,s,!0)}async function k(e,t,n=null){if(typeof n==`function`){let r=await n(e,t);if(r)return r}try{let t=await import(e);if(t)return t}catch{}if(t)try{return await import(t)}catch(n){if(!/^https?:\/\/esm\.sh\//i.test(t))try{return await import(`https://esm.sh/${e}`)}catch{}throw Error(`Failed to load WASM package '${e}' from ${t}: ${n.message||n}`)}throw Error(`Package '${e}' could not be loaded`)}function A(e,t=!1){let n={usage:null,options:[]};if(!e||typeof e!=`string`)return n;let r=e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean),i=new Set,a=t?r.findIndex(e=>/^usage:\s*(.+)/i.test(e)):-1,o=a>=0?a:0;for(let e=o;e<r.length;e++){let a=r[e];!n.usage&&/^usage:\s*(.+)/i.test(a)?n.usage=a.replace(/^usage:\s*/i,``).trim():/^(?:-[a-zA-Z0-9?]|--[a-zA-Z0-9][-a-zA-Z0-9]*)(?:\s|,|=|<|\[|$)/.test(a)&&a.length<=120&&!/^(?:-[hHvV],\s*)?--(?:help|version)\b/i.test(a)&&(!t||/^(?:-[a-zA-Z?]|--[a-zA-Z][a-zA-Z0-9-]*)(?:,\s*--?[a-zA-Z0-9-]+)?(?:\s+[<\[a-zA-Z0-9_.->\]]+)*(?:\s+[A-Za-z`'"(][A-Za-z0-9 ,.;:()'"`/<>\[\]=+$\t_-]*|)$/.test(a))&&(i.has(a)||(i.add(a),n.options.push(a)))}if(t&&n.options.length===0){let t=e.match(/--[a-z][a-z0-9-]{1,24}/g)||[];for(let e of Array.from(new Set(t)).slice(0,12))e!==`--help`&&e!==`--version`&&n.options.push(e)}return n}function j(e){let t={usage:null,options:[],exports:[],wasiImports:[]};if(!(e instanceof Uint8Array)||e.length<8)return t;try{if(typeof WebAssembly<`u`&&WebAssembly.Module){let n=new WebAssembly.Module(e);t.exports=WebAssembly.Module.exports(n).filter(e=>e.kind===`function`).map(e=>e.name),t.wasiImports=WebAssembly.Module.imports(n).filter(e=>e.module.startsWith(`wasi_`)).map(e=>e.name)}}catch{}try{let n=[],r=``;for(let t=0;t<e.length;t++){let i=e[t];i>=32&&i<=126||i===9||i===10?r+=String.fromCharCode(i):(r.length>=4&&n.push(r),r=``)}r.length>=4&&n.push(r);let i=A(n.join(`
|
|
9
|
+
`),!0);t.usage=i.usage,t.options=i.options}catch{}return t}function M(e,t={},n=null){let r=t.name||e,i=t.version||`wasm`,a=t.description||`WebAssembly binary`,o=t&&typeof t.repl==`object`?t.repl:t.repl?{}:null,s=n&&n.usage||t.usage,c=s?s.replace(/%s/g,e):null,l=o?`${e} [options] ${o.evalFlag?`[${o.evalFlag} <code>] `:``}[file] [args...]`:`${e} [options] [args...]`,u=[`${e} (${r} ${i} wasm) — ${a}`,`Usage: ${c||l}`];t.details&&u.push(``,t.details),u.push(``,`Options:`);let d=n&&n.options&&n.options.length>0?n.options:Array.isArray(t.options)?t.options:[];if(d.length>0)for(let e of d)u.push(` ${e}`);else o&&(o.evalFlag&&u.push(` ${o.evalFlag.padEnd(20)}Evaluate inline code and print result`),u.push(` (no arguments) Start interactive ${e} REPL shell`));return u.push(` -h, --help Show this help message and exit`),u.push(` -V, --version Show WebAssembly binary version and exit`),n&&n.exports&&n.exports.length>0&&u.push(``,`WASM Exports: ${n.exports.join(`, `)}`),Array.isArray(t.aliases)&&t.aliases.length>0&&u.push(``,`Aliases: ${t.aliases.join(`, `)}`),(t.homepage||t.cdnUrl||t.wasmUrl)&&u.push(`Source: ${t.homepage||t.cdnUrl||t.wasmUrl}`),u}function N(e,t={},n=null){let r=X(),i=(n||e.bin||e.name).toLowerCase();class a extends r{static get name(){return i}get name(){return i}get requiresFilesystem(){return!0}async run(){let n=[...this.arguments||[]],r=n.includes(`--help`)||n.includes(`-h`),a=!r&&(n.includes(`--version`)||n.includes(`-V`)||n.includes(`-v`));this._inspectedWasm=null,this._persistedWasmBytes=e.wasmPath?D(this.context&&this.context.fs||this.fs,e.wasmPath):null,r&&this._persistedWasmBytes&&this._persistedWasmBytes.byteLength>0&&(this._inspectedWasm=j(this._persistedWasmBytes));try{if((e.type===`wasm`||e.type===`custom-wasm`)&&(this._persistedWasmBytes||e.wasmUrl)){let i=this._persistedWasmBytes;if(!i&&t.moduleLoader)try{let n=await t.moduleLoader(e.name,e.cdnUrl);n instanceof Uint8Array||n instanceof ArrayBuffer?i=n instanceof Uint8Array?n:new Uint8Array(n):n&&(n.wasmBytes||n.wasm||n.wasmBinary)&&(i=n.wasmBytes||n.wasm||n.wasmBinary)}catch{}if(!i&&e.wasmUrl&&(i=await this._fetchWasmBytes(e.wasmUrl)),i){r&&(this._inspectedWasm=j(i)),await this._runRawWasmBytes(i,n);return}}else{let o=e.cdnUrl||e.wasmUrl||`https://esm.sh/${e.name}`,s=typeof globalThis.fetch==`function`?globalThis.fetch:null;if(s&&this._persistedWasmBytes&&this._persistedWasmBytes.byteLength>0&&typeof Response<`u`){let t=this._persistedWasmBytes,n=e.wasmUrl||``;globalThis.fetch=async(e,r)=>{let i=typeof e==`string`?e:e&&e.url?e.url:``;return i&&(i===n||!/^https?:\/\//i.test(i)&&/\.wasm(\?.*)?$/i.test(i))?new Response(t,{status:200,headers:{"Content-Type":`application/wasm`}}):s(e,r)}}let c,l;try{c=await k(e.name,o,t.moduleLoader),l=c&&c.default!==void 0?c.default:c,l&&typeof l.then==`function`&&(l=await l)}finally{s&&(globalThis.fetch=s)}if(l instanceof Uint8Array||l instanceof ArrayBuffer){let e=l instanceof Uint8Array?l:new Uint8Array(l);r&&(this._inspectedWasm=j(e)),await this._runRawWasmBytes(e,n)}else if(l&&(l.wasmBytes instanceof Uint8Array||l.wasm instanceof Uint8Array)){let e=l.wasmBytes||l.wasm;r&&(this._inspectedWasm=j(e)),await this._runRawWasmBytes(e,n)}else if(typeof l==`function`)await this._runFunctionOrEmscripten(l,n,r);else if(l&&typeof l==`object`){l.ready&&await l.ready,r&&(l.HEAPU8 instanceof Uint8Array||l.wasmBinary instanceof Uint8Array)&&(this._inspectedWasm=j(l.wasmBinary||l.HEAPU8));let t=l.main||l.run||l.callMain||l.exec;if(typeof t==`function`)await this._invokeCliFunction(t.bind(l),n);else if(l.promised||typeof l.raw==`function`||typeof l.json==`function`){let e=l.promised?await l.promised:l,t=n.filter(e=>e.startsWith(`-`)),i=n.filter(e=>!e.startsWith(`-`)),o=i.shift()||`.`,s=this._createIoBridge(n,[],[]),c=i.length>0?s.readFile(i[0])||``:s.stdin||(r||a?`{}`:``),u=typeof e.raw==`function`?e.raw(c,o,t):!r&&!a?JSON.stringify(e.json(JSON.parse(c||`null`),o)):null;u!=null&&String(u).replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>{this.stdOut=e})}else if(!r&&!a){this.stdErr=`${i}: unsupported WASM module format for '${e.name}'`,this.exitCode=1;return}}else if(!r&&!a){this.stdErr=`${i}: unsupported WASM module format for '${e.name}'`,this.exitCode=1;return}}}catch(e){if(!r&&!a){if(e&&typeof e.status==`number`){this.exitCode=e.status;return}this.stdErr=`${i}: ${e.message||e}`,this.exitCode=1;return}}if(r||a){let t=this.result&&this.result.getStdOutput?this.result.getStdOutput():[],n=t.map(e=>e.string).join(`
|
|
10
|
+
`),o=r?A(n):null,s=r&&!!(o&&(o.usage||o.options.length>0)||t.some(e=>/\b(usage|options):/i.test(e.string))),c=t.filter(e=>e.type===`out`).map(e=>e.string),l=a&&c.length>0&&(this.exitCode===0||this.exitCode===void 0);if(r)if(s){let e=t.map(e=>e.string);this.result&&Array.isArray(this.result.std)&&(this.result.std.length=0),this.exitCode=0;for(let t of e)this.stdOut=t}else{this.result&&Array.isArray(this.result.std)&&(this.result.std.length=0),this.exitCode=0;for(let t of M(i,e,this._inspectedWasm))this.stdOut=t}else a&&!l?(this.result&&Array.isArray(this.result.std)&&(this.result.std.length=0),this.exitCode=0,this.stdOut=`${i} (${e.name} ${e.version||`wasm`} wasm)`):this.exitCode=0}}async _fetchWasmBytes(e){if(E.has(e))return E.get(e);let n=t.fetch||(typeof fetch==`function`?fetch:null);if(!n)throw Error(`fetch is not available in this environment`);let r=await n(e);if(!r||!r.ok)throw Error(`HTTP ${r?r.status:`error`} fetching ${e}`);let i=new Uint8Array(await r.arrayBuffer());return E.set(e,i),i}async _runRawWasmBytes(t,n){let r=new T(i,n,this.context);r.script=i,r.arguments=n,r.context=this.context,r.fs=this.fs,r._pkgMeta=e,this.stdin!==void 0&&(r.stdin=this.stdin),await r._runWasm(t);for(let e of r.result.getStdOutput())e.type===`out`?this.stdOut=e.string:e.type===`err`&&(this.stdErr=e.string);this.exitCode=r.result.getExitCode()}_createIoBridge(t,n,r){let a=e=>({write(t){(t instanceof Uint8Array?new TextDecoder().decode(t):String(t??``)).replace(/\r?\n$/,``).split(/\r?\n/).forEach(t=>e.push(t))}});return{binName:i,args:t,stdin:this.stdin!==void 0&&this.stdin!==null?String(this.stdin):``,fs:this.fs,context:this.context,wasmPath:e.wasmPath||null,wasmBytes:this._persistedWasmBytes||null,stdout:Object.assign(e=>n.push(String(e)),a(n)),stderr:Object.assign(e=>r.push(String(e)),a(r)),readFile:(e,t)=>{if(!this.fs)return null;let n=t&&t!==`.`&&!e.startsWith(`/`)?`${t.replace(/\/+$/,``)}/${e}`:e,r=this.fs.getFileByPath(n)??this.fs.getFileByPath(e);return r==null?null:typeof r==`string`?r:new TextDecoder().decode(r)},readBytes:e=>D(this.fs,e),writeFile:(e,t,n)=>{if(!this.fs)return;let r=n&&n!==`.`&&!e.startsWith(`/`)?`${n.replace(/\/+$/,``)}/${e}`:e;if(t instanceof Uint8Array||ArrayBuffer.isView(t)){let e=r.endsWith(`.wasm`)?`application/wasm`:`application/octet-stream`;O(this.fs,r,t,e)}else this.fs.setFileByPath(r,String(t),!0);if(r.endsWith(`.wasm`)||r.endsWith(`.wat`))try{this.context&&this.context.fs?this.context.fs.setMode(r,493):this.fs.setMode(r,493)}catch{}},listFiles:(e,t)=>{if(!this.fs)return[];let n=t&&t!==`.`&&!e.startsWith(`/`)?`${t.replace(/\/+$/,``)}/${e}`:e,r=this.fs.getFileByPath(n);return r&&typeof r==`object`&&!(r instanceof Uint8Array)?Object.keys(r):[]}}}async _runFunctionOrEmscripten(t,n,r=!1){let i=[],a=[],o=new TextEncoder().encode(this.stdin||``),s=0,c=new Set,l={arguments:n,noInitialRun:!0,...this._persistedWasmBytes&&this._persistedWasmBytes.byteLength>0?{wasmBinary:this._persistedWasmBytes}:{},...e.wasmUrl?{locateFile:t=>t.endsWith(`.wasm`)?e.wasmUrl:t}:{},print:e=>{i.push(String(e))},printErr:e=>{a.push(String(e))},stdin:()=>s<o.length?o[s++]:null,preRun:[e=>{e&&e.FS&&(c=this._syncBrshToEmscriptenFs(e.FS,n))}]},u=this._createIoBridge(n,i,a),d;try{d=t.prototype&&t.prototype.constructor===t&&Object.getOwnPropertyNames(t.prototype).length>1?new t(l,u):await t(l,u)}catch(e){if(e&&typeof e.status==`number`)this.exitCode=e.status;else throw e}if(d&&typeof d==`object`)if(r&&(d.wasmBinary instanceof Uint8Array||d.HEAPU8 instanceof Uint8Array)&&(this._inspectedWasm=j(d.wasmBinary||d.HEAPU8)),typeof d.callMain==`function`){d.FS&&c.size===0&&(c=this._syncBrshToEmscriptenFs(d.FS,n));try{let e=await d.callMain(n);typeof e==`number`&&e!==0&&(this.exitCode=e)}catch(e){e&&typeof e.status==`number`?this.exitCode=e.status:(a.push(e.message||String(e)),this.exitCode=1)}d.FS&&this._syncEmscriptenFsToBrsh(d.FS,n,c)}else if(typeof d.exec==`function`&&typeof d.writeFile==`function`)await this._runVirtualFsInstance(d,n,i,a);else if(typeof d.main==`function`||typeof d.run==`function`){let e=(d.main||d.run).bind(d);await this._invokeCliFunction(e,n,i,a)}else !r&&!isVersion&&typeof d.Database==`function`?this._runSqlJsDatabase(d,n,u,i):(typeof d.stdout==`string`&&d.stdout&&d.stdout.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)),typeof d.stderr==`string`&&d.stderr&&d.stderr.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>a.push(e)),d.error&&a.length===0&&(a.push(d.error.message||String(d.error)),this.exitCode=1),typeof d.exitCode==`number`&&(this.exitCode=d.exitCode));else typeof d==`string`?d.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)):typeof d==`number`&&(this.exitCode=d);i.forEach(e=>{this.stdOut=e}),a.forEach(e=>{this.stdErr=e})}_runSqlJsDatabase(e,t,n,r){let i=`list`,a=`:memory:`,o=null,s=[];for(let e=0;e<t.length;e++){let n=t[e];n===`-table`||n===`--table`||n===`-box`?i=`table`:n===`-csv`||n===`--csv`?i=`csv`:n===`-cmd`&&e+1<t.length?o=t[++e]:n.startsWith(`-`)||s.push(n)}if(s.length===1?/^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|PRAGMA|WITH|BEGIN|EXPLAIN|\.)\b/i.test(s[0])?o=s[0]:a=s[0]:s.length>=2&&(a=s[0],o=s.slice(1).join(` `)),!o&&n.stdin&&n.stdin.trim()&&(o=n.stdin.trim()),!o)return;let c=a===`:memory:`?null:n.readBytes(a),l=c&&c.byteLength>0?new e.Database(c):new e.Database;try{if(o.trim()===`.tables`){let e=l.exec(`SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name`),t=e[0]&&e[0].values?e[0].values.map(e=>e[0]):[];t.length>0&&r.push(t.join(` `))}else{let e=l.exec(o);for(let t of e){let e=(t.columns||[]).map(String),n=t.values||[];if(i===`table`&&e.length>0){let t=e.map(e=>e.length),i=n.map(n=>e.map((e,r)=>{let i=n[r]==null?`NULL`:String(n[r]);return i.length>t[r]&&(t[r]=i.length),i}));r.push(e.map((e,n)=>` `+e.padEnd(t[n])+` `).join(`|`)),r.push(t.map(e=>`-`.repeat(e+2)).join(`+`)),i.forEach(e=>r.push(e.map((e,n)=>` `+e.padEnd(t[n])+` `).join(`|`)))}else if(i===`csv`){let t=e=>{let t=e==null?``:String(e);return/[",\r\n]/.test(t)?`"`+t.replace(/"/g,`""`)+`"`:t};e.length>0&&r.push(e.map(t).join(`,`)),n.forEach(n=>r.push(e.map((e,r)=>t(n[r])).join(`,`)))}else n.forEach(t=>r.push(e.map((e,n)=>t[n]==null?``:String(t[n])).join(`|`)))}}a!==`:memory:`&&n.writeFile(a,l.export())}finally{l.close()}}async _runVirtualFsInstance(t,n,r,i){typeof t.on==`function`&&t.on(`log`,({message:e})=>{e&&r.push(e)}),!t.loaded&&typeof t.load==`function`&&await t.load(e.coreUrl?{coreURL:e.coreUrl}:void 0);let a=new Set,o=[];for(let e of n)if(!e.startsWith(`-`)&&(o.push(e),this.fs.exists(e))){let n=D(this.fs,e);n&&(await t.writeFile(e,n),a.add(e))}let s=await t.exec(n);for(let e of o)if(!a.has(e))try{if(typeof t.readFile==`function`){let n=await t.readFile(e);n&&O(this.fs,e,n)}}catch{}typeof s==`number`&&s!==0&&(this.exitCode=s,i.length===0&&r.length>0&&i.push(...r.splice(0,r.length)))}async _invokeCliFunction(e,t,n=null,r=null){let i=n||[],a=r||[],o=await e(t,this._createIoBridge(t,i,a));typeof o==`string`?o.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)):typeof o==`number`?this.exitCode=o:o&&typeof o==`object`&&(typeof o.stdout==`string`&&o.stdout&&o.stdout.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)),typeof o.stderr==`string`&&o.stderr&&o.stderr.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>a.push(e)),o.error?(a.length===0&&a.push(o.error.message||String(o.error)),this.exitCode=typeof o.exitCode==`number`?o.exitCode:1):typeof o.exitCode==`number`&&(this.exitCode=o.exitCode)),n||(i.forEach(e=>{this.stdOut=e}),a.forEach(e=>{this.stdErr=e}))}_syncBrshToEmscriptenFs(e,t){let n=new Set;if(!this.fs||!e||typeof e.writeFile!=`function`)return n;for(let r of t)if(!r.startsWith(`-`)&&this.fs.exists(r)){let t=D(this.fs,r);if(t)try{e.writeFile(r,t),n.add(r)}catch{}}return n}_syncEmscriptenFsToBrsh(e,t,n){if(!(!this.fs||!e||typeof e.readFile!=`function`)){for(let r of t)if(!(r.startsWith(`-`)||n.has(r)))try{let t=e.readFile(r);if(t){let e=r.endsWith(`.wasm`)?`application/wasm`:`application/octet-stream`;if(O(this.fs,r,t,e),r.endsWith(`.wasm`)||r.endsWith(`.wat`))try{this.context&&this.context.fs?this.context.fs.setMode(r,493):this.fs.setMode(r,493)}catch{}}}catch{}}}}return a}T.readBytesFromFs=D,T.writeBytesToFs=O,T.loadModule=k,T.extractHelpFromText=A,T.inspectWasmBytes=j,T.formatWasmHelp=M,T.createGenericWasmCommand=N,T.createCommand=N,t.exports=T})),ae=t(((e,t)=>{var n=G(),r=class extends n{static get name(){return`test`}get requiresFilesystem(){return!0}run(){let e=[...this.arguments];return e[e.length-1]===`]`&&e.pop(),this._evaluate(e)||(this.exitCode=1),Promise.resolve()}_evaluate(e){if(e.length===0)return!1;let t=e.indexOf(`-o`);if(t!==-1)return this._evaluate(e.slice(0,t))||this._evaluate(e.slice(t+1));let n=e.indexOf(`-a`);if(n!==-1)return this._evaluate(e.slice(0,n))&&this._evaluate(e.slice(n+1));if(e[0]===`!`)return!this._evaluate(e.slice(1));if(e.length===1)return e[0].length>0;if(e.length===2){let[t,n]=e;switch(t){case`-n`:return n.length>0;case`-z`:return n.length===0;case`-e`:return this.fs?this.fs.getFileByPath(n)!=null:!1;case`-f`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e!=null&&e.constructor!==Object}case`-d`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e!=null&&e.constructor===Object}case`-r`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&292)!=0}case`-w`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&146)!=0}case`-x`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&73)!=0}case`-s`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e==null||e.constructor===Object?!1:e.toString().length>0}default:return!1}}if(e.length===3){let[t,n,r]=e;switch(n){case`=`:case`==`:return t===r;case`!=`:return t!==r;case`-eq`:return parseInt(t)===parseInt(r);case`-ne`:return parseInt(t)!==parseInt(r);case`-lt`:return parseInt(t)<parseInt(r);case`-le`:return parseInt(t)<=parseInt(r);case`-gt`:return parseInt(t)>parseInt(r);case`-ge`:return parseInt(t)>=parseInt(r);default:return!1}}return!1}};t.exports={Test:r,TestBracket:class extends r{static get name(){return`[`}}}})),oe=t(((e,t)=>{var n=G();t.exports=class extends n{static get name(){return`cat`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=!1,r=[];for(let i of this.arguments)if(i.startsWith(`-`)&&i.length>1)for(let r of i.slice(1))r===`n`?e=!0:r===`b`?(t=!0,e=!1):r===`s`&&(n=!0);else r.push(i);let i=[];if(r.length===0){let e=typeof this.stdin==`string`?this.stdin:null;if(e==null)return this.stdErr=`cat: no file specified`,this.exitCode=1,Promise.resolve();i.push(e)}else for(let e of r){if(e===`-`){i.push(typeof this.stdin==`string`?this.stdin:``);continue}let t=this.fs.getFileByPath(e);if(t==null){let t=this.fs.exists(e)?`Permission denied`:`No such file or directory`;return this.stdErr=`${e}: ${t}`,this.exitCode=1,Promise.resolve()}if(t.constructor===Object)return this.stdErr=`${e}: Is a directory`,this.exitCode=1,Promise.resolve();i.push(t.toString())}let a=i.join(``);a.endsWith(`
|
|
11
11
|
`)&&(a=a.slice(0,-1));let o=a.split(`
|
|
12
|
-
`);if(n&&(o=o.reduce((e,t)=>(t===``&&e.length>0&&e[e.length-1]===``||e.push(t),e),[])),t||e){let e=0;o=o.map(n=>t&&n===``?n:(e++,`${String(e).padStart(6)}\t${n}`))}return o.forEach(e=>this.stdOut=e),Promise.resolve()}}})),ce=t(((e,t)=>{function n(e){return typeof e==`object`&&!!e}function r(e){return n(e)&&typeof e.length==`number`}function i(e){return Array.isArray(e)?e:e===void 0?[]:r(e)||e instanceof Set?Array.from(e):[e]}t.exports=i})),le=t(((e,t)=>{function n(e,t,...n){let r=[];if(!Array.isArray(e))throw Error(`Input must be an array`);for(let[i,a]of e.entries()){let e=[];n.forEach(t=>{typeof t==`function`?e=e.concat(t(a)):e.push(t)}),t(a)&&r.push({index:i,replaceWithValue:e})}for(let t of r.reverse()){let n=[t.index,1].concat(t.replaceWithValue);e.splice.apply(e,n)}return e}t.exports=n})),ue=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return!isNaN(parseFloat(e))}function n(e){return!isNaN(parseFloat(e))&&isFinite(e)}function r(e){return typeof e==`object`&&!!e&&e.constructor===Object}function i(e){return a(e)&&typeof e.length==`number`}function a(e){return typeof e==`object`&&!!e}function o(e){return e!==void 0}function s(e){return!o(e)}function c(e){return e===null}function l(e){return o(e)&&!c(e)&&!Number.isNaN(e)}function u(e){return typeof e==`function`?/^class /.test(Function.prototype.toString.call(e)):!1}function d(e){if(e===null)return!0;switch(typeof e){case`string`:case`number`:case`symbol`:case`undefined`:case`boolean`:return!0;default:return!1}}function f(e){if(e){let t=o(Promise)&&e instanceof Promise,n=e.then&&typeof e.then==`function`;return!!(t||n)}else return!1}function p(e){return e===null||!o(e)?!1:typeof e[Symbol.iterator]==`function`||typeof e[Symbol.asyncIterator]==`function`}function m(e){return typeof e==`string`}function h(e){return typeof e==`function`}function g(e){return typeof e==`function`&&e.constructor.name===`AsyncFunction`}e.default={isNumber:t,isFiniteNumber:n,isPlainObject:r,isArrayLike:i,isObject:a,isDefined:o,isUndefined:s,isNull:c,isDefinedValue:l,isClass:u,isPrimitive:d,isPromise:f,isIterable:p,isString:m,isFunction:h,isAsyncFunction:g},e.isArrayLike=i,e.isAsyncFunction=g,e.isClass=u,e.isDefined=o,e.isDefinedValue=l,e.isFiniteNumber=n,e.isFunction=h,e.isIterable=p,e.isNull=c,e.isNumber=t,e.isObject=a,e.isPlainObject=r,e.isPrimitive=d,e.isPromise=f,e.isString=m,e.isUndefined=s})),de,fe=e((()=>{de=globalThis||self})),pe=t(((e,t)=>{fe();var n=1/0,r=`[object Symbol]`,i=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,a=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,o=`\\ud800-\\udfff`,s=`\\u0300-\\u036f\\ufe20-\\ufe23`,c=`\\u20d0-\\u20f0`,l=`\\u2700-\\u27bf`,u=`a-z\\xdf-\\xf6\\xf8-\\xff`,d=`\\xac\\xb1\\xd7\\xf7`,f=`\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf`,p=`\\u2000-\\u206f`,m=` \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000`,h=`A-Z\\xc0-\\xd6\\xd8-\\xde`,g=`\\ufe0e\\ufe0f`,_=d+f+p+m,v=`['’]`,y=`[`+o+`]`,b=`[`+_+`]`,x=`[`+s+c+`]`,S=`\\d+`,C=`[`+l+`]`,w=`[`+u+`]`,T=`[^`+o+_+S+l+u+h+`]`,E=`\\ud83c[\\udffb-\\udfff]`,D=`(?:`+x+`|`+E+`)`,O=`[^`+o+`]`,k=`(?:\\ud83c[\\udde6-\\uddff]){2}`,A=`[\\ud800-\\udbff][\\udc00-\\udfff]`,j=`[`+h+`]`,M=`\\u200d`,N=`(?:`+w+`|`+T+`)`,P=`(?:`+j+`|`+T+`)`,F=`(?:`+v+`(?:d|ll|m|re|s|t|ve))?`,I=`(?:`+v+`(?:D|LL|M|RE|S|T|VE))?`,ee=D+`?`,L=`[`+g+`]?`,R=`(?:`+M+`(?:`+[O,k,A].join(`|`)+`)`+L+ee+`)*`,z=L+ee+R,B=`(?:`+[C,k,A].join(`|`)+`)`+z,V=`(?:`+[O+x+`?`,x,k,A,y].join(`|`)+`)`,H=RegExp(v,`g`),U=RegExp(x,`g`),W=RegExp(E+`(?=`+E+`)|`+V+z,`g`),G=RegExp([j+`?`+w+`+`+F+`(?=`+[b,j,`$`].join(`|`)+`)`,P+`+`+I+`(?=`+[b,j+N,`$`].join(`|`)+`)`,j+`?`+N+`+`+F,j+`+`+I,S,B].join(`|`),`g`),K=RegExp(`[`+M+o+s+c+g+`]`),te=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,q={À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,Ç:`C`,ç:`c`,Ð:`D`,ð:`d`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,è:`e`,é:`e`,ê:`e`,ë:`e`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,ì:`i`,í:`i`,î:`i`,ï:`i`,Ñ:`N`,ñ:`n`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,ù:`u`,ú:`u`,û:`u`,ü:`u`,Ý:`Y`,ý:`y`,ÿ:`y`,Æ:`Ae`,æ:`ae`,Þ:`Th`,þ:`th`,ß:`ss`,Ā:`A`,Ă:`A`,Ą:`A`,ā:`a`,ă:`a`,ą:`a`,Ć:`C`,Ĉ:`C`,Ċ:`C`,Č:`C`,ć:`c`,ĉ:`c`,ċ:`c`,č:`c`,Ď:`D`,Đ:`D`,ď:`d`,đ:`d`,Ē:`E`,Ĕ:`E`,Ė:`E`,Ę:`E`,Ě:`E`,ē:`e`,ĕ:`e`,ė:`e`,ę:`e`,ě:`e`,Ĝ:`G`,Ğ:`G`,Ġ:`G`,Ģ:`G`,ĝ:`g`,ğ:`g`,ġ:`g`,ģ:`g`,Ĥ:`H`,Ħ:`H`,ĥ:`h`,ħ:`h`,Ĩ:`I`,Ī:`I`,Ĭ:`I`,Į:`I`,İ:`I`,ĩ:`i`,ī:`i`,ĭ:`i`,į:`i`,ı:`i`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,ĸ:`k`,Ĺ:`L`,Ļ:`L`,Ľ:`L`,Ŀ:`L`,Ł:`L`,ĺ:`l`,ļ:`l`,ľ:`l`,ŀ:`l`,ł:`l`,Ń:`N`,Ņ:`N`,Ň:`N`,Ŋ:`N`,ń:`n`,ņ:`n`,ň:`n`,ŋ:`n`,Ō:`O`,Ŏ:`O`,Ő:`O`,ō:`o`,ŏ:`o`,ő:`o`,Ŕ:`R`,Ŗ:`R`,Ř:`R`,ŕ:`r`,ŗ:`r`,ř:`r`,Ś:`S`,Ŝ:`S`,Ş:`S`,Š:`S`,ś:`s`,ŝ:`s`,ş:`s`,š:`s`,Ţ:`T`,Ť:`T`,Ŧ:`T`,ţ:`t`,ť:`t`,ŧ:`t`,Ũ:`U`,Ū:`U`,Ŭ:`U`,Ů:`U`,Ű:`U`,Ų:`U`,ũ:`u`,ū:`u`,ŭ:`u`,ů:`u`,ű:`u`,ų:`u`,Ŵ:`W`,ŵ:`w`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Ź:`Z`,Ż:`Z`,Ž:`Z`,ź:`z`,ż:`z`,ž:`z`,IJ:`IJ`,ij:`ij`,Œ:`Oe`,œ:`oe`,ʼn:`'n`,ſ:`ss`},ne=typeof de==`object`&&de&&de.Object===Object&&de,re=typeof self==`object`&&self&&self.Object===Object&&self,J=ne||re||Function(`return this`)();function Y(e,t,n,r){var i=-1,a=e?e.length:0;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function ie(e){return e.split(``)}function ae(e){return e.match(i)||[]}function oe(e){return function(t){return e?.[t]}}var se=oe(q);function ce(e){return K.test(e)}function le(e){return te.test(e)}function ue(e){return ce(e)?pe(e):ie(e)}function pe(e){return e.match(W)||[]}function me(e){return e.match(G)||[]}var he=Object.prototype.toString,X=J.Symbol,ge=X?X.prototype:void 0,_e=ge?ge.toString:void 0;function ve(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function ye(e){if(typeof e==`string`)return e;if(we(e))return _e?_e.call(e):``;var t=e+``;return t==`0`&&1/e==-n?`-0`:t}function be(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:ve(e,t,n)}function xe(e){return function(t){t=Te(t);var n=ce(t)?ue(t):void 0,r=n?n[0]:t.charAt(0),i=n?be(n,1).join(``):t.slice(1);return r[e]()+i}}function Se(e){return function(t){return Y(Ae(Oe(t).replace(H,``)),e,``)}}function Ce(e){return!!e&&typeof e==`object`}function we(e){return typeof e==`symbol`||Ce(e)&&he.call(e)==r}function Te(e){return e==null?``:ye(e)}var Ee=Se(function(e,t,n){return t=t.toLowerCase(),e+(n?De(t):t)});function De(e){return ke(Te(e).toLowerCase())}function Oe(e){return e=Te(e),e&&e.replace(a,se).replace(U,``)}var ke=xe(`toUpperCase`);function Ae(e,t,n){return e=Te(e),t=n?void 0:t,t===void 0?le(e)?me(e):ae(e):e.match(t)||[]}t.exports=Ee})),me=t(((e,t)=>{z();var n=ce(),r=le(),i=ue(),a=pe(),o={short:/^-([^\d-])$/,long:/^--(\S+)/,combinedShort:/^-[^\d-]{2,}$/,optEquals:/^(--\S+?)=(.*)/},s=class extends Array{load(e){if(this.clear(),e&&e!==R.argv)e=n(e);else{e=R.argv.slice(0);let t=R.execArgv.some(m)?1:2;e.splice(0,t)}e.forEach(e=>this.push(String(e)))}clear(){this.length=0}expandOptionEqualsNotation(){if(this.some(e=>o.optEquals.test(e))){let e=[];this.forEach(t=>{let n=t.match(o.optEquals);n?e.push(n[1],n[2]):e.push(t)}),this.clear(),this.load(e)}}expandGetoptNotation(){this.hasCombinedShortOptions()&&r(this,o.combinedShort,c)}hasCombinedShortOptions(){return this.some(e=>o.combinedShort.test(e))}static from(e){let t=new this;return t.load(e),t}};function c(e){return e=e.slice(1),e.split(``).map(e=>`-`+e)}function l(e){return o.optEquals.test(e)}function u(e){return(o.short.test(e)||o.long.test(e))&&!o.optEquals.test(e)}function d(e){return o.long.test(e)&&!l(e)}function f(e){return o.short.test(e)?e.match(o.short)[1]:d(e)?e.match(o.long)[1]:l(e)?e.match(o.optEquals)[1].replace(/^--/,``):null}function p(e){return!(u(e)||o.combinedShort.test(e)||o.optEquals.test(e))}function m(e){return[`--eval`,`-e`].indexOf(e)>-1||e.startsWith(`--eval=`)}var h=class{constructor(e){this.name=e.name,this.type=e.type||String,this.alias=e.alias,this.multiple=e.multiple,this.lazyMultiple=e.lazyMultiple,this.defaultOption=e.defaultOption,this.defaultValue=e.defaultValue,this.group=e.group;for(let t in e)this[t]||(this[t]=e[t])}isBoolean(){return this.type===Boolean||i.isFunction(this.type)&&this.type.name===`Boolean`}isMultiple(){return this.multiple||this.lazyMultiple}static create(e){return new this(e)}},g=class extends Array{validate(e){this.some(e=>!e.name)&&_(`INVALID_DEFINITIONS`,"Invalid option definitions: the `name` property is required on each definition"),this.some(e=>e.type&&typeof e.type!=`function`)&&_(`INVALID_DEFINITIONS`,"Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)");let t;this.some(e=>(t=e,i.isDefined(e.alias)&&i.isNumber(e.alias)))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: to avoid ambiguity an alias cannot be numeric [--`+t.name+` alias is -`+t.alias+`]`),this.some(e=>(t=e,i.isDefined(e.alias)&&e.alias.length!==1))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: an alias must be a single character`),this.some(e=>(t=e,e.alias===`-`))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: an alias cannot be "-"`),y(this.map(t=>e?t.name.toLowerCase():t.name))&&_(`INVALID_DEFINITIONS`,`Two or more option definitions have the same name`),y(this.map(t=>e&&i.isDefined(t.alias)?t.alias.toLowerCase():t.alias))&&_(`INVALID_DEFINITIONS`,`Two or more option definitions have the same alias`),this.filter(e=>e.defaultOption===!0).length>1&&_(`INVALID_DEFINITIONS`,`Only one option definition can be the defaultOption`),this.some(e=>(t=e,e.isBoolean()&&e.defaultOption))&&_(`INVALID_DEFINITIONS`,`A boolean option ["${t.name}"] can not also be the defaultOption.`)}get(e,t){if(u(e))if(o.short.test(e)){let n=f(e);if(t){let e=n.toLowerCase();return this.find(t=>i.isDefined(t.alias)&&t.alias.toLowerCase()===e)}else return this.find(e=>e.alias===n)}else{let n=f(e);if(t){let e=n.toLowerCase();return this.find(t=>t.name.toLowerCase()===e)}else return this.find(e=>e.name===n)}else return this.find(t=>t.name===e)}getDefault(){return this.find(e=>e.defaultOption===!0)}isGrouped(){return this.some(e=>e.group)}whereGrouped(){return this.filter(v)}whereNotGrouped(){return this.filter(e=>!v(e))}whereDefaultValueSet(){return this.filter(e=>i.isDefined(e.defaultValue))}static from(e,t){if(e instanceof this)return e;let r=super.from(n(e),e=>h.create(e));return r.validate(t),r}};function _(e,t){let n=Error(t);throw n.name=e,n}function v(e){return n(e.group).some(e=>e)}function y(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];if(t[r])return!0;i.isDefined(r)&&(t[r]=!0)}}var b=class{constructor(e,t){this.options=Object.assign({},t),this.definitions=g.from(e,this.options.caseInsensitive),this.argv=s.from(this.options.argv),this.argv.hasCombinedShortOptions()&&r(this.argv,o.combinedShort.test.bind(o.combinedShort),e=>(e=e.slice(1),e.split(``).map(t=>({origArg:`-${e}`,arg:`-`+t}))))}*[Symbol.iterator](){let e=this.definitions,t,n,r,a,s=!1,c=!1,d;for(let f of this.argv){if(i.isPlainObject(f)&&(d=f.origArg,f=f.arg),c&&this.options.stopAtFirstUnknown){yield{event:`unknown_value`,arg:f,name:`_unknown`,value:void 0};continue}if(u(f))t=e.get(f,this.options.caseInsensitive),n=void 0,t?(n=t.isBoolean()?!0:null,a=`set`):a=`unknown_option`;else if(l(f)){let r=f.match(o.optEquals);t=e.get(r[1],this.options.caseInsensitive),t?t.isBoolean()?(yield{event:`unknown_value`,arg:f,name:`_unknown`,value:n,def:t},a=`set`,n=!0):(a=`set`,n=r[2]):a=`unknown_option`}else p(f)&&(t?(n=f,a=`set`):(t=this.definitions.getDefault(),t&&!s?(n=f,a=`set`):(a=`unknown_value`,t=void 0)));r=t?t.name:`_unknown`;let m={event:a,arg:f,name:r,value:n,def:t};d&&(m.subArg=f,m.arg=d),yield m,r===`_unknown`&&(c=!0),t&&t.defaultOption&&!t.isMultiple()&&a===`set`&&(s=!0),t&&t.isBoolean()&&(t=void 0),t&&!t.multiple&&i.isDefined(n)&&n!==null&&(t=void 0),n=void 0,a=void 0,r=void 0,d=void 0}}},x=new WeakMap,S=class{constructor(e){this.definition=new h(e),this.state=null,this.resetToDefault()}get(){return x.get(this)}set(e){this._set(e,`set`)}_set(e,t){let n=this.definition;if(n.isMultiple()){if(e!=null){let r=this.get();this.state===`default`&&(r.length=0),r.push(n.type(e)),this.state=t}}else if(!n.isMultiple()&&this.state===`set`){let t=Error(`Singular option already set [${this.definition.name}=${this.get()}]`);throw t.name=`ALREADY_SET`,t.value=e,t.optionName=n.name,t}else e==null?x.set(this,e):(x.set(this,n.type(e)),this.state=t)}resetToDefault(){i.isDefined(this.definition.defaultValue)?this.definition.isMultiple()?x.set(this,n(this.definition.defaultValue).slice()):x.set(this,this.definition.defaultValue):this.definition.isMultiple()?x.set(this,[]):x.set(this,null),this.state=`default`}static create(e){return e=new h(e),e.isBoolean()?C.create(e):new this(e)}},C=class extends S{set(e){super.set(!0)}static create(e){return new this(e)}},w=class extends Map{constructor(e){super(),this.definitions=g.from(e),this.set(`_unknown`,S.create({name:`_unknown`,multiple:!0}));for(let e of this.definitions.whereDefaultValueSet())this.set(e.name,S.create(e))}toObject(e){e||={};let t={};for(let n of this){let r=e.camelCase&&n[0]!==`_unknown`?a(n[0]):n[0],i=n[1];r===`_unknown`&&!i.get().length||(t[r]=i.get())}return e.skipUnknown&&delete t._unknown,t}},T=class extends w{toObject(e){let t=super.toObject({skipUnknown:e.skipUnknown}),r=super.toObject(e),o=r._unknown;delete r._unknown;let s={_all:r};return o&&o.length&&(s._unknown=o),this.definitions.whereGrouped().forEach(r=>{let o=e.camelCase?a(r.name):r.name,c=t[r.name];for(let e of n(r.group))s[e]=s[e]||{},i.isDefined(c)&&(s[e][o]=c)}),this.definitions.whereNotGrouped().forEach(n=>{let r=e.camelCase?a(n.name):n.name,o=t[n.name];i.isDefined(o)&&(s._none||={},s._none[r]=o)}),s}};function E(e,t){t||={},t.stopAtFirstUnknown&&(t.partial=!0),e=g.from(e,t.caseInsensitive);let n=new b(e,{argv:t.argv,stopAtFirstUnknown:t.stopAtFirstUnknown,caseInsensitive:t.caseInsensitive}),r=new(e.isGrouped()?T:w)(e);for(let e of n){let n=e.subArg||e.arg;if(!t.partial){if(e.event===`unknown_value`){let e=Error(`Unknown value: ${n}`);throw e.name=`UNKNOWN_VALUE`,e.value=n,e}else if(e.event===`unknown_option`){let e=Error(`Unknown option: ${n}`);throw e.name=`UNKNOWN_OPTION`,e.optionName=n,e}}let i;r.has(e.name)?i=r.get(e.name):(i=S.create(e.def),r.set(e.name,i)),e.name===`_unknown`?i.set(n):i.set(e.value)}return r.toObject({skipUnknown:!t.partial,camelCase:t.camelCase})}t.exports=E})),he=t(((e,t)=>{var n=W(),r=me();t.exports=class extends n{static get name(){return`ls`}get requiresFilesystem(){return!0}run(){let e=this.arguments.filter(e=>e!==`-1`),t=e.length!==this.arguments.length,n;try{n=this.parseArgs(e)}catch(e){return this.printHelp(e),Promise.reject()}if(n.one=n.one||t,n.help)return this.printHelp(),Promise.resolve();let r=this.fs.getFileByPath(n.path);if(!r){let e=this.fs.exists(n.path)?`Permission denied`:`No such file or directory`;return Promise.reject(`${n.path}: ${e}`)}if(r.constructor===Object){let e=r;n.all||(e=Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`.`)||(e[t]=n),e),{}));let t=this.fs.absolutePath(n.path);return n.long?this.printLong(e,t):n.one?Object.entries(e).forEach(([e,t])=>{this.stdOut=this._applyIndicator(e,t,n.classify)}):this.printSimple(e,n.classify),n.recursive&&Object.entries(e).forEach(([e,r])=>{if(r&&r.constructor===Object){let r=t.endsWith(`/`)?t+e:t+`/`+e;this.stdOut=``,this.stdOut=r+`:`,this.run.call(Object.create(this,{arguments:{value:[...this.arguments.filter(e=>e!==n.path&&e!==`./`),r]}}))}}),Promise.resolve()}return Promise.resolve(n.path)}printHelp(e){e&&(this.stdOut=e.message),this.stdOut=`usage: ls [-alRF1h] [file ...]`}printSimple(e,t){this.stdOut=Object.entries(e).reduce((e,[n,r])=>e+this.padString(this._applyIndicator(n,r,t)),``)}printLong(e,t){let n=t.endsWith(`/`)?t.slice(0,-1):t;Object.entries(e).forEach(([e,t])=>{let r=n+`/`+e,i=t!=null&&t.constructor===Object,a=this.fs.getMode(r),o=a===null?i?493:420:a,s=this._modeToString(o,i),c=this.fs.getSize(r);return this.stdOut=`${s} root users ${this.padString(c,10)} ${e}`})}_applyIndicator(e,t,n){return n?t&&t.constructor===Object?e+`/`:typeof t==`function`||this.fs.isExecutable(e)?e+`*`:e:e}_modeToString(e,t){return(t?`d`:`-`)+(e&256?`r`:`-`)+(e&128?`w`:`-`)+(e&64?`x`:`-`)+(e&32?`r`:`-`)+(e&16?`w`:`-`)+(e&8?`x`:`-`)+(e&4?`r`:`-`)+(e&2?`w`:`-`)+(e&1?`x`:`-`)}padString(e,t=16){let n=t-e.toString().length,r=``;for(let e=0;e<n;e++)r+=` `;return e.toString()+r}parseArgs(e=this.arguments){return r([{name:`path`,defaultOption:!0,defaultValue:`./`,type:String},{name:`all`,alias:`a`,type:Boolean},{name:`long`,alias:`l`,type:Boolean},{name:`recursive`,alias:`R`,type:Boolean},{name:`one`,type:Boolean},{name:`classify`,alias:`F`,type:Boolean},{name:`help`,alias:`h`,type:Boolean}],{argv:e})}}})),X=t(((e,t)=>{var n=W();t.exports=class extends n{static get name(){return`echo`}run(){let e=[...this.arguments],t=!1,n=!1;for(;e.length>0&&/^-[neE]+$/.test(e[0]);){let r=e.shift();r.includes(`n`)&&(t=!0),r.includes(`e`)&&(n=!0),r===`-E`&&(n=!1)}let r=e.join(` `);return n&&(r=r.replace(/\\c.*$/s,()=>(t=!0,``)).replace(/\\0([0-7]{1,3})/g,(e,t)=>String.fromCharCode(parseInt(t,8))).replace(/\\x([0-9a-fA-F]{1,2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\n/g,`
|
|
13
|
-
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\a/g,`\x07`).replace(/\\b/g,`\b`).replace(/\\e/g,`\x1B`).replace(/\\f/g,`\f`).replace(/\\v/g,`\v`).replace(/\\\\/g,`\\`)),t?(r.split(/\r?\n/).forEach(e=>this.stdOut=e),Promise.resolve()):Promise.resolve(r)}}})),
|
|
14
|
-
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\a/g,`\x07`).replace(/\\b/g,`\b`).replace(/\\e/g,`\x1B`).replace(/\\f/g,`\f`).replace(/\\v/g,`\v`).replace(/\\\\/g,`\\`);let n=``,r=0;for(let i=0;i<t.length;i++)if(t[i]===`%`&&i+1<t.length){let a=t[i+1];a===`s`?(n+=String(e[r++]??``),i++):a===`d`||a===`i`?(n+=String(parseInt(e[r++])||0),i++):a===`f`?(n+=String(parseFloat(e[r++])||0),i++):a===`%`?(n+=`%`,i++):n+=t[i]}else n+=t[i];return n.split(/\r?\n/).forEach(e=>this.stdOut=e),Promise.resolve()}}})),
|
|
12
|
+
`);if(n&&(o=o.reduce((e,t)=>(t===``&&e.length>0&&e[e.length-1]===``||e.push(t),e),[])),t||e){let e=0;o=o.map(n=>t&&n===``?n:(e++,`${String(e).padStart(6)}\t${n}`))}return o.forEach(e=>this.stdOut=e),Promise.resolve()}}})),se=t(((e,t)=>{function n(e){return typeof e==`object`&&!!e}function r(e){return n(e)&&typeof e.length==`number`}function i(e){return Array.isArray(e)?e:e===void 0?[]:r(e)||e instanceof Set?Array.from(e):[e]}t.exports=i})),ce=t(((e,t)=>{function n(e,t,...n){let r=[];if(!Array.isArray(e))throw Error(`Input must be an array`);for(let[i,a]of e.entries()){let e=[];n.forEach(t=>{typeof t==`function`?e=e.concat(t(a)):e.push(t)}),t(a)&&r.push({index:i,replaceWithValue:e})}for(let t of r.reverse()){let n=[t.index,1].concat(t.replaceWithValue);e.splice.apply(e,n)}return e}t.exports=n})),le=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return!isNaN(parseFloat(e))}function n(e){return!isNaN(parseFloat(e))&&isFinite(e)}function r(e){return typeof e==`object`&&!!e&&e.constructor===Object}function i(e){return a(e)&&typeof e.length==`number`}function a(e){return typeof e==`object`&&!!e}function o(e){return e!==void 0}function s(e){return!o(e)}function c(e){return e===null}function l(e){return o(e)&&!c(e)&&!Number.isNaN(e)}function u(e){return typeof e==`function`?/^class /.test(Function.prototype.toString.call(e)):!1}function d(e){if(e===null)return!0;switch(typeof e){case`string`:case`number`:case`symbol`:case`undefined`:case`boolean`:return!0;default:return!1}}function f(e){if(e){let t=o(Promise)&&e instanceof Promise,n=e.then&&typeof e.then==`function`;return!!(t||n)}else return!1}function p(e){return e===null||!o(e)?!1:typeof e[Symbol.iterator]==`function`||typeof e[Symbol.asyncIterator]==`function`}function m(e){return typeof e==`string`}function h(e){return typeof e==`function`}function g(e){return typeof e==`function`&&e.constructor.name===`AsyncFunction`}e.default={isNumber:t,isFiniteNumber:n,isPlainObject:r,isArrayLike:i,isObject:a,isDefined:o,isUndefined:s,isNull:c,isDefinedValue:l,isClass:u,isPrimitive:d,isPromise:f,isIterable:p,isString:m,isFunction:h,isAsyncFunction:g},e.isArrayLike=i,e.isAsyncFunction=g,e.isClass=u,e.isDefined=o,e.isDefinedValue=l,e.isFiniteNumber=n,e.isFunction=h,e.isIterable=p,e.isNull=c,e.isNumber=t,e.isObject=a,e.isPlainObject=r,e.isPrimitive=d,e.isPromise=f,e.isString=m,e.isUndefined=s})),ue,de=e((()=>{ue=globalThis||self})),fe=t(((e,t)=>{de();var n=1/0,r=`[object Symbol]`,i=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,a=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,o=`\\ud800-\\udfff`,s=`\\u0300-\\u036f\\ufe20-\\ufe23`,c=`\\u20d0-\\u20f0`,l=`\\u2700-\\u27bf`,u=`a-z\\xdf-\\xf6\\xf8-\\xff`,d=`\\xac\\xb1\\xd7\\xf7`,f=`\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf`,p=`\\u2000-\\u206f`,m=` \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000`,h=`A-Z\\xc0-\\xd6\\xd8-\\xde`,g=`\\ufe0e\\ufe0f`,_=d+f+p+m,v=`['’]`,y=`[`+o+`]`,b=`[`+_+`]`,x=`[`+s+c+`]`,S=`\\d+`,C=`[`+l+`]`,w=`[`+u+`]`,T=`[^`+o+_+S+l+u+h+`]`,E=`\\ud83c[\\udffb-\\udfff]`,D=`(?:`+x+`|`+E+`)`,O=`[^`+o+`]`,k=`(?:\\ud83c[\\udde6-\\uddff]){2}`,A=`[\\ud800-\\udbff][\\udc00-\\udfff]`,j=`[`+h+`]`,M=`\\u200d`,N=`(?:`+w+`|`+T+`)`,P=`(?:`+j+`|`+T+`)`,F=`(?:`+v+`(?:d|ll|m|re|s|t|ve))?`,I=`(?:`+v+`(?:D|LL|M|RE|S|T|VE))?`,L=D+`?`,R=`[`+g+`]?`,z=`(?:`+M+`(?:`+[O,k,A].join(`|`)+`)`+R+L+`)*`,B=R+L+z,V=`(?:`+[C,k,A].join(`|`)+`)`+B,H=`(?:`+[O+x+`?`,x,k,A,y].join(`|`)+`)`,U=RegExp(v,`g`),W=RegExp(x,`g`),G=RegExp(E+`(?=`+E+`)|`+H+B,`g`),ee=RegExp([j+`?`+w+`+`+F+`(?=`+[b,j,`$`].join(`|`)+`)`,P+`+`+I+`(?=`+[b,j+N,`$`].join(`|`)+`)`,j+`?`+N+`+`+F,j+`+`+I,S,V].join(`|`),`g`),K=RegExp(`[`+M+o+s+c+g+`]`),q=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,J={À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,Ç:`C`,ç:`c`,Ð:`D`,ð:`d`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,è:`e`,é:`e`,ê:`e`,ë:`e`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,ì:`i`,í:`i`,î:`i`,ï:`i`,Ñ:`N`,ñ:`n`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,ù:`u`,ú:`u`,û:`u`,ü:`u`,Ý:`Y`,ý:`y`,ÿ:`y`,Æ:`Ae`,æ:`ae`,Þ:`Th`,þ:`th`,ß:`ss`,Ā:`A`,Ă:`A`,Ą:`A`,ā:`a`,ă:`a`,ą:`a`,Ć:`C`,Ĉ:`C`,Ċ:`C`,Č:`C`,ć:`c`,ĉ:`c`,ċ:`c`,č:`c`,Ď:`D`,Đ:`D`,ď:`d`,đ:`d`,Ē:`E`,Ĕ:`E`,Ė:`E`,Ę:`E`,Ě:`E`,ē:`e`,ĕ:`e`,ė:`e`,ę:`e`,ě:`e`,Ĝ:`G`,Ğ:`G`,Ġ:`G`,Ģ:`G`,ĝ:`g`,ğ:`g`,ġ:`g`,ģ:`g`,Ĥ:`H`,Ħ:`H`,ĥ:`h`,ħ:`h`,Ĩ:`I`,Ī:`I`,Ĭ:`I`,Į:`I`,İ:`I`,ĩ:`i`,ī:`i`,ĭ:`i`,į:`i`,ı:`i`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,ĸ:`k`,Ĺ:`L`,Ļ:`L`,Ľ:`L`,Ŀ:`L`,Ł:`L`,ĺ:`l`,ļ:`l`,ľ:`l`,ŀ:`l`,ł:`l`,Ń:`N`,Ņ:`N`,Ň:`N`,Ŋ:`N`,ń:`n`,ņ:`n`,ň:`n`,ŋ:`n`,Ō:`O`,Ŏ:`O`,Ő:`O`,ō:`o`,ŏ:`o`,ő:`o`,Ŕ:`R`,Ŗ:`R`,Ř:`R`,ŕ:`r`,ŗ:`r`,ř:`r`,Ś:`S`,Ŝ:`S`,Ş:`S`,Š:`S`,ś:`s`,ŝ:`s`,ş:`s`,š:`s`,Ţ:`T`,Ť:`T`,Ŧ:`T`,ţ:`t`,ť:`t`,ŧ:`t`,Ũ:`U`,Ū:`U`,Ŭ:`U`,Ů:`U`,Ű:`U`,Ų:`U`,ũ:`u`,ū:`u`,ŭ:`u`,ů:`u`,ű:`u`,ų:`u`,Ŵ:`W`,ŵ:`w`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Ź:`Z`,Ż:`Z`,Ž:`Z`,ź:`z`,ż:`z`,ž:`z`,IJ:`IJ`,ij:`ij`,Œ:`Oe`,œ:`oe`,ʼn:`'n`,ſ:`ss`},te=typeof ue==`object`&&ue&&ue.Object===Object&&ue,ne=typeof self==`object`&&self&&self.Object===Object&&self,Y=te||ne||Function(`return this`)();function X(e,t,n,r){var i=-1,a=e?e.length:0;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function re(e){return e.split(``)}function ie(e){return e.match(i)||[]}function ae(e){return function(t){return e?.[t]}}var oe=ae(J);function se(e){return K.test(e)}function ce(e){return q.test(e)}function le(e){return se(e)?fe(e):re(e)}function fe(e){return e.match(G)||[]}function pe(e){return e.match(ee)||[]}var me=Object.prototype.toString,Z=Y.Symbol,he=Z?Z.prototype:void 0,ge=he?he.toString:void 0;function _e(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function ve(e){if(typeof e==`string`)return e;if(Ce(e))return ge?ge.call(e):``;var t=e+``;return t==`0`&&1/e==-n?`-0`:t}function ye(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:_e(e,t,n)}function be(e){return function(t){t=we(t);var n=se(t)?le(t):void 0,r=n?n[0]:t.charAt(0),i=n?ye(n,1).join(``):t.slice(1);return r[e]()+i}}function xe(e){return function(t){return X(ke(De(t).replace(U,``)),e,``)}}function Se(e){return!!e&&typeof e==`object`}function Ce(e){return typeof e==`symbol`||Se(e)&&me.call(e)==r}function we(e){return e==null?``:ve(e)}var Te=xe(function(e,t,n){return t=t.toLowerCase(),e+(n?Ee(t):t)});function Ee(e){return Oe(we(e).toLowerCase())}function De(e){return e=we(e),e&&e.replace(a,oe).replace(W,``)}var Oe=be(`toUpperCase`);function ke(e,t,n){return e=we(e),t=n?void 0:t,t===void 0?ce(e)?pe(e):ie(e):e.match(t)||[]}t.exports=Te})),pe=t(((e,t)=>{B();var n=se(),r=ce(),i=le(),a=fe(),o={short:/^-([^\d-])$/,long:/^--(\S+)/,combinedShort:/^-[^\d-]{2,}$/,optEquals:/^(--\S+?)=(.*)/},s=class extends Array{load(e){if(this.clear(),e&&e!==z.argv)e=n(e);else{e=z.argv.slice(0);let t=z.execArgv.some(m)?1:2;e.splice(0,t)}e.forEach(e=>this.push(String(e)))}clear(){this.length=0}expandOptionEqualsNotation(){if(this.some(e=>o.optEquals.test(e))){let e=[];this.forEach(t=>{let n=t.match(o.optEquals);n?e.push(n[1],n[2]):e.push(t)}),this.clear(),this.load(e)}}expandGetoptNotation(){this.hasCombinedShortOptions()&&r(this,o.combinedShort,c)}hasCombinedShortOptions(){return this.some(e=>o.combinedShort.test(e))}static from(e){let t=new this;return t.load(e),t}};function c(e){return e=e.slice(1),e.split(``).map(e=>`-`+e)}function l(e){return o.optEquals.test(e)}function u(e){return(o.short.test(e)||o.long.test(e))&&!o.optEquals.test(e)}function d(e){return o.long.test(e)&&!l(e)}function f(e){return o.short.test(e)?e.match(o.short)[1]:d(e)?e.match(o.long)[1]:l(e)?e.match(o.optEquals)[1].replace(/^--/,``):null}function p(e){return!(u(e)||o.combinedShort.test(e)||o.optEquals.test(e))}function m(e){return[`--eval`,`-e`].indexOf(e)>-1||e.startsWith(`--eval=`)}var h=class{constructor(e){this.name=e.name,this.type=e.type||String,this.alias=e.alias,this.multiple=e.multiple,this.lazyMultiple=e.lazyMultiple,this.defaultOption=e.defaultOption,this.defaultValue=e.defaultValue,this.group=e.group;for(let t in e)this[t]||(this[t]=e[t])}isBoolean(){return this.type===Boolean||i.isFunction(this.type)&&this.type.name===`Boolean`}isMultiple(){return this.multiple||this.lazyMultiple}static create(e){return new this(e)}},g=class extends Array{validate(e){this.some(e=>!e.name)&&_(`INVALID_DEFINITIONS`,"Invalid option definitions: the `name` property is required on each definition"),this.some(e=>e.type&&typeof e.type!=`function`)&&_(`INVALID_DEFINITIONS`,"Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)");let t;this.some(e=>(t=e,i.isDefined(e.alias)&&i.isNumber(e.alias)))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: to avoid ambiguity an alias cannot be numeric [--`+t.name+` alias is -`+t.alias+`]`),this.some(e=>(t=e,i.isDefined(e.alias)&&e.alias.length!==1))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: an alias must be a single character`),this.some(e=>(t=e,e.alias===`-`))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: an alias cannot be "-"`),y(this.map(t=>e?t.name.toLowerCase():t.name))&&_(`INVALID_DEFINITIONS`,`Two or more option definitions have the same name`),y(this.map(t=>e&&i.isDefined(t.alias)?t.alias.toLowerCase():t.alias))&&_(`INVALID_DEFINITIONS`,`Two or more option definitions have the same alias`),this.filter(e=>e.defaultOption===!0).length>1&&_(`INVALID_DEFINITIONS`,`Only one option definition can be the defaultOption`),this.some(e=>(t=e,e.isBoolean()&&e.defaultOption))&&_(`INVALID_DEFINITIONS`,`A boolean option ["${t.name}"] can not also be the defaultOption.`)}get(e,t){if(u(e))if(o.short.test(e)){let n=f(e);if(t){let e=n.toLowerCase();return this.find(t=>i.isDefined(t.alias)&&t.alias.toLowerCase()===e)}else return this.find(e=>e.alias===n)}else{let n=f(e);if(t){let e=n.toLowerCase();return this.find(t=>t.name.toLowerCase()===e)}else return this.find(e=>e.name===n)}else return this.find(t=>t.name===e)}getDefault(){return this.find(e=>e.defaultOption===!0)}isGrouped(){return this.some(e=>e.group)}whereGrouped(){return this.filter(v)}whereNotGrouped(){return this.filter(e=>!v(e))}whereDefaultValueSet(){return this.filter(e=>i.isDefined(e.defaultValue))}static from(e,t){if(e instanceof this)return e;let r=super.from(n(e),e=>h.create(e));return r.validate(t),r}};function _(e,t){let n=Error(t);throw n.name=e,n}function v(e){return n(e.group).some(e=>e)}function y(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];if(t[r])return!0;i.isDefined(r)&&(t[r]=!0)}}var b=class{constructor(e,t){this.options=Object.assign({},t),this.definitions=g.from(e,this.options.caseInsensitive),this.argv=s.from(this.options.argv),this.argv.hasCombinedShortOptions()&&r(this.argv,o.combinedShort.test.bind(o.combinedShort),e=>(e=e.slice(1),e.split(``).map(t=>({origArg:`-${e}`,arg:`-`+t}))))}*[Symbol.iterator](){let e=this.definitions,t,n,r,a,s=!1,c=!1,d;for(let f of this.argv){if(i.isPlainObject(f)&&(d=f.origArg,f=f.arg),c&&this.options.stopAtFirstUnknown){yield{event:`unknown_value`,arg:f,name:`_unknown`,value:void 0};continue}if(u(f))t=e.get(f,this.options.caseInsensitive),n=void 0,t?(n=t.isBoolean()?!0:null,a=`set`):a=`unknown_option`;else if(l(f)){let r=f.match(o.optEquals);t=e.get(r[1],this.options.caseInsensitive),t?t.isBoolean()?(yield{event:`unknown_value`,arg:f,name:`_unknown`,value:n,def:t},a=`set`,n=!0):(a=`set`,n=r[2]):a=`unknown_option`}else p(f)&&(t?(n=f,a=`set`):(t=this.definitions.getDefault(),t&&!s?(n=f,a=`set`):(a=`unknown_value`,t=void 0)));r=t?t.name:`_unknown`;let m={event:a,arg:f,name:r,value:n,def:t};d&&(m.subArg=f,m.arg=d),yield m,r===`_unknown`&&(c=!0),t&&t.defaultOption&&!t.isMultiple()&&a===`set`&&(s=!0),t&&t.isBoolean()&&(t=void 0),t&&!t.multiple&&i.isDefined(n)&&n!==null&&(t=void 0),n=void 0,a=void 0,r=void 0,d=void 0}}},x=new WeakMap,S=class{constructor(e){this.definition=new h(e),this.state=null,this.resetToDefault()}get(){return x.get(this)}set(e){this._set(e,`set`)}_set(e,t){let n=this.definition;if(n.isMultiple()){if(e!=null){let r=this.get();this.state===`default`&&(r.length=0),r.push(n.type(e)),this.state=t}}else if(!n.isMultiple()&&this.state===`set`){let t=Error(`Singular option already set [${this.definition.name}=${this.get()}]`);throw t.name=`ALREADY_SET`,t.value=e,t.optionName=n.name,t}else e==null?x.set(this,e):(x.set(this,n.type(e)),this.state=t)}resetToDefault(){i.isDefined(this.definition.defaultValue)?this.definition.isMultiple()?x.set(this,n(this.definition.defaultValue).slice()):x.set(this,this.definition.defaultValue):this.definition.isMultiple()?x.set(this,[]):x.set(this,null),this.state=`default`}static create(e){return e=new h(e),e.isBoolean()?C.create(e):new this(e)}},C=class extends S{set(e){super.set(!0)}static create(e){return new this(e)}},w=class extends Map{constructor(e){super(),this.definitions=g.from(e),this.set(`_unknown`,S.create({name:`_unknown`,multiple:!0}));for(let e of this.definitions.whereDefaultValueSet())this.set(e.name,S.create(e))}toObject(e){e||={};let t={};for(let n of this){let r=e.camelCase&&n[0]!==`_unknown`?a(n[0]):n[0],i=n[1];r===`_unknown`&&!i.get().length||(t[r]=i.get())}return e.skipUnknown&&delete t._unknown,t}},T=class extends w{toObject(e){let t=super.toObject({skipUnknown:e.skipUnknown}),r=super.toObject(e),o=r._unknown;delete r._unknown;let s={_all:r};return o&&o.length&&(s._unknown=o),this.definitions.whereGrouped().forEach(r=>{let o=e.camelCase?a(r.name):r.name,c=t[r.name];for(let e of n(r.group))s[e]=s[e]||{},i.isDefined(c)&&(s[e][o]=c)}),this.definitions.whereNotGrouped().forEach(n=>{let r=e.camelCase?a(n.name):n.name,o=t[n.name];i.isDefined(o)&&(s._none||={},s._none[r]=o)}),s}};function E(e,t){t||={},t.stopAtFirstUnknown&&(t.partial=!0),e=g.from(e,t.caseInsensitive);let n=new b(e,{argv:t.argv,stopAtFirstUnknown:t.stopAtFirstUnknown,caseInsensitive:t.caseInsensitive}),r=new(e.isGrouped()?T:w)(e);for(let e of n){let n=e.subArg||e.arg;if(!t.partial){if(e.event===`unknown_value`){let e=Error(`Unknown value: ${n}`);throw e.name=`UNKNOWN_VALUE`,e.value=n,e}else if(e.event===`unknown_option`){let e=Error(`Unknown option: ${n}`);throw e.name=`UNKNOWN_OPTION`,e.optionName=n,e}}let i;r.has(e.name)?i=r.get(e.name):(i=S.create(e.def),r.set(e.name,i)),e.name===`_unknown`?i.set(n):i.set(e.value)}return r.toObject({skipUnknown:!t.partial,camelCase:t.camelCase})}t.exports=E})),me=t(((e,t)=>{var n=G(),r=pe();t.exports=class extends n{static get name(){return`ls`}get requiresFilesystem(){return!0}run(){let e=this.arguments.filter(e=>e!==`-1`),t=e.length!==this.arguments.length,n;try{n=this.parseArgs(e)}catch(e){return this.printHelp(e),Promise.reject()}if(n.one=n.one||t,n.help)return this.printHelp(),Promise.resolve();let r=this.fs.getFileByPath(n.path);if(!r){let e=this.fs.exists(n.path)?`Permission denied`:`No such file or directory`;return Promise.reject(`${n.path}: ${e}`)}if(r.constructor===Object){let e=r;n.all||(e=Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`.`)||(e[t]=n),e),{}));let t=this.fs.absolutePath(n.path);return n.long?this.printLong(e,t):n.one?Object.entries(e).forEach(([e,t])=>{this.stdOut=this._applyIndicator(e,t,n.classify)}):this.printSimple(e,n.classify),n.recursive&&Object.entries(e).forEach(([e,r])=>{if(r&&r.constructor===Object){let r=t.endsWith(`/`)?t+e:t+`/`+e;this.stdOut=``,this.stdOut=r+`:`,this.run.call(Object.create(this,{arguments:{value:[...this.arguments.filter(e=>e!==n.path&&e!==`./`),r]}}))}}),Promise.resolve()}return Promise.resolve(n.path)}printHelp(e){e&&(this.stdOut=e.message),this.stdOut=`usage: ls [-alRF1h] [file ...]`}printSimple(e,t){this.stdOut=Object.entries(e).reduce((e,[n,r])=>e+this.padString(this._applyIndicator(n,r,t)),``)}printLong(e,t){let n=t.endsWith(`/`)?t.slice(0,-1):t;Object.entries(e).forEach(([e,t])=>{let r=n+`/`+e,i=t!=null&&t.constructor===Object,a=this.fs.getMode(r),o=a===null?i?493:420:a,s=this._modeToString(o,i),c=this.fs.getSize(r);return this.stdOut=`${s} root users ${this.padString(c,10)} ${e}`})}_applyIndicator(e,t,n){return n?t&&t.constructor===Object?e+`/`:typeof t==`function`||this.fs.isExecutable(e)?e+`*`:e:e}_modeToString(e,t){return(t?`d`:`-`)+(e&256?`r`:`-`)+(e&128?`w`:`-`)+(e&64?`x`:`-`)+(e&32?`r`:`-`)+(e&16?`w`:`-`)+(e&8?`x`:`-`)+(e&4?`r`:`-`)+(e&2?`w`:`-`)+(e&1?`x`:`-`)}padString(e,t=16){let n=t-e.toString().length,r=``;for(let e=0;e<n;e++)r+=` `;return e.toString()+r}parseArgs(e=this.arguments){return r([{name:`path`,defaultOption:!0,defaultValue:`./`,type:String},{name:`all`,alias:`a`,type:Boolean},{name:`long`,alias:`l`,type:Boolean},{name:`recursive`,alias:`R`,type:Boolean},{name:`one`,type:Boolean},{name:`classify`,alias:`F`,type:Boolean},{name:`help`,alias:`h`,type:Boolean}],{argv:e})}}})),Z=t(((e,t)=>{var n=G();t.exports=class extends n{static get name(){return`echo`}run(){let e=[...this.arguments],t=!1,n=!1;for(;e.length>0&&/^-[neE]+$/.test(e[0]);){let r=e.shift();r.includes(`n`)&&(t=!0),r.includes(`e`)&&(n=!0),r===`-E`&&(n=!1)}let r=e.join(` `);return n&&(r=r.replace(/\\c.*$/s,()=>(t=!0,``)).replace(/\\0([0-7]{1,3})/g,(e,t)=>String.fromCharCode(parseInt(t,8))).replace(/\\x([0-9a-fA-F]{1,2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\n/g,`
|
|
13
|
+
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\a/g,`\x07`).replace(/\\b/g,`\b`).replace(/\\e/g,`\x1B`).replace(/\\f/g,`\f`).replace(/\\v/g,`\v`).replace(/\\\\/g,`\\`)),t?(r.split(/\r?\n/).forEach(e=>this.stdOut=e),Promise.resolve()):Promise.resolve(r)}}})),he=t(((e,t)=>{var n=G();t.exports=class extends n{static get name(){return`printf`}run(){let e=[...this.arguments];if(!e.length)return Promise.resolve();let t=e.shift();t=t.replace(/\\n/g,`
|
|
14
|
+
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\a/g,`\x07`).replace(/\\b/g,`\b`).replace(/\\e/g,`\x1B`).replace(/\\f/g,`\f`).replace(/\\v/g,`\v`).replace(/\\\\/g,`\\`);let n=``,r=0;for(let i=0;i<t.length;i++)if(t[i]===`%`&&i+1<t.length){let a=t[i+1];a===`s`?(n+=String(e[r++]??``),i++):a===`d`||a===`i`?(n+=String(parseInt(e[r++])||0),i++):a===`f`?(n+=String(parseFloat(e[r++])||0),i++):a===`%`?(n+=`%`,i++):n+=t[i]}else n+=t[i];return n.split(/\r?\n/).forEach(e=>this.stdOut=e),Promise.resolve()}}})),ge=t(((e,t)=>{var n=G();t.exports=class extends n{static get name(){return`grep`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!1,f=!1,p=null,m=!1,h=[],g=[],_=[...this.arguments],v=0;for(;v<_.length;){let y=_[v];if(y===`--`){v++;break}if(y.startsWith(`-`)&&y.length>1){let g=y.slice(1),b=!1;for(let y=0;y<g.length&&!b;y++)switch(g[y]){case`i`:e=!0;break;case`v`:t=!0;break;case`n`:n=!0;break;case`c`:r=!0;break;case`l`:i=!0;break;case`L`:a=!0;break;case`q`:o=!0;break;case`r`:case`R`:s=!0;break;case`F`:c=!0;break;case`E`:break;case`o`:l=!0;break;case`w`:u=!0;break;case`x`:d=!0;break;case`s`:f=!0;break;case`a`:break;case`e`:{let e=g.slice(y+1),t=e.length>0?e:_[++v];for(let e of t.split(`
|
|
15
15
|
`))e.length>0&&h.push(e);m=!0,b=!0;break}case`f`:{let e=g.slice(y+1);p=e.length>0?e:_[++v],m=!0,b=!0;break}default:return f||(this.stdErr=`grep: invalid option -- '${g[y]}'`),this.exitCode=2,Promise.resolve()}}else g.push(y);v++}for(;v<_.length;)g.push(_[v++]);if(p!==null){let e=``;if(p===`-`)e=typeof this.stdin==`string`?this.stdin:``;else{let t=this.fs.getFileByPath(p);if(t==null){if(!f){let e=this.fs.exists(p)?`Permission denied`:`No such file or directory`;this.stdErr=`grep: ${p}: ${e}`}return this.exitCode=2,Promise.resolve()}e=t.toString()}for(let t of e.split(`
|
|
16
16
|
`))t.length>0&&h.push(t)}if(h.length===0&&!m){if(g.length===0)return this.stdErr=`grep: no pattern given`,this.exitCode=2,Promise.resolve();let e=g.shift();for(let t of e.split(`
|
|
17
17
|
`))t.length>0&&h.push(t);h.length===0&&h.push(e)}let y=e?`gi`:`g`,b=[];for(let e of h){let t=c?e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`):e;u&&(t=`(?:^|\\W)(?:${t})(?:\\W|$)`),d&&(t=`^(?:${t})$`);try{b.push(new RegExp(t,y))}catch(e){return this.stdErr=`grep: invalid regex: ${e.message}`,this.exitCode=2,Promise.resolve()}}let x=[],S=!1,C=typeof this.stdin==`string`?this.stdin:``,w=(e,t=!1)=>{let n=this.fs.getFileByPath(e);if(n==null){if(!f){let t=this.fs.exists(e)?`Permission denied`:`No such file or directory`;this.stdErr=`grep: ${e}: ${t}`}S=!0;return}if(n.constructor===Object){if(!s){f||(this.stdErr=`grep: ${e}: Is a directory`),S=!0;return}if(!t&&this.fs.isSymlink&&this.fs.isSymlink(e))return;for(let t of Object.keys(n))w(e.replace(/\/$/,``)+`/`+t,!1);return}x.push({label:e,content:n.toString()})};if(g.length===0)x.push({label:null,content:C});else for(let e of g)e===`-`?x.push({label:`(standard input)`,content:C}):w(e,!0);let T=s||x.length+ +!!S>1,E=!1,D=e=>{if(b.length===0)return!1;for(let t of b)if(t.lastIndex=0,t.test(e))return!0;return!1},O=e=>{let t=[];for(let n of b){n.lastIndex=0;let r;for(;(r=n.exec(e))!==null;){if(r[0].length===0){n.lastIndex++;continue}if(t.push(r[0]),!n.global)break}}return t};for(let{label:e,content:s}of x){let c=s.split(`
|
|
18
|
-
`);c.length>0&&c[c.length-1]===``&&c.pop();let u=0,d=[];for(let e=0;e<c.length;e++){let n=c[e],r,i=[];l&&!t?(i=O(n),r=i.length>0):r=D(n),r!==t&&(u++,d.push({text:n,num:e+1,segments:i}))}if(a){u===0&&(this.stdOut=e||`(standard input)`,E=!0);continue}if(u>0&&(E=!0),!o){if(i){u>0&&(this.stdOut=e||`(standard input)`);continue}if(r){let t=T&&e?`${e}:`:``;this.stdOut=`${t}${u}`;continue}for(let{text:t,num:r,segments:i}of d){let a=T&&e?`${e}:`:``,o=n?`${r}:`:``;if(l)for(let e of i)this.stdOut=`${a}${o}${e}`;else this.stdOut=`${a}${o}${t}`}}}return S&&!(o&&E)?this.exitCode=2:E||(this.exitCode=1),Promise.resolve()}}})),ve=t(((e,t)=>{var n=W();t.exports=class extends n{static get name(){return`true`}run(){return Promise.resolve()}}})),ye=t(((e,t)=>{var n=W();t.exports=class extends n{static get name(){return`false`}run(){return this.exitCode=1,Promise.resolve()}}})),be=t(((e,t)=>{var{Test:n,TestBracket:r}=oe();t.exports=[se(),he(),X(),ge(),_e(),ve(),ye(),n,r]})),xe=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`alias`}run(){if(this.arguments.length!==1)return Promise.reject(`alias requires a single argument`);let e=this.arguments[0].split(`=`);return e.length===2?(this.context.setAlias(e[0],e[1]),Promise.resolve()):Promise.reject(`alias requires a key and value delimited by '=' ie: key=value`)}}})),Se=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`export`}run(){if(this.arguments.length!==1)return Promise.reject(`export requires a single argument`);let e=this.arguments[0].split(`=`);return e.length!==2&&Promise.reject(`export requires a key and value delimited by '=' ie: key=value`),this.context.setVar(e[0],e[1]),Promise.resolve()}}})),Ce=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`cd`}run(){if(this.arguments.length!==1)return Promise.reject(`cd requires a single argument`);let e=this.context.fs.stat(this.arguments[0]);return e?e.isDirectory?(this.context.setCwd(this.arguments[0]),Promise.resolve()):Promise.reject(`${this.arguments[0]}: Not a directory`):Promise.reject(`file or directory not found`)}}})),we=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`chmod`}get requiresFilesystem(){return!0}run(){let e=this.arguments;if(e.length<2)return this.stdErr=`chmod: usage: chmod MODE FILE...`,this.exitCode=1,Promise.resolve();let t=e[0],n=e.slice(1);for(let e of n){if(!this.fs.exists(e)){this.stdErr=`chmod: cannot access '${e}': No such file or directory`,this.exitCode=1;continue}let n=this.fs.getMode(e),r=this._parseMode(t,n===null?420:n);if(r===null)return this.stdErr=`chmod: invalid mode: '${t}'`,this.exitCode=1,Promise.resolve();this.fs.setMode(e,r)}return Promise.resolve()}_parseMode(e,t){if(/^0?[0-7]{3,4}$/.test(e))return parseInt(e,8);let n=e.match(/^([ugoa]*)([+\-=])([rwx]+)$/);if(!n)return null;let[,r,i,a]=n,o=!r||r===`a`?[`u`,`g`,`o`]:r.split(``),s={u:256,g:32,o:4},c={u:128,g:16,o:2},l={u:64,g:8,o:1},u=0;for(let e of o)a.includes(`r`)&&(u|=s[e]),a.includes(`w`)&&(u|=c[e]),a.includes(`x`)&&(u|=l[e]);if(i===`+`)return t|u;if(i===`-`)return t&~u;if(i===`=`){let e=0;for(let t of o)e|=s[t]|c[t]|l[t];return t&~e|u}return null}}})),Te=t(((e,t)=>{var n=Y(),r=q();t.exports=class extends n{static get name(){return`cp`}get requiresFilesystem(){return!0}run(){let e=!1,t=null,n=!1,r=!1,i=null,a=[],o=[...this.arguments],s=0;for(;s<o.length;){let c=o[s];if(c===`--`){s++;break}if(c.startsWith(`-`)&&c.length>1)for(let a of c.slice(1))switch(a){case`r`:case`R`:e=!0,n=!0;break;case`a`:e=!0,n=!0,t=`preserve`,i=`preserve`;break;case`d`:case`P`:t=`preserve`,i=`preserve`;break;case`L`:t=`follow`,i=`follow`;break;case`H`:t=`follow_cl`,r=!0;break;case`f`:break}else a.push(c);s++}for(;s<o.length;)a.push(o[s++]);let c=t===null?n?`preserve`:`follow`:t;if(a.length<2)return this.stdErr=`cp: missing destination file operand${a.length?` after '${a[0]}'`:``}`,this.exitCode=1,Promise.resolve();let l=a[a.length-1],u=a.slice(0,-1),d=this.fs.stat(l),f=d!==null&&d.isDirectory,p=r||c===`follow_cl`?`follow`:c,m=r||c===`follow_cl`?i===null?`preserve`:i:c;for(let t of u){let n=this.fs.isSymlink?this.fs.isSymlink(t):!1,r=this.fs.stat(t);if(r===null){this.stdErr=`cp: cannot stat '${t}': No such file or directory`,this.exitCode=1;continue}if(!(n&&p===`preserve`)&&r.isDirectory&&!e){this.stdErr=`cp: omitting directory '${t}'`,this.exitCode=1;continue}let i=f?l.replace(/\/$/,``)+`/`+t.split(`/`).pop():l,a=this._copy(t,i,p,n,m);a&&(this.stdErr=a,this.exitCode=1)}return Promise.resolve()}_copy(e,t,n,i,a){if(i&&n===`preserve`&&this.fs.readSymlink){let n=this.fs.readSymlink(e);if(n===null)return`cp: cannot read symlink '${e}'`;try{this.fs.createSymlink(n,t)}catch(e){return`cp: cannot create symlink '${t}': ${e.message}`}return null}let o=this.fs.getFileByPath(e);if(o==null)return`cp: cannot stat '${e}': ${this.fs.exists(e)?`Permission denied`:`No such file or directory`}`;if(o.constructor===Object){try{this.fs.setFileByPath(t,{},!0)}catch(e){return`cp: cannot create directory '${t}': ${e.message}`}let n=this.fs.absolutePath(e),i;try{i=r.readdirSync(n)}catch{i=Object.keys(o)}for(let n of i){let r=e.replace(/\/$/,``)+`/`+n,i=t.replace(/\/$/,``)+`/`+n,o=this.fs.isSymlink?this.fs.isSymlink(r):!1,s=this._copy(r,i,a,o,a);s&&(this.stdErr=s,this.exitCode=1)}}else try{this.fs.setFileByPath(t,o,!0)}catch(e){return`cp: cannot create '${t}': ${e.message}`}return null}}})),Ee=t(((e,t)=>{var n=Y(),r=(()=>{try{return q()}catch{return null}})();t.exports=class extends n{static get name(){return`ln`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=[],i=[...this.arguments],a=0;for(;a<i.length;){let r=i[a];if(r===`--`){a++;break}if(r.startsWith(`-`)&&r.length>1)for(let n of r.slice(1))switch(n){case`s`:e=!0;break;case`f`:t=!0;break;case`n`:break;case`v`:break}else n.push(r);a++}for(;a<i.length;)n.push(i[a++]);if(n.length<2)return this.stdErr=n.length===0?`ln: missing file operand`:`ln: missing destination file operand after '${n[0]}'`,this.exitCode=1,Promise.resolve();let o=n[n.length-1],s=n.slice(0,-1),c=this.fs.stat(o),l=c!==null&&c.isDirectory;for(let n of s){let i=l?o.replace(/\/$/,``)+`/`+n.split(`/`).pop():o;if(t&&this.fs.exists(i)&&!this.fs.stat(i)?.isDirectory)try{this.fs.deleteFileByPath(i)}catch{}if(e){if(!this.fs.createSymlink){this.stdErr=`ln: cannot create symlink '${i}': Operation not supported`,this.exitCode=1;continue}try{this.fs.createSymlink(n,i)}catch(e){this.stdErr=`ln: cannot create symlink '${i}': ${e.message}`,this.exitCode=1}}else{if(!this.fs.isRealFilesystem||!r){this.stdErr=`ln: cannot create hard link '${i}': Operation not supported`,this.exitCode=1;continue}if(!this.fs.exists(n)){this.stdErr=`ln: failed to create hard link '${i}' => '${n}': No such file or directory`,this.exitCode=1;continue}try{r.linkSync(this.fs.absolutePath(n),this.fs.absolutePath(i))}catch(e){this.stdErr=`ln: failed to create hard link '${i}' => '${n}': ${e.message}`,this.exitCode=1}}}return Promise.resolve()}}})),De=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`mkdir`}get requiresFilesystem(){return!0}run(){let e=!1,t=[];for(let n of this.arguments)n===`-p`||n===`--parents`?e=!0:t.push(n);if(t.length===0)return this.stdErr=`mkdir: missing operand`,this.exitCode=1,Promise.resolve();for(let n of t){if(this.fs.exists(n)){e||(this.stdErr=`mkdir: cannot create directory '${n}': File exists`,this.exitCode=1);continue}try{this.fs.setFileByPath(n,{},e)}catch(e){this.stdErr=`mkdir: cannot create directory '${n}': ${e.message}`,this.exitCode=1}}return Promise.resolve()}}})),Oe=t(((e,t)=>{var n=Y(),r=q();t.exports=class extends n{static get name(){return`mv`}get requiresFilesystem(){return!0}run(){let e=null,t=[],n=[...this.arguments],i=0;for(;i<n.length;){let r=n[i];if(r===`--`){i++;break}if(r.startsWith(`-`)&&r.length>1)for(let t=1;t<r.length;t++)switch(r[t]){case`f`:case`i`:case`n`:break;case`t`:{let a=r.slice(t+1);e=a.length>0?a:n[++i],t=r.length;break}}else t.push(r);i++}for(;i<n.length;)t.push(n[i++]);let a=e===null?t[t.length-1]:e,o=e===null?t.slice(0,-1):t;if(!a||o.length===0)return this.stdErr=`mv: missing destination file operand${o.length?` after '${o[0]}'`:``}`,this.exitCode=1,Promise.resolve();let s=this.fs.stat(a),c=s!==null&&s.isDirectory;for(let e of o){let t=c?a.replace(/\/$/,``)+`/`+e.split(`/`).pop():a;if(this.fs.isRealFilesystem){let n=this.fs.absolutePath(e),i=this.fs.absolutePath(t);try{r.lstatSync(n)}catch{this.stdErr=`mv: cannot stat '${e}': No such file or directory`,this.exitCode=1;continue}try{let e=ne();r.mkdirSync(e.dirname(i),{recursive:!0}),r.renameSync(n,i)}catch(n){this.stdErr=`mv: cannot move '${e}' to '${t}': ${n.message}`,this.exitCode=1}}else{let n=this.fs.getFileByPath(e);if(n==null){let t=this.fs.exists(e)?`Permission denied`:`No such file or directory`;this.stdErr=`mv: cannot stat '${e}': ${t}`,this.exitCode=1;continue}try{this.fs.setFileByPath(t,this._deepCopy(n),!0),this.fs.deleteFileByPath(e)}catch(n){this.stdErr=`mv: cannot move '${e}' to '${t}': ${n.message}`,this.exitCode=1}}}return Promise.resolve()}_deepCopy(e){if(e==null||typeof e==`function`||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e))t[n]=this._deepCopy(r);return t}}})),ke=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`pwd`}run(){let e=this.context.fs.cwd;return this.stdOut=e.endsWith(`/`)&&e!==`/`?e.slice(0,-1):e,Promise.resolve()}}})),Ae=t(((e,t)=>{var n=Y(),r=q();t.exports=class extends n{static get name(){return`rm`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=[];for(let r of this.arguments)/^-[rRf]+$/.test(r)?((r.includes(`r`)||r.includes(`R`))&&(e=!0),r.includes(`f`)&&(t=!0)):n.push(r);if(n.length===0)return t||(this.stdErr=`rm: missing operand`,this.exitCode=1),Promise.resolve();for(let r of n)try{this._remove(r,e,t)}catch(e){this.stdErr=e.message,this.exitCode=1}return Promise.resolve()}_remove(e,t,n){if(!(this.fs.isSymlink&&this.fs.isSymlink(e))){let i=this.fs.getFileByPath(e);if(i==null){if(!n)throw Error(`rm: cannot remove '${e}': No such file or directory`);return}if(i.constructor===Object){if(!t)throw Error(`rm: cannot remove '${e}': Is a directory`);let a;if(this.fs.isRealFilesystem)try{a=r.readdirSync(this.fs.absolutePath(e))}catch{a=[]}else a=Object.keys(i);for(let r of a){let i=e.replace(/\/$/,``)+`/`+r;this._remove(i,t,n)}}}this.fs.deleteFileByPath(e)}}})),je=t(((e,t)=>{var n=Y(),r=(()=>{try{return q()}catch{return null}})();t.exports=class extends n{static get name(){return`stat`}get requiresFilesystem(){return!0}run(){let e=[];for(let t of this.arguments){if(t===`--`)break;t.startsWith(`-`)||e.push(t)}if(e.length===0)return this.stdErr=`stat: missing operand`,this.exitCode=1,Promise.resolve();for(let t of e){let e=this.fs.isSymlink?this.fs.isSymlink(t):!1;if(!this.fs.exists(t)&&!e){this.stdErr=`stat: cannot stat '${t}': No such file or directory`,this.exitCode=1;continue}this.stdOut=this._format(t,e)}return Promise.resolve()}_format(e,t){let n=this.fs.absolutePath(e);if(this.fs.isRealFilesystem&&r)try{let e=r.lstatSync(n),t=e.isSymbolicLink()?`l`:e.isDirectory()?`d`:`-`,i=e.isSymbolicLink()?`symbolic link`:e.isDirectory()?`directory`:`regular file`,a=(e.mode&511).toString(8).padStart(4,`0`),o=t+this._rwxBits(e.mode&511);return[` File: ${n}${e.isSymbolicLink()?` -> ${r.readlinkSync(n)}`:``}`,` Size: ${e.size}\t\tBlocks: ${e.blocks}\t\tIO Block: ${e.blksize}\t${i}`,`Device: ${e.dev}\t\tInode: ${e.ino}\t\tLinks: ${e.nlink}`,`Access: (${a}/${o})\tUid: ${e.uid}\tGid: ${e.gid}`,`Access: ${e.atime.toISOString()}`,`Modify: ${e.mtime.toISOString()}`,`Change: ${e.ctime.toISOString()}`].join(`
|
|
18
|
+
`);c.length>0&&c[c.length-1]===``&&c.pop();let u=0,d=[];for(let e=0;e<c.length;e++){let n=c[e],r,i=[];l&&!t?(i=O(n),r=i.length>0):r=D(n),r!==t&&(u++,d.push({text:n,num:e+1,segments:i}))}if(a){u===0&&(this.stdOut=e||`(standard input)`,E=!0);continue}if(u>0&&(E=!0),!o){if(i){u>0&&(this.stdOut=e||`(standard input)`);continue}if(r){let t=T&&e?`${e}:`:``;this.stdOut=`${t}${u}`;continue}for(let{text:t,num:r,segments:i}of d){let a=T&&e?`${e}:`:``,o=n?`${r}:`:``;if(l)for(let e of i)this.stdOut=`${a}${o}${e}`;else this.stdOut=`${a}${o}${t}`}}}return S&&!(o&&E)?this.exitCode=2:E||(this.exitCode=1),Promise.resolve()}}})),_e=t(((e,t)=>{var n=G();t.exports=class extends n{static get name(){return`true`}run(){return Promise.resolve()}}})),ve=t(((e,t)=>{var n=G();t.exports=class extends n{static get name(){return`false`}run(){return this.exitCode=1,Promise.resolve()}}})),ye=t(((e,t)=>{var{Test:n,TestBracket:r}=ae();t.exports=[oe(),me(),Z(),he(),ge(),_e(),ve(),n,r]})),be=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`alias`}run(){if(this.arguments.length!==1)return Promise.reject(`alias requires a single argument`);let e=this.arguments[0].split(`=`);return e.length===2?(this.context.setAlias(e[0],e[1]),Promise.resolve()):Promise.reject(`alias requires a key and value delimited by '=' ie: key=value`)}}})),xe=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`export`}run(){if(this.arguments.length!==1)return Promise.reject(`export requires a single argument`);let e=this.arguments[0].split(`=`);return e.length!==2&&Promise.reject(`export requires a key and value delimited by '=' ie: key=value`),this.context.setVar(e[0],e[1]),Promise.resolve()}}})),Se=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`cd`}run(){if(this.arguments.length!==1)return Promise.reject(`cd requires a single argument`);let e=this.context.fs.stat(this.arguments[0]);return e?e.isDirectory?(this.context.setCwd(this.arguments[0]),Promise.resolve()):Promise.reject(`${this.arguments[0]}: Not a directory`):Promise.reject(`file or directory not found`)}}})),Ce=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`chmod`}get requiresFilesystem(){return!0}run(){let e=this.arguments;if(e.length<2)return this.stdErr=`chmod: usage: chmod MODE FILE...`,this.exitCode=1,Promise.resolve();let t=e[0],n=e.slice(1);for(let e of n){if(!this.fs.exists(e)){this.stdErr=`chmod: cannot access '${e}': No such file or directory`,this.exitCode=1;continue}let n=this.fs.getMode(e),r=this._parseMode(t,n===null?420:n);if(r===null)return this.stdErr=`chmod: invalid mode: '${t}'`,this.exitCode=1,Promise.resolve();this.fs.setMode(e,r)}return Promise.resolve()}_parseMode(e,t){if(/^0?[0-7]{3,4}$/.test(e))return parseInt(e,8);let n=e.match(/^([ugoa]*)([+\-=])([rwx]+)$/);if(!n)return null;let[,r,i,a]=n,o=!r||r===`a`?[`u`,`g`,`o`]:r.split(``),s={u:256,g:32,o:4},c={u:128,g:16,o:2},l={u:64,g:8,o:1},u=0;for(let e of o)a.includes(`r`)&&(u|=s[e]),a.includes(`w`)&&(u|=c[e]),a.includes(`x`)&&(u|=l[e]);if(i===`+`)return t|u;if(i===`-`)return t&~u;if(i===`=`){let e=0;for(let t of o)e|=s[t]|c[t]|l[t];return t&~e|u}return null}}})),we=t(((e,t)=>{var n=X(),r=J();t.exports=class extends n{static get name(){return`cp`}get requiresFilesystem(){return!0}run(){let e=!1,t=null,n=!1,r=!1,i=null,a=[],o=[...this.arguments],s=0;for(;s<o.length;){let c=o[s];if(c===`--`){s++;break}if(c.startsWith(`-`)&&c.length>1)for(let a of c.slice(1))switch(a){case`r`:case`R`:e=!0,n=!0;break;case`a`:e=!0,n=!0,t=`preserve`,i=`preserve`;break;case`d`:case`P`:t=`preserve`,i=`preserve`;break;case`L`:t=`follow`,i=`follow`;break;case`H`:t=`follow_cl`,r=!0;break;case`f`:break}else a.push(c);s++}for(;s<o.length;)a.push(o[s++]);let c=t===null?n?`preserve`:`follow`:t;if(a.length<2)return this.stdErr=`cp: missing destination file operand${a.length?` after '${a[0]}'`:``}`,this.exitCode=1,Promise.resolve();let l=a[a.length-1],u=a.slice(0,-1),d=this.fs.stat(l),f=d!==null&&d.isDirectory,p=r||c===`follow_cl`?`follow`:c,m=r||c===`follow_cl`?i===null?`preserve`:i:c;for(let t of u){let n=this.fs.isSymlink?this.fs.isSymlink(t):!1,r=this.fs.stat(t);if(r===null){this.stdErr=`cp: cannot stat '${t}': No such file or directory`,this.exitCode=1;continue}if(!(n&&p===`preserve`)&&r.isDirectory&&!e){this.stdErr=`cp: omitting directory '${t}'`,this.exitCode=1;continue}let i=f?l.replace(/\/$/,``)+`/`+t.split(`/`).pop():l,a=this._copy(t,i,p,n,m);a&&(this.stdErr=a,this.exitCode=1)}return Promise.resolve()}_copy(e,t,n,i,a){if(i&&n===`preserve`&&this.fs.readSymlink){let n=this.fs.readSymlink(e);if(n===null)return`cp: cannot read symlink '${e}'`;try{this.fs.createSymlink(n,t)}catch(e){return`cp: cannot create symlink '${t}': ${e.message}`}return null}let o=this.fs.getFileByPath(e);if(o==null)return`cp: cannot stat '${e}': ${this.fs.exists(e)?`Permission denied`:`No such file or directory`}`;if(o.constructor===Object){try{this.fs.setFileByPath(t,{},!0)}catch(e){return`cp: cannot create directory '${t}': ${e.message}`}let n=this.fs.absolutePath(e),i;try{i=r.readdirSync(n)}catch{i=Object.keys(o)}for(let n of i){let r=e.replace(/\/$/,``)+`/`+n,i=t.replace(/\/$/,``)+`/`+n,o=this.fs.isSymlink?this.fs.isSymlink(r):!1,s=this._copy(r,i,a,o,a);s&&(this.stdErr=s,this.exitCode=1)}}else try{this.fs.setFileByPath(t,o,!0)}catch(e){return`cp: cannot create '${t}': ${e.message}`}return null}}})),Te=t(((e,t)=>{var n=X(),r=(()=>{try{return J()}catch{return null}})();t.exports=class extends n{static get name(){return`ln`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=[],i=[...this.arguments],a=0;for(;a<i.length;){let r=i[a];if(r===`--`){a++;break}if(r.startsWith(`-`)&&r.length>1)for(let n of r.slice(1))switch(n){case`s`:e=!0;break;case`f`:t=!0;break;case`n`:break;case`v`:break}else n.push(r);a++}for(;a<i.length;)n.push(i[a++]);if(n.length<2)return this.stdErr=n.length===0?`ln: missing file operand`:`ln: missing destination file operand after '${n[0]}'`,this.exitCode=1,Promise.resolve();let o=n[n.length-1],s=n.slice(0,-1),c=this.fs.stat(o),l=c!==null&&c.isDirectory;for(let n of s){let i=l?o.replace(/\/$/,``)+`/`+n.split(`/`).pop():o;if(t&&this.fs.exists(i)&&!this.fs.stat(i)?.isDirectory)try{this.fs.deleteFileByPath(i)}catch{}if(e){if(!this.fs.createSymlink){this.stdErr=`ln: cannot create symlink '${i}': Operation not supported`,this.exitCode=1;continue}try{this.fs.createSymlink(n,i)}catch(e){this.stdErr=`ln: cannot create symlink '${i}': ${e.message}`,this.exitCode=1}}else{if(!this.fs.isRealFilesystem||!r){this.stdErr=`ln: cannot create hard link '${i}': Operation not supported`,this.exitCode=1;continue}if(!this.fs.exists(n)){this.stdErr=`ln: failed to create hard link '${i}' => '${n}': No such file or directory`,this.exitCode=1;continue}try{r.linkSync(this.fs.absolutePath(n),this.fs.absolutePath(i))}catch(e){this.stdErr=`ln: failed to create hard link '${i}' => '${n}': ${e.message}`,this.exitCode=1}}}return Promise.resolve()}}})),Ee=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`mkdir`}get requiresFilesystem(){return!0}run(){let e=!1,t=[];for(let n of this.arguments)n===`-p`||n===`--parents`?e=!0:t.push(n);if(t.length===0)return this.stdErr=`mkdir: missing operand`,this.exitCode=1,Promise.resolve();for(let n of t){if(this.fs.exists(n)){e||(this.stdErr=`mkdir: cannot create directory '${n}': File exists`,this.exitCode=1);continue}try{this.fs.setFileByPath(n,{},e)}catch(e){this.stdErr=`mkdir: cannot create directory '${n}': ${e.message}`,this.exitCode=1}}return Promise.resolve()}}})),De=t(((e,t)=>{var n=X(),r=J();t.exports=class extends n{static get name(){return`mv`}get requiresFilesystem(){return!0}run(){let e=null,t=[],n=[...this.arguments],i=0;for(;i<n.length;){let r=n[i];if(r===`--`){i++;break}if(r.startsWith(`-`)&&r.length>1)for(let t=1;t<r.length;t++)switch(r[t]){case`f`:case`i`:case`n`:break;case`t`:{let a=r.slice(t+1);e=a.length>0?a:n[++i],t=r.length;break}}else t.push(r);i++}for(;i<n.length;)t.push(n[i++]);let a=e===null?t[t.length-1]:e,o=e===null?t.slice(0,-1):t;if(!a||o.length===0)return this.stdErr=`mv: missing destination file operand${o.length?` after '${o[0]}'`:``}`,this.exitCode=1,Promise.resolve();let s=this.fs.stat(a),c=s!==null&&s.isDirectory;for(let e of o){let t=c?a.replace(/\/$/,``)+`/`+e.split(`/`).pop():a;if(this.fs.isRealFilesystem){let n=this.fs.absolutePath(e),i=this.fs.absolutePath(t);try{r.lstatSync(n)}catch{this.stdErr=`mv: cannot stat '${e}': No such file or directory`,this.exitCode=1;continue}try{let e=te();r.mkdirSync(e.dirname(i),{recursive:!0}),r.renameSync(n,i)}catch(n){this.stdErr=`mv: cannot move '${e}' to '${t}': ${n.message}`,this.exitCode=1}}else{let n=this.fs.getFileByPath(e);if(n==null){let t=this.fs.exists(e)?`Permission denied`:`No such file or directory`;this.stdErr=`mv: cannot stat '${e}': ${t}`,this.exitCode=1;continue}try{this.fs.setFileByPath(t,this._deepCopy(n),!0),this.fs.deleteFileByPath(e)}catch(n){this.stdErr=`mv: cannot move '${e}' to '${t}': ${n.message}`,this.exitCode=1}}}return Promise.resolve()}_deepCopy(e){if(e==null||typeof e==`function`||typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e))t[n]=this._deepCopy(r);return t}}})),Oe=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`pwd`}run(){let e=this.context.fs.cwd;return this.stdOut=e.endsWith(`/`)&&e!==`/`?e.slice(0,-1):e,Promise.resolve()}}})),ke=t(((e,t)=>{var n=X(),r=J();t.exports=class extends n{static get name(){return`rm`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=[];for(let r of this.arguments)/^-[rRf]+$/.test(r)?((r.includes(`r`)||r.includes(`R`))&&(e=!0),r.includes(`f`)&&(t=!0)):n.push(r);if(n.length===0)return t||(this.stdErr=`rm: missing operand`,this.exitCode=1),Promise.resolve();for(let r of n)try{this._remove(r,e,t)}catch(e){this.stdErr=e.message,this.exitCode=1}return Promise.resolve()}_remove(e,t,n){if(!(this.fs.isSymlink&&this.fs.isSymlink(e))){let i=this.fs.getFileByPath(e);if(i==null){if(!n)throw Error(`rm: cannot remove '${e}': No such file or directory`);return}if(i.constructor===Object){if(!t)throw Error(`rm: cannot remove '${e}': Is a directory`);let a;if(this.fs.isRealFilesystem)try{a=r.readdirSync(this.fs.absolutePath(e))}catch{a=[]}else a=Object.keys(i);for(let r of a){let i=e.replace(/\/$/,``)+`/`+r;this._remove(i,t,n)}}}this.fs.deleteFileByPath(e)}}})),Ae=t(((e,t)=>{var n=X(),r=(()=>{try{return J()}catch{return null}})();t.exports=class extends n{static get name(){return`stat`}get requiresFilesystem(){return!0}run(){let e=[];for(let t of this.arguments){if(t===`--`)break;t.startsWith(`-`)||e.push(t)}if(e.length===0)return this.stdErr=`stat: missing operand`,this.exitCode=1,Promise.resolve();for(let t of e){let e=this.fs.isSymlink?this.fs.isSymlink(t):!1;if(!this.fs.exists(t)&&!e){this.stdErr=`stat: cannot stat '${t}': No such file or directory`,this.exitCode=1;continue}this.stdOut=this._format(t,e)}return Promise.resolve()}_format(e,t){let n=this.fs.absolutePath(e);if(this.fs.isRealFilesystem&&r)try{let e=r.lstatSync(n),t=e.isSymbolicLink()?`l`:e.isDirectory()?`d`:`-`,i=e.isSymbolicLink()?`symbolic link`:e.isDirectory()?`directory`:`regular file`,a=(e.mode&511).toString(8).padStart(4,`0`),o=t+this._rwxBits(e.mode&511);return[` File: ${n}${e.isSymbolicLink()?` -> ${r.readlinkSync(n)}`:``}`,` Size: ${e.size}\t\tBlocks: ${e.blocks}\t\tIO Block: ${e.blksize}\t${i}`,`Device: ${e.dev}\t\tInode: ${e.ino}\t\tLinks: ${e.nlink}`,`Access: (${a}/${o})\tUid: ${e.uid}\tGid: ${e.gid}`,`Access: ${e.atime.toISOString()}`,`Modify: ${e.mtime.toISOString()}`,`Change: ${e.ctime.toISOString()}`].join(`
|
|
19
19
|
`)}catch(t){return`stat: cannot stat '${e}': ${t.message}`}let i=this.fs.stat(e),a=this.fs.getMode(e)??420,o=this.fs.getSize(e),s=t?`l`:i?.isDirectory?`d`:`-`,c=t?`symbolic link`:i?.isDirectory?`directory`:(i?.isCommand,`regular file`),l=a.toString(8).padStart(4,`0`),u=s+this._rwxBits(a);return[` File: ${n}${t&&this.fs.readSymlink?` -> ${this.fs.readSymlink(e)}`:``}`,` Size: ${o}\t\tType: ${c}`,`Access: (${l}/${u})`].join(`
|
|
20
|
-
`)}_rwxBits(e){return[e&256?`r`:`-`,e&128?`w`:`-`,e&64?`x`:`-`,e&32?`r`:`-`,e&16?`w`:`-`,e&8?`x`:`-`,e&4?`r`:`-`,e&2?`w`:`-`,e&1?`x`:`-`].join(``)}}})),Me=t(((e,t)=>{var n=Y(),r=(()=>{try{return q()}catch{return null}})();t.exports=class extends n{static get name(){return`touch`}get requiresFilesystem(){return!0}run(){let e=!1,t=[];for(let n of this.arguments){if(n===`--`)break;if(n.startsWith(`-`)&&n.length>1)for(let t of n.slice(1))t===`c`&&(e=!0);else t.push(n)}if(t.length===0)return this.stdErr=`touch: missing file operand`,this.exitCode=1,Promise.resolve();let n=new Date;for(let i of t)if(this.fs.exists(i)){if(r&&this.fs.isRealFilesystem)try{r.utimesSync(this.fs.absolutePath(i),n,n)}catch(e){this.stdErr=`touch: cannot touch '${i}': ${e.message}`,this.exitCode=1}}else{if(e)continue;try{this.fs.setFileByPath(i,``,!0)}catch(e){this.stdErr=`touch: cannot touch '${i}': ${e.message}`,this.exitCode=1}}return Promise.resolve()}}})),Ne=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`which`}run(){if(this.arguments.length!==1)return Promise.reject(`which requires a single argument`);let e=this.context.fs.getFileByPath(`${this.context.getVar(`PATH`)}/${this.arguments[0]}`);return!e||e.constructor===Object||e.constructor===String?Promise.reject():Promise.resolve(`${this.context.getVar(`PATH`)}/${this.arguments[0]}`)}}})),Pe=t(((e,t)=>{var n=ie(),r=Y();t.exports=class extends r{static get name(){return`source`}constructor(e,t){if(super(e,t),this.arguments.length!==1)return Promise.reject(`source requires a single argument`);let r=this.arguments[0];if(r.startsWith(`./`)||r.startsWith(`/`)){let i=this.context.fs.getFileByPath(r);if(i&&i.constructor===String&&i.startsWith(`#!`))return new n(i,e,t,!0)}}run(){let e=this.arguments[0];if(e.startsWith(`./`)||e.startsWith(`/`)){let t=this.context.fs.getFileByPath(e);if(!t){let t=this.context.fs.exists(e)?`Permission denied`:`No such file or directory`;return Promise.reject(`${e}: ${t}`)}if(t.constructor===Object)return Promise.reject(`${e}: is a directory`);if(t.prototype&&typeof t.prototype.run==`function`&&typeof t.prototype.runCommand==`function`)return Promise.reject(`${e}: command not found`);if(t.constructor===String&&t.startsWith(`#!`))return Promise.reject(`FATAL: should not get here`)}return Promise.reject(`${e}: permission denied`)}}})),Fe=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`clear`}run(){return this.arguments.length>0?Promise.reject(`clear does not require arguments`):(this.stdout&&this.stdout.write(`\x1B[2J\x1B[3J\x1B[H`),this.context.clear(),Promise.resolve())}}})),Ie=t(((e,t)=>{var n=Y();t.exports=class extends n{static get name(){return`exit`}run(){let e=parseInt(this.arguments[0])||0;return this.exitCode=e,this.context.destroy(e),Promise.resolve()}}})),Le=t(((e,t)=>{var n=Y(),r=me();t.exports=class extends n{static get name(){return`read`}get requiresFilesystem(){return!1}get captureInput(){return!0}run(){let e;try{e=this.parseArgs()}catch(e){return this.printHelp(e),Promise.reject()}return e.help?(this.printHelp(),Promise.resolve()):(this.nchars=e.nchars,this.var=e.name,new Promise(t=>{let n=setTimeout(()=>{t(),this.exitCode=1},e.timeout?e.timeout*1e3:864e5);this.completionCallback=e=>{clearTimeout(n),t(e)},this.stdErr=e.prompt||``,this.flush()}))}onInput(e){if(this.inputBuffer||=``,e.length===1&&(this.inputBuffer+=e),e===`Enter`){this.var?(this.context.setVar(this.var,this.inputBuffer||``),this.completionCallback()):this.completionCallback(this.inputBuffer||``);return}if(this.inputBuffer.length===this.nchars){if(this.var){this.context.setVar(this.var,this.inputBuffer),this.completionCallback();return}this.completionCallback(this.inputBuffer)}}printHelp(e){e&&(this.stdOut=e.message),this.stdOut=`usage: read [-n nchars] [-p prompt] [-t timeout] [name ...]`}parseArgs(){return r([{name:`prompt`,alias:`p`,type:String},{name:`nchars`,alias:`n`,type:Number},{name:`timeout`,alias:`t`,type:Number},{name:`help`,alias:`h`,type:Boolean},{defaultOption:!0,name:`name`,type:String}],{argv:this.arguments})}}})),Re=t(((e,t)=>{var n=Y(),r=W();t.exports=class extends n{static get name(){return`jsfunction`}run(){let[e,...t]=this.arguments;if(!e||t.length===0)return this.stdErr=`usage: jsfunction <name> <function-body>`,this.exitCode=1,Promise.resolve();let n=t.join(` `),i;try{if(i=Function(`return (`+n+`)`)(),typeof i!=`function`)throw Error(`expression is not a function`)}catch(e){return this.stdErr=`jsfunction: ${e.message}`,this.exitCode=1,Promise.resolve()}class a extends r{run(){let e;try{e=i(this.arguments)}catch(e){return this.stdErr=e.message||String(e),this.exitCode=1,Promise.resolve()}return e&&typeof e.then==`function`?e.then(e=>{e!=null&&(this.stdOut=String(e))}).catch(e=>{this.stdErr=e.message||String(e),this.exitCode=1}):(e!=null&&(this.stdOut=String(e)),Promise.resolve())}}return Object.defineProperty(a,"name",{value:e,configurable:!0}),this.context.setCommand(a),Promise.resolve()}}})),ze=t(((e,t)=>{var n=Y();function r(e){return e>=1048576?(e/1048576).toFixed(1)+` MB`:e>=1024?(e/1024).toFixed(1)+` KB`:e+` B`}t.exports=class extends n{static get name(){return`curl`}get requiresFilesystem(){return!0}run(){let e=[...this.arguments],t=null,n={},i=null,a=!1,o=!1,s=null,c=null,l=0;for(;l<e.length;){let r=e[l];switch(r){case`-X`:case`--request`:t=e[++l];break;case`-H`:case`--header`:{let t=e[++l]||``,r=t.indexOf(`:`);r>0&&(n[t.slice(0,r).trim()]=t.slice(r+1).trim());break}case`-d`:case`--data`:case`--data-raw`:i=e[++l],t||=`POST`;break;case`-u`:case`--user`:{let t=e[++l]||``;n.Authorization=`Basic `+btoa(t);break}case`-o`:case`--output`:s=e[++l];break;case`-i`:case`--include`:a=!0;break;case`-s`:case`--silent`:o=!0;break;case`-#`:case`--progress-bar`:break;case`-L`:case`--location`:break;default:r.startsWith(`-`)?o||(this.stdErr=`curl: unknown option '${r}'`):c=r}l++}if(!c)return this.stdErr=`curl: no URL specified`,this.exitCode=1,Promise.resolve();if(!/^https?:\/\//i.test(c))return this.stdErr=`curl: unsupported protocol in URL: ${c}`,this.exitCode=1,Promise.resolve();let u={method:t||`GET`,headers:n};return i!==null&&(u.body=i),fetch(c,u).then(async e=>{a&&(this.stdOut=`HTTP/1.1 ${e.status} ${e.statusText}`,e.headers.forEach((e,t)=>{this.stdOut=`${t}: ${e}`}),this.stdOut=``);let t=null,n=Number(e.headers.get(`content-length`)||0);if(e.body&&typeof e.body.getReader==`function`){let i=e.body.getReader(),a=[],c=0;for(;;){let{done:e,value:t}=await i.read();if(e)break;if(a.push(t),c+=t.length,s&&!o){if(n>0){let e=Math.min(100,Math.floor(c/n*100)),t=Math.min(20,Math.round(c/n*20)),i=`=`.repeat(Math.max(0,t-1))+(t>0?`>`:``)+` `.repeat(Math.max(0,20-t));this.stdOut=`\r[${i}] ${e}% (${r(c)} / ${r(n)})`}else this.stdOut=`\rDownloading: ${r(c)}`;this.flush()}}t=new Uint8Array(c);let l=0;for(let e of a)t.set(e,l),l+=e.length;if(s&&!o&&c>0){let e=n||c;this.stdOut=`\r[${`=`.repeat(20)}] 100% (${r(c)} / ${r(e)})`,this.flush()}}else{let n=await e.arrayBuffer();t=new Uint8Array(n)}if(s)try{let n=e.headers.get(`content-type`)||``;if(/^text\/|application\/(json|javascript|xml|x-sh)/i.test(n)){let e=new TextDecoder().decode(t);this.fs.setFileByPath(s,e,!0)}else{let{BinaryFile:e}=te(),r=e?new e(t.buffer,n||`application/octet-stream`):t;this.fs.setFileByPath(s,r,!0)}}catch(e){this.stdErr=`curl: cannot write to '${s}': ${e.message}`,this.exitCode=1}else new TextDecoder().decode(t).split(/\r?\n/).forEach(e=>{this.stdOut=e});e.ok||(this.exitCode=22)}).catch(e=>{if(!o){let t=e&&e.message?e.message:String(e);if(e instanceof TypeError&&/failed to fetch|networkerror|load failed|fetch is aborted/i.test(t)){let e=/^https:\/\//i.test(c),t=typeof location<`u`&&location.protocol===`https:`;!e&&t?this.stdErr=`curl: (35) Mixed content blocked — the page is served over HTTPS but the target URL is HTTP. Browsers block insecure requests from secure pages.`:(this.stdErr=`curl: (6) Network request failed — this is likely a CORS error. The server at ${c} did not include the required 'Access-Control-Allow-Origin' response header. You can only fetch cross-origin resources that explicitly allow it.`,this.stdErr=` Hint: try a public CORS proxy, or ensure the server sends 'Access-Control-Allow-Origin: *'.`)}else this.stdErr=`curl: (6) Could not connect: ${t}`}this.exitCode=6})}}})),Be=t(((e,t)=>{var n=Y(),r={errexit:`e`,xtrace:`x`,nounset:`u`,noexec:`n`,allexport:`a`};t.exports=class extends n{static get name(){return`set`}run(){let e=this.arguments;if(e.length===0){let e=this.context.vars;return Object.keys(e).sort().forEach(t=>{this.stdOut=`${t}=${e[t]}`}),Promise.resolve()}let t=0;for(;t<e.length;){let n=e[t];if(n===`--`){let n=e.slice(t+1),r=1;for(;this.context.getVar(String(r));)this.context.unsetVar(String(r)),r++;return n.forEach((e,t)=>this.context.setVar(String(t+1),e)),this.context.setVar(`#`,String(n.length)),Promise.resolve()}if((n.startsWith(`-`)||n.startsWith(`+`))&&n.length>1&&n[1]!==`-`){let i=n[0]===`-`,a=n.slice(1);if(a===`o`){t++;let n=e[t];if(n===void 0){Object.entries(r).forEach(([e,t])=>{let n=this.context.getVar(`-`)||``;this.stdOut=`${e.padEnd(15)} ${n.includes(t)?`on`:`off`}`}),t++;continue}let a=r[n];a?this._setFlag(a,i):this.stdErr=`set: ${n}: invalid option name`,t++;continue}for(let e of a)this._setFlag(e,i);t++;continue}t++}return Promise.resolve()}_setFlag(e,t){let n=this.context.getVar(`-`)||``;t?n.includes(e)||this.context.setVar(`-`,n+e):this.context.setVar(`-`,n.split(``).filter(t=>t!==e).join(``))}}})),Ve=t(((e,t)=>{var n=Pe();t.exports=class extends n{static get name(){return`.`}}})),He=t(((e,t)=>{t.exports=[xe(),Se(),Ce(),we(),Te(),Ee(),De(),Oe(),ke(),Ae(),je(),Me(),Ne(),Pe(),Fe(),Ie(),Le(),Re(),ze(),Be(),Ve()]})),Ue=t(((e,t)=>{t.exports=Object})),We=t(((e,t)=>{t.exports=Error})),Ge=t(((e,t)=>{t.exports=EvalError})),Ke=t(((e,t)=>{t.exports=RangeError})),qe=t(((e,t)=>{t.exports=ReferenceError})),Je=t(((e,t)=>{t.exports=SyntaxError})),Z=t(((e,t)=>{t.exports=TypeError})),Ye=t(((e,t)=>{t.exports=URIError})),Xe=t(((e,t)=>{t.exports=Math.abs})),Ze=t(((e,t)=>{t.exports=Math.floor})),Qe=t(((e,t)=>{t.exports=Math.max})),$e=t(((e,t)=>{t.exports=Math.min})),et=t(((e,t)=>{t.exports=Math.pow})),tt=t(((e,t)=>{t.exports=Math.round})),nt=t(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),rt=t(((e,t)=>{var n=nt();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),it=t(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),at=t(((e,t)=>{var n=it();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),ot=t(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),st=t(((e,t)=>{t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}})),ct=t(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=st();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),lt=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),ut=t(((e,t)=>{t.exports=Ue().getPrototypeOf||null})),dt=t(((e,t)=>{var n=`Function.prototype.bind called on incompatible `,r=Object.prototype.toString,i=Math.max,a=`[object Function]`,o=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},s=function(e,t){for(var n=[],r=t||0,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},c=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||r.apply(t)!==a)throw TypeError(n+t);for(var l=s(arguments,1),u,d=function(){if(this instanceof u){var n=t.apply(this,o(l,arguments));return Object(n)===n?n:this}return t.apply(e,o(l,arguments))},f=i(0,t.length-l.length),p=[],m=0;m<f;m++)p[m]=`$`+m;if(u=Function(`binder`,`return function (`+c(p,`,`)+`){ return binder.apply(this,arguments); }`)(d),t.prototype){var h=function(){};h.prototype=t.prototype,u.prototype=new h,h.prototype=null}return u}})),ft=t(((e,t)=>{var n=dt();t.exports=Function.prototype.bind||n})),pt=t(((e,t)=>{t.exports=Function.prototype.call})),mt=t(((e,t)=>{t.exports=Function.prototype.apply})),ht=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),gt=t(((e,t)=>{var n=ft(),r=mt(),i=pt();t.exports=ht()||n.call(i,r)})),_t=t(((e,t)=>{var n=ft(),r=Z(),i=pt(),a=gt();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),vt=t(((e,t)=>{var n=_t(),r=at(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`?function(e){return s(e==null?e:o(e))}:!1})),yt=t(((e,t)=>{var n=lt(),r=ut(),i=vt();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null})),bt=t(((e,t)=>{var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=ft().call(n,r)})),Q=t(((e,t)=>{var n,r=Ue(),i=We(),a=Ge(),o=Ke(),s=qe(),c=Je(),l=Z(),u=Ye(),d=Xe(),f=Ze(),p=Qe(),m=$e(),h=et(),g=tt(),_=rt(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=at(),x=ot(),S=function(){throw new l},C=b?function(){try{return arguments.callee,S}catch{try{return b(arguments,`callee`).get}catch{return S}}}():S,w=ct()(),T=yt(),E=ut(),D=lt(),O=mt(),k=pt(),A={},j=typeof Uint8Array>`u`||!T?n:T(Uint8Array),M={__proto__:null,"%AggregateError%":typeof AggregateError>`u`?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>`u`?n:ArrayBuffer,"%ArrayIteratorPrototype%":w&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>`u`?n:Atomics,"%BigInt%":typeof BigInt>`u`?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>`u`?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>`u`?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>`u`?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>`u`?n:Float16Array,"%Float32Array%":typeof Float32Array>`u`?n:Float32Array,"%Float64Array%":typeof Float64Array>`u`?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>`u`?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>`u`?n:Int8Array,"%Int16Array%":typeof Int16Array>`u`?n:Int16Array,"%Int32Array%":typeof Int32Array>`u`?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON==`object`?JSON:n,"%Map%":typeof Map>`u`?n:Map,"%MapIteratorPrototype%":typeof Map>`u`||!w||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>`u`?n:Promise,"%Proxy%":typeof Proxy>`u`?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":typeof Reflect>`u`?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>`u`?n:Set,"%SetIteratorPrototype%":typeof Set>`u`||!w||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>`u`?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&T?T(``[Symbol.iterator]()):n,"%Symbol%":w?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":C,"%TypedArray%":j,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>`u`?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>`u`?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>`u`?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>`u`?n:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>`u`?n:WeakMap,"%WeakRef%":typeof WeakRef>`u`?n:WeakRef,"%WeakSet%":typeof WeakSet>`u`?n:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":O,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":E,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":D};if(T)try{null.error}catch(e){M[`%Error.prototype%`]=T(T(e))}var N=function e(t){var n;if(t===`%AsyncFunction%`)n=y(`async function () {}`);else if(t===`%GeneratorFunction%`)n=y(`function* () {}`);else if(t===`%AsyncGeneratorFunction%`)n=y(`async function* () {}`);else if(t===`%AsyncGenerator%`){var r=e(`%AsyncGeneratorFunction%`);r&&(n=r.prototype)}else if(t===`%AsyncIteratorPrototype%`){var i=e(`%AsyncGenerator%`);i&&T&&(n=T(i.prototype))}return M[t]=n,n},P={__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`]},F=ft(),I=bt(),ee=F.call(k,Array.prototype.concat),L=F.call(O,Array.prototype.splice),R=F.call(k,String.prototype.replace),z=F.call(k,String.prototype.slice),B=F.call(k,RegExp.prototype.exec),V=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,H=/\\(\\)?/g,U=function(e){var t=z(e,0,1),n=z(e,-1);if(t===`%`&&n!==`%`)throw new c("invalid intrinsic syntax, expected closing `%`");if(n===`%`&&t!==`%`)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return R(e,V,function(e,t,n,i){r[r.length]=n?R(i,H,`$1`):t||e}),r},W=function(e,t){var n=e,r;if(I(P,n)&&(r=P[n],n=`%`+r[0]+`%`),I(M,n)){var i=M[n];if(i===A&&(i=N(n)),i===void 0&&!t)throw new l(`intrinsic `+e+` exists, but is not available. Please file an issue!`);return{alias:r,name:n,value:i}}throw new c(`intrinsic `+e+` does not exist!`)};t.exports=function(e,t){if(typeof e!=`string`||e.length===0)throw new l(`intrinsic name must be a non-empty string`);if(arguments.length>1&&typeof t!=`boolean`)throw new l(`"allowMissing" argument must be a boolean`);if(B(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=U(e),r=n.length>0?n[0]:``,i=W(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],L(n,ee([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=z(p,0,1),h=z(p,-1);if((m===`"`||m===`'`||m==="`"||h===`"`||h===`'`||h==="`")&&m!==h)throw new c(`property names with quotes must have matching quotes`);if((p===`constructor`||!f)&&(s=!0),r+=`.`+p,a=`%`+r+`%`,I(M,a))o=M[a];else if(o!=null){if(!(p in o)){if(!t)throw new l(`base intrinsic for `+e+` exists, but the property is not available.`);return}if(b&&d+1>=n.length){var g=b(o,p);f=!!g,o=f&&`get`in g&&!(`originalValue`in g.get)?g.get:o[p]}else f=I(o,p),o=o[p];f&&!s&&(M[a]=o)}}return o}})),xt=t(((e,t)=>{var n=ot(),r=Je(),i=Z(),a=at();t.exports=function(e,t,o){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`obj` must be an object or a function`");if(typeof t!=`string`&&typeof t!=`symbol`)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=`boolean`&&arguments[3]!==null)throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=`boolean`&&arguments[4]!==null)throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=`boolean`&&arguments[5]!==null)throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=`boolean`)throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,d=!!a&&a(e,t);if(n)n(e,t,{configurable:l===null&&d?d.configurable:!l,enumerable:s===null&&d?d.enumerable:!s,value:o,writable:c===null&&d?d.writable:!c});else if(u||!s&&!c&&!l)e[t]=o;else throw new r(`This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.`)}})),St=t(((e,t)=>{var n=ot(),r=function(){return!!n};r.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],`length`,{value:1}).length!==1}catch{return!0}},t.exports=r})),Ct=t(((e,t)=>{var n=Q(),r=xt(),i=St()(),a=at(),o=Z(),s=n(`%Math.floor%`);t.exports=function(e,t){if(typeof e!=`function`)throw new o("`fn` is not a function");if(typeof t!=`number`||t<0||t>4294967295||s(t)!==t)throw new o("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],c=!0,l=!0;if(`length`in e&&a){var u=a(e,`length`);u&&!u.configurable&&(c=!1),u&&!u.writable&&(l=!1)}return(c||l||!n)&&(i?r(e,`length`,t,!0,!0):r(e,`length`,t)),e}})),wt=t(((e,t)=>{var n=ft(),r=mt(),i=gt();t.exports=function(){return i(n,r,arguments)}})),Tt=t(((e,t)=>{var n=Ct(),r=ot(),i=_t(),a=wt();t.exports=function(e){var t=i(arguments),r=1+e.length-(arguments.length-1);return n(t,r>0?r:0,!0)},r?r(t.exports,`apply`,{value:a}):t.exports.apply=a})),Et=t(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){var t=n.call(e),r=t===`[object Arguments]`;return r||=t!==`[object Array]`&&typeof e==`object`&&!!e&&typeof e.length==`number`&&e.length>=0&&n.call(e.callee)===`[object Function]`,r}})),Dt=t(((e,t)=>{var n;if(!Object.keys){var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Et(),o=Object.prototype.propertyIsEnumerable,s=!o.call({toString:null},`toString`),c=o.call(function(){},`prototype`),l=[`toString`,`toLocaleString`,`valueOf`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`constructor`],u=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>`u`)return!1;for(var e in window)try{if(!d[`$`+e]&&r.call(window,e)&&window[e]!==null&&typeof window[e]==`object`)try{u(window[e])}catch{return!0}}catch{return!0}return!1}(),p=function(e){if(typeof window>`u`||!f)return u(e);try{return u(e)}catch{return!1}};n=function(e){var t=typeof e==`object`&&!!e,n=i.call(e)===`[object Function]`,o=a(e),u=t&&i.call(e)===`[object String]`,d=[];if(!t&&!n&&!o)throw TypeError(`Object.keys called on a non-object`);var f=c&&n;if(u&&e.length>0&&!r.call(e,0))for(var m=0;m<e.length;++m)d.push(String(m));if(o&&e.length>0)for(var h=0;h<e.length;++h)d.push(String(h));else for(var g in e)!(f&&g===`prototype`)&&r.call(e,g)&&d.push(String(g));if(s)for(var _=p(e),v=0;v<l.length;++v)!(_&&l[v]===`constructor`)&&r.call(e,l[v])&&d.push(l[v]);return d}}t.exports=n})),Ot=t(((e,t)=>{var n=Array.prototype.slice,r=Et(),i=Object.keys,a=i?function(e){return i(e)}:Dt(),o=Object.keys;a.shim=function(){return Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return r(e)?o(n.call(e)):o(e)}):Object.keys=a,Object.keys||a},t.exports=a})),kt=t(((e,t)=>{var n=Ot(),r=typeof Symbol==`function`&&typeof Symbol(`foo`)==`symbol`,i=Object.prototype.toString,a=Array.prototype.concat,o=xt(),s=function(e){return typeof e==`function`&&i.call(e)===`[object Function]`},c=St()(),l=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!s(r)||!r())return}c?o(e,t,n,!0):o(e,t,n)},u=function(e,t){var i=arguments.length>2?arguments[2]:{},o=n(t);r&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)l(e,o[s],t[o[s]],i[o[s]])};u.supportsDescriptors=!!c,t.exports=u})),$=t(((e,t)=>{var n=Q(),r=_t(),i=r([n(`%String.prototype.indexOf%`)]);t.exports=function(e,t){var a=n(e,!!t);return typeof a==`function`&&i(e,`.prototype.`)>-1?r([a]):a}})),At=t(((e,t)=>{var n=Q()(`%Array%`),r=!n.isArray&&$()(`Object.prototype.toString`);t.exports=n.isArray||function(e){return r(e)===`[object Array]`}})),jt=t(((e,t)=>{t.exports=At()})),Mt=t(((e,t)=>{var n=Q(),r=$(),i=Z(),a=jt(),o=n(`%Reflect.apply%`,!0)||r(`Function.prototype.apply`);t.exports=function(e,t){var n=arguments.length>2?arguments[2]:[];if(!a(n))throw new i("Assertion failed: optional `argumentsList`, if provided, must be a List");return o(e,t,n)}})),Nt=t(((e,t)=>{t.exports={}})),Pt=t(((e,t)=>{fe();var n=typeof Map==`function`&&Map.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,`size`):null,i=n&&r&&typeof r.get==`function`?r.get:null,a=n&&Map.prototype.forEach,o=typeof Set==`function`&&Set.prototype,s=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,`size`):null,c=o&&s&&typeof s.get==`function`?s.get:null,l=o&&Set.prototype.forEach,u=typeof WeakMap==`function`&&WeakMap.prototype?WeakMap.prototype.has:null,d=typeof WeakSet==`function`&&WeakSet.prototype?WeakSet.prototype.has:null,f=typeof WeakRef==`function`&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,h=Function.prototype.toString,g=String.prototype.match,_=String.prototype.slice,v=String.prototype.replace,y=String.prototype.toUpperCase,b=String.prototype.toLowerCase,x=RegExp.prototype.test,S=Array.prototype.concat,C=Array.prototype.join,w=Array.prototype.slice,T=Math.floor,E=typeof BigInt==`function`?BigInt.prototype.valueOf:null,D=Object.getOwnPropertySymbols,O=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?Symbol.prototype.toString:null,k=typeof Symbol==`function`&&typeof Symbol.iterator==`object`,A=typeof Symbol==`function`&&Symbol.toStringTag?Symbol.toStringTag:null,j=Object.prototype.propertyIsEnumerable,M=(typeof Reflect==`function`?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function N(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||x.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e==`number`){var r=e<0?-T(-e):T(e);if(r!==e){var i=String(r),a=_.call(t,i.length+1);return v.call(i,n,`$&_`)+`.`+v.call(v.call(a,/([0-9]{3})/g,`$&_`),/_$/,``)}}return v.call(t,n,`$&_`)}var P=Nt(),F=P.custom,I=q(F)?F:null,ee={__proto__:null,double:`"`,single:`'`},L={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};t.exports=function e(t,n,r,o){var s=n||{};if(J(s,`quoteStyle`)&&!J(ee,s.quoteStyle))throw TypeError(`option "quoteStyle" must be "single" or "double"`);if(J(s,`maxStringLength`)&&(typeof s.maxStringLength==`number`?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=J(s,`customInspect`)?s.customInspect:!0;if(typeof u!=`boolean`&&u!==`symbol`)throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(J(s,`indent`)&&s.indent!==null&&s.indent!==` `&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(J(s,`numericSeparator`)&&typeof s.numericSeparator!=`boolean`)throw TypeError('option "numericSeparator", if provided, must be `true` or `false`');var d=s.numericSeparator;if(t===void 0)return`undefined`;if(t===null)return`null`;if(typeof t==`boolean`)return t?`true`:`false`;if(typeof t==`string`)return me(t,s);if(typeof t==`number`){if(t===0)return 1/0/t>0?`0`:`-0`;var f=String(t);return d?N(t,f):f}if(typeof t==`bigint`){var m=String(t)+`n`;return d?N(t,m):m}var h=s.depth===void 0?5:s.depth;if(r===void 0&&(r=0),r>=h&&h>0&&typeof t==`object`)return V(t)?`[Array]`:`[Object]`;var g=ye(s,r);if(o===void 0)o=[];else if(ae(o,t)>=0)return`[Circular]`;function y(t,n,i){if(n&&(o=w.call(o),o.push(n)),i){var a={depth:s.depth};return J(s,`quoteStyle`)&&(a.quoteStyle=s.quoteStyle),e(t,a,r+1,o)}return e(t,s,r+1,o)}if(typeof t==`function`&&!U(t)){var x=ie(t),T=xe(t,y);return`[Function`+(x?`: `+x:` (anonymous)`)+`]`+(T.length>0?` { `+C.call(T,`, `)+` }`:``)}if(q(t)){var D=k?v.call(String(t),/^(Symbol\(.*\))_[^)]*$/,`$1`):O.call(t);return typeof t==`object`&&!k?X(D):D}if(pe(t)){for(var F=`<`+b.call(String(t.nodeName)),L=t.attributes||[],B=0;B<L.length;B++)F+=` `+L[B].name+`=`+R(z(L[B].value),`double`,s);return F+=`>`,t.childNodes&&t.childNodes.length&&(F+=`...`),F+=`</`+b.call(String(t.nodeName))+`>`,F}if(V(t)){if(t.length===0)return`[]`;var re=xe(t,y);return g&&!ve(re)?`[`+be(re,g)+`]`:`[ `+C.call(re,`, `)+` ]`}if(W(t)){var fe=xe(t,y);return!(`cause`in Error.prototype)&&`cause`in t&&!j.call(t,`cause`)?`{ [`+String(t)+`] `+C.call(S.call(`[cause]: `+y(t.cause),fe),`, `)+` }`:fe.length===0?`[`+String(t)+`]`:`{ [`+String(t)+`] `+C.call(fe,`, `)+` }`}if(typeof t==`object`&&u){if(I&&typeof t[I]==`function`&&P)return P(t,{depth:h-r});if(u!==`symbol`&&typeof t.inspect==`function`)return t.inspect()}if(oe(t)){var he=[];return a&&a.call(t,function(e,n){he.push(y(n,t,!0)+` => `+y(e,t))}),_e(`Map`,i.call(t),he,g)}if(le(t)){var Se=[];return l&&l.call(t,function(e){Se.push(y(e,t))}),_e(`Set`,c.call(t),Se,g)}if(se(t))return ge(`WeakMap`);if(ue(t))return ge(`WeakSet`);if(ce(t))return ge(`WeakRef`);if(K(t))return X(y(Number(t)));if(ne(t))return X(y(E.call(t)));if(te(t))return X(p.call(t));if(G(t))return X(y(String(t)));if(typeof window<`u`&&t===window)return`{ [object Window] }`;if(typeof globalThis<`u`&&t===globalThis||de!==void 0&&t===de)return`{ [object globalThis] }`;if(!H(t)&&!U(t)){var Ce=xe(t,y),we=M?M(t)===Object.prototype:t instanceof Object||t.constructor===Object,Te=t instanceof Object?``:`null prototype`,Ee=!we&&A&&Object(t)===t&&A in t?_.call(Y(t),8,-1):Te?`Object`:``,De=(we||typeof t.constructor!=`function`?``:t.constructor.name?t.constructor.name+` `:``)+(Ee||Te?`[`+C.call(S.call([],Ee||[],Te||[]),`: `)+`] `:``);return Ce.length===0?De+`{}`:g?De+`{`+be(Ce,g)+`}`:De+`{ `+C.call(Ce,`, `)+` }`}return String(t)};function R(e,t,n){var r=ee[n.quoteStyle||t];return r+e+r}function z(e){return v.call(String(e),/"/g,`"`)}function B(e){return!A||!(typeof e==`object`&&(A in e||e[A]!==void 0))}function V(e){return Y(e)===`[object Array]`&&B(e)}function H(e){return Y(e)===`[object Date]`&&B(e)}function U(e){return Y(e)===`[object RegExp]`&&B(e)}function W(e){return Y(e)===`[object Error]`&&B(e)}function G(e){return Y(e)===`[object String]`&&B(e)}function K(e){return Y(e)===`[object Number]`&&B(e)}function te(e){return Y(e)===`[object Boolean]`&&B(e)}function q(e){if(k)return e&&typeof e==`object`&&e instanceof Symbol;if(typeof e==`symbol`)return!0;if(!e||typeof e!=`object`||!O)return!1;try{return O.call(e),!0}catch{}return!1}function ne(e){if(!e||typeof e!=`object`||!E)return!1;try{return E.call(e),!0}catch{}return!1}var re=Object.prototype.hasOwnProperty||function(e){return e in this};function J(e,t){return re.call(e,t)}function Y(e){return m.call(e)}function ie(e){if(e.name)return e.name;var t=g.call(h.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function ae(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function oe(e){if(!i||!e||typeof e!=`object`)return!1;try{i.call(e);try{c.call(e)}catch{return!0}return e instanceof Map}catch{}return!1}function se(e){if(!u||!e||typeof e!=`object`)return!1;try{u.call(e,u);try{d.call(e,d)}catch{return!0}return e instanceof WeakMap}catch{}return!1}function ce(e){if(!f||!e||typeof e!=`object`)return!1;try{return f.call(e),!0}catch{}return!1}function le(e){if(!c||!e||typeof e!=`object`)return!1;try{c.call(e);try{i.call(e)}catch{return!0}return e instanceof Set}catch{}return!1}function ue(e){if(!d||!e||typeof e!=`object`)return!1;try{d.call(e,d);try{u.call(e,u)}catch{return!0}return e instanceof WeakSet}catch{}return!1}function pe(e){return!e||typeof e!=`object`?!1:typeof HTMLElement<`u`&&e instanceof HTMLElement?!0:typeof e.nodeName==`string`&&typeof e.getAttribute==`function`}function me(e,t){if(e.length>t.maxStringLength){var n=e.length-t.maxStringLength,r=`... `+n+` more character`+(n>1?`s`:``);return me(_.call(e,0,t.maxStringLength),t)+r}var i=L[t.quoteStyle||`single`];return i.lastIndex=0,R(v.call(v.call(e,i,`\\$1`),/[\x00-\x1f]/g,he),`single`,t)}function he(e){var t=e.charCodeAt(0),n={8:`b`,9:`t`,10:`n`,12:`f`,13:`r`}[t];return n?`\\`+n:`\\x`+(t<16?`0`:``)+y.call(t.toString(16))}function X(e){return`Object(`+e+`)`}function ge(e){return e+` { ? }`}function _e(e,t,n,r){var i=r?be(n,r):C.call(n,`, `);return e+` (`+t+`) {`+i+`}`}function ve(e){for(var t=0;t<e.length;t++)if(ae(e[t],`
|
|
21
|
-
`)>=0)return!1;return!0}function
|
|
20
|
+
`)}_rwxBits(e){return[e&256?`r`:`-`,e&128?`w`:`-`,e&64?`x`:`-`,e&32?`r`:`-`,e&16?`w`:`-`,e&8?`x`:`-`,e&4?`r`:`-`,e&2?`w`:`-`,e&1?`x`:`-`].join(``)}}})),je=t(((e,t)=>{var n=X(),r=(()=>{try{return J()}catch{return null}})();t.exports=class extends n{static get name(){return`touch`}get requiresFilesystem(){return!0}run(){let e=!1,t=[];for(let n of this.arguments){if(n===`--`)break;if(n.startsWith(`-`)&&n.length>1)for(let t of n.slice(1))t===`c`&&(e=!0);else t.push(n)}if(t.length===0)return this.stdErr=`touch: missing file operand`,this.exitCode=1,Promise.resolve();let n=new Date;for(let i of t)if(this.fs.exists(i)){if(r&&this.fs.isRealFilesystem)try{r.utimesSync(this.fs.absolutePath(i),n,n)}catch(e){this.stdErr=`touch: cannot touch '${i}': ${e.message}`,this.exitCode=1}}else{if(e)continue;try{this.fs.setFileByPath(i,``,!0)}catch(e){this.stdErr=`touch: cannot touch '${i}': ${e.message}`,this.exitCode=1}}return Promise.resolve()}}})),Me=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`which`}run(){if(this.arguments.length!==1)return Promise.reject(`which requires a single argument`);let e=this.context.fs.getFileByPath(`${this.context.getVar(`PATH`)}/${this.arguments[0]}`);return!e||e.constructor===Object||e.constructor===String?Promise.reject():Promise.resolve(`${this.context.getVar(`PATH`)}/${this.arguments[0]}`)}}})),Ne=t(((e,t)=>{var n=re(),r=X();t.exports=class extends r{static get name(){return`source`}constructor(e,t){if(super(e,t),this.arguments.length!==1)return Promise.reject(`source requires a single argument`);let r=this.arguments[0];if(r.startsWith(`./`)||r.startsWith(`/`)){let i=this.context.fs.getFileByPath(r);if(i&&i.constructor===String&&i.startsWith(`#!`))return new n(i,e,t,!0)}}run(){let e=this.arguments[0];if(e.startsWith(`./`)||e.startsWith(`/`)){let t=this.context.fs.getFileByPath(e);if(!t){let t=this.context.fs.exists(e)?`Permission denied`:`No such file or directory`;return Promise.reject(`${e}: ${t}`)}if(t.constructor===Object)return Promise.reject(`${e}: is a directory`);if(t.prototype&&typeof t.prototype.run==`function`&&typeof t.prototype.runCommand==`function`)return Promise.reject(`${e}: command not found`);if(t.constructor===String&&t.startsWith(`#!`))return Promise.reject(`FATAL: should not get here`)}return Promise.reject(`${e}: permission denied`)}}})),Pe=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`clear`}run(){return this.arguments.length>0?Promise.reject(`clear does not require arguments`):(this.stdout&&this.stdout.write(`\x1B[2J\x1B[3J\x1B[H`),this.context.clear(),Promise.resolve())}}})),Fe=t(((e,t)=>{var n=X();t.exports=class extends n{static get name(){return`exit`}run(){let e=parseInt(this.arguments[0])||0;return this.exitCode=e,this.context.destroy(e),Promise.resolve()}}})),Ie=t(((e,t)=>{var n=X(),r=pe();t.exports=class extends n{static get name(){return`read`}get requiresFilesystem(){return!1}get captureInput(){return!0}run(){let e;try{e=this.parseArgs()}catch(e){return this.printHelp(e),Promise.reject()}return e.help?(this.printHelp(),Promise.resolve()):(this.nchars=e.nchars,this.var=e.name,new Promise(t=>{let n=setTimeout(()=>{t(),this.exitCode=1},e.timeout?e.timeout*1e3:864e5);this.completionCallback=e=>{clearTimeout(n),t(e)},this.stdErr=e.prompt||``,this.flush()}))}onInput(e){if(this.inputBuffer||=``,e.length===1&&(this.inputBuffer+=e),e===`Enter`){this.var?(this.context.setVar(this.var,this.inputBuffer||``),this.completionCallback()):this.completionCallback(this.inputBuffer||``);return}if(this.inputBuffer.length===this.nchars){if(this.var){this.context.setVar(this.var,this.inputBuffer),this.completionCallback();return}this.completionCallback(this.inputBuffer)}}printHelp(e){e&&(this.stdOut=e.message),this.stdOut=`usage: read [-n nchars] [-p prompt] [-t timeout] [name ...]`}parseArgs(){return r([{name:`prompt`,alias:`p`,type:String},{name:`nchars`,alias:`n`,type:Number},{name:`timeout`,alias:`t`,type:Number},{name:`help`,alias:`h`,type:Boolean},{defaultOption:!0,name:`name`,type:String}],{argv:this.arguments})}}})),Le=t(((e,t)=>{var n=X(),r=G();t.exports=class extends n{static get name(){return`jsfunction`}run(){let[e,...t]=this.arguments;if(!e||t.length===0)return this.stdErr=`usage: jsfunction <name> <function-body>`,this.exitCode=1,Promise.resolve();let n=t.join(` `),i;try{if(i=Function(`return (`+n+`)`)(),typeof i!=`function`)throw Error(`expression is not a function`)}catch(e){return this.stdErr=`jsfunction: ${e.message}`,this.exitCode=1,Promise.resolve()}class a extends r{run(){let e;try{e=i(this.arguments)}catch(e){return this.stdErr=e.message||String(e),this.exitCode=1,Promise.resolve()}return e&&typeof e.then==`function`?e.then(e=>{e!=null&&(this.stdOut=String(e))}).catch(e=>{this.stdErr=e.message||String(e),this.exitCode=1}):(e!=null&&(this.stdOut=String(e)),Promise.resolve())}}return Object.defineProperty(a,"name",{value:e,configurable:!0}),this.context.setCommand(a),Promise.resolve()}}})),Re=t(((e,t)=>{var n=X();function r(e){return e>=1048576?(e/1048576).toFixed(1)+` MB`:e>=1024?(e/1024).toFixed(1)+` KB`:e+` B`}t.exports=class extends n{static get name(){return`curl`}get requiresFilesystem(){return!0}run(){let e=[...this.arguments],t=null,n={},i=null,a=!1,o=!1,s=null,c=null,l=0;for(;l<e.length;){let r=e[l];switch(r){case`-X`:case`--request`:t=e[++l];break;case`-H`:case`--header`:{let t=e[++l]||``,r=t.indexOf(`:`);r>0&&(n[t.slice(0,r).trim()]=t.slice(r+1).trim());break}case`-d`:case`--data`:case`--data-raw`:i=e[++l],t||=`POST`;break;case`-u`:case`--user`:{let t=e[++l]||``;n.Authorization=`Basic `+btoa(t);break}case`-o`:case`--output`:s=e[++l];break;case`-i`:case`--include`:a=!0;break;case`-s`:case`--silent`:o=!0;break;case`-#`:case`--progress-bar`:break;case`-L`:case`--location`:break;default:r.startsWith(`-`)?o||(this.stdErr=`curl: unknown option '${r}'`):c=r}l++}if(!c)return this.stdErr=`curl: no URL specified`,this.exitCode=1,Promise.resolve();if(!/^https?:\/\//i.test(c))return this.stdErr=`curl: unsupported protocol in URL: ${c}`,this.exitCode=1,Promise.resolve();let u={method:t||`GET`,headers:n};return i!==null&&(u.body=i),fetch(c,u).then(async e=>{a&&(this.stdOut=`HTTP/1.1 ${e.status} ${e.statusText}`,e.headers.forEach((e,t)=>{this.stdOut=`${t}: ${e}`}),this.stdOut=``);let t=null,n=Number(e.headers.get(`content-length`)||0);if(e.body&&typeof e.body.getReader==`function`){let i=e.body.getReader(),a=[],c=0;for(;;){let{done:e,value:t}=await i.read();if(e)break;if(a.push(t),c+=t.length,s&&!o){if(n>0){let e=Math.min(100,Math.floor(c/n*100)),t=Math.min(20,Math.round(c/n*20)),i=`=`.repeat(Math.max(0,t-1))+(t>0?`>`:``)+` `.repeat(Math.max(0,20-t));this.stdOut=`\r[${i}] ${e}% (${r(c)} / ${r(n)})`}else this.stdOut=`\rDownloading: ${r(c)}`;this.flush()}}t=new Uint8Array(c);let l=0;for(let e of a)t.set(e,l),l+=e.length;if(s&&!o&&c>0){let e=n||c;this.stdOut=`\r[${`=`.repeat(20)}] 100% (${r(c)} / ${r(e)})`,this.flush()}}else{let n=await e.arrayBuffer();t=new Uint8Array(n)}if(s)try{let n=e.headers.get(`content-type`)||``;if(/^text\/|application\/(json|javascript|xml|x-sh)/i.test(n)){let e=new TextDecoder().decode(t);this.fs.setFileByPath(s,e,!0)}else{let{BinaryFile:e}=q(),r=e?new e(t.buffer,n||`application/octet-stream`):t;this.fs.setFileByPath(s,r,!0)}}catch(e){this.stdErr=`curl: cannot write to '${s}': ${e.message}`,this.exitCode=1}else new TextDecoder().decode(t).split(/\r?\n/).forEach(e=>{this.stdOut=e});e.ok||(this.exitCode=22)}).catch(e=>{if(!o){let t=e&&e.message?e.message:String(e);if(e instanceof TypeError&&/failed to fetch|networkerror|load failed|fetch is aborted/i.test(t)){let e=/^https:\/\//i.test(c),t=typeof location<`u`&&location.protocol===`https:`;!e&&t?this.stdErr=`curl: (35) Mixed content blocked — the page is served over HTTPS but the target URL is HTTP. Browsers block insecure requests from secure pages.`:(this.stdErr=`curl: (6) Network request failed — this is likely a CORS error. The server at ${c} did not include the required 'Access-Control-Allow-Origin' response header. You can only fetch cross-origin resources that explicitly allow it.`,this.stdErr=` Hint: try a public CORS proxy, or ensure the server sends 'Access-Control-Allow-Origin: *'.`)}else this.stdErr=`curl: (6) Could not connect: ${t}`}this.exitCode=6})}}})),ze=t(((e,t)=>{var n=X(),r={errexit:`e`,xtrace:`x`,nounset:`u`,noexec:`n`,allexport:`a`};t.exports=class extends n{static get name(){return`set`}run(){let e=this.arguments;if(e.length===0){let e=this.context.vars;return Object.keys(e).sort().forEach(t=>{this.stdOut=`${t}=${e[t]}`}),Promise.resolve()}let t=0;for(;t<e.length;){let n=e[t];if(n===`--`){let n=e.slice(t+1),r=1;for(;this.context.getVar(String(r));)this.context.unsetVar(String(r)),r++;return n.forEach((e,t)=>this.context.setVar(String(t+1),e)),this.context.setVar(`#`,String(n.length)),Promise.resolve()}if((n.startsWith(`-`)||n.startsWith(`+`))&&n.length>1&&n[1]!==`-`){let i=n[0]===`-`,a=n.slice(1);if(a===`o`){t++;let n=e[t];if(n===void 0){Object.entries(r).forEach(([e,t])=>{let n=this.context.getVar(`-`)||``;this.stdOut=`${e.padEnd(15)} ${n.includes(t)?`on`:`off`}`}),t++;continue}let a=r[n];a?this._setFlag(a,i):this.stdErr=`set: ${n}: invalid option name`,t++;continue}for(let e of a)this._setFlag(e,i);t++;continue}t++}return Promise.resolve()}_setFlag(e,t){let n=this.context.getVar(`-`)||``;t?n.includes(e)||this.context.setVar(`-`,n+e):this.context.setVar(`-`,n.split(``).filter(t=>t!==e).join(``))}}})),Be=t(((e,t)=>{var n=Ne();t.exports=class extends n{static get name(){return`.`}}})),Ve=t(((e,t)=>{t.exports=[be(),xe(),Se(),Ce(),we(),Te(),Ee(),De(),Oe(),ke(),Ae(),je(),Me(),Ne(),Pe(),Fe(),Ie(),Le(),Re(),ze(),Be()]})),He=t(((e,t)=>{t.exports=Object})),Ue=t(((e,t)=>{t.exports=Error})),We=t(((e,t)=>{t.exports=EvalError})),Ge=t(((e,t)=>{t.exports=RangeError})),Ke=t(((e,t)=>{t.exports=ReferenceError})),qe=t(((e,t)=>{t.exports=SyntaxError})),Q=t(((e,t)=>{t.exports=TypeError})),Je=t(((e,t)=>{t.exports=URIError})),Ye=t(((e,t)=>{t.exports=Math.abs})),Xe=t(((e,t)=>{t.exports=Math.floor})),Ze=t(((e,t)=>{t.exports=Math.max})),Qe=t(((e,t)=>{t.exports=Math.min})),$e=t(((e,t)=>{t.exports=Math.pow})),et=t(((e,t)=>{t.exports=Math.round})),tt=t(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),nt=t(((e,t)=>{var n=tt();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),rt=t(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),it=t(((e,t)=>{var n=rt();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),at=t(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),ot=t(((e,t)=>{t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}})),st=t(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=ot();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),ct=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),lt=t(((e,t)=>{t.exports=He().getPrototypeOf||null})),ut=t(((e,t)=>{var n=`Function.prototype.bind called on incompatible `,r=Object.prototype.toString,i=Math.max,a=`[object Function]`,o=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},s=function(e,t){for(var n=[],r=t||0,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},c=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||r.apply(t)!==a)throw TypeError(n+t);for(var l=s(arguments,1),u,d=function(){if(this instanceof u){var n=t.apply(this,o(l,arguments));return Object(n)===n?n:this}return t.apply(e,o(l,arguments))},f=i(0,t.length-l.length),p=[],m=0;m<f;m++)p[m]=`$`+m;if(u=Function(`binder`,`return function (`+c(p,`,`)+`){ return binder.apply(this,arguments); }`)(d),t.prototype){var h=function(){};h.prototype=t.prototype,u.prototype=new h,h.prototype=null}return u}})),dt=t(((e,t)=>{var n=ut();t.exports=Function.prototype.bind||n})),ft=t(((e,t)=>{t.exports=Function.prototype.call})),pt=t(((e,t)=>{t.exports=Function.prototype.apply})),mt=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),ht=t(((e,t)=>{var n=dt(),r=pt(),i=ft();t.exports=mt()||n.call(i,r)})),gt=t(((e,t)=>{var n=dt(),r=Q(),i=ft(),a=ht();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),_t=t(((e,t)=>{var n=gt(),r=it(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`?function(e){return s(e==null?e:o(e))}:!1})),vt=t(((e,t)=>{var n=ct(),r=lt(),i=_t();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null})),yt=t(((e,t)=>{var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=dt().call(n,r)})),$=t(((e,t)=>{var n,r=He(),i=Ue(),a=We(),o=Ge(),s=Ke(),c=qe(),l=Q(),u=Je(),d=Ye(),f=Xe(),p=Ze(),m=Qe(),h=$e(),g=et(),_=nt(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=it(),x=at(),S=function(){throw new l},C=b?function(){try{return arguments.callee,S}catch{try{return b(arguments,`callee`).get}catch{return S}}}():S,w=st()(),T=vt(),E=lt(),D=ct(),O=pt(),k=ft(),A={},j=typeof Uint8Array>`u`||!T?n:T(Uint8Array),M={__proto__:null,"%AggregateError%":typeof AggregateError>`u`?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>`u`?n:ArrayBuffer,"%ArrayIteratorPrototype%":w&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>`u`?n:Atomics,"%BigInt%":typeof BigInt>`u`?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>`u`?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>`u`?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>`u`?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>`u`?n:Float16Array,"%Float32Array%":typeof Float32Array>`u`?n:Float32Array,"%Float64Array%":typeof Float64Array>`u`?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>`u`?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>`u`?n:Int8Array,"%Int16Array%":typeof Int16Array>`u`?n:Int16Array,"%Int32Array%":typeof Int32Array>`u`?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON==`object`?JSON:n,"%Map%":typeof Map>`u`?n:Map,"%MapIteratorPrototype%":typeof Map>`u`||!w||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>`u`?n:Promise,"%Proxy%":typeof Proxy>`u`?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":typeof Reflect>`u`?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>`u`?n:Set,"%SetIteratorPrototype%":typeof Set>`u`||!w||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>`u`?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&T?T(``[Symbol.iterator]()):n,"%Symbol%":w?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":C,"%TypedArray%":j,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>`u`?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>`u`?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>`u`?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>`u`?n:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>`u`?n:WeakMap,"%WeakRef%":typeof WeakRef>`u`?n:WeakRef,"%WeakSet%":typeof WeakSet>`u`?n:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":O,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":E,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":D};if(T)try{null.error}catch(e){M[`%Error.prototype%`]=T(T(e))}var N=function e(t){var n;if(t===`%AsyncFunction%`)n=y(`async function () {}`);else if(t===`%GeneratorFunction%`)n=y(`function* () {}`);else if(t===`%AsyncGeneratorFunction%`)n=y(`async function* () {}`);else if(t===`%AsyncGenerator%`){var r=e(`%AsyncGeneratorFunction%`);r&&(n=r.prototype)}else if(t===`%AsyncIteratorPrototype%`){var i=e(`%AsyncGenerator%`);i&&T&&(n=T(i.prototype))}return M[t]=n,n},P={__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`]},F=dt(),I=yt(),L=F.call(k,Array.prototype.concat),R=F.call(O,Array.prototype.splice),z=F.call(k,String.prototype.replace),B=F.call(k,String.prototype.slice),V=F.call(k,RegExp.prototype.exec),H=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,U=/\\(\\)?/g,W=function(e){var t=B(e,0,1),n=B(e,-1);if(t===`%`&&n!==`%`)throw new c("invalid intrinsic syntax, expected closing `%`");if(n===`%`&&t!==`%`)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return z(e,H,function(e,t,n,i){r[r.length]=n?z(i,U,`$1`):t||e}),r},G=function(e,t){var n=e,r;if(I(P,n)&&(r=P[n],n=`%`+r[0]+`%`),I(M,n)){var i=M[n];if(i===A&&(i=N(n)),i===void 0&&!t)throw new l(`intrinsic `+e+` exists, but is not available. Please file an issue!`);return{alias:r,name:n,value:i}}throw new c(`intrinsic `+e+` does not exist!`)};t.exports=function(e,t){if(typeof e!=`string`||e.length===0)throw new l(`intrinsic name must be a non-empty string`);if(arguments.length>1&&typeof t!=`boolean`)throw new l(`"allowMissing" argument must be a boolean`);if(V(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=W(e),r=n.length>0?n[0]:``,i=G(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],R(n,L([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=B(p,0,1),h=B(p,-1);if((m===`"`||m===`'`||m==="`"||h===`"`||h===`'`||h==="`")&&m!==h)throw new c(`property names with quotes must have matching quotes`);if((p===`constructor`||!f)&&(s=!0),r+=`.`+p,a=`%`+r+`%`,I(M,a))o=M[a];else if(o!=null){if(!(p in o)){if(!t)throw new l(`base intrinsic for `+e+` exists, but the property is not available.`);return}if(b&&d+1>=n.length){var g=b(o,p);f=!!g,o=f&&`get`in g&&!(`originalValue`in g.get)?g.get:o[p]}else f=I(o,p),o=o[p];f&&!s&&(M[a]=o)}}return o}})),bt=t(((e,t)=>{var n=at(),r=qe(),i=Q(),a=it();t.exports=function(e,t,o){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`obj` must be an object or a function`");if(typeof t!=`string`&&typeof t!=`symbol`)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=`boolean`&&arguments[3]!==null)throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=`boolean`&&arguments[4]!==null)throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=`boolean`&&arguments[5]!==null)throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=`boolean`)throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,d=!!a&&a(e,t);if(n)n(e,t,{configurable:l===null&&d?d.configurable:!l,enumerable:s===null&&d?d.enumerable:!s,value:o,writable:c===null&&d?d.writable:!c});else if(u||!s&&!c&&!l)e[t]=o;else throw new r(`This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.`)}})),xt=t(((e,t)=>{var n=at(),r=function(){return!!n};r.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],`length`,{value:1}).length!==1}catch{return!0}},t.exports=r})),St=t(((e,t)=>{var n=$(),r=bt(),i=xt()(),a=it(),o=Q(),s=n(`%Math.floor%`);t.exports=function(e,t){if(typeof e!=`function`)throw new o("`fn` is not a function");if(typeof t!=`number`||t<0||t>4294967295||s(t)!==t)throw new o("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],c=!0,l=!0;if(`length`in e&&a){var u=a(e,`length`);u&&!u.configurable&&(c=!1),u&&!u.writable&&(l=!1)}return(c||l||!n)&&(i?r(e,`length`,t,!0,!0):r(e,`length`,t)),e}})),Ct=t(((e,t)=>{var n=dt(),r=pt(),i=ht();t.exports=function(){return i(n,r,arguments)}})),wt=t(((e,t)=>{var n=St(),r=at(),i=gt(),a=Ct();t.exports=function(e){var t=i(arguments),r=1+e.length-(arguments.length-1);return n(t,r>0?r:0,!0)},r?r(t.exports,`apply`,{value:a}):t.exports.apply=a})),Tt=t(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){var t=n.call(e),r=t===`[object Arguments]`;return r||=t!==`[object Array]`&&typeof e==`object`&&!!e&&typeof e.length==`number`&&e.length>=0&&n.call(e.callee)===`[object Function]`,r}})),Et=t(((e,t)=>{var n;if(!Object.keys){var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Tt(),o=Object.prototype.propertyIsEnumerable,s=!o.call({toString:null},`toString`),c=o.call(function(){},`prototype`),l=[`toString`,`toLocaleString`,`valueOf`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`constructor`],u=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>`u`)return!1;for(var e in window)try{if(!d[`$`+e]&&r.call(window,e)&&window[e]!==null&&typeof window[e]==`object`)try{u(window[e])}catch{return!0}}catch{return!0}return!1}(),p=function(e){if(typeof window>`u`||!f)return u(e);try{return u(e)}catch{return!1}};n=function(e){var t=typeof e==`object`&&!!e,n=i.call(e)===`[object Function]`,o=a(e),u=t&&i.call(e)===`[object String]`,d=[];if(!t&&!n&&!o)throw TypeError(`Object.keys called on a non-object`);var f=c&&n;if(u&&e.length>0&&!r.call(e,0))for(var m=0;m<e.length;++m)d.push(String(m));if(o&&e.length>0)for(var h=0;h<e.length;++h)d.push(String(h));else for(var g in e)!(f&&g===`prototype`)&&r.call(e,g)&&d.push(String(g));if(s)for(var _=p(e),v=0;v<l.length;++v)!(_&&l[v]===`constructor`)&&r.call(e,l[v])&&d.push(l[v]);return d}}t.exports=n})),Dt=t(((e,t)=>{var n=Array.prototype.slice,r=Tt(),i=Object.keys,a=i?function(e){return i(e)}:Et(),o=Object.keys;a.shim=function(){return Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return r(e)?o(n.call(e)):o(e)}):Object.keys=a,Object.keys||a},t.exports=a})),Ot=t(((e,t)=>{var n=Dt(),r=typeof Symbol==`function`&&typeof Symbol(`foo`)==`symbol`,i=Object.prototype.toString,a=Array.prototype.concat,o=bt(),s=function(e){return typeof e==`function`&&i.call(e)===`[object Function]`},c=xt()(),l=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!s(r)||!r())return}c?o(e,t,n,!0):o(e,t,n)},u=function(e,t){var i=arguments.length>2?arguments[2]:{},o=n(t);r&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)l(e,o[s],t[o[s]],i[o[s]])};u.supportsDescriptors=!!c,t.exports=u})),kt=t(((e,t)=>{var n=$(),r=gt(),i=r([n(`%String.prototype.indexOf%`)]);t.exports=function(e,t){var a=n(e,!!t);return typeof a==`function`&&i(e,`.prototype.`)>-1?r([a]):a}})),At=t(((e,t)=>{var n=$()(`%Array%`),r=!n.isArray&&kt()(`Object.prototype.toString`);t.exports=n.isArray||function(e){return r(e)===`[object Array]`}})),jt=t(((e,t)=>{t.exports=At()})),Mt=t(((e,t)=>{var n=$(),r=kt(),i=Q(),a=jt(),o=n(`%Reflect.apply%`,!0)||r(`Function.prototype.apply`);t.exports=function(e,t){var n=arguments.length>2?arguments[2]:[];if(!a(n))throw new i("Assertion failed: optional `argumentsList`, if provided, must be a List");return o(e,t,n)}})),Nt=t(((e,t)=>{t.exports={}})),Pt=t(((e,t)=>{de();var n=typeof Map==`function`&&Map.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,`size`):null,i=n&&r&&typeof r.get==`function`?r.get:null,a=n&&Map.prototype.forEach,o=typeof Set==`function`&&Set.prototype,s=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,`size`):null,c=o&&s&&typeof s.get==`function`?s.get:null,l=o&&Set.prototype.forEach,u=typeof WeakMap==`function`&&WeakMap.prototype?WeakMap.prototype.has:null,d=typeof WeakSet==`function`&&WeakSet.prototype?WeakSet.prototype.has:null,f=typeof WeakRef==`function`&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,h=Function.prototype.toString,g=String.prototype.match,_=String.prototype.slice,v=String.prototype.replace,y=String.prototype.toUpperCase,b=String.prototype.toLowerCase,x=RegExp.prototype.test,S=Array.prototype.concat,C=Array.prototype.join,w=Array.prototype.slice,T=Math.floor,E=typeof BigInt==`function`?BigInt.prototype.valueOf:null,D=Object.getOwnPropertySymbols,O=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?Symbol.prototype.toString:null,k=typeof Symbol==`function`&&typeof Symbol.iterator==`object`,A=typeof Symbol==`function`&&Symbol.toStringTag?Symbol.toStringTag:null,j=Object.prototype.propertyIsEnumerable,M=(typeof Reflect==`function`?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function N(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||x.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e==`number`){var r=e<0?-T(-e):T(e);if(r!==e){var i=String(r),a=_.call(t,i.length+1);return v.call(i,n,`$&_`)+`.`+v.call(v.call(a,/([0-9]{3})/g,`$&_`),/_$/,``)}}return v.call(t,n,`$&_`)}var P=Nt(),F=P.custom,I=J(F)?F:null,L={__proto__:null,double:`"`,single:`'`},R={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};t.exports=function e(t,n,r,o){var s=n||{};if(Y(s,`quoteStyle`)&&!Y(L,s.quoteStyle))throw TypeError(`option "quoteStyle" must be "single" or "double"`);if(Y(s,`maxStringLength`)&&(typeof s.maxStringLength==`number`?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=Y(s,`customInspect`)?s.customInspect:!0;if(typeof u!=`boolean`&&u!==`symbol`)throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Y(s,`indent`)&&s.indent!==null&&s.indent!==` `&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Y(s,`numericSeparator`)&&typeof s.numericSeparator!=`boolean`)throw TypeError('option "numericSeparator", if provided, must be `true` or `false`');var d=s.numericSeparator;if(t===void 0)return`undefined`;if(t===null)return`null`;if(typeof t==`boolean`)return t?`true`:`false`;if(typeof t==`string`)return pe(t,s);if(typeof t==`number`){if(t===0)return 1/0/t>0?`0`:`-0`;var f=String(t);return d?N(t,f):f}if(typeof t==`bigint`){var m=String(t)+`n`;return d?N(t,m):m}var h=s.depth===void 0?5:s.depth;if(r===void 0&&(r=0),r>=h&&h>0&&typeof t==`object`)return H(t)?`[Array]`:`[Object]`;var g=ve(s,r);if(o===void 0)o=[];else if(ie(o,t)>=0)return`[Circular]`;function y(t,n,i){if(n&&(o=w.call(o),o.push(n)),i){var a={depth:s.depth};return Y(s,`quoteStyle`)&&(a.quoteStyle=s.quoteStyle),e(t,a,r+1,o)}return e(t,s,r+1,o)}if(typeof t==`function`&&!W(t)){var x=re(t),T=be(t,y);return`[Function`+(x?`: `+x:` (anonymous)`)+`]`+(T.length>0?` { `+C.call(T,`, `)+` }`:``)}if(J(t)){var D=k?v.call(String(t),/^(Symbol\(.*\))_[^)]*$/,`$1`):O.call(t);return typeof t==`object`&&!k?Z(D):D}if(fe(t)){for(var F=`<`+b.call(String(t.nodeName)),R=t.attributes||[],V=0;V<R.length;V++)F+=` `+R[V].name+`=`+z(B(R[V].value),`double`,s);return F+=`>`,t.childNodes&&t.childNodes.length&&(F+=`...`),F+=`</`+b.call(String(t.nodeName))+`>`,F}if(H(t)){if(t.length===0)return`[]`;var ne=be(t,y);return g&&!_e(ne)?`[`+ye(ne,g)+`]`:`[ `+C.call(ne,`, `)+` ]`}if(G(t)){var de=be(t,y);return!(`cause`in Error.prototype)&&`cause`in t&&!j.call(t,`cause`)?`{ [`+String(t)+`] `+C.call(S.call(`[cause]: `+y(t.cause),de),`, `)+` }`:de.length===0?`[`+String(t)+`]`:`{ [`+String(t)+`] `+C.call(de,`, `)+` }`}if(typeof t==`object`&&u){if(I&&typeof t[I]==`function`&&P)return P(t,{depth:h-r});if(u!==`symbol`&&typeof t.inspect==`function`)return t.inspect()}if(ae(t)){var me=[];return a&&a.call(t,function(e,n){me.push(y(n,t,!0)+` => `+y(e,t))}),ge(`Map`,i.call(t),me,g)}if(ce(t)){var xe=[];return l&&l.call(t,function(e){xe.push(y(e,t))}),ge(`Set`,c.call(t),xe,g)}if(oe(t))return he(`WeakMap`);if(le(t))return he(`WeakSet`);if(se(t))return he(`WeakRef`);if(K(t))return Z(y(Number(t)));if(te(t))return Z(y(E.call(t)));if(q(t))return Z(p.call(t));if(ee(t))return Z(y(String(t)));if(typeof window<`u`&&t===window)return`{ [object Window] }`;if(typeof globalThis<`u`&&t===globalThis||ue!==void 0&&t===ue)return`{ [object globalThis] }`;if(!U(t)&&!W(t)){var Se=be(t,y),Ce=M?M(t)===Object.prototype:t instanceof Object||t.constructor===Object,we=t instanceof Object?``:`null prototype`,Te=!Ce&&A&&Object(t)===t&&A in t?_.call(X(t),8,-1):we?`Object`:``,Ee=(Ce||typeof t.constructor!=`function`?``:t.constructor.name?t.constructor.name+` `:``)+(Te||we?`[`+C.call(S.call([],Te||[],we||[]),`: `)+`] `:``);return Se.length===0?Ee+`{}`:g?Ee+`{`+ye(Se,g)+`}`:Ee+`{ `+C.call(Se,`, `)+` }`}return String(t)};function z(e,t,n){var r=L[n.quoteStyle||t];return r+e+r}function B(e){return v.call(String(e),/"/g,`"`)}function V(e){return!A||!(typeof e==`object`&&(A in e||e[A]!==void 0))}function H(e){return X(e)===`[object Array]`&&V(e)}function U(e){return X(e)===`[object Date]`&&V(e)}function W(e){return X(e)===`[object RegExp]`&&V(e)}function G(e){return X(e)===`[object Error]`&&V(e)}function ee(e){return X(e)===`[object String]`&&V(e)}function K(e){return X(e)===`[object Number]`&&V(e)}function q(e){return X(e)===`[object Boolean]`&&V(e)}function J(e){if(k)return e&&typeof e==`object`&&e instanceof Symbol;if(typeof e==`symbol`)return!0;if(!e||typeof e!=`object`||!O)return!1;try{return O.call(e),!0}catch{}return!1}function te(e){if(!e||typeof e!=`object`||!E)return!1;try{return E.call(e),!0}catch{}return!1}var ne=Object.prototype.hasOwnProperty||function(e){return e in this};function Y(e,t){return ne.call(e,t)}function X(e){return m.call(e)}function re(e){if(e.name)return e.name;var t=g.call(h.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function ie(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function ae(e){if(!i||!e||typeof e!=`object`)return!1;try{i.call(e);try{c.call(e)}catch{return!0}return e instanceof Map}catch{}return!1}function oe(e){if(!u||!e||typeof e!=`object`)return!1;try{u.call(e,u);try{d.call(e,d)}catch{return!0}return e instanceof WeakMap}catch{}return!1}function se(e){if(!f||!e||typeof e!=`object`)return!1;try{return f.call(e),!0}catch{}return!1}function ce(e){if(!c||!e||typeof e!=`object`)return!1;try{c.call(e);try{i.call(e)}catch{return!0}return e instanceof Set}catch{}return!1}function le(e){if(!d||!e||typeof e!=`object`)return!1;try{d.call(e,d);try{u.call(e,u)}catch{return!0}return e instanceof WeakSet}catch{}return!1}function fe(e){return!e||typeof e!=`object`?!1:typeof HTMLElement<`u`&&e instanceof HTMLElement?!0:typeof e.nodeName==`string`&&typeof e.getAttribute==`function`}function pe(e,t){if(e.length>t.maxStringLength){var n=e.length-t.maxStringLength,r=`... `+n+` more character`+(n>1?`s`:``);return pe(_.call(e,0,t.maxStringLength),t)+r}var i=R[t.quoteStyle||`single`];return i.lastIndex=0,z(v.call(v.call(e,i,`\\$1`),/[\x00-\x1f]/g,me),`single`,t)}function me(e){var t=e.charCodeAt(0),n={8:`b`,9:`t`,10:`n`,12:`f`,13:`r`}[t];return n?`\\`+n:`\\x`+(t<16?`0`:``)+y.call(t.toString(16))}function Z(e){return`Object(`+e+`)`}function he(e){return e+` { ? }`}function ge(e,t,n,r){var i=r?ye(n,r):C.call(n,`, `);return e+` (`+t+`) {`+i+`}`}function _e(e){for(var t=0;t<e.length;t++)if(ie(e[t],`
|
|
21
|
+
`)>=0)return!1;return!0}function ve(e,t){var n;if(e.indent===` `)n=` `;else if(typeof e.indent==`number`&&e.indent>0)n=C.call(Array(e.indent+1),` `);else return null;return{base:n,prev:C.call(Array(t+1),n)}}function ye(e,t){if(e.length===0)return``;var n=`
|
|
22
22
|
`+t.prev+t.base;return n+C.call(e,`,`+n)+`
|
|
23
|
-
`+t.prev}function xe(e,t){var n=V(e),r=[];if(n){r.length=e.length;for(var i=0;i<e.length;i++)r[i]=J(e,i)?t(e[i],e):``}var a=typeof D==`function`?D(e):[],o;if(k){o={};for(var s=0;s<a.length;s++)o[`$`+a[s]]=a[s]}for(var c in e)J(e,c)&&(n&&String(Number(c))===c&&c<e.length||k&&o[`$`+c]instanceof Symbol||(x.call(/[^\w$]/,c)?r.push(t(c,e)+`: `+t(e[c],e)):r.push(c+`: `+t(e[c],e))));if(typeof D==`function`)for(var l=0;l<a.length;l++)j.call(e,a[l])&&r.push(`[`+t(a[l])+`]: `+t(e[a[l]],e));return r}})),Ft=t(((e,t)=>{t.exports=function(e){return typeof e==`string`||typeof e==`symbol`}})),It=t(((e,t)=>{t.exports=function(e){return!!e&&(typeof e==`function`||typeof e==`object`)}})),Lt=t(((e,t)=>{var n=Z(),r=Pt(),i=Ft(),a=It();t.exports=function(e,t){if(!a(e))throw new n(`Assertion failed: Type(O) is not Object`);if(!i(t))throw new n(`Assertion failed: P is not a Property Key, got `+r(t));return e[t]}})),Rt=t(((e,t)=>{var n=Z(),r=Pt(),i=Ft();t.exports=function(e,t){if(!i(t))throw new n(`Assertion failed: P is not a Property Key, got `+r(t));return e[t]}})),zt=t(((e,t)=>{var n=Function.prototype.toString,r=typeof Reflect==`object`&&Reflect!==null&&Reflect.apply,i,a;if(typeof r==`function`&&typeof Object.defineProperty==`function`)try{i=Object.defineProperty({},"length",{get:function(){throw a}}),a={},r(function(){throw 42},null,i)}catch(e){e!==a&&(r=null)}else r=null;var o=/^\s*class\b/,s=function(e){try{var t=n.call(e);return o.test(t)}catch{return!1}},c=function(e){try{return s(e)?!1:(n.call(e),!0)}catch{return!1}},l=Object.prototype.toString,u=`[object Object]`,d=`[object Function]`,f=`[object GeneratorFunction]`,p=`[object HTMLAllCollection]`,m=`[object HTML document.all class]`,h=`[object HTMLCollection]`,g=typeof Symbol==`function`&&!!Symbol.toStringTag,_=!(0 in[,]),v=function(){return!1};if(typeof document==`object`){var y=document.all;l.call(y)===l.call(document.all)&&(v=function(e){if((_||!e)&&(e===void 0||typeof e==`object`))try{var t=l.call(e);return(t===p||t===m||t===h||t===u)&&e(``)==null}catch{}return!1})}t.exports=r?function(e){if(v(e))return!0;if(!e||typeof e!=`function`&&typeof e!=`object`)return!1;try{r(e,null,i)}catch(e){if(e!==a)return!1}return!s(e)&&c(e)}:function(e){if(v(e))return!0;if(!e||typeof e!=`function`&&typeof e!=`object`)return!1;if(g)return c(e);if(s(e))return!1;var t=l.call(e);return t!==d&&t!==f&&!/^\[object HTML/.test(t)?!1:c(e)}})),Bt=t(((e,t)=>{t.exports=zt()})),Vt=t(((e,t)=>{var n=Z(),r=Rt(),i=Bt(),a=Ft(),o=Pt();t.exports=function(e,t){if(!a(t))throw new n(`Assertion failed: P is not a Property Key`);var s=r(e,t);if(s!=null){if(!i(s))throw new n(o(t)+` is not a function: `+o(s));return s}}})),Ht=t(((e,t)=>{var n=st();t.exports=function(){return n()&&!!Symbol.toStringTag}})),Ut=t(((e,t)=>{var n=$(),r=Ht()(),i=bt(),a=at(),o;if(r){var s=n(`RegExp.prototype.exec`),c={},l=function(){throw c},u={toString:l,valueOf:l};typeof Symbol.toPrimitive==`symbol`&&(u[Symbol.toPrimitive]=l),o=function(e){if(!e||typeof e!=`object`)return!1;var t=a(e,`lastIndex`);if(!(t&&i(t,`value`)))return!1;try{s(e,u)}catch(e){return e===c}}}else{var d=n(`Object.prototype.toString`),f=`[object RegExp]`;o=function(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:d(e)===f}}t.exports=o})),Wt=t(((e,t)=>{t.exports=function(e){return!!e}})),Gt=t(((e,t)=>{var n=Q()(`%Symbol.match%`,!0),r=Ut(),i=It(),a=Wt();t.exports=function(e){if(!i(e))return!1;if(n){var t=e[n];if(t!==void 0)return a(t)}return r(e)}})),Kt=t(((e,t)=>{var n=Q()(`%String%`),r=Z();t.exports=function(e){if(typeof e==`symbol`)throw new r(`Cannot convert a Symbol value to a string`);return n(e)}})),qt=t(((e,t)=>{var n=Z();t.exports=function(e){if(e==null)throw new n(arguments.length>0&&arguments[1]||`Cannot call method on `+e);return e}})),Jt=t(((e,t)=>{var n=function(){return typeof function(){}.name==`string`},r=Object.getOwnPropertyDescriptor;if(r)try{r([],`length`)}catch{r=null}n.functionsHaveConfigurableNames=function(){if(!n()||!r)return!1;var e=r(function(){},`name`);return!!e&&!!e.configurable};var i=Function.prototype.bind;n.boundFunctionsHaveNames=function(){return n()&&typeof i==`function`&&function(){}.bind().name!==``},t.exports=n})),Yt=t(((e,t)=>{var n=xt(),r=St()(),i=Jt().functionsHaveConfigurableNames(),a=Z();t.exports=function(e,t){if(typeof e!=`function`)throw new a("`fn` is not a function");return(!(arguments.length>2&&arguments[2])||i)&&(r?n(e,`name`,t,!0,!0):n(e,`name`,t)),e}})),Xt=t(((e,t)=>{var n=Yt(),r=Z(),i=Object;t.exports=n(function(){if(this==null||this!==i(this))throw new r(`RegExp.prototype.flags getter called on non-object`);var e=``;return this.hasIndices&&(e+=`d`),this.global&&(e+=`g`),this.ignoreCase&&(e+=`i`),this.multiline&&(e+=`m`),this.dotAll&&(e+=`s`),this.unicode&&(e+=`u`),this.unicodeSets&&(e+=`v`),this.sticky&&(e+=`y`),e},`get flags`,!0)})),Zt=t(((e,t)=>{var n=Xt(),r=kt().supportsDescriptors,i=Object.getOwnPropertyDescriptor;t.exports=function(){if(r&&/a/gim.flags===`gim`){var e=i(RegExp.prototype,`flags`);if(e&&typeof e.get==`function`&&`dotAll`in RegExp.prototype&&`hasIndices`in RegExp.prototype){var t=``,a={};if(Object.defineProperty(a,"hasIndices",{get:function(){t+=`d`}}),Object.defineProperty(a,"sticky",{get:function(){t+=`y`}}),e.get.call(a),t===`dy`)return e.get}}return n}})),Qt=t(((e,t)=>{var n=kt().supportsDescriptors,r=Zt(),i=at(),a=Object.defineProperty,o=We(),s=yt(),c=/a/;t.exports=function(){if(!n||!s)throw new o(`RegExp.prototype.flags requires a true ES5 environment that supports property descriptors`);var e=r(),t=s(c),l=i(t,`flags`);return(!l||l.get!==e)&&a(t,`flags`,{configurable:!0,enumerable:!1,get:e}),e}})),$t=t(((e,t)=>{var n=kt(),r=Tt(),i=Xt(),a=Zt(),o=Qt(),s=r(a());n(s,{getPolyfill:a,implementation:i,shim:o}),t.exports=s})),en=t(((e,t)=>{t.exports=function(e){return typeof e==`number`&&e>=55296&&e<=56319}})),tn=t(((e,t)=>{t.exports=function(e){return typeof e==`number`&&e>=56320&&e<=57343}})),nn=t(((e,t)=>{var n=Q(),r=Z(),i=n(`%String.fromCharCode%`),a=en(),o=tn();t.exports=function(e,t){if(!a(e)||!o(t))throw new r("Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code");return i(e)+i(t)}})),rn=t(((e,t)=>{var n=Z(),r=$(),i=en(),a=tn(),o=nn(),s=r(`String.prototype.charAt`),c=r(`String.prototype.charCodeAt`);t.exports=function(e,t){if(typeof e!=`string`)throw new n("Assertion failed: `string` must be a String");var r=e.length;if(t<0||t>=r)throw new n("Assertion failed: `position` must be >= 0, and < the length of `string`");var l=c(e,t),u=s(e,t),d=i(l),f=a(l);if(!d&&!f)return{"[[CodePoint]]":u,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!1};if(f||t+1===r)return{"[[CodePoint]]":u,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0};var p=c(e,t+1);return a(p)?{"[[CodePoint]]":o(l,p),"[[CodeUnitCount]]":2,"[[IsUnpairedSurrogate]]":!1}:{"[[CodePoint]]":u,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0}}})),an=t(((e,t)=>{var n=nt();t.exports=function(e){return(typeof e==`number`||typeof e==`bigint`)&&!n(e)&&e!==1/0&&e!==-1/0}})),on=t(((e,t)=>{var n=Xe(),r=Ze(),i=nt(),a=an();t.exports=function(e){if(typeof e!=`number`||i(e)||!a(e))return!1;var t=n(e);return r(t)===t}})),sn=t(((e,t)=>{t.exports=2**53-1||9007199254740991})),cn=t(((e,t)=>{var n=rn(),r=Z(),i=on(),a=sn();t.exports=function(e,t,o){if(typeof e!=`string`)throw new r("Assertion failed: `S` must be a String");if(!i(t)||t<0||t>a)throw new r("Assertion failed: `length` must be an integer >= 0 and <= 2**53");if(typeof o!=`boolean`)throw new r("Assertion failed: `unicode` must be a Boolean");if(!o)return t+1;var s=e.length;return t+1>=s?t+1:t+n(e,t)[`[[CodeUnitCount]]`]}})),ln=t(((e,t)=>{var n=Z();t.exports=function(e,t){if(typeof t!=`boolean`)throw new n(`Assertion failed: Type(done) is not Boolean`);return{value:e,done:t}}})),un=t(((e,t)=>{var n=Z(),r=bt(),i={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};t.exports=function(e){if(!e||typeof e!=`object`)return!1;for(var t in e)if(r(e,t)&&!i[t])return!1;var a=r(e,`[[Value]]`)||r(e,`[[Writable]]`),o=r(e,`[[Get]]`)||r(e,`[[Set]]`);if(a&&o)throw new n(`Property Descriptors may not be both accessor and data descriptors`);return!0}})),dn=t(((e,t)=>{var n=St(),r=ot(),i=n.hasArrayLengthDefineBug(),a=i&&At(),o=$()(`Object.prototype.propertyIsEnumerable`);t.exports=function(e,t,n,s,c,l){if(!r){if(!e(l)||!l[`[[Configurable]]`]||!l[`[[Writable]]`]||c in s&&o(s,c)!==!!l[`[[Enumerable]]`])return!1;var u=l[`[[Value]]`];return s[c]=u,t(s[c],u)}return i&&c===`length`&&`[[Value]]`in l&&a(s)&&s.length!==l[`[[Value]]`]?(s.length=l[`[[Value]]`],s.length===l[`[[Value]]`]):(r(s,c,n(l)),!0)}})),fn=t(((e,t)=>{t.exports=function(e){if(e===void 0)return e;var t={};return`[[Value]]`in e&&(t.value=e[`[[Value]]`]),`[[Writable]]`in e&&(t.writable=!!e[`[[Writable]]`]),`[[Get]]`in e&&(t.get=e[`[[Get]]`]),`[[Set]]`in e&&(t.set=e[`[[Set]]`]),`[[Enumerable]]`in e&&(t.enumerable=!!e[`[[Enumerable]]`]),`[[Configurable]]`in e&&(t.configurable=!!e[`[[Configurable]]`]),t}})),pn=t(((e,t)=>{var n=Z(),r=un(),i=fn();t.exports=function(e){if(e!==void 0&&!r(e))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return i(e)}})),mn=t(((e,t)=>{var n=Z(),r=bt(),i=un();t.exports=function(e){if(e===void 0)return!1;if(!i(e))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return!(!r(e,`[[Value]]`)&&!r(e,`[[Writable]]`))}})),hn=t(((e,t)=>{var n=nt();t.exports=function(e,t){return e===t?e===0?1/e==1/t:!0:n(e)&&n(t)}})),gn=t(((e,t)=>{var n=bt(),r=Z(),i=It(),a=Bt(),o=Wt();t.exports=function(e){if(!i(e))throw new r(`ToPropertyDescriptor requires an object`);var t={};if(n(e,`enumerable`)&&(t[`[[Enumerable]]`]=o(e.enumerable)),n(e,`configurable`)&&(t[`[[Configurable]]`]=o(e.configurable)),n(e,`value`)&&(t[`[[Value]]`]=e.value),n(e,`writable`)&&(t[`[[Writable]]`]=o(e.writable)),n(e,`get`)){var s=e.get;if(s!==void 0&&!a(s))throw new r(`getter must be a function`);t[`[[Get]]`]=s}if(n(e,`set`)){var c=e.set;if(c!==void 0&&!a(c))throw new r(`setter must be a function`);t[`[[Set]]`]=c}if((n(t,`[[Get]]`)||n(t,`[[Set]]`))&&(n(t,`[[Value]]`)||n(t,`[[Writable]]`)))throw new r(`Invalid property descriptor. Cannot both specify accessors and a value or writable attribute`);return t}})),_n=t(((e,t)=>{var n=Z(),r=It(),i=un(),a=dn(),o=pn(),s=mn(),c=Ft(),l=hn(),u=gn();t.exports=function(e,t,d){if(!r(e))throw new n(`Assertion failed: Type(O) is not Object`);if(!c(t))throw new n(`Assertion failed: P is not a Property Key`);var f=i(d)?d:u(d);if(!i(f))throw new n(`Assertion failed: Desc is not a valid Property Descriptor`);return a(s,l,o,e,t,f)}})),vn=t(((e,t)=>{t.exports=function(e){return e===null||typeof e!=`function`&&typeof e!=`object`}})),yn=t(((e,t)=>{var n=Q(),r=n(`%Object.preventExtensions%`,!0),i=n(`%Object.isExtensible%`,!0),a=vn();t.exports=r?function(e){return!a(e)&&i(e)}:function(e){return!a(e)}})),bn=t(((e,t)=>{var n=Z(),r=It(),i=_n(),a=yn(),o=Ft();t.exports=function(e,t,s,c){if(!r(e))throw new n("Assertion failed: `homeObject` is not an Object");if(!o(t))throw new n("Assertion failed: `key` is not a Property Key or a Private Name");if(typeof s!=`function`)throw new n("Assertion failed: `closure` is not a function");if(typeof c!=`boolean`)throw new n("Assertion failed: `enumerable` is not a Boolean");if(!a(e))throw new n("Assertion failed: `homeObject` is not an ordinary, extensible object, with no non-configurable properties");i(e,t,{"[[Value]]":s,"[[Writable]]":!0,"[[Enumerable]]":c,"[[Configurable]]":!0})}})),xn=t(((e,t)=>{t.exports=function(e,t){for(var n=0;n<e.length;n+=1)t(e[n],n,e)}})),Sn=t(((e,t)=>{var n=Pt(),r=Z(),i=function(e,t,n){for(var r=e,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},a=function(e,t){if(e){var n=i(e,t);return n&&n.value}},o=function(e,t,n){var r=i(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}},s=function(e,t){return e?!!i(e,t):!1},c=function(e,t){if(e)return i(e,t,!0)};t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new r(`Side channel does not contain `+n(e))},delete:function(t){var n=c(e,t);return n&&e&&!e.next&&(e=void 0),!!n},get:function(t){return a(e,t)},has:function(t){return s(e,t)},set:function(t,n){e||={next:void 0},o(e,t,n)}};return t}})),Cn=t(((e,t)=>{var n=Q(),r=$(),i=Pt(),a=Z(),o=n(`%Map%`,!0),s=r(`Map.prototype.get`,!0),c=r(`Map.prototype.set`,!0),l=r(`Map.prototype.has`,!0),u=r(`Map.prototype.delete`,!0),d=r(`Map.prototype.size`,!0);t.exports=!!o&&function(){var e,t={assert:function(e){if(!t.has(e))throw new a(`Side channel does not contain `+i(e))},delete:function(t){if(e){var n=u(e,t);return d(e)===0&&(e=void 0),n}return!1},get:function(t){if(e)return s(e,t)},has:function(t){return e?l(e,t):!1},set:function(t,n){e||=new o,c(e,t,n)}};return t}})),wn=t(((e,t)=>{var n=Q(),r=$(),i=Pt(),a=Cn(),o=Z(),s=n(`%WeakMap%`,!0),c=r(`WeakMap.prototype.get`,!0),l=r(`WeakMap.prototype.set`,!0),u=r(`WeakMap.prototype.has`,!0),d=r(`WeakMap.prototype.delete`,!0);t.exports=s?function(){var e,t,n={assert:function(e){if(!n.has(e))throw new o(`Side channel does not contain `+i(e))},delete:function(n){if(s&&n&&(typeof n==`object`||typeof n==`function`)){if(e)return d(e,n)}else if(a&&t)return t.delete(n);return!1},get:function(n){return s&&n&&(typeof n==`object`||typeof n==`function`)&&e?c(e,n):t&&t.get(n)},has:function(n){return s&&n&&(typeof n==`object`||typeof n==`function`)&&e?u(e,n):!!t&&t.has(n)},set:function(n,r){s&&n&&(typeof n==`object`||typeof n==`function`)?(e||=new s,l(e,n,r)):a&&(t||=a(),t.set(n,r))}};return n}:a})),Tn=t(((e,t)=>{var n=Z(),r=Pt(),i=Sn(),a=Cn(),o=wn()||a||i;t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new n(`Side channel does not contain `+r(e))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,n){e||=o(),e.set(t,n)}};return t}})),En=t(((e,t)=>{var n=bt(),r=Tn()(),i=Z(),a={assert:function(e,t){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");if(r.assert(e),!a.has(e,t))throw new i("`"+t+"` is not present on `O`")},get:function(e,t){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");var n=r.get(e);return n&&n[`$`+t]},has:function(e,t){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");var a=r.get(e);return!!a&&n(a,`$`+t)},set:function(e,t,n){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");var a=r.get(e);a||(a={},r.set(e,a)),a[`$`+t]=n}};Object.freeze&&Object.freeze(a),t.exports=a})),Dn=t(((e,t)=>{var n={__proto__:null,foo:{}},r={__proto__:n}.foo===n.foo&&!(n instanceof Object);t.exports=function(){return r}})),On=t(((e,t)=>{var n=Q()(`%Object.create%`,!0),r=Z(),i=Je(),a=It(),o=jt(),s=xn(),c=En(),l=Dn()();t.exports=function(e){if(e!==null&&!a(e))throw new r("Assertion failed: `proto` must be null or an object");var t=arguments.length<2?[]:arguments[1];if(!o(t))throw new r("Assertion failed: `additionalInternalSlotsList` must be an Array");var u;if(l)u={__proto__:e};else if(n)u=n(e);else{if(e===null)throw new i(`native Object.create support is required to create null objects`);var d=function(){};d.prototype=e,u=new d}return t.length>0&&s(t,function(e){c.set(u,e,void 0)}),u}})),kn=t(((e,t)=>{var n=Z(),r=It(),i=$()(`RegExp.prototype.exec`),a=Mt(),o=Lt(),s=Bt();t.exports=function(e,t){if(!r(e))throw new n("Assertion failed: `R` must be an Object");if(typeof t!=`string`)throw new n("Assertion failed: `S` must be a String");var c=o(e,`exec`);if(s(c)){var l=a(c,e,[t]);if(l===null||r(l))return l;throw new n('"exec" method must return `null` or an Object')}return i(e,t)}})),An=t(((e,t)=>{var n=Z(),r=It(),i=Ft(),a=hn(),o=function(){try{return delete 0,!0}catch{return!1}}();t.exports=function(e,t,s,c){if(!r(e))throw new n("Assertion failed: `O` must be an Object");if(!i(t))throw new n("Assertion failed: `P` must be a Property Key");if(typeof c!=`boolean`)throw new n("Assertion failed: `Throw` must be a Boolean");if(c){if(e[t]=s,o&&!a(e[t],s))throw new n(`Attempted to assign to readonly property.`);return!0}try{return e[t]=s,o?a(e[t],s):!0}catch{return!1}}})),jn=t(((e,t)=>{t.exports=function(e){return e===null||typeof e!=`function`&&typeof e!=`object`}})),Mn=t(((e,t)=>{var n=$(),r=n(`Date.prototype.getDay`),i=function(e){try{return r(e),!0}catch{return!1}},a=n(`Object.prototype.toString`),o=`[object Date]`,s=Ht()();t.exports=function(e){return typeof e!=`object`||!e?!1:s?i(e):a(e)===o}})),Nn=t(((e,t)=>{var n=$(),r=Ut(),i=n(`RegExp.prototype.exec`),a=Z();t.exports=function(e){if(!r(e))throw new a("`regex` must be a RegExp");return function(t){return i(e,t)!==null}}})),Pn=t(((e,t)=>{var n=$(),r=n(`Object.prototype.toString`),i=ct()(),a=Nn();if(i){var o=n(`Symbol.prototype.toString`),s=a(/^Symbol\(.*\)$/),c=function(e){return typeof e.valueOf()==`symbol`?s(o(e)):!1};t.exports=function(e){if(typeof e==`symbol`)return!0;if(!e||typeof e!=`object`||r(e)!==`[object Symbol]`)return!1;try{return c(e)}catch{return!1}}}else t.exports=function(e){return!1}})),Fn=t(((e,t)=>{var n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`,r=jn(),i=zt(),a=Mn(),o=Pn(),s=function(e,t){if(e==null)throw TypeError(`Cannot call method on `+e);if(typeof t!=`string`||t!==`number`&&t!==`string`)throw TypeError(`hint must be "string" or "number"`);var n=t===`string`?[`toString`,`valueOf`]:[`valueOf`,`toString`],a,o,s;for(s=0;s<n.length;++s)if(a=e[n[s]],i(a)&&(o=a.call(e),r(o)))return o;throw TypeError(`No default value`)},c=function(e,t){var n=e[t];if(n!=null){if(!i(n))throw TypeError(n+` returned for property `+String(t)+` of object `+e+` is not a function`);return n}};t.exports=function(e){if(r(e))return e;var t=`default`;arguments.length>1&&(arguments[1]===String?t=`string`:arguments[1]===Number&&(t=`number`));var i;if(n&&(Symbol.toPrimitive?i=c(e,Symbol.toPrimitive):o(e)&&(i=Symbol.prototype.valueOf)),i!==void 0){var l=i.call(e,t);if(r(l))return l;throw TypeError(`unable to convert exotic object to primitive`)}return t===`default`&&(a(e)||o(e))&&(t=`string`),s(e,t===`default`?`number`:t)}})),In=t(((e,t)=>{var n=Fn();t.exports=function(e){return arguments.length>1?n(e,arguments[1]):n(e)}})),Ln=t(((e,t)=>{var n=qt(),r=Kt(),i=$()(`String.prototype.replace`),a=/^\s$/.test(``),o=a?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,s=a?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;t.exports=function(){return i(i(r(n(this)),o,``),s,``)}})),Rn=t(((e,t)=>{var n=Ln(),r=``,i=``;t.exports=function(){return String.prototype.trim&&r.trim()===r&&i.trim()===i&&(`_`+i).trim()===`_`+i&&(i+`_`).trim()===i+`_`?String.prototype.trim:n}})),zn=t(((e,t)=>{var n=St()(),r=xt(),i=Rn();t.exports=function(){var e=i();return String.prototype.trim!==e&&(n?r(String.prototype,`trim`,e,!0):r(String.prototype,`trim`,e)),e}})),Bn=t(((e,t)=>{var n=Tt(),r=kt(),i=qt(),a=Ln(),o=Rn(),s=zn(),c=n(o()),l=function(e){return i(e),c(e)};r(l,{getPolyfill:o,implementation:a,shim:s}),t.exports=l})),Vn=t(((e,t)=>{var n=Q(),r=n(`%RegExp%`),i=Z(),a=n(`%parseInt%`),o=$(),s=Nn(),c=o(`String.prototype.slice`),l=s(/^0b[01]+$/i),u=s(/^0o[0-7]+$/i),d=s(/^[-+]0x[0-9a-f]+$/i),f=s(new r(`[`+[`
`,``,``].join(``)+`]`,`g`)),p=Bn();t.exports=function e(t){if(typeof t!=`string`)throw new i("Assertion failed: `argument` is not a String");if(l(t))return+a(c(t,2),2);if(u(t))return+a(c(t,2),8);if(f(t)||d(t))return NaN;var n=p(t);return n===t?+t:e(n)}})),Hn=t(((e,t)=>{var n=Q(),r=Z(),i=n(`%Number%`),a=vn(),o=In(),s=Vn();t.exports=function(e){var t=a(e)?e:o(e,i);if(typeof t==`symbol`)throw new r(`Cannot convert a Symbol value to a number`);if(typeof t==`bigint`)throw new r(`Conversion from 'BigInt' to 'number' is not allowed.`);return typeof t==`string`?s(t):+t}})),Un=t(((e,t)=>{var n=Ze();t.exports=function(e){return typeof e==`bigint`?e:n(e)}})),Wn=t(((e,t)=>{var n=Un(),r=Z();t.exports=function(e){if(typeof e!=`number`&&typeof e!=`bigint`)throw new r(`argument must be a Number or a BigInt`);var t=e<0?-n(-e):n(e);return t===0?0:t}})),Gn=t(((e,t)=>{var n=Hn(),r=Wn(),i=nt(),a=an();t.exports=function(e){var t=n(e);return i(t)||t===0?0:a(t)?r(t):t}})),Kn=t(((e,t)=>{var n=sn(),r=Gn();t.exports=function(e){var t=r(e);return t<=0?0:t>n?n:t}})),qn=t(((e,t)=>{var n=Q()(`%Object.defineProperty%`,!0),r=Ht()(),i=bt(),a=Z(),o=r?Symbol.toStringTag:null;t.exports=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,s=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(r!==void 0&&typeof r!=`boolean`||s!==void 0&&typeof s!=`boolean`)throw new a("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");o&&(r||!i(e,o))&&(n?n(e,o,{configurable:!s,enumerable:!1,value:t,writable:!1}):e[o]=t)}})),Jn=t(((e,t)=>{var n=Q(),r=ct()(),i=Z(),a=It(),o=n(`%IteratorPrototype%`,!0),s=cn(),c=ln(),l=bn(),u=Lt(),d=On(),f=kn(),p=An(),m=Kn(),h=Kt(),g=En(),_=qn(),v=function(e,t,n,r){if(typeof t!=`string`)throw new i("`S` must be a string");if(typeof n!=`boolean`)throw new i("`global` must be a boolean");if(typeof r!=`boolean`)throw new i("`fullUnicode` must be a boolean");g.set(this,`[[IteratingRegExp]]`,e),g.set(this,`[[IteratedString]]`,t),g.set(this,`[[Global]]`,n),g.set(this,`[[Unicode]]`,r),g.set(this,`[[Done]]`,!1)};o&&(v.prototype=d(o)),l(v.prototype,`next`,function(){var e=this;if(!a(e))throw new i(`receiver must be an object`);if(!(e instanceof v)||!g.has(e,`[[IteratingRegExp]]`)||!g.has(e,`[[IteratedString]]`)||!g.has(e,`[[Global]]`)||!g.has(e,`[[Unicode]]`)||!g.has(e,`[[Done]]`))throw new i(`"this" value must be a RegExpStringIterator instance`);if(g.get(e,`[[Done]]`))return c(void 0,!0);var t=g.get(e,`[[IteratingRegExp]]`),n=g.get(e,`[[IteratedString]]`),r=g.get(e,`[[Global]]`),o=g.get(e,`[[Unicode]]`),l=f(t,n);return l===null?(g.set(e,`[[Done]]`,!0),c(void 0,!0)):r?(h(u(l,`0`))===``&&p(t,`lastIndex`,s(n,m(u(t,`lastIndex`)),o),!0),c(l,!1)):(g.set(e,`[[Done]]`,!0),c(l,!1))},!1),r&&(_(v.prototype,`RegExp String Iterator`),Symbol.iterator&&typeof v.prototype[Symbol.iterator]!=`function`&&l(v.prototype,Symbol.iterator,function(){return this},!1)),t.exports=function(e,t,n,r){return new v(e,t,n,r)}})),Yn=t(((e,t)=>{t.exports=Q()})),Xn=t(((e,t)=>{var n=Yn()(`%Reflect.construct%`,!0),r=_n();try{r({},``,{"[[Get]]":function(){}})}catch{r=null}if(r&&n){var i={},a={};r(a,`length`,{"[[Get]]":function(){throw i},"[[Enumerable]]":!0}),t.exports=function(e){try{n(e,a)}catch(e){return e===i}}}else t.exports=function(e){return typeof e==`function`&&!!e.prototype}})),Zn=t(((e,t)=>{var n=Q()(`%Symbol.species%`,!0),r=Z(),i=It(),a=Xn();t.exports=function(e,t){if(!i(e))throw new r(`Assertion failed: Type(O) is not Object`);var o=e.constructor;if(o===void 0)return t;if(!i(o))throw new r(`O.constructor is not an Object`);var s=n?o[n]:void 0;if(s==null)return t;if(a(s))return s;throw new r(`no constructor found`)}})),Qn=t(((e,t)=>{var n=It();t.exports=function(e){if(e===null)return`Null`;if(e===void 0)return`Undefined`;if(n(e))return`Object`;if(typeof e==`number`)return`Number`;if(typeof e==`boolean`)return`Boolean`;if(typeof e==`string`)return`String`}})),$n=t(((e,t)=>{var n=Qn();t.exports=function(e){return typeof e==`symbol`?`Symbol`:typeof e==`bigint`?`BigInt`:n(e)}})),er=t(((e,t)=>{var n=Jn(),r=Lt(),i=An(),a=Zn(),o=Kn(),s=Kt(),c=$n(),l=$t(),u=Yt(),d=$(),f=Q(),p=Z(),m=d(`String.prototype.indexOf`),h=f(`%RegExp%`),g=`flags`in h.prototype,_=function(e,t){var n,i=`flags`in t?r(t,`flags`):s(l(t));return n=g&&typeof i==`string`?new e(t,i):e===h?new e(t.source,i):new e(t,i),{flags:i,matcher:n}};t.exports=u(function(e){var t=this;if(c(t)!==`Object`)throw new p(`"this" value must be an Object`);var l=s(e),u=_(a(t,h),t),d=u.flags,f=u.matcher;return i(f,`lastIndex`,o(r(t,`lastIndex`)),!0),n(f,l,m(d,`g`)>-1,m(d,`u`)>-1)},`[Symbol.matchAll]`,!0)})),tr=t(((e,t)=>{var n=ct()(),r=er();t.exports=function(){return!n||typeof Symbol.matchAll!=`symbol`||typeof RegExp.prototype[Symbol.matchAll]!=`function`?r:RegExp.prototype[Symbol.matchAll]}})),nr=t(((e,t)=>{var n=Mt(),r=Lt(),i=Vt(),a=Gt(),o=Kt(),s=qt(),c=$(),l=ct()(),u=$t(),d=Q(),f=Z(),p=d(`%RegExp%`),m=c(`String.prototype.indexOf`),h=tr(),g=function(e){var t=h();if(l&&typeof Symbol.matchAll==`symbol`){var n=i(e,Symbol.matchAll);return n===p.prototype[Symbol.matchAll]&&n!==t?t:n}if(a(e))return t};t.exports=function(e){var t=s(this);if(e!=null){if(a(e)){var i=`flags`in e?r(e,`flags`):u(e);if(s(i),m(o(i),`g`)<0)throw new f(`matchAll requires a global regular expression`)}var c=g(e);if(c!==void 0)return n(c,e,[t])}var l=o(t),d=new p(e,`g`);return n(g(d),d,[l])}})),rr=t(((e,t)=>{var n=nr();t.exports=function(){if(String.prototype.matchAll)try{``.matchAll(RegExp.prototype)}catch{return String.prototype.matchAll}return n}})),ir=t(((e,t)=>{var n=kt(),r=ct()(),i=at(),a=rr(),o=tr(),s=Object.defineProperty;t.exports=function(){var e=a();if(n(String.prototype,{matchAll:e},{matchAll:function(){return String.prototype.matchAll!==e}}),r){var t=Symbol.matchAll||(Symbol.for?Symbol.for(`Symbol.matchAll`):Symbol(`Symbol.matchAll`));if(n(Symbol,{matchAll:t},{matchAll:function(){return Symbol.matchAll!==t}}),s&&i){var c=i(Symbol,t);(!c||c.configurable)&&s(Symbol,t,{configurable:!1,enumerable:!1,value:t,writable:!1})}var l=o(),u={};u[t]=l;var d={};d[t]=function(){return RegExp.prototype[t]!==l},n(RegExp.prototype,u,d)}return e}})),ar=t(((e,t)=>{var n=Tt(),r=kt(),i=nr(),a=rr(),o=ir(),s=n(i);r(s,{getPolyfill:a,implementation:i,shim:o}),t.exports=s})),or=t(((e,t)=>{var n=G(),{createGenericWasmCommand:r}=ae(),i=`\x1B[2J\x1B[H`,a=`\x1B[0m`,o=`\x1B[7m`,s=`\x1B[1m`,c=`\x1B[2m`,l=`\x1B[36m`,u=`\x1B[31m`,d=`\x1B[32m`,f=class extends n{get requiresFilesystem(){return!0}get interactive(){return this.shouldBeInteractive()}get captureInput(){return this.shouldBeInteractive()}shouldBeInteractive(){return!!this._dynamicReplActive}getReplTitle(){return this._dynamicReplOpts&&this._dynamicReplOpts.title||`${this.name} interactive shell`}getReplPrompt(){return this._dynamicReplMultiline&&this._dynamicReplOpts&&this._dynamicReplOpts.continuePrompt?this._dynamicReplOpts.continuePrompt:this._dynamicReplOpts&&this._dynamicReplOpts.prompt||`${this.name}> `}getReplWelcome(){return this._dynamicReplOpts&&this._dynamicReplOpts.banner||[`Welcome to ${this.name}. Type .exit or Ctrl+D to quit.`]}async initRepl(){}async evaluateReplLine(e){if(this._dynamicReplOpts&&typeof this._dynamicReplOpts.onEvaluate==`function`){let t=await this._dynamicReplOpts.onEvaluate(e);return{output:Array.isArray(t)?t:t==null?[]:[String(t)]}}return{output:[]}}async cleanupRepl(){this._dynamicReplOpts&&typeof this._dynamicReplOpts.onClose==`function`&&await this._dynamicReplOpts.onClose()}async runNonInteractive(){}startRepl(e={}){return this._dynamicReplActive=!0,this._dynamicReplOpts=e,this._dynamicReplBuffer=``,this._dynamicReplMultiline=!1,typeof this._enterAltScreen==`function`&&this._enterAltScreen(),this._launchInteractiveReplLoop()}run(){return this.shouldBeInteractive()?this._launchInteractiveReplLoop():Promise.resolve(this.runNonInteractive())}_launchInteractiveReplLoop(){return this._replHistory=[],this._replHistoryIdx=null,this._replInput=``,this._replCursor=0,this._replLog=[],this._replBusy=!0,this._replStatus=`Initializing WASM runtime...`,this._scrollOffset=0,this._renderRepl(),new Promise(e=>{this._replResolve=e,Promise.resolve().then(()=>this.initRepl()).then(()=>{this._replBusy=!1,this._replStatus=`^D / .exit: Quit | ^L: Clear | Up/Down: History`;for(let e of this.getReplWelcome())this._appendReplLog(e,`info`);this._renderRepl()}).catch(e=>{this._replBusy=!1,this.stdErr=e.message||String(e),this.exitCode=1,this._exitRepl()})})}_appendReplLog(e,t=`out`){let n=String(e??``).split(/\r?\n/);for(let e of n)this._replLog.push({text:e,type:t});this._scrollOffset=0}streamReplChunk(e,t=`out`){if(!e)return;(this._replLog.length===0||this._replLog[this._replLog.length-1].type!==t||!this._replStreamingActive)&&(this._replLog.push({text:``,type:t}),this._replStreamingActive=!0);let n=this._replLog[this._replLog.length-1],r=(n.text+e).split(/\r?\n/);n.text=r[0];for(let e=1;e<r.length;e++)this._replLog.push({text:r[e],type:t});this._scrollOffset=0,this._renderRepl()}onInput(e){if(this.shouldBeInteractive()){if(e===`^D`||e===`^X`){this._exitRepl();return}if(e===`^C`){this._replInput.length>0||this._dynamicReplBuffer?(this._appendReplLog(`${this.getReplPrompt()}${this._replInput}^C`,`prompt`),this._replInput=``,this._replCursor=0,this._dynamicReplBuffer=``,this._dynamicReplMultiline=!1,this._renderRepl()):this._exitRepl();return}if(!this._replBusy){if(e===`^L`){this._replLog=[],this._scrollOffset=0,this._renderRepl();return}if(e===`Enter`){let e=this._replInput;this._replInput=``,this._replCursor=0,this._replHistoryIdx=null,e.trim()&&this._replHistory.push(e),this._appendReplLog(`${this.getReplPrompt()}${e}`,`prompt`);let t=e.trim();if(this._dynamicReplOpts&&typeof this._dynamicReplOpts.isExitCommand==`function`&&this._dynamicReplOpts.isExitCommand(t)||t===`.exit`||t===`.quit`||t===`\\q`||t===`exit`||t===`quit`||t===`exit()`||t===`quit()`){this._exitRepl();return}if(t===`.clear`||t===`\\! clear`){this._replLog=[],this._renderRepl();return}if(this._dynamicReplOpts&&typeof this._dynamicReplOpts.needsMoreInput==`function`&&(this._dynamicReplBuffer=this._dynamicReplBuffer?`${this._dynamicReplBuffer}\n${e}`:e,this._dynamicReplOpts.needsMoreInput(this._dynamicReplBuffer))){this._dynamicReplMultiline=!0,this._renderRepl();return}let n=this._dynamicReplBuffer||e;this._dynamicReplBuffer=``,this._dynamicReplMultiline=!1,this._replBusy=!0,this._replStatus=`Running...`,this._renderRepl(),Promise.resolve().then(()=>this.evaluateReplLine(n)).then(e=>{if(this._replBusy=!1,this._replStreamingActive=!1,this._replStatus=`^D / .exit: Quit | ^L: Clear | Up/Down: History`,e){if(e.clear&&(this._replLog=[]),!e.streamed)if(Array.isArray(e.output))for(let t of e.output)this._appendReplLog(t,`out`);else typeof e.output==`string`&&e.output.length>0&&this._appendReplLog(e.output,`out`);if(e.error&&this._appendReplLog(e.error,`err`),e.exit){this._exitRepl();return}}this._renderRepl()}).catch(e=>{this._replBusy=!1,this._replStatus=`^D / .exit: Quit | ^L: Clear | Up/Down: History`,this._appendReplLog(`Error: ${e.message||e}`,`err`),this._renderRepl()});return}if(e===`Backspace`){this._replCursor>0&&(this._replInput=this._replInput.slice(0,this._replCursor-1)+this._replInput.slice(this._replCursor),this._replCursor--,this._renderRepl());return}if(e===`^W`){let e=this._replCursor;for(;e>0&&this._replInput[e-1]===` `;)e--;for(;e>0&&this._replInput[e-1]!==` `;)e--;this._replInput=this._replInput.slice(0,e)+this._replInput.slice(this._replCursor),this._replCursor=e,this._renderRepl();return}if(e===`Delete`){this._replCursor<this._replInput.length&&(this._replInput=this._replInput.slice(0,this._replCursor)+this._replInput.slice(this._replCursor+1),this._renderRepl());return}if(e===`ArrowLeft`){this._replCursor>0&&(this._replCursor--,this._renderRepl());return}if(e===`ArrowRight`){this._replCursor<this._replInput.length&&(this._replCursor++,this._renderRepl());return}if(e===`Home`||e===`^A`){this._replCursor=0,this._renderRepl();return}if(e===`End`||e===`^E`){this._replCursor=this._replInput.length,this._renderRepl();return}if(e===`ArrowUp`){if(this._replHistory.length===0)return;this._replHistoryIdx===null?this._replHistoryIdx=this._replHistory.length-1:this._replHistoryIdx>0&&this._replHistoryIdx--,this._replInput=this._replHistory[this._replHistoryIdx],this._replCursor=this._replInput.length,this._renderRepl();return}if(e===`ArrowDown`){if(this._replHistoryIdx===null)return;this._replHistoryIdx<this._replHistory.length-1?(this._replHistoryIdx++,this._replInput=this._replHistory[this._replHistoryIdx]):(this._replHistoryIdx=null,this._replInput=``),this._replCursor=this._replInput.length,this._renderRepl();return}if(e===`PageUp`){let e=Math.max(0,this._replLog.length-5);this._scrollOffset=Math.min(e,this._scrollOffset+5),this._renderRepl();return}if(e===`PageDown`){this._scrollOffset=Math.max(0,this._scrollOffset-5),this._renderRepl();return}e.length===1&&!e.startsWith(`^`)&&(this._replInput=this._replInput.slice(0,this._replCursor)+e+this._replInput.slice(this._replCursor),this._replCursor++,this._renderRepl())}}}_renderRepl(){let{cols:e,rows:t}=this.terminalSize,n=Math.max(3,t-3),r=`${o}${s}${` ${this.getReplTitle()} `.padEnd(e).slice(0,e)}${a}`,f=this._replLog.length,p=Math.max(0,f-this._scrollOffset),m=Math.max(0,p-n),h=this._replLog.slice(m,p),g=[];for(let e=0;e<n;e++){let t=h[e];if(!t){g.push(``);continue}t.type===`prompt`?g.push(`${l}${t.text}${a}`):t.type===`err`?g.push(`${u}${t.text}${a}`):t.type===`info`?g.push(`${c}${t.text}${a}`):g.push(t.text)}let _=this.getReplPrompt(),v=this._replInput.slice(0,this._replCursor),y=this._replCursor<this._replInput.length?this._replInput[this._replCursor]:` `,b=this._replCursor<this._replInput.length?this._replInput.slice(this._replCursor+1):``,x=this._replBusy?`${c}${this._replStatus}${a}`:`${d}${s}${_}${a}${v}${o}${y}${a}${b}`,S=`${o}${` ${this._replStatus} `.padEnd(e).slice(0,e)}${a}`,C=[i+r,...g,x,S].join(`
|
|
23
|
+
`+t.prev}function be(e,t){var n=H(e),r=[];if(n){r.length=e.length;for(var i=0;i<e.length;i++)r[i]=Y(e,i)?t(e[i],e):``}var a=typeof D==`function`?D(e):[],o;if(k){o={};for(var s=0;s<a.length;s++)o[`$`+a[s]]=a[s]}for(var c in e)Y(e,c)&&(n&&String(Number(c))===c&&c<e.length||k&&o[`$`+c]instanceof Symbol||(x.call(/[^\w$]/,c)?r.push(t(c,e)+`: `+t(e[c],e)):r.push(c+`: `+t(e[c],e))));if(typeof D==`function`)for(var l=0;l<a.length;l++)j.call(e,a[l])&&r.push(`[`+t(a[l])+`]: `+t(e[a[l]],e));return r}})),Ft=t(((e,t)=>{t.exports=function(e){return typeof e==`string`||typeof e==`symbol`}})),It=t(((e,t)=>{t.exports=function(e){return!!e&&(typeof e==`function`||typeof e==`object`)}})),Lt=t(((e,t)=>{var n=Q(),r=Pt(),i=Ft(),a=It();t.exports=function(e,t){if(!a(e))throw new n(`Assertion failed: Type(O) is not Object`);if(!i(t))throw new n(`Assertion failed: P is not a Property Key, got `+r(t));return e[t]}})),Rt=t(((e,t)=>{var n=Q(),r=Pt(),i=Ft();t.exports=function(e,t){if(!i(t))throw new n(`Assertion failed: P is not a Property Key, got `+r(t));return e[t]}})),zt=t(((e,t)=>{var n=Function.prototype.toString,r=typeof Reflect==`object`&&Reflect!==null&&Reflect.apply,i,a;if(typeof r==`function`&&typeof Object.defineProperty==`function`)try{i=Object.defineProperty({},"length",{get:function(){throw a}}),a={},r(function(){throw 42},null,i)}catch(e){e!==a&&(r=null)}else r=null;var o=/^\s*class\b/,s=function(e){try{var t=n.call(e);return o.test(t)}catch{return!1}},c=function(e){try{return s(e)?!1:(n.call(e),!0)}catch{return!1}},l=Object.prototype.toString,u=`[object Object]`,d=`[object Function]`,f=`[object GeneratorFunction]`,p=`[object HTMLAllCollection]`,m=`[object HTML document.all class]`,h=`[object HTMLCollection]`,g=typeof Symbol==`function`&&!!Symbol.toStringTag,_=!(0 in[,]),v=function(){return!1};if(typeof document==`object`){var y=document.all;l.call(y)===l.call(document.all)&&(v=function(e){if((_||!e)&&(e===void 0||typeof e==`object`))try{var t=l.call(e);return(t===p||t===m||t===h||t===u)&&e(``)==null}catch{}return!1})}t.exports=r?function(e){if(v(e))return!0;if(!e||typeof e!=`function`&&typeof e!=`object`)return!1;try{r(e,null,i)}catch(e){if(e!==a)return!1}return!s(e)&&c(e)}:function(e){if(v(e))return!0;if(!e||typeof e!=`function`&&typeof e!=`object`)return!1;if(g)return c(e);if(s(e))return!1;var t=l.call(e);return t!==d&&t!==f&&!/^\[object HTML/.test(t)?!1:c(e)}})),Bt=t(((e,t)=>{t.exports=zt()})),Vt=t(((e,t)=>{var n=Q(),r=Rt(),i=Bt(),a=Ft(),o=Pt();t.exports=function(e,t){if(!a(t))throw new n(`Assertion failed: P is not a Property Key`);var s=r(e,t);if(s!=null){if(!i(s))throw new n(o(t)+` is not a function: `+o(s));return s}}})),Ht=t(((e,t)=>{var n=ot();t.exports=function(){return n()&&!!Symbol.toStringTag}})),Ut=t(((e,t)=>{var n=kt(),r=Ht()(),i=yt(),a=it(),o;if(r){var s=n(`RegExp.prototype.exec`),c={},l=function(){throw c},u={toString:l,valueOf:l};typeof Symbol.toPrimitive==`symbol`&&(u[Symbol.toPrimitive]=l),o=function(e){if(!e||typeof e!=`object`)return!1;var t=a(e,`lastIndex`);if(!(t&&i(t,`value`)))return!1;try{s(e,u)}catch(e){return e===c}}}else{var d=n(`Object.prototype.toString`),f=`[object RegExp]`;o=function(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:d(e)===f}}t.exports=o})),Wt=t(((e,t)=>{t.exports=function(e){return!!e}})),Gt=t(((e,t)=>{var n=$()(`%Symbol.match%`,!0),r=Ut(),i=It(),a=Wt();t.exports=function(e){if(!i(e))return!1;if(n){var t=e[n];if(t!==void 0)return a(t)}return r(e)}})),Kt=t(((e,t)=>{var n=$()(`%String%`),r=Q();t.exports=function(e){if(typeof e==`symbol`)throw new r(`Cannot convert a Symbol value to a string`);return n(e)}})),qt=t(((e,t)=>{var n=Q();t.exports=function(e){if(e==null)throw new n(arguments.length>0&&arguments[1]||`Cannot call method on `+e);return e}})),Jt=t(((e,t)=>{var n=function(){return typeof function(){}.name==`string`},r=Object.getOwnPropertyDescriptor;if(r)try{r([],`length`)}catch{r=null}n.functionsHaveConfigurableNames=function(){if(!n()||!r)return!1;var e=r(function(){},`name`);return!!e&&!!e.configurable};var i=Function.prototype.bind;n.boundFunctionsHaveNames=function(){return n()&&typeof i==`function`&&function(){}.bind().name!==``},t.exports=n})),Yt=t(((e,t)=>{var n=bt(),r=xt()(),i=Jt().functionsHaveConfigurableNames(),a=Q();t.exports=function(e,t){if(typeof e!=`function`)throw new a("`fn` is not a function");return(!(arguments.length>2&&arguments[2])||i)&&(r?n(e,`name`,t,!0,!0):n(e,`name`,t)),e}})),Xt=t(((e,t)=>{var n=Yt(),r=Q(),i=Object;t.exports=n(function(){if(this==null||this!==i(this))throw new r(`RegExp.prototype.flags getter called on non-object`);var e=``;return this.hasIndices&&(e+=`d`),this.global&&(e+=`g`),this.ignoreCase&&(e+=`i`),this.multiline&&(e+=`m`),this.dotAll&&(e+=`s`),this.unicode&&(e+=`u`),this.unicodeSets&&(e+=`v`),this.sticky&&(e+=`y`),e},`get flags`,!0)})),Zt=t(((e,t)=>{var n=Xt(),r=Ot().supportsDescriptors,i=Object.getOwnPropertyDescriptor;t.exports=function(){if(r&&/a/gim.flags===`gim`){var e=i(RegExp.prototype,`flags`);if(e&&typeof e.get==`function`&&`dotAll`in RegExp.prototype&&`hasIndices`in RegExp.prototype){var t=``,a={};if(Object.defineProperty(a,"hasIndices",{get:function(){t+=`d`}}),Object.defineProperty(a,"sticky",{get:function(){t+=`y`}}),e.get.call(a),t===`dy`)return e.get}}return n}})),Qt=t(((e,t)=>{var n=Ot().supportsDescriptors,r=Zt(),i=it(),a=Object.defineProperty,o=Ue(),s=vt(),c=/a/;t.exports=function(){if(!n||!s)throw new o(`RegExp.prototype.flags requires a true ES5 environment that supports property descriptors`);var e=r(),t=s(c),l=i(t,`flags`);return(!l||l.get!==e)&&a(t,`flags`,{configurable:!0,enumerable:!1,get:e}),e}})),$t=t(((e,t)=>{var n=Ot(),r=wt(),i=Xt(),a=Zt(),o=Qt(),s=r(a());n(s,{getPolyfill:a,implementation:i,shim:o}),t.exports=s})),en=t(((e,t)=>{t.exports=function(e){return typeof e==`number`&&e>=55296&&e<=56319}})),tn=t(((e,t)=>{t.exports=function(e){return typeof e==`number`&&e>=56320&&e<=57343}})),nn=t(((e,t)=>{var n=$(),r=Q(),i=n(`%String.fromCharCode%`),a=en(),o=tn();t.exports=function(e,t){if(!a(e)||!o(t))throw new r("Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code");return i(e)+i(t)}})),rn=t(((e,t)=>{var n=Q(),r=kt(),i=en(),a=tn(),o=nn(),s=r(`String.prototype.charAt`),c=r(`String.prototype.charCodeAt`);t.exports=function(e,t){if(typeof e!=`string`)throw new n("Assertion failed: `string` must be a String");var r=e.length;if(t<0||t>=r)throw new n("Assertion failed: `position` must be >= 0, and < the length of `string`");var l=c(e,t),u=s(e,t),d=i(l),f=a(l);if(!d&&!f)return{"[[CodePoint]]":u,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!1};if(f||t+1===r)return{"[[CodePoint]]":u,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0};var p=c(e,t+1);return a(p)?{"[[CodePoint]]":o(l,p),"[[CodeUnitCount]]":2,"[[IsUnpairedSurrogate]]":!1}:{"[[CodePoint]]":u,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0}}})),an=t(((e,t)=>{var n=tt();t.exports=function(e){return(typeof e==`number`||typeof e==`bigint`)&&!n(e)&&e!==1/0&&e!==-1/0}})),on=t(((e,t)=>{var n=Ye(),r=Xe(),i=tt(),a=an();t.exports=function(e){if(typeof e!=`number`||i(e)||!a(e))return!1;var t=n(e);return r(t)===t}})),sn=t(((e,t)=>{t.exports=2**53-1||9007199254740991})),cn=t(((e,t)=>{var n=rn(),r=Q(),i=on(),a=sn();t.exports=function(e,t,o){if(typeof e!=`string`)throw new r("Assertion failed: `S` must be a String");if(!i(t)||t<0||t>a)throw new r("Assertion failed: `length` must be an integer >= 0 and <= 2**53");if(typeof o!=`boolean`)throw new r("Assertion failed: `unicode` must be a Boolean");if(!o)return t+1;var s=e.length;return t+1>=s?t+1:t+n(e,t)[`[[CodeUnitCount]]`]}})),ln=t(((e,t)=>{var n=Q();t.exports=function(e,t){if(typeof t!=`boolean`)throw new n(`Assertion failed: Type(done) is not Boolean`);return{value:e,done:t}}})),un=t(((e,t)=>{var n=Q(),r=yt(),i={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};t.exports=function(e){if(!e||typeof e!=`object`)return!1;for(var t in e)if(r(e,t)&&!i[t])return!1;var a=r(e,`[[Value]]`)||r(e,`[[Writable]]`),o=r(e,`[[Get]]`)||r(e,`[[Set]]`);if(a&&o)throw new n(`Property Descriptors may not be both accessor and data descriptors`);return!0}})),dn=t(((e,t)=>{var n=xt(),r=at(),i=n.hasArrayLengthDefineBug(),a=i&&At(),o=kt()(`Object.prototype.propertyIsEnumerable`);t.exports=function(e,t,n,s,c,l){if(!r){if(!e(l)||!l[`[[Configurable]]`]||!l[`[[Writable]]`]||c in s&&o(s,c)!==!!l[`[[Enumerable]]`])return!1;var u=l[`[[Value]]`];return s[c]=u,t(s[c],u)}return i&&c===`length`&&`[[Value]]`in l&&a(s)&&s.length!==l[`[[Value]]`]?(s.length=l[`[[Value]]`],s.length===l[`[[Value]]`]):(r(s,c,n(l)),!0)}})),fn=t(((e,t)=>{t.exports=function(e){if(e===void 0)return e;var t={};return`[[Value]]`in e&&(t.value=e[`[[Value]]`]),`[[Writable]]`in e&&(t.writable=!!e[`[[Writable]]`]),`[[Get]]`in e&&(t.get=e[`[[Get]]`]),`[[Set]]`in e&&(t.set=e[`[[Set]]`]),`[[Enumerable]]`in e&&(t.enumerable=!!e[`[[Enumerable]]`]),`[[Configurable]]`in e&&(t.configurable=!!e[`[[Configurable]]`]),t}})),pn=t(((e,t)=>{var n=Q(),r=un(),i=fn();t.exports=function(e){if(e!==void 0&&!r(e))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return i(e)}})),mn=t(((e,t)=>{var n=Q(),r=yt(),i=un();t.exports=function(e){if(e===void 0)return!1;if(!i(e))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return!(!r(e,`[[Value]]`)&&!r(e,`[[Writable]]`))}})),hn=t(((e,t)=>{var n=tt();t.exports=function(e,t){return e===t?e===0?1/e==1/t:!0:n(e)&&n(t)}})),gn=t(((e,t)=>{var n=yt(),r=Q(),i=It(),a=Bt(),o=Wt();t.exports=function(e){if(!i(e))throw new r(`ToPropertyDescriptor requires an object`);var t={};if(n(e,`enumerable`)&&(t[`[[Enumerable]]`]=o(e.enumerable)),n(e,`configurable`)&&(t[`[[Configurable]]`]=o(e.configurable)),n(e,`value`)&&(t[`[[Value]]`]=e.value),n(e,`writable`)&&(t[`[[Writable]]`]=o(e.writable)),n(e,`get`)){var s=e.get;if(s!==void 0&&!a(s))throw new r(`getter must be a function`);t[`[[Get]]`]=s}if(n(e,`set`)){var c=e.set;if(c!==void 0&&!a(c))throw new r(`setter must be a function`);t[`[[Set]]`]=c}if((n(t,`[[Get]]`)||n(t,`[[Set]]`))&&(n(t,`[[Value]]`)||n(t,`[[Writable]]`)))throw new r(`Invalid property descriptor. Cannot both specify accessors and a value or writable attribute`);return t}})),_n=t(((e,t)=>{var n=Q(),r=It(),i=un(),a=dn(),o=pn(),s=mn(),c=Ft(),l=hn(),u=gn();t.exports=function(e,t,d){if(!r(e))throw new n(`Assertion failed: Type(O) is not Object`);if(!c(t))throw new n(`Assertion failed: P is not a Property Key`);var f=i(d)?d:u(d);if(!i(f))throw new n(`Assertion failed: Desc is not a valid Property Descriptor`);return a(s,l,o,e,t,f)}})),vn=t(((e,t)=>{t.exports=function(e){return e===null||typeof e!=`function`&&typeof e!=`object`}})),yn=t(((e,t)=>{var n=$(),r=n(`%Object.preventExtensions%`,!0),i=n(`%Object.isExtensible%`,!0),a=vn();t.exports=r?function(e){return!a(e)&&i(e)}:function(e){return!a(e)}})),bn=t(((e,t)=>{var n=Q(),r=It(),i=_n(),a=yn(),o=Ft();t.exports=function(e,t,s,c){if(!r(e))throw new n("Assertion failed: `homeObject` is not an Object");if(!o(t))throw new n("Assertion failed: `key` is not a Property Key or a Private Name");if(typeof s!=`function`)throw new n("Assertion failed: `closure` is not a function");if(typeof c!=`boolean`)throw new n("Assertion failed: `enumerable` is not a Boolean");if(!a(e))throw new n("Assertion failed: `homeObject` is not an ordinary, extensible object, with no non-configurable properties");i(e,t,{"[[Value]]":s,"[[Writable]]":!0,"[[Enumerable]]":c,"[[Configurable]]":!0})}})),xn=t(((e,t)=>{t.exports=function(e,t){for(var n=0;n<e.length;n+=1)t(e[n],n,e)}})),Sn=t(((e,t)=>{var n=Pt(),r=Q(),i=function(e,t,n){for(var r=e,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},a=function(e,t){if(e){var n=i(e,t);return n&&n.value}},o=function(e,t,n){var r=i(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}},s=function(e,t){return e?!!i(e,t):!1},c=function(e,t){if(e)return i(e,t,!0)};t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new r(`Side channel does not contain `+n(e))},delete:function(t){var n=c(e,t);return n&&e&&!e.next&&(e=void 0),!!n},get:function(t){return a(e,t)},has:function(t){return s(e,t)},set:function(t,n){e||={next:void 0},o(e,t,n)}};return t}})),Cn=t(((e,t)=>{var n=$(),r=kt(),i=Pt(),a=Q(),o=n(`%Map%`,!0),s=r(`Map.prototype.get`,!0),c=r(`Map.prototype.set`,!0),l=r(`Map.prototype.has`,!0),u=r(`Map.prototype.delete`,!0),d=r(`Map.prototype.size`,!0);t.exports=!!o&&function(){var e,t={assert:function(e){if(!t.has(e))throw new a(`Side channel does not contain `+i(e))},delete:function(t){if(e){var n=u(e,t);return d(e)===0&&(e=void 0),n}return!1},get:function(t){if(e)return s(e,t)},has:function(t){return e?l(e,t):!1},set:function(t,n){e||=new o,c(e,t,n)}};return t}})),wn=t(((e,t)=>{var n=$(),r=kt(),i=Pt(),a=Cn(),o=Q(),s=n(`%WeakMap%`,!0),c=r(`WeakMap.prototype.get`,!0),l=r(`WeakMap.prototype.set`,!0),u=r(`WeakMap.prototype.has`,!0),d=r(`WeakMap.prototype.delete`,!0);t.exports=s?function(){var e,t,n={assert:function(e){if(!n.has(e))throw new o(`Side channel does not contain `+i(e))},delete:function(n){if(s&&n&&(typeof n==`object`||typeof n==`function`)){if(e)return d(e,n)}else if(a&&t)return t.delete(n);return!1},get:function(n){return s&&n&&(typeof n==`object`||typeof n==`function`)&&e?c(e,n):t&&t.get(n)},has:function(n){return s&&n&&(typeof n==`object`||typeof n==`function`)&&e?u(e,n):!!t&&t.has(n)},set:function(n,r){s&&n&&(typeof n==`object`||typeof n==`function`)?(e||=new s,l(e,n,r)):a&&(t||=a(),t.set(n,r))}};return n}:a})),Tn=t(((e,t)=>{var n=Q(),r=Pt(),i=Sn(),a=Cn(),o=wn()||a||i;t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new n(`Side channel does not contain `+r(e))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,n){e||=o(),e.set(t,n)}};return t}})),En=t(((e,t)=>{var n=yt(),r=Tn()(),i=Q(),a={assert:function(e,t){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");if(r.assert(e),!a.has(e,t))throw new i("`"+t+"` is not present on `O`")},get:function(e,t){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");var n=r.get(e);return n&&n[`$`+t]},has:function(e,t){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");var a=r.get(e);return!!a&&n(a,`$`+t)},set:function(e,t,n){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`O` is not an object");if(typeof t!=`string`)throw new i("`slot` must be a string");var a=r.get(e);a||(a={},r.set(e,a)),a[`$`+t]=n}};Object.freeze&&Object.freeze(a),t.exports=a})),Dn=t(((e,t)=>{var n={__proto__:null,foo:{}},r={__proto__:n}.foo===n.foo&&!(n instanceof Object);t.exports=function(){return r}})),On=t(((e,t)=>{var n=$()(`%Object.create%`,!0),r=Q(),i=qe(),a=It(),o=jt(),s=xn(),c=En(),l=Dn()();t.exports=function(e){if(e!==null&&!a(e))throw new r("Assertion failed: `proto` must be null or an object");var t=arguments.length<2?[]:arguments[1];if(!o(t))throw new r("Assertion failed: `additionalInternalSlotsList` must be an Array");var u;if(l)u={__proto__:e};else if(n)u=n(e);else{if(e===null)throw new i(`native Object.create support is required to create null objects`);var d=function(){};d.prototype=e,u=new d}return t.length>0&&s(t,function(e){c.set(u,e,void 0)}),u}})),kn=t(((e,t)=>{var n=Q(),r=It(),i=kt()(`RegExp.prototype.exec`),a=Mt(),o=Lt(),s=Bt();t.exports=function(e,t){if(!r(e))throw new n("Assertion failed: `R` must be an Object");if(typeof t!=`string`)throw new n("Assertion failed: `S` must be a String");var c=o(e,`exec`);if(s(c)){var l=a(c,e,[t]);if(l===null||r(l))return l;throw new n('"exec" method must return `null` or an Object')}return i(e,t)}})),An=t(((e,t)=>{var n=Q(),r=It(),i=Ft(),a=hn(),o=function(){try{return delete 0,!0}catch{return!1}}();t.exports=function(e,t,s,c){if(!r(e))throw new n("Assertion failed: `O` must be an Object");if(!i(t))throw new n("Assertion failed: `P` must be a Property Key");if(typeof c!=`boolean`)throw new n("Assertion failed: `Throw` must be a Boolean");if(c){if(e[t]=s,o&&!a(e[t],s))throw new n(`Attempted to assign to readonly property.`);return!0}try{return e[t]=s,o?a(e[t],s):!0}catch{return!1}}})),jn=t(((e,t)=>{t.exports=function(e){return e===null||typeof e!=`function`&&typeof e!=`object`}})),Mn=t(((e,t)=>{var n=kt(),r=n(`Date.prototype.getDay`),i=function(e){try{return r(e),!0}catch{return!1}},a=n(`Object.prototype.toString`),o=`[object Date]`,s=Ht()();t.exports=function(e){return typeof e!=`object`||!e?!1:s?i(e):a(e)===o}})),Nn=t(((e,t)=>{var n=kt(),r=Ut(),i=n(`RegExp.prototype.exec`),a=Q();t.exports=function(e){if(!r(e))throw new a("`regex` must be a RegExp");return function(t){return i(e,t)!==null}}})),Pn=t(((e,t)=>{var n=kt(),r=n(`Object.prototype.toString`),i=st()(),a=Nn();if(i){var o=n(`Symbol.prototype.toString`),s=a(/^Symbol\(.*\)$/),c=function(e){return typeof e.valueOf()==`symbol`?s(o(e)):!1};t.exports=function(e){if(typeof e==`symbol`)return!0;if(!e||typeof e!=`object`||r(e)!==`[object Symbol]`)return!1;try{return c(e)}catch{return!1}}}else t.exports=function(e){return!1}})),Fn=t(((e,t)=>{var n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`,r=jn(),i=zt(),a=Mn(),o=Pn(),s=function(e,t){if(e==null)throw TypeError(`Cannot call method on `+e);if(typeof t!=`string`||t!==`number`&&t!==`string`)throw TypeError(`hint must be "string" or "number"`);var n=t===`string`?[`toString`,`valueOf`]:[`valueOf`,`toString`],a,o,s;for(s=0;s<n.length;++s)if(a=e[n[s]],i(a)&&(o=a.call(e),r(o)))return o;throw TypeError(`No default value`)},c=function(e,t){var n=e[t];if(n!=null){if(!i(n))throw TypeError(n+` returned for property `+String(t)+` of object `+e+` is not a function`);return n}};t.exports=function(e){if(r(e))return e;var t=`default`;arguments.length>1&&(arguments[1]===String?t=`string`:arguments[1]===Number&&(t=`number`));var i;if(n&&(Symbol.toPrimitive?i=c(e,Symbol.toPrimitive):o(e)&&(i=Symbol.prototype.valueOf)),i!==void 0){var l=i.call(e,t);if(r(l))return l;throw TypeError(`unable to convert exotic object to primitive`)}return t===`default`&&(a(e)||o(e))&&(t=`string`),s(e,t===`default`?`number`:t)}})),In=t(((e,t)=>{var n=Fn();t.exports=function(e){return arguments.length>1?n(e,arguments[1]):n(e)}})),Ln=t(((e,t)=>{var n=qt(),r=Kt(),i=kt()(`String.prototype.replace`),a=/^\s$/.test(``),o=a?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,s=a?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;t.exports=function(){return i(i(r(n(this)),o,``),s,``)}})),Rn=t(((e,t)=>{var n=Ln(),r=``,i=``;t.exports=function(){return String.prototype.trim&&r.trim()===r&&i.trim()===i&&(`_`+i).trim()===`_`+i&&(i+`_`).trim()===i+`_`?String.prototype.trim:n}})),zn=t(((e,t)=>{var n=xt()(),r=bt(),i=Rn();t.exports=function(){var e=i();return String.prototype.trim!==e&&(n?r(String.prototype,`trim`,e,!0):r(String.prototype,`trim`,e)),e}})),Bn=t(((e,t)=>{var n=wt(),r=Ot(),i=qt(),a=Ln(),o=Rn(),s=zn(),c=n(o()),l=function(e){return i(e),c(e)};r(l,{getPolyfill:o,implementation:a,shim:s}),t.exports=l})),Vn=t(((e,t)=>{var n=$(),r=n(`%RegExp%`),i=Q(),a=n(`%parseInt%`),o=kt(),s=Nn(),c=o(`String.prototype.slice`),l=s(/^0b[01]+$/i),u=s(/^0o[0-7]+$/i),d=s(/^[-+]0x[0-9a-f]+$/i),f=s(new r(`[`+[`
`,``,``].join(``)+`]`,`g`)),p=Bn();t.exports=function e(t){if(typeof t!=`string`)throw new i("Assertion failed: `argument` is not a String");if(l(t))return+a(c(t,2),2);if(u(t))return+a(c(t,2),8);if(f(t)||d(t))return NaN;var n=p(t);return n===t?+t:e(n)}})),Hn=t(((e,t)=>{var n=$(),r=Q(),i=n(`%Number%`),a=vn(),o=In(),s=Vn();t.exports=function(e){var t=a(e)?e:o(e,i);if(typeof t==`symbol`)throw new r(`Cannot convert a Symbol value to a number`);if(typeof t==`bigint`)throw new r(`Conversion from 'BigInt' to 'number' is not allowed.`);return typeof t==`string`?s(t):+t}})),Un=t(((e,t)=>{var n=Xe();t.exports=function(e){return typeof e==`bigint`?e:n(e)}})),Wn=t(((e,t)=>{var n=Un(),r=Q();t.exports=function(e){if(typeof e!=`number`&&typeof e!=`bigint`)throw new r(`argument must be a Number or a BigInt`);var t=e<0?-n(-e):n(e);return t===0?0:t}})),Gn=t(((e,t)=>{var n=Hn(),r=Wn(),i=tt(),a=an();t.exports=function(e){var t=n(e);return i(t)||t===0?0:a(t)?r(t):t}})),Kn=t(((e,t)=>{var n=sn(),r=Gn();t.exports=function(e){var t=r(e);return t<=0?0:t>n?n:t}})),qn=t(((e,t)=>{var n=$()(`%Object.defineProperty%`,!0),r=Ht()(),i=yt(),a=Q(),o=r?Symbol.toStringTag:null;t.exports=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,s=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(r!==void 0&&typeof r!=`boolean`||s!==void 0&&typeof s!=`boolean`)throw new a("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");o&&(r||!i(e,o))&&(n?n(e,o,{configurable:!s,enumerable:!1,value:t,writable:!1}):e[o]=t)}})),Jn=t(((e,t)=>{var n=$(),r=st()(),i=Q(),a=It(),o=n(`%IteratorPrototype%`,!0),s=cn(),c=ln(),l=bn(),u=Lt(),d=On(),f=kn(),p=An(),m=Kn(),h=Kt(),g=En(),_=qn(),v=function(e,t,n,r){if(typeof t!=`string`)throw new i("`S` must be a string");if(typeof n!=`boolean`)throw new i("`global` must be a boolean");if(typeof r!=`boolean`)throw new i("`fullUnicode` must be a boolean");g.set(this,`[[IteratingRegExp]]`,e),g.set(this,`[[IteratedString]]`,t),g.set(this,`[[Global]]`,n),g.set(this,`[[Unicode]]`,r),g.set(this,`[[Done]]`,!1)};o&&(v.prototype=d(o)),l(v.prototype,`next`,function(){var e=this;if(!a(e))throw new i(`receiver must be an object`);if(!(e instanceof v)||!g.has(e,`[[IteratingRegExp]]`)||!g.has(e,`[[IteratedString]]`)||!g.has(e,`[[Global]]`)||!g.has(e,`[[Unicode]]`)||!g.has(e,`[[Done]]`))throw new i(`"this" value must be a RegExpStringIterator instance`);if(g.get(e,`[[Done]]`))return c(void 0,!0);var t=g.get(e,`[[IteratingRegExp]]`),n=g.get(e,`[[IteratedString]]`),r=g.get(e,`[[Global]]`),o=g.get(e,`[[Unicode]]`),l=f(t,n);return l===null?(g.set(e,`[[Done]]`,!0),c(void 0,!0)):r?(h(u(l,`0`))===``&&p(t,`lastIndex`,s(n,m(u(t,`lastIndex`)),o),!0),c(l,!1)):(g.set(e,`[[Done]]`,!0),c(l,!1))},!1),r&&(_(v.prototype,`RegExp String Iterator`),Symbol.iterator&&typeof v.prototype[Symbol.iterator]!=`function`&&l(v.prototype,Symbol.iterator,function(){return this},!1)),t.exports=function(e,t,n,r){return new v(e,t,n,r)}})),Yn=t(((e,t)=>{t.exports=$()})),Xn=t(((e,t)=>{var n=Yn()(`%Reflect.construct%`,!0),r=_n();try{r({},``,{"[[Get]]":function(){}})}catch{r=null}if(r&&n){var i={},a={};r(a,`length`,{"[[Get]]":function(){throw i},"[[Enumerable]]":!0}),t.exports=function(e){try{n(e,a)}catch(e){return e===i}}}else t.exports=function(e){return typeof e==`function`&&!!e.prototype}})),Zn=t(((e,t)=>{var n=$()(`%Symbol.species%`,!0),r=Q(),i=It(),a=Xn();t.exports=function(e,t){if(!i(e))throw new r(`Assertion failed: Type(O) is not Object`);var o=e.constructor;if(o===void 0)return t;if(!i(o))throw new r(`O.constructor is not an Object`);var s=n?o[n]:void 0;if(s==null)return t;if(a(s))return s;throw new r(`no constructor found`)}})),Qn=t(((e,t)=>{var n=It();t.exports=function(e){if(e===null)return`Null`;if(e===void 0)return`Undefined`;if(n(e))return`Object`;if(typeof e==`number`)return`Number`;if(typeof e==`boolean`)return`Boolean`;if(typeof e==`string`)return`String`}})),$n=t(((e,t)=>{var n=Qn();t.exports=function(e){return typeof e==`symbol`?`Symbol`:typeof e==`bigint`?`BigInt`:n(e)}})),er=t(((e,t)=>{var n=Jn(),r=Lt(),i=An(),a=Zn(),o=Kn(),s=Kt(),c=$n(),l=$t(),u=Yt(),d=kt(),f=$(),p=Q(),m=d(`String.prototype.indexOf`),h=f(`%RegExp%`),g=`flags`in h.prototype,_=function(e,t){var n,i=`flags`in t?r(t,`flags`):s(l(t));return n=g&&typeof i==`string`?new e(t,i):e===h?new e(t.source,i):new e(t,i),{flags:i,matcher:n}};t.exports=u(function(e){var t=this;if(c(t)!==`Object`)throw new p(`"this" value must be an Object`);var l=s(e),u=_(a(t,h),t),d=u.flags,f=u.matcher;return i(f,`lastIndex`,o(r(t,`lastIndex`)),!0),n(f,l,m(d,`g`)>-1,m(d,`u`)>-1)},`[Symbol.matchAll]`,!0)})),tr=t(((e,t)=>{var n=st()(),r=er();t.exports=function(){return!n||typeof Symbol.matchAll!=`symbol`||typeof RegExp.prototype[Symbol.matchAll]!=`function`?r:RegExp.prototype[Symbol.matchAll]}})),nr=t(((e,t)=>{var n=Mt(),r=Lt(),i=Vt(),a=Gt(),o=Kt(),s=qt(),c=kt(),l=st()(),u=$t(),d=$(),f=Q(),p=d(`%RegExp%`),m=c(`String.prototype.indexOf`),h=tr(),g=function(e){var t=h();if(l&&typeof Symbol.matchAll==`symbol`){var n=i(e,Symbol.matchAll);return n===p.prototype[Symbol.matchAll]&&n!==t?t:n}if(a(e))return t};t.exports=function(e){var t=s(this);if(e!=null){if(a(e)){var i=`flags`in e?r(e,`flags`):u(e);if(s(i),m(o(i),`g`)<0)throw new f(`matchAll requires a global regular expression`)}var c=g(e);if(c!==void 0)return n(c,e,[t])}var l=o(t),d=new p(e,`g`);return n(g(d),d,[l])}})),rr=t(((e,t)=>{var n=nr();t.exports=function(){if(String.prototype.matchAll)try{``.matchAll(RegExp.prototype)}catch{return String.prototype.matchAll}return n}})),ir=t(((e,t)=>{var n=Ot(),r=st()(),i=it(),a=rr(),o=tr(),s=Object.defineProperty;t.exports=function(){var e=a();if(n(String.prototype,{matchAll:e},{matchAll:function(){return String.prototype.matchAll!==e}}),r){var t=Symbol.matchAll||(Symbol.for?Symbol.for(`Symbol.matchAll`):Symbol(`Symbol.matchAll`));if(n(Symbol,{matchAll:t},{matchAll:function(){return Symbol.matchAll!==t}}),s&&i){var c=i(Symbol,t);(!c||c.configurable)&&s(Symbol,t,{configurable:!1,enumerable:!1,value:t,writable:!1})}var l=o(),u={};u[t]=l;var d={};d[t]=function(){return RegExp.prototype[t]!==l},n(RegExp.prototype,u,d)}return e}})),ar=t(((e,t)=>{var n=wt(),r=Ot(),i=nr(),a=rr(),o=ir(),s=n(i);r(s,{getPolyfill:a,implementation:i,shim:o}),t.exports=s})),or=t(((e,t)=>{var n=ee(),{createGenericWasmCommand:r}=ie(),i=`\x1B[2J\x1B[H`,a=`\x1B[0m`,o=`\x1B[7m`,s=`\x1B[1m`,c=`\x1B[2m`,l=`\x1B[36m`,u=`\x1B[31m`,d=`\x1B[32m`,f=class extends n{get requiresFilesystem(){return!0}get interactive(){return this.shouldBeInteractive()}get captureInput(){return this.shouldBeInteractive()}shouldBeInteractive(){return!!this._dynamicReplActive}getReplTitle(){return this._dynamicReplOpts&&this._dynamicReplOpts.title||`${this.name} interactive shell`}getReplPrompt(){return this._dynamicReplMultiline&&this._dynamicReplOpts&&this._dynamicReplOpts.continuePrompt?this._dynamicReplOpts.continuePrompt:this._dynamicReplOpts&&this._dynamicReplOpts.prompt||`${this.name}> `}getReplWelcome(){return this._dynamicReplOpts&&this._dynamicReplOpts.banner||[`Welcome to ${this.name}. Type .exit or Ctrl+D to quit.`]}async initRepl(){}async evaluateReplLine(e){if(this._dynamicReplOpts&&typeof this._dynamicReplOpts.onEvaluate==`function`){let t=await this._dynamicReplOpts.onEvaluate(e);return{output:Array.isArray(t)?t:t==null?[]:[String(t)]}}return{output:[]}}async cleanupRepl(){this._dynamicReplOpts&&typeof this._dynamicReplOpts.onClose==`function`&&await this._dynamicReplOpts.onClose()}async runNonInteractive(){}startRepl(e={}){return this._dynamicReplActive=!0,this._dynamicReplOpts=e,this._dynamicReplBuffer=``,this._dynamicReplMultiline=!1,typeof this._enterAltScreen==`function`&&this._enterAltScreen(),this._launchInteractiveReplLoop()}run(){return this.shouldBeInteractive()?this._launchInteractiveReplLoop():Promise.resolve(this.runNonInteractive())}_launchInteractiveReplLoop(){return this._replHistory=[],this._replHistoryIdx=null,this._replInput=``,this._replCursor=0,this._replLog=[],this._replBusy=!0,this._replStatus=`Initializing WASM runtime...`,this._scrollOffset=0,this._renderRepl(),new Promise(e=>{this._replResolve=e,Promise.resolve().then(()=>this.initRepl()).then(()=>{this._replBusy=!1,this._replStatus=`^D / .exit: Quit | ^L: Clear | Up/Down: History`;for(let e of this.getReplWelcome())this._appendReplLog(e,`info`);this._renderRepl()}).catch(e=>{this._replBusy=!1,this.stdErr=e.message||String(e),this.exitCode=1,this._exitRepl()})})}_appendReplLog(e,t=`out`){let n=String(e??``).split(/\r?\n/);for(let e of n)this._replLog.push({text:e,type:t});this._scrollOffset=0}streamReplChunk(e,t=`out`){if(!e)return;(this._replLog.length===0||this._replLog[this._replLog.length-1].type!==t||!this._replStreamingActive)&&(this._replLog.push({text:``,type:t}),this._replStreamingActive=!0);let n=this._replLog[this._replLog.length-1],r=(n.text+e).split(/\r?\n/);n.text=r[0];for(let e=1;e<r.length;e++)this._replLog.push({text:r[e],type:t});this._scrollOffset=0,this._renderRepl()}onInput(e){if(this.shouldBeInteractive()){if(e===`^D`||e===`^X`){this._exitRepl();return}if(e===`^C`){this._replInput.length>0||this._dynamicReplBuffer?(this._appendReplLog(`${this.getReplPrompt()}${this._replInput}^C`,`prompt`),this._replInput=``,this._replCursor=0,this._dynamicReplBuffer=``,this._dynamicReplMultiline=!1,this._renderRepl()):this._exitRepl();return}if(!this._replBusy){if(e===`^L`){this._replLog=[],this._scrollOffset=0,this._renderRepl();return}if(e===`Enter`){let e=this._replInput;this._replInput=``,this._replCursor=0,this._replHistoryIdx=null,e.trim()&&this._replHistory.push(e),this._appendReplLog(`${this.getReplPrompt()}${e}`,`prompt`);let t=e.trim();if(this._dynamicReplOpts&&typeof this._dynamicReplOpts.isExitCommand==`function`&&this._dynamicReplOpts.isExitCommand(t)||t===`.exit`||t===`.quit`||t===`\\q`||t===`exit`||t===`quit`||t===`exit()`||t===`quit()`){this._exitRepl();return}if(t===`.clear`||t===`\\! clear`){this._replLog=[],this._renderRepl();return}if(this._dynamicReplOpts&&typeof this._dynamicReplOpts.needsMoreInput==`function`&&(this._dynamicReplBuffer=this._dynamicReplBuffer?`${this._dynamicReplBuffer}\n${e}`:e,this._dynamicReplOpts.needsMoreInput(this._dynamicReplBuffer))){this._dynamicReplMultiline=!0,this._renderRepl();return}let n=this._dynamicReplBuffer||e;this._dynamicReplBuffer=``,this._dynamicReplMultiline=!1,this._replBusy=!0,this._replStatus=`Running...`,this._renderRepl(),Promise.resolve().then(()=>this.evaluateReplLine(n)).then(e=>{if(this._replBusy=!1,this._replStreamingActive=!1,this._replStatus=`^D / .exit: Quit | ^L: Clear | Up/Down: History`,e){if(e.clear&&(this._replLog=[]),!e.streamed)if(Array.isArray(e.output))for(let t of e.output)this._appendReplLog(t,`out`);else typeof e.output==`string`&&e.output.length>0&&this._appendReplLog(e.output,`out`);if(e.error&&this._appendReplLog(e.error,`err`),e.exit){this._exitRepl();return}}this._renderRepl()}).catch(e=>{this._replBusy=!1,this._replStatus=`^D / .exit: Quit | ^L: Clear | Up/Down: History`,this._appendReplLog(`Error: ${e.message||e}`,`err`),this._renderRepl()});return}if(e===`Backspace`){this._replCursor>0&&(this._replInput=this._replInput.slice(0,this._replCursor-1)+this._replInput.slice(this._replCursor),this._replCursor--,this._renderRepl());return}if(e===`^W`){let e=this._replCursor;for(;e>0&&this._replInput[e-1]===` `;)e--;for(;e>0&&this._replInput[e-1]!==` `;)e--;this._replInput=this._replInput.slice(0,e)+this._replInput.slice(this._replCursor),this._replCursor=e,this._renderRepl();return}if(e===`Delete`){this._replCursor<this._replInput.length&&(this._replInput=this._replInput.slice(0,this._replCursor)+this._replInput.slice(this._replCursor+1),this._renderRepl());return}if(e===`ArrowLeft`){this._replCursor>0&&(this._replCursor--,this._renderRepl());return}if(e===`ArrowRight`){this._replCursor<this._replInput.length&&(this._replCursor++,this._renderRepl());return}if(e===`Home`||e===`^A`){this._replCursor=0,this._renderRepl();return}if(e===`End`||e===`^E`){this._replCursor=this._replInput.length,this._renderRepl();return}if(e===`ArrowUp`){if(this._replHistory.length===0)return;this._replHistoryIdx===null?this._replHistoryIdx=this._replHistory.length-1:this._replHistoryIdx>0&&this._replHistoryIdx--,this._replInput=this._replHistory[this._replHistoryIdx],this._replCursor=this._replInput.length,this._renderRepl();return}if(e===`ArrowDown`){if(this._replHistoryIdx===null)return;this._replHistoryIdx<this._replHistory.length-1?(this._replHistoryIdx++,this._replInput=this._replHistory[this._replHistoryIdx]):(this._replHistoryIdx=null,this._replInput=``),this._replCursor=this._replInput.length,this._renderRepl();return}if(e===`PageUp`){let e=Math.max(0,this._replLog.length-5);this._scrollOffset=Math.min(e,this._scrollOffset+5),this._renderRepl();return}if(e===`PageDown`){this._scrollOffset=Math.max(0,this._scrollOffset-5),this._renderRepl();return}e.length===1&&!e.startsWith(`^`)&&(this._replInput=this._replInput.slice(0,this._replCursor)+e+this._replInput.slice(this._replCursor),this._replCursor++,this._renderRepl())}}}_renderRepl(){let{cols:e,rows:t}=this.terminalSize,n=Math.max(3,t-3),r=`${o}${s}${` ${this.getReplTitle()} `.padEnd(e).slice(0,e)}${a}`,f=this._replLog.length,p=Math.max(0,f-this._scrollOffset),m=Math.max(0,p-n),h=this._replLog.slice(m,p),g=[];for(let e=0;e<n;e++){let t=h[e];if(!t){g.push(``);continue}t.type===`prompt`?g.push(`${l}${t.text}${a}`):t.type===`err`?g.push(`${u}${t.text}${a}`):t.type===`info`?g.push(`${c}${t.text}${a}`):g.push(t.text)}let _=this.getReplPrompt(),v=this._replInput.slice(0,this._replCursor),y=this._replCursor<this._replInput.length?this._replInput[this._replCursor]:` `,b=this._replCursor<this._replInput.length?this._replInput.slice(this._replCursor+1):``,x=this._replBusy?`${c}${this._replStatus}${a}`:`${d}${s}${_}${a}${v}${o}${y}${a}${b}`,S=`${o}${` ${this._replStatus} `.padEnd(e).slice(0,e)}${a}`,C=[i+r,...g,x,S].join(`
|
|
24
24
|
`);this.stdOut=C,this.flush()}_exitRepl(){Promise.resolve().then(()=>this.cleanupRepl()).catch(()=>{}).finally(()=>{if(this._replResolve){let e=this._replResolve;this._replResolve=null,e()}})}};function p(e,t={},n=null){let i=(n||e.bin||e.name).toLowerCase(),a=r(e,t,i),o=e&&typeof e.repl==`object`?e.repl:{};class s extends f{static get name(){return i}get name(){return i}constructor(e,t){super(e,t),this._sessionArgs=[],this._isInteractiveMode=this._detectInteractiveMode(e||[])}_detectInteractiveMode(e){if(e.includes(`--help`)||e.includes(`-h`)||e.includes(`--version`)||e.includes(`-V`)||e.includes(`-v`))return!1;if(e.length===0)return!0;if(o.sessionArg&&e.length===1&&!e[0].startsWith(`-`)){let t=e[0].trim();if(!/^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|PRAGMA|WITH|BEGIN|EXPLAIN|\.)\b/i.test(t))return this._sessionArgs=[e[0]],!0}return!1}shouldBeInteractive(){return this._dynamicReplActive?!0:this.stdin!==void 0&&this.stdin!==null&&String(this.stdin).trim().length>0?!1:this._isInteractiveMode}getReplTitle(){let t=this._sessionArgs.length>0?` — ${this._sessionArgs.join(` `)}`:``;return o.title||`${i} (${e.name} ${e.version||`wasm`})${t}`}getReplPrompt(){return this._dynamicReplMultiline&&o.continuePrompt?o.continuePrompt:o.prompt||`${i}> `}getReplWelcome(){return o.banner||[`${e.name} (${e.version||`wasm`}) interactive shell`,`Type ".exit" or Ctrl+D to quit.`]}async evaluateReplLine(e){let t=o.evalFlag,n=t?[...this._sessionArgs,t,e]:[...this._sessionArgs,e],r=t?void 0:e,{out:i,err:a}=await this._captureBaseWasmOutput(n,r);return{output:i,error:a.length>0?a.join(`
|
|
25
|
-
`):void 0}}async runNonInteractive(){await this._delegateToBaseWasm([...this.arguments||[]])}async _delegateToBaseWasm(e){let t=new a(e,this.context);t.fs=this.fs,this.stdin!==void 0&&(t.stdin=this.stdin),await t.run();for(let e of t.result.getStdOutput())e.type===`out`?this.stdOut=e.string:e.type===`err`&&(this.stdErr=e.string);this.exitCode=t.exitCode||t.result.getExitCode()}async _captureBaseWasmOutput(e,t){let n=new a(e,this.context);n.fs=this.fs,t!==void 0&&(n.stdin=t),await n.run();let r=[],i=[];for(let e of n.result.getStdOutput())e.type===`err`?i.push(e.string):r.push(e.string);return{out:r,err:i}}}return s}f.createReplWasmCommand=p,f.createCommand=p,t.exports=f}));return t(((e,t)=>{y();var n=
|
|
25
|
+
`):void 0}}async runNonInteractive(){await this._delegateToBaseWasm([...this.arguments||[]])}async _delegateToBaseWasm(e){let t=new a(e,this.context);t.fs=this.fs,this.stdin!==void 0&&(t.stdin=this.stdin),await t.run();for(let e of t.result.getStdOutput())e.type===`out`?this.stdOut=e.string:e.type===`err`&&(this.stdErr=e.string);this.exitCode=t.exitCode||t.result.getExitCode()}async _captureBaseWasmOutput(e,t){let n=new a(e,this.context);n.fs=this.fs,t!==void 0&&(n.stdin=t),await n.run();let r=[],i=[];for(let e of n.result.getStdOutput())e.type===`err`?i.push(e.string):r.push(e.string);return{out:r,err:i}}}return s}f.createReplWasmCommand=p,f.createCommand=p,t.exports=f}));return t(((e,t)=>{y();var n=Y(),r=X(),i=re(),a=ie(),o=G(),s=ee(),{TtyStream:c}=W(),l=`/.brsh_history`,u=ye(),d=Ve(),f=V(),p=b(),{isAsyncFilesystemSource:m,resolveFilesystemSource:h}=K(),g=/\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g,_=f.EventEmitter||f.default||f;String.prototype.regexIndexOf=function(e,t){let n=this.substring(t||0).search(e);return n>=0?n+(t||0):n},ar().shim();var x=class e extends _{constructor(e){super();let{path:t=`/bin`,profile:r,motd:i,command:a,interactive:o=!0,subshell:s=!1,hostname:l=`browser`,filesystem:u={},permissions:d={},cwd:f=`/`,onFsChange:p,useRealFilesystem:h=!1}=e;if(this.context=new n(Object.assign({},e,{clearFn:this.clear.bind(this),destroyFn:this.destroy.bind(this),onFsChange:typeof p==`function`?p:null})),this._readonlyContext=Object.freeze({getVar:e=>this.context.getVar(e),getAlias:e=>this.context.getAlias(e),getCommand:e=>this.context.getCommand(e)}),this.context.setVar(`PATH`,t),this.context.setVar(`HOST`,l),!s){let e=(o?`i`:``)+(a?`c`:``);e&&this.context.setVar(`-`,e)}if(this._lastCode=0,this._subshell=s,this._useRealFilesystem=h,this._profile=r,this._motd=i,this._initialCommand=a||null,this._suppressMotd=!!a,this._loadingFs=null,this._queuedWhileLoading=!1,this.stdinStream=new c({columns:80,rows:24}),this.stdout=new c({columns:80,rows:24,onWrite:e=>this.emit(`data`,e)}),this.stderr=new c({columns:80,rows:24,onWrite:e=>this.emit(`data`,e)}),this._lineBuffer=[],this._cursorPos=0,this._history=[],this._historyPos=null,this._savedInput=null,this._historyLoaded=!1,this._working=!0,this._promptReady=!1,this._inProgressLine=!1,this._fromLineEditor=!1,this._lastPromptRowOffset=0,this._pendingCommands=[],s||this._setupTtyStreams(),h)this.context.setNodeFilesystem(f),this.context.setCwd(f),this._loadDefaultCommands(),this._loadBuiltinCommands(!0),this.ready=Promise.resolve(this),s?this._initializing=!1:(this._initializing=!0,setTimeout(()=>this._init(),0));else if(m(u)||u&&typeof u==`object`&&m(u.filesystem))this.context.setFilesystem({},d),this._loadDefaultCommands(),this._loadBuiltinCommands(!1),this._initializing=!s,this._loadingFs=this._initAsyncFilesystem(u,d,f,r),this.ready=this._loadingFs;else{this.context.setFilesystem(u,d),this.context.setCwd(f);let e=this.context.fs.exists(this.context.getVar(`PATH`));this._loadDefaultCommands(),this._loadBuiltinCommands(e),this.ready=Promise.resolve(this),s?this._initializing=!1:(this._initializing=!0,setTimeout(()=>this._init(),0))}}async _initAsyncFilesystem(t,n,r){let i=this.context.getVar(`PATH`)||`/bin`,a=()=>{try{let e=this.context.fs.getRaw(),t=i.replace(/^\/+|\/+$/g,``).split(`/`).filter(Boolean),n=e;for(let e of t)n&&=n[e];return n&&typeof n==`object`?Object.assign({},n):{}}catch{return{}}},o=a();try{let e=await h(t,n),s=a(),c=[];for(let[e,t]of Object.entries(s))o[e]!==t&&typeof t==`function`&&c.push(t);let l=this.context._onFsChange;this.context._onFsChange=null,this.context.setFilesystem(e.filesystem,e.permissions);let u=this.context.fs.exists(i);this._loadDefaultCommands(),this._loadBuiltinCommands(u);for(let e of c)this.context.setCommand(e);this.context.setCwd(r),this.context._onFsChange=l,l&&this.context.fs&&(this.context.fs._onChange=()=>l(this.context.fs.getRaw(),this.context.fs.getRawPermissions()))}catch(e){this.emit(`stdErr`,e.message||String(e))}finally{this._loadingFs=null}return this._subshell?(this._initializing=!1,!this._queuedWhileLoading&&!this.destroyed&&this.emit(`status`,e.STATUS_READY)):await this._init(),this}get path(){return this.context.getVar(`PATH`)}set lastCode(e){this.context.setVar(`?`,String(e)),this._lastCode=e}get lastCode(){return this._lastCode}get stdin(){return this._stdin===void 0?this.stdinStream:this._stdin}set stdin(e){this._stdin=e}write(e){return this.stdinStream.pushData(e),!0}resize(e,t){this.setTerminalSize(e,t)}onInput(e){if(this.runningCommand&&this.runningCommand.onInput&&this.runningCommand.captureInput)return this.runningCommand.onInput(e),!0}setTerminalSize(e,t){this._terminalSize={cols:e,rows:t},this.context.setVar(`COLUMNS`,String(e)),this.context.setVar(`LINES`,String(t)),this.stdinStream.resize(e,t),this.stdout.resize(e,t),this.stderr.resize(e,t),this.runningCommand&&(this.runningCommand.stdinStream&&this.runningCommand.stdinStream.resize(e,t),this.runningCommand.stdout&&this.runningCommand.stdout.resize(e,t),this.runningCommand.stderr&&this.runningCommand.stderr.resize(e,t)),this.emit(`resize`,{cols:e,rows:t})}get terminalSize(){return this._terminalSize||{cols:80,rows:24}}_loadDefaultCommands(){d.forEach(e=>{this.context.setCommand(e)})}_loadBuiltinCommands(e=!1){u.forEach(e=>{this.context.setCommand(e)}),e||this.context.fs.setMode(this.context.getVar(`PATH`),365)}suppressMotd(){this._suppressMotd=!0;let e=this.context.getVar(`-`);e.includes(`c`)||this.context.setVar(`-`,e+`c`)}async _init(){try{if(!this._suppressMotd&&!this._initialCommand&&await this._runMotd(),await this._loadProfile(this._profile),this._initialCommand){await this.onCommand(this._initialCommand,!1);let e=this.context.getVar(`-`);e.includes(`c`)&&this.context.setVar(`-`,e.replace(/c/g,``))}}finally{this._initializing=!1,!this._queuedWhileLoading&&!this.destroyed&&this.emit(`status`,e.STATUS_READY)}}_hasHushlogin(){if(this.context.fs.exists(`.hushlogin`))return!0;let e=this.context.getVar(`HOME`);return!!(e&&this.context.fs.exists(`${e.replace(/\/$/,``)}/.hushlogin`))}async _runMotd(){if(!(this._motd===!1||this._hasHushlogin())){if(typeof this._motd==`string`){await this._renderMotdPath(this._motd);return}this._useRealFilesystem||(this.context.fs.exists(`/etc/update-motd.d`)&&await this._runMotdDir(`/etc/update-motd.d`),this.context.fs.exists(`/etc/motd`)&&await this._renderMotdPath(`/etc/motd`))}}async _runMotdDir(e){let t=this.context.fs.getFileByPath(e);if(!t||t.constructor!==Object)return;let n=Object.keys(t).sort(),r=e.endsWith(`/`)?e.slice(0,-1):e;for(let e of n){let t=`${r}/${e}`,n=this.context.fs.stat(t);!n||n.isDirectory||this.context.fs.isExecutable(t)&&await this.onCommand(t,!1)}}async _renderMotdPath(e){if(!this.context.fs.exists(e))return;let t=this.context.fs.stat(e);if(!t)return;if(t.isDirectory){await this._runMotdDir(e);return}let n=this.context.fs.getFileByPath(e);if(n==null)return;if(typeof n==`function`){this.context.fs.isExecutable(e)&&await this.onCommand(e,!1);return}if(typeof n==`string`&&n.startsWith(`#!`)){this.context.fs.isExecutable(e)?await this.onCommand(e,!1):await this.onCommand(`source ${e}`,!1);return}let r=n.toString();r.endsWith(`
|
|
26
26
|
`)&&(r=r.slice(0,-1)),r.split(/\r?\n/).forEach(e=>{this.emit(`stdOut`,e)})}async _loadProfile(e){if(!this._useRealFilesystem&&e!==`/etc/profile`&&this.context.fs.exists(`/etc/profile`)){let e=this.context.fs.getFileByPath(`/etc/profile`);typeof e==`string`&&e.startsWith(`#!`)&&await this.onCommand(`source /etc/profile`,!1)}e&&await this.onCommand(`source ${e}`,!1)}onCommand(t,n=!0){n&&!this._subshell&&this._promptReady&&!this._fromLineEditor&&(this.stdout.write(`\r${this.getPrompt()} ${t}\x1b[K\r\n`),this._lineBuffer=[],this._cursorPos=0),this._fromLineEditor=!1;let r=this._splitInput(t),i=this._groupPipes(r),a=!0;this._loadingFs&&n&&(this._queuedWhileLoading=!0);let o=this._loadingFs?Promise.resolve(this._loadingFs):Promise.resolve(),s=i.reduce((e,{commands:t,op:n})=>e.then(()=>{if(!a){n===`&&`?a=this._lastCode===0:n===`||`?a=this._lastCode!==0:n===`;`&&(a=!0);return}return this._runPipeChain(t).then(()=>{n===`&&`?a=this._lastCode===0:n===`||`?a=this._lastCode!==0:n===`;`&&(a=!0)})}),o);return n?s.then(()=>{this.destroyed||this.emit(`status`,e.STATUS_READY)}).catch(()=>this.emit(`status`,e.STATUS_READY)):s}tabCompletion(e){return this.context.fs.autoComplete(e,this.path)}async _runCommand(t){if(!t||t.length<1)return;this._initializing||this.emit(`status`,e.STATUS_WORKING);let n;try{n=await this._parseCommandLine(t)}catch(e){this.emit(`stdErr`,e.message||String(e)),this.lastCode=1,this.emit(`exitCode`,this.lastCode);return}if(!n.length)return;let a=!1;for(;n.length>0&&!n[0].hasQuote&&n[0].value===`!`;)a=!a,n.shift();if(!n.length){this.lastCode=+!!a,this.emit(`exitCode`,this.lastCode);return}let o={type:`stdout`},s={type:`stderr`},c=[];for(let e=0;e<n.length;e++){let{value:t,hasQuote:r}=n[e];if(r){c.push(t);continue}if(t===`2>&1`){s={...o};continue}if(t===`1>&2`){o={...s};continue}if(t===`2>&-`){s={type:`null`};continue}if(t===`1>&-`||t===`>&-`){o={type:`null`};continue}if(t===`&>>`){if(e+1<n.length){let t=n[++e].value,r=t===`/dev/null`?{type:`null`}:{type:`file`,file:t,append:!0};o=r,s=r}continue}if(t===`&>`||t===`>&`){if(e+1<n.length){let t=n[++e].value,r=t===`/dev/null`?{type:`null`}:{type:`file`,file:t,append:!1};o=r,s=r}continue}if(t.startsWith(`&>>`)&&t.length>3){let e=t.slice(3),n=e===`/dev/null`?{type:`null`}:{type:`file`,file:e,append:!0};o=n,s=n;continue}if((t.startsWith(`&>`)||t.startsWith(`>&`))&&t.length>2){let e=t.slice(2),n=e===`/dev/null`?{type:`null`}:{type:`file`,file:e,append:!1};o=n,s=n;continue}if(t===`2>>`){if(e+1<n.length){let t=n[++e].value;s=t===`/dev/null`?{type:`null`}:{type:`file`,file:t,append:!0}}continue}if(t===`2>`){if(e+1<n.length){let t=n[++e].value;s=t===`/dev/null`?{type:`null`}:{type:`file`,file:t,append:!1}}continue}if(t.startsWith(`2>>`)&&t.length>3){let e=t.slice(3);s=e===`/dev/null`?{type:`null`}:{type:`file`,file:e,append:!0};continue}if(t.startsWith(`2>`)&&t.length>2){let e=t.slice(2);s=e===`/dev/null`?{type:`null`}:{type:`file`,file:e,append:!1};continue}if(t===`1>>`||t===`>>`){if(e+1<n.length){let t=n[++e].value;o=t===`/dev/null`?{type:`null`}:{type:`file`,file:t,append:!0}}continue}if(t===`1>`||t===`>`){if(e+1<n.length){let t=n[++e].value;o=t===`/dev/null`?{type:`null`}:{type:`file`,file:t,append:!1}}continue}if((t.startsWith(`1>>`)||t.startsWith(`>>`))&&t.length>(t.startsWith(`1>>`)?3:2)){let e=t.slice(t.startsWith(`1>>`)?3:2);o=e===`/dev/null`?{type:`null`}:{type:`file`,file:e,append:!0};continue}if((t.startsWith(`1>`)||t.startsWith(`>`))&&t.length>(t.startsWith(`1>`)?2:1)){let e=t.slice(t.startsWith(`1>`)?2:1);o=e===`/dev/null`?{type:`null`}:{type:`file`,file:e,append:!1};continue}c.push(t)}if(!c.length){for(let e of[o,s])if(e.type===`file`&&e.file!==`/dev/null`)try{let t=this.context.fs.absolutePath(e.file),n=this.context.fs._getFileRaw(t);(!e.append||n===void 0)&&this.context.fs.setFileByPath(t,n||``,!0)}catch{this.emit(`stdErr`,`${e.file}: Permission denied`),this.lastCode=+!a,this.emit(`exitCode`,this.lastCode);return}this.lastCode=+!!a,this.emit(`exitCode`,this.lastCode);return}let l=c.shift();if(n=c,n.length===0&&/^[A-Za-z_]\w*=/.test(l)){let e=l.indexOf(`=`);this.context.setVar(l.slice(0,e),l.slice(e+1)),this.lastCode=+!!a,this.emit(`exitCode`,this.lastCode);return}let u=this.context.getAlias(l);if(u)return this.onCommand(u,!1).then(()=>{a&&(this.lastCode=+(this.lastCode===0),this.emit(`exitCode`,this.lastCode))});let d;try{d=this._parseCommand(l.startsWith(`/`)||l.startsWith(`./`)?l:l.toLowerCase())}catch(e){this._handleCommandError(e.message,s,a);return}let f=e=>typeof e==`function`&&typeof e.prototype.run==`function`&&typeof e.prototype.runCommand==`function`,p;if(d.prototype instanceof r||new d instanceof i)p=new d(n,this.context);else if(f(d))p=new d(n,this._readonlyContext);else{this._handleCommandError(`${l}: Command not found`,s,a);return}p.requiresFilesystem&&(p.fs=this.context.fs.sandbox()),this._stdin!==void 0&&(p.stdin=this._stdin);let m=new Map,h=({type:e,string:t})=>{let n=e===`out`?o:s;if(n.type===`stdout`)this.emit(`stdOut`,t);else if(n.type===`stderr`)this.emit(`stdErr`,t);else if(n.type===`file`&&n.file!==`/dev/null`){let e=m.get(n.file);e||(e={append:n.append,lines:[]},m.set(n.file,e)),e.lines.push(t)}};return this.runningCommand=p,this.runningCommand.on&&(this.runningCommand.on(`flush`,e=>{e.forEach(h)}),this.runningCommand.on(`stdout`,e=>{o.type===`file`?p._streamedStdout||(p.stdOut=String(e??``)):o.type===`stderr`?this.stderr.write(e):o.type===`null`||(this.stdout.write(e),this.emit(`stdOutRaw`,e))}),this.runningCommand.on(`token`,e=>{this.emit(`token`,e)}),this.runningCommand.on(`stderr`,e=>{s.type===`file`?p.stdErr=String(e??``):s.type===`stdout`?o.type===`file`?p.stdOut=String(e??``):o.type===`null`||(this.stdout.write(e),this.emit(`stdOutRaw`,e)):s.type===`null`||this.stderr.write(e)})),p.interactive&&this.emit(`interactive`),p.runCommand().then(e=>{e.getStdOutput().forEach(h);for(let e of[o,s])e.type===`file`&&e.file!==`/dev/null`&&!m.has(e.file)&&m.set(e.file,{append:e.append,lines:[]});for(let[e,{append:t,lines:n}]of m){let r=this.context.fs.absolutePath(e),i=n.join(`
|
|
27
27
|
`),o=i;if(t){let e=this.context.fs._getFileRaw(r);o=typeof e==`string`&&e.length>0?e+`
|
|
28
28
|
`+i:i}try{this.context.fs.setFileByPath(r,o,!0)}catch{this.emit(`stdErr`,`${e}: Permission denied`),this.lastCode=+!a,this.emit(`exitCode`,this.lastCode),delete this.runningCommand;return}}let t=e.getExitCode();this.lastCode=a?+(t===0):t,this.emit(`exitCode`,this.lastCode),delete this.runningCommand})}_handleCommandError(e,t,n){if(t.type===`stdout`)this.emit(`stdOut`,e);else if(t.type===`file`){if(t.file!==`/dev/null`)try{let n=this.context.fs.absolutePath(t.file),r=this.context.fs._getFileRaw(n),i=t.append&&typeof r==`string`&&r.length>0?r+`
|