brsh 2.5.6 → 2.7.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.
@@ -0,0 +1,24 @@
1
+ "use strict";var Wbt=(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=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)}})),r=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}}})),i=t(((e,t)=>{var n=r();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}}})),a=t(((e,t)=>{var r=n(),a=i(),o=r.EventEmitter||r.default||r;t.exports=class extends o{constructor(e,t){super(),this.arguments=e,this.result=new a,this.context=t||null}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())}}})),o=t(((e,t)=>{var n=a();t.exports=class extends n{constructor(e,t){super(e,t)}}}));function s(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 c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,n=s(e),r=n[0],i=n[1],a=new v(l(e,r,i)),o=0,c=i>0?r-4:r,u;for(u=0;u<c;u+=4)t=_[e.charCodeAt(u)]<<18|_[e.charCodeAt(u+1)]<<12|_[e.charCodeAt(u+2)]<<6|_[e.charCodeAt(u+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=_[e.charCodeAt(u)]<<2|_[e.charCodeAt(u+1)]>>4,a[o++]=t&255),i===1&&(t=_[e.charCodeAt(u)]<<10|_[e.charCodeAt(u+1)]<<4|_[e.charCodeAt(u+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function d(e){return g[e>>18&63]+g[e>>12&63]+g[e>>6&63]+g[e&63]}function f(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(d(r));return i.join(``)}function p(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,s=n-r;o<s;o+=a)i.push(f(e,o,o+a>s?s:o+a));return r===1?(t=e[n-1],i.push(g[t>>2]+g[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(g[t>>10]+g[t>>4&63]+g[t<<2&63]+`=`)),i.join(``)}var m,h,g,_,v,y,b,x,S,C,w=e((()=>{for(m={},h={},h.byteLength=c,h.toByteArray=u,h.fromByteArray=p,g=[],_=[],v=typeof Uint8Array<`u`?Uint8Array:Array,y=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,b=0,x=y.length;b<x;++b)g[b]=y[b],_[y.charCodeAt(b)]=b;_[45]=62,_[95]=63,S={},S.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)},S.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=h,n=S,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=u,e.SlowBuffer=C,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i;let{Uint8Array:a,ArrayBuffer:o,SharedArrayBuffer:s}=globalThis;u.TYPED_ARRAY_SUPPORT=c(),!u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.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,u.prototype),t}function u(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 m(e)}return d(e,t,n)}u.poolSize=8192;function d(e,t,n){if(typeof e==`string`)return g(e,t);if(o.isView(e))return v(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(Q(e,o)||e&&Q(e.buffer,o)||s!==void 0&&(Q(e,s)||e&&Q(e.buffer,s)))return y(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 u.from(r,t,n);let i=b(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return u.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)}u.from=function(e,t,n){return d(e,t,n)},Object.setPrototypeOf(u.prototype,a.prototype),Object.setPrototypeOf(u,a);function f(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 p(e,t,n){return f(e),e<=0||t===void 0?l(e):typeof n==`string`?l(e).fill(t,n):l(e).fill(t)}u.alloc=function(e,t,n){return p(e,t,n)};function m(e){return f(e),l(e<0?0:x(e)|0)}u.allocUnsafe=function(e){return m(e)},u.allocUnsafeSlow=function(e){return m(e)};function g(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!u.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 _(e){let t=e.length<0?0:x(e.length)|0,n=l(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function v(e){if(Q(e,a)){let t=new a(e);return y(t.buffer,t.byteOffset,t.byteLength)}return _(e)}function y(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,u.prototype),r}function b(e){if(u.isBuffer(e)){let t=x(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`||de(e.length)?l(0):_(e);if(e.type===`Buffer`&&Array.isArray(e.data))return _(e.data)}function x(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),u.alloc(+e)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype},u.compare=function(e,t){if(Q(e,a)&&(e=u.from(e,e.offset,e.byteLength)),Q(t,a)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.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)},u.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}},u.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return u.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,a))i+t.length>r.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(r,i)):a.prototype.set.call(r,t,i);else if(u.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(u.isBuffer(e))return e.length;if(o.isView(e)||Q(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 oe(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return le(e).length;default:if(i)return r?-1:oe(e).length;t=(``+t).toLowerCase(),i=!0}}u.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}}u.prototype._isBuffer=!0;function E(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}u.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},u.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},u.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},u.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?F(this,0,e):T.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:u.compare(this,e)===0},u.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&&(u.prototype[r]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,i){if(Q(e,a)&&(e=u.from(e,e.offset,e.byteLength)),!u.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),d=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==d[e]){o=l[e],s=d[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,de(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=u.from(t,r)),u.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}u.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},u.prototype.indexOf=function(e,t,n){return D(this,e,t,n,!0)},u.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(de(r))return o;e[n+o]=r}return o}function A(e,t,n,r){return ue(oe(t,e.length-n),e,n,r)}function j(e,t,n,r){return ue(se(t),e,n,r)}function M(e,t,n,r){return ue(le(t),e,n,r)}function N(e,t,n,r){return ue(ce(t,e.length-n),e,n,r)}u.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}},u.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+=fe[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}u.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,u.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`)}u.prototype.readUintLE=u.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},u.prototype.readUintBE=u.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},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||H(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.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},u.prototype.readUint32BE=u.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])},u.prototype.readBigUInt64LE=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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))}),u.prototype.readBigUInt64BE=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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)}),u.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},u.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},u.prototype.readInt8=function(e,t){return e>>>=0,t||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},u.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},u.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},u.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},u.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]},u.prototype.readBigInt64LE=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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)}),u.prototype.readBigInt64BE=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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)}),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||H(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||H(e,8,this.length),n.read(this,e,!0,52,8)},u.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(!u.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`)}u.prototype.writeUintLE=u.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},u.prototype.writeUintBE=u.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},u.prototype.writeUint8=u.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},u.prototype.writeUint16LE=u.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},u.prototype.writeUint16BE=u.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},u.prototype.writeUint32LE=u.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},u.prototype.writeUint32BE=u.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){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 G(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}u.prototype.writeBigUInt64LE=$(function(e,t=0){return W(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.prototype.writeBigUInt64BE=$(function(e,t=0){return G(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.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},u.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},u.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},u.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},u.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},u.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},u.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},u.prototype.writeBigInt64LE=$(function(e,t=0){return W(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),u.prototype.writeBigInt64BE=$(function(e,t=0){return G(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function K(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ee(e,t,r,i,a){return t=+t,r>>>=0,a||K(e,t,r,4),n.write(e,t,r,i,23,4),r+4}u.prototype.writeFloatLE=function(e,t,n){return ee(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return ee(this,e,t,!1,n)};function te(e,t,r,i,a){return t=+t,r>>>=0,a||K(e,t,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.writeDoubleLE=function(e,t,n){return te(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return te(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.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},u.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`&&!u.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=u.isBuffer(e)?e:u.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){X(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&Z(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 X(e,t){if(typeof e!=`number`)throw new q.ERR_INVALID_ARG_TYPE(t,`number`,e)}function Z(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):(X(e,n),new q.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ie=/[^+/0-9A-Za-z-_]/g;function ae(e){if(e=e.split(`=`)[0],e=e.trim().replace(ie,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function oe(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 se(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ce(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 le(e){return t.toByteArray(ae(e))}function ue(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 Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function de(e){return e!==e}let fe=(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 $(e){return typeof BigInt>`u`?pe:e}function pe(){throw Error(`BigInt not supported`)}})(m),C=m.Buffer,m.Blob,m.BlobOptions,m.Buffer,m.File,m.FileOptions,m.INSPECT_MAX_BYTES,m.SlowBuffer,m.TranscodeEncoding,m.atob,m.btoa,m.constants,m.isAscii,m.isUtf8,m.kMaxLength,m.kStringMaxLength,m.resolveObjectURL,m.transcode})),T=t(((e,t)=>{var n=o();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.fs.isRealFilesystem?{useRealFilesystem:!0}:{filesystem:this.context.fs.getRaw(),permissions:this.context.fs.getRawPermissions()};this.sandbox=new globalThis.shell({cwd:this.context.fs.cwd,...e,subshell:!0}),this.sandbox.context.source(this.context),this.sandbox.on(`stdOut`,e=>{this.stdOut=e,this.flush()}),this.sandbox.on(`stdErr`,e=>{this.stdErr=e,this.flush()}),this._scriptFunctions={};let t=this.script.split(/\r?\n/);if(!r(t[0])){let e=t[0].startsWith(`#!`)?t[0].slice(2).split(/\s/)[0]:t[0];return Promise.reject(`${e}: bad interpreter: No such file or directory`)}let n=this._parseLines(t.slice(1));return this._executeNodes(n).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)})}_parseLines(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=o(),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})),E=t(((e,t)=>{var n=new Set([`getFileByPath`,`setFileByPath`,`deleteFileByPath`,`exists`,`stat`,`absolutePath`,`getMode`,`setMode`,`isReadable`,`isWritable`,`isExecutable`,`getSize`,`autoComplete`,`isRealFilesystem`,`isSymlink`,`readSymlink`,`createSymlink`]);t.exports=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())}))}}}));function D(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function O(){throw Error(`setTimeout has not been defined`)}function k(){throw Error(`clearTimeout has not been defined`)}function A(e){if(R===setTimeout)return setTimeout(e,0);if((R===O||!R)&&setTimeout)return R=setTimeout,setTimeout(e,0);try{return R(e,0)}catch{try{return R.call(null,e,0)}catch{return R.call(this,e,0)}}}function j(e){if(z===clearTimeout)return clearTimeout(e);if((z===k||!z)&&clearTimeout)return z=clearTimeout,clearTimeout(e);try{return z(e)}catch{try{return z.call(null,e)}catch{return z.call(this,e)}}}function M(){!V||!H||(V=!1,H.length?B=H.concat(B):U=-1,B.length&&N())}function N(){if(!V){var e=A(M);V=!0;for(var t=B.length;t;){for(H=B,B=[];++U<t;)H&&H[U].run();U=-1,t=B.length}H=null,V=!1,j(e)}}function P(e,t){this.fun=e,this.array=t}function F(){}var I,L,R,z,B,V,H,U,W,G,K=e((()=>{I={exports:{}},L=I.exports={},(function(){try{R=typeof setTimeout==`function`?setTimeout:O}catch{R=O}try{z=typeof clearTimeout==`function`?clearTimeout:k}catch{z=k}})(),B=[],V=!1,U=-1,L.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];B.push(new P(e,t)),B.length===1&&!V&&A(N)},P.prototype.run=function(){this.fun.apply(null,this.array)},L.title=`browser`,L.browser=!0,L.env={},L.argv=[],L.version=``,L.versions={},L.on=F,L.addListener=F,L.once=F,L.off=F,L.removeListener=F,L.removeAllListeners=F,L.emit=F,L.prependListener=F,L.prependOnceListener=F,L.listeners=function(e){return[]},L.binding=function(e){throw Error(`process.binding is not supported`)},L.cwd=function(){return`/`},L.chdir=function(e){throw Error(`process.chdir is not supported`)},L.umask=function(){return 0},W=I.exports,G=D(W)})),ee=t(((e,t)=>{var n=a();t.exports=class extends n{get captureInput(){return!0}get interactive(){return!0}get terminalSize(){return{cols:parseInt(this.context.getVar(`COLUMNS`),10)||80,rows:parseInt(this.context.getVar(`LINES`),10)||24}}}})),te=t(((e,t)=>{w(),K();var{BinaryFile:n,SymlinkRef:r}=q(),i=new Uint8Array([66,82,70,83]),o=2;function s(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 c(e={},t={},n={}){let a=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||C!==void 0&&C.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(C!==void 0)a=new Uint8Array(C.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(a.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(a.encode(n.commandsBundle)));let m={v:o,tree:f,permissions:Object.assign({},t)};p&&(m.commandsSlice=p),Object.keys(u).length>0&&(m.inlineCommands=u);let h=a.encode(JSON.stringify(m)),g=12+h.byteLength+c,_=new Uint8Array(g);_.set(i,0);let v=new DataView(_.buffer,_.byteOffset,_.byteLength);v.setUint32(4,o,!0),v.setUint32(8,h.byteLength,!0),_.set(h,12);let y=12+h.byteLength;for(let e of s)_.set(e,y),y+=e.byteLength;return _}function l(e,t={}){let i=e instanceof Uint8Array?e:new Uint8Array(e.buffer||e,e.byteOffset||0,e.byteLength);if(!s(i))throw Error(`Invalid BRFS binary container (missing BRFS magic header)`);let c=new DataView(i.buffer,i.byteOffset,i.byteLength),l=c.getUint32(4,!0);if(l>o)throw Error(`Unsupported BRFS container version: ${l}`);let u=12+c.getUint32(8,!0);if(u>i.byteLength)throw Error(`Corrupt BRFS binary container (header length exceeds buffer)`);let d=new TextDecoder,f=d.decode(i.subarray(12,u)),p=JSON.parse(f),m=i.subarray(u),h=Object.assign({},t);if(Array.isArray(p.commandsSlice)){let[e,t]=p.commandsSlice,n=d.decode(m.subarray(e,e+t));try{let e=Function(n)();e&&typeof e==`object`&&Object.assign(h,e)}catch{}}let g=e=>{if(!e||typeof e!=`object`)return e;if(`$t`in e){let[t,n]=e.$t;return d.decode(m.subarray(t,t+n))}if(`$b`in e){let[t,r,i]=e.$b;return new n(m.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(h[t])return h[t];if(p.inlineCommands&&p.inlineCommands[t])try{let e=a(),n=ee();return Function(`Command`,`InteractiveCommand`,`return (${p.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=g(r);e!==null&&(t[n]=e)}return t}return e};return{filesystem:g(p.tree)||{},permissions:Object.assign({},p.permissions||{})}}function u(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 d(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(G!==void 0&&typeof G.getBuiltinModule==`function`){let t=G.getBuiltinModule(`zlib`);if(t)return new Uint8Array(t.gunzipSync(C.from(e.buffer,e.byteOffset,e.byteLength)))}throw Error(`Gzip decompression is not supported in this environment`)}function f(e){return e?!!(typeof e==`string`||typeof e.then==`function`||typeof e.arrayBuffer==`function`||u(e)):!1}async function p(e,t={}){if(!e)return{filesystem:{},permissions:t};if(typeof e.then==`function`)return p(await e,t);if(typeof e.arrayBuffer==`function`){let n=await e.arrayBuffer();return p(new Uint8Array(n),t)}if(typeof e==`string`){if(!/^https?:\/\//i.test(e)&&G!==void 0&&typeof G.getBuiltinModule==`function`&&typeof window>`u`)try{let n=G.getBuiltinModule(`fs`);if(n&&n.existsSync(e)){let r=await n.promises.readFile(e);return p(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 p(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(u(n)&&(n=await d(n)),s(n)){let e=l(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`?f(e.filesystem)||s(e.filesystem)?p(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:o,isBinaryContainer:s,isGzipBytes:u,isAsyncFilesystemSource:f,resolveFilesystemSource:p,serializeBinaryFilesystem:c,deserializeBinaryFilesystem:l,FilesystemStorage:class{static async save(e,t=`brsh-rootfs`){let n=e.context?e.context.fs:e,r=c(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 p(e);if(typeof indexedDB<`u`&&typeof e==`string`){let t=await this._idbGet(e);if(t&&s(t))return l(t)}return null}static async loadOrFetch(e=`brsh-rootfs`,t={}){return await this.load(e)||p(t)}static createAutoSave(e=`brsh-rootfs`,t=null){return(n,r)=>{let i=c(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)=>{w();var n=E(),r=class extends Uint8Array{constructor(e,t){super(e),Object.defineProperty(this,"mimeType",{value:t,enumerable:!1,configurable:!1,writable:!1})}toString(){if(C!==void 0)return`data:${this.mimeType};base64,${C.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)}`}},i=class{constructor(e){this.target=e}};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(C!==void 0)c=new Uint8Array(C.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}=te(),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}=te(),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,this._onChange=r,this._changeScheduled=!1}toBinaryContainer(e={}){let{serializeBinaryFilesystem:t}=te();return t(this.fileSystem,this.permissions,e)}static fromBinaryContainer(e,t={}){let{deserializeBinaryFilesystem:n}=te();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+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})),ne=t(((e,t)=>{t.exports=null})),re=t(((e,t)=>{K();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=G.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})),J=t(((e,t)=>{w();var n=T(),{BinaryFile:r}=q(),i=0,a=8,s=20,c=28,l=31,u=44,d=54,f=70,p=0,m=2,h=3,g=4,_=1,v=2,y=4,b=8,x=1,S=class extends n{get name(){return`wasm`}get requiresFilesystem(){return!0}run(){let e=this.script,t=(()=>{try{return ne()}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){if(this.context.fs.isRealFilesystem&&t)try{let n=t.readFileSync(this.context.fs.absolutePath(e)),r=new Uint8Array(n);return Promise.resolve({bytes:r,isWat:this._isWat(e,r)})}catch(t){return Promise.reject(Error(`${e}: ${t.message}`))}let n=this.context.fs.getFileByPath(e);if(n==null)return Promise.reject(Error(`${e}: No such file or directory`));let r=this._contentToBytes(n);return Promise.resolve({bytes:r,isWat:this._isWat(e,r)})}_isWat(e,t){return e.endsWith(`.wat`)?!0:t.length>0&&t[0]===40}_contentToBytes(e){if(e instanceof Uint8Array)return e;if(C!==void 0&&C.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,o=new TextEncoder,S=null,C=(e,n)=>{t[e]=(t[e]||``)+n;let r=t[e].split(`
2
+ `);t[e]=r.pop();for(let t of r)e===1?this.stdOut=t:this.stdErr=t},w=()=>{t[1]&&=(this.stdOut=t[1],``),t[2]&&=(this.stdErr=t[2],``)},T=o.encode(this.stdin||``),E=0,D=this.context&&this.context.fs?this.context.fs:this.fs,O=5,k=new Map([[3,{type:`preopen`,path:`/`,guestName:`/`}],[4,{type:`preopen`,path:D&&D.cwd||`/`,guestName:`.`}]]),A=(e,t)=>{let n=k.get(e);if(!n||n.type!==`preopen`&&n.type!==`dir`)return null;if(t.startsWith(`/`))return D.absolutePath(t);let r=n.path.endsWith(`/`)?n.path:n.path+`/`;return D.absolutePath(r+t)},N=e=>{if(!(!e||e.type!==`file`||!e.dirty||!D))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);D.setFileByPath(e.path,t,!0)}else{let t=new Uint8Array(e.bytes.length);t.set(e.bytes),D.setFileByPath(e.path,new r(t.buffer,`application/octet-stream`),!0)}e.dirty=!1}catch{}},P=Object.entries(this.context&&this.context.vars||{}).map(([e,t])=>`${e}=${t}`),F=new Proxy({fd_write:(e,t,r,o)=>{if(!S)return a;let s=new DataView(S.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&&C(e,n.decode(new Uint8Array(S.buffer,r,o))),a+=o}return s.setUint32(o,a,!0),i}let c=k.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(S.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(!S)return a;let o=new DataView(S.buffer);if(e===0){let e=0;for(let r=0;r<n&&E<T.length;r++){let n=o.getUint32(t+r*8,!0),i=o.getUint32(t+r*8+4,!0),a=Math.min(i,T.length-E);new Uint8Array(S.buffer).set(T.slice(E,E+a),n),E+=a,e+=a}return o.setUint32(r,e,!0),i}let s=k.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(S.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(!S)return a;if(e<=2)return f;let s=k.get(e);if(!s||s.type!==`file`)return a;let l,u,d;typeof t==`bigint`?(l=Number(t),u=n,d=r):(l=t,u=r,d=o);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(S.buffer).setBigUint64(d,BigInt(s.pos),!0),i)},fd_tell:(e,t)=>{if(!S)return a;let n=k.get(e);return!n||n.type!==`file`?a:(new DataView(S.buffer).setBigUint64(t,BigInt(n.pos),!0),i)},fd_close:e=>{if(e<=2)return i;let t=k.get(e);return t?(N(t),k.delete(e),i):a},fd_sync:e=>{let t=k.get(e);return t&&N(t),i},fd_datasync:e=>{let t=k.get(e);return t&&N(t),i},fd_prestat_get:(e,t)=>{if(!S)return a;let n=k.get(e);if(!n||n.type!==`preopen`)return a;let r=new DataView(S.buffer),s=o.encode(n.guestName);return r.setUint8(t,0),r.setUint32(t+4,s.length,!0),i},fd_prestat_dir_name:(e,t,n)=>{if(!S)return a;let r=k.get(e);if(!r||r.type!==`preopen`)return a;let s=o.encode(r.guestName);return new Uint8Array(S.buffer,t,Math.min(n,s.length)).set(s.subarray(0,n)),i},fd_fdstat_get:(e,t)=>{if(!S)return a;let n=new DataView(S.buffer),r=p;if(e<=2)r=m;else{let t=k.get(e);if(!t)return a;r=t.type===`preopen`||t.type===`dir`?h:g}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(!S)return a;let n=new DataView(S.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=k.get(e);if(!r)return a;let o=r.type===`preopen`||r.type===`dir`;return n.setUint8(t+16,o?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,c,f,p,m,h,g)=>{if(!S||!D)return a;let C=A(e,n.decode(new Uint8Array(S.buffer,r,c)));if(!C)return a;let w=D.stat(C),T=w!==null;if(f&y&&f&_&&T)return s;if(f&v){if(!T)return u;if(!w.isDirectory)return d;let e=O++;return k.set(e,{type:`dir`,path:C}),new DataView(S.buffer).setUint32(g,e,!0),i}if(T&&w.isDirectory)return l;if(!T&&!(f&_))return u;let E=new Uint8Array,j=!1;if(T&&!(f&b)){let e=D.getFileByPath(C);e!=null&&(E=typeof e==`string`?o.encode(e):new Uint8Array(this._contentToBytes(e)))}else j=!0;let M=O++;return k.set(M,{type:`file`,path:C,bytes:E,pos:h&x?E.length:0,append:!!(h&x),dirty:j}),new DataView(S.buffer).setUint32(g,M,!0),i},path_filestat_get:(e,t,r,o,s)=>{if(!S||!D)return a;let c=A(e,n.decode(new Uint8Array(S.buffer,r,o)));if(!c)return a;let l=D.stat(c);if(!l)return u;let d=new DataView(S.buffer);for(let e=0;e<64;e++)d.setUint8(s+e,0);return d.setUint8(s+16,l.isDirectory?h:g),d.setBigUint64(s+24,1n,!0),d.setBigUint64(s+32,BigInt(D.getSize(c)||0),!0),i},path_create_directory:(e,t,r)=>{if(!S||!D)return a;let o=A(e,n.decode(new Uint8Array(S.buffer,t,r)));if(!o)return a;try{return D.setFileByPath(o,{},!0),i}catch{return c}},path_unlink_file:(e,t,r)=>{if(!S||!D)return a;let o=A(e,n.decode(new Uint8Array(S.buffer,t,r)));if(!o||!D.exists(o))return u;try{return D.deleteFileByPath(o),i}catch{return c}},path_remove_directory:(e,t,r)=>{if(!S||!D)return a;let o=A(e,n.decode(new Uint8Array(S.buffer,t,r)));if(!o||!D.exists(o))return u;try{return D.deleteFileByPath(o),i}catch{return c}},proc_exit:e=>{throw e!==0&&(this.exitCode=e),{_wasmExit:!0,code:e}},args_sizes_get:(e,t)=>{if(!S)return c;let n=[this.script,...this.arguments||[]],r=new DataView(S.buffer);return r.setUint32(e,n.length,!0),r.setUint32(t,n.reduce((e,t)=>e+o.encode(t).length+1,0),!0),i},args_get:(e,t)=>{if(!S)return c;let n=[this.script,...this.arguments||[]],r=new DataView(S.buffer),a=t;for(let t=0;t<n.length;t++){r.setUint32(e+t*4,a,!0);let i=o.encode(n[t]+`\0`);new Uint8Array(S.buffer).set(i,a),a+=i.length}return i},environ_sizes_get:(e,t)=>{if(!S)return c;let n=new DataView(S.buffer);n.setUint32(e,P.length,!0);let r=P.reduce((e,t)=>e+o.encode(t).length+1,0);return n.setUint32(t,r,!0),i},environ_get:(e,t)=>{if(!S)return c;let n=new DataView(S.buffer),r=t;for(let t=0;t<P.length;t++){n.setUint32(e+t*4,r,!0);let i=o.encode(P[t]+`\0`);new Uint8Array(S.buffer).set(i,r),r+=i.length}return i},clock_time_get:(e,t,n)=>{if(S){let e=BigInt(Date.now())*1000000n;new DataView(S.buffer).setBigUint64(n,e,!0)}return i},random_get:(e,t)=>{if(S){let n=new Uint8Array(S.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}}),I=e=>{if(!S||!e)return``;try{let t=new DataView(S.buffer).getUint32(e-4,!0),n=new Uint16Array(S.buffer,e,t>>>1);return String.fromCharCode(...n)}catch{return``}},L={wasi_snapshot_preview1:F,wasi_unstable:F,env:new Proxy({print:(e,t)=>{S&&C(1,n.decode(new Uint8Array(S.buffer,e,t)))},eprint:(e,t)=>{S&&C(2,n.decode(new Uint8Array(S.buffer,e,t)))},log:e=>{C(1,I(e)+`
3
+ `)},logi:e=>{C(1,String(e)+`
4
+ `)},logf:e=>{C(1,String(e)+`
5
+ `)},trace:(e,t,...n)=>{let r=t>0?` `+n.slice(0,t).join(`, `):``;C(1,`trace: ${I(e)}${r}\n`)},seed:()=>Date.now()*Math.random(),abort:(e,t,n,r)=>{let i=I(e),a=I(t);throw(i||a)&&C(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});S=t,L[e.module]||(L[e.module]={}),L[e.module][e.name]=t}let n=await WebAssembly.instantiate(t,L);n.exports.memory&&(S=n.exports.memory);let r=n.exports._start||n.exports.__wasi_command||n.exports.main||n.exports.run;if(r)try{await r()}catch(e){(!e||!e._wasmExit)&&(this.stdErr=`${this.script}: runtime error: ${e?.message||String(e)}`,this.exitCode=1)}else{let e=Object.entries(n.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{for(let e of k.values())N(e)}w();let R=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(R.includes(`--help`)||R.includes(`-h`)){let r=j(e);for(let e of M(t,n,r))this.stdOut=e}else (R.includes(`--version`)||R.includes(`-V`)||R.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=ne();return new Uint8Array(n.readFileSync(e.absolutePath(t)))}catch{return null}let n=e.getFileByPath(t);if(n==null)return null;if(n instanceof Uint8Array||C!==void 0&&C.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(C!==void 0)return new Uint8Array(C.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);if(e.isRealFilesystem){let n=ne(),r=re(),i=e.absolutePath(t);n.mkdirSync(r.dirname(i),{recursive:!0}),n.writeFileSync(i,C.from(a.buffer,a.byteOffset,a.byteLength));return}let o=new Uint8Array(a.byteLength);o.set(a);let s=new r(o.buffer,i);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){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;for(let e of r)!n.usage&&/^usage:\s*(.+)/i.test(e)?n.usage=e.replace(/^usage:\s*/i,``).trim():/^(?:-[a-zA-Z0-9?]|--[a-zA-Z0-9][-a-zA-Z0-9]*)(?:\s|,|=|<|\[|$)/.test(e)&&e.length<=120&&!/^(?:-[hHvV],\s*)?--(?:help|version)\b/i.test(e)&&(i.has(e)||(i.add(e),n.options.push(e)));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(`
6
+ `),!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=o?`${e} [options] ${o.evalFlag?`[${o.evalFlag} <code>] `:``}[file] [args...]`:`${e} [options] [args...]`,l=[`${e} (${r} ${i} wasm) — ${a}`,`Usage: ${s||c}`];t.details&&l.push(``,t.details),l.push(``,`Options:`);let u=n&&n.options&&n.options.length>0?n.options:Array.isArray(t.options)?t.options:[];if(u.length>0)for(let e of u)l.push(` ${e}`);else o&&(o.evalFlag&&l.push(` ${o.evalFlag.padEnd(20)}Evaluate inline code and print result`),l.push(` (no arguments) Start interactive ${e} REPL shell`));return l.push(` -h, --help Show this help message and exit`),l.push(` -V, --version Show WebAssembly binary version and exit`),n&&n.exports&&n.exports.length>0&&l.push(``,`WASM Exports: ${n.exports.join(`, `)}`),Array.isArray(t.aliases)&&t.aliases.length>0&&l.push(``,`Aliases: ${t.aliases.join(`, `)}`),(t.homepage||t.cdnUrl||t.wasmUrl)&&l.push(`Source: ${t.homepage||t.cdnUrl||t.wasmUrl}`),l}function N(e,t={},n=null){let r=o(),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;try{if(e.type===`wasm`&&e.wasmUrl&&!t.moduleLoader){let t=await this._fetchWasmBytes(e.wasmUrl);r&&(this._inspectedWasm=j(t)),await this._runRawWasmBytes(t,n)}else{let o=e.cdnUrl||e.wasmUrl||`https://esm.sh/${e.name}`,s=await k(e.name,o,t.moduleLoader),c=s&&s.default!==void 0?s.default:s;if(c instanceof Uint8Array||c instanceof ArrayBuffer){let e=c instanceof Uint8Array?c:new Uint8Array(c);r&&(this._inspectedWasm=j(e)),await this._runRawWasmBytes(e,n)}else if(c&&(c.wasmBytes instanceof Uint8Array||c.wasm instanceof Uint8Array)){let e=c.wasmBytes||c.wasm;r&&(this._inspectedWasm=j(e)),await this._runRawWasmBytes(e,n)}else if(typeof c==`function`)await this._runFunctionOrEmscripten(c,n,r);else if(c&&typeof c==`object`){c.ready&&await c.ready,r&&(c.HEAPU8 instanceof Uint8Array||c.wasmBinary instanceof Uint8Array)&&(this._inspectedWasm=j(c.wasmBinary||c.HEAPU8));let t=c.main||c.run||c.callMain||c.exec;if(typeof t==`function`)await this._invokeCliFunction(t.bind(c),n);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(`
7
+ `),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 S(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(e,t,n){let r=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:e,stdin:this.stdin!==void 0&&this.stdin!==null?String(this.stdin):``,fs:this.fs,context:this.context,stdout:Object.assign(e=>t.push(String(e)),r(t)),stderr:Object.assign(e=>n.push(String(e)),r(n)),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(e,t,n=!1){let r=[],i=[],a=new TextEncoder().encode(this.stdin||``),o=0,s=new Set,c={arguments:t,noInitialRun:!0,print:e=>{r.push(String(e))},printErr:e=>{i.push(String(e))},stdin:()=>o<a.length?a[o++]:null,preRun:[e=>{e&&e.FS&&(s=this._syncBrshToEmscriptenFs(e.FS,t))}]},l=this._createIoBridge(t,r,i),u;try{u=e.prototype&&e.prototype.constructor===e&&Object.getOwnPropertyNames(e.prototype).length>1?new e(c,l):await e(c,l)}catch(e){if(e&&typeof e.status==`number`)this.exitCode=e.status;else throw e}if(u&&typeof u==`object`)if(n&&(u.wasmBinary instanceof Uint8Array||u.HEAPU8 instanceof Uint8Array)&&(this._inspectedWasm=j(u.wasmBinary||u.HEAPU8)),typeof u.callMain==`function`){u.FS&&s.size===0&&(s=this._syncBrshToEmscriptenFs(u.FS,t));try{let e=await u.callMain(t);typeof e==`number`&&e!==0&&(this.exitCode=e)}catch(e){e&&typeof e.status==`number`?this.exitCode=e.status:(i.push(e.message||String(e)),this.exitCode=1)}u.FS&&this._syncEmscriptenFsToBrsh(u.FS,t,s)}else if(typeof u.exec==`function`&&typeof u.writeFile==`function`)await this._runVirtualFsInstance(u,t,r,i);else if(typeof u.main==`function`||typeof u.run==`function`){let e=(u.main||u.run).bind(u);await this._invokeCliFunction(e,t,r,i)}else typeof u.stdout==`string`&&u.stdout&&u.stdout.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>r.push(e)),typeof u.stderr==`string`&&u.stderr&&u.stderr.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>i.push(e)),u.error&&i.length===0&&(i.push(u.error.message||String(u.error)),this.exitCode=1),typeof u.exitCode==`number`&&(this.exitCode=u.exitCode);else typeof u==`string`?u.replace(/\r?\n$/,``).split(/\r?\n/).forEach(e=>r.push(e)):typeof u==`number`&&(this.exitCode=u);r.forEach(e=>{this.stdOut=e}),i.forEach(e=>{this.stdErr=e})}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}S.readBytesFromFs=D,S.writeBytesToFs=O,S.loadModule=k,S.extractHelpFromText=A,S.inspectWasmBytes=j,S.formatWasmHelp=M,S.createGenericWasmCommand=N,S.createCommand=N,t.exports=S})),Y=t(((e,t)=>{var n=ee(),{createGenericWasmCommand:r}=J(),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,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}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._replStatus=`^D / .exit: Quit | ^L: Clear | Up/Down: History`,e){if(e.clear&&(this._replLog=[]),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===`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(`
8
+ `);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(`
9
+ `):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})),X=t(((e,t)=>{var n={pglite:{name:`pglite`,bin:`pglite`,aliases:[`psql`,`pg_ctl`],version:`0.2.17`,description:`Lightweight WASM Postgres database & daemon in the browser and Node`,details:"PGlite is a WASM build of PostgreSQL packaged into a client-side library that runs a full Postgres database in memory, persisted to the brsh filesystem, or as a background server daemon (`pglite serve` / `pg_ctl start`).",homepage:`https://pglite.dev`,cdnUrl:`https://esm.sh/@electric-sql/pglite@0.2.17`,type:`builtin-adapter`,adapter:`pglite`,size:`3.1 MB`},sqlite3:{name:`sqlite3`,bin:`sqlite3`,aliases:[`sqlite`],version:`1.13.0`,description:`SQLite compiled to WebAssembly (via sql.js) with filesystem persistence`,details:`SQLite3 WASM allows creating, querying, and modifying SQLite database files directly in the brsh filesystem. Supports interactive SQL shell, piped SQL input, and one-shot queries.`,homepage:`https://sql.js.org`,cdnUrl:`https://esm.sh/sql.js@1.13.0`,wasmUrl:`https://cdn.jsdelivr.net/npm/sql.js@1.13.0/dist/sql-wasm.wasm`,type:`generic-runtime`,repl:{prompt:`sqlite> `,sessionArg:!0},size:`680 KB`},assemblyscript:{name:`assemblyscript`,bin:`asc`,aliases:[`asrun`,`asnode`,`assemblyscript`],version:`0.27.31`,description:`AssemblyScript compiler (asc) and JIT/AOT runtime runner (asrun / asnode)`,details:"AssemblyScript compiles a strict variant of TypeScript to WebAssembly. Includes `asc` (ahead-of-time compiler to .wasm/.wat) and `asrun` / `asnode`.",homepage:`https://www.assemblyscript.org`,cdnUrl:`https://esm.sh/assemblyscript@0.27.31/asc`,type:`generic-runtime`,repl:{prompt:`as> `,evalFlag:`-e`},size:`1.4 MB`},jq:{name:`jq`,bin:`jq`,aliases:[],version:`1.7.1`,description:`Command-line JSON processor compiled to WebAssembly (jq-web)`,details:`jq is like sed for JSON data — you can use it to slice, filter, map, and transform structured JSON data from files or piped standard input.`,homepage:`https://jqlang.github.io/jq/`,cdnUrl:`https://esm.sh/jq-web@0.5.3`,type:`generic-runtime`,size:`620 KB`},python3:{name:`python3`,bin:`python3`,aliases:[`python`,`py`],version:`3.12.1`,description:`CPython 3.12 compiled to WebAssembly (via Pyodide)`,details:"Full Python 3.12 runtime in WebAssembly powered by Pyodide. Supports interactive Python REPL (`>>>`), running `.py` scripts from the brsh filesystem, `-c` inline code evaluation, and piped standard input.",homepage:`https://pyodide.org`,cdnUrl:`https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide.mjs`,indexURL:`https://cdn.jsdelivr.net/pyodide/v0.26.4/full/`,type:`generic-runtime`,repl:{prompt:`>>> `,evalFlag:`-c`},size:`6.4 MB`},duckdb:{name:`duckdb`,bin:`duckdb`,aliases:[],version:`1.29.0`,description:`In-process analytical SQL OLAP database compiled to WebAssembly`,details:`DuckDB-WASM executes analytical SQL queries directly in WebAssembly, including querying CSV and JSON files stored in the brsh filesystem, interactive SQL shell, and one-shot / piped queries.`,homepage:`https://duckdb.org`,cdnUrl:`https://esm.sh/@duckdb/duckdb-wasm@1.29.0`,type:`generic-runtime`,repl:{prompt:`D `,continuePrompt:` > `,evalFlag:`-c`},size:`4.2 MB`},graphviz:{name:`graphviz`,bin:`dot`,aliases:[`graphviz`],version:`1.13.0`,description:"Graphviz graph visualization compiler (`dot`) compiled to WebAssembly",details:"Powered by @hpcc-js/wasm-graphviz. Compiles DOT language graph descriptions (`.dot` / `.gv`) into SVG, DOT, canon, or JSON formats (`dot -Tsvg input.dot -o output.svg`).",homepage:`https://graphviz.org`,cdnUrl:`https://esm.sh/@hpcc-js/wasm-graphviz@1.13.0`,type:`generic-runtime`,size:`1.1 MB`},ffmpeg:{name:`ffmpeg`,bin:`ffmpeg`,aliases:[],version:`0.12.10`,description:`FFmpeg multimedia framework compiled to WebAssembly (@ffmpeg/ffmpeg)`,details:"Record, convert, transcode, and inspect audio, video, and image files directly inside the brsh filesystem using WebAssembly (`ffmpeg -i input.mp4 output.webm`).",homepage:`https://ffmpegwasm.netlify.app`,cdnUrl:`https://esm.sh/@ffmpeg/ffmpeg@0.12.10`,coreUrl:`https://unpkg.com/@ffmpeg/core@0.12.6/dist/esm/ffmpeg-core.js`,type:`generic-runtime`,size:`8.5 MB`},wabt:{name:`wabt`,bin:`wat2wasm`,aliases:[`wasm2wat`],version:`1.0.36`,description:`WebAssembly Binary Toolkit (wat2wasm & wasm2wat)`,details:`WABT provides tools for translating between WebAssembly Text Format (.wat) and the WebAssembly binary format (.wasm), as well as inspecting WASM modules.`,homepage:`https://github.com/WebAssembly/wabt`,cdnUrl:`https://esm.sh/wabt@1.0.36`,type:`generic-runtime`,size:`540 KB`},quickjs:{name:`quickjs`,bin:`qjs`,aliases:[`quickjs`],version:`0.31.0`,description:`Sandboxed QuickJS JavaScript engine compiled to WebAssembly`,details:`QuickJS is a small and embeddable Javascript engine supporting ES2023. Runs JS code and files inside an isolated WebAssembly sandbox.`,homepage:`https://bellard.org/quickjs/`,cdnUrl:`https://esm.sh/quickjs-emscripten@0.31.0`,type:`generic-runtime`,repl:{prompt:`qjs > `,evalFlag:`-e`},size:`820 KB`},lua:{name:`lua`,bin:`lua`,aliases:[],version:`5.4.6`,description:`Lua 5.4 interpreter compiled to WebAssembly (via wasmoon)`,details:"Full Lua 5.4 virtual machine compiled to WebAssembly. Supports interactive REPL, script execution from the brsh filesystem, and `-e` one-liners.",homepage:`https://www.lua.org`,cdnUrl:`https://esm.sh/wasmoon@1.16.0`,type:`generic-runtime`,repl:{prompt:`lua> `,evalFlag:`-e`},size:`410 KB`}},r={sqlite:`sqlite3`,"sqlite-wasm":`sqlite3`,psql:`pglite`,postgres:`pglite`,asc:`assemblyscript`,asrun:`assemblyscript`,asnode:`assemblyscript`,python:`python3`,py:`python3`,pyodide:`python3`,dot:`graphviz`,wat2wasm:`wabt`,wasm2wat:`wabt`,qjs:`quickjs`};function i(e){if(!e)return null;let t=e.toLowerCase();return r[t]||t}t.exports={DEFAULT_REGISTRY:n,PACKAGE_ALIASES:r,resolvePackageName:i}})),Z,ie=e((()=>{Z=globalThis||self})),ae=t((e=>{ie(),e.fetch=i(Z.fetch)&&i(Z.ReadableStream),e.writableStream=i(Z.WritableStream),e.abortController=i(Z.AbortController);var t;function n(){if(t!==void 0)return t;if(Z.XMLHttpRequest){t=new Z.XMLHttpRequest;try{t.open(`GET`,Z.XDomainRequest?`/`:`https://example.com`)}catch{t=null}}else t=null;return t}function r(e){var t=n();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch{}return!1}e.arraybuffer=e.fetch||r(`arraybuffer`),e.msstream=!e.fetch&&r(`ms-stream`),e.mozchunkedarraybuffer=!e.fetch&&r(`moz-chunked-arraybuffer`),e.overrideMimeType=e.fetch||(n()?i(n().overrideMimeType):!1);function i(e){return typeof e==`function`}t=null})),oe=t(((e,t)=>{typeof Object.create==`function`?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),se=t(((e,t)=>{t.exports=n().EventEmitter})),ce=t((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t={},n={};n.byteLength=u,n.toByteArray=f,n.fromByteArray=h;for(var r=[],i=[],a=typeof Uint8Array<`u`?Uint8Array:Array,o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,s=0,c=o.length;s<c;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;i[45]=62,i[95]=63;function l(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 u(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r}function d(e,t,n){return(t+n)*3/4-n}function f(e){var t,n=l(e),r=n[0],o=n[1],s=new a(d(e,r,o)),c=0,u=o>0?r-4:r,f;for(f=0;f<u;f+=4)t=i[e.charCodeAt(f)]<<18|i[e.charCodeAt(f+1)]<<12|i[e.charCodeAt(f+2)]<<6|i[e.charCodeAt(f+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=t&255;return o===2&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,s[c++]=t&255),o===1&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[e&63]}function m(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(p(r));return i.join(``)}function h(e){for(var t,n=e.length,i=n%3,a=[],o=16383,s=0,c=n-i;s<c;s+=o)a.push(m(e,s,s+o>c?c:s+o));return i===1?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+`==`)):i===2&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+`=`)),a.join(``)}var g={};g.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)},g.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=n,r=g,i=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 a=2147483647;e.kMaxLength=a;let{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:c}=globalThis;d.TYPED_ARRAY_SUPPORT=l(),!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 l(){try{let e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.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 u(e){if(e>a)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new o(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 _(e,t);if(s.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(Q(e,s)||e&&Q(e.buffer,s)||c!==void 0&&(Q(e,c)||e&&Q(e.buffer,c)))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,o.prototype),Object.setPrototypeOf(d,o);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?u(e):typeof n==`string`?u(e).fill(t,n):u(e).fill(t)}d.alloc=function(e,t,n){return m(e,t,n)};function h(e){return p(e),u(e<0?0:S(e)|0)}d.allocUnsafe=function(e){return h(e)},d.allocUnsafeSlow=function(e){return h(e)};function _(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=w(e,t)|0,r=u(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=u(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function y(e){if(Q(e,o)){let t=new o(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 o(e):n===void 0?new o(e,t):new o(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function x(e){if(d.isBuffer(e)){let t=S(e.length)|0,n=u(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||de(e.length)?u(0):v(e);if(e.type===`Buffer`&&Array.isArray(e.data))return v(e.data)}function S(e){if(e>=a)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+a.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(Q(e,o)&&(e=d.from(e,e.offset,e.byteLength)),Q(t,o)&&(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(Q(t,o))i+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,i)):o.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(s.isView(e)||Q(e,s))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 oe(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return le(e).length;default:if(i)return r?-1:oe(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+`>`},i&&(d.prototype[i]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,i){if(Q(e,o)&&(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 a=i-r,s=n-t,c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],s=u[e];break}return a<s?-1:+(s<a)};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,de(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 o.prototype.indexOf==`function`?i?o.prototype.indexOf.call(e,t,n):o.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(de(r))return o;e[n+o]=r}return o}function A(e,t,n,r){return ue(oe(t,e.length-n),e,n,r)}function j(e,t,n,r){return ue(se(t),e,n,r)}function M(e,t,n,r){return ue(le(t),e,n,r)}function N(e,t,n,r){return ue(ce(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+=fe[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=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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=$(function(e){e>>>=0,X(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Z(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),r.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||H(e,4,this.length),r.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||H(e,8,this.length),r.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||H(e,8,this.length),r.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){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 G(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=$(function(e,t=0){return W(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=$(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=$(function(e,t=0){return W(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=$(function(e,t=0){return G(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function K(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ee(e,t,n,i,a){return t=+t,n>>>=0,a||K(e,t,n,4),r.write(e,t,n,i,23,4),n+4}d.prototype.writeFloatLE=function(e,t,n){return ee(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return ee(this,e,t,!1,n)};function te(e,t,n,i,a){return t=+t,n>>>=0,a||K(e,t,n,8),r.write(e,t,n,i,52,8),n+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 o.prototype.copyWithin==`function`?this.copyWithin(t,n,r):o.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){X(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&Z(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 X(e,t){if(typeof e!=`number`)throw new q.ERR_INVALID_ARG_TYPE(t,`number`,e)}function Z(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):(X(e,n),new q.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ie=/[^+/0-9A-Za-z-_]/g;function ae(e){if(e=e.split(`=`)[0],e=e.trim().replace(ie,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function oe(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 se(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ce(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 le(e){return t.toByteArray(ae(e))}function ue(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 Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function de(e){return e!==e}let fe=(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 $(e){return typeof BigInt>`u`?pe:e}function pe(){throw Error(`BigInt not supported`)}})(t);var _=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=_,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode})),le=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}})),ue=t(((e,t)=>{var n=le();t.exports=function(){return n()&&!!Symbol.toStringTag}})),Q=t(((e,t)=>{t.exports=Object})),de=t(((e,t)=>{t.exports=Error})),fe=t(((e,t)=>{t.exports=EvalError})),$=t(((e,t)=>{t.exports=RangeError})),pe=t(((e,t)=>{t.exports=ReferenceError})),me=t(((e,t)=>{t.exports=SyntaxError})),he=t(((e,t)=>{t.exports=TypeError})),ge=t(((e,t)=>{t.exports=URIError})),_e=t(((e,t)=>{t.exports=Math.abs})),ve=t(((e,t)=>{t.exports=Math.floor})),ye=t(((e,t)=>{t.exports=Math.max})),be=t(((e,t)=>{t.exports=Math.min})),xe=t(((e,t)=>{t.exports=Math.pow})),Se=t(((e,t)=>{t.exports=Math.round})),Ce=t(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),we=t(((e,t)=>{var n=Ce();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),Te=t(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),Ee=t(((e,t)=>{var n=Te();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),De=t(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),Oe=t(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=le();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),ke=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),Ae=t(((e,t)=>{t.exports=Q().getPrototypeOf||null})),je=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}})),Me=t(((e,t)=>{var n=je();t.exports=Function.prototype.bind||n})),Ne=t(((e,t)=>{t.exports=Function.prototype.call})),Pe=t(((e,t)=>{t.exports=Function.prototype.apply})),Fe=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),Ie=t(((e,t)=>{var n=Me(),r=Pe(),i=Ne();t.exports=Fe()||n.call(i,r)})),Le=t(((e,t)=>{var n=Me(),r=he(),i=Ne(),a=Ie();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),Re=t(((e,t)=>{var n=Le(),r=Ee(),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})),ze=t(((e,t)=>{var n=ke(),r=Ae(),i=Re();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})),Be=t(((e,t)=>{var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=Me().call(n,r)})),Ve=t(((e,t)=>{var n,r=Q(),i=de(),a=fe(),o=$(),s=pe(),c=me(),l=he(),u=ge(),d=_e(),f=ve(),p=ye(),m=be(),h=xe(),g=Se(),_=we(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=Ee(),x=De(),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=Oe()(),T=ze(),E=Ae(),D=ke(),O=Pe(),k=Ne(),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=Me(),I=Be(),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}})),He=t(((e,t)=>{var n=Ve(),r=Le(),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}})),Ue=t(((e,t)=>{var n=ue()(),r=He()(`Object.prototype.toString`),i=function(e){return n&&e&&typeof e==`object`&&Symbol.toStringTag in e?!1:r(e)===`[object Arguments]`},a=function(e){return i(e)?!0:typeof e==`object`&&!!e&&`length`in e&&typeof e.length==`number`&&e.length>=0&&r(e)!==`[object Array]`&&`callee`in e&&r(e.callee)===`[object Function]`},o=function(){return i(arguments)}();i.isLegacyArguments=a,t.exports=o?i:a})),We=t(((e,t)=>{var n=He(),r=ue()(),i=Be(),a=Ee(),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})),Ge=t(((e,t)=>{var n=He(),r=We(),i=n(`RegExp.prototype.exec`),a=he();t.exports=function(e){if(!r(e))throw new a("`regex` must be a RegExp");return function(t){return i(e,t)!==null}}})),Ke=t(((e,t)=>{var n=function*(){}.constructor;t.exports=()=>n})),qe=t(((e,t)=>{var n=He(),r=Ge()(/^\s*(?:function)?\*/),i=ue()(),a=ze(),o=n(`Object.prototype.toString`),s=n(`Function.prototype.toString`),c=Ke();t.exports=function(e){if(typeof e!=`function`)return!1;if(r(s(e)))return!0;if(!i)return o(e)===`[object GeneratorFunction]`;if(!a)return!1;var t=c();return t&&a(e)===t.prototype}})),Je=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)}})),Ye=t(((e,t)=>{var n=Je(),r=Object.prototype.toString,i=Object.prototype.hasOwnProperty,a=function(e,t,n){for(var r=0,a=e.length;r<a;r++)i.call(e,r)&&(n==null?t(e[r],r,e):t.call(n,e[r],r,e))},o=function(e,t,n){for(var r=0,i=e.length;r<i;r++)n==null?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)},s=function(e,t,n){for(var r in e)i.call(e,r)&&(n==null?t(e[r],r,e):t.call(n,e[r],r,e))};function c(e){return r.call(e)===`[object Array]`}t.exports=function(e,t,r){if(!n(t))throw TypeError(`iterator must be a function`);var i;arguments.length>=3&&(i=r),c(e)?a(e,t,i):typeof e==`string`?o(e,t,i):s(e,t,i)}})),Xe=t(((e,t)=>{t.exports=[`Float16Array`,`Float32Array`,`Float64Array`,`Int8Array`,`Int16Array`,`Int32Array`,`Uint8Array`,`Uint8ClampedArray`,`Uint16Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`]})),Ze=t(((e,t)=>{ie();var n=Xe(),r=typeof globalThis>`u`?Z:globalThis;t.exports=function(){for(var e=[],t=0;t<n.length;t++)typeof r[n[t]]==`function`&&(e[e.length]=n[t]);return e}})),Qe=t(((e,t)=>{var n=De(),r=me(),i=he(),a=Ee();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.`)}})),$e=t(((e,t)=>{var n=De(),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})),et=t(((e,t)=>{var n=Ve(),r=Qe(),i=$e()(),a=Ee(),o=he(),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}})),tt=t(((e,t)=>{var n=Me(),r=Pe(),i=Ie();t.exports=function(){return i(n,r,arguments)}})),nt=t(((e,t)=>{var n=et(),r=De(),i=Le(),a=tt();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})),rt=t(((e,t)=>{ie();var n=Ye(),r=Ze(),i=nt(),a=He(),o=Ee(),s=ze(),c=a(`Object.prototype.toString`),l=ue()(),u=typeof globalThis>`u`?Z:globalThis,d=r(),f=a(`String.prototype.slice`),p=a(`Array.prototype.indexOf`,!0)||function(e,t){for(var n=0;n<e.length;n+=1)if(e[n]===t)return n;return-1},m={__proto__:null};l&&o&&s?n(d,function(e){var t=new u[e];if(Symbol.toStringTag in t&&s){var n=s(t),r=o(n,Symbol.toStringTag);if(!r&&n&&(r=o(s(n),Symbol.toStringTag)),r&&r.get){var a=i(r.get);m[`$`+e]=a}}}):n(d,function(e){var t=new u[e],n=t.slice||t.set;if(n){var r=i(n);m[`$`+e]=r}});var h=function(e){var t=!1;return n(m,function(n,r){if(!t)try{`$`+n(e)===r&&(t=f(r,1))}catch{}}),t},g=function(e){var t=!1;return n(m,function(n,r){if(!t)try{n(e),t=f(r,1)}catch{}}),t};t.exports=function(e){if(!e||typeof e!=`object`)return!1;if(!l){var t=f(c(e),8,-1);return p(d,t)>-1?t:t===`Object`?g(e):!1}return o?h(e):null}})),it=t(((e,t)=>{var n=rt();t.exports=function(e){return!!n(e)}})),at=t((e=>{var t=Ue(),n=qe(),r=rt(),i=it();function a(e){return e.call.bind(e)}var o=typeof BigInt<`u`,s=typeof Symbol<`u`,c=a(Object.prototype.toString),l=a(Number.prototype.valueOf),u=a(String.prototype.valueOf),d=a(Boolean.prototype.valueOf);if(o)var f=a(BigInt.prototype.valueOf);if(s)var p=a(Symbol.prototype.valueOf);function m(e,t){if(typeof e!=`object`)return!1;try{return t(e),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=n,e.isTypedArray=i;function h(e){return typeof Promise<`u`&&e instanceof Promise||typeof e==`object`&&!!e&&typeof e.then==`function`&&typeof e.catch==`function`}e.isPromise=h;function g(e){return typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):i(e)||z(e)}e.isArrayBufferView=g;function _(e){return r(e)===`Uint8Array`}e.isUint8Array=_;function v(e){return r(e)===`Uint8ClampedArray`}e.isUint8ClampedArray=v;function y(e){return r(e)===`Uint16Array`}e.isUint16Array=y;function b(e){return r(e)===`Uint32Array`}e.isUint32Array=b;function x(e){return r(e)===`Int8Array`}e.isInt8Array=x;function S(e){return r(e)===`Int16Array`}e.isInt16Array=S;function C(e){return r(e)===`Int32Array`}e.isInt32Array=C;function w(e){return r(e)===`Float32Array`}e.isFloat32Array=w;function T(e){return r(e)===`Float64Array`}e.isFloat64Array=T;function E(e){return r(e)===`BigInt64Array`}e.isBigInt64Array=E;function D(e){return r(e)===`BigUint64Array`}e.isBigUint64Array=D;function O(e){return c(e)===`[object Map]`}O.working=typeof Map<`u`&&O(new Map);function k(e){return typeof Map>`u`?!1:O.working?O(e):e instanceof Map}e.isMap=k;function A(e){return c(e)===`[object Set]`}A.working=typeof Set<`u`&&A(new Set);function j(e){return typeof Set>`u`?!1:A.working?A(e):e instanceof Set}e.isSet=j;function M(e){return c(e)===`[object WeakMap]`}M.working=typeof WeakMap<`u`&&M(new WeakMap);function N(e){return typeof WeakMap>`u`?!1:M.working?M(e):e instanceof WeakMap}e.isWeakMap=N;function P(e){return c(e)===`[object WeakSet]`}P.working=typeof WeakSet<`u`&&P(new WeakSet);function F(e){return P(e)}e.isWeakSet=F;function I(e){return c(e)===`[object ArrayBuffer]`}I.working=typeof ArrayBuffer<`u`&&I(new ArrayBuffer);function L(e){return typeof ArrayBuffer>`u`?!1:I.working?I(e):e instanceof ArrayBuffer}e.isArrayBuffer=L;function R(e){return c(e)===`[object DataView]`}R.working=typeof ArrayBuffer<`u`&&typeof DataView<`u`&&R(new DataView(new ArrayBuffer(1),0,1));function z(e){return typeof DataView>`u`?!1:R.working?R(e):e instanceof DataView}e.isDataView=z;var B=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:void 0;function V(e){return c(e)===`[object SharedArrayBuffer]`}function H(e){return B===void 0?!1:(V.working===void 0&&(V.working=V(new B)),V.working?V(e):e instanceof B)}e.isSharedArrayBuffer=H;function U(e){return c(e)===`[object AsyncFunction]`}e.isAsyncFunction=U;function W(e){return c(e)===`[object Map Iterator]`}e.isMapIterator=W;function G(e){return c(e)===`[object Set Iterator]`}e.isSetIterator=G;function K(e){return c(e)===`[object Generator]`}e.isGeneratorObject=K;function ee(e){return c(e)===`[object WebAssembly.Module]`}e.isWebAssemblyCompiledModule=ee;function te(e){return m(e,l)}e.isNumberObject=te;function q(e){return m(e,u)}e.isStringObject=q;function ne(e){return m(e,d)}e.isBooleanObject=ne;function re(e){return o&&m(e,f)}e.isBigIntObject=re;function J(e){return s&&m(e,p)}e.isSymbolObject=J;function Y(e){return te(e)||q(e)||ne(e)||re(e)||J(e)}e.isBoxedPrimitive=Y;function X(e){return typeof Uint8Array<`u`&&(L(e)||H(e))}e.isAnyArrayBuffer=X,[`isProxy`,`isExternal`,`isModuleNamespaceObject`].forEach(function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw Error(t+` is not supported in userland`)}})})})),ot=t(((e,t)=>{t.exports=function(e){return e&&typeof e==`object`&&typeof e.copy==`function`&&typeof e.fill==`function`&&typeof e.readUInt8==`function`}})),st=t((e=>{K();var t=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},n=/%[sdj%]/g;e.format=function(e){if(!x(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(o(arguments[r]));return t.join(` `)}for(var r=1,i=arguments,a=i.length,s=String(e).replace(n,function(e){if(e===`%%`)return`%`;if(r>=a)return e;switch(e){case`%s`:return String(i[r++]);case`%d`:return Number(i[r++]);case`%j`:try{return JSON.stringify(i[r++])}catch{return`[Circular]`}default:return e}}),c=i[r];r<a;c=i[++r])v(c)||!T(c)?s+=` `+c:s+=` `+o(c);return s},e.deprecate=function(t,n){if(G!==void 0&&G.noDeprecation===!0)return t;if(G===void 0)return function(){return e.deprecate(t,n).apply(this,arguments)};var r=!1;function i(){if(!r){if(G.throwDeprecation)throw Error(n);G.traceDeprecation?console.trace(n):console.error(n),r=!0}return t.apply(this,arguments)}return i};var r={},i=/^$/;if(G.env.NODE_DEBUG){var a=G.env.NODE_DEBUG;a=a.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`).replace(/\*/g,`.*`).replace(/,/g,`$|^`).toUpperCase(),i=RegExp(`^`+a+`$`,`i`)}e.debuglog=function(t){if(t=t.toUpperCase(),!r[t])if(i.test(t)){var n=G.pid;r[t]=function(){var r=e.format.apply(e,arguments);console.error(`%s %d: %s`,t,n,r)}}else r[t]=function(){};return r[t]};function o(t,n){var r={seen:[],stylize:c};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),_(n)?r.showHidden=n:n&&e._extend(r,n),C(r.showHidden)&&(r.showHidden=!1),C(r.depth)&&(r.depth=2),C(r.colors)&&(r.colors=!1),C(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),u(r,t,r.depth)}e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:`cyan`,number:`yellow`,boolean:`yellow`,undefined:`grey`,null:`bold`,string:`green`,date:`magenta`,regexp:`red`};function s(e,t){var n=o.styles[t];return n?`\x1B[`+o.colors[n][0]+`m`+e+`\x1B[`+o.colors[n][1]+`m`:e}function c(e,t){return e}function l(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(t,n,r){if(t.customInspect&&n&&O(n.inspect)&&n.inspect!==e.inspect&&!(n.constructor&&n.constructor.prototype===n)){var i=n.inspect(r,t);return x(i)||(i=u(t,i,r)),i}var a=d(t,n);if(a)return a;var o=Object.keys(n),s=l(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(n)),D(n)&&(o.indexOf(`message`)>=0||o.indexOf(`description`)>=0))return f(n);if(o.length===0){if(O(n)){var c=n.name?`: `+n.name:``;return t.stylize(`[Function`+c+`]`,`special`)}if(w(n))return t.stylize(RegExp.prototype.toString.call(n),`regexp`);if(E(n))return t.stylize(Date.prototype.toString.call(n),`date`);if(D(n))return f(n)}var _=``,v=!1,y=[`{`,`}`];if(g(n)&&(v=!0,y=[`[`,`]`]),O(n)&&(_=` [Function`+(n.name?`: `+n.name:``)+`]`),w(n)&&(_=` `+RegExp.prototype.toString.call(n)),E(n)&&(_=` `+Date.prototype.toUTCString.call(n)),D(n)&&(_=` `+f(n)),o.length===0&&(!v||n.length==0))return y[0]+_+y[1];if(r<0)return w(n)?t.stylize(RegExp.prototype.toString.call(n),`regexp`):t.stylize(`[Object]`,`special`);t.seen.push(n);var b=v?p(t,n,r,s,o):o.map(function(e){return m(t,n,r,s,e,v)});return t.seen.pop(),h(b,_,y)}function d(e,t){if(C(t))return e.stylize(`undefined`,`undefined`);if(x(t)){var n=`'`+JSON.stringify(t).replace(/^"|"$/g,``).replace(/'/g,`\\'`).replace(/\\"/g,`"`)+`'`;return e.stylize(n,`string`)}if(b(t))return e.stylize(``+t,`number`);if(_(t))return e.stylize(``+t,`boolean`);if(v(t))return e.stylize(`null`,`null`)}function f(e){return`[`+Error.prototype.toString.call(e)+`]`}function p(e,t,n,r,i){for(var a=[],o=0,s=t.length;o<s;++o)P(t,String(o))?a.push(m(e,t,n,r,String(o),!0)):a.push(``);return i.forEach(function(i){i.match(/^\d+$/)||a.push(m(e,t,n,r,i,!0))}),a}function m(e,t,n,r,i,a){var o,s,c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]};if(c.get?s=c.set?e.stylize(`[Getter/Setter]`,`special`):e.stylize(`[Getter]`,`special`):c.set&&(s=e.stylize(`[Setter]`,`special`)),P(r,i)||(o=`[`+i+`]`),s||(e.seen.indexOf(c.value)<0?(s=v(n)?u(e,c.value,null):u(e,c.value,n-1),s.indexOf(`
10
+ `)>-1&&(s=a?s.split(`
11
+ `).map(function(e){return` `+e}).join(`
12
+ `).slice(2):`
13
+ `+s.split(`
14
+ `).map(function(e){return` `+e}).join(`
15
+ `))):s=e.stylize(`[Circular]`,`special`)),C(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(``+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=e.stylize(o,`name`)):(o=o.replace(/'/g,`\\'`).replace(/\\"/g,`"`).replace(/(^"|"$)/g,`'`),o=e.stylize(o,`string`))}return o+`: `+s}function h(e,t,n){var r=0;return e.reduce(function(e,t){return r++,t.indexOf(`
16
+ `)>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,``).length+1},0)>60?n[0]+(t===``?``:t+`
17
+ `)+` `+e.join(`,
18
+ `)+` `+n[1]:n[0]+t+` `+e.join(`, `)+` `+n[1]}e.types=at();function g(e){return Array.isArray(e)}e.isArray=g;function _(e){return typeof e==`boolean`}e.isBoolean=_;function v(e){return e===null}e.isNull=v;function y(e){return e==null}e.isNullOrUndefined=y;function b(e){return typeof e==`number`}e.isNumber=b;function x(e){return typeof e==`string`}e.isString=x;function S(e){return typeof e==`symbol`}e.isSymbol=S;function C(e){return e===void 0}e.isUndefined=C;function w(e){return T(e)&&A(e)===`[object RegExp]`}e.isRegExp=w,e.types.isRegExp=w;function T(e){return typeof e==`object`&&!!e}e.isObject=T;function E(e){return T(e)&&A(e)===`[object Date]`}e.isDate=E,e.types.isDate=E;function D(e){return T(e)&&(A(e)===`[object Error]`||e instanceof Error)}e.isError=D,e.types.isNativeError=D;function O(e){return typeof e==`function`}e.isFunction=O;function k(e){return e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||typeof e==`symbol`||e===void 0}e.isPrimitive=k,e.isBuffer=ot();function A(e){return Object.prototype.toString.call(e)}function j(e){return e<10?`0`+e.toString(10):e.toString(10)}var M=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function N(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(`:`);return[e.getDate(),M[e.getMonth()],t].join(` `)}e.log=function(){console.log(`%s - %s`,N(),e.format.apply(e,arguments))},e.inherits=oe(),e._extend=function(e,t){if(!t||!T(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var F=typeof Symbol<`u`?Symbol(`util.promisify.custom`):void 0;e.promisify=function(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type Function`);if(F&&e[F]){var n=e[F];if(typeof n!=`function`)throw TypeError(`The "util.promisify.custom" argument must be of type Function`);return Object.defineProperty(n,F,{value:n,enumerable:!1,writable:!1,configurable:!0}),n}function n(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),i=[],a=0;a<arguments.length;a++)i.push(arguments[a]);i.push(function(e,r){e?n(e):t(r)});try{e.apply(this,i)}catch(e){n(e)}return r}return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),F&&Object.defineProperty(n,F,{value:n,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(n,t(e))},e.promisify.custom=F;function I(e,t){if(!e){var n=Error(`Promise was rejected with a falsy value`);n.reason=e,e=n}return t(e)}function L(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type Function`);function n(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var r=t.pop();if(typeof r!=`function`)throw TypeError(`The last argument must be of type Function`);var i=this,a=function(){return r.apply(i,arguments)};e.apply(this,t).then(function(e){G.nextTick(a.bind(null,null,e))},function(e){G.nextTick(I.bind(null,e,a))})}return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.defineProperties(n,t(e)),n}e.callbackify=L})),ct=t(((e,t)=>{function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]==null?{}:arguments[t];t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,n){return t=c(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e){var t=l(e,`string`);return typeof t==`symbol`?t:String(t)}function l(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var u=ce().Buffer,d=st().inspect,f=d&&d.custom||`inspect`;function p(e,t,n){u.prototype.copy.call(e,t,n)}t.exports=function(){function e(){a(this,e),this.head=null,this.tail=null,this.length=0}return s(e,[{key:`push`,value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:`unshift`,value:function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}},{key:`shift`,value:function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:`clear`,value:function(){this.head=this.tail=null,this.length=0}},{key:`join`,value:function(e){if(this.length===0)return``;for(var t=this.head,n=``+t.data;t=t.next;)n+=e+t.data;return n}},{key:`concat`,value:function(e){if(this.length===0)return u.alloc(0);for(var t=u.allocUnsafe(e>>>0),n=this.head,r=0;n;)p(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:`consume`,value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:`first`,value:function(){return this.head.data}},{key:`_getString`,value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,a=e>i.length?i.length:e;if(a===i.length?r+=i:r+=i.slice(0,e),e-=a,e===0){a===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(a));break}++n}return this.length-=n,r}},{key:`_getBuffer`,value:function(e){var t=u.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),e-=a,e===0){a===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(a));break}++r}return this.length-=r,t}},{key:f,value:function(e,t){return d(this,r(r({},t),{},{depth:0,customInspect:!1}))}}]),e}()})),lt=t(((e,t)=>{K();function n(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,G.nextTick(o,this,e)):G.nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?n._writableState?n._writableState.errorEmitted?G.nextTick(i,n):(n._writableState.errorEmitted=!0,G.nextTick(r,n,e)):G.nextTick(r,n,e):t?(G.nextTick(i,n),t(e)):G.nextTick(i,n)}),this)}function r(e,t){o(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit(`close`)}function a(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(e,t){e.emit(`error`,t)}function s(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit(`error`,t)}t.exports={destroy:n,undestroy:a,errorOrDestroy:s}})),ut=t(((e,t)=>{function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var r={};function i(e,t,i){i||=Error;function a(e,n,r){return typeof t==`string`?t:t(e,n,r)}var o=function(e){n(t,e);function t(t,n,r){return e.call(this,a(t,n,r))||this}return t}(i);o.prototype.name=i.name,o.prototype.code=e,r[e]=o}function a(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?`one of ${t} ${e.slice(0,n-1).join(`, `)}, or `+e[n-1]:n===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}function o(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function s(e,t,n){return(n===void 0||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function c(e,t,n){return typeof n!=`number`&&(n=0),n+t.length>e.length?!1:e.indexOf(t,n)!==-1}i(`ERR_INVALID_OPT_VALUE`,function(e,t){return`The value "`+t+`" is invalid for option "`+e+`"`},TypeError),i(`ERR_INVALID_ARG_TYPE`,function(e,t,n){var r;typeof t==`string`&&o(t,`not `)?(r=`must not be`,t=t.replace(/^not /,``)):r=`must be`;var i=s(e,` argument`)?`The ${e} ${r} ${a(t,`type`)}`:`The "${e}" ${c(e,`.`)?`property`:`argument`} ${r} ${a(t,`type`)}`;return i+=`. Received type ${typeof n}`,i},TypeError),i(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`),i(`ERR_METHOD_NOT_IMPLEMENTED`,function(e){return`The `+e+` method is not implemented`}),i(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`),i(`ERR_STREAM_DESTROYED`,function(e){return`Cannot call `+e+` after a stream was destroyed`}),i(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`),i(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`),i(`ERR_STREAM_WRITE_AFTER_END`,`write after end`),i(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),i(`ERR_UNKNOWN_ENCODING`,function(e){return`Unknown encoding: `+e},TypeError),i(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`),t.exports.codes=r})),dt=t(((e,t)=>{var n=ut().codes.ERR_INVALID_OPT_VALUE;function r(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function i(e,t,i,a){var o=r(t,a,i);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0)throw new n(a?i:`highWaterMark`,o);return Math.floor(o)}return e.objectMode?16:16*1024}t.exports={getHighWaterMark:i}})),ft=t(((e,t)=>{ie(),t.exports=n;function n(e,t){if(r(`noDeprecation`))return e;var n=!1;function i(){if(!n){if(r(`throwDeprecation`))throw Error(t);r(`traceDeprecation`)?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}return i}function r(e){try{if(!Z.localStorage)return!1}catch{return!1}var t=Z.localStorage[e];return t==null?!1:String(t).toLowerCase()===`true`}})),pt=t(((e,t)=>{ie(),K(),t.exports=T;function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){H(t,e)}}var r;T.WritableState=C;var i={deprecate:ft()},a=se(),o=ce().Buffer,s=(Z===void 0?typeof window<`u`?window:typeof self<`u`?self:{}:Z).Uint8Array||function(){};function c(e){return o.from(e)}function l(e){return o.isBuffer(e)||e instanceof s}var u=lt(),d=dt().getHighWaterMark,f=ut().codes,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_METHOD_NOT_IMPLEMENTED,h=f.ERR_MULTIPLE_CALLBACK,g=f.ERR_STREAM_CANNOT_PIPE,_=f.ERR_STREAM_DESTROYED,v=f.ERR_STREAM_NULL_VALUES,y=f.ERR_STREAM_WRITE_AFTER_END,b=f.ERR_UNKNOWN_ENCODING,x=u.errorOrDestroy;oe()(T,a);function S(){}function C(e,t,i){r||=mt(),e||={},typeof i!=`boolean`&&(i=t instanceof r),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=d(this,e,`writableHighWaterMark`,i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=e.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){N(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}C.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},(function(){try{Object.defineProperty(C.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},`_writableState.buffer is deprecated. Use _writableState.getBuffer instead.`,`DEP0003`)})}catch{}})();var w;typeof Symbol==`function`&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==`function`?(w=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(e){return w.call(this,e)?!0:this===T?e&&e._writableState instanceof C:!1}})):w=function(e){return e instanceof this};function T(e){r||=mt();var t=this instanceof r;if(!t&&!w.call(T,this))return new T(e);this._writableState=new C(e,this,t),this.writable=!0,e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final)),a.call(this)}T.prototype.pipe=function(){x(this,new g)};function E(e,t){var n=new y;x(e,n),G.nextTick(t,n)}function D(e,t,n,r){var i;return n===null?i=new v:typeof n!=`string`&&!t.objectMode&&(i=new p(`chunk`,[`string`,`Buffer`],n)),i?(x(e,i),G.nextTick(r,i),!1):!0}T.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&l(e);return a&&!o.isBuffer(e)&&(e=c(e)),typeof t==`function`&&(n=t,t=null),a?t=`buffer`:t||=r.defaultEncoding,typeof n!=`function`&&(n=S),r.ending?E(this,n):(a||D(this,r,e,n))&&(r.pendingcb++,i=k(this,r,a,e,t,n)),i},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&I(this,e))},T.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=e.toLowerCase()),!([`hex`,`utf8`,`utf-8`,`ascii`,`binary`,`base64`,`ucs2`,`ucs-2`,`utf16le`,`utf-16le`,`raw`].indexOf((e+``).toLowerCase())>-1))throw new b(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function O(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t==`string`&&(t=o.from(t,n)),t}Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function k(e,t,n,r,i,a){if(!n){var o=O(t,r,i);r!==o&&(n=!0,i=`buffer`,r=o)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else A(e,t,!1,s,r,i,a);return c}function A(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new _(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function j(e,t,n,r,i){--t.pendingcb,n?(G.nextTick(i,r),G.nextTick(B,e,t),e._writableState.errorEmitted=!0,x(e,r)):(i(r),e._writableState.errorEmitted=!0,x(e,r),B(e,t))}function M(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function N(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(typeof i!=`function`)throw new h;if(M(n),t)j(e,n,r,t,i);else{var a=L(n)||e.destroyed;!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&I(e,n),r?G.nextTick(P,e,n,a,i):P(e,n,a,i)}}function P(e,t,n,r){n||F(e,t),t.pendingcb--,r(),B(e,t)}function F(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`))}function I(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,a=Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)a[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;a.allBuffers=c,A(e,t,!0,t.length,a,``,o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(A(e,t,!1,t.objectMode?1:l.length,l,u,d),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}T.prototype._write=function(e,t,n){n(new m(`_write()`))},T.prototype._writev=null,T.prototype.end=function(e,t,n){var r=this._writableState;return typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||V(this,r,n),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function L(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function R(e,t){e._final(function(n){t.pendingcb--,n&&x(e,n),t.prefinished=!0,e.emit(`prefinish`),B(e,t)})}function z(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,G.nextTick(R,e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function B(e,t){var n=L(t);if(n&&(z(e,t),t.pendingcb===0&&(t.finished=!0,e.emit(`finish`),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}function V(e,t,n){t.ending=!0,B(e,t),n&&(t.finished?G.nextTick(n):e.once(`finish`,n)),t.ended=!0,e.writable=!1}function H(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=u.destroy,T.prototype._undestroy=u.undestroy,T.prototype._destroy=function(e,t){t(e)}})),mt=t(((e,t)=>{K();var n=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=c;var r=bt(),i=pt();oe()(c,r);for(var a=n(i.prototype),o=0;o<a.length;o++){var s=a[o];c.prototype[s]||(c.prototype[s]=i.prototype[s])}function c(e){if(!(this instanceof c))return new c(e);r.call(this,e),i.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once(`end`,l)))}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||G.nextTick(u,this)}function u(e){e.end()}Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})})),ht=t(((e,t)=>{var n=ce(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),gt=t((e=>{var t=ht().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),_t=t(((e,t)=>{var n=ut().codes.ERR_STREAM_PREMATURE_CLOSE;function r(e){var t=!1;return function(){if(!t){t=!0;var n=[...arguments];e.apply(this,n)}}}function i(){}function a(e){return e.setHeader&&typeof e.abort==`function`}function o(e,t,s){if(typeof t==`function`)return o(e,null,t);t||={},s=r(s||i);var c=t.readable||t.readable!==!1&&e.readable,l=t.writable||t.writable!==!1&&e.writable,u=function(){e.writable||f()},d=e._writableState&&e._writableState.finished,f=function(){l=!1,d=!0,c||s.call(e)},p=e._readableState&&e._readableState.endEmitted,m=function(){c=!1,p=!0,l||s.call(e)},h=function(t){s.call(e,t)},g=function(){var t;if(c&&!p)return(!e._readableState||!e._readableState.ended)&&(t=new n),s.call(e,t);if(l&&!d)return(!e._writableState||!e._writableState.ended)&&(t=new n),s.call(e,t)},_=function(){e.req.on(`finish`,f)};return a(e)?(e.on(`complete`,f),e.on(`abort`,g),e.req?_():e.on(`request`,_)):l&&!e._writableState&&(e.on(`end`,u),e.on(`close`,u)),e.on(`end`,m),e.on(`finish`,f),t.error!==!1&&e.on(`error`,h),e.on(`close`,g),function(){e.removeListener(`complete`,f),e.removeListener(`abort`,g),e.removeListener(`request`,_),e.req&&e.req.removeListener(`finish`,f),e.removeListener(`end`,u),e.removeListener(`close`,u),e.removeListener(`finish`,f),e.removeListener(`end`,m),e.removeListener(`error`,h),e.removeListener(`close`,g)}}t.exports=o})),vt=t(((e,t)=>{K();var n;function r(e,t,n){return t=i(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=a(e,`string`);return typeof t==`symbol`?t:String(t)}function a(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var o=_t(),s=Symbol(`lastResolve`),c=Symbol(`lastReject`),l=Symbol(`error`),u=Symbol(`ended`),d=Symbol(`lastPromise`),f=Symbol(`handlePromise`),p=Symbol(`stream`);function m(e,t){return{value:e,done:t}}function h(e){var t=e[s];if(t!==null){var n=e[p].read();n!==null&&(e[d]=null,e[s]=null,e[c]=null,t(m(n,!1)))}}function g(e){G.nextTick(h,e)}function _(e,t){return function(n,r){e.then(function(){if(t[u]){n(m(void 0,!0));return}t[f](n,r)},r)}}var v=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((n={get stream(){return this[p]},next:function(){var e=this,t=this[l];if(t!==null)return Promise.reject(t);if(this[u])return Promise.resolve(m(void 0,!0));if(this[p].destroyed)return new Promise(function(t,n){G.nextTick(function(){e[l]?n(e[l]):t(m(void 0,!0))})});var n=this[d],r;if(n)r=new Promise(_(n,this));else{var i=this[p].read();if(i!==null)return Promise.resolve(m(i,!1));r=new Promise(this[f])}return this[d]=r,r}},r(n,Symbol.asyncIterator,function(){return this}),r(n,`return`,function(){var e=this;return new Promise(function(t,n){e[p].destroy(null,function(e){if(e){n(e);return}t(m(void 0,!0))})})}),n),v);t.exports=function(e){var t,n=Object.create(y,(t={},r(t,p,{value:e,writable:!0}),r(t,s,{value:null,writable:!0}),r(t,c,{value:null,writable:!0}),r(t,l,{value:null,writable:!0}),r(t,u,{value:e._readableState.endEmitted,writable:!0}),r(t,f,{value:function(e,t){var r=n[p].read();r?(n[d]=null,n[s]=null,n[c]=null,e(m(r,!1))):(n[s]=e,n[c]=t)},writable:!0}),t));return n[d]=null,o(e,function(e){if(e&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`){var t=n[c];t!==null&&(n[d]=null,n[s]=null,n[c]=null,t(e)),n[l]=e;return}var r=n[s];r!==null&&(n[d]=null,n[s]=null,n[c]=null,r(m(void 0,!0))),n[u]=!0}),e.on(`readable`,g.bind(null,n)),n}})),yt=t(((e,t)=>{t.exports=function(){throw Error(`Readable.from is not available in the browser`)}})),bt=t(((e,t)=>{ie(),K(),t.exports=D;var r;D.ReadableState=E,n().EventEmitter;var i=function(e,t){return e.listeners(t).length},a=se(),o=ce().Buffer,s=(Z===void 0?typeof window<`u`?window:typeof self<`u`?self:{}:Z).Uint8Array||function(){};function c(e){return o.from(e)}function l(e){return o.isBuffer(e)||e instanceof s}var u=st(),d=u&&u.debuglog?u.debuglog(`stream`):function(){},f=ct(),p=lt(),m=dt().getHighWaterMark,h=ut().codes,g=h.ERR_INVALID_ARG_TYPE,_=h.ERR_STREAM_PUSH_AFTER_EOF,v=h.ERR_METHOD_NOT_IMPLEMENTED,y=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,b,x,S;oe()(D,a);var C=p.errorOrDestroy,w=[`error`,`close`,`destroy`,`pause`,`resume`];function T(e,t,n){if(typeof e.prependListener==`function`)return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function E(e,t,n){r||=mt(),e||={},typeof n!=`boolean`&&(n=t instanceof r),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,`readableHighWaterMark`,n),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||=gt().StringDecoder,this.decoder=new b(e.encoding),this.encoding=e.encoding)}function D(e){if(r||=mt(),!(this instanceof D))return new D(e);var t=this instanceof r;this._readableState=new E(e,this,t),this.readable=!0,e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy)),a.call(this)}Object.defineProperty(D.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),D.prototype.destroy=p.destroy,D.prototype._undestroy=p.undestroy,D.prototype._destroy=function(e,t){t(e)},D.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:typeof e==`string`&&(t||=n.defaultEncoding,t!==n.encoding&&(e=o.from(e,t),t=``),r=!0),O(this,e,t,!1,r)},D.prototype.unshift=function(e){return O(this,e,null,!0,!1)};function O(e,t,n,r,i){d(`readableAddChunk`,t);var a=e._readableState;if(t===null)a.reading=!1,P(e,a);else{var s;if(i||(s=A(a,t)),s)C(e,s);else if(a.objectMode||t&&t.length>0)if(typeof t!=`string`&&!a.objectMode&&Object.getPrototypeOf(t)!==o.prototype&&(t=c(t)),r)a.endEmitted?C(e,new y):k(e,a,t,!0);else if(a.ended)C(e,new _);else if(a.destroyed)return!1;else a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?k(e,a,t,!1):L(e,a)):k(e,a,t,!1);else r||(a.reading=!1,L(e,a))}return!a.ended&&(a.length<a.highWaterMark||a.length===0)}function k(e,t,n,r){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&F(e)),L(e,t)}function A(e,t){var n;return!l(t)&&typeof t!=`string`&&t!==void 0&&!e.objectMode&&(n=new g(`chunk`,[`string`,`Buffer`,`Uint8Array`],t)),n}D.prototype.isPaused=function(){return this._readableState.flowing===!1},D.prototype.setEncoding=function(e){b||=gt().StringDecoder;var t=new b(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r=``;n!==null;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),r!==``&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var j=1073741824;function M(e){return e>=j?e=j:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function N(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=M(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}D.prototype.read=function(e){d(`read`,e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return d(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?te(this):F(this),null;if(e=N(e,t),e===0&&t.ended)return t.length===0&&te(this),null;var r=t.needReadable;d(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,d(`length less than watermark`,r)),t.ended||t.reading?(r=!1,d(`reading or ended`,r)):r&&(d(`do read`),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=N(n,t)));var i=e>0?ee(e,t):null;return i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&te(this)),i!==null&&this.emit(`data`,i),i};function P(e,t){if(d(`onEofChunk`),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,I(e)))}}function F(e){var t=e._readableState;d(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(d(`emitReadable`,t.flowing),t.emittedReadable=!0,G.nextTick(I,e))}function I(e){var t=e._readableState;d(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,W(e)}function L(e,t){t.readingMore||(t.readingMore=!0,G.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var n=t.length;if(d(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}D.prototype._read=function(e){C(this,new v(`_read()`))},D.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e);break}r.pipesCount+=1,d(`pipe count=%d opts=%j`,r.pipesCount,t);var a=(!t||t.end!==!1)&&e!==G.stdout&&e!==G.stderr?s:g;r.endEmitted?G.nextTick(a):n.once(`end`,a),e.on(`unpipe`,o);function o(e,t){d(`onunpipe`),e===n&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){d(`onend`),e.end()}var c=z(n);e.on(`drain`,c);var l=!1;function u(){d(`cleanup`),e.removeListener(`close`,m),e.removeListener(`finish`,h),e.removeListener(`drain`,c),e.removeListener(`error`,p),e.removeListener(`unpipe`,o),n.removeListener(`end`,s),n.removeListener(`end`,g),n.removeListener(`data`,f),l=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}n.on(`data`,f);function f(t){d(`ondata`);var i=e.write(t);d(`dest.write`,i),i===!1&&((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&ne(r.pipes,e)!==-1)&&!l&&(d(`false write response, pause`,r.awaitDrain),r.awaitDrain++),n.pause())}function p(t){d(`onerror`,t),g(),e.removeListener(`error`,p),i(e,`error`)===0&&C(e,t)}T(e,`error`,p);function m(){e.removeListener(`finish`,h),g()}e.once(`close`,m);function h(){d(`onfinish`),e.removeListener(`close`,m),g()}e.once(`finish`,h);function g(){d(`unpipe`),n.unpipe(e)}return e.emit(`pipe`,n),r.flowing||(d(`pipe resume`),n.resume()),e};function z(e){return function(){var t=e._readableState;d(`pipeOnDrain`,t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&i(e,`data`)&&(t.flowing=!0,W(e))}}D.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||=t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit(`unpipe`,this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit(`unpipe`,this,{hasUnpiped:!1});return this}var o=ne(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),--t.pipesCount,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit(`unpipe`,this,n),this)},D.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t),r=this._readableState;return e===`data`?(r.readableListening=this.listenerCount(`readable`)>0,r.flowing!==!1&&this.resume()):e===`readable`&&!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,d(`on readable`,r.length,r.reading),r.length?F(this):r.reading||G.nextTick(V,this)),n},D.prototype.addListener=D.prototype.on,D.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return e===`readable`&&G.nextTick(B,this),n},D.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&G.nextTick(B,this),t};function B(e){var t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount(`data`)>0&&e.resume()}function V(e){d(`readable nexttick read 0`),e.read(0)}D.prototype.resume=function(){var e=this._readableState;return e.flowing||(d(`resume`),e.flowing=!e.readableListening,H(this,e)),e.paused=!1,this};function H(e,t){t.resumeScheduled||(t.resumeScheduled=!0,G.nextTick(U,e,t))}function U(e,t){d(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),W(e),t.flowing&&!t.reading&&e.read(0)}D.prototype.pause=function(){return d(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(d(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState.paused=!0,this};function W(e){var t=e._readableState;for(d(`flow`,t.flowing);t.flowing&&e.read()!==null;);}D.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on(`end`,function(){if(d(`wrapped end`),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on(`data`,function(i){d(`wrapped data`),n.decoder&&(i=n.decoder.write(i)),!(n.objectMode&&i==null)&&(!n.objectMode&&(!i||!i.length)||t.push(i)||(r=!0,e.pause()))}),e)this[i]===void 0&&typeof e[i]==`function`&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<w.length;a++)e.on(w[a],this.emit.bind(this,w[a]));return this._read=function(t){d(`wrapped _read`,t),r&&(r=!1,e.resume())},this},typeof Symbol==`function`&&(D.prototype[Symbol.asyncIterator]=function(){return x===void 0&&(x=vt()),x(this)}),Object.defineProperty(D.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(D.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(D.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),D._fromList=ee,Object.defineProperty(D.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function ee(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function te(e){var t=e._readableState;d(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,G.nextTick(q,t,e))}function q(e,t){if(d(`endReadableNT`,e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit(`end`),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}typeof Symbol==`function`&&(D.from=function(e,t){return S===void 0&&(S=yt()),S(D,e,t)});function ne(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}})),xt=t(((e,t)=>{t.exports=l;var n=ut().codes,r=n.ERR_METHOD_NOT_IMPLEMENTED,i=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=n.ERR_TRANSFORM_WITH_LENGTH_0,s=mt();oe()(l,s);function c(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit(`error`,new i);n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function u(){var e=this;typeof this._flush==`function`&&!this._readableState.destroyed?this._flush(function(t,n){d(e,t,n)}):d(this,null,null)}l.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,n){n(new r(`_transform()`))},l.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},l.prototype._destroy=function(e,t){s.prototype._destroy.call(this,e,function(e){t(e)})};function d(e,t,n){if(t)return e.emit(`error`,t);if(n!=null&&e.push(n),e._writableState.length)throw new o;if(e._transformState.transforming)throw new a;return e.push(null)}})),St=t(((e,t)=>{t.exports=r;var n=xt();oe()(r,n);function r(e){if(!(this instanceof r))return new r(e);n.call(this,e)}r.prototype._transform=function(e,t,n){n(null,e)}})),Ct=t(((e,t)=>{var n;function r(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var i=ut().codes,a=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function c(e){return e.setHeader&&typeof e.abort==`function`}function l(e,t,i,a){a=r(a);var s=!1;e.on(`close`,function(){s=!0}),n===void 0&&(n=_t()),n(e,{readable:t,writable:i},function(e){if(e)return a(e);s=!0,a()});var l=!1;return function(t){if(!s&&!l){if(l=!0,c(e))return e.abort();if(typeof e.destroy==`function`)return e.destroy();a(t||new o(`pipe`))}}}function u(e){e()}function d(e,t){return e.pipe(t)}function f(e){return!e.length||typeof e[e.length-1]!=`function`?s:e.pop()}function p(){var e=[...arguments],t=f(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new a(`streams`);var n,r=e.map(function(i,a){var o=a<e.length-1;return l(i,o,a>0,function(e){n||=e,e&&r.forEach(u),!o&&(r.forEach(u),t(n))})});return e.reduce(d)}t.exports=p})),wt=t(((e,t)=>{e=t.exports=bt(),e.Stream=e,e.Readable=e,e.Writable=pt(),e.Duplex=mt(),e.Transform=xt(),e.PassThrough=St(),e.finished=_t(),e.pipeline=Ct()})),Tt=t((e=>{w(),ie(),K();var t=ae(),n=oe(),r=wt(),i=e.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},a=e.IncomingMessage=function(e,n,i,a){var o=this;if(r.Readable.call(o),o._mode=i,o.headers={},o.rawHeaders=[],o.trailers={},o.rawTrailers=[],o.on(`end`,function(){G.nextTick(function(){o.emit(`close`)})}),i===`fetch`){if(o._fetchResponse=n,o.url=n.url,o.statusCode=n.status,o.statusMessage=n.statusText,n.headers.forEach(function(e,t){o.headers[t.toLowerCase()]=e,o.rawHeaders.push(t,e)}),t.writableStream){var s=new WritableStream({write:function(e){return a(!1),new Promise(function(t,n){o._destroyed?n():o.push(C.from(e))?t():o._resumeFetch=t})},close:function(){a(!0),o._destroyed||o.push(null)},abort:function(e){a(!0),o._destroyed||o.emit(`error`,e)}});try{n.body.pipeTo(s).catch(function(e){a(!0),o._destroyed||o.emit(`error`,e)});return}catch{}}var c=n.body.getReader();function e(){c.read().then(function(t){if(!o._destroyed){if(a(t.done),t.done){o.push(null);return}o.push(C.from(t.value)),e()}}).catch(function(e){a(!0),o._destroyed||o.emit(`error`,e)})}e()}else if(o._xhr=e,o._pos=0,o.url=e.responseURL,o.statusCode=e.status,o.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();n===`set-cookie`?(o.headers[n]===void 0&&(o.headers[n]=[]),o.headers[n].push(t[2])):o.headers[n]===void 0?o.headers[n]=t[2]:o.headers[n]+=`, `+t[2],o.rawHeaders.push(t[1],t[2])}}),o._charset=`x-user-defined`,!t.overrideMimeType){var l=o.rawHeaders[`mime-type`];if(l){var u=l.match(/;\s*charset=([^;])(;|$)/);u&&(o._charset=u[1].toLowerCase())}o._charset||=`utf-8`}};n(a,r.Readable),a.prototype._read=function(){var e=this,t=e._resumeFetch;t&&(e._resumeFetch=null,t())},a.prototype._onXHRProgress=function(e){var t=this,n=t._xhr,r=null;switch(t._mode){case`text`:if(r=n.responseText,r.length>t._pos){var a=r.substr(t._pos);if(t._charset===`x-user-defined`){for(var o=C.alloc(a.length),s=0;s<a.length;s++)o[s]=a.charCodeAt(s)&255;t.push(o)}else t.push(a,t._charset);t._pos=r.length}break;case`arraybuffer`:if(n.readyState!==i.DONE||!n.response)break;r=n.response,t.push(C.from(new Uint8Array(r)));break;case`moz-chunked-arraybuffer`:if(r=n.response,n.readyState!==i.LOADING||!r)break;t.push(C.from(new Uint8Array(r)));break;case`ms-stream`:if(r=n.response,n.readyState!==i.LOADING)break;var c=new Z.MSStreamReader;c.onprogress=function(){c.result.byteLength>t._pos&&(t.push(C.from(new Uint8Array(c.result.slice(t._pos)))),t._pos=c.result.byteLength)},c.onload=function(){e(!0),t.push(null)},c.readAsArrayBuffer(r);break}t._xhr.readyState===i.DONE&&t._mode!==`ms-stream`&&(e(!0),t.push(null))}})),Et=t(((e,t)=>{w(),ie(),K();var n=ae(),r=oe(),i=Tt(),a=wt(),o=i.IncomingMessage,s=i.readyStates;function c(e,t){return n.fetch&&t?`fetch`:n.mozchunkedarraybuffer?`moz-chunked-arraybuffer`:n.msstream?`ms-stream`:n.arraybuffer&&e?`arraybuffer`:`text`}var l=t.exports=function(e){var t=this;a.Writable.call(t),t._opts=e,t._body=[],t._headers={},e.auth&&t.setHeader(`Authorization`,`Basic `+C.from(e.auth).toString(`base64`)),Object.keys(e.headers).forEach(function(n){t.setHeader(n,e.headers[n])});var r,i=!0;if(e.mode===`disable-fetch`||`requestTimeout`in e&&!n.abortController)i=!1,r=!0;else if(e.mode===`prefer-streaming`)r=!1;else if(e.mode===`allow-wrong-content-type`)r=!n.overrideMimeType;else if(!e.mode||e.mode===`default`||e.mode===`prefer-fast`)r=!0;else throw Error(`Invalid value for opts.mode`);t._mode=c(r,i),t._fetchTimer=null,t._socketTimeout=null,t._socketTimer=null,t.on(`finish`,function(){t._onFinish()})};r(l,a.Writable),l.prototype.setHeader=function(e,t){var n=this,r=e.toLowerCase();d.indexOf(r)===-1&&(n._headers[r]={name:e,value:t})},l.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},l.prototype.removeHeader=function(e){var t=this;delete t._headers[e.toLowerCase()]},l.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts;`timeout`in t&&t.timeout!==0&&e.setTimeout(t.timeout);var r=e._headers,i=null;t.method!==`GET`&&t.method!==`HEAD`&&(i=new Blob(e._body,{type:(r[`content-type`]||{}).value||``}));var a=[];if(Object.keys(r).forEach(function(e){var t=r[e].name,n=r[e].value;Array.isArray(n)?n.forEach(function(e){a.push([t,e])}):a.push([t,n])}),e._mode===`fetch`){var o=null;if(n.abortController){var c=new AbortController;o=c.signal,e._fetchAbortController=c,`requestTimeout`in t&&t.requestTimeout!==0&&(e._fetchTimer=Z.setTimeout(function(){e.emit(`requestTimeout`),e._fetchAbortController&&e._fetchAbortController.abort()},t.requestTimeout))}Z.fetch(e._opts.url,{method:e._opts.method,headers:a,body:i||void 0,mode:`cors`,credentials:t.withCredentials?`include`:`same-origin`,signal:o}).then(function(t){e._fetchResponse=t,e._resetTimers(!1),e._connect()},function(t){e._resetTimers(!0),e._destroyed||e.emit(`error`,t)})}else{var l=e._xhr=new Z.XMLHttpRequest;try{l.open(e._opts.method,e._opts.url,!0)}catch(t){G.nextTick(function(){e.emit(`error`,t)});return}`responseType`in l&&(l.responseType=e._mode),`withCredentials`in l&&(l.withCredentials=!!t.withCredentials),e._mode===`text`&&`overrideMimeType`in l&&l.overrideMimeType(`text/plain; charset=x-user-defined`),`requestTimeout`in t&&(l.timeout=t.requestTimeout,l.ontimeout=function(){e.emit(`requestTimeout`)}),a.forEach(function(e){l.setRequestHeader(e[0],e[1])}),e._response=null,l.onreadystatechange=function(){switch(l.readyState){case s.LOADING:case s.DONE:e._onXHRProgress();break}},e._mode===`moz-chunked-arraybuffer`&&(l.onprogress=function(){e._onXHRProgress()}),l.onerror=function(){e._destroyed||(e._resetTimers(!0),e.emit(`error`,Error(`XHR error`)))};try{l.send(i)}catch(t){G.nextTick(function(){e.emit(`error`,t)});return}}}};function u(e){try{var t=e.status;return t!==null&&t!==0}catch{return!1}}l.prototype._onXHRProgress=function(){var e=this;e._resetTimers(!1),!(!u(e._xhr)||e._destroyed)&&(e._response||e._connect(),e._response._onXHRProgress(e._resetTimers.bind(e)))},l.prototype._connect=function(){var e=this;e._destroyed||(e._response=new o(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e)),e._response.on(`error`,function(t){e.emit(`error`,t)}),e.emit(`response`,e._response))},l.prototype._write=function(e,t,n){this._body.push(e),n()},l.prototype._resetTimers=function(e){var t=this;Z.clearTimeout(t._socketTimer),t._socketTimer=null,e?(Z.clearTimeout(t._fetchTimer),t._fetchTimer=null):t._socketTimeout&&(t._socketTimer=Z.setTimeout(function(){t.emit(`timeout`)},t._socketTimeout))},l.prototype.abort=l.prototype.destroy=function(e){var t=this;t._destroyed=!0,t._resetTimers(!0),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort(),e&&t.emit(`error`,e)},l.prototype.end=function(e,t,n){var r=this;typeof e==`function`&&(n=e,e=void 0),a.Writable.prototype.end.call(r,e,t,n)},l.prototype.setTimeout=function(e,t){var n=this;t&&n.once(`timeout`,t),n._socketTimeout=e,n._resetTimers(!1)},l.prototype.flushHeaders=function(){},l.prototype.setNoDelay=function(){},l.prototype.setSocketKeepAlive=function(){};var d=[`accept-charset`,`accept-encoding`,`access-control-request-headers`,`access-control-request-method`,`connection`,`content-length`,`cookie`,`cookie2`,`date`,`dnt`,`expect`,`host`,`keep-alive`,`origin`,`referer`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`via`]})),Dt=t(((e,t)=>{t.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var i in r)n.call(r,i)&&(e[i]=r[i])}return e}})),Ot=t(((e,t)=>{t.exports={100:`Continue`,101:`Switching Protocols`,102:`Processing`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Unordered Collection`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`}})),kt=t(((e,t)=>{ie(),(function(n){var r=typeof e==`object`&&e&&!e.nodeType&&e,i=typeof t==`object`&&t&&!t.nodeType&&t,a=typeof Z==`object`&&Z;(a.global===a||a.window===a||a.self===a)&&(n=a);var o,s=2147483647,c=36,l=1,u=26,d=38,f=700,p=72,m=128,h=`-`,g=/^xn--/,_=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},b=c-l,x=Math.floor,S=String.fromCharCode,C;function w(e){throw RangeError(y[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function E(e,t){var n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(v,`.`);var i=T(e.split(`.`),t).join(`.`);return r+i}function D(e){for(var t=[],n=0,r=e.length,i,a;n<r;)i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<r?(a=e.charCodeAt(n++),(a&64512)==56320?t.push(((i&1023)<<10)+(a&1023)+65536):(t.push(i),n--)):t.push(i);return t}function O(e){return T(e,function(e){var t=``;return e>65535&&(e-=65536,t+=S(e>>>10&1023|55296),e=56320|e&1023),t+=S(e),t}).join(``)}function k(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function A(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function j(e,t,n){var r=0;for(e=n?x(e/f):e>>1,e+=x(e/t);e>b*u>>1;r+=c)e=x(e/b);return x(r+(b+1)*e/(e+d))}function M(e){var t=[],n=e.length,r,i=0,a=m,o=p,d=e.lastIndexOf(h),f,g,_,v,y,b,S,C;for(d<0&&(d=0),f=0;f<d;++f)e.charCodeAt(f)>=128&&w(`not-basic`),t.push(e.charCodeAt(f));for(g=d>0?d+1:0;g<n;){for(_=i,v=1,y=c;g>=n&&w(`invalid-input`),b=k(e.charCodeAt(g++)),(b>=c||b>x((s-i)/v))&&w(`overflow`),i+=b*v,S=y<=o?l:y>=o+u?u:y-o,!(b<S);y+=c)C=c-S,v>x(s/C)&&w(`overflow`),v*=C;r=t.length+1,o=j(i-_,r,_==0),x(i/r)>s-a&&w(`overflow`),a+=x(i/r),i%=r,t.splice(i++,0,a)}return O(t)}function N(e){var t,n,r,i,a,o,d,f,g,_,v,y=[],b,C,T,E;for(e=D(e),b=e.length,t=m,n=0,a=p,o=0;o<b;++o)v=e[o],v<128&&y.push(S(v));for(r=i=y.length,i&&y.push(h);r<b;){for(d=s,o=0;o<b;++o)v=e[o],v>=t&&v<d&&(d=v);for(C=r+1,d-t>x((s-n)/C)&&w(`overflow`),n+=(d-t)*C,t=d,o=0;o<b;++o)if(v=e[o],v<t&&++n>s&&w(`overflow`),v==t){for(f=n,g=c;_=g<=a?l:g>=a+u?u:g-a,!(f<_);g+=c)E=f-_,T=c-_,y.push(S(A(_+E%T,0))),f=x(E/T);y.push(S(A(f,0))),a=j(n,C,r==i),n=0,++r}++n,++t}return y.join(``)}function P(e){return E(e,function(e){return g.test(e)?M(e.slice(4).toLowerCase()):e})}function F(e){return E(e,function(e){return _.test(e)?`xn--`+N(e):e})}if(o={version:`1.4.1`,ucs2:{decode:D,encode:O},decode:M,encode:N,toASCII:F,toUnicode:P},typeof define==`function`&&typeof define.amd==`object`&&define.amd)define(`punycode`,function(){return o});else if(r&&i)if(t.exports==r)i.exports=o;else for(C in o)o.hasOwnProperty(C)&&(r[C]=o[C]);else n.punycode=o})(e)})),At=t(((e,t)=>{t.exports={}})),jt=t(((e,t)=>{ie();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=At(),F=P.custom,I=q(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(J(s,`quoteStyle`)&&!J(L,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 de(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=ge(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`&&!W(t)){var x=X(t),T=ve(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?$(D):D}if(Q(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 re=ve(t,y);return g&&!he(re)?`[`+_e(re,g)+`]`:`[ `+C.call(re,`, `)+` ]`}if(G(t)){var ie=ve(t,y);return!(`cause`in Error.prototype)&&`cause`in t&&!j.call(t,`cause`)?`{ [`+String(t)+`] `+C.call(S.call(`[cause]: `+y(t.cause),ie),`, `)+` }`:ie.length===0?`[`+String(t)+`]`:`{ [`+String(t)+`] `+C.call(ie,`, `)+` }`}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 fe=[];return a&&a.call(t,function(e,n){fe.push(y(n,t,!0)+` => `+y(e,t))}),me(`Map`,i.call(t),fe,g)}if(le(t)){var ye=[];return l&&l.call(t,function(e){ye.push(y(e,t))}),me(`Set`,c.call(t),ye,g)}if(se(t))return pe(`WeakMap`);if(ue(t))return pe(`WeakSet`);if(ce(t))return pe(`WeakRef`);if(ee(t))return $(y(Number(t)));if(ne(t))return $(y(E.call(t)));if(te(t))return $(p.call(t));if(K(t))return $(y(String(t)));if(typeof window<`u`&&t===window)return`{ [object Window] }`;if(typeof globalThis<`u`&&t===globalThis||Z!==void 0&&t===Z)return`{ [object globalThis] }`;if(!U(t)&&!W(t)){var be=ve(t,y),xe=M?M(t)===Object.prototype:t instanceof Object||t.constructor===Object,Se=t instanceof Object?``:`null prototype`,Ce=!xe&&A&&Object(t)===t&&A in t?_.call(Y(t),8,-1):Se?`Object`:``,we=(xe||typeof t.constructor!=`function`?``:t.constructor.name?t.constructor.name+` `:``)+(Ce||Se?`[`+C.call(S.call([],Ce||[],Se||[]),`: `)+`] `:``);return be.length===0?we+`{}`:g?we+`{`+_e(be,g)+`}`:we+`{ `+C.call(be,`, `)+` }`}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,`&quot;`)}function V(e){return!A||!(typeof e==`object`&&(A in e||e[A]!==void 0))}function H(e){return Y(e)===`[object Array]`&&V(e)}function U(e){return Y(e)===`[object Date]`&&V(e)}function W(e){return Y(e)===`[object RegExp]`&&V(e)}function G(e){return Y(e)===`[object Error]`&&V(e)}function K(e){return Y(e)===`[object String]`&&V(e)}function ee(e){return Y(e)===`[object Number]`&&V(e)}function te(e){return Y(e)===`[object Boolean]`&&V(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 X(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 Q(e){return!e||typeof e!=`object`?!1:typeof HTMLElement<`u`&&e instanceof HTMLElement?!0:typeof e.nodeName==`string`&&typeof e.getAttribute==`function`}function de(e,t){if(e.length>t.maxStringLength){var n=e.length-t.maxStringLength,r=`... `+n+` more character`+(n>1?`s`:``);return de(_.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,fe),`single`,t)}function fe(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 $(e){return`Object(`+e+`)`}function pe(e){return e+` { ? }`}function me(e,t,n,r){var i=r?_e(n,r):C.call(n,`, `);return e+` (`+t+`) {`+i+`}`}function he(e){for(var t=0;t<e.length;t++)if(ae(e[t],`
19
+ `)>=0)return!1;return!0}function ge(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 _e(e,t){if(e.length===0)return``;var n=`
20
+ `+t.prev+t.base;return n+C.call(e,`,`+n)+`
21
+ `+t.prev}function ve(e,t){var n=H(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}})),Mt=t(((e,t)=>{var n=jt(),r=he(),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}})),Nt=t(((e,t)=>{var n=Ve(),r=He(),i=jt(),a=he(),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}})),Pt=t(((e,t)=>{var n=Ve(),r=He(),i=jt(),a=Nt(),o=he(),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})),Ft=t(((e,t)=>{var n=he(),r=jt(),i=Mt(),a=Nt(),o=Pt()||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}})),It=t(((e,t)=>{var n=String.prototype.replace,r=/%20/g,i={RFC1738:`RFC1738`,RFC3986:`RFC3986`};t.exports={default:i.RFC3986,formatters:{RFC1738:function(e){return n.call(e,r,`+`)},RFC3986:function(e){return String(e)}},RFC1738:i.RFC1738,RFC3986:i.RFC3986}})),Lt=t(((e,t)=>{var n=It(),r=Ft(),i=Object.prototype.hasOwnProperty,a=Array.isArray,o=r(),s=function(e,t){return o.set(e,t),e},c=function(e){return o.has(e)},l=function(e){return o.get(e)},u=function(e,t){o.set(e,t)},d=function(){for(var e=[],t=0;t<256;++t)e[e.length]=`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase();return e}(),f=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(a(n)){for(var r=[],i=0;i<n.length;++i)n[i]!==void 0&&(r[r.length]=n[i]);t.obj[t.prop]=r}}},p=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},r=0;r<e.length;++r)e[r]!==void 0&&(n[r]=e[r]);return n},m=function e(t,n,r){if(!n)return t;if(typeof n!=`object`&&typeof n!=`function`){if(a(t)){var o=t.length;if(r&&typeof r.arrayLimit==`number`&&o>r.arrayLimit)return s(p(t.concat(n),r),o);t[o]=n}else if(t&&typeof t==`object`)if(c(t)){var d=l(t)+1;t[d]=n,u(t,d)}else if(r&&r.strictMerge)return[t,n];else (r&&(r.plainObjects||r.allowPrototypes)||!i.call(Object.prototype,n))&&(t[n]=!0);else return[t,n];return t}if(!t||typeof t!=`object`){if(c(n)){for(var f=Object.keys(n),m=r&&r.plainObjects?{__proto__:null,0:t}:{0:t},h=0;h<f.length;h++){var g=parseInt(f[h],10);m[g+1]=n[f[h]]}return s(m,l(n)+1)}var _=[t].concat(n);return r&&typeof r.arrayLimit==`number`&&_.length>r.arrayLimit?s(p(_,r),_.length-1):_}var v=t;return a(t)&&!a(n)&&(v=p(t,r)),a(t)&&a(n)?(n.forEach(function(n,a){if(i.call(t,a)){var o=t[a];o&&typeof o==`object`&&n&&typeof n==`object`?t[a]=e(o,n,r):t[t.length]=n}else t[a]=n}),t):Object.keys(n).reduce(function(t,a){var o=n[a];if(i.call(t,a)?t[a]=e(t[a],o,r):t[a]=o,c(n)&&!c(t)&&s(t,l(n)),c(t)){var d=parseInt(a,10);String(d)===a&&d>=0&&d>l(t)&&u(t,d)}return t},v)},h=function(e,t){return Object.keys(t).reduce(function(e,n){return e[n]=t[n],e},e)},g=function(e,t,n){var r=e.replace(/\+/g,` `);if(n===`iso-8859-1`)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},_=1024;t.exports={arrayToObject:p,assign:h,combine:function(e,t,n,r){if(c(e)){var i=l(e)+1;return e[i]=t,u(e,i),e}var a=[].concat(e,t);return a.length>n?s(p(a,{plainObjects:r}),a.length-1):a},compact:function(e){for(var t=[{obj:{o:e},prop:`o`}],n=[],r=0;r<t.length;++r)for(var i=t[r],a=i.obj[i.prop],o=Object.keys(a),s=0;s<o.length;++s){var c=o[s],l=a[c];typeof l==`object`&&l&&n.indexOf(l)===-1&&(t[t.length]={obj:a,prop:c},n[n.length]=l)}return f(t),e},decode:g,encode:function(e,t,r,i,a){if(e.length===0)return e;var o=e;if(typeof e==`symbol`?o=Symbol.prototype.toString.call(e):typeof e!=`string`&&(o=String(e)),r===`iso-8859-1`)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});for(var s=``,c=0;c<o.length;c+=_){for(var l=o.length>=_?o.slice(c,c+_):o,u=[],f=0;f<l.length;++f){var p=l.charCodeAt(f);if(p===45||p===46||p===95||p===126||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||a===n.RFC1738&&(p===40||p===41)){u[u.length]=l.charAt(f);continue}if(p<128){u[u.length]=d[p];continue}if(p<2048){u[u.length]=d[192|p>>6]+d[128|p&63];continue}if(p<55296||p>=57344){u[u.length]=d[224|p>>12]+d[128|p>>6&63]+d[128|p&63];continue}f+=1,p=65536+((p&1023)<<10|l.charCodeAt(f)&1023),u[u.length]=d[240|p>>18]+d[128|p>>12&63]+d[128|p>>6&63]+d[128|p&63]}s+=u.join(``)}return s},isBuffer:function(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isOverflow:c,isRegExp:function(e){return Object.prototype.toString.call(e)===`[object RegExp]`},markOverflow:s,maybeMap:function(e,t){if(a(e)){for(var n=[],r=0;r<e.length;r+=1)n[n.length]=t(e[r]);return n}return t(e)},merge:m}})),Rt=t(((e,t)=>{var n=Ft(),r=Lt(),i=It(),a=Object.prototype.hasOwnProperty,o={brackets:function(e){return e+`[]`},comma:`comma`,indices:function(e,t){return e+`[`+t+`]`},repeat:function(e){return e}},s=Array.isArray,c=Array.prototype.push,l=function(e,t){c.apply(e,s(t)?t:[t])},u=Date.prototype.toISOString,d=i.default,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,commaRoundTrip:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:r.encode,encodeValuesOnly:!1,filter:void 0,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},p=function(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`},m={},h=function e(t,i,a,o,c,u,d,h,g,_,v,y,b,x,S,C,w,T){for(var E=t,D=T,O=0,k=!1;(D=D.get(m))!==void 0&&!k;){var A=D.get(t);if(O+=1,A!==void 0){if(A===O)throw RangeError(`Cyclic object value`);k=!0}D.get(m)===void 0&&(O=0)}if(typeof _==`function`?E=_(i,E):E instanceof Date?E=b(E):a===`comma`&&s(E)&&(E=r.maybeMap(E,function(e){return e instanceof Date?b(e):e})),E===null){if(u)return S(g&&!C?g(i,f.encoder,w,`key`,x):i);E=``}if(p(E)||r.isBuffer(E))return g?[S(C?i:g(i,f.encoder,w,`key`,x))+`=`+S(g(E,f.encoder,w,`value`,x))]:[S(i)+`=`+S(String(E))];var j=[];if(E===void 0)return j;var M;if(a===`comma`&&s(E))C&&g&&(E=r.maybeMap(E,function(e){return e==null?e:g(e)})),M=[{value:E.length>0?E.join(`,`)||null:void 0}];else if(s(_))M=_;else{var N=Object.keys(E);M=v?N.sort(v):N}var P=h?String(i).replace(/\./g,`%2E`):String(i),F=o&&s(E)&&E.length===1?P+`[]`:P;if(c&&s(E)&&E.length===0)return F+`[]`;for(var I=0;I<M.length;++I){var L=M[I],R=typeof L==`object`&&L&&L.value!==void 0?L.value:E[L];if(!(d&&R===null)){var z=y&&h?String(L).replace(/\./g,`%2E`):String(L),B=s(E)?typeof a==`function`?a(F,z):F:F+(y?`.`+z:`[`+z+`]`);T.set(t,O);var V=n();V.set(m,T),l(j,e(R,B,a,o,c,u,d,h,a===`comma`&&C&&s(E)?null:g,_,v,y,b,x,S,C,w,V))}}return j},g=function(e){if(!e)return f;if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);var t=e.charset||f.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);var n=i.default;if(e.format!==void 0){if(!a.call(i.formatters,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}var r=i.formatters[n],c=f.filter;(typeof e.filter==`function`||s(e.filter))&&(c=e.filter);var l=e.arrayFormat in o?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:f.arrayFormat;if(`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");var u=e.allowDots===void 0?e.encodeDotInKeys===!0?!0:f.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:f.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:l,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:f.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?f.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:f.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:f.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:f.encodeValuesOnly,filter:c,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:f.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:f.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:f.strictNullHandling}};t.exports=function(e,t){var r=e,i=g(t),a,c;typeof i.filter==`function`?(c=i.filter,r=c(``,r)):s(i.filter)&&(c=i.filter,a=c);var u=[];if(typeof r!=`object`||!r)return``;var d=o[i.arrayFormat],f=d===`comma`&&i.commaRoundTrip;a||=Object.keys(r),i.sort&&a.sort(i.sort);for(var p=n(),m=0;m<a.length;++m){var _=a[m];if(_!=null){var v=r[_];i.skipNulls&&v===null||l(u,h(v,_,d,f,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,p))}}var y=u.join(i.delimiter),b=i.addQueryPrefix===!0?`?`:``;return i.charsetSentinel&&(i.charset===`iso-8859-1`?b+=`utf8=%26%2310003%3B`+i.delimiter:b+=`utf8=%E2%9C%93`+i.delimiter),y.length>0?b+y:``}})),zt=t(((e,t)=>{var n=Lt(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:`utf-8`,charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:`&`,depth:5,duplicates:`combine`,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},s=function(e,t,n){if(e&&typeof e==`string`&&t.comma&&e.indexOf(`,`)>-1)return e.split(`,`);if(t.throwOnLimitExceeded&&n>=t.arrayLimit)throw RangeError(`Array limit exceeded. Only `+t.arrayLimit+` element`+(t.arrayLimit===1?``:`s`)+` allowed in an array.`);return e},c=`utf8=%26%2310003%3B`,l=`utf8=%E2%9C%93`,u=function(e,t){var u={__proto__:null},d=t.ignoreQueryPrefix?e.replace(/^\?/,``):e;d=d.replace(/%5B/gi,`[`).replace(/%5D/gi,`]`);var f=t.parameterLimit===1/0?void 0:t.parameterLimit,p=d.split(t.delimiter,t.throwOnLimitExceeded&&f!==void 0?f+1:f);if(t.throwOnLimitExceeded&&f!==void 0&&p.length>f)throw RangeError(`Parameter limit exceeded. Only `+f+` parameter`+(f===1?``:`s`)+` allowed.`);var m=-1,h,g=t.charset;if(t.charsetSentinel)for(h=0;h<p.length;++h)p[h].indexOf(`utf8=`)===0&&(p[h]===l?g=`utf-8`:p[h]===c&&(g=`iso-8859-1`),m=h,h=p.length);for(h=0;h<p.length;++h)if(h!==m){var _=p[h],v=_.indexOf(`]=`),y=v===-1?_.indexOf(`=`):v+1,b,x;if(y===-1?(b=t.decoder(_,a.decoder,g,`key`),x=t.strictNullHandling?null:``):(b=t.decoder(_.slice(0,y),a.decoder,g,`key`),b!==null&&(x=n.maybeMap(s(_.slice(y+1),t,i(u[b])?u[b].length:0),function(e){return t.decoder(e,a.decoder,g,`value`)}))),x&&t.interpretNumericEntities&&g===`iso-8859-1`&&(x=o(String(x))),_.indexOf(`[]=`)>-1&&(x=i(x)?[x]:x),t.comma&&i(x)&&x.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw RangeError(`Array limit exceeded. Only `+t.arrayLimit+` element`+(t.arrayLimit===1?``:`s`)+` allowed in an array.`);x=n.combine([],x,t.arrayLimit,t.plainObjects)}if(b!==null){var S=r.call(u,b);S&&(t.duplicates===`combine`||_.indexOf(`[]=`)>-1)?u[b]=n.combine(u[b],x,t.arrayLimit,t.plainObjects):(!S||t.duplicates===`last`)&&(u[b]=x)}}return u},d=function(e,t,r,i){var a=0;if(e.length>0&&e[e.length-1]===`[]`){var o=e.slice(0,-1).join(``);a=Array.isArray(t)&&t[o]?t[o].length:0}for(var c=i?t:s(t,r,a),l=e.length-1;l>=0;--l){var u,d=e[l];if(d===`[]`&&r.parseArrays)u=n.isOverflow(c)?c:r.allowEmptyArrays&&(c===``||r.strictNullHandling&&c===null)?[]:n.combine([],c,r.arrayLimit,r.plainObjects);else{u=r.plainObjects?{__proto__:null}:{};var f=d.charAt(0)===`[`&&d.charAt(d.length-1)===`]`?d.slice(1,-1):d,p=r.decodeDotInKeys?f.replace(/%2E/g,`.`):f,m=parseInt(p,10),h=!isNaN(m)&&d!==p&&String(m)===p&&m>=0&&r.parseArrays;if(!r.parseArrays&&p===``)u={0:c};else if(h&&m<r.arrayLimit)u=[],u[m]=c;else if(h&&r.throwOnLimitExceeded)throw RangeError(`Array limit exceeded. Only `+r.arrayLimit+` element`+(r.arrayLimit===1?``:`s`)+` allowed in an array.`);else h?(u[m]=c,n.markOverflow(u,m)):p!==`__proto__`&&(u[p]=c)}c=u}return c},f=function(e,t){var n=t.allowDots?e.replace(/\.([^.[]+)/g,`[$1]`):e;if(t.depth<=0)return!t.plainObjects&&r.call(Object.prototype,n)&&!t.allowPrototypes?void 0:[n];var i=[],a=n.indexOf(`[`),o=a>=0?n.slice(0,a):n;if(o){if(!t.plainObjects&&r.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var s=n.length,c=a,l=0;c>=0&&l<t.depth;){for(var u=1,d=c+1,f=-1;d<s&&f<0;){var p=n.charCodeAt(d);p===91?u+=1:p===93&&(--u,u===0&&(f=d)),d+=1}if(f<0)return i[i.length]=`[`+n.slice(c)+`]`,i;var m=n.slice(c,f+1),h=m.slice(1,-1);if(!t.plainObjects&&r.call(Object.prototype,h)&&!t.allowPrototypes)return;i[i.length]=m,l+=1,c=n.indexOf(`[`,f+1)}if(c>=0){if(t.strictDepth===!0)throw RangeError(`Input depth exceeded depth option of `+t.depth+` and strictDepth is true`);i[i.length]=`[`+n.slice(c)+`]`}return i},p=function(e,t,n,r){if(e){var i=f(e,n);if(i)return d(i,t,n,r)}},m=function(e){if(!e)return a;if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.decodeDotInKeys!==void 0&&typeof e.decodeDotInKeys!=`boolean`)throw TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!=`function`)throw TypeError(`Decoder has to be a function.`);if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);if(e.throwOnLimitExceeded!==void 0&&typeof e.throwOnLimitExceeded!=`boolean`)throw TypeError("`throwOnLimitExceeded` option must be a boolean");var t=e.charset===void 0?a.charset:e.charset,r=e.duplicates===void 0?a.duplicates:e.duplicates;if(r!==`combine`&&r!==`first`&&r!==`last`)throw TypeError(`The duplicates option must be either combine, first, or last`);return{allowDots:e.allowDots===void 0?e.decodeDotInKeys===!0?!0:a.allowDots:!!e.allowDots,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes==`boolean`?e.allowPrototypes:a.allowPrototypes,allowSparse:typeof e.allowSparse==`boolean`?e.allowSparse:a.allowSparse,arrayLimit:typeof e.arrayLimit==`number`?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:a.charsetSentinel,comma:typeof e.comma==`boolean`?e.comma:a.comma,decodeDotInKeys:typeof e.decodeDotInKeys==`boolean`?e.decodeDotInKeys:a.decodeDotInKeys,decoder:typeof e.decoder==`function`?e.decoder:a.decoder,delimiter:typeof e.delimiter==`string`||n.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:typeof e.depth==`number`||e.depth===!1?+e.depth:a.depth,duplicates:r,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities==`boolean`?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:typeof e.parameterLimit==`number`?e.parameterLimit:a.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects==`boolean`?e.plainObjects:a.plainObjects,strictDepth:typeof e.strictDepth==`boolean`?!!e.strictDepth:a.strictDepth,strictMerge:typeof e.strictMerge==`boolean`?!!e.strictMerge:a.strictMerge,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:a.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded==`boolean`?e.throwOnLimitExceeded:!1}};t.exports=function(e,t){var r=m(t);if(e===``||e==null)return r.plainObjects?{__proto__:null}:{};for(var i=typeof e==`string`?u(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),s=0;s<o.length;++s){var c=o[s],l=p(c,i[c],r,typeof e==`string`);a=n.merge(a,l,r)}return r.allowSparse===!0?a:n.compact(a)}})),Bt=t(((e,t)=>{var n=Rt(),r=zt();t.exports={formats:It(),parse:r,stringify:n}})),Vt=t(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=kt(),r=Bt();function i(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var a=i(n),o=i(r),s=a.default;function c(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var l=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,d=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,f=[`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
22
+ `,` `],p=[`%`,`/`,`?`,`;`,`#`].concat(f),m=[`/`,`?`,`#`],h=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=o.default;function S(e,t,n){if(e&&typeof e==`object`&&e instanceof c)return e;var r=new c;return r.parse(e,t,n),r}c.prototype.parse=function(e,t,n){if(typeof e!=`string`)throw TypeError(`Parameter 'url' must be a string, not `+typeof e);var r=e.indexOf(`?`),i=r!==-1&&r<e.indexOf(`#`)?`?`:`#`,a=e.split(i);a[0]=a[0].replace(/\\/g,`/`),e=a.join(i);var o=e;if(o=o.trim(),!n&&e.split(`#`).length===1){var c=d.exec(o);if(c)return this.path=o,this.href=o,this.pathname=c[1],c[2]?(this.search=c[2],t?this.query=x.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search=``,this.query={}),this}var u=l.exec(o);if(u){u=u[0];var S=u.toLowerCase();this.protocol=S,o=o.substr(u.length)}if(n||u||o.match(/^\/\/[^@/]+@[^@/]+/)){var C=o.substr(0,2)===`//`;C&&!(u&&y[u])&&(o=o.substr(2),this.slashes=!0)}if(!y[u]&&(C||u&&!b[u])){for(var w=-1,T=0;T<m.length;T++){var E=o.indexOf(m[T]);E!==-1&&(w===-1||E<w)&&(w=E)}var D,O=w===-1?o.lastIndexOf(`@`):o.lastIndexOf(`@`,w);O!==-1&&(D=o.slice(0,O),o=o.slice(O+1),this.auth=decodeURIComponent(D)),w=-1;for(var T=0;T<p.length;T++){var E=o.indexOf(p[T]);E!==-1&&(w===-1||E<w)&&(w=E)}w===-1&&(w=o.length),this.host=o.slice(0,w),o=o.slice(w),this.parseHost(),this.hostname=this.hostname||``;var k=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!k)for(var A=this.hostname.split(/\./),T=0,j=A.length;T<j;T++){var M=A[T];if(M&&!M.match(g)){for(var N=``,P=0,F=M.length;P<F;P++)M.charCodeAt(P)>127?N+=`x`:N+=M[P];if(!N.match(g)){var I=A.slice(0,T),L=A.slice(T+1),R=M.match(_);R&&(I.push(R[1]),L.unshift(R[2])),L.length&&(o=`/`+L.join(`.`)+o),this.hostname=I.join(`.`);break}}}this.hostname.length>h?this.hostname=``:this.hostname=this.hostname.toLowerCase(),k||(this.hostname=s.toASCII(this.hostname));var z=this.port?`:`+this.port:``,B=this.hostname||``;this.host=B+z,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!==`/`&&(o=`/`+o))}if(!v[S])for(var T=0,j=f.length;T<j;T++){var V=f[T];if(o.indexOf(V)!==-1){var H=encodeURIComponent(V);H===V&&(H=escape(V)),o=o.split(V).join(H)}}var U=o.indexOf(`#`);U!==-1&&(this.hash=o.substr(U),o=o.slice(0,U));var W=o.indexOf(`?`);if(W===-1?t&&(this.search=``,this.query={}):(this.search=o.substr(W),this.query=o.substr(W+1),t&&(this.query=x.parse(this.query)),o=o.slice(0,W)),o&&(this.pathname=o),b[S]&&this.hostname&&!this.pathname&&(this.pathname=`/`),this.pathname||this.search){var z=this.pathname||``,G=this.search||``;this.path=z+G}return this.href=this.format(),this};function C(e){return typeof e==`string`&&(e=S(e)),e instanceof c?e.format():c.prototype.format.call(e)}c.prototype.format=function(){var e=this.auth||``;e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,`:`),e+=`@`);var t=this.protocol||``,n=this.pathname||``,r=this.hash||``,i=!1,a=``;this.host?i=e+this.host:this.hostname&&(i=e+(this.hostname.indexOf(`:`)===-1?this.hostname:`[`+this.hostname+`]`),this.port&&(i+=`:`+this.port)),this.query&&typeof this.query==`object`&&Object.keys(this.query).length&&(a=x.stringify(this.query,{arrayFormat:`repeat`,addQueryPrefix:!1}));var o=this.search||a&&`?`+a||``;return t&&t.substr(-1)!==`:`&&(t+=`:`),this.slashes||(!t||b[t])&&i!==!1?(i=`//`+(i||``),n&&n.charAt(0)!==`/`&&(n=`/`+n)):i||=``,r&&r.charAt(0)!==`#`&&(r=`#`+r),o&&o.charAt(0)!==`?`&&(o=`?`+o),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),o=o.replace(`#`,`%23`),t+i+n+o+r};function w(e,t){return S(e,!1,!0).resolve(t)}c.prototype.resolve=function(e){return this.resolveObject(S(e,!1,!0)).format()};function T(e,t){return e?S(e,!1,!0).resolveObject(t):t}c.prototype.resolveObject=function(e){if(typeof e==`string`){var t=new c;t.parse(e,!1,!0),e=t}for(var n=new c,r=Object.keys(this),i=0;i<r.length;i++){var a=r[i];n[a]=this[a]}if(n.hash=e.hash,e.href===``)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var o=Object.keys(e),s=0;s<o.length;s++){var l=o[s];l!==`protocol`&&(n[l]=e[l])}return b[n.protocol]&&n.hostname&&!n.pathname&&(n.pathname=`/`,n.path=n.pathname),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!b[e.protocol]){for(var u=Object.keys(e),d=0;d<u.length;d++){var f=u[d];n[f]=e[f]}return n.href=n.format(),n}if(n.protocol=e.protocol,!e.host&&!y[e.protocol]){for(var p=(e.pathname||``).split(`/`);p.length&&!(e.host=p.shift()););e.host||=``,e.hostname||=``,p[0]!==``&&p.unshift(``),p.length<2&&p.unshift(``),n.pathname=p.join(`/`)}else n.pathname=e.pathname;return n.search=e.search,n.query=e.query,n.host=e.host||``,n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,(n.pathname||n.search)&&(n.path=(n.pathname||``)+(n.search||``)),n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var m=n.pathname&&n.pathname.charAt(0)===`/`,h=e.host||e.pathname&&e.pathname.charAt(0)===`/`,g=h||m||n.host&&e.pathname,_=g,v=n.pathname&&n.pathname.split(`/`)||[],p=e.pathname&&e.pathname.split(`/`)||[],x=n.protocol&&!b[n.protocol];if(x&&(n.hostname=``,n.port=null,n.host&&(v[0]===``?v[0]=n.host:v.unshift(n.host)),n.host=``,e.protocol&&(e.hostname=null,e.port=null,e.host&&(p[0]===``?p[0]=e.host:p.unshift(e.host)),e.host=null),g&&=p[0]===``||v[0]===``),h)n.host=e.host||e.host===``?e.host:n.host,n.hostname=e.hostname||e.hostname===``?e.hostname:n.hostname,n.search=e.search,n.query=e.query,v=p;else if(p.length)v||=[],v.pop(),v=v.concat(p),n.search=e.search,n.query=e.query;else if(e.search!=null){if(x){n.host=v.shift(),n.hostname=n.host;var S=n.host&&n.host.indexOf(`@`)>0?n.host.split(`@`):!1;S&&(n.auth=S.shift(),n.hostname=S.shift(),n.host=n.hostname)}return n.search=e.search,n.query=e.query,(n.pathname!==null||n.search!==null)&&(n.path=(n.pathname?n.pathname:``)+(n.search?n.search:``)),n.href=n.format(),n}if(!v.length)return n.pathname=null,n.search?n.path=`/`+n.search:n.path=null,n.href=n.format(),n;for(var C=v.slice(-1)[0],w=(n.host||e.host||v.length>1)&&(C===`.`||C===`..`)||C===``,T=0,E=v.length;E>=0;E--)C=v[E],C===`.`?v.splice(E,1):C===`..`?(v.splice(E,1),T++):T&&(v.splice(E,1),T--);if(!g&&!_)for(;T--;)v.unshift(`..`);g&&v[0]!==``&&(!v[0]||v[0].charAt(0)!==`/`)&&v.unshift(``),w&&v.join(`/`).substr(-1)!==`/`&&v.push(``);var D=v[0]===``||v[0]&&v[0].charAt(0)===`/`;if(x){n.hostname=D?``:v.length?v.shift():``,n.host=n.hostname;var S=n.host&&n.host.indexOf(`@`)>0?n.host.split(`@`):!1;S&&(n.auth=S.shift(),n.hostname=S.shift(),n.host=n.hostname)}return g||=n.host&&v.length,g&&!D&&v.unshift(``),v.length>0?n.pathname=v.join(`/`):(n.pathname=null,n.path=null),(n.pathname!==null||n.search!==null)&&(n.path=(n.pathname?n.pathname:``)+(n.search?n.search:``)),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},c.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var E=S,D=w,O=T,k=C,A=c;function j(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;)e.unshift(`..`);return e}function M(){for(var e=``,t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:`/`;if(typeof r!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);r&&(e=r+`/`+e,t=r.charAt(0)===`/`)}return e=j(N(e.split(`/`),function(e){return!!e}),!t).join(`/`),(t?`/`:``)+e||`.`}function N(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var P=function(e){function t(){var t=this||self;return delete e.prototype.__magic__,t}return typeof globalThis==`object`?globalThis:this?t():(e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:t}),__magic__)}(Object),F=k,I=E,L=D,R=A,z=P.URL,B=P.URLSearchParams,V=/%/g,H=/\\/g,U=/\n/g,W=/\r/g,G=/\t/g,K=47;function ee(e){var t=e??null;return!!(t!==null&&t?.href&&t?.origin)}function te(e){if(e.hostname!==``)throw TypeError(`File URL host must be "localhost" or empty on browser`);for(var t=e.pathname,n=0;n<t.length;n++)if(t[n]===`%`){var r=t.codePointAt(n+2)|32;if(t[n+1]===`2`&&r===102)throw TypeError(`File URL path must not include encoded / characters`)}return decodeURIComponent(t)}function q(e){return e.includes(`%`)&&(e=e.replace(V,`%25`)),e.includes(`\\`)&&(e=e.replace(H,`%5C`)),e.includes(`
23
+ `)&&(e=e.replace(U,`%0A`)),e.includes(`\r`)&&(e=e.replace(W,`%0D`)),e.includes(` `)&&(e=e.replace(G,`%09`)),e}var ne=function(e){if(e===void 0)throw TypeError(`The "domain" argument must be specified`);return new z(`http://`+e).hostname},re=function(e){if(e===void 0)throw TypeError(`The "domain" argument must be specified`);return new z(`http://`+e).hostname},J=function(e){var t=new z(`file://`),n=M(e);return e.charCodeAt(e.length-1)===K&&n[n.length-1]!==`/`&&(n+=`/`),t.pathname=q(n),t},Y=function(e){if(!ee(e)&&typeof e!=`string`)throw TypeError(`The "path" argument must be of type string or an instance of URL. Received type `+typeof e+` (`+e+`)`);var t=new z(e);if(t.protocol!==`file:`)throw TypeError(`The URL must be of scheme file`);return te(t)},X=function(e,t){if(t===void 0&&(t={}),!(e instanceof z))return F(e);if(typeof t!=`object`||!t)throw TypeError(`The "options" argument must be of type object.`);var n=t.auth??!0,r=t.fragment??!0,i=t.search??!0;t.unicode;var a=new z(e.toString());return n||(a.username=``,a.password=``),r||(a.hash=``),i||(a.search=``),a.toString()},Z={format:X,parse:I,resolve:L,resolveObject:O,Url:R,URL:z,URLSearchParams:B,domainToASCII:ne,domainToUnicode:re,pathToFileURL:J,fileURLToPath:Y};e.URL=z,e.URLSearchParams=B,e.Url=R,e.default=Z,e.domainToASCII=ne,e.domainToUnicode=re,e.fileURLToPath=Y,e.format=X,e.parse=I,e.pathToFileURL=J,e.resolve=L,e.resolveObject=O,e=t.exports=Z})),Ht=t((e=>{ie();var t=Et(),n=Tt(),r=Dt(),i=Ot(),a=Vt(),o=e;o.request=function(e,n){e=typeof e==`string`?a.parse(e):r(e);var i=Z.location.protocol.search(/^https?:$/)===-1?`http:`:``,o=e.protocol||i,s=e.hostname||e.host,c=e.port,l=e.path||`/`;s&&s.indexOf(`:`)!==-1&&(s=`[`+s+`]`),e.url=(s?o+`//`+s:``)+(c?`:`+c:``)+l,e.method=(e.method||`GET`).toUpperCase(),e.headers=e.headers||{};var u=new t(e);return n&&u.on(`response`,n),u},o.get=function(e,t){var n=o.request(e,t);return n.end(),n},o.ClientRequest=t,o.IncomingMessage=n.IncomingMessage,o.Agent=function(){},o.Agent.defaultMaxSockets=4,o.globalAgent=new o.Agent,o.STATUS_CODES=i,o.METHODS=`CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REPORT.SEARCH.SUBSCRIBE.TRACE.UNLOCK.UNSUBSCRIBE`.split(`.`)})),Ut=t(((e,t)=>{w(),K();var n=class{constructor(){this._daemons=new Map,this._nextPid=1001,this._fetchPatched=!1,this._originalFetch=null}async startDaemon(e){let{name:t,port:n=5432,host:r=`127.0.0.1`,dataDir:i=`memory://`,handler:a,onStop:o,instance:s,fs:c,pidFile:l}=e,u=Number(n);if(this._daemons.has(u))throw Error(`Port ${u} is already in use by daemon '${this._daemons.get(u).name}' (PID ${this._daemons.get(u).pid})`);let d=this._nextPid++,f=null;if(this._ensureFetchInterceptor(),e.bindNodeServer&&G!==void 0&&G.versions&&G.versions.node)try{f=Ht().createServer(async(e,t)=>{try{let n=[];for await(let t of e)n.push(t);let i=C.concat(n).toString(`utf8`),o=new URL(e.url||`/`,`http://${r}:${u}`),s=await a({method:e.method||`GET`,url:o.toString(),path:o.pathname,searchParams:o.searchParams,headers:e.headers||{},body:i}),c=s&&s.status||200,l=Object.assign({"content-type":`application/json`,"access-control-allow-origin":`*`},s&&s.headers||{});t.writeHead(c,l),t.end(typeof s.body==`string`?s.body:JSON.stringify(s.body??{}))}catch(e){t.writeHead(500,{"content-type":`application/json`}),t.end(JSON.stringify({error:e.message||String(e)}))}}),await new Promise(e=>{f.once(`error`,()=>{f=null,e()}),f.listen(u,r,()=>e())})}catch{f=null}let p={pid:d,name:t,port:u,host:r,dataDir:i,startedAt:new Date().toISOString(),handler:a,onStop:o,instance:s,nodeHttpServer:f,pidFile:l,fs:c};if(this._daemons.set(u,p),c&&l)try{c.setFileByPath(l,JSON.stringify({pid:d,name:t,port:u,host:r,dataDir:i,startedAt:p.startedAt},null,2),!0)}catch{}return p}async stopDaemon(e){let t=this.getDaemon(e);if(!t)return null;if(this._daemons.delete(t.port),t.nodeHttpServer&&await new Promise(e=>t.nodeHttpServer.close(()=>e())),typeof t.onStop==`function`)try{await t.onStop(t)}catch{}if(t.fs&&t.pidFile)try{t.fs.deleteFileByPath(t.pidFile)}catch{}return t}async stopAll(){let e=Array.from(this._daemons.keys());for(let t of e)await this.stopDaemon(t)}getDaemon(e){if(e==null)return this._daemons.size===1?this._daemons.values().next().value:null;let t=Number(e);if(!Number.isNaN(t)&&this._daemons.has(t))return this._daemons.get(t);for(let n of this._daemons.values())if(n.pid===t||n.name===String(e).toLowerCase()||n.dataDir===e)return n;return null}listDaemons(){return Array.from(this._daemons.values())}_ensureFetchInterceptor(){if(this._fetchPatched||typeof globalThis.fetch!=`function`)return;let e=globalThis.fetch.bind(globalThis);this._originalFetch=e;let t=this,n=async function(n,r={}){let i=typeof n==`string`?n:n&&typeof n.url==`string`?n.url:String(n),a=i.match(/^https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)(\/.*)?$/i);if(a){let e=Number(a[1]),o=t._daemons.get(e);if(o&&typeof o.handler==`function`){let e=new URL(i),t=(r.method||n&&n.method||`GET`).toUpperCase(),a={};if(r.headers){if(typeof r.headers.forEach==`function`)r.headers.forEach((e,t)=>{a[t.toLowerCase()]=e});else if(typeof r.headers==`object`)for(let[e,t]of Object.entries(r.headers))a[e.toLowerCase()]=t}let s=r.body!==void 0&&r.body!==null?String(r.body):null,c=await o.handler({method:t,url:i,path:e.pathname,searchParams:e.searchParams,headers:a,body:s}),l=c&&c.status||200,u=c&&c.statusText||(l===200?`OK`:`Error`),d=typeof c?.body==`string`?c.body:JSON.stringify(c?.body??{}),f=new Map(Object.entries(Object.assign({"content-type":`application/json`,"x-powered-by":`${o.name}-wasm-daemon`},c&&c.headers||{})));return{ok:l>=200&&l<300,status:l,statusText:u,headers:{get:e=>f.get(String(e).toLowerCase())||null,forEach:e=>f.forEach((t,n)=>e(t,n))},text:async()=>d,json:async()=>JSON.parse(d),arrayBuffer:async()=>new TextEncoder().encode(d).buffer}}}return e(n,r)};n.__isWbtDaemonFetch=!0,globalThis.fetch=n,this._fetchPatched=!0}};t.exports={DaemonManager:n,daemonManager:new n}})),Wt=t(((e,t)=>{function n(e,t,n={}){let{showRowCount:r=!0}=n;if(!e||e.length===0)return[];let i=e.map(e=>String(e)),a=i.map(e=>e.length),o=(t||[]).map(e=>i.map((t,n)=>{let r=Array.isArray(e)?e[n]:e[t],i=r==null?`NULL`:String(r);return i.length>a[n]&&(a[n]=i.length),i})),s=[],c=i.map((e,t)=>` `+e.padEnd(a[t])+` `).join(`|`),l=a.map(e=>`-`.repeat(e+2)).join(`+`);s.push(c),s.push(l);for(let e of o)s.push(e.map((e,t)=>` `+e.padEnd(a[t])+` `).join(`|`));return r&&s.push(`(${o.length} row${o.length===1?``:`s`})`),s}function r(e,t,n=!1){let r=[],i=(e||[]).map(e=>String(e));n&&i.length>0&&r.push(i.join(`|`));for(let e of t||[]){let t=i.map((t,n)=>{let r=Array.isArray(e)?e[n]:e[t];return r==null?``:String(r)});r.push(t.join(`|`))}return r}function i(e,t,n=!0){let r=e=>{let t=e==null?``:String(e);return/[",\r\n]/.test(t)?`"`+t.replace(/"/g,`""`)+`"`:t},i=[],a=(e||[]).map(e=>String(e));n&&a.length>0&&i.push(a.map(r).join(`,`));for(let e of t||[]){let t=a.map((t,n)=>r(Array.isArray(e)?e[n]:e[t]));i.push(t.join(`,`))}return i}var{readBytesFromFs:a,writeBytesToFs:o,loadModule:s,extractHelpFromText:c,inspectWasmBytes:l,formatWasmHelp:u}=J();t.exports={formatTable:n,formatPipeList:r,formatCsv:i,readBytesFromFs:a,writeBytesToFs:o,loadModule:s,extractHelpFromText:c,inspectWasmBytes:l,formatWasmHelp:u}})),Gt=t(((e,t)=>{var n=a(),r=Y(),{formatTable:i,formatPipeList:o,formatCsv:s,loadModule:c}=Wt(),{daemonManager:l}=Ut(),u=new Map;async function d(e,t,n,r={}){let i=await c(`@electric-sql/pglite`,n.cdnUrl,r.moduleLoader),a=i.PGlite||i.default||i;if(!e||e===`memory://`||e===`:memory:`){let e=typeof a.create==`function`?await a.create():new a;return e.waitReady&&await e.waitReady,{pg:e,isEphemeral:!0,absDir:null}}let o=t.absolutePath(e);if(u.has(o))return{pg:u.get(o),isEphemeral:!1,absDir:o};if(t.isRealFilesystem){ne().mkdirSync(o,{recursive:!0});let e=typeof a.create==`function`?await a.create(o):new a(o);return e.waitReady&&await e.waitReady,u.set(o,e),{pg:e,isEphemeral:!1,absDir:o}}t.exists(o)||t.setFileByPath(o,{},!0);let s=`${o}/wal.sql`,l=typeof a.create==`function`?await a.create():new a;l.waitReady&&await l.waitReady;let d=t.getFileByPath(s);if(typeof d==`string`&&d.trim())try{await l.exec(d)}catch{}return u.set(o,l),{pg:l,isEphemeral:!1,absDir:o}}function f(e,t,n,r){if(!(n||!t||!e||e.isRealFilesystem)&&/\b(CREATE|INSERT|UPDATE|DELETE|ALTER|DROP|TRUNCATE)\b/i.test(r))try{let n=`${t}/wal.sql`,i=e.getFileByPath(n),a=r.trim().endsWith(`;`)?r.trim():r.trim()+`;`,o=typeof i==`string`&&i.length>0?`${i}\n${a}`:a;e.setFileByPath(n,o,!0)}catch{}}async function p({dataDir:e=`/var/lib/postgresql/data`,port:t=5432,host:n=`127.0.0.1`,fs:r,pkgMeta:i,wbtConfig:a}){let{pg:o,isEphemeral:s,absDir:c}=await d(e,r,i,a),u=`${c||`/var/run`}/postmaster.pid`;return await l.startDaemon({name:`pglite`,port:Number(t),host:n,dataDir:c||e,instance:o,fs:r,pidFile:u,handler:async n=>{if(n.path===`/status`||n.path===`/health`)return{status:200,body:{status:`ready`,engine:`pglite`,version:i.version,port:Number(t),dataDir:c||e}};let a=n.searchParams?n.searchParams.get(`sql`):null;if(!a&&n.body){let e=n.body.trim();if(e.startsWith(`{`))try{let t=JSON.parse(e);a=t.query||t.sql||``}catch{a=e}else a=e}if(!a)return{status:400,body:{error:`No SQL query provided. Pass SQL in POST body or ?sql= query param.`}};try{let e=typeof o.exec==`function`?await o.exec(a):[await o.query(a)];f(r,c,s,a);let t=Array.isArray(e)?e:[e],n=t[t.length-1]||{fields:[],rows:[]};return{status:200,body:{fields:(n.fields||[]).map(e=>typeof e==`string`?e:e.name),rows:n.rows||[],affectedRows:n.affectedRows??0,results:t}}}catch(e){return{status:400,body:{error:e.message||String(e)}}}}})}function m(e,t={},n=`pglite`){class a extends r{static get name(){return n}get name(){return n}constructor(e,t){super(e,t),this._parsed=this._parseArgs(e||[]),this._pg=null,this._mode=this._parsed.mode||`table`}_parseArgs(e){let t=null,n=null,r=null,i=`table`,a=!1,o=!1,s=!1,c=null,u=null,d=5432,f=[];for(let l=0;l<e.length;l++){let p=e[l];p===`--help`||p===`-h`&&l+1>=e.length||p===`-?`?o=!0:p===`--version`||p===`-V`||p===`-v`?s=!0:p===`--serve`||p===`--daemon`?c=`start`:(p===`-p`||p===`--port`)&&l+1<e.length?d=Number(e[++l])||5432:p.startsWith(`--port=`)?d=Number(p.slice(7))||5432:(p===`-h`||p===`--host`)&&l+1<e.length?u=e[++l]:(p===`-c`||p===`--command`)&&l+1<e.length?n=e[++l]:(p===`-f`||p===`--file`)&&l+1<e.length?r=e[++l]:(p===`-d`||p===`--dbname`||p===`-D`||p===`--pgdata`)&&l+1<e.length?t=e[++l]:p===`-t`||p===`--tuples-only`||p===`-A`||p===`--no-align`?(a=!0,i=`list`):p===`--csv`?i=`csv`:p===`--json`?i=`json`:p.startsWith(`-`)||f.push(p)}if(f.length>0&&[`serve`,`start`,`stop`,`status`].includes(f[0].toLowerCase())){let e=f.shift().toLowerCase();c=e===`serve`?`start`:e}f.length===1?/^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER|WITH|BEGIN|SHOW|SET|EXPLAIN|VALUES|\\)\b/i.test(f[0])?n=f[0]:t=f[0]:f.length>=2&&(t=f[0],n=f.slice(1).join(` `));let p=l.getDaemon(d),m=!!(u||p&&!t);return{dataDir:t||(p?p.dataDir:`memory://`),sql:n,file:r,mode:i,tuplesOnly:a,help:o,version:s,daemonAction:c,host:u||`127.0.0.1`,port:d,useDaemon:m}}shouldBeInteractive(){return!(this._parsed.help||this._parsed.version||this._parsed.daemonAction||this._parsed.sql!==null||this._parsed.file!==null||this.stdin!==void 0&&this.stdin!==null&&String(this.stdin).trim().length>0)}getReplTitle(){let t=l.getDaemon(this._parsed.port),n=t?`daemon://${t.host}:${t.port} (${t.dataDir})`:this._parsed.dataDir;return`PGlite PostgreSQL WASM (${e.version}) — ${n}`}getReplPrompt(){return`postgres=# `}getReplWelcome(){let t=l.getDaemon(this._parsed.port);return[`psql (PGlite ${e.version}, PostgreSQL 16.4 WASM)`,t?`Connected to running PGlite daemon on ${t.host}:${t.port} (PID ${t.pid})`:`Data directory: ${this._parsed.dataDir}`,`Type "\\?" for help, "\\dt" to list tables, "\\q" or ".exit" to quit.`]}async _initPg(){let n=l.getDaemon(this._parsed.port);if(n&&(this._parsed.useDaemon||n.dataDir===this.fs.absolutePath(this._parsed.dataDir))){this._pg=n.instance,this._absDataDir=n.dataDir,this._isEphemeral=!1;return}let{pg:r,isEphemeral:i,absDir:a}=await d(this._parsed.dataDir,this.fs,e,t);this._pg=r,this._isEphemeral=i,this._absDataDir=a}async _executeQuery(e){let t=[],n=e.trim();if(!n)return t;if(n.startsWith(`\\`)){let e=n.split(/\s+/),t=e[0];if(t===`\\?`||t===`\\help`)return[`General:`,` \\dt list tables in public schema`,` \\d [NAME] describe table, view, or index`,` \\l list databases`,` \\i FILE execute commands from file`,` \\q quit pglite`];if(t===`\\dt`)return this._executeQuery(`SELECT schemaname AS schema, tablename AS name, tableowner AS owner FROM pg_catalog.pg_tables WHERE schemaname NOT IN ('pg_catalog', 'information_schema') ORDER BY 1, 2;`);if(t===`\\l`)return this._executeQuery(`SELECT datname AS name, pg_catalog.pg_encoding_to_char(encoding) AS encoding FROM pg_catalog.pg_database;`);if(t===`\\d`){if(!e[1])return this._executeQuery(`SELECT table_schema AS schema, table_name AS name, table_type AS type FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') ORDER BY 1, 2;`);let t=e[1].replace(/'/g,`''`);return this._executeQuery(`SELECT column_name AS column, data_type AS type, is_nullable AS nullable, column_default AS default FROM information_schema.columns WHERE table_name = '${t}' ORDER BY ordinal_position;`)}if(t===`\\i`&&e[1]){let t=this.fs.getFileByPath(e[1]);if(t==null)throw Error(`${e[1]}: No such file or directory`);return this._executeQuery(String(t))}throw Error(`invalid command ${t}. Try \\? for help.`)}let r=typeof this._pg.exec==`function`?await this._pg.exec(e):[await this._pg.query(e)];f(this.fs,this._absDataDir,this._isEphemeral,e);let a=Array.isArray(r)?r:[r];for(let e of a){if(!e)continue;let n=(e.fields||[]).map(e=>typeof e==`string`?e:e.name),r=e.rows||[];if(n.length===0){typeof e.affectedRows==`number`&&t.push(`OK (${e.affectedRows})`);continue}this._mode===`list`?t.push(...o(n,r,!1)):this._mode===`csv`?t.push(...s(n,r,!0)):this._mode===`json`?t.push(JSON.stringify(r)):t.push(...i(n,r,{showRowCount:!0}))}return t}async initRepl(){await this._initPg()}async evaluateReplLine(e){try{return{output:await this._executeQuery(e)}}catch(e){return{error:`ERROR: ${e.message||e}`}}}async cleanupRepl(){if(this._isEphemeral&&this._pg&&typeof this._pg.close==`function`)try{await this._pg.close()}catch{}}async _handleDaemonAction(){let n=this._parsed.daemonAction,r=this._parsed.port||5432,i=this._parsed.dataDir===`memory://`?`/var/lib/postgresql/data`:this._parsed.dataDir;if(n===`start`){try{let n=await p({dataDir:i,port:r,host:this._parsed.host,fs:this.fs,pkgMeta:e,wbtConfig:t});this.stdOut=`waiting for server to start.... done`,this.stdOut=`server started (PID ${n.pid}) listening on http://${n.host}:${n.port} (dataDir: ${n.dataDir})`}catch(e){this.stdErr=`pglite: could not start server: ${e.message||e}`,this.exitCode=1}return}if(n===`stop`){let e=await l.stopDaemon(r)||await l.stopDaemon(`pglite`);if(!e){this.stdErr=`pglite: no server running on port ${r}`,this.exitCode=1;return}this.stdOut=`waiting for server to shut down.... done`,this.stdOut=`server stopped (PID ${e.pid})`;return}if(n===`status`){let e=l.getDaemon(r)||l.getDaemon(`pglite`);if(!e){this.stdOut=`pglite: no server running`,this.exitCode=3;return}this.stdOut=`pglite server is running (PID: ${e.pid}, port: ${e.port}, dataDir: ${e.dataDir})`}}async runNonInteractive(){if(this._parsed.help){[`${n} (${e.name} ${e.version} wasm) — ${e.description}`,`Usage: ${n} [OPTIONS] [DATADIR] [SQL]`,` pglite serve [-D DATADIR] [-p PORT] Start PGlite background daemon`,` pglite status [-p PORT] Check daemon status`,` pglite stop [-p PORT] Stop running daemon`,``,`Options:`,` -c, --command=SQL Run only single command (SQL or internal) and exit`,` -f, --file=FILENAME Execute commands from file, then exit`,` -d, -D, --pgdata=DIR Database storage directory in filesystem`,` --serve, --daemon Start PGlite server daemon in the background`,` -h, --host=HOSTNAME Database server host (default: 127.0.0.1)`,` -p, --port=PORT Database server port (default: 5432)`,` -t, --tuples-only Print rows only (pipe-separated)`,` --csv CSV output mode`,` --json JSON output mode`,` -h, --help Show this help message and exit`,` -V, --version Show WebAssembly binary version and exit`,``,`Aliases: pglite, psql, pg_ctl`,`Source: ${e.homepage||e.cdnUrl}`].forEach(e=>{this.stdOut=e});return}if(this._parsed.version){this.stdOut=`${n} (${e.name} ${e.version} wasm)`;return}if(this._parsed.daemonAction){await this._handleDaemonAction();return}try{await this._initPg();let e=[];if(this._parsed.file){let t=this.fs.getFileByPath(this._parsed.file);if(t==null){this.stdErr=`${n}: error: ${this._parsed.file}: No such file or directory`,this.exitCode=1;return}e.push(String(t))}this._parsed.sql!==null&&e.push(this._parsed.sql),this.stdin!==void 0&&this.stdin!==null&&String(this.stdin).trim().length>0&&e.push(String(this.stdin));for(let t of e)(await this._executeQuery(t)).forEach(e=>{this.stdOut=e})}catch(e){this.stdErr=`ERROR: ${e.message||e}`,this.exitCode=1}finally{await this.cleanupRepl()}}}return a}function h(e,t={}){class r extends n{static get name(){return`pg_ctl`}get name(){return`pg_ctl`}get requiresFilesystem(){return!0}async run(){let n=[...this.arguments||[]];if(n.includes(`--version`)||n.includes(`-V`)||n.includes(`-v`)){this.stdOut=`pg_ctl (${e.name} ${e.version} wasm)`;return}if(n.length===0||n.includes(`--help`)||n.includes(`-h`)){[`pg_ctl (${e.name} ${e.version} wasm) — Initialize, start, stop, or control a PGlite PostgreSQL server daemon`,`Usage: pg_ctl <start|stop|restart|status> [-D DATADIR] [-p PORT]`,``,`Options:`,` -D, --pgdata=DATADIR Database storage directory (default: /var/lib/postgresql/data)`,` -p, --port=PORT Database server port (default: 5432)`,` -h, --help Show this help message and exit`,` -V, --version Show WebAssembly binary version and exit`].forEach(e=>{this.stdOut=e});return}let r=null,i=`/var/lib/postgresql/data`,a=5432;for(let e=0;e<n.length;e++){let t=n[e];if((t===`-D`||t===`--pgdata`)&&e+1<n.length)i=n[++e];else if((t===`-p`||t===`--port`)&&e+1<n.length)a=Number(n[++e])||5432;else if(t===`-o`&&e+1<n.length){let t=n[++e].match(/-p\s*(\d+)/);t&&(a=Number(t[1]))}else !t.startsWith(`-`)&&!r&&(r=t.toLowerCase())}r===`restart`&&(await l.stopDaemon(a),r=`start`);let o=new(m(e,t,`pg_ctl`))([r||`status`,`-D`,i,`-p`,String(a)],this.context);o.fs=this.fs;let s=await o.runCommand();for(let e of s.getStdOutput())e.type===`out`?this.stdOut=e.string:e.type===`err`&&(this.stdErr=e.string);this.exitCode=s.getExitCode()}}return r}t.exports=m,t.exports.createPgliteCommand=m,t.exports.createPgCtlCommand=h,t.exports.pgliteInstances=u}));return t(((e,t)=>{var n=o(),r=J(),i=Y(),{DEFAULT_REGISTRY:a,resolvePackageName:s}=X(),{writeBytesToFs:c,createGenericWasmCommand:l}=r,{createReplWasmCommand:u}=i,{daemonManager:d}=Ut(),{createPgliteCommand:f,createPgCtlCommand:p}=Gt(),m=`/var/lib/wbt/installed.json`,h=`/var/cache/wbt`,g={pglite:(e,t)=>[{bin:e.bin||`pglite`,Cmd:f(e,t,`pglite`)},{bin:`psql`,Cmd:f(e,t,`psql`)},{bin:`pg_ctl`,Cmd:p(e,t)}]};function _(e,t,n={}){class i extends r{static get name(){return e}get name(){return e}constructor(e,r){super(t,e,r),this.script=t,this.arguments=e||[],this.context=r||null,this._pkgMeta=n}}return i}var v=class extends n{static get name(){return`wbt`}get name(){return`wbt`}get requiresFilesystem(){return!0}static get _config(){return this.__wbtConfig||{}}static configure(e={}){class t extends v{static get name(){return`wbt`}}return t.__wbtConfig=Object.assign({},this._config,e),t}static restoreInstalled(e,t={}){let n=e.context||e;if(!n||!n.fs)return;let r=new(this.configure(t))([],n);r.fs=n.fs.sandbox(),r._restoreCommands()}_getRegistry(){let e=this.constructor._config||{},t=Object.assign({},a,e.registry||{});try{let e=this.context.fs._getFileRaw(`${h}/remote-registry.json`);if(typeof e==`string`&&e.trim()){let n=JSON.parse(e);Object.assign(t,n)}}catch{}return t}_readState(){try{let e=this.context.fs._getFileRaw(m);if(typeof e==`string`&&e.trim()){let t=JSON.parse(e);if(t&&typeof t==`object`&&t.packages)return t}}catch{}return{packages:{}}}_writeState(e){this.context.fs._setFileRaw(m,JSON.stringify(e,null,2),!0)}_buildCommandsForPackage(e){let t=this.constructor._config||{};if(e.type===`custom-wasm`&&e.wasmPath){let t=(e.bin||e.name).toLowerCase();return[{bin:t,Cmd:_(t,e.wasmPath,e)}]}let n=g[e.adapter||e.name];if(n)return n(e,t);let r=e.repl?u:l,i=(e.bin||e.name.split(`/`).pop()).toLowerCase(),a=[{bin:i,Cmd:r(e,t,i)}];for(let n of e.aliases||[]){let o=n.toLowerCase();o!==i&&a.push({bin:o,Cmd:r(e,t,o)})}return a}_registerPackageIntoContext(e){let t=this.context.getVar(`PATH`)||`/bin`,n=this._buildCommandsForPackage(e),r=[];for(let{bin:e,Cmd:i}of n){let n=e.toLowerCase();this._installBin(t,n,i),r.push(n)}for(let i of e.aliases||[]){let e=i.toLowerCase();if(!r.includes(e)&&n.length>0){let i=n[0].Cmd;class a extends i{static get name(){return e}get name(){return e}}this._installBin(t,e,a),r.push(e)}}return r}_installBin(e,t,n){let r=`${e}/${t}`;this.context.fs.addFiles({[r]:n}),this.context.fs.setMode(r,365)}_removeBin(e,t){let n=`${e}/${t.toLowerCase()}`;if(this.context.fs._deleteByAbsolutePath)this.context.fs._deleteByAbsolutePath(n),this.context.fs._triggerChange();else try{this.context.fs.deleteFileByPath(n)}catch{}}_restoreCommands(){let e=this._readState(),t=this._getRegistry();for(let[n,r]of Object.entries(e.packages)){let e=t[n]||r;if(e)try{this._registerPackageIntoContext(e)}catch{}}}async run(){let e=[...this.arguments||[]];if(e.length===0||e.includes(`--help`)||e.includes(`-h`)||e[0]===`help`){this._printHelp();return}if(e.includes(`--version`)||e.includes(`-v`)){this.stdOut=`wbt 1.1.0 (Web Binary Tool for brsh)`;return}let t=e.shift().toLowerCase();switch(t){case`install`:case`add`:await this._handleInstall(e);break;case`remove`:case`uninstall`:case`purge`:await this._handleRemove(e);break;case`list`:this._handleList(e);break;case`search`:this._handleSearch(e);break;case`show`:case`info`:this._handleShow(e);break;case`update`:await this._handleUpdate(e);break;case`run`:await this._handleRun(e);break;case`services`:case`daemons`:case`ps`:await this._handleServices(e);break;default:this.stdErr=`E: Invalid operation ${t}`,this.stdErr=`Run 'wbt --help' for usage information.`,this.exitCode=100}}async _handleInstall(e){let t=[],n=[],r=null;for(let i=0;i<e.length;i++){let a=e[i];a===`--as`&&i+1<e.length?r=e[++i]:a.startsWith(`--as=`)?r=a.slice(5):a.startsWith(`-`)?t.push(a):n.push(a)}let i=t.includes(`-q`)||t.includes(`--quiet`),a=t.includes(`--generic`)||t.includes(`--npm`);if(n.length===0){this.stdErr=`E: Specify at least one package to install`,this.exitCode=1;return}let o=e=>/^(https?:\/\/|data:)/i.test(e),c=e=>e.startsWith(`data:`)?`custom-wasm`:e.split(`/`).pop().split(`?`)[0].replace(/\.(wasm|wat|mjs|js)$/i,``)||`custom-wasm`,l=this._getRegistry(),u=this._readState(),d=!1;for(let e=0;e<n.length;e++){let f=n[e];if(!o(f)&&e+1<n.length&&o(n[e+1])){let t=n[++e],a=(r||f).toLowerCase();if(await this._installCustomUrl(a,t,i,u),this.exitCode)return;continue}if(o(f)){let e=f,t=(r||c(e)).toLowerCase();if(await this._installCustomUrl(t,e,i,u),this.exitCode)return;continue}!i&&!d&&(this.stdOut=`Reading package lists... Done`,this.stdOut=`Building dependency tree... Done`,this.flush(),d=!0);let p=l[s(f)];if(!p&&(a||f.startsWith(`npm:`)||f.startsWith(`esm:`))){let e=f.replace(/^(npm|esm):/i,``),t=(r||e.replace(/^@[^/]+\//,``).split(`@`)[0]).toLowerCase();p={name:t,bin:t,version:`latest`,description:`Dynamic WASM/ESM package from https://esm.sh/${e}`,cdnUrl:`https://esm.sh/${e}`,type:`generic-runtime`}}if(!p){this.stdErr=`E: Unable to locate package ${f}`,this.exitCode=100;return}if(u.packages[p.name]&&!t.includes(`--reinstall`)&&!t.includes(`-f`)){i||(this.stdOut=`${p.name} is already the newest version (${p.version}).`);continue}if(i||(this.stdOut=`Get:1 ${p.cdnUrl} ${p.name} ${p.version} [${p.size||`WASM`}]`,this.stdOut=`Unpacking ${p.name} (${p.version}) ...`,this.flush()),t.includes(`--preload`)){let e=this.constructor._config||{},{loadModule:t}=Wt();try{await t(p.name,p.cdnUrl,e.moduleLoader)}catch(e){this.stdErr=`E: Failed to fetch ${p.name}: ${e.message||e}`,this.exitCode=1;return}}let m=this._registerPackageIntoContext(p);u.packages[p.name]={name:p.name,bin:p.bin,bins:m,aliases:p.aliases||[],version:p.version,description:p.description,cdnUrl:p.cdnUrl,type:p.type,adapter:p.adapter,repl:p.repl,installedAt:new Date().toISOString()},i||(this.stdOut=`Setting up ${p.name} (${p.version}) -> /bin/${m.join(`, /bin/`)} ...`)}this._writeState(u)}async _installCustomUrl(e,t,n=!1,r=null){if(!/\.(wasm|wat)(\?.*)?$/i.test(t)&&(/^https?:\/\/esm\.sh\//i.test(t)||/\.(mjs|js)(\?.*)?$/i.test(t))){let i={name:e,bin:e,bins:[e],version:`custom-esm`,description:`Custom ESM/WASM module from ${t}`,cdnUrl:t,type:`generic-runtime`,installedAt:new Date().toISOString()};this._registerPackageIntoContext(i);let a=r||this._readState();a.packages[e]=i,this._writeState(a),n||(this.stdOut=`Setting up ${e} (generic runtime) -> /bin/${e} ...`);return}let i=(this.constructor._config||{}).fetch||(typeof fetch==`function`?fetch:null);if(!i){this.stdErr=`E: fetch is not available in this environment`,this.exitCode=1;return}n||(this.stdOut=`Get:1 ${t} ${e}`,this.flush());let a=t.replace(/^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/(?:blob|raw)\/([^/]+)\/(.+)$/i,`https://raw.githubusercontent.com/$1/$2/$3/$4`),o;try{o=await i(a)}catch(e){if(/^https?:\/\/github\.com\/[^/]+\/[^/]+\/releases\/download\//i.test(a))try{o=await i(`https://corsproxy.io/?${encodeURIComponent(a)}`)}catch{this.stdErr=`E: Failed to fetch ${t} (GitHub Releases blocks browser CORS requests; host the .wasm on jsDelivr/unpkg/raw.githubusercontent.com): ${e.message||e}`,this.exitCode=1;return}else{this.stdErr=`E: Failed to fetch ${t}: ${e.message||e}`,this.exitCode=1;return}}if(!o||!o.ok){this.stdErr=`E: HTTP ${o?o.status:`error`} fetching ${t}`,this.exitCode=1;return}let s=t.endsWith(`.wat`),l=`/var/lib/wbt/wasm/${e}${s?`.wat`:`.wasm`}`;if(s){let e=await o.text();this.context.fs._setFileRaw(l,e,!0)}else{let e=await o.arrayBuffer();c(this.fs,l,new Uint8Array(e),`application/wasm`)}this.context.fs.setMode(l,493);let u={name:e,bin:e,bins:[e],version:`custom`,description:`Custom WebAssembly binary from ${t}`,cdnUrl:t,type:`custom-wasm`,wasmPath:l,installedAt:new Date().toISOString()};this._registerPackageIntoContext(u);let d=r||this._readState();d.packages[e]=u,this._writeState(d),n||(this.stdOut=`Setting up ${e} (custom) -> /bin/${e} ...`)}async _handleRemove(e){let t=e.filter(e=>!e.startsWith(`-`));if(t.length===0){this.stdErr=`E: Specify at least one package to remove`,this.exitCode=1;return}let n=this._readState(),r=this.context.getVar(`PATH`)||`/bin`;for(let e of t){let t=s(e),i=n.packages[t]||n.packages[e.toLowerCase()];if(!i){this.stdErr=`E: Package '${e}' is not installed, so not removed`,this.exitCode=1;return}let a=i.bins||[i.bin||i.name,...i.aliases||[]];for(let e of a)this._removeBin(r,e);if(i.wasmPath)try{this.context.fs.deleteFileByPath(i.wasmPath)}catch{}delete n.packages[i.name],this.stdOut=`Removing ${i.name} (${i.version}) ...`}this._writeState(n)}_handleList(e){let t=e.includes(`--installed`)||e.includes(`-i`),n=this._getRegistry(),r=this._readState();this.stdOut=`Listing...`;let i=t?Object.keys(r.packages).sort():Array.from(new Set([...Object.keys(n),...Object.keys(r.packages)])).sort();for(let e of i){let t=n[e],i=r.packages[e],a=i||t;if(!a)continue;let o=i?`[installed]`:`[available]`,s=a.bin&&a.bin!==a.name?` (bin: ${a.bin})`:``;this.stdOut=`${a.name}/wasm ${a.version} wasm ${o}${s} - ${a.description||``}`}}_handleSearch(e){let t=e.filter(e=>!e.startsWith(`-`)).join(` `).toLowerCase(),n=this._getRegistry(),r=this._readState();this.stdOut=`Sorting... Done`,this.stdOut=`Full Text Search... Done`;let i=Object.values(n).filter(e=>t?e.name.toLowerCase().includes(t)||e.bin&&e.bin.toLowerCase().includes(t)||e.aliases&&e.aliases.some(e=>e.toLowerCase().includes(t))||e.description&&e.description.toLowerCase().includes(t)||e.details&&e.details.toLowerCase().includes(t):!0);for(let e of i){let t=r.packages[e.name]?` [installed]`:``;this.stdOut=`${e.name}/wasm ${e.version} wasm${t}`,this.stdOut=` ${e.description}`}}_handleShow(e){let t=e.find(e=>!e.startsWith(`-`));if(!t){this.stdErr=`E: No packages found — specify a package name`,this.exitCode=1;return}let n=s(t),r=this._getRegistry(),i=this._readState(),a=i.packages[n]||r[n];if(!a){this.stdErr=`E: No packages found matching ${t}`,this.exitCode=100;return}let o=Object.assign({},r[n]||{},a),c=!!i.packages[o.name];this.stdOut=`Package: ${o.name}`,this.stdOut=`Version: ${o.version}`,this.stdOut=`State: ${c?`installed`:`not installed`}`,this.stdOut=`Binary: ${o.bin||o.name}`,o.aliases&&o.aliases.length>0&&(this.stdOut=`Aliases: ${o.aliases.join(`, `)}`),o.size&&(this.stdOut=`Download-Size: ${o.size}`),o.cdnUrl&&(this.stdOut=`APT-Sources: ${o.cdnUrl}`),o.homepage&&(this.stdOut=`Homepage: ${o.homepage}`),this.stdOut=`Description: ${o.description||``}`,o.details&&(this.stdOut=` ${o.details}`)}async _handleUpdate(){let e=this.constructor._config||{},t=e.sources||[],n=e.fetch||(typeof fetch==`function`?fetch:null),r={},i=1;this.stdOut=`Hit:1 https://registry.brsh.dev/wbt wasm InRelease`;for(let e of t)if(i++,n)try{let t=await n(e);if(t&&t.ok){let n=await t.json();Object.assign(r,n),this.stdOut=`Get:${i} ${e} Packages`}}catch(t){this.stdErr=`W: Failed to fetch ${e}: ${t.message||t}`}Object.keys(r).length>0&&this.context.fs._setFileRaw(`${h}/remote-registry.json`,JSON.stringify(r,null,2),!0),this._restoreCommands();let a=this._getRegistry();this.stdOut=`Reading package lists... Done (${Object.keys(a).length} packages available)`}async _handleRun(e){if(e.length===0){this.stdErr=`E: Specify a package to run (e.g. wbt run sqlite3 --version)`,this.exitCode=1;return}let t=e.shift(),n=s(t),r=this._getRegistry(),i=this._readState().packages[n]||r[n];if(!i&&(t.startsWith(`npm:`)||t.startsWith(`esm:`))){let e=t.replace(/^(npm|esm):/i,``),n=e.replace(/^@[^/]+\//,``).split(`@`)[0].toLowerCase();i={name:n,bin:n,version:`latest`,cdnUrl:`https://esm.sh/${e}`,type:`generic-runtime`}}if(!i){this.stdErr=`E: Unable to locate package ${t}`,this.exitCode=100;return}let a=this._buildCommandsForPackage(i),o=(a.find(e=>e.bin===t.toLowerCase())||a[0]).Cmd,c=new o(e,this.context);c.requiresFilesystem&&(c.fs=this.context.fs.sandbox()),this.stdin!==void 0&&(c.stdin=this.stdin);let l=await c.runCommand();for(let e of l.getStdOutput())e.type===`out`?this.stdOut=e.string:e.type===`err`&&(this.stdErr=e.string);this.exitCode=l.getExitCode()}async _handleServices(e){if((e[0]||`list`).toLowerCase()===`stop`&&e[1]){let t=await d.stopDaemon(e[1]);if(!t){this.stdErr=`E: No running service matching '${e[1]}'`,this.exitCode=1;return}this.stdOut=`Stopped service ${t.name} (PID ${t.pid}, port ${t.port})`;return}let t=d.listDaemons();if(t.length===0){this.stdOut=`No WASM background services currently running.`;return}this.stdOut=`PID SERVICE PORT HOST DATADIR`;for(let e of t)this.stdOut=`${String(e.pid).padEnd(5)} ${e.name.padEnd(10)} ${String(e.port).padEnd(6)} ${e.host.padEnd(11)} ${e.dataDir}`}_printHelp(){[`wbt 1.1.0 — Web Binary Tool (WASM binary manager & runtime for brsh)`,`Usage: wbt [options] command [package ...]`,``,`Commands:`,` install <pkg> [url] Install a WASM binary from registry, npm:<pkg>, or a custom URL`,` remove <pkg> Remove an installed WASM binary`,` update Update package index and restore installed binaries`,` list [--installed] List available or installed WASM binaries`,` search <query> Search available WASM binaries by name or description`,` show <pkg> Show detailed information about a package`,` run <pkg> [args...] Run a WASM binary without permanently installing it`,` services [stop <id>] List or stop running WASM background server daemons`,``,`Curated WASM Packages:`,` pglite WASM PostgreSQL database, REPL & daemon (pglite, psql, pg_ctl)`,` sqlite3 SQLite3 compiled to WebAssembly (sqlite3, sqlite)`,` assemblyscript AssemblyScript compiler & ts-node style runtime (asc, asrun, asnode)`,` jq Command-line JSON processor (jq)`,` python3 CPython 3.12 via Pyodide (python3, python, py)`,` duckdb DuckDB analytical SQL OLAP engine (duckdb)`,` graphviz Graphviz DOT diagram compiler (dot)`,` ffmpeg FFmpeg multimedia transcoder (ffmpeg)`,` wabt WebAssembly Binary Toolkit (wat2wasm, wasm2wat)`,` quickjs Sandboxed QuickJS JavaScript engine (qjs)`,` lua Lua 5.4 WebAssembly interpreter (lua)`].forEach(e=>{this.stdOut=e})}};t.exports=v,t.exports.Wbt=v,t.exports.DEFAULT_REGISTRY=a,t.exports.daemonManager=d,t.exports.createGenericWasmCommand=l,t.exports.createReplWasmCommand=u}))()})();
24
+ //# sourceMappingURL=wbt.min.js.map