@gadgetinc/substrate 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/kernel.wasm +0 -0
- package/dist/assets/manifest.json +32 -0
- package/dist/assets/network-driver.js +2 -0
- package/dist/assets/network-driver.js.map +1 -0
- package/dist/assets/runtime.js +264 -0
- package/dist/assets/runtime.js.map +1 -0
- package/dist/binaries.d.ts +58 -0
- package/dist/binaries.d.ts.map +1 -0
- package/dist/boot/index.d.ts +318 -0
- package/dist/boot/index.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4589 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel/bridge.d.ts +64 -0
- package/dist/kernel/bridge.d.ts.map +1 -0
- package/dist/kernel/types.d.ts +518 -0
- package/dist/kernel/types.d.ts.map +1 -0
- package/dist/kernel/wasm.d.ts +20 -0
- package/dist/kernel/wasm.d.ts.map +1 -0
- package/dist/node/assert.d.ts +99 -0
- package/dist/node/assert.d.ts.map +1 -0
- package/dist/node/async_hooks.d.ts +88 -0
- package/dist/node/async_hooks.d.ts.map +1 -0
- package/dist/node/buffer.d.ts +62 -0
- package/dist/node/buffer.d.ts.map +1 -0
- package/dist/node/child_process.d.ts +300 -0
- package/dist/node/child_process.d.ts.map +1 -0
- package/dist/node/cluster.d.ts +37 -0
- package/dist/node/cluster.d.ts.map +1 -0
- package/dist/node/constants.d.ts +306 -0
- package/dist/node/constants.d.ts.map +1 -0
- package/dist/node/crypto.d.ts +176 -0
- package/dist/node/crypto.d.ts.map +1 -0
- package/dist/node/dgram.d.ts +44 -0
- package/dist/node/dgram.d.ts.map +1 -0
- package/dist/node/diagnostics_channel.d.ts +57 -0
- package/dist/node/diagnostics_channel.d.ts.map +1 -0
- package/dist/node/dns.d.ts +278 -0
- package/dist/node/dns.d.ts.map +1 -0
- package/dist/node/domain.d.ts +21 -0
- package/dist/node/domain.d.ts.map +1 -0
- package/dist/node/events.d.ts +54 -0
- package/dist/node/events.d.ts.map +1 -0
- package/dist/node/fs/promises.d.ts +116 -0
- package/dist/node/fs/promises.d.ts.map +1 -0
- package/dist/node/fs.d.ts +536 -0
- package/dist/node/fs.d.ts.map +1 -0
- package/dist/node/http.d.ts +471 -0
- package/dist/node/http.d.ts.map +1 -0
- package/dist/node/http2.d.ts +508 -0
- package/dist/node/http2.d.ts.map +1 -0
- package/dist/node/https.d.ts +42 -0
- package/dist/node/https.d.ts.map +1 -0
- package/dist/node/inspector.d.ts +25 -0
- package/dist/node/inspector.d.ts.map +1 -0
- package/dist/node/net.d.ts +231 -0
- package/dist/node/net.d.ts.map +1 -0
- package/dist/node/os.d.ts +318 -0
- package/dist/node/os.d.ts.map +1 -0
- package/dist/node/path.d.ts +144 -0
- package/dist/node/path.d.ts.map +1 -0
- package/dist/node/process.d.ts +105 -0
- package/dist/node/process.d.ts.map +1 -0
- package/dist/node/punycode.d.ts +34 -0
- package/dist/node/punycode.d.ts.map +1 -0
- package/dist/node/querystring.d.ts +49 -0
- package/dist/node/querystring.d.ts.map +1 -0
- package/dist/node/readline.d.ts +99 -0
- package/dist/node/readline.d.ts.map +1 -0
- package/dist/node/stream.d.ts +409 -0
- package/dist/node/stream.d.ts.map +1 -0
- package/dist/node/string_decoder.d.ts +46 -0
- package/dist/node/string_decoder.d.ts.map +1 -0
- package/dist/node/timers.d.ts +79 -0
- package/dist/node/timers.d.ts.map +1 -0
- package/dist/node/tls.d.ts +159 -0
- package/dist/node/tls.d.ts.map +1 -0
- package/dist/node/trace_events.d.ts +18 -0
- package/dist/node/trace_events.d.ts.map +1 -0
- package/dist/node/tty.d.ts +67 -0
- package/dist/node/tty.d.ts.map +1 -0
- package/dist/node/url.d.ts +85 -0
- package/dist/node/url.d.ts.map +1 -0
- package/dist/node/util.d.ts +252 -0
- package/dist/node/util.d.ts.map +1 -0
- package/dist/node/v8.d.ts +134 -0
- package/dist/node/v8.d.ts.map +1 -0
- package/dist/node/vm.d.ts +89 -0
- package/dist/node/vm.d.ts.map +1 -0
- package/dist/node/wasi.d.ts +25 -0
- package/dist/node/wasi.d.ts.map +1 -0
- package/dist/node/worker_threads.d.ts +206 -0
- package/dist/node/worker_threads.d.ts.map +1 -0
- package/dist/node/ws.d.ts +110 -0
- package/dist/node/ws.d.ts.map +1 -0
- package/dist/node/zlib.d.ts +328 -0
- package/dist/node/zlib.d.ts.map +1 -0
- package/dist/persistence/opfs-store.d.ts +93 -0
- package/dist/persistence/opfs-store.d.ts.map +1 -0
- package/dist/runtime/async-function-shim.d.ts +27 -0
- package/dist/runtime/async-function-shim.d.ts.map +1 -0
- package/dist/runtime/fs-interface.d.ts +60 -0
- package/dist/runtime/fs-interface.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +113 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/loader.d.ts +50 -0
- package/dist/runtime/loader.d.ts.map +1 -0
- package/dist/runtime/loaders/async-transform.d.ts +40 -0
- package/dist/runtime/loaders/async-transform.d.ts.map +1 -0
- package/dist/runtime/loaders/cjs.d.ts +37 -0
- package/dist/runtime/loaders/cjs.d.ts.map +1 -0
- package/dist/runtime/loaders/detect-module-type.d.ts +21 -0
- package/dist/runtime/loaders/detect-module-type.d.ts.map +1 -0
- package/dist/runtime/loaders/esm.d.ts +140 -0
- package/dist/runtime/loaders/esm.d.ts.map +1 -0
- package/dist/runtime/loaders/source-map-registry.d.ts +43 -0
- package/dist/runtime/loaders/source-map-registry.d.ts.map +1 -0
- package/dist/runtime/loaders/source-map.d.ts +50 -0
- package/dist/runtime/loaders/source-map.d.ts.map +1 -0
- package/dist/runtime/loaders/utils.d.ts +6 -0
- package/dist/runtime/loaders/utils.d.ts.map +1 -0
- package/dist/runtime/native-globals.d.ts +24 -0
- package/dist/runtime/native-globals.d.ts.map +1 -0
- package/dist/runtime/network-driver.d.ts +78 -0
- package/dist/runtime/network-driver.d.ts.map +1 -0
- package/dist/runtime/process-context.d.ts +96 -0
- package/dist/runtime/process-context.d.ts.map +1 -0
- package/dist/runtime/process-event-loop.d.ts +356 -0
- package/dist/runtime/process-event-loop.d.ts.map +1 -0
- package/dist/runtime/process-handler.d.ts +71 -0
- package/dist/runtime/process-handler.d.ts.map +1 -0
- package/dist/runtime/process-handlers/node.d.ts +22 -0
- package/dist/runtime/process-handlers/node.d.ts.map +1 -0
- package/dist/runtime/process-handlers/npm.d.ts +20 -0
- package/dist/runtime/process-handlers/npm.d.ts.map +1 -0
- package/dist/runtime/process-handlers/npx.d.ts +11 -0
- package/dist/runtime/process-handlers/npx.d.ts.map +1 -0
- package/dist/runtime/process-handlers/pnpm.d.ts +12 -0
- package/dist/runtime/process-handlers/pnpm.d.ts.map +1 -0
- package/dist/runtime/process-handlers/shell.d.ts +24 -0
- package/dist/runtime/process-handlers/shell.d.ts.map +1 -0
- package/dist/runtime/process-handlers/yarn.d.ts +12 -0
- package/dist/runtime/process-handlers/yarn.d.ts.map +1 -0
- package/dist/runtime/process-helpers.d.ts +17 -0
- package/dist/runtime/process-helpers.d.ts.map +1 -0
- package/dist/runtime/process-manager.d.ts +87 -0
- package/dist/runtime/process-manager.d.ts.map +1 -0
- package/dist/runtime/process-scheduler.d.ts +123 -0
- package/dist/runtime/process-scheduler.d.ts.map +1 -0
- package/dist/runtime/process-waker.d.ts +24 -0
- package/dist/runtime/process-waker.d.ts.map +1 -0
- package/dist/runtime/promise.d.ts +44 -0
- package/dist/runtime/promise.d.ts.map +1 -0
- package/dist/runtime/stack-trace.d.ts +52 -0
- package/dist/runtime/stack-trace.d.ts.map +1 -0
- package/dist/runtime/wasm-package-interceptor.d.ts +141 -0
- package/dist/runtime/wasm-package-interceptor.d.ts.map +1 -0
- package/dist/runtime/web-streams.d.ts +57 -0
- package/dist/runtime/web-streams.d.ts.map +1 -0
- package/dist/runtime/websocket.d.ts +102 -0
- package/dist/runtime/websocket.d.ts.map +1 -0
- package/dist/shim/websocket-shim-inline.d.ts +9 -0
- package/dist/shim/websocket-shim-inline.d.ts.map +1 -0
- package/dist/shim/websocket-shim.d.ts +15 -0
- package/dist/shim/websocket-shim.d.ts.map +1 -0
- package/dist/sw/index.d.ts +53 -0
- package/dist/sw/index.d.ts.map +1 -0
- package/dist/utils/debug.d.ts +75 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/path.d.ts +20 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/tarball.d.ts +37 -0
- package/dist/utils/tarball.d.ts.map +1 -0
- package/dist/utils/websocket-protocol.d.ts +102 -0
- package/dist/utils/websocket-protocol.d.ts.map +1 -0
- package/dist/worker/host.d.ts +14 -0
- package/dist/worker/host.d.ts.map +1 -0
- package/dist/worker/types.d.ts +209 -0
- package/dist/worker/types.d.ts.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},o=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},s=t=>r.call(t,`module.exports`)?t[`module.exports`]:o(e({},`__esModule`,{value:!0}),t);function c(e){let t=e.length,n=0,r=0;for(;r<t;){let i=e.charCodeAt(r++);if(!(i&4294967168)){n++;continue}else if(!(i&4294965248))n+=2;else{if(i>=55296&&i<=56319&&r<t){let t=e.charCodeAt(r);(t&64512)==56320&&(++r,i=((i&1023)<<10)+(t&1023)+65536)}i&4294901760?n+=4:n+=3}}return n}function l(e,t,n){let r=e.length,i=n,a=0;for(;a<r;){let n=e.charCodeAt(a++);if(!(n&4294967168)){t[i++]=n;continue}else if(!(n&4294965248))t[i++]=n>>6&31|192;else{if(n>=55296&&n<=56319&&a<r){let t=e.charCodeAt(a);(t&64512)==56320&&(++a,n=((n&1023)<<10)+(t&1023)+65536)}n&4294901760?(t[i++]=n>>18&7|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128):(t[i++]=n>>12&15|224,t[i++]=n>>6&63|128)}t[i++]=n&63|128}}function u(e,t,n){h.encodeInto(e,t.subarray(n))}function d(e,t,n){e.length>g?u(e,t,n):l(e,t,n)}function f(e,t,n){let r=t,i=r+n,a=[],o=``;for(;r<i;){let t=e[r++];if(!(t&128))a.push(t);else if((t&224)==192){let n=e[r++]&63;a.push((t&31)<<6|n)}else if((t&240)==224){let n=e[r++]&63,i=e[r++]&63;a.push((t&31)<<12|n<<6|i)}else if((t&248)==240){let n=e[r++]&63,i=e[r++]&63,o=e[r++]&63,s=(t&7)<<18|n<<12|i<<6|o;s>65535&&(s-=65536,a.push(s>>>10&1023|55296),s=56320|s&1023),a.push(s)}else a.push(t);a.length>=_&&(o+=String.fromCharCode(...a),a.length=0)}return a.length>0&&(o+=String.fromCharCode(...a)),o}function p(e,t,n){let r=e.subarray(t,t+n);return v.decode(r)}function m(e,t,n){return n>y?p(e,t,n):f(e,t,n)}var h,g,_,v,y,b=i((()=>{h=new TextEncoder,g=50,_=4096,v=new TextDecoder,y=200}));function ee(e){"@babel/helpers - typeof";return ee=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ee(e)}var te=i((()=>{}));function ne(e,t){if(ee(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(ee(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var x=i((()=>{te()}));function S(e){var t=ne(e,`string`);return ee(t)==`symbol`?t:t+``}var re=i((()=>{te(),x()}));function C(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=i((()=>{re()})),ie,ae=i((()=>{w(),ie=class{constructor(e,t){C(this,`type`,void 0),C(this,`data`,void 0),this.type=e,this.data=t}}})),oe,se=i((()=>{oe=class e extends Error{constructor(t){super(t);let n=Object.create(e.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,`name`,{configurable:!0,enumerable:!1,value:e.name})}}}));function ce(e,t,n){let r=n/4294967296,i=n;e.setUint32(t,r),e.setUint32(t+4,i)}function le(e,t,n){let r=Math.floor(n/4294967296),i=n;e.setUint32(t,r),e.setUint32(t+4,i)}function ue(e,t){let n=e.getInt32(t),r=e.getUint32(t+4);return n*4294967296+r}function de(e,t){let n=e.getUint32(t),r=e.getUint32(t+4);return n*4294967296+r}var fe,pe=i((()=>{fe=4294967295}));function me({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=xe)if(t===0&&e<=be){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}else{let n=e/4294967296,r=e&4294967295,i=new Uint8Array(8),a=new DataView(i.buffer);return a.setUint32(0,t<<2|n&3),a.setUint32(4,r),i}else{let n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,t),le(r,4,e),n}}function he(e){let t=e.getTime(),n=Math.floor(t/1e3),r=(t-n*1e3)*1e6,i=Math.floor(r/1e9);return{sec:n+i,nsec:r-i*1e9}}function ge(e){return e instanceof Date?me(he(e)):null}function _e(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let e=t.getUint32(0),n=t.getUint32(4);return{sec:(e&3)*4294967296+n,nsec:e>>>2}}case 12:return{sec:ue(t,4),nsec:t.getUint32(0)};default:throw new oe(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function ve(e){let t=_e(e);return new Date(t.sec*1e3+t.nsec/1e6)}var ye,be,xe,Se,Ce=i((()=>{se(),pe(),ye=-1,be=4294967295,xe=17179869183,Se={type:ye,encode:ge,decode:ve}})),we,Te,Ee=i((()=>{ae(),Ce(),w(),Te=class{constructor(){C(this,`__brand`,void 0),C(this,`builtInEncoders`,[]),C(this,`builtInDecoders`,[]),C(this,`encoders`,[]),C(this,`decoders`,[]),this.register(Se)}register({type:e,encode:t,decode:n}){if(e>=0)this.encoders[e]=t,this.decoders[e]=n;else{let r=-1-e;this.builtInEncoders[r]=t,this.builtInDecoders[r]=n}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){let r=this.builtInEncoders[n];if(r!=null){let i=r(e,t);if(i!=null)return new ie(-1-n,i)}}for(let n=0;n<this.encoders.length;n++){let r=this.encoders[n];if(r!=null){let i=r(e,t);if(i!=null)return new ie(n,i)}}return e instanceof ie?e:null}decode(e,t,n){let r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,n):new ie(t,e)}},we=Te,C(Te,`defaultCodec`,new we)}));function De(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer}function Oe(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):De(e)?new Uint8Array(e):Uint8Array.from(e)}var ke=i((()=>{})),Ae,je,Me,Ne=i((()=>{b(),Ee(),pe(),ke(),w(),Ae=100,je=2048,Me=class e{constructor(e){var t,n,r,i,a,o,s,c;C(this,`extensionCodec`,void 0),C(this,`context`,void 0),C(this,`useBigInt64`,void 0),C(this,`maxDepth`,void 0),C(this,`initialBufferSize`,void 0),C(this,`sortKeys`,void 0),C(this,`forceFloat32`,void 0),C(this,`ignoreUndefined`,void 0),C(this,`forceIntegerToFloat`,void 0),C(this,`pos`,void 0),C(this,`view`,void 0),C(this,`bytes`,void 0),C(this,`entered`,!1),this.extensionCodec=(t=e==null?void 0:e.extensionCodec)==null?Te.defaultCodec:t,this.context=e==null?void 0:e.context,this.useBigInt64=(n=e==null?void 0:e.useBigInt64)==null?!1:n,this.maxDepth=(r=e==null?void 0:e.maxDepth)==null?Ae:r,this.initialBufferSize=(i=e==null?void 0:e.initialBufferSize)==null?je:i,this.sortKeys=(a=e==null?void 0:e.sortKeys)==null?!1:a,this.forceFloat32=(o=e==null?void 0:e.forceFloat32)==null?!1:o,this.ignoreUndefined=(s=e==null?void 0:e.ignoreUndefined)==null?!1:s,this.forceIntegerToFloat=(c=e==null?void 0:e.forceIntegerToFloat)==null?!1:c,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,t){if(t>this.maxDepth)throw Error(`Too deep objects in depth ${t}`);e==null?this.encodeNil():typeof e==`boolean`?this.encodeBoolean(e):typeof e==`number`?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e==`string`?this.encodeString(e):this.useBigInt64&&typeof e==`bigint`?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){let t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(e){let t=new ArrayBuffer(e),n=new Uint8Array(t),r=new DataView(t);n.set(this.bytes),this.view=r,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){let t=c(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),d(e,this.bytes,this.pos),this.pos+=t}encodeObject(e,t){let n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e==`object`)this.encodeMap(e,t);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw Error(`Too large binary: ${t}`);let n=Oe(e);this.writeU8a(n)}encodeArray(e,t){let n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw Error(`Too large array: ${n}`);for(let n of e)this.doEncode(n,t+1)}countWithoutUndefined(e,t){let n=0;for(let r of t)e[r]!==void 0&&n++;return n}encodeMap(e,t){let n=Object.keys(e);this.sortKeys&&n.sort();let r=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else if(r<4294967296)this.writeU8(223),this.writeU32(r);else throw Error(`Too large map object: ${r}`);for(let r of n){let n=e[r];this.ignoreUndefined&&n===void 0||(this.encodeString(r),this.doEncode(n,t+1))}}encodeExtension(e){if(typeof e.data==`function`){let t=e.data(this.pos+6),n=t.length;if(n>=4294967296)throw Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(e.type),this.writeU8a(t);return}let t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw Error(`Too large extension object: ${t}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),ce(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),le(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}}));function Pe(e,t){return new Me(t).encodeSharedRef(e)}var Fe=i((()=>{Ne()}));function Ie(e){return`${e<0?`-`:``}0x${Math.abs(e).toString(16).padStart(2,`0`)}`}var Le=i((()=>{})),Re,ze,Be,Ve=i((()=>{b(),w(),Re=16,ze=16,Be=class{constructor(e=Re,t=ze){C(this,`hit`,0),C(this,`miss`,0),C(this,`caches`,void 0),C(this,`maxKeyLength`,void 0),C(this,`maxLengthPerKey`,void 0),this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,n){let r=this.caches[n-1];FIND_CHUNK:for(let i of r){let r=i.bytes;for(let i=0;i<n;i++)if(r[i]!==e[t+i])continue FIND_CHUNK;return i.str}return null}store(e,t){let n=this.caches[e.length-1],r={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)}decode(e,t,n){let r=this.find(e,t,n);if(r!=null)return this.hit++,r;this.miss++;let i=f(e,t,n),a=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(a,i),i}}}));function He(e){var t,n,r,i=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Ue(t.call(e));n=`@@asyncIterator`,r=`@@iterator`}throw TypeError(`Object is not async iterable`)}function Ue(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return Ue=function(e){this.s=e,this.n=e.next},Ue.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new Ue(e)}var We=i((()=>{}));function Ge(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function T(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Ge(a,r,i,o,s,`next`,e)}function s(e){Ge(a,r,i,o,s,`throw`,e)}o(void 0)})}}var Ke=i((()=>{}));function qe(e,t){this.v=e,this.k=t}var Je=i((()=>{}));function Ye(e){var t={},n=!1;function r(t,r){return n=!0,r=new Promise(function(n){n(e[t](r))}),{done:!1,value:new qe(r,1)}}return t[typeof Symbol<`u`&&Symbol.iterator||`@@iterator`]=function(){return this},t.next=function(e){return n?(n=!1,e):r(`next`,e)},typeof e.throw==`function`&&(t.throw=function(e){if(n)throw n=!1,e;return r(`throw`,e)}),typeof e.return==`function`&&(t.return=function(e){return n?(n=!1,e):r(`return`,e)}),t}var Xe=i((()=>{Je()}));function Ze(e){return new qe(e,0)}var Qe=i((()=>{Je()}));function $e(e){return function(){return new et(e.apply(this,arguments))}}function et(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof qe;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}var tt=i((()=>{Je(),et.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},et.prototype.next=function(e){return this._invoke(`next`,e)},et.prototype.throw=function(e){return this._invoke(`throw`,e)},et.prototype.return=function(e){return this._invoke(`return`,e)}})),nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt=i((()=>{Le(),Ee(),pe(),b(),ke(),Ve(),se(),w(),We(),Ke(),Xe(),Qe(),tt(),nt=`array`,rt=`map_key`,it=`map_value`,at=e=>{if(typeof e==`string`||typeof e==`number`)return e;throw new oe(`The type of key must be string or number but `+typeof e)},ot=class{constructor(){C(this,`stack`,[]),C(this,`stackHeadPosition`,-1)}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=nt,t.position=0,t.size=e,t.array=Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=rt,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){return this.stackHeadPosition++,this.stackHeadPosition===this.stack.length&&this.stack.push({type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null}),this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw Error(`Invalid stack state. Released state is not on top of the stack.`);if(e.type===nt){let t=e;t.size=0,t.array=void 0,t.position=0,t.type=void 0}if(e.type===rt||e.type===it){let t=e;t.size=0,t.map=void 0,t.readCount=0,t.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},st=-1,ct=new DataView(new ArrayBuffer(0)),lt=new Uint8Array(ct.buffer);try{ct.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw Error(`This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access`)}ut=RangeError(`Insufficient data`),dt=new Be,ft=class e{constructor(e){var t,n,r,i,a,o,s,c,l;C(this,`extensionCodec`,void 0),C(this,`context`,void 0),C(this,`useBigInt64`,void 0),C(this,`rawStrings`,void 0),C(this,`maxStrLength`,void 0),C(this,`maxBinLength`,void 0),C(this,`maxArrayLength`,void 0),C(this,`maxMapLength`,void 0),C(this,`maxExtLength`,void 0),C(this,`keyDecoder`,void 0),C(this,`mapKeyConverter`,void 0),C(this,`totalPos`,0),C(this,`pos`,0),C(this,`view`,ct),C(this,`bytes`,lt),C(this,`headByte`,st),C(this,`stack`,new ot),C(this,`entered`,!1),this.extensionCodec=(t=e==null?void 0:e.extensionCodec)==null?Te.defaultCodec:t,this.context=e==null?void 0:e.context,this.useBigInt64=(n=e==null?void 0:e.useBigInt64)==null?!1:n,this.rawStrings=(r=e==null?void 0:e.rawStrings)==null?!1:r,this.maxStrLength=(i=e==null?void 0:e.maxStrLength)==null?fe:i,this.maxBinLength=(a=e==null?void 0:e.maxBinLength)==null?fe:a,this.maxArrayLength=(o=e==null?void 0:e.maxArrayLength)==null?fe:o,this.maxMapLength=(s=e==null?void 0:e.maxMapLength)==null?fe:s,this.maxExtLength=(c=e==null?void 0:e.maxExtLength)==null?fe:c,this.keyDecoder=(e==null?void 0:e.keyDecoder)===void 0?dt:e.keyDecoder,this.mapKeyConverter=(l=e==null?void 0:e.mapKeyConverter)==null?at:l}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=st,this.stack.reset()}setBuffer(e){let t=Oe(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===st&&!this.hasRemaining(1))this.setBuffer(e);else{let t=this.bytes.subarray(this.pos),n=Oe(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:t,pos:n}=this;return RangeError(`Extra ${t.byteLength-n} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}decodeAsync(e){var t=this;return T(function*(){if(t.entered)return t.clone().decodeAsync(e);try{t.entered=!0;let s=!1,c;var n=!1,r=!1,i;try{for(var a=He(e),o;n=!(o=yield a.next()).done;n=!1){let e=o.value;if(s)throw t.entered=!1,t.createExtraByteError(t.totalPos);t.appendBuffer(e);try{c=t.doDecodeSync(),s=!0}catch(e){if(!(e instanceof RangeError))throw e}t.totalPos+=t.pos}}catch(e){r=!0,i=e}finally{try{n&&a.return!=null&&(yield a.return())}finally{if(r)throw i}}if(s){if(t.hasRemaining(1))throw t.createExtraByteError(t.totalPos);return c}let{headByte:l,pos:u,totalPos:d}=t;throw RangeError(`Insufficient data in parsing ${Ie(l)} at ${d} (${u} in the current buffer)`)}finally{t.entered=!1}})()}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}decodeMultiAsync(e,t){var n=this;return $e(function*(){if(n.entered){yield*Ye(He(n.clone().decodeMultiAsync(e,t)));return}try{n.entered=!0;let c=t,l=-1;var r=!1,i=!1,a;try{for(var o=He(e),s;r=!(s=yield Ze(o.next())).done;r=!1){let e=s.value;if(t&&l===0)throw n.createExtraByteError(n.totalPos);n.appendBuffer(e),c&&(l=n.readArraySize(),c=!1,n.complete());try{for(;yield n.doDecodeSync(),--l!==0;);}catch(e){if(!(e instanceof RangeError))throw e}n.totalPos+=n.pos}}catch(e){i=!0,a=e}finally{try{r&&o.return!=null&&(yield Ze(o.return()))}finally{if(i)throw a}}}finally{n.entered=!1}})()}doDecodeSync(){DECODE:for(;;){let e=this.readHeadByte(),t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){let n=e-128;if(n!==0){this.pushMapState(n),this.complete();continue DECODE}else t={}}else if(e<160){let n=e-144;if(n!==0){this.pushArrayState(n),this.complete();continue DECODE}else t=[]}else{let n=e-160;t=this.decodeString(n,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.readU8();else if(e===205)t=this.readU16();else if(e===206)t=this.readU32();else if(e===207)t=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(e===208)t=this.readI8();else if(e===209)t=this.readI16();else if(e===210)t=this.readI32();else if(e===211)t=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(e===217){let e=this.lookU8();t=this.decodeString(e,1)}else if(e===218){let e=this.lookU16();t=this.decodeString(e,2)}else if(e===219){let e=this.lookU32();t=this.decodeString(e,4)}else if(e===220){let e=this.readU16();if(e!==0){this.pushArrayState(e),this.complete();continue DECODE}else t=[]}else if(e===221){let e=this.readU32();if(e!==0){this.pushArrayState(e),this.complete();continue DECODE}else t=[]}else if(e===222){let e=this.readU16();if(e!==0){this.pushMapState(e),this.complete();continue DECODE}else t={}}else if(e===223){let e=this.readU32();if(e!==0){this.pushMapState(e),this.complete();continue DECODE}else t={}}else if(e===196){let e=this.lookU8();t=this.decodeBinary(e,1)}else if(e===197){let e=this.lookU16();t=this.decodeBinary(e,2)}else if(e===198){let e=this.lookU32();t=this.decodeBinary(e,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){let e=this.lookU8();t=this.decodeExtension(e,1)}else if(e===200){let e=this.lookU16();t=this.decodeExtension(e,2)}else if(e===201){let e=this.lookU32();t=this.decodeExtension(e,4)}else throw new oe(`Unrecognized type byte: ${Ie(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let e=n.top();if(e.type===nt)if(e.array[e.position]=t,e.position++,e.position===e.size)t=e.array,n.release(e);else continue DECODE;else if(e.type===rt){if(t===`__proto__`)throw new oe(`The key __proto__ is not allowed`);e.key=this.mapKeyConverter(t),e.type=it;continue DECODE}else if(e.map[e.key]=t,e.readCount++,e.readCount===e.size)t=e.map,n.release(e);else{e.key=null,e.type=rt;continue DECODE}}return t}}readHeadByte(){return this.headByte===st&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=st}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new oe(`Unrecognized array type byte: ${Ie(e)}`)}}pushMapState(e){if(e>this.maxMapLength)throw new oe(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new oe(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){var n;if(e>this.maxStrLength)throw new oe(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw ut;let r=this.pos+t,i;return i=this.stateIsMapKey()&&(n=this.keyDecoder)!=null&&n.canBeCached(e)?this.keyDecoder.decode(this.bytes,r,e):m(this.bytes,r,e),this.pos+=t+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===rt:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new oe(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw ut;let n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r}decodeExtension(e,t){if(e>this.maxExtLength)throw new oe(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){let e=de(this.view,this.pos);return this.pos+=8,e}readI64(){let e=ue(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}}}));function mt(e,t){return new ft(t).decode(e)}var ht=i((()=>{pt()})),gt=i((()=>{Fe(),ht()}));function _t(e){Tt=e}function vt(e){wt=e}function yt(){if(!wt)throw Error(`Kernel not initialized. Call createSubstrate() first.`);return wt}function bt(){wt=null,Et=null}function xt(e){Et=e}function St(){return Et}function Ct(){Tt&&Tt()}var wt,Tt,Et,Dt,E,Ot,kt=i((()=>{wt=null,Tt=null,Et=null,Dt=new Set([`net_connect`,`net_conn_write`,`net_conn_close`,`fs_write_fd`,`fs_close_fd`,`fs_write_file`,`fs_write_at`,`fs_open`,`fs_ftruncate`,`fs_mkdir`,`fs_unlink`,`fs_rename`,`fs_symlink`,`fs_link`,`proc_spawn`,`proc_exit`,`proc_kill`]),E=(e,t)=>{let n=yt().syscall(e,t);if(!n.ok){let e=Error(n.error.message);throw e.code=n.error.code,e}return Tt&&Dt.has(e)&&Tt(),n.result},Ot=(e,t)=>{try{return E(e,t)}catch(e){return null}}}));function At(){let e=globalThis.__SUBSTRATE_LOG_LEVEL;return typeof e==`string`&&e in It?e:`info`}function jt(e){globalThis.__SUBSTRATE_LOG_LEVEL=e}function Mt(){let e=globalThis.__SUBSTRATE_LOG_COMPONENTS;return Array.isArray(e)?e:[]}function Nt(e){let t=At();try{return jt(`off`),e()}finally{jt(t)}}function Pt(e,t){let n=At(),r=Mt();return!(It[e]>It[n]||r.length>0&&!r.some(e=>e.endsWith(`*`)?t.startsWith(e.slice(0,-1)):t===e))}function D(e){let t=(t,...n)=>{var r,i;if(t===`off`||!Pt(t,e))return;let a=`[${e}]`,o=(r=(i=new Date().toISOString().split(`T`)[1])==null?void 0:i.slice(0,-1))==null?``:r;switch(t){case`error`:Ft.error(`%c${o} ${t.toUpperCase()} ${a}`,Lt[t],...n);break;case`warn`:Ft.warn(`%c${o} ${t.toUpperCase()} ${a}`,Lt[t],...n);break;case`info`:Ft.info(`%c${o} ${t.toUpperCase()} ${a}`,Lt[t],...n);break;case`debug`:Ft.debug(`%c${o} ${t.toUpperCase()} ${a}`,Lt[t],...n);break;case`trace`:Ft.debug(`%c${o} ${t.toUpperCase()} ${a}`,Lt[t],...n);break}};return{error:(...e)=>t(`error`,...e),warn:(...e)=>t(`warn`,...e),info:(...e)=>t(`info`,...e),debug:(...e)=>t(`debug`,...e),trace:(...e)=>t(`trace`,...e),log:t}}var Ft,It,Lt,O,Rt,zt,Bt,k,Vt,Ht,Ut,Wt,A=i((()=>{Ft=console,It={off:0,error:1,warn:2,info:3,debug:4,trace:5},Lt={off:``,error:`color: #ff5555; font-weight: bold`,warn:`color: #ffaa00; font-weight: bold`,info:`color: #55aaff`,debug:`color: #888888`,trace:`color: #666666`},O=D(`vfs`),Rt=D(`proc`),zt=D(`net`),Bt=D(`module`),k=D(`http`),Vt=D(`ws`),Ht=D(`child_process`),Ut=D(`worker`),Wt=D(`runtime`)}));function Gt(e,t){return{write(n,r,i){let a=typeof n==`string`?n:new TextDecoder().decode(n);return Rt.trace(`[${t}].write: ${a.length} chars`),e(a),!0},end(e,t,n){typeof e==`function`?e():e!==void 0&&this.write(e,t)},isTTY:!1,writable:!0,columns:80,rows:24,clearLine(e,t){return t==null||t(),!0},clearScreenDown(e){return e==null||e(),!0},cursorTo(e,t,n){return typeof t==`function`?t():n==null||n(),!0},moveCursor(e,t,n){return n==null||n(),!0},getWindowSize(){return[80,24]},hasColors(){return!1},getColorDepth(){return 1},on(){return this},once(){return this},emit(){return!1},addListener(){return this},removeListener(){return this},removeAllListeners(){return this},prependListener(){return this},prependOnceListener(){return this},listeners(){return[]},listenerCount(){return 0},eventNames(){return[]}}}var Kt,qt,Jt=i((()=>{A(),w(),Kt=D(`process-context`),qt=class{constructor(e,t){C(this,`pid`,void 0),C(this,`cwd`,void 0),C(this,`command`,void 0),C(this,`env`,void 0),C(this,`argv`,void 0),C(this,`stdout`,void 0),C(this,`stderr`,void 0),C(this,`kernel`,void 0),C(this,`_exited`,!1),Kt.debug(`Creating ProcessContext for PID ${e} (parent: ${t.ppid})`),this.pid=e,this.command=t.command,this.cwd=t.cwd,this.env=t.env,this.argv=t.argv,this.kernel=t.kernel,this.stdout=Gt(t=>{let n=typeof t==`string`?new TextEncoder().encode(t):new Uint8Array(t);Rt.trace(`stdout: writing ${n.length} bytes to kernel pipe fd=1 for pid=${e}`);let r=this.kernel.syscall(`fs_write_fd`,{pid:e,fd:1,bytes:n});r.ok||Kt.warn(`stdout write failed for pid=${e}: ${r.error.message}`)},`stdout`),this.stderr=Gt(t=>{let n=typeof t==`string`?new TextEncoder().encode(t):new Uint8Array(t);Rt.trace(`stderr: writing ${n.length} bytes to kernel pipe fd=2 for pid=${e}`);let r=this.kernel.syscall(`fs_write_fd`,{pid:e,fd:2,bytes:n});r.ok||Kt.warn(`stderr write failed for pid=${e}: ${r.error.message}`)},`stderr`)}writeStdout(e){this.stdout.write(e)}writeStderr(e){this.stderr.write(e)}exit(e){this._exited||(this._exited=!0,Kt.debug(`ProcessContext[${this.pid}] exiting with code ${e}`),this.kernel.syscall(`proc_exit`,{pid:this.pid,exit_code:e}))}}}));function Yt(e,t=!1){let n=t?en:$t,r=``,i=e.length;for(let a=0;a<i;a+=3){let o=e[a],s=a+1<i?e[a+1]:0,c=a+2<i?e[a+2]:0,l=o<<16|s<<8|c;r+=n[l>>18&63],r+=n[l>>12&63],r+=a+1<i?n[l>>6&63]:t?``:`=`,r+=a+2<i?n[l&63]:t?``:`=`}return r}function Xt(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`).replace(/=/g,``),n=[];for(let e=0;e<t.length;e+=4){var r,i,a;let o=$t.indexOf(t[e]),s=$t.indexOf((r=t[e+1])==null?`A`:r),c=$t.indexOf((i=t[e+2])==null?`A`:i),l=$t.indexOf((a=t[e+3])==null?`A`:a),u=o<<18|s<<12|c<<6|l;n.push(u>>16&255),e+2<t.length&&n.push(u>>8&255),e+3<t.length&&n.push(u&255)}return new Uint8Array(n)}function Zt(e){let t=``;for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,`0`);return t}function Qt(e){let t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n++)t[n]=parseInt(e.slice(n*2,n*2+2),16);return t}var $t,en,tn,nn,j,rn=i((()=>{$t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,en=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,tn=class e extends Uint8Array{static get[Symbol.species](){return j}static from(t,n,r){if(t==null)throw TypeError(`The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array`);if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&t instanceof SharedArrayBuffer){let i=typeof n==`number`?n:0,a=r==null?t.byteLength-i:r,o=new e(a);return o.set(new Uint8Array(t,i,a)),o}if(typeof t==`string`){let r=typeof n==`string`?n:`utf8`,i;switch(r){case`hex`:i=Qt(t);break;case`base64`:case`base64url`:i=Xt(t);break;case`binary`:case`latin1`:i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e)&255;break;default:i=new TextEncoder().encode(t);break}let a=new e(i.length);return a.set(i),a}if(t instanceof e){let n=new e(t.length);return n.set(t),n}if(t instanceof Uint8Array){let n=new e(t.length);return n.set(t),n}if(Array.isArray(t)){let n=new e(t.length);for(let e=0;e<t.length;e++)n[e]=typeof t[e]==`number`?t[e]:0;return n}if(ArrayBuffer.isView(t)){let n=t,r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),i=new e(r.length);return i.set(r),i}if(typeof t==`object`&&typeof t.length==`number`){var i;if(typeof t.then==`function`)throw TypeError(`Cannot create Buffer from Promise. Did you forget to await?`);let r=(i=t.constructor)==null?void 0:i.name;if(r===`Response`||r===`Minipass`||r===`MinipassBody`||r===`Body`||typeof t.arrayBuffer==`function`)throw TypeError(`Cannot create Buffer from ${r}. Use .arrayBuffer() or .text() method first.`);if(t instanceof String)return e.from(t.valueOf(),n);let a=t;if(a.type===`Buffer`&&Array.isArray(a.data)){let t=new e(a.data.length);return t.set(a.data),t}let o=t;if(o.length>2147483647)throw RangeError(`Buffer size too large`);let s=new e(o.length);for(let e=0;e<o.length;e++){let t=o[e];s[e]=typeof t==`number`?t:0}return s}throw TypeError(`The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array`)}static alloc(t,n){let r=new e(t);if(n!==void 0)if(typeof n==`number`)r.fill(n);else{let e=new TextEncoder().encode(n);for(let n=0;n<t;n++)r[n]=e[n%e.length]}return r}static allocUnsafe(t){return new e(t)}static concat(t,n){let r=n==null?t.reduce((e,t)=>e+t.length,0):n,i=new e(r),a=0;for(let e of t){if(a>=r)break;let t=Math.min(e.length,r-a);i.set(e.subarray(0,t),a),a+=t}return i}static isBuffer(t){return t instanceof e}static compare(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.length<t.length?-1:e.length>t.length?1:0}static byteLength(e,t){if(typeof e==`string`)switch(t==null?`utf8`:t){case`hex`:return e.length>>>1;case`base64`:case`base64url`:{let t=e.length;for(;t>0&&(e[t-1]===`=`||e[t-1]===` `);)t--;return t*3>>>2}case`binary`:case`latin1`:case`ascii`:return e.length;default:return new TextEncoder().encode(e).byteLength}if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength;throw TypeError(`The "string" argument must be of type string or an instance of Buffer or ArrayBuffer`)}toString(e,t,n){let r=t!==void 0||n!==void 0?this.subarray(t==null?0:t,n==null?this.length:n):this;switch(e==null?`utf8`:e){case`hex`:return Zt(r);case`base64`:return Yt(r,!1);case`base64url`:return Yt(r,!0);case`binary`:case`latin1`:{let e=``;for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e}default:return new TextDecoder(`utf-8`).decode(r)}}toJSON(){return{type:`Buffer`,data:Array.from(this)}}write(e,t,n,r){let i=new TextEncoder().encode(e),a=t==null?0:t,o=Math.min(n==null?i.length:n,this.length-a,i.length);return this.set(i.subarray(0,o),a),o}copy(e,t,n,r){let i=t==null?0:t,a=n==null?0:n,o=r==null?this.length:r,s=Math.min(o-a,e.length-i);return e.set(this.subarray(a,a+s),i),s}equals(e){if(this.length!==e.length)return!1;for(let t=0;t<this.length;t++)if(this[t]!==e[t])return!1;return!0}compare(e){let t=Math.min(this.length,e.length);for(let n=0;n<t;n++){if(this[n]<e[n])return-1;if(this[n]>e[n])return 1}return this.length<e.length?-1:this.length>e.length?1:0}indexOf(e,t,n){let r=t==null?0:t;if(typeof e==`number`)return super.indexOf(e,r);let i;if(i=typeof e==`string`?new TextEncoder().encode(e):e,i.length===0)return r<=this.length?r:this.length;outer:for(let e=r;e<=this.length-i.length;e++){for(let t=0;t<i.length;t++)if(this[e+t]!==i[t])continue outer;return e}return-1}slice(e,t){return this._bufferSubarray(e,t)}subarray(e,t){return this._bufferSubarray(e,t)}_bufferSubarray(t,n){let r=super.subarray(t,n);return new e(r.buffer,r.byteOffset,r.byteLength)}readUInt8(e=0){return this[e]}readUInt16BE(e=0){return this[e]<<8|this[e+1]}readUInt16LE(e=0){return this[e]|this[e+1]<<8}readUInt32BE(e=0){return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])}readUInt32LE(e=0){return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216}readInt8(e=0){let t=this[e];return t&128?t-256:t}readInt16BE(e=0){let t=this[e]<<8|this[e+1];return t&32768?t-65536:t}readInt16LE(e=0){let t=this[e]|this[e+1]<<8;return t&32768?t-65536:t}readInt32BE(e=0){return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]}readInt32LE(e=0){return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24}readBigUInt64BE(e=0){let t=BigInt(this.readUInt32BE(e)),n=BigInt(this.readUInt32BE(e+4));return t<<BigInt(32)|n}readBigUInt64LE(e=0){let t=BigInt(this.readUInt32LE(e));return BigInt(this.readUInt32LE(e+4))<<BigInt(32)|t}readFloatBE(e=0){return new DataView(this.buffer,this.byteOffset+e,4).getFloat32(0,!1)}readFloatLE(e=0){return new DataView(this.buffer,this.byteOffset+e,4).getFloat32(0,!0)}readDoubleBE(e=0){return new DataView(this.buffer,this.byteOffset+e,8).getFloat64(0,!1)}readDoubleLE(e=0){return new DataView(this.buffer,this.byteOffset+e,8).getFloat64(0,!0)}writeUInt8(e,t=0){return this[t]=e&255,t+1}writeUInt16BE(e,t=0){return this[t]=e>>>8&255,this[t+1]=e&255,t+2}writeUInt16LE(e,t=0){return this[t]=e&255,this[t+1]=e>>>8&255,t+2}writeUInt32BE(e,t=0){return this[t]=e>>>24&255,this[t+1]=e>>>16&255,this[t+2]=e>>>8&255,this[t+3]=e&255,t+4}writeUInt32LE(e,t=0){return this[t]=e&255,this[t+1]=e>>>8&255,this[t+2]=e>>>16&255,this[t+3]=e>>>24&255,t+4}writeInt8(e,t=0){return this[t]=e&255,t+1}writeInt16BE(e,t=0){return this[t]=e>>>8&255,this[t+1]=e&255,t+2}writeInt16LE(e,t=0){return this[t]=e&255,this[t+1]=e>>>8&255,t+2}writeInt32BE(e,t=0){return this[t]=e>>>24&255,this[t+1]=e>>>16&255,this[t+2]=e>>>8&255,this[t+3]=e&255,t+4}writeInt32LE(e,t=0){return this[t]=e&255,this[t+1]=e>>>8&255,this[t+2]=e>>>16&255,this[t+3]=e>>>24&255,t+4}toUint8Array(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}};for(let e of[`from`,`alloc`,`allocUnsafe`,`concat`,`isBuffer`,`compare`,`byteLength`]){let t=Object.getOwnPropertyDescriptor(tn,e);t&&(t.enumerable=!0,Object.defineProperty(tn,e,t))}nn=tn,j=new Proxy(nn,{apply(e,t,n){let r=n[0];return typeof r==`number`?nn.alloc(r):nn.from(r,n[1],n[2])}})}));function an(e){return typeof e==`object`&&!!e||typeof e==`function`}function on(e){try{return{then:e.then,threw:!1}}catch(e){return{threw:!0,error:e}}}function sn(e,t){var n;let r=new((n=globalThis.AggregateError)==null?Error:n)(t);return r.name=`AggregateError`,r.errors=e,r}var cn,ln,un,dn,fn,pn,mn=i((()=>{A(),w(),cn=D(`substrate:promise`),ln=Symbol.for(`SubstratePromise`),un=0,dn=1,fn=2,pn=e=>{function t(t){cn.trace(`enqueuing promise microtask for process ${e.pid}`),e.queueMicrotask(t)}let n=new Map;function r(){if(n.size===0)return;let t=[...n.entries()];n.clear();for(let[n,r]of t)e.reportUnhandledRejection(r,n)}class i{constructor(e){if(C(this,ln,!0),C(this,`_state`,un),C(this,`_value`,void 0),C(this,`_handlers`,[]),C(this,`_resolveDepth`,0),typeof e!=`function`)throw TypeError(`Promise resolver is not a function`);let t=!1,n=e=>{t||(t=!0,this._resolve(e))},r=e=>{t||(t=!0,this._reject(e))};try{e(n,r)}catch(e){r(e)}}_fulfill(e){this._state===un&&(this._state=dn,this._value=e,this._flushHandlers())}_reject(e){this._state===un&&(this._state=fn,this._value=e,this._handlers.length===0&&n.set(this,e),this._flushHandlers())}_resolve(e){if(e===this){this._reject(TypeError(`Cannot resolve promise with itself`));return}if(an(e)){let a=on(e);if(a.threw){this._reject(a.error);return}let o=a.then;if(typeof o==`function`){if(!(e instanceof i||e[ln])){var n,r;cn.trace(`_resolve: assimilating non-SubstratePromise thenable: ${(n=(r=Object.getPrototypeOf(e))==null||(r=r.constructor)==null?void 0:r.name)==null?typeof e:n}`)}if(this._resolveDepth++,this._resolveDepth>25){this._resolveDepth=0,t(()=>this._resolve(e));return}let a=!1;try{o.call(e,e=>{a||(a=!0,this._resolve(e))},e=>{a||(a=!0,this._reject(e))})}catch(e){a||this._reject(e)}finally{this._resolveDepth--}return}}this._fulfill(e)}_enqueueHandler(t){t.asyncContext=e.captureAsyncContext(),this._handlers.push(t),this._state!==un&&this._flushHandlers()}_flushHandlers(){if(this._state===un||this._handlers.length===0)return;let e=this._handlers;this._handlers=[],t(()=>{for(let t of e)this._runHandler(t)})}_runHandler(t){let{onFulfilled:n,onRejected:r,resolve:i,reject:a,asyncContext:o}=t,s=()=>{try{if(this._state===dn){let e=this._value;if(!n){i(e);return}i(n(e))}else{let e=this._value;if(!r){a(e);return}i(r(e))}}catch(e){if(cn.trace(`_runHandler: CAUGHT exception: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&e.stack)for(let t of e.stack.split(`
|
|
2
|
+
`).slice(0,15))cn.trace(`_runHandler: stack: ${t}`);a(e)}};o?e.runInAsyncContext(o,s):s()}then(e,t){let r=this.constructor;return new r((r,i)=>{this._enqueueHandler({onFulfilled:typeof e==`function`?e:null,onRejected:typeof t==`function`?t:null,resolve:r,reject:i,asyncContext:null}),n.delete(this)})}catch(e){return this.then(void 0,e)}finally(e){let t=this.constructor;return typeof e==`function`?this.then(n=>t.resolve(e()).then(()=>n),n=>t.resolve(e()).then(()=>{throw n})):this.then(e=>e,e=>{throw e})}static resolve(e){return e instanceof this?e:new this(t=>t(e))}static reject(e){return new this((t,n)=>n(e))}static all(e){let t=this;return new t((n,r)=>{let i=Array.from(e),a=Array.from({length:i.length});if(i.length===0){n(a);return}let o=i.length;for(let e=0;e<i.length;e++)t.resolve(i[e]).then(t=>{a[e]=t,o--,o===0&&n(a)},e=>r(e))})}static race(e){let t=this;return new t((n,r)=>{for(let i of e)t.resolve(i).then(n,r)})}static allSettled(e){let t=this;return new t(n=>{let r=Array.from(e),i=Array.from({length:r.length});if(r.length===0){n(i);return}let a=r.length;for(let e=0;e<r.length;e++)t.resolve(r[e]).then(t=>{i[e]={status:`fulfilled`,value:t},a--,a===0&&n(i)},t=>{i[e]={status:`rejected`,reason:t},a--,a===0&&n(i)})})}static any(e){let t=this;return new t((n,r)=>{let i=Array.from(e);if(i.length===0){r(sn([],`All promises were rejected`));return}let a=Array.from({length:i.length}),o=i.length,s=!1;for(let e=0;e<i.length;e++)t.resolve(i[e]).then(e=>{s||(s=!0,n(e))},t=>{a[e]=t,o--,o===0&&!s&&r(sn(a,`All promises were rejected`))})})}static withResolvers(){let e,t;return{promise:new this((n,r)=>{e=n,t=r}),resolve:e,reject:t}}}return{PromiseClass:i,checkUnhandledRejections:r}}})),hn,gn,_n,vn,yn,bn,xn,Sn,Cn=i((()=>{gn=globalThis.setTimeout.bind(globalThis),_n=globalThis.clearTimeout.bind(globalThis),globalThis.setInterval.bind(globalThis),globalThis.clearInterval.bind(globalThis),(hn=globalThis.queueMicrotask)==null||hn.bind(globalThis),vn=globalThis.Promise,yn=globalThis.fetch.bind(globalThis),bn=globalThis.ReadableStream,xn=globalThis.WritableStream,Sn=globalThis.TransformStream}));function wn(e){var t;return(t=In.get(e))==null?e:t}function Tn(e,t,n){return new t((t,r)=>{n.ref();let i=!1,a=()=>{i||(i=!0,n.unref())};e.then(e=>{t(e),a()},e=>{r(e),a()})})}function En(e,t,n){let r=e.read.bind(e),i=e.cancel.bind(e),a=e.closed;return e.read=()=>Tn(r(),t,n),e.cancel=e=>Tn(i(e),t,n),Object.defineProperty(e,`closed`,{get:()=>Tn(a,t,n),configurable:!0}),e}function Dn(e,t,n){let r=e.write.bind(e),i=e.close.bind(e),a=e.abort.bind(e),o=e.ready,s=e.closed;return e.write=e=>Tn(r(e),t,n),e.close=()=>Tn(i(),t,n),e.abort=e=>Tn(a(e),t,n),Object.defineProperty(e,`ready`,{get:()=>Tn(o,t,n),configurable:!0}),Object.defineProperty(e,`closed`,{get:()=>Tn(s,t,n),configurable:!0}),e}function On(e,t,n){let r={next:(...r)=>Tn(e.next(...r),t,n)};if(e.return){let i=e.return.bind(e);r.return=e=>Tn(i(e),t,n)}if(e.throw){let i=e.throw.bind(e);r.throw=e=>Tn(i(e),t,n)}return r}function kn(e,t,n){let r=new Proxy(e,{get(e,r,i){return r===`getReader`?r=>En(e.getReader(r),t,n):r===`cancel`?r=>Tn(e.cancel(r),t,n):r===`pipeTo`?(r,i)=>{let a=wn(r);return Tn(e.pipeTo(a,i),t,n)}:r===`pipeThrough`?(r,i)=>{let a=In.get(r),o=a&&`readable`in a?a:{readable:wn(r.readable),writable:wn(r.writable)};return kn(e.pipeThrough(o,i),t,n)}:r===`tee`?()=>{let[r,i]=e.tee();return[kn(r,t,n),kn(i,t,n)]}:r===`values`?r=>On(e.values(r),t,n):r===Symbol.asyncIterator?()=>{let r=En(e.getReader(),t,n);return{next(){return r.read()},return(e){return r.releaseLock(),t.resolve({done:!0,value:e})}}}:Reflect.get(e,r,e)}});return In.set(r,e),r}function An(e,t,n){let r=new Proxy(e,{get(e,r,i){return r===`getWriter`?()=>Dn(e.getWriter(),t,n):r===`close`?()=>Tn(e.close(),t,n):r===`abort`?r=>Tn(e.abort(r),t,n):Reflect.get(e,r,e)}});return In.set(r,e),r}function jn(e,t,n){let r,i,a=new Proxy(e,{get(e,a,o){return a===`readable`?(r!=null||(r=kn(e.readable,t,n)),r):a===`writable`?(i!=null||(i=An(e.writable,t,n)),i):Reflect.get(e,a,e)}});return In.set(a,e),a}function Mn(e,t,n){let r=e.body?kn(e.body,t,n):null;return new Proxy(e,{get(e,i,a){return i===`body`?r:Ln.includes(i)?()=>Tn(e[i].call(e),t,n):i===`clone`?()=>Mn(e.clone(),t,n):Reflect.get(e,i,e)}})}function Nn(){let e=function(e,t){return new Rn(e&&wn(e),t)};return Object.setPrototypeOf(e,Rn),Object.setPrototypeOf(e.prototype,Rn.prototype),Object.defineProperty(e,Symbol.hasInstance,{value:e=>e instanceof Rn,configurable:!0}),e}function Pn(e,t){let n=function(...n){return kn(new bn(...n),e,t)};Object.setPrototypeOf(n,bn),Object.setPrototypeOf(n.prototype,bn.prototype),n.from=function(n){let r,i=!1;return Symbol.asyncIterator in n?(r=n[Symbol.asyncIterator](),i=!0):r=n[Symbol.iterator](),kn(new bn({pull(e){if(i)return r.next().then(t=>{t.done?e.close():e.enqueue(t.value)});{let t=r.next();t.done?e.close():e.enqueue(t.value)}}}),e,t)},Object.defineProperty(n,Symbol.hasInstance,{value:e=>e instanceof bn,configurable:!0});let r=function(...n){return An(new xn(...n),e,t)};Object.setPrototypeOf(r,xn),Object.setPrototypeOf(r.prototype,xn.prototype),Object.defineProperty(r,Symbol.hasInstance,{value:e=>e instanceof xn,configurable:!0});let i=function(...n){return jn(new Sn(...n),e,t)};return Object.setPrototypeOf(i,Sn),Object.setPrototypeOf(i.prototype,Sn.prototype),Object.defineProperty(i,Symbol.hasInstance,{value:e=>e instanceof Sn,configurable:!0}),Fn.trace(`Created wrapped Web Stream classes`),{ReadableStream:n,WritableStream:r,TransformStream:i}}var Fn,In,Ln,Rn,zn=i((()=>{Cn(),A(),Fn=D(`web-streams`),In=new WeakMap,Ln=[`text`,`json`,`arrayBuffer`,`blob`,`formData`,`bytes`],Rn=globalThis.Response})),Bn,Vn,Hn,Un,Wn,Gn=i((()=>{Cn(),Bn=e=>{let t=!1,n=null;return{signal:()=>{t=!0;let e=n;n=null,e==null||e()},wait:r=>{if(t)return t=!1,vn.resolve();if(n)throw Error(`[${e}] waker: concurrent wait not allowed`);return new vn(e=>{let i=!1,a=()=>{i||(i=!0,t=!1,e())};n=a,r!==1/0&&gn(()=>{i||(i=!0,n===a&&(n=null),e())},r)})},isSignaled:()=>t,__getWaiterCount:()=>n?1:0}},Vn=new Set,Hn=e=>{Vn.add(e)},Un=e=>{Vn.delete(e)},Wn=()=>{for(let e of Vn)e.signal()}}));function Kn(e){if(!e._events||!(e._events instanceof Map)){let t=e._events,n=new Map;if(t&&typeof t==`object`)for(let e of Object.keys(t)){let r=t[e];Array.isArray(r)&&r.length>0&&n.set(e,r)}e._events=n,e._maxListeners==null&&(e._maxListeners=10)}return e._events}function qn(e,t){return e.listenerCount(t)}function Jn(e,t){return typeof(e==null?void 0:e.listeners)==`function`?e.listeners(t):[]}function Yn(e,t){return new Promise((n,r)=>{let i=(...t)=>{e.off(`error`,a),n(t)},a=(...n)=>{e.off(t,i),r(n[0]instanceof Error?n[0]:Error(String(n[0])))};e.once(t,i),t!==`error`&&e.once(`error`,a)})}function Xn(e,t){let n=[],r=null,i=!1,a=(...e)=>{r?(r({value:e,done:!1}),r=null):n.push(e)};return e.on(t,a),{[Symbol.asyncIterator](){return{next(){return i?Promise.resolve({value:void 0,done:!0}):n.length>0?Promise.resolve({value:n.shift(),done:!1}):new Promise(e=>{r=e})},return(){return i=!0,e.off(t,a),Promise.resolve({value:void 0,done:!0})}}}}}var M,Zn,Qn=i((()=>{M=function(){this&&(this._events=new Map,this._maxListeners=10)},M.prototype.addListener=function(e,t){return this.on(e,t)},M.prototype.on=function(e,t){let n=Kn(this);return e!==`newListener`&&this.emit(`newListener`,e,t),n.has(e)||n.set(e,[]),n.get(e).push(t),this},M.prototype.once=function(e,t){let n=this,r=function r(...i){n.off(e,r),t.apply(n,i)};return r.listener=t,this.on(e,r)},M.prototype.off=function(e,t){let n=Kn(this),r=n.get(e);if(r){let i=r.findIndex(e=>e===t||e.listener===t);i!==-1&&(r.splice(i,1),e!==`removeListener`&&this.emit(`removeListener`,e,t)),r.length===0&&n.delete(e)}return this},M.prototype.removeListener=function(e,t){return this.off(e,t)},M.prototype.removeAllListeners=function(e){let t=Kn(this);return e===void 0?t.clear():t.delete(e),this},M.prototype.emit=function(e,...t){let n=Kn(this).get(e);if(!n||n.length===0)return!1;for(let e of n.slice())e.apply(this,t);return!0},M.prototype.listeners=function(e){return[...Kn(this).get(e)||[]]},M.prototype.rawListeners=function(e){return[...Kn(this).get(e)||[]]},M.prototype.listenerCount=function(e){return(Kn(this).get(e)||[]).length},M.prototype.prependListener=function(e,t){let n=Kn(this);return e!==`newListener`&&this.emit(`newListener`,e,t),n.has(e)||n.set(e,[]),n.get(e).unshift(t),this},M.prototype.prependOnceListener=function(e,t){let n=this,r=function r(...i){n.off(e,r),t.apply(n,i)};return r.listener=t,this.prependListener(e,r)},M.prototype.eventNames=function(){return[...Kn(this).keys()]},M.prototype.setMaxListeners=function(e){return Kn(this),this._maxListeners=e,this},M.prototype.getMaxListeners=function(){return Kn(this),this._maxListeners},M.prototype.constructor=M,M.listenerCount=function(e,t){return typeof(e==null?void 0:e.listenerCount)==`function`?e.listenerCount(t):typeof(e==null?void 0:e.listeners)==`function`?e.listeners(t).length:0},Zn=10})),$n,er,tr,nr,rr,ir=i((()=>{kt(),A(),Zo(),rn(),Qn(),w(),$n=D(`proc`),er=performance.now.bind(performance),tr=class extends M{constructor(e){super(),C(this,`_paused`,!0),C(this,`_ended`,!1),C(this,`_encoding`,null),C(this,`_readableListenerCount`,0),C(this,`_pid`,void 0),C(this,`_refed`,!1),C(this,`_fdRegistered`,!1),C(this,`isTTY`,!1),C(this,`readable`,!0),C(this,`fd`,0),this._pid=e,this.on(`newListener`,t=>{if(t===`readable`&&(this._readableListenerCount++,$n.trace(`ProcessStdin[${e}]: 'readable' listener added (count=${this._readableListenerCount})`)),t===`data`){$n.trace(`ProcessStdin[${e}]: 'data' listener added, entering flowing mode`);let t=H(e);t?t.queueMicrotask(()=>this.resume()):queueMicrotask(()=>this.resume())}}),this.on(`removeListener`,e=>{e===`readable`&&this._readableListenerCount--})}get readableEnded(){return this._ended}get readableFlowing(){return this._paused?null:!0}get readableLength(){return 0}_ref(){if(this._refed)return;let e=H(this._pid);e&&($n.trace(`ProcessStdin[${this._pid}]: refing event loop`),e.ref(),this._refed=!0)}_unref(){if(!this._refed)return;let e=H(this._pid);e&&($n.trace(`ProcessStdin[${this._pid}]: unrefing event loop`),e.unref(),this._refed=!1)}end(){this._ended||(this._ended=!0,this._unregisterFd(),this._unref(),this.emit(`end`),this.emit(`close`))}_registerFd(){if(this._fdRegistered)return;let e=H(this._pid);e&&(e.registerFdReadable(0,()=>this._tryFlowingRead(),!0),this._fdRegistered=!0)}_unregisterFd(){if(!this._fdRegistered)return;let e=H(this._pid);e&&e.unregisterFdReadable(0),this._fdRegistered=!1}_flushOne(e){let t=this._encoding?e.toString(this._encoding):e;this.emit(`data`,t)}pause(){return this._paused=!0,this._unregisterFd(),this._unref(),this}resume(){return this._ended?this:(this._paused=!1,this._ref(),this._registerFd(),this._tryFlowingRead(),this)}_tryFlowingRead(){if(this._paused||this._ended)return;let e=null;try{e=E(`fs_read_fd`,{pid:this._pid,fd:0,length:65536})}catch(e){var t;let n=e;if($n.trace(`ProcessStdin[${this._pid}]._tryFlowingRead: fs_read_fd error ${(t=n.code)==null?n.message:t}`),n.code===`EBADF`||n.code===`ESRCH`){this.end();return}this.emit(`error`,n);return}if(e&&e.bytes&&e.bytes.length>0){let t=j.from(e.bytes);$n.trace(`ProcessStdin[${this._pid}]._tryFlowingRead: got ${t.length} bytes`),this._flushOne(t),queueMicrotask(()=>this._tryFlowingRead())}else e&&e.eof?($n.trace(`ProcessStdin[${this._pid}]._tryFlowingRead: EOF reached`),this.end()):$n.trace(`ProcessStdin[${this._pid}]._tryFlowingRead: no data yet, waiting for event`)}read(e){if(this._ended)return null;let t=e==null?65536:e,n=null;try{n=E(`fs_read_fd`,{pid:this._pid,fd:0,length:t})}catch(t){var r;let n=t;return $n.trace(`ProcessStdin[${this._pid}].read(${e}): fs_read_fd error ${(r=n.code)==null?n.message:r}`),n.code===`EBADF`||n.code===`ESRCH`?(this.end(),null):(this.emit(`error`,n),null)}if(!n||!n.bytes||n.bytes.length===0)return $n.trace(`ProcessStdin[${this._pid}].read(${e}): no data available`),null;let i=j.from(n.bytes);return $n.trace(`ProcessStdin[${this._pid}].read(${e}): got ${i.length} bytes`),this._encoding?i.toString(this._encoding):i}setEncoding(e){return this._encoding=e,this}pipe(e){return this.on(`data`,t=>{let n=e;n&&typeof n.write==`function`&&n.write(t)}),e}unpipe(){return this.removeAllListeners(`data`),this}},nr=class extends Error{constructor(e,t=null){super(`Process exited with code ${e}${t?` (${t})`:``}`),C(this,`code`,void 0),C(this,`signal`,void 0),this.name=`ProcessExitError`,this.code=e,this.signal=t}},rr=(e,t,n,r,i)=>{let a=e,o=t,s=i,c=n,l=r,u,d=10,f=`node`,p=[],m=[],h=[],g=[],_=new Map,v=new Map,y=new Map,b={get env(){return s},set env(e){s=e},get argv(){return c},set argv(e){c=e},get argv0(){return c[0]||`node`},execArgv:[],execPath:`/usr/bin/node`,cwd(){return l},chdir(e){let t=l,n;n=e.startsWith(`/`)?e:t+`/`+e;let r=n.split(`/`).filter(Boolean),i=[];for(let e of r)e===`..`?i.pop():e!==`.`&&i.push(e);n=`/`+i.join(`/`);let a=Ot(`fs_stat`,{path:n});if(!a||a.kind!==`dir`){let t=Error(`ENOENT: no such file or directory, chdir '${e}'`);throw t.code=`ENOENT`,t}l=n},get exitCode(){return u},set exitCode(e){u=e},exit(e){var t;let n=(t=e==null?u:e)==null?0:t;if($n.debug(`process.exit[${a}](${n}) called`),n!==0){let e=Error().stack;if($n.debug(`process.exit[${a}] stack:`,e),e){let t=e.split(`
|
|
3
|
+
`);for(let e of t.slice(1,10))$n.debug(` -> ${e.trim()}`)}}for(let e of p)try{$n.trace(`Calling exit handler for process ${a} with code ${n}`),e(n)}catch(e){}for(let e of h)e(n);h=[];try{H(a).requestExit(n)}catch(e){}throw new nr(n)},on(e,t){return e===`exit`?p.push(t):e===`uncaughtException`?m.push(t):e===`unhandledRejection`?g.push(t):(_.has(e)||_.set(e,[]),_.get(e).push(t)),b},off(e,t){if(e===`exit`){let e=p.indexOf(t);e!==-1&&p.splice(e,1)}else if(e===`uncaughtException`){let e=m.indexOf(t);e!==-1&&m.splice(e,1)}else if(e===`unhandledRejection`){let e=g.indexOf(t);e!==-1&&g.splice(e,1)}else{let n=_.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}return b},removeListener(e,t){return b.off(e,t)},addListener(e,t){return b.on(e,t)},listeners(e){if(e===`exit`)return[...p];if(e===`uncaughtException`)return[...m];if(e===`unhandledRejection`)return[...g];let t=_.get(e);return t?[...t]:[]},listenerCount(e){return b.listeners(e).length},once(e,t){let n=(...r)=>{b.off(e,n),t(...r)};return b.on(e,n)},getMaxListeners(){return d},setMaxListeners(e){return d=e,b},removeAllListeners(e){return(e===`exit`||e===void 0)&&(p.length=0),(e===`uncaughtException`||e===void 0)&&(m.length=0),(e===`unhandledRejection`||e===void 0)&&(g.length=0),b},emit(e,...t){if(e===`time`){let n=t[0];v.set(n,performance.now());let r=_.get(e);if(r)for(let e of r)try{e(...t)}catch(e){console.error(`Error in time handler:`,e)}return!0}if(e===`timeEnd`){let n=t[0],r=v.get(n);if(r!==void 0){let e=performance.now()-r;y.set(n,e),v.delete(n)}let i=_.get(e);if(i)for(let e of i)try{e(...t)}catch(e){console.error(`Error in timeEnd handler:`,e)}return!0}if(e===`exit`){var n;let e=(n=t[0])==null?0:n;for(let t of p)try{t(e)}catch(e){console.error(`Error in exit handler:`,e)}return p.length>0}else if(e===`uncaughtException`){let e=t[0];for(let t of m)try{t(e)}catch(e){console.error(`Error in uncaughtException handler:`,e)}return m.length>0}else if(e===`unhandledRejection`){let[e,n]=t;for(let t of g)try{t(e,n)}catch(e){console.error(`Error in unhandledRejection handler:`,e)}return g.length>0}let r=_.get(e);if(r&&r.length>0){for(let n of r)try{n(...t)}catch(t){if(t instanceof nr)throw t;e!==`output`&&console.error(`Error in ${e} handler:`,t)}return!0}return!1},emitWarning(e,t,n){let r;if(typeof e==`string`){var i;r=Error(e),r.name=typeof t==`string`?t:(i=t==null?void 0:t.type)==null?`Warning`:i,n?r.code=n:typeof t==`object`&&t&&t.code&&(r.code=t.code)}else r=e;b.emit(`warning`,r)},nextTick(e,...t){queueMicrotask(()=>e(...t))},platform:`linux`,arch:`x64`,version:`v22.12.0`,versions:{node:`22.12.0`,substrate:`0.1.0`,v8:`browser`,modules:`127`,uv:`1.48.0`,napi:`9`,openssl:`3.0.0`},config:{target_defaults:{cflags:[],default_configuration:`Release`,defines:[],include_dirs:[],libraries:[]},variables:{asan:0,coverage:!1,debug_nghttp2:!1,enable_lto:!1,enable_pgo_generate:!1,enable_pgo_use:!1,force_dynamic_crt:0,host_arch:`x64`,icu_gyp_path:`tools/icu/icu-generic.gyp`,icu_small:!1,is_debug:0,llvm_version:`0.0`,napi_build_version:`9`,node_builtin_shareable_builtins:[],node_module_version:127,node_no_browser_globals:!1,node_prefix:`/usr/local`,node_release_urlbase:``,node_shared:!1,node_shared_brotli:!1,node_shared_cares:!1,node_shared_http_parser:!1,node_shared_libuv:!1,node_shared_nghttp2:!1,node_shared_nghttp3:!1,node_shared_ngtcp2:!1,node_shared_openssl:!1,node_shared_zlib:!1,node_tag:``,node_target_type:`executable`,node_use_bundled_v8:!0,node_use_node_code_cache:!0,node_use_node_snapshot:!0,node_use_openssl:!0,node_use_v8_platform:!0,node_without_node_options:!1,openssl_is_fips:!1,openssl_quic:!0,ossfuzz:!1,shlib_suffix:`so.127`,target_arch:`x64`,v8_enable_31bit_smis_on_64bit_arch:0,v8_enable_gdbjit:0,v8_enable_hugepage:0,v8_enable_i18n_support:1,v8_enable_inspector:1,v8_enable_javascript_linkage:1,v8_enable_lite_mode:0,v8_enable_object_print:1,v8_enable_pointer_compression:0,v8_enable_short_builtin_calls:1,v8_enable_webassembly:1,v8_no_strict_aliasing:1,v8_optimized_debug:1,v8_promise_internal_field_count:1,v8_random_seed:0,v8_trace_maps:0,v8_use_siphash:1,want_separate_host_toolset:0}},release:{name:`node`,lts:`Jod`,sourceUrl:`https://nodejs.org/download/release/v22.12.0/node-v22.12.0.tar.gz`,headersUrl:`https://nodejs.org/download/release/v22.12.0/node-v22.12.0-headers.tar.gz`},pid:a,get ppid(){let e=o.syscall(`proc_get_info`,{pid:a});return e.ok&&e.result.parent_pid!==void 0?e.result.parent_pid:0},hrtime:Object.assign(function(e){let t=er(),n=Math.floor(t/1e3),r=Math.floor(t%1e3*1e6);if(e){let t=n-e[0],i=r-e[1];return i<0&&(--t,i+=1e9),[t,i]}return[n,r]},{bigint(){let e=er();return BigInt(Math.floor(e*1e6))}}),memoryUsage(){return{rss:0,heapTotal:0,heapUsed:0,external:0,arrayBuffers:0}},uptime(){return performance.now()/1e3},getuid(){return 1e3},geteuid(){return 1e3},getgid(){return 1e3},getegid(){return 1e3},getgroups(){return[1e3]},setuid(e){},seteuid(e){},setgid(e){},setegid(e){},setgroups(e){},umask(e){return 18},get title(){return f},set title(e){f=e},stdin:new tr(a),stdout:{fd:1,write(e,t,n){let r=typeof t==`function`?t:n,i=typeof e==`string`?e:new TextDecoder().decode(e);return console.log(i.replace(/\n$/,``)),r&&H(a).queuePending(r),!0},end(e,t,n){typeof e==`function`?e():(typeof e==`string`||e instanceof Uint8Array)&&(this.write(e),typeof n==`function`&&n())},on(){return this},once(){return this},emit(){return!1},addListener(){return this},removeListener(){return this},removeAllListeners(){return this},prependListener(){return this},prependOnceListener(){return this},listeners(){return[]},listenerCount(){return 0},eventNames(){return[]},isTTY:!1,writable:!0},stderr:{fd:2,write(e,t,n){let r=typeof t==`function`?t:n,i=typeof e==`string`?e:new TextDecoder().decode(e);return $n.trace(`process.stderr.write[${a}]: ${i.replace(/\n$/,``)}`),console.error(i.replace(/\n$/,``)),r&&H(a).queuePending(r),!0},end(e,t,n){typeof e==`function`?e():(typeof e==`string`||e instanceof Uint8Array)&&(this.write(e),typeof n==`function`&&n())},on(){return this},once(){return this},emit(){return!1},addListener(){return this},removeListener(){return this},removeAllListeners(){return this},prependListener(){return this},prependOnceListener(){return this},listeners(){return[]},listenerCount(){return 0},eventNames(){return[]},isTTY:!1,writable:!0},report:{getReport(){return{header:{reportVersion:3,nodejsVersion:`v22.12.0`,osName:`Linux`,osRelease:`5.15.0`,osMachine:`x86_64`,glibcVersionRuntime:`2.31`,glibcVersionCompiler:`2.31`},sharedObjects:[],javascriptStack:{message:``,stack:[]},nativeStack:[],resourceUsage:{},libuv:[],environmentVariables:{},userLimits:{}}},writeReport(e){return``},directory:``,filename:``,compact:!1,excludeNetwork:!1,signal:`SIGUSR2`,reportOnFatalError:!1,reportOnSignal:!1,reportOnUncaughtException:!1},binding(e){switch($n.debug(`process.binding[${a}]('${e}') called`),e){case`constants`:return{os:{UV_UDP_REUSEADDR:4,errno:{ENOENT:-2,EACCES:-13,EAGAIN:-11,EEXIST:-17,EINVAL:-22,EMFILE:-24,ENOTEMPTY:-39,EPERM:-1,ENOTDIR:-20,EISDIR:-21},signals:{SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGKILL:9,SIGTERM:15}},fs:{O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_TRUNC:512,O_APPEND:1024,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFLNK:40960},crypto:{},zlib:{}};case`config`:return{variables:{node_module_version:127,node_prefix:`/usr`,v8_enable_i18n_support:1},target_defaults:{}};case`natives`:return{};case`buffer`:return{Buffer:j,kMaxLength:2147483647,kStringMaxLength:536870888,setupBufferJS(){}};case`util`:return{isArrayBuffer(e){return e instanceof ArrayBuffer},isDataView(e){return e instanceof DataView},isDate(e){return e instanceof Date},isMap(e){return e instanceof Map},isSet(e){return e instanceof Set},isRegExp(e){return e instanceof RegExp},isTypedArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},isUint8Array(e){return e instanceof Uint8Array}};case`fs`:return{FSReqCallback:class{},statValues:new Float64Array(14),bigintStatValues:new BigInt64Array(14)};case`process_methods`:return{memoryUsage(){return{rss:50*1024*1024,heapTotal:30*1024*1024,heapUsed:15*1024*1024,external:1024*1024,arrayBuffers:0}}};default:throw Error(`No such module: ${e}`)}},_linkedBinding(e){return $n.debug(`process._linkedBinding[${a}]('${e}') called`),this.binding(e)}};return b},globalThis.process}));function ar(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function or(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Zr.test(String.fromCharCode(e)):t===!1?!1:ar(e,Wr)}function sr(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Qr.test(String.fromCharCode(e)):t===!1?!1:ar(e,Wr)||ar(e,Ur)}function cr(e,t){return new P(e,{beforeExpr:!0,binop:t})}function N(e,t){return t===void 0&&(t={}),t.keyword=e,ti[e]=new P(e,t)}function lr(e){return e===10||e===13||e===8232||e===8233}function ur(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(lr(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}function dr(e){return di[e]||(di[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function fr(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function pr(e,t){for(var n=1,r=0;;){var i=ur(e,r,t);if(i<0)return new pi(n,t-r);++n,r=i}}function mr(e){var t={};for(var n in hi)t[n]=e&&li(e,n)?e[n]:hi[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!gi&&typeof console==`object`&&console.warn&&(gi=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
4
|
+
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),ui(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return ui(t.onComment)&&(t.onComment=hr(t,t.onComment)),t}function hr(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new mi(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}function gr(e,t){return vi|(e?yi:0)|(t?bi:0)}function _r(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function vr(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}function yr(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&yr(e.expression)}function br(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&br(e.expression)||e.type===`ParenthesizedExpression`&&br(e.expression)}function xr(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}function Sr(e){var t=ya[e]={binary:dr(ca[e]+` `+da),binaryOfStrings:dr(ua[e]),nonBinary:{General_Category:dr(da),Script:dr(va[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}function Cr(e){for(var t in e)return!0;return!1}function wr(e){return e===105||e===109||e===115}function Tr(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}function Er(e){return or(e,!0)||e===36||e===95}function Dr(e){return sr(e,!0)||e===36||e===95||e===8204||e===8205}function Or(e){return e>=65&&e<=90||e>=97&&e<=122}function kr(e){return e>=0&&e<=1114111}function Ar(e){return e===100||e===68||e===115||e===83||e===119||e===87}function jr(e){return Or(e)||e===95}function Mr(e){return jr(e)||Ir(e)}function Nr(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Pr(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}function Fr(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}function Ir(e){return e>=48&&e<=57}function Lr(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Rr(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}function zr(e){return e>=48&&e<=55}function Br(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function Vr(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}function Hr(e,t){return Pi.parse(e,t)}var Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,P,$r,ei,ti,F,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,I,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,L,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,R,Ca,wa,Ta,Ea,Da,Oa,z,ka,Aa,ja=i((()=>{for(Ur=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],Wr=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Gr=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Kr=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,qr={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Jr=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,Yr={5:Jr,"5module":Jr+` export import`,6:Jr+` const class extends export import super`},Xr=/^in(stanceof)?$/,Zr=RegExp(`[`+Kr+`]`),Qr=RegExp(`[`+Kr+Gr+`]`),P=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null},$r={beforeExpr:!0},ei={startsExpr:!0},ti={},F={num:new P(`num`,ei),regexp:new P(`regexp`,ei),string:new P(`string`,ei),name:new P(`name`,ei),privateId:new P(`privateId`,ei),eof:new P(`eof`),bracketL:new P(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new P(`]`),braceL:new P(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new P(`}`),parenL:new P(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new P(`)`),comma:new P(`,`,$r),semi:new P(`;`,$r),colon:new P(`:`,$r),dot:new P(`.`),question:new P(`?`,$r),questionDot:new P(`?.`),arrow:new P(`=>`,$r),template:new P(`template`),invalidTemplate:new P(`invalidTemplate`),ellipsis:new P(`...`,$r),backQuote:new P("`",ei),dollarBraceL:new P("${",{beforeExpr:!0,startsExpr:!0}),eq:new P(`=`,{beforeExpr:!0,isAssign:!0}),assign:new P(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new P(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new P(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:cr(`||`,1),logicalAND:cr(`&&`,2),bitwiseOR:cr(`|`,3),bitwiseXOR:cr(`^`,4),bitwiseAND:cr(`&`,5),equality:cr(`==/!=/===/!==`,6),relational:cr(`</>/<=/>=`,7),bitShift:cr(`<</>>/>>>`,8),plusMin:new P(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:cr(`%`,10),star:cr(`*`,10),slash:cr(`/`,10),starstar:new P(`**`,{beforeExpr:!0}),coalesce:cr(`??`,1),_break:N(`break`),_case:N(`case`,$r),_catch:N(`catch`),_continue:N(`continue`),_debugger:N(`debugger`),_default:N(`default`,$r),_do:N(`do`,{isLoop:!0,beforeExpr:!0}),_else:N(`else`,$r),_finally:N(`finally`),_for:N(`for`,{isLoop:!0}),_function:N(`function`,ei),_if:N(`if`),_return:N(`return`,$r),_switch:N(`switch`),_throw:N(`throw`,$r),_try:N(`try`),_var:N(`var`),_const:N(`const`),_while:N(`while`,{isLoop:!0}),_with:N(`with`),_new:N(`new`,{beforeExpr:!0,startsExpr:!0}),_this:N(`this`,ei),_super:N(`super`,ei),_class:N(`class`,ei),_extends:N(`extends`,$r),_export:N(`export`),_import:N(`import`,ei),_null:N(`null`,ei),_true:N(`true`,ei),_false:N(`false`,ei),_in:N(`in`,{beforeExpr:!0,binop:7}),_instanceof:N(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:N(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:N(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:N(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},ni=/\r\n?|\n|\u2028|\u2029/,ri=new RegExp(ni.source,`g`),ii=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ai=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,oi=Object.prototype,si=oi.hasOwnProperty,ci=oi.toString,li=Object.hasOwn||(function(e,t){return si.call(e,t)}),ui=Array.isArray||(function(e){return ci.call(e)===`[object Array]`}),di=Object.create(null),fi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,pi=function(e,t){this.line=e,this.column=t},pi.prototype.offset=function(e){return new pi(this.line,this.column+e)},mi=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)},hi={ecmaVersion:null,sourceType:`script`,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},gi=!1,_i=1,vi=2,yi=4,bi=8,xi=16,Si=32,Ci=64,wi=128,Ti=256,Ei=512,Di=_i|vi|Ti,Oi=0,ki=1,Ai=2,ji=3,Mi=4,Ni=5,Pi=function(e,t,n){this.options=e=mr(e),this.sourceFile=e.sourceFile,this.keywords=dr(Yr[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=qr[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=dr(r);var i=(r?r+` `:``)+qr.strict;this.reservedWordsStrict=dr(i),this.reservedWordsStrictBind=dr(i+` `+qr.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
|
|
5
|
+
`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(ni).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=F.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(_i),this.regexpState=null,this.privateNameStack=[]},Fi={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}},Pi.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},Fi.inFunction.get=function(){return(this.currentVarScope().flags&vi)>0},Fi.inGenerator.get=function(){return(this.currentVarScope().flags&bi)>0},Fi.inAsync.get=function(){return(this.currentVarScope().flags&yi)>0},Fi.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Ti|Ei))return!1;if(t&vi)return(t&yi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Fi.allowSuper.get=function(){return(this.currentThisScope().flags&Ci)>0||this.options.allowSuperOutsideMethod},Fi.allowDirectSuper.get=function(){return(this.currentThisScope().flags&wi)>0},Fi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Fi.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Ti|Ei)||t&vi&&!(t&xi))return!0}return!1},Fi.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ti)>0},Pi.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},Pi.parse=function(e,t){return new this(t,e).parse()},Pi.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},Pi.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Pi.prototype,Fi),Ii=Pi.prototype,Li=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/,Ii.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){ai.lastIndex=e,e+=ai.exec(this.input)[0].length;var t=Li.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){ai.lastIndex=e+t[0].length;var n=ai.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||ni.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,ai.lastIndex=e,e+=ai.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Ii.eat=function(e){return this.type===e?(this.next(),!0):!1},Ii.isContextual=function(e){return this.type===F.name&&this.value===e&&!this.containsEsc},Ii.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Ii.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Ii.canInsertSemicolon=function(){return this.type===F.eof||this.type===F.braceR||ni.test(this.input.slice(this.lastTokEnd,this.start))},Ii.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Ii.semicolon=function(){!this.eat(F.semi)&&!this.insertSemicolon()&&this.unexpected()},Ii.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Ii.expect=function(e){this.eat(e)||this.unexpected()},Ii.unexpected=function(e){this.raise(e==null?this.start:e,`Unexpected token`)},Ri=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1},Ii.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},Ii.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Ii.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Ii.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`},I=Pi.prototype,I.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==F.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)},zi={kind:`loop`},Bi={kind:`switch`},I.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;ai.lastIndex=this.pos;var t=ai.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(or(r,!0)){for(var i=n+1;sr(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!Xr.test(a))return!0}return!1},I.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;ai.lastIndex=this.pos;var e=ai.exec(this.input),t=this.pos+e[0].length,n;return!ni.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(sr(n=this.input.charCodeAt(t+8))||n>55295&&n<56320))},I.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;ai.lastIndex=this.pos;var n=ai.exec(this.input),r=this.pos+n[0].length;if(ni.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||sr(a=this.input.charCodeAt(i))||a>55295&&a<56320)return!1;ai.lastIndex=i;var o=ai.exec(this.input);if(o&&ni.test(this.input.slice(i,i+o[0].length)))return!1}if(t){var s=r+2,c;if(this.input.slice(r,s)===`of`&&(s===this.input.length||!sr(c=this.input.charCodeAt(s))&&!(c>55295&&c<56320)))return!1}var l=this.input.charCodeAt(r);return or(l,!0)||l===92},I.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},I.isUsing=function(e){return this.isUsingKeyword(!1,e)},I.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=F._var,a=`let`),r){case F._break:case F._continue:return this.parseBreakContinueStatement(i,r.keyword);case F._debugger:return this.parseDebuggerStatement(i);case F._do:return this.parseDoStatement(i);case F._for:return this.parseForStatement(i);case F._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case F._class:return e&&this.unexpected(),this.parseClass(i,!0);case F._if:return this.parseIfStatement(i);case F._return:return this.parseReturnStatement(i);case F._switch:return this.parseSwitchStatement(i);case F._throw:return this.parseThrowStatement(i);case F._try:return this.parseTryStatement(i);case F._const:case F._var:return a=a||this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case F._while:return this.parseWhileStatement(i);case F._with:return this.parseWithStatement(i);case F.braceL:return this.parseBlock(!0,i);case F.semi:return this.parseEmptyStatement(i);case F._export:case F._import:if(this.options.ecmaVersion>10&&r===F._import){ai.lastIndex=this.pos;var o=ai.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===F._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return t&&this.options.sourceType===`script`&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===F.name&&d.type===`Identifier`&&this.eat(F.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},I.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(F.semi)||this.insertSemicolon()?e.label=null:this.type===F.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},I.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},I.parseDoStatement=function(e){return this.next(),this.labels.push(zi),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(F._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(F.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},I.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(zi),this.enterScope(0),this.expect(F.parenL),this.type===F.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===F._var||this.type===F._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&this.next(),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new Ri,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===F._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===F._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},I.parseForAfterInit=function(e,t,n){return(this.type===F._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===F._in?n>-1&&this.unexpected(n):e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},I.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Hi|(n?0:Ui),!1,t)},I.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(F._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},I.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,`'return' outside of function`),this.next(),this.eat(F.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},I.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(F.braceL),this.labels.push(Bi),this.enterScope(0);for(var t,n=!1;this.type!==F.braceR;)if(this.type===F._case||this.type===F._default){var r=this.type===F._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(F.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},I.parseThrowStatement=function(e){return this.next(),ni.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)},Vi=[],I.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Si:0),this.checkLValPattern(e,t?Mi:Ai),this.expect(F.parenR),e},I.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===F._catch){var t=this.startNode();this.next(),this.eat(F.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(F._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},I.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},I.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(zi),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},I.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},I.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},I.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===F._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},I.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},I.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(F.braceL),e&&this.enterScope(0);this.type!==F.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},I.parseFor=function(e,t){return e.init=t,this.expect(F.semi),e.test=this.type===F.semi?null:this.parseExpression(),this.expect(F.semi),e.update=this.type===F.parenR?null:this.parseExpression(),this.expect(F.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},I.parseForIn=function(e,t){var n=this.type===F._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(F.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},I.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(F.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===F._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==F._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&!(t&&(this.type===F._in||this.isContextual(`of`)))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(F.comma))break}return e},I.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?ki:Ai,!1)},Hi=1,Ui=2,Wi=4,I.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===F.star&&t&Ui&&this.unexpected(),e.generator=this.eat(F.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Hi&&(e.id=t&Wi&&this.type!==F.name?null:this.parseIdent(),e.id&&!(t&Ui)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?ki:Ai:ji));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(gr(e.async,e.generator)),t&Hi||(e.id=this.type===F.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&Hi?`FunctionDeclaration`:`FunctionExpression`)},I.parseFunctionParams=function(e){this.expect(F.parenL),e.params=this.parseBindingList(F.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},I.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(F.braceL);this.type!==F.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&_r(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},I.parseClassElement=function(e){if(this.eat(F.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(F.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===F.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===F.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(F.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===F.parenL||o!==`method`||i||a){var l=!n.static&&vr(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},I.isClassElementNameStart=function(){return this.type===F.name||this.type===F.privateId||this.type===F.num||this.type===F.string||this.type===F.bracketL||this.type.keyword},I.parseClassElementName=function(e){this.type===F.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},I.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&vr(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},I.parseClassField=function(e){return vr(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&vr(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(F.eq)?(this.enterScope(Ei|Ci),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},I.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Ti|Ci);this.type!==F.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},I.parseClassId=function(e,t){this.type===F.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Ai,!1)):(t===!0&&this.unexpected(),e.id=null)},I.parseClassSuper=function(e){e.superClass=this.eat(F._extends)?this.parseExprSubscripts(null,!1):null},I.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},I.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];li(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}},I.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==F.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},I.parseExport=function(e,t){if(this.next(),this.eat(F.star))return this.parseExportAllDeclaration(e,t);if(this.eat(F._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==F.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},I.parseExportDeclaration=function(e){return this.parseStatement(null)},I.parseExportDefaultDeclaration=function(){var e;if(this.type===F._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Hi|Wi,!1,e)}else if(this.type===F._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},I.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),li(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},I.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},I.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},I.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},I.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},I.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(F.braceL);!this.eat(F.braceR);){if(n)n=!1;else if(this.expect(F.comma),this.afterTrailingComma(F.braceR))break;t.push(this.parseExportSpecifier(e))}return t},I.parseImport=function(e){return this.next(),this.type===F.string?(e.specifiers=Vi,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===F.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},I.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Ai),this.finishNode(e,`ImportSpecifier`)},I.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Ai),this.finishNode(e,`ImportDefaultSpecifier`)},I.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,Ai),this.finishNode(e,`ImportNamespaceSpecifier`)},I.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===F.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(F.comma)))return e;if(this.type===F.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(F.braceL);!this.eat(F.braceR);){if(t)t=!1;else if(this.expect(F.comma),this.afterTrailingComma(F.braceR))break;e.push(this.parseImportSpecifier())}return e},I.parseWithClause=function(){var e=[];if(!this.eat(F._with))return e;this.expect(F.braceL);for(var t={},n=!0;!this.eat(F.braceR);){if(n)n=!1;else if(this.expect(F.comma),this.afterTrailingComma(F.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;li(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},I.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===F.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(F.colon),this.type!==F.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},I.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===F.string){var e=this.parseLiteral(this.value);return fi.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},I.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},I.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)},Gi=Pi.prototype,Gi.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},Gi.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},Gi.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},Gi.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==F.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},Gi.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case F.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(F.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case F.braceL:return this.parseObj(!0)}return this.parseIdent()},Gi.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(F.comma),t&&this.type===F.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===F.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===F.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},Gi.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Gi.parseBindingListItem=function(e){return e},Gi.parseMaybeDefault=function(e,t,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(F.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},Gi.checkLValSimple=function(e,t,n){t===void 0&&(t=Oi);var r=t!==Oi;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===Ai&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(li(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Ni&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},Gi.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Oi),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},Gi.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Oi),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}},Ki=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},qi={b_stat:new Ki(`{`,!1),b_expr:new Ki(`{`,!0),b_tmpl:new Ki("${",!1),p_stat:new Ki(`(`,!1),p_expr:new Ki(`(`,!0),q_tmpl:new Ki("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Ki(`function`,!1),f_expr:new Ki(`function`,!0),f_expr_gen:new Ki(`function`,!0,!1,null,!0),f_gen:new Ki(`function`,!1,!1,null,!0)},Ji=Pi.prototype,Ji.initialContext=function(){return[qi.b_stat]},Ji.curContext=function(){return this.context[this.context.length-1]},Ji.braceIsBlock=function(e){var t=this.curContext();return t===qi.f_expr||t===qi.f_stat?!0:e===F.colon&&(t===qi.b_stat||t===qi.b_expr)?!t.isExpr:e===F._return||e===F.name&&this.exprAllowed?ni.test(this.input.slice(this.lastTokEnd,this.start)):e===F._else||e===F.semi||e===F.eof||e===F.parenR||e===F.arrow?!0:e===F.braceL?t===qi.b_stat:e===F._var||e===F._const||e===F.name?!1:!this.exprAllowed},Ji.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Ji.updateContext=function(e){var t,n=this.type;n.keyword&&e===F.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Ji.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},F.parenR.updateContext=F.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===qi.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},F.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?qi.b_stat:qi.b_expr),this.exprAllowed=!0},F.dollarBraceL.updateContext=function(){this.context.push(qi.b_tmpl),this.exprAllowed=!0},F.parenL.updateContext=function(e){var t=e===F._if||e===F._for||e===F._with||e===F._while;this.context.push(t?qi.p_stat:qi.p_expr),this.exprAllowed=!0},F.incDec.updateContext=function(){},F._function.updateContext=F._class.updateContext=function(e){e.beforeExpr&&e!==F._else&&!(e===F.semi&&this.curContext()!==qi.p_stat)&&!(e===F._return&&ni.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===F.colon||e===F.braceL)&&this.curContext()===qi.b_stat)?this.context.push(qi.f_expr):this.context.push(qi.f_stat),this.exprAllowed=!1},F.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},F.backQuote.updateContext=function(){this.curContext()===qi.q_tmpl?this.context.pop():this.context.push(qi.q_tmpl),this.exprAllowed=!1},F.star.updateContext=function(e){if(e===F._function){var t=this.context.length-1;this.context[t]===qi.f_expr?this.context[t]=qi.f_expr_gen:this.context[t]=qi.f_gen}this.exprAllowed=!0},F.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==F.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t},L=Pi.prototype,L.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},L.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===F.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(F.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,`SequenceExpression`)}return i},L.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Ri,r=!0);var s=this.start,c=this.startLoc;(this.type===F.parenL||this.type===F.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===F.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===F.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}else r&&this.checkExpressionErrors(t,!0);return i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},L.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(F.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(F.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},L.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},L.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==F._in)&&a>r){var o=this.type===F.logicalOR||this.type===F.logicalAND,s=this.type===F.coalesce;s&&(a=F.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===F.coalesce||s&&(this.type===F.logicalOR||this.type===F.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},L.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},L.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===F.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&yr(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&br(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===F.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==F._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(F.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1);else return o},L.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},L.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},L.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(F.arrow)},L.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},L.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(F.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(F.bracketL);if(l||c&&this.type!==F.parenL&&this.type!==F.backQuote||this.eat(F.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(F.bracketR)):this.type===F.privateId&&e.type!==`Super`?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(F.parenL)){var d=new Ri,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(F.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===F.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},L.parseExprAtom=function(e,t,n){this.type===F.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case F._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===F.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==F.dot&&this.type!==F.bracketL&&this.type!==F.parenL&&this.unexpected(),this.finishNode(r,`Super`);case F._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case F.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(F._function))return this.overrideContext(qi.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(F.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===F.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(F.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case F.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case F.num:case F.string:return this.parseLiteral(this.value);case F._null:case F._true:case F._false:return r=this.startNode(),r.value=this.type===F._null?null:this.type===F._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case F.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case F.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(F.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case F.braceL:return this.overrideContext(qi.b_expr),this.parseObj(!1,e);case F._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case F._class:return this.parseClass(this.startNode(),!1);case F._new:return this.parseNew();case F.backQuote:return this.parseTemplate();case F._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},L.parseExprAtomDefault=function(){this.unexpected()},L.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===F.parenL&&!e)return this.parseDynamicImport(t);if(this.type===F.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}else this.unexpected()},L.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(F.parenR)?e.options=null:(this.expect(F.comma),this.afterTrailingComma(F.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(F.parenR)||(this.expect(F.comma),this.afterTrailingComma(F.parenR)||this.unexpected())));else if(!this.eat(F.parenR)){var t=this.start;this.eat(F.comma)&&this.eat(F.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},L.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},L.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},L.parseParenExpression=function(){this.expect(F.parenL);var e=this.parseExpression();return this.expect(F.parenR),e},L.shouldParseArrow=function(e){return!this.canInsertSemicolon()},L.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new Ri,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==F.parenR;)if(l?l=!1:this.expect(F.comma),a&&this.afterTrailingComma(F.parenR,!0)){u=!0;break}else if(this.type===F.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===F.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}else c.push(this.parseMaybeAssign(!1,d,this.parseParenItem));var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(F.parenR),e&&this.shouldParseArrow(c)&&this.eat(F.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}else return i},L.parseParenItem=function(e){return e},L.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)},Yi=[],L.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===F.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(F.parenL)?e.arguments=this.parseExprList(F.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Yi,this.finishNode(e,`NewExpression`)},L.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===F.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
6
|
+
`),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
7
|
+
`),cooked:this.value},this.next(),n.tail=this.type===F.backQuote,this.finishNode(n,`TemplateElement`)},L.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===F.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(F.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(F.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},L.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===F.name||this.type===F.num||this.type===F.string||this.type===F.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===F.star)&&!ni.test(this.input.slice(this.lastTokEnd,this.start))},L.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(F.braceR);){if(r)r=!1;else if(this.expect(F.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(F.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},L.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(F.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===F.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===F.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(F.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(F.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},L.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},L.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===F.colon&&this.unexpected(),this.eat(F.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===F.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==F.comma&&this.type!==F.braceR&&this.type!==F.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===F.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},L.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(F.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(F.bracketR),e.key;e.computed=!1}return e.key=this.type===F.num||this.type===F.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},L.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},L.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(gr(t,r.generator)|Ci|(n?wi:0)),this.expect(F.parenL),r.params=this.parseBindingList(F.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},L.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(gr(n,!1)|xi),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},L.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==F.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ni),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},L.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},L.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,ki,t?null:n)}},L.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(F.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===F.comma?o=null:this.type===F.ellipsis?(o=this.parseSpread(r),r&&this.type===F.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},L.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Di)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},L.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},L.parseIdentNode=function(){var e=this.startNode();return this.type===F.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=F.name):this.unexpected(),e},L.parsePrivateIdent=function(){var e=this.startNode();return this.type===F.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},L.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===F.semi||this.canInsertSemicolon()||this.type!==F.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(F.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},L.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)},Xi=Pi.prototype,Xi.raise=function(e,t){var n=pr(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},Xi.raiseRecoverable=Xi.raise,Xi.curPosition=function(){if(this.options.locations)return new pi(this.curLine,this.pos-this.lineStart)},Zi=Pi.prototype,Qi=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]},Zi.enterScope=function(e){this.scopeStack.push(new Qi(e))},Zi.exitScope=function(){this.scopeStack.pop()},Zi.treatFunctionsAsVarInScope=function(e){return e.flags&vi||!this.inModule&&e.flags&_i},Zi.declareName=function(e,t,n){var r=!1;if(t===Ai){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&_i&&delete this.undefinedExports[e]}else if(t===Mi)this.currentScope().lexical.push(e);else if(t===ji){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Si&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&_i&&delete this.undefinedExports[e],s.flags&Di)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},Zi.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Zi.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Zi.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Di|Ei|Ti))return t}},Zi.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Di|Ei|Ti)&&!(t.flags&xi))return t}},$i=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new mi(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},ea=Pi.prototype,ea.startNode=function(){return new $i(this,this.start,this.startLoc)},ea.startNodeAt=function(e,t){return new $i(this,e,t)},ea.finishNode=function(e,t){return xr.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ea.finishNodeAt=function(e,t,n,r){return xr.call(this,e,t,n,r)},ea.copyNode=function(e){var t=new $i(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t},ta=`Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz`,na=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,ra=na+` Extended_Pictographic`,ia=ra,aa=ia+` EBase EComp EMod EPres ExtPict`,oa=aa,sa=oa,ca={9:na,10:ra,11:ia,12:aa,13:oa,14:sa},la=`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`,ua={9:``,10:``,11:``,12:``,13:``,14:la},da=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,fa=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,pa=fa+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,ma=pa+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,ha=ma+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,ga=ha+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,_a=ga+` `+ta,va={9:fa,10:pa,11:ma,12:ha,13:ga,14:_a},ya={},ba=0,xa=[9,10,11,12,13,14];ba<xa.length;ba+=1)Sa=xa[ba],Sr(Sa);R=Pi.prototype,Ca=function(e,t){this.parent=e,this.base=t||this},Ca.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Ca.prototype.sibling=function(){return new Ca(this.parent,this.base)},wa=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=ya[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null},wa.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},wa.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},wa.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},wa.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},wa.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},wa.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},wa.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},wa.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e?(this.advance(t),!0):!1},wa.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},R.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)},R.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Cr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},R.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},R.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ca(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},R.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},R.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},R.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},R.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},R.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},R.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},R.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},R.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},R.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},R.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},R.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&wr(n);)t+=fr(n),e.advance();return t},R.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},R.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},R.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Tr(t)?(e.lastIntValue=t,e.advance(),!0):!1},R.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!Tr(n);)e.advance();return e.pos!==t},R.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},R.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`);t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},R.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},R.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=fr(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=fr(e.lastIntValue);return!0}return!1},R.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Er(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},R.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Dr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},R.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},R.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},R.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},R.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},R.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},R.regexp_eatZero=function(e){return e.current()===48&&!Ir(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},R.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},R.regexp_eatControlLetter=function(e){var t=e.current();return Or(t)?(e.lastIntValue=t%32,e.advance(),!0):!1},R.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&kr(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1},R.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},R.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1},Ta=0,Ea=1,Da=2,R.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Ar(t))return e.lastIntValue=-1,e.advance(),Ea;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Da&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return Ta},R.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),Ea}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Ta},R.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){li(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},R.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ea;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Da;e.raise(`Invalid property name`)},R.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;jr(t=e.current());)e.lastStringValue+=fr(t),e.advance();return e.lastStringValue!==``},R.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;Mr(t=e.current());)e.lastStringValue+=fr(t),e.advance();return e.lastStringValue!==``},R.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},R.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Da&&e.raise(`Negated character class may contain strings`),!0}return!1},R.regexp_classContents=function(e){return e.current()===93?Ea:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ea)},R.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},R.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||zr(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r===93?!1:(e.lastIntValue=r,e.advance(),!0)},R.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},R.regexp_classSetExpression=function(e){var t=Ea,n;if(!this.regexp_eatClassSetRange(e))if(n=this.regexp_eatClassSetOperand(e)){n===Da&&(t=Da);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Da&&(t=Ea);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`);for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Da&&(t=Da)}},R.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},R.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Ea:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},R.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Da&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},R.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},R.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Da&&(t=Da);return t},R.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ea:Da},R.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&Nr(n)||Pr(n)?!1:(e.advance(),e.lastIntValue=n,!0)},R.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return Fr(t)?(e.lastIntValue=t,e.advance(),!0):!1},R.regexp_eatClassControlLetter=function(e){var t=e.current();return Ir(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},R.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},R.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Ir(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t},R.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Lr(n=e.current());)e.lastIntValue=16*e.lastIntValue+Rr(n),e.advance();return e.pos!==t},R.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+n*8+e.lastIntValue:e.lastIntValue=t*8+n}else e.lastIntValue=t;return!0}return!1},R.regexp_eatOctalDigit=function(e){var t=e.current();return zr(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},R.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!Lr(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+Rr(i),e.advance()}return!0},Oa=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new mi(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},z=Pi.prototype,z.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new Oa(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},z.getToken=function(){return this.next(),new Oa(this)},typeof Symbol<`u`&&(z[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===F.eof,value:t}}}}),z.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(F.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},z.readToken=function(e){return or(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},z.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},z.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=ur(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},z.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!lr(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},z.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&ii.test(String.fromCharCode(e)))++this.pos;else break loop}}},z.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},z.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(F.ellipsis)):(++this.pos,this.finishToken(F.dot))},z.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(F.assign,2):this.finishOp(F.slash,1)},z.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?F.star:F.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=F.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(F.assign,n+1):this.finishOp(r,n)},z.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(F.assign,3):this.finishOp(e===124?F.logicalOR:F.logicalAND,2):t===61?this.finishOp(F.assign,2):this.finishOp(e===124?F.bitwiseOR:F.bitwiseAND,1)},z.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(F.assign,2):this.finishOp(F.bitwiseXOR,1)},z.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||ni.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(F.incDec,2):t===61?this.finishOp(F.assign,2):this.finishOp(F.plusMin,1)},z.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(F.assign,n+1):this.finishOp(F.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(F.relational,n))},z.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(F.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(F.arrow)):this.finishOp(e===61?F.eq:F.prefix,1)},z.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(F.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(F.assign,3):this.finishOp(F.coalesce,2)}return this.finishOp(F.question,1)},z.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),or(t,!0)||t===92))return this.finishToken(F.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+fr(t)+`'`)},z.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(F.parenL);case 41:return++this.pos,this.finishToken(F.parenR);case 59:return++this.pos,this.finishToken(F.semi);case 44:return++this.pos,this.finishToken(F.comma);case 91:return++this.pos,this.finishToken(F.bracketL);case 93:return++this.pos,this.finishToken(F.bracketR);case 123:return++this.pos,this.finishToken(F.braceL);case 125:return++this.pos,this.finishToken(F.braceR);case 58:return++this.pos,this.finishToken(F.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(F.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(F.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+fr(e)+`'`)},z.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},z.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(ni.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||(this.regexpState=new wa(this));s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch(e){}return this.finishToken(F.regexp,{pattern:i,flags:o,value:c})},z.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t==null?1/0:t;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o},z.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n==null&&this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Vr(this.input.slice(t,this.pos)),++this.pos):or(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(F.num,n)},z.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=Vr(this.input.slice(t,this.pos));return++this.pos,or(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(F.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),or(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=Br(this.input.slice(t,this.pos),n);return this.finishToken(F.num,a)},z.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},z.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(lr(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(F.string,t)},ka={},z.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===ka)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},z.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ka;this.raise(e,t)},z.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===F.template||this.type===F.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(F.dollarBraceL)):(++this.pos,this.finishToken(F.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(F.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(lr(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
8
|
+
`;break;default:e+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else ++this.pos}},z.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(F.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
|
|
9
|
+
`&&++this.pos;case`
|
|
10
|
+
`:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,`Unterminated template`)},z.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
11
|
+
`;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return fr(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return lr(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},z.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},z.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(sr(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?or:sr)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=fr(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},z.readWord=function(){var e=this.readWord1(),t=F.name;return this.keywords.test(e)&&(t=ti[e]),this.finishToken(t,e)},Aa=`8.15.0`,Pi.acorn={Parser:Pi,version:Aa,defaultOptions:hi,Position:pi,SourceLocation:mi,getLineInfo:pr,Node:$i,TokenType:P,tokTypes:F,keywordTypes:ti,TokContext:Ki,tokContexts:qi,isIdentifierChar:sr,isIdentifierStart:or,Token:Oa,isNewLine:lr,lineBreak:ni,lineBreakG:ri,nonASCIIwhitespace:ii}}));function Ma(e,t,n){var r;let i=new Set;if(e.indexOf(`async`)===-1)return{usedHelpers:i};let a=(r=n==null?void 0:n.sourceType)==null?`module`:r,o=Hr(e,{ecmaVersion:`latest`,sourceType:a,allowAwaitOutsideFunction:a===`module`,allowReturnOutsideFunction:!0}),s=[{node:o,isAsync:!1,isGenerator:!1,isArrow:!1,isTopLevel:!0,referencesThis:!1,referencesArguments:!1,referencesSuper:!1,referencesSuperEq:!1,forAwaitDepth:0,superRefs:[]}];function c(){return s[s.length-1]}function l(){for(let e=s.length-1;e>=0;e--){let t=s[e];if(t.isAsync&&!t.isTopLevel)return t;if(!t.isArrow&&!t.isTopLevel)return null}return null}function u(e,t,n,r){s.push({node:e,isAsync:t,isGenerator:n,isArrow:r,isTopLevel:!1,referencesThis:!1,referencesArguments:!1,referencesSuper:!1,referencesSuperEq:!1,forAwaitDepth:0,superRefs:[]})}function d(){return s.pop()}function f(n,r,a){switch(n.type){case`MethodDefinition`:case`Property`:{let r=n;if(r.value&&r.value.type===`FunctionExpression`&&r.value.async){let a=r.value;r.key&&f(r.key,n,`key`),u(a,a.async,a.generator,!1),p(a);let o=d();o.isAsync&&Na(a,o,t,e,i,n.start);return}p(n);return}case`FunctionDeclaration`:case`FunctionExpression`:{let r=n;u(n,r.async,r.generator,!1),p(n);let a=d();a.isAsync&&Na(r,a,t,e,i);return}case`ArrowFunctionExpression`:{let r=n;u(n,r.async,!1,!0),p(n);let a=d();if(a.isAsync&&Pa(r,a,t,e,i),s.length>0){let e=c();e.referencesThis=e.referencesThis||a.referencesThis,e.referencesArguments=e.referencesArguments||a.referencesArguments,e.referencesSuper=e.referencesSuper||a.referencesSuper,e.referencesSuperEq=e.referencesSuperEq||a.referencesSuperEq,e.superRefs.push(...a.superRefs)}return}case`AwaitExpression`:{let i=n;f(i.argument,n,`argument`);let o=l();if(!o)return;Fa(i,r,a,o,t,e);return}case`ForOfStatement`:{let r=n;if(r.await){let a=l();if(a){a.forAwaitDepth++,Ia(r,a,t,e,i),f(r.left,n,`left`),f(r.right,n,`right`),f(r.body,n,`body`),a.forAwaitDepth--;return}La(r,t,e,i),f(r.left,n,`left`),f(r.right,n,`right`),f(r.body,n,`body`);return}p(n);return}case`ThisExpression`:{let e=c();e.referencesThis=!0;return}case`Identifier`:if(n.name===`arguments`){let e=c();e.referencesArguments=!0}return;case`MemberExpression`:{let e=n;if(e.object.type===`Super`){let t=c(),i=(r==null?void 0:r.type)===`AssignmentExpression`&&a===`left`,o=(r==null?void 0:r.type)===`CallExpression`&&a===`callee`;i&&(t.referencesSuperEq=!0),t.referencesSuper=!0,!e.computed&&e.property.name&&t.superRefs.push({memberStart:n.start,memberEnd:n.end,propertyName:e.property.name,computed:!1,isCall:o})}p(n);return}default:p(n)}}function p(e){for(let t of Object.keys(e)){if(t===`type`||t===`start`||t===`end`||t===`loc`||t===`range`)continue;let n=e[t];if(n&&typeof n==`object`)if(Array.isArray(n))for(let r of n)r&&typeof r==`object`&&`type`in r&&f(r,e,t);else `type`in n&&f(n,e,t)}}if(f(o,null,null),i.size>0){let e=[];for(let t of[`__async`,`__asyncGen`,`__asyncIterator`])i.has(t)&&e.push(Wa[t]);t.append(`
|
|
12
|
+
`+e.join(`
|
|
13
|
+
`))}return{usedHelpers:i}}function Na(e,t,n,r,i,a){let o=t.isGenerator?`__asyncGen`:`__async`;i.add(o);let s=a==null?e.start:a,c=Ha(r,s);if(c>=0){let e=c+5;for(;e<r.length&&r[e]===` `;)e++;n.remove(c,e)}if(t.isGenerator){let t=Ua(r,c>=0?c+5:s,e.body.start);t>=0&&n.remove(t,t+1)}t.superRefs.length>0&&Ra(e,t.superRefs,n);let{wrapperOpen:l,wrapperClose:u}=Ba(t,o),d=e.body.start;n.appendLeft(d+1,l);let f=e.body.end;n.prependRight(f-1,u)}function Pa(e,t,n,r,i){i.add(`__async`);let a=Ha(r,e.start);if(a>=0){let e=a+5;for(;e<r.length&&r[e]===` `;)e++;n.remove(a,e)}let{wrapperOpen:o,wrapperClose:s}=Ba(t,`__async`);if(e.body.type===`BlockStatement`)n.appendLeft(e.body.start+1,o),n.prependRight(e.body.end-1,s);else{let t=o.replace(/^return /,``);n.prependRight(e.body.start,t+`return `),n.appendLeft(e.body.end,s)}}function Fa(e,t,n,r,i,a){let o=e.start,s=e.end,c=e.argument.start;if(r.isGenerator){i.overwrite(o,c,`yield{__await:`),i.appendLeft(s,`}`);return}i.overwrite(o,o+5,`yield`),Va(t,n)&&(i.prependRight(o,`(`),i.appendLeft(s,`)`));let l=a.slice(o+5,c);l.includes(`
|
|
14
|
+
`)&&(i.overwrite(o+5,c,`(`),l.includes(`(`)||i.appendLeft(s,`)`))}function Ia(e,t,n,r,i){i.add(`__asyncIterator`);let a=t.forAwaitDepth,o=`__iter${a}`,s=`__result${a}`,c=`__err${a}`,l=r.slice(e.left.start,e.left.end),u=t.isGenerator?e=>`yield{__await:${e}}`:e=>`yield ${e}`,d=`{var ${o}=__asyncIterator(`,f=[`),${s},${c};`,`try{while(!(${s}=${u(`${o}.next()`)}).done){`,`${l}=${s}.value;`].join(``),p=[`}}catch(e){${c}=e}finally{`,`try{!${s}.done&&${o}.return&&(${u(`${o}.return()`)})`,`}finally{if(${c})throw ${c}}}}`].join(``);n.overwrite(e.start,e.right.start,d),n.overwrite(e.right.end,e.body.start,f),n.appendLeft(e.body.end,p)}function La(e,t,n,r){r.add(`__asyncIterator`);let i=`__iter`,a=`__result`,o=`__err`,s=n.slice(e.left.start,e.left.end),c=`{var ${i}=__asyncIterator(`,l=[`),${a},${o};`,`try{while(!(${a}=await ${i}.next()).done){`,`${s}=${a}.value;`].join(``),u=[`}}catch(e){${o}=e}finally{`,`try{!${a}.done&&${i}.return&&(await ${i}.return())`,`}finally{if(${o})throw ${o}}}}`].join(``);t.overwrite(e.start,e.right.start,c),t.overwrite(e.right.end,e.body.start,l),t.appendLeft(e.body.end,u)}function Ra(e,t,n){let r=new Set,i=new Set;for(let e of t)e.computed||(e.isCall?r.add(e.propertyName):i.add(e.propertyName));let a=[];for(let e of r){let t=`_superprop_call${za(e)}`;a.push(`var ${t}=(...args)=>super.${e}(...args);`)}for(let e of i){let t=`_superprop_get${za(e)}`;a.push(`var ${t}=()=>super.${e};`)}a.length>0&&n.appendLeft(e.body.start+1,a.join(``));for(let e of t)e.computed||(e.isCall?n.overwrite(e.memberStart,e.memberEnd,`_superprop_call${za(e.propertyName)}`):n.overwrite(e.memberStart,e.memberEnd,`_superprop_get${za(e.propertyName)}()`))}function za(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ba(e,t){let n=[],r=[],i=!1;return e.referencesThis&&(i=!0),e.referencesArguments&&!e.isArrow&&(n.push(`arguments$`),r.push(`arguments`)),{wrapperOpen:`return ${t}(function*(${n.join(`,`)}){`,wrapperClose:i?`}.call(this${r.length?`,`+r.join(`,`):``}))`:`}(${r.join(`,`)}))`}}function Va(e,t){if(!e)return!1;switch(e.type){case`BinaryExpression`:case`LogicalExpression`:return!0;case`UnaryExpression`:return!0;case`ConditionalExpression`:return t===`test`;case`TaggedTemplateExpression`:return t===`tag`;case`MemberExpression`:return t===`object`;case`SequenceExpression`:return!0;default:return!1}}function Ha(e,t){let n=t;for(;n<e.length-4;){if(e.slice(n,n+5)===`async`)return n;if(n++,n>t+50)break}return-1}function Ua(e,t,n){for(let r=t;r<n;r++)if(e[r]===`*`)return r;return-1}var Wa,Ga=i((()=>{ja(),Wa={__async:`function __async(g){var k=(new Error).stack;return new Promise(function(s,j){function c(a,x){try{var r=g[x?"throw":"next"](a)}catch(e){if(e instanceof Error&&k){e.__asyncStack=k}j(e);return}r.done?s(r.value):Promise.resolve(r.value).then(c,d)}function d(e){c(e,1)}c()})}`,__asyncGen:`function __asyncGen(g){var q=[],T=["next","throw","return"],I={};for(var i=0;i<3;i++)I[T[i]]=a.bind(0,i);I[Symbol.asyncIterator]=function(){return this};function a(t,v){return new Promise(function(s,j){q.push([s,j,v,t]);q.length===1&&c(v,t)})}function c(v,t){try{var r=g[T[t|0]](v),w=r.value&&r.value.__await;w?Promise.resolve(w).then(c,d):n(r,0)}catch(e){n(e,1)}}function d(e){c(e,1)}function n(r,s){q.shift()[s](r);q.length&&c(q[0][2],q[0][3])}return I}`,__asyncIterator:`function __asyncIterator(o){var m;if((m=o[Symbol.asyncIterator]))return m.call(o);if((m=o[Symbol.iterator]))return m.call(o);throw new TypeError("Object is not async iterable")}`}}));function Ka(e,t){let n=0,r=0,i=0;do i=ro[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function qa(e,t,n){let r=t-n;r=r<0?-r<<1|1:r<<1;do{let t=r&31;r>>>=5,r>0&&(t|=32),e.write(no[t])}while(r>0);return t}function Ja(e,t){return e.pos>=t?!1:e.peek()!==$a}function Ya(e){let{length:t}=e,n=new so(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=Ka(n,i),i<u&&(l=!1),u=i,Ja(n,e)?(a=Ka(n,a),o=Ka(n,o),s=Ka(n,s),Ja(n,e)?(c=Ka(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||Xa(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function Xa(e){e.sort(Za)}function Za(e,t){return e[0]-t[0]}function Qa(e){let t=new oo,n=0,r=0,i=0,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(o>0&&t.write(eo),s.length===0)continue;let c=0;for(let e=0;e<s.length;e++){let o=s[e];e>0&&t.write($a),c=qa(t,o[0],c),o.length!==1&&(n=qa(t,o[1],n),r=qa(t,o[2],r),i=qa(t,o[3],i),o.length!==4&&(a=qa(t,o[4],a)))}}return t.flush()}var $a,eo,to,no,ro,io,ao,oo,so,co=i((()=>{$a=44,eo=59,to=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,no=new Uint8Array(64),ro=new Uint8Array(128);for(let e=0;e<to.length;e++){let t=to.charCodeAt(e);no[e]=t,ro[t]=e}io=1024*16,ao=typeof TextDecoder<`u`?new TextDecoder:typeof Buffer<`u`?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}},oo=class{constructor(){this.pos=0,this.out=``,this.buffer=new Uint8Array(io)}write(e){let{buffer:t}=this;t[this.pos++]=e,this.pos===io&&(this.out+=ao.decode(t),this.pos=0)}flush(){let{buffer:e,out:t,pos:n}=this;return n>0?t+ao.decode(e.subarray(0,n)):t}},so=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}}}));function lo(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 B(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?lo(Object(n),!0).forEach(function(t){C(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var uo=i((()=>{w()}));function fo(){return typeof globalThis<`u`&&typeof globalThis.btoa==`function`?e=>globalThis.btoa(unescape(encodeURIComponent(e))):typeof Buffer==`function`?e=>Buffer.from(e,`utf-8`).toString(`base64`):()=>{throw Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}function po(e){let t=e.split(`
|
|
15
|
+
`),n=t.filter(e=>/^\t+/.test(e)),r=t.filter(e=>/^ {2,}/.test(e));if(n.length===0&&r.length===0)return null;if(n.length>=r.length)return` `;let i=r.reduce((e,t)=>{let n=/^ +/.exec(t)[0].length;return Math.min(n,e)},1/0);return Array(i+1).join(` `)}function mo(e,t){let n=e.split(/[/\\]/),r=t.split(/[/\\]/);for(n.pop();n[0]===r[0];)n.shift(),r.shift();if(n.length){let e=n.length;for(;e--;)n[e]=`..`}return n.concat(r).join(`/`)}function ho(e){return xo.call(e)===`[object Object]`}function go(e){let t=e.split(`
|
|
16
|
+
`),n=[];for(let e=0,r=0;e<t.length;e++)n.push(r),r+=t[e].length+1;return function(e){let t=0,r=n.length;for(;t<r;){let i=t+r>>1;e<n[i]?r=i:t=i+1}let i=t-1;return{line:i,column:e-n[i]}}}var _o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do=i((()=>{co(),uo(),_o=class e{constructor(t){this.bits=t instanceof e?t.bits.slice():[]}add(e){this.bits[e>>5]|=1<<(e&31)}has(e){return!!(this.bits[e>>5]&1<<(e&31))}},vo=class e{constructor(e,t,n){this.start=e,this.end=t,this.original=n,this.intro=``,this.outro=``,this.content=n,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(e){this.outro+=e}appendRight(e){this.intro+=e}clone(){let t=new e(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(e){return this.start<e&&e<this.end}eachNext(e){let t=this;for(;t;)e(t),t=t.next}eachPrevious(e){let t=this;for(;t;)e(t),t=t.previous}edit(e,t,n){return this.content=e,n||(this.intro=``,this.outro=``),this.storeName=t,this.edited=!0,this}prependLeft(e){this.outro=e+this.outro}prependRight(e){this.intro=e+this.intro}reset(){this.intro=``,this.outro=``,this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(t){let n=t-this.start,r=this.original.slice(0,n),i=this.original.slice(n);this.original=r;let a=new e(t,this.end,i);return a.outro=this.outro,this.outro=``,this.end=t,this.edited?(a.edit(``,!1),this.content=``):this.content=r,a.next=this.next,a.next&&(a.next.previous=a),a.previous=this,this.next=a,a}toString(){return this.intro+this.content+this.outro}trimEnd(e){if(this.outro=this.outro.replace(e,``),this.outro.length)return!0;let t=this.content.replace(e,``);if(t.length)return t!==this.content&&(this.split(this.start+t.length).edit(``,void 0,!0),this.edited&&this.edit(t,this.storeName,!0)),!0;if(this.edit(``,void 0,!0),this.intro=this.intro.replace(e,``),this.intro.length)return!0}trimStart(e){if(this.intro=this.intro.replace(e,``),this.intro.length)return!0;let t=this.content.replace(e,``);if(t.length){if(t!==this.content){let e=this.split(this.end-t.length);this.edited&&e.edit(t,this.storeName,!0),this.edit(``,void 0,!0)}return!0}else if(this.edit(``,void 0,!0),this.outro=this.outro.replace(e,``),this.outro.length)return!0}},yo=fo(),bo=class{constructor(e){this.version=3,this.file=e.file,this.sources=e.sources,this.sourcesContent=e.sourcesContent,this.names=e.names,this.mappings=Qa(e.mappings),e.x_google_ignoreList!==void 0&&(this.x_google_ignoreList=e.x_google_ignoreList),e.debugId!==void 0&&(this.debugId=e.debugId)}toString(){return JSON.stringify(this)}toUrl(){return`data:application/json;charset=utf-8;base64,`+yo(this.toString())}},xo=Object.prototype.toString,So=/\w/,Co=class{constructor(e){this.hires=e,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(e,t,n,r){if(t.length){let i=t.length-1,a=t.indexOf(`
|
|
17
|
+
`,0),o=-1;for(;a>=0&&i>a;){let i=[this.generatedCodeColumn,e,n.line,n.column];r>=0&&i.push(r),this.rawSegments.push(i),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,o=a,a=t.indexOf(`
|
|
18
|
+
`,a+1)}let s=[this.generatedCodeColumn,e,n.line,n.column];r>=0&&s.push(r),this.rawSegments.push(s),this.advance(t.slice(o+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(t));this.pending=null}addUneditedChunk(e,t,n,r,i){let a=t.start,o=!0,s=!1;for(;a<t.end;){if(n[a]===`
|
|
19
|
+
`)r.line+=1,r.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,o=!0,s=!1;else{if(this.hires||o||i.has(a)){let t=[this.generatedCodeColumn,e,r.line,r.column];this.hires===`boundary`?So.test(n[a])?s||(this.rawSegments.push(t),s=!0):(this.rawSegments.push(t),s=!1):this.rawSegments.push(t)}r.column+=1,this.generatedCodeColumn+=1,o=!1}a+=1}this.pending=null}advance(e){if(!e)return;let t=e.split(`
|
|
20
|
+
`);if(t.length>1){for(let e=0;e<t.length-1;e++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=t[t.length-1].length}},wo=`
|
|
21
|
+
`,To={insertLeft:!1,insertRight:!1,storeName:!1},Eo=class e{constructor(e,t={}){let n=new vo(0,e.length,e);Object.defineProperties(this,{original:{writable:!0,value:e},outro:{writable:!0,value:``},intro:{writable:!0,value:``},firstChunk:{writable:!0,value:n},lastChunk:{writable:!0,value:n},lastSearchedChunk:{writable:!0,value:n},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:t.filename},indentExclusionRanges:{writable:!0,value:t.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new _o},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:t.ignoreList},offset:{writable:!0,value:t.offset||0}}),this.byStart[0]=n,this.byEnd[e.length]=n}addSourcemapLocation(e){this.sourcemapLocations.add(e)}append(e){if(typeof e!=`string`)throw TypeError(`outro content must be a string`);return this.outro+=e,this}appendLeft(e,t){if(e+=this.offset,typeof t!=`string`)throw TypeError(`inserted content must be a string`);this._split(e);let n=this.byEnd[e];return n?n.appendLeft(t):this.intro+=t,this}appendRight(e,t){if(e+=this.offset,typeof t!=`string`)throw TypeError(`inserted content must be a string`);this._split(e);let n=this.byStart[e];return n?n.appendRight(t):this.outro+=t,this}clone(){let t=new e(this.original,{filename:this.filename,offset:this.offset}),n=this.firstChunk,r=t.firstChunk=t.lastSearchedChunk=n.clone();for(;n;){t.byStart[r.start]=r,t.byEnd[r.end]=r;let e=n.next,i=e&&e.clone();i&&(r.next=i,i.previous=r,r=i),n=e}return t.lastChunk=r,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new _o(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(e){e=e||{};let t=Object.keys(this.storedNames),n=new Co(e.hires),r=go(this.original);return this.intro&&n.advance(this.intro),this.firstChunk.eachNext(e=>{let i=r(e.start);e.intro.length&&n.advance(e.intro),e.edited?n.addEdit(0,e.content,i,e.storeName?t.indexOf(e.original):-1):n.addUneditedChunk(0,e,this.original,i,this.sourcemapLocations),e.outro.length&&n.advance(e.outro)}),this.outro&&n.advance(this.outro),{file:e.file?e.file.split(/[/\\]/).pop():void 0,sources:[e.source?mo(e.file||``,e.source):e.file||``],sourcesContent:e.includeContent?[this.original]:void 0,names:t,mappings:n.raw,x_google_ignoreList:this.ignoreList?[0]:void 0}}generateMap(e){return new bo(this.generateDecodedMap(e))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=po(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?` `:this.indentStr}indent(e,t){let n=/^[^\r\n]/gm;if(ho(e)&&(t=e,e=void 0),e===void 0&&(this._ensureindentStr(),e=this.indentStr||` `),e===``)return this;t=t||{};let r={};t.exclude&&(typeof t.exclude[0]==`number`?[t.exclude]:t.exclude).forEach(e=>{for(let t=e[0];t<e[1];t+=1)r[t]=!0});let i=t.indentStart!==!1,a=t=>i?`${e}${t}`:(i=!0,t);this.intro=this.intro.replace(n,a);let o=0,s=this.firstChunk;for(;s;){let t=s.end;if(s.edited)r[o]||(s.content=s.content.replace(n,a),s.content.length&&(i=s.content[s.content.length-1]===`
|
|
22
|
+
`));else for(o=s.start;o<t;){if(!r[o]){let t=this.original[o];t===`
|
|
23
|
+
`?i=!0:t!==`\r`&&i&&(i=!1,o===s.start?s.prependRight(e):(this._splitChunk(s,o),s=s.next,s.prependRight(e)))}o+=1}o=s.end,s=s.next}return this.outro=this.outro.replace(n,a),this}insert(){throw Error(`magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)`)}insertLeft(e,t){return To.insertLeft||(console.warn(`magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead`),To.insertLeft=!0),this.appendLeft(e,t)}insertRight(e,t){return To.insertRight||(console.warn(`magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead`),To.insertRight=!0),this.prependRight(e,t)}move(e,t,n){if(e+=this.offset,t+=this.offset,n+=this.offset,n>=e&&n<=t)throw Error(`Cannot move a selection inside itself`);this._split(e),this._split(t),this._split(n);let r=this.byStart[e],i=this.byEnd[t],a=r.previous,o=i.next,s=this.byStart[n];if(!s&&i===this.lastChunk)return this;let c=s?s.previous:this.lastChunk;return a&&(a.next=o),o&&(o.previous=a),c&&(c.next=r),s&&(s.previous=i),r.previous||(this.firstChunk=i.next),i.next||(this.lastChunk=r.previous,this.lastChunk.next=null),r.previous=c,i.next=s||null,c||(this.firstChunk=r),s||(this.lastChunk=i),this}overwrite(e,t,n,r){return r=r||{},this.update(e,t,n,B(B({},r),{},{overwrite:!r.contentOnly}))}update(e,t,n,r){if(e+=this.offset,t+=this.offset,typeof n!=`string`)throw TypeError(`replacement content must be a string`);if(this.original.length!==0){for(;e<0;)e+=this.original.length;for(;t<0;)t+=this.original.length}if(t>this.original.length)throw Error(`end is out of bounds`);if(e===t)throw Error(`Cannot overwrite a zero-length range – use appendLeft or prependRight instead`);this._split(e),this._split(t),r===!0&&(To.storeName||(console.warn(`The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string`),To.storeName=!0),r={storeName:!0});let i=r===void 0?!1:r.storeName,a=r===void 0?!1:r.overwrite;if(i){let n=this.original.slice(e,t);Object.defineProperty(this.storedNames,n,{writable:!0,value:!0,enumerable:!0})}let o=this.byStart[e],s=this.byEnd[t];if(o){let e=o;for(;e!==s;){if(e.next!==this.byStart[e.end])throw Error(`Cannot overwrite across a split point`);e=e.next,e.edit(``,!1)}o.edit(n,i,!a)}else{let r=new vo(e,t,``).edit(n,i);s.next=r,r.previous=s}return this}prepend(e){if(typeof e!=`string`)throw TypeError(`outro content must be a string`);return this.intro=e+this.intro,this}prependLeft(e,t){if(e+=this.offset,typeof t!=`string`)throw TypeError(`inserted content must be a string`);this._split(e);let n=this.byEnd[e];return n?n.prependLeft(t):this.intro=t+this.intro,this}prependRight(e,t){if(e+=this.offset,typeof t!=`string`)throw TypeError(`inserted content must be a string`);this._split(e);let n=this.byStart[e];return n?n.prependRight(t):this.outro=t+this.outro,this}remove(e,t){if(e+=this.offset,t+=this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;t<0;)t+=this.original.length}if(e===t)return this;if(e<0||t>this.original.length)throw Error(`Character is out of bounds`);if(e>t)throw Error(`end must be greater than start`);this._split(e),this._split(t);let n=this.byStart[e];for(;n;)n.intro=``,n.outro=``,n.edit(``),n=t>n.end?this.byStart[n.end]:null;return this}reset(e,t){if(e+=this.offset,t+=this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;t<0;)t+=this.original.length}if(e===t)return this;if(e<0||t>this.original.length)throw Error(`Character is out of bounds`);if(e>t)throw Error(`end must be greater than start`);this._split(e),this._split(t);let n=this.byStart[e];for(;n;)n.reset(),n=t>n.end?this.byStart[n.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let e=this.lastChunk;do{if(e.outro.length)return e.outro[e.outro.length-1];if(e.content.length)return e.content[e.content.length-1];if(e.intro.length)return e.intro[e.intro.length-1]}while(e=e.previous);return this.intro.length?this.intro[this.intro.length-1]:``}lastLine(){let e=this.outro.lastIndexOf(wo);if(e!==-1)return this.outro.substr(e+1);let t=this.outro,n=this.lastChunk;do{if(n.outro.length>0){if(e=n.outro.lastIndexOf(wo),e!==-1)return n.outro.substr(e+1)+t;t=n.outro+t}if(n.content.length>0){if(e=n.content.lastIndexOf(wo),e!==-1)return n.content.substr(e+1)+t;t=n.content+t}if(n.intro.length>0){if(e=n.intro.lastIndexOf(wo),e!==-1)return n.intro.substr(e+1)+t;t=n.intro+t}}while(n=n.previous);return e=this.intro.lastIndexOf(wo),e===-1?this.intro+t:this.intro.substr(e+1)+t}slice(e=0,t=this.original.length-this.offset){if(e+=this.offset,t+=this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;t<0;)t+=this.original.length}let n=``,r=this.firstChunk;for(;r&&(r.start>e||r.end<=e);){if(r.start<t&&r.end>=t)return n;r=r.next}if(r&&r.edited&&r.start!==e)throw Error(`Cannot use replaced character ${e} as slice start anchor.`);let i=r;for(;r;){r.intro&&(i!==r||r.start===e)&&(n+=r.intro);let a=r.start<t&&r.end>=t;if(a&&r.edited&&r.end!==t)throw Error(`Cannot use replaced character ${t} as slice end anchor.`);let o=i===r?e-r.start:0,s=a?r.content.length+t-r.end:r.content.length;if(n+=r.content.slice(o,s),r.outro&&(!a||r.end===t)&&(n+=r.outro),a)break;r=r.next}return n}snip(e,t){let n=this.clone();return n.remove(0,e),n.remove(t,n.original.length),n}_split(e){if(this.byStart[e]||this.byEnd[e])return;let t=this.lastSearchedChunk,n=t,r=e>t.end;for(;t;){if(t.contains(e))return this._splitChunk(t,e);if(t=r?this.byStart[t.end]:this.byEnd[t.start],t===n)return;n=t}}_splitChunk(e,t){if(e.edited&&e.content.length){let n=go(this.original)(t);throw Error(`Cannot split a chunk that has already been edited (${n.line}:${n.column} – "${e.original}")`)}let n=e.split(t);return this.byEnd[t]=e,this.byStart[t]=n,this.byEnd[n.end]=n,e===this.lastChunk&&(this.lastChunk=n),this.lastSearchedChunk=e,!0}toString(){let e=this.intro,t=this.firstChunk;for(;t;)e+=t.toString(),t=t.next;return e+this.outro}isEmpty(){let e=this.firstChunk;do if(e.intro.length&&e.intro.trim()||e.content.length&&e.content.trim()||e.outro.length&&e.outro.trim())return!1;while(e=e.next);return!0}length(){let e=this.firstChunk,t=0;do t+=e.intro.length+e.content.length+e.outro.length;while(e=e.next);return t}trimLines(){return this.trim(`[\\r\\n]`)}trim(e){return this.trimStart(e).trimEnd(e)}trimEndAborted(e){let t=RegExp((e||`\\s`)+`+$`);if(this.outro=this.outro.replace(t,``),this.outro.length)return!0;let n=this.lastChunk;do{let e=n.end,r=n.trimEnd(t);if(n.end!==e&&(this.lastChunk===n&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),r)return!0;n=n.previous}while(n);return!1}trimEnd(e){return this.trimEndAborted(e),this}trimStartAborted(e){let t=RegExp(`^`+(e||`\\s`)+`+`);if(this.intro=this.intro.replace(t,``),this.intro.length)return!0;let n=this.firstChunk;do{let e=n.end,r=n.trimStart(t);if(n.end!==e&&(n===this.lastChunk&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),r)return!0;n=n.next}while(n);return!1}trimStart(e){return this.trimStartAborted(e),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(e,t){function n(e,n){return typeof t==`string`?t.replace(/\$(\$|&|\d+)/g,(t,n)=>n===`$`?`$`:n===`&`?e[0]:+n<e.length?e[+n]:`$${n}`):t(...e,e.index,n,e.groups)}function r(e,t){let n,r=[];for(;n=e.exec(t);)r.push(n);return r}if(e.global)r(e,this.original).forEach(e=>{if(e.index!=null){let t=n(e,this.original);t!==e[0]&&this.overwrite(e.index,e.index+e[0].length,t)}});else{let t=this.original.match(e);if(t&&t.index!=null){let e=n(t,this.original);e!==t[0]&&this.overwrite(t.index,t.index+t[0].length,e)}}return this}_replaceString(e,t){let{original:n}=this,r=n.indexOf(e);return r!==-1&&(typeof t==`function`&&(t=t(e,r,n)),e!==t&&this.overwrite(r,r+e.length,t)),this}replace(e,t){return typeof e==`string`?this._replaceString(e,t):this._replaceRegexp(e,t)}_replaceAllString(e,t){let{original:n}=this,r=e.length;for(let i=n.indexOf(e);i!==-1;i=n.indexOf(e,i+r)){let e=n.slice(i,i+r),a=t;typeof t==`function`&&(a=t(e,i,n)),e!==a&&this.overwrite(i,i+r,a)}return this}replaceAll(e,t){if(typeof e==`string`)return this._replaceAllString(e,t);if(!e.global)throw TypeError(`MagicString.prototype.replaceAll called with a non-global RegExp argument`);return this._replaceRegexp(e,t)}}}));function Oo(e,t){let n=`async function __af__(${e.join(`,`)}){\n${t}\n}`,r=new Eo(n);Ma(n,r,{sourceType:`script`});let i=r.toString();return Function(`${i}\nreturn __af__;`)()}function ko(){let e=Function;return new Proxy(e,{construct(t,n){if(n.length>0){let e=n[n.length-1];if(typeof e==`string`&&jo.test(e)){Ao.debug(`Intercepted new Function() with await in body, applying async transform`);let t=String(e);return Oo(n.slice(0,-1).map(String),t)}}return Reflect.construct(e,n)},apply(t,n,r){if(r.length>0){let e=r[r.length-1];if(typeof e==`string`&&jo.test(e)){Ao.debug(`Intercepted Function() call with await in body, applying async transform`);let t=String(e);return Oo(r.slice(0,-1).map(String),t)}}return e(...r)},get(e,t,n){return Reflect.get(e,t,n)}})}var Ao,jo,Mo=i((()=>{Ga(),Do(),A(),Ao=D(`async-fn`),jo=/\bawait[\s(]/}));function No(e){var t;return(t={SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:7,SIGFPE:8,SIGKILL:9,SIGUSR1:10,SIGSEGV:11,SIGUSR2:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:17,SIGCONT:18,SIGSTOP:19,SIGTSTP:20,SIGTTIN:21,SIGTTOU:22}[e])==null?15:t}function Po(){var e;return(e=Uo==null?void 0:Uo())==null?!1:e}function Fo(){return new Promise(e=>{if(typeof MessageChannel<`u`){let t=new MessageChannel;t.port1.onmessage=()=>e(),t.port2.postMessage(0)}else setTimeout(e,0)})}var Io,Lo,Ro,zo,Bo,V,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,H,Xo,Zo=i((()=>{rn(),A(),mn(),Cn(),zn(),Gn(),ir(),Mo(),w(),Ke(),V=D(`event-loop`),Vo=[`global`,`clearImmediate`,`setImmediate`,`clearInterval`,`clearTimeout`,`setInterval`,`setTimeout`,`queueMicrotask`,`structuredClone`,`atob`,`btoa`,`performance`,`fetch`,`fs`,`path`,`os`,`TextEncoder`,`TextDecoder`,`require`,`ReadableStream`,`WritableStream`,`TransformStream`,`Response`],Ho=null,Uo=null,Wo=class extends Error{constructor(e,t){super(e),this.name=`UnhandledEventLoopError`,this.cause=t}},Io=Symbol.toPrimitive,Lo=Symbol.dispose,Go=class{constructor(e,t){C(this,`_id`,void 0),C(this,`_timer`,void 0),this._id=e,this._timer=t}ref(){return this._timer.ref=!0,this}unref(){return V.trace(`Timer[${this._id}] unrefing`),this._timer.ref=!1,this}hasRef(){return this._timer.ref}refresh(){return this._timer.refresh(),this}[Io](){return this._id}[Lo](){this._timer.cleared=!0}},Ro=Symbol.toPrimitive,zo=Symbol.dispose,Ko=class{constructor(e,t){C(this,`_id`,void 0),C(this,`_immediate`,void 0),this._id=e,this._immediate=t}ref(){return this._immediate.ref=!0,this}unref(){return this._immediate.ref=!1,this}hasRef(){return this._immediate.ref}[Ro](){return this._id}[zo](){this._immediate.cleared=!0}},Bo=Symbol.iterator,qo=class{constructor(){C(this,`heap`,[]),C(this,`idToIndex`,new Map)}get size(){return this.heap.length}insert(e){this.heap.push(e),this.idToIndex.set(e.id,this.heap.length-1),this.siftUp(this.heap.length-1)}peek(){return this.heap[0]}extractMin(){if(this.heap.length===0)return;let e=this.heap[0];return this.idToIndex.delete(e.id),this.heap.length===1?(this.heap.pop(),e):(this.heap[0]=this.heap.pop(),this.idToIndex.set(this.heap[0].id,0),this.siftDown(0),e)}get(e){let t=this.idToIndex.get(e);return t===void 0?void 0:this.heap[t]}remove(e){let t=this.idToIndex.get(e);return t===void 0?!1:(this.idToIndex.delete(e),t===this.heap.length-1?(this.heap.pop(),!0):(this.heap[t]=this.heap.pop(),this.idToIndex.set(this.heap[t].id,t),this.siftDown(t),this.siftUp(t),!0))}updateExpiry(e,t){let n=this.idToIndex.get(e);if(n===void 0)return;let r=this.heap[n],i=r.expireAt;r.expireAt=t,t<i?this.siftUp(n):this.siftDown(n)}siftUp(e){for(;e>0;){let t=Math.floor((e-1)/2);if(this.heap[t].expireAt<=this.heap[e].expireAt)break;this.swap(e,t),e=t}}siftDown(e){for(;;){let t=2*e+1,n=2*e+2,r=e;if(t<this.heap.length&&this.heap[t].expireAt<this.heap[r].expireAt&&(r=t),n<this.heap.length&&this.heap[n].expireAt<this.heap[r].expireAt&&(r=n),r===e)break;this.swap(e,r),e=r}}swap(e,t){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,this.idToIndex.set(this.heap[e].id,e),this.idToIndex.set(this.heap[t].id,t)}countRefed(){let e=0;for(let t of this.heap)t.ref&&!t.cleared&&e++;return e}[Bo](){return this.heap[Symbol.iterator]()}},Jo=new Map,Yo=(e,t)=>{let n=new Xo(e,t);return Jo.set(e,n),Hn(n.wake),n},H=e=>{let t=Jo.get(e);if(!t)throw Error(`ProcessEventLoop for PID ${e} not found`);return t},Xo=class{constructor(e,t){C(this,`pid`,void 0),C(this,`kernel`,void 0),C(this,`eqId`,null),C(this,`running`,!1),C(this,`_exitRequested`,null),C(this,`_currentAsyncContext`,null),C(this,`nextTickQueue`,[]),C(this,`nodeMicrotaskQueue`,[]),C(this,`timerHeap`,new qo),C(this,`nextTimerId`,1),C(this,`immediateQueue`,[]),C(this,`nextImmediateId`,1),C(this,`closeQueue`,[]),C(this,`pendingCallbacks`,[]),C(this,`handles`,new Map),C(this,`refCount`,0),C(this,`wake`,void 0),C(this,`_globals`,void 0),C(this,`_builtinModules`,new Set),C(this,`_checkUnhandledRejections`,null),this.pid=e,this.kernel=t,this.wake=Bn(`el:${e}`);let{PromiseClass:n,checkUnhandledRejections:r}=pn(this);this._checkUnhandledRejections=r;let i=this.createWrappedFetch(n),a=Pn(n,this);this._globals={Promise:n,__SubstratePatchedFunction:ko(),Buffer:j,fetch:i,ReadableStream:a.ReadableStream,WritableStream:a.WritableStream,TransformStream:a.TransformStream,Response:Nn(),setTimeout:this.setTimeout.bind(this),setInterval:this.setInterval.bind(this),setImmediate:this.setImmediate.bind(this),clearTimeout:this.clearTimeout.bind(this),clearInterval:this.clearInterval.bind(this),clearImmediate:this.clearImmediate.bind(this),queueMicrotask:this.queueMicrotask.bind(this)},this.initKernelEventQueue()}createWrappedFetch(e){return((t,n)=>{let r=t instanceof URL?t.toString():t instanceof Request?t.url:t;return V.trace(`EventLoop[${this.pid}] running wrapped fetch for ${r}`),new e((i,a)=>{this.ref();let o=!1,s=()=>{o||(o=!0,this.unref())};yn(t,n).then(t=>{V.trace(`EventLoop[${this.pid}] wrapped fetch resolved for ${r}; response status: ${t.status}`),i(Mn(t,e,this)),s()}).catch(e=>{V.trace(`EventLoop[${this.pid}] wrapped fetch rejected for ${r}; error: ${e instanceof Error?e.message:String(e)}`),a(e),s()}).catch(e=>{s(),a(e)})})})}initKernelEventQueue(){try{let e=this.kernel.syscall(`eq_create`,{});if(e.ok){this.eqId=e.result.eq_id,V.debug(`EventLoop[${this.pid}] created kernel event queue: eqId=${this.eqId}`);try{this.kernel.syscall(`proc_set_eq_id`,{pid:this.pid,eq_id:this.eqId})}catch(e){V.warn(`EventLoop[${this.pid}] failed to set process eq_id:`,e)}}else V.warn(`EventLoop[${this.pid}] failed to create kernel event queue:`,e.error)}catch(e){V.warn(`EventLoop[${this.pid}] error creating kernel event queue:`,e)}}getEventQueueId(){return this.eqId}captureAsyncContext(){return this._currentAsyncContext}runInAsyncContext(e,t){let n=this._currentAsyncContext;this._currentAsyncContext=e;try{return t()}finally{this._currentAsyncContext=n}}setCurrentAsyncContext(e){this._currentAsyncContext=e}wrapWithContext(e,t){let n=this._currentAsyncContext;return t&&t.length>0?n?()=>this.runInAsyncContext(n,()=>e(...t)):()=>e(...t):n?()=>this.runInAsyncContext(n,e):e}registerServer(e,t,n=!0){let r=`server:${e}`;this.handles.set(r,{callback:t,ref:n}),n&&this.refCount++,V.debug(`EventLoop[${this.pid}] registered server handle: ${r}`)}unregisterServer(e){let t=`server:${e}`,n=this.handles.get(t);n&&(n.ref&&this.refCount--,this.handles.delete(t),V.debug(`EventLoop[${this.pid}] unregistered server handle: ${t}`))}registerConnection(e,t,n=!0){let r=`conn:${e}`;this.handles.set(r,{callback:t,ref:n}),n&&this.refCount++,V.trace(`EventLoop[${this.pid}] registered connection handle: ${r}`)}registerFsWatch(e,t,n=!0){let r=`watch:${e}`;this.handles.set(r,{callback:t,ref:n}),n&&this.refCount++,V.trace(`EventLoop[${this.pid}] registered fs watch handle: ${r}`)}registerFdReadable(e,t,n=!0){let r=`fd:${e}`;this.handles.set(r,{callback:t,ref:n}),n&&this.refCount++,V.trace(`EventLoop[${this.pid}] registered fd handle: ${r}`)}unregisterConnection(e){let t=`conn:${e}`,n=this.handles.get(t);n&&(n.ref&&this.refCount--,this.handles.delete(t),V.trace(`EventLoop[${this.pid}] unregistered connection handle: ${t}`))}unregisterFsWatch(e){let t=`watch:${e}`,n=this.handles.get(t);n&&(n.ref&&this.refCount--,this.handles.delete(t),V.trace(`EventLoop[${this.pid}] unregistered fs watch handle: ${t}`))}unregisterFdReadable(e){let t=`fd:${e}`,n=this.handles.get(t);n&&(n.ref&&this.refCount--,this.handles.delete(t),V.trace(`EventLoop[${this.pid}] unregistered fd handle: ${t}`))}queuePendingCallback(e){this.pendingCallbacks.push({callback:e}),this.wake.signal()}setGlobal(e,t){this._globals[e]=t}reportUnhandledRejection(e,t){let n=this._globals.process;if(n!=null&&n.emit&&(n.listenerCount?n.listenerCount(`unhandledRejection`)>0:n.listeners&&n.listeners(`unhandledRejection`).length>0)){n.emit(`unhandledRejection`,e,t);return}let r=this._globals.console;r!=null&&r.error&&(e instanceof Error?r.error(e.stack||e.message):r.error(`Unhandled promise rejection:`,e)),this.requestExit(1)}isBuiltinModule(e){return this._builtinModules.has(e)}runWithGlobals(e){if(typeof e!=`function`)throw TypeError(`withGlobal: fn must be a function`);if(Ho!==null){if(Ho===this)return e();throw Error(`Cannot switch global context from pid ${Ho.pid} to pid ${this.pid} mid-execution. This indicates a bug in the event loop scheduling.`)}let t=globalThis,n=new Set([...Object.keys(this._globals),...Vo]),r=new Set(Object.getOwnPropertyNames(globalThis)),i=new Map;for(let e of n)e in t&&i.set(e,t[e]);for(let e of Object.keys(this._globals))t[e]=this._globals[e];let a=Function.prototype.constructor,o=this._globals.__SubstratePatchedFunction;o&&(Function.prototype.constructor=o),Ho=this;try{return e()}finally{Function.prototype.constructor=a,Ho=null;for(let e of Object.keys(t))!r.has(e)&&!(e in this._globals)&&(V.trace(`EventLoop[${this.pid}] captured new global: ${e}`),this._globals[e]=t[e],delete t[e]);for(let[e,n]of i)n===void 0?delete t[e]:t[e]=n;for(let e of Object.keys(this._globals))!r.has(e)&&!i.has(e)&&delete t[e]}}nextTick(e,...t){let n=this.wrapWithContext(e,t);this.nextTickQueue.push(n),V.trace(`EventLoop[${this.pid}] queued nextTick callback, size=${this.nextTickQueue.length}`),this.wake.signal()}queueMicrotask(e){let t=this.wrapWithContext(e);this.nodeMicrotaskQueue.push(t),V.trace(`EventLoop[${this.pid}] queued nodeMicrotask callback, size=${this.nodeMicrotaskQueue.length}`),this.wake.signal()}setImmediate(e,...t){let n=this.nextImmediateId++,r={id:n,callback:this.wrapWithContext(e,t),ref:!0,cleared:!1};return this.immediateQueue.push(r),V.trace(`EventLoop[${this.pid}] queued immediate callback, size=${this.immediateQueue.length}`),this.wake.signal(),new Ko(n,r)}clearImmediate(e){if(e!=null)if(typeof e==`number`){let t=this.immediateQueue.find(t=>t.id===e);t&&(t.cleared=!0)}else e[Symbol.dispose]()}queuePending(e){let t=this.wrapWithContext(e);this.pendingCallbacks.push({callback:t}),V.trace(`EventLoop[${this.pid}] queued pending callback, size=${this.pendingCallbacks.length}`),this.wake.signal()}queueClose(e){let t=this.wrapWithContext(e);this.closeQueue.push({callback:t}),V.trace(`EventLoop[${this.pid}] queued close callback, size=${this.closeQueue.length}`),this.wake.signal()}setTimeout(e,t,...n){return this.addTimer(e,Math.max(0,t),0,...n)}setInterval(e,t,...n){let r=Math.max(1,t);return this.addTimer(e,r,r,...n)}clearTimeout(e){if(e!=null)if(typeof e==`number`){let t=this.timerHeap.get(e);t&&(t.cleared=!0)}else e[Symbol.dispose]()}clearInterval(e){if(e!=null)if(typeof e==`number`){let t=this.timerHeap.get(e);t&&(t.cleared=!0)}else e[Symbol.dispose]()}ref(){this.refCount++,V.trace(`EventLoop[${this.pid}] refed ${this.refCount} times`),this.wake.signal()}unref(){this.refCount>0&&this.refCount--,V.trace(`EventLoop[${this.pid}] unrefed, now refed ${this.refCount} times`),this.wake.signal()}start(){var e=this;return T(function*(){if(e.running)return;V.debug(`EventLoop[${e.pid}] starting`),e.running=!0;let t=0;e.checkPendingSignal();try{for(;e.running;)if(yield e.runIteration(),t++,t%1e4==0&&V.debug(`EventLoop[${e.pid}] iteration ${t}: refCount=${e.refCount} nextTickQueue=${e.nextTickQueue.length} nodeMicrotaskQueue=${e.nodeMicrotaskQueue.length} pendingCallbacks=${e.pendingCallbacks.length} immediateQueue=${e.immediateQueue.length} closeQueue=${e.closeQueue.length} refedTimers=${e.timerHeap.countRefed()}`),!e.loopAlive()){V.debug(`EventLoop[${e.pid}] loop is not alive, stopping (refCount=${e.refCount} nextTick=${e.nextTickQueue.length} microtask=${e.nodeMicrotaskQueue.length} pending=${e.pendingCallbacks.length} immediate=${e.immediateQueue.length} close=${e.closeQueue.length} refedTimers=${e.timerHeap.countRefed()})`);break}if(e._exitRequested)throw new nr(e._exitRequested.code,e._exitRequested.signal)}catch(n){throw n instanceof nr?V.debug(`EventLoop[${e.pid}] process.exit(${n.code}) after ${t} iterations`):V.error(`EventLoop[${e.pid}] error while running event loop: iterationCount=${t} error=${n instanceof Error?n.message:String(n)}`),n}finally{e.running&&V.debug(`EventLoop[${e.pid}] stopping due to no work: iterationCount=${t} refCount=${e.refCount} nextTickQueue=${e.nextTickQueue.length} nodeMicrotaskQueue=${e.nodeMicrotaskQueue.length} pendingCallbacks=${e.pendingCallbacks.length} immediateQueue=${e.immediateQueue.length} closeQueue=${e.closeQueue.length} hasActiveTimers=${e.hasActiveTimers()}`),e.stop()}})()}runOnce(){var e=this;return T(function*(){e.runWithGlobals(()=>{e.drainNextTickAndMicrotaskQueues(),e.runTimers(),e.drainNextTickAndMicrotaskQueues(),e.drainPhaseQueue(`pending`,e.pendingCallbacks),e.drainNextTickAndMicrotaskQueues()}),e.pollKernelEvents()&&e.runWithGlobals(()=>{e.drainPhaseQueue(`pending`,e.pendingCallbacks),e.drainNextTickAndMicrotaskQueues()}),e.runWithGlobals(()=>{e.drainPhaseQueue(`check`,e.immediateQueue),e.drainNextTickAndMicrotaskQueues(),e.drainPhaseQueue(`close`,e.closeQueue),e.drainNextTickAndMicrotaskQueues()}),yield Fo()})()}requestExit(e,t=null){this._exitRequested||(V.debug(`EventLoop[${this.pid}] exit requested with code ${e}`),this._exitRequested={code:e,signal:t},this.running=!1,this.wake.signal())}stop(){this.running&&(V.debug(`EventLoop[${this.pid}] stopping`),this.running=!1,this.wake.signal(),Un(this.wake),Jo.get(this.pid)===this&&Jo.delete(this.pid))}isRunning(){return this.running}__getWakerWaiterCount(){return this.wake.__getWaiterCount()}loopAlive(){var e;if(!this.running)return!1;if(this.refCount>0||this.nextTickQueue.length>0||this.nodeMicrotaskQueue.length>0||this.pendingCallbacks.length>0||this.immediateQueue.length>0||this.closeQueue.length>0||this.hasActiveTimers())return!0;if(Po())return V.trace(`EventLoop[${this.pid}] kept alive by global pending work`),!0;let t=this.kernel.syscall(`proc_has_running_children`,{pid:this.pid}),n=t.ok&&((e=t.result)==null?void 0:e.value);return V.trace(`EventLoop[${this.pid}] proc_has_running_children result: ok=${t.ok} value=${n}`),!!n}checkPendingSignal(){try{let e=this.kernel.syscall(`proc_get_info`,{pid:this.pid});if(!e.ok){V.trace(`EventLoop[${this.pid}] proc_get_info failed during signal check`);return}let t=e.result.signal;t&&(V.debug(`EventLoop[${this.pid}] found pending signal: ${t}`),this.queuePendingCallback(()=>{this.dispatchKernelEvent({type:`proc_exit`,pid:this.pid,signal:t})}))}catch(e){V.warn(`EventLoop[${this.pid}] error checking pending signal:`,e)}}runIteration(){var e=this;return T(function*(){e.runWithGlobals(()=>{e.drainNextTickAndMicrotaskQueues(),e.runTimers(),e.drainNextTickAndMicrotaskQueues(),e.drainPhaseQueue(`pending`,e.pendingCallbacks),e.drainNextTickAndMicrotaskQueues()}),yield e.poll(),e.runWithGlobals(()=>{e.drainPhaseQueue(`check`,e.immediateQueue),e.drainNextTickAndMicrotaskQueues(),e.drainPhaseQueue(`close`,e.closeQueue),e.drainNextTickAndMicrotaskQueues()})})()}poll(){var e=this;return T(function*(){if(e.pollKernelEvents()&&e.runWithGlobals(()=>{e.drainPhaseQueue(`pending`,e.pendingCallbacks),e.drainNextTickAndMicrotaskQueues()}),e.hasImmediateWork()){V.trace(`EventLoop[${e.pid}] has immediate work, skipping poll wait`),yield Fo();return}let t=e.computePollTimeout();if(V.trace(`EventLoop[${e.pid}] poll timeout=${t}`),t===0){yield Fo();return}yield e.wake.wait(t),e.pollKernelEvents()&&e.runWithGlobals(()=>{e.drainPhaseQueue(`pending`,e.pendingCallbacks),e.drainNextTickAndMicrotaskQueues()})})()}pollKernelEvents(){if(this.eqId===null)return!1;try{let e=this.kernel.syscall(`eq_poll`,{eq_id:this.eqId,max:100});if(!e.ok)return V.trace(`EventLoop[${this.pid}] eq_poll failed:`,e.error),!1;let t=e.result.events;if(t.length===0)return!1;V.debug(`EventLoop[${this.pid}] polled ${t.length} kernel events`);for(let e of t)this.dispatchKernelEvent(e);return!0}catch(e){return V.warn(`EventLoop[${this.pid}] error polling kernel events:`,e),!1}}dispatchKernelEvent(e){V.trace(`EventLoop[${this.pid}] dispatching kernel event: ${e.type}`);let t=null;switch(e.type){case`net_accept`:t=`server:${e.server_id}`;break;case`net_readable`:case`net_writable`:case`net_closed`:t=`conn:${e.conn_id}`;break;case`fs_watch_event`:t=`watch:${e.watch_id}`;break;case`pipe_readable`:{let{fd:n,pid:r}=e;V.trace(`EventLoop[${this.pid}] pipe_readable fd=${n} pid=${r}`),t=`fd:${n}`;break}case`proc_exit`:{let{pid:t,signal:n}=e;t===this.pid&&n&&(V.debug(`EventLoop[${this.pid}] received proc_exit with signal=${n}, emitting to process`),this.pendingCallbacks.push({callback:()=>{let e=this._globals.process;if(e&&typeof e.emit==`function`){V.debug(`EventLoop[${this.pid}] emitting ${n} on process`);try{e.emit(n)}catch(e){if(e instanceof nr)throw e;V.error(`EventLoop[${this.pid}] error in signal handler:`,e)}}throw new nr(128+No(n),n)}}));return}default:V.trace(`EventLoop[${this.pid}] no handle mapping for event type: ${e.type}`);return}let n=this.handles.get(t);if(!n){V.trace(`EventLoop[${this.pid}] no handle registered for ${t} (event=${e.type})`);return}V.trace(`EventLoop[${this.pid}] queuing pending callback for ${t}`),this.pendingCallbacks.push({callback:()=>{try{n.callback(e)}catch(e){V.error(`EventLoop[${this.pid}] error in handle callback:`,e)}}})}computePollTimeout(){if(this.hasImmediateWork())return 0;let e=this.peekNextRefedTimer();if(e){let t=performance.now();return Math.max(0,e.expireAt-t)}return this.refCount>0?1/0:0}peekNextRefedTimer(){let e;for(let t of this.timerHeap)!t.cleared&&t.ref&&(!e||t.expireAt<e.expireAt)&&(e=t);return e}drainPhaseQueue(e,t){let n=t.length;n>0&&V.trace(`EventLoop[${this.pid}] draining ${e} queue (size=${n})`);for(let e=0;e<n;e++){let e=t.shift();e.cleared||this.callAndDrainNextTickAndMicrotaskQueues(e.callback,e.args)}}callAndDrainNextTickAndMicrotaskQueues(e,t){this.callAndRethrow(e,t),this.drainNextTickAndMicrotaskQueues()}callAndRethrow(e,t){try{t?e(...t):e()}catch(e){if(e instanceof nr)throw V.trace(`EventLoop[${this.pid}] process exited with code ${e.code}`),e;if(V.error(`EventLoop[${this.pid}] error in callback: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&e.stack)for(let t of e.stack.split(`
|
|
24
|
+
`))V.error(`EventLoop[${this.pid}] | ${t}`);let t=this._globals.process;if(t!=null&&t.emit&&(t.listenerCount?t.listenerCount(`uncaughtException`)>0:t.listeners&&t.listeners(`uncaughtException`).length>0)){t.emit(`uncaughtException`,e);return}throw new Wo(`Unhandled event loop error: ${e instanceof Error?e.message:String(e)}`,e)}}drainNextTickAndMicrotaskQueues(){var e;let t=0;for(;;){let e=this.drainQueue(this.nextTickQueue),n=this.drainQueue(this.nodeMicrotaskQueue);if(!e&&!n)break;t++,t>0&&t%1e3==0&&V.warn(`EventLoop[${this.pid}] drainNextTickAndMicrotaskQueues has run ${t} rounds — possible infinite nextTick/microtask loop (nextTick=${this.nextTickQueue.length} microtask=${this.nodeMicrotaskQueue.length})`)}(e=this._checkUnhandledRejections)==null||e.call(this)}drainQueue(e){let t=!1,n=0;for(;e.length>0;){t=!0;let r=e.shift();this.callAndRethrow(r),n++,n>0&&n%1e4==0&&V.warn(`EventLoop[${this.pid}] drainQueue: processed ${n} callbacks so far, queue still has ${e.length} items`)}return t}hasImmediateWork(){return this.nextTickQueue.length>0||this.nodeMicrotaskQueue.length>0||this.immediateQueue.length>0||this.pendingCallbacks.length>0||this.closeQueue.length>0||this.timersDueNow()}addTimer(e,t,n,...r){let i=this.nextTimerId++,a=performance.now()+t;V.trace(`EventLoop[${this.pid}] adding timer ${i} with delay ${t}ms and interval ${n}ms`);let o={id:i,callback:this.wrapWithContext(e,r),expireAt:a,delay:t,interval:n,ref:!0,cleared:!1,refresh:()=>{let e=performance.now();this.timerHeap.updateExpiry(i,e+t),this.wake.signal()}};return this.timerHeap.insert(o),V.trace(`EventLoop[${this.pid}] inserted timer ${i} into heap, size=${this.timerHeap.size}`),this.wake.signal(),new Go(i,o)}runTimers(){for(;this.timerHeap.size>0;){let e=this.peekNextActiveTimer();if(!e)return;let t=performance.now();if(e.expireAt>t)return;V.trace(`EventLoop[${this.pid}] running timer ${e.id} with delay ${t-e.expireAt}ms`),this.timerHeap.extractMin(),this.callAndDrainNextTickAndMicrotaskQueues(e.callback,e.args),e.interval&&e.interval>0&&!e.cleared?(e.expireAt=performance.now()+e.interval,e.id=this.nextTimerId++,this.timerHeap.insert(e)):e.cleared=!0}}peekNextActiveTimer(){for(;this.timerHeap.size>0;){let e=this.timerHeap.peek();if(!e)return;if(e.cleared)this.timerHeap.extractMin();else return e}}hasActiveTimers(){return this.timerHeap.countRefed()>0}timersDueNow(){let e=performance.now(),t=this.peekNextActiveTimer();return t?t.expireAt<=e:!1}}})),Qo=a({Duplex:()=>ls,PassThrough:()=>ds,Readable:()=>ss,Stream:()=>os,Transform:()=>us,Writable:()=>cs,default:()=>os,finished:()=>es,pipeline:()=>$o});function $o(...e){let t=e[e.length-1],n=typeof t==`function`,r=n?t:void 0,i=n?e.slice(0,-1):e;if(i.length<2){let e=Error(`pipeline requires at least 2 streams`);if(r){r(e);return}return Promise.reject(e)}let a=null,o=()=>{for(let t of i)if(`destroy`in t){var e;t.destroy((e=a)==null?void 0:e)}},s=i[0];for(let e=1;e<i.length;e++){let t=i[e];s.on(`error`,e=>{a=e instanceof Error?e:Error(String(e)),o()}),`pipe`in s&&s.pipe(t),s=t}let c=i[i.length-1];return r?(c.on(`finish`,()=>r(a)),c.on(`error`,e=>r(e instanceof Error?e:Error(String(e)))),c):new Promise((e,t)=>{c.on(`finish`,()=>a?t(a):e()),c.on(`error`,e=>t(e instanceof Error?e:Error(String(e))))})}function es(e,t){let n=null,r=()=>{t&&t(n)},i=()=>{t&&t(n)},a=e=>{n=e instanceof Error?e:Error(String(e)),t&&t(n)},o=()=>{t&&t(n)},s=()=>{e.removeListener(`end`,r),e.removeListener(`finish`,i),e.removeListener(`error`,a),e.removeListener(`close`,o)};return e.on(`end`,r),e.on(`finish`,i),e.on(`error`,a),e.on(`close`,o),t?s:new Promise((t,r)=>{let i=e=>{s(),e?r(e):t()};e.on(`end`,()=>i(n)),e.on(`finish`,()=>i(n)),e.on(`error`,e=>i(e instanceof Error?e:Error(String(e))))})}var ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs=i((()=>{A(),rn(),w(),Qe(),tt(),Ke(),uo(),ns=D(`stream`),rs=0,is=200,as=function(){this._events=new Map,this._maxListeners=10,this._emitDepth=new Map},as.prototype.on=function(e,t){let n=this._events.get(e);return n||(n=[],this._events.set(e,n)),n.push(t),this},as.prototype.once=function(e,t){let n=this,r=function(...i){n.off(e,r),t.call(n,...i)};return r.listener=t,this.on(e,r)},as.prototype.off=function(e,t){let n=this._events.get(e);if(n){let r=n.findIndex(e=>e===t||e.listener===t);r!==-1&&n.splice(r,1),n.length===0&&this._events.delete(e)}return this},as.prototype.removeListener=function(e,t){return this.off(e,t)},as.prototype.removeAllListeners=function(e){return e?this._events.delete(e):this._events.clear(),this},as.prototype.emit=function(e,...t){var n;rs++;let r=((n=this._emitDepth.get(e))==null?0:n)+1;if(this._emitDepth.set(e,r),rs>is)throw rs--,this._emitDepth.set(e,r-1),Error(`EventEmitter recursion detected: event="${e}", depth=${rs}`);try{let n=this._events.get(e);if(!n||n.length===0){if(e===`error`){let e=t[0];throw e instanceof Error?e:Error(`Unhandled stream error`)}return!1}for(let e of n.slice())e.call(this,...t);return!0}finally{rs--,this._emitDepth.set(e,r-1)}},as.prototype.listeners=function(e){let t=this._events.get(e);return t?t.map(e=>e.listener||e):[]},as.prototype.rawListeners=function(e){return[...this._events.get(e)||[]]},as.prototype.listenerCount=function(e){var t,n;return(t=(n=this._events.get(e))==null?void 0:n.length)==null?0:t},as.prototype.setMaxListeners=function(e){return this._maxListeners=e,this},as.prototype.getMaxListeners=function(){return this._maxListeners},as.prototype.addListener=function(e,t){return this.on(e,t)},as.prototype.prependListener=function(e,t){let n=this._events.get(e);return n||(n=[],this._events.set(e,n)),n.unshift(t),this},as.prototype.prependOnceListener=function(e,t){let n=this,r=function(...i){n.off(e,r),t.call(n,...i)};return r.listener=t,this.prependListener(e,r)},as.prototype.eventNames=function(){return Array.from(this._events.keys())},os=function(){as.call(this)},Object.defineProperty(os,`name`,{value:`Stream`}),Object.setPrototypeOf(os.prototype,as.prototype),os.prototype.constructor=os,os.prototype.pipe=function(e,t){let n=(t==null?void 0:t.end)!==!1;return this.on(`data`,t=>{e.write(t)}),this.on(`end`,()=>{n&&e.end()}),this.on(`error`,t=>{e.emit(`error`,t)}),e},ts=Symbol.asyncIterator,ss=class e extends os{constructor(e={}){var t,n,r;super(),C(this,`_buffer`,[]),C(this,`_bufferSize`,0),C(this,`_flowing`,null),C(this,`_ended`,!1),C(this,`_endEmitted`,!1),C(this,`_destroyed`,!1),C(this,`_reading`,!1),C(this,`readable`,!0),C(this,`readableHighWaterMark`,void 0),C(this,`readableObjectMode`,void 0),C(this,`readableEncoding`,void 0),this.readableObjectMode=(t=e.objectMode)==null?!1:t,this.readableHighWaterMark=(n=e.highWaterMark)==null?this.readableObjectMode?16:16384:n,this.readableEncoding=(r=e.encoding)==null?null:r,e.read&&(this._read=e.read.bind(this)),e.signal&&e.signal.addEventListener(`abort`,()=>this.destroy())}setEncoding(e){return this.readableEncoding=e,this}on(e,t){return super.on(e,t),e===`data`&&this._flowing===null&&this.resume(),this}_read(e){}push(e,t){if(this._destroyed)return!1;if(e===null)return this._ended=!0,this._maybeEmitEnd(),!1;let n=e;return typeof e==`string`&&!this.readableObjectMode&&(n=new TextEncoder().encode(e)),this._buffer.push(n),this._bufferSize+=this._getChunkSize(n),this._flowing?this._emitData():this.emit(`readable`),this._bufferSize<this.readableHighWaterMark}unshift(e){if(e==null)return;let t=e;typeof e==`string`&&!this.readableObjectMode&&(t=new TextEncoder().encode(e)),this._buffer.unshift(t),this._bufferSize+=this._getChunkSize(t)}read(e){if(this._buffer.length===0)return this._ended?(this._maybeEmitEnd(),null):(this._reading||(this._reading=!0,queueMicrotask(()=>{this._reading=!1,this._read(this.readableHighWaterMark)})),null);let t;return e===void 0||e>=this._bufferSize||this.readableObjectMode?(this._buffer.length===1||this.readableObjectMode?t=this._buffer.shift():(t=this._concatBuffers(),this._buffer=[]),this._bufferSize=0):t=this._readPartial(e),this._buffer.length===0&&this._ended&&this._maybeEmitEnd(),t}resume(){return this._destroyed?this:(this._flowing=!0,this._emitData(),this)}pause(){return this._flowing=!1,this}pipe(e,t){let n=(t==null?void 0:t.end)!==!1;return this.on(`data`,t=>{e.write(t)||(this.pause(),e.once(`drain`,()=>this.resume()))}),this.once(`end`,()=>{n&&e.end()}),this.once(`error`,t=>{e.destroy(t instanceof Error?t:Error(String(t)))}),this.resume(),e}unpipe(e){return this.pause(),this}destroy(e){return this._destroyed?this:(this._destroyed=!0,queueMicrotask(()=>{e&&this.emit(`error`,e),this.emit(`close`)}),this)}[ts](){var e=this;return $e(function*(){for(;!e._ended||e._buffer.length>0;){let t=e.read();t===null?e._ended||(yield Ze(new Promise(t=>{let n=()=>{e.off(`readable`,n),e.off(`end`,r),t()},r=()=>{e.off(`readable`,n),e.off(`end`,r),t()};e.once(`readable`,n),e.once(`end`,r)}))):yield t}})()}get readableEnded(){return this._endEmitted}get readableFlowing(){return this._flowing}get readableLength(){return this._bufferSize}get destroyed(){return this._destroyed}get _readableState(){return{endEmitted:this._endEmitted,ended:this._ended,destroyed:this._destroyed,flowing:this._flowing,length:this._bufferSize,pipes:null,pipesCount:0}}_emitData(){for(;this._flowing&&this._buffer.length>0;){let e=this._buffer.shift();this._bufferSize-=this._getChunkSize(e),this.emit(`data`,e)}this._flowing&&this._ended&&this._buffer.length===0&&this._maybeEmitEnd(),this._flowing&&this._bufferSize<this.readableHighWaterMark&&!this._ended&&!this._reading&&(this._reading=!0,queueMicrotask(()=>{this._reading=!1,this._read(this.readableHighWaterMark)}))}_maybeEmitEnd(){!this._endEmitted&&this._ended&&this._buffer.length===0&&(this._endEmitted=!0,queueMicrotask(()=>{this.emit(`end`),queueMicrotask(()=>{this._destroyed||this.emit(`close`)})}))}_getChunkSize(e){return this.readableObjectMode?1:e instanceof Uint8Array||typeof e==`string`?e.length:1}_concatBuffers(){let e=0;for(let t of this._buffer)t instanceof Uint8Array&&(e+=t.length);let t=new Uint8Array(e),n=0;for(let e of this._buffer)e instanceof Uint8Array&&(t.set(e,n),n+=e.length);return t}_readPartial(e){let t=this._buffer[0];if(!(t instanceof Uint8Array))return this._buffer.shift(),this._bufferSize-=this._getChunkSize(t),t;if(t.length<=e)return this._buffer.shift(),this._bufferSize-=t.length,t;let n=t.slice(0,e);return this._buffer[0]=t.slice(e),this._bufferSize-=e,n}static from(t,n){let r=new e(n),i,a=!1;Symbol.asyncIterator in t?(i=t[Symbol.asyncIterator](),a=!0):i=t[Symbol.iterator]();let o=!1,s=e=>{e.done?(o=!1,r.push(null)):r.push(e.value)?c():o=!1},c=function(){var e=T(function*(){if(a)try{s(yield i.next())}catch(e){o=!1,r.destroy(e instanceof Error?e:Error(String(e)))}else s(i.next())});return function(){return e.apply(this,arguments)}}();return r._read=()=>{o||(o=!0,c())},r}static fromWeb(t,n){let r=new e(B(B({},n),{},{read(){}})),i=t.getReader(),a=!1,o=function(){var e=T(function*(){if(!a){a=!0;try{for(;;){let{done:e,value:t}=yield i.read();if(e){r.push(null);break}r.push(t)||(yield new Promise(e=>{let t=r._read.bind(r);r._read=n=>{r._read=t,e(),t(n)}}))}}catch(e){r.destroy(e instanceof Error?e:Error(String(e)))}finally{a=!1}}});return function(){return e.apply(this,arguments)}}(),s=r._read.bind(r);return r._read=e=>{s(e),o().catch(()=>{})},r.on(`close`,()=>{i.cancel().catch(()=>{})}),r}static toWeb(e,t){return new ReadableStream({start(t){e.on(`data`,e=>{let n;n=e instanceof Uint8Array?e:typeof e==`string`?new TextEncoder().encode(e):j.isBuffer(e)?new Uint8Array(e):new TextEncoder().encode(JSON.stringify(e)),t.enqueue(n)}),e.on(`end`,()=>{t.close()}),e.on(`error`,e=>{t.error(e)})},cancel(t){e.destroy(t instanceof Error?t:Error(String(t)))}},t==null?void 0:t.strategy)}},cs=class e extends os{constructor(e={}){var t,n;super(),C(this,`_buffer`,[]),C(this,`_bufferSize`,0),C(this,`_writing`,!1),C(this,`_ending`,!1),C(this,`_ended`,!1),C(this,`_finished`,!1),C(this,`_destroyed`,!1),C(this,`_needDrain`,!1),C(this,`_corked`,0),C(this,`writable`,!0),C(this,`writableHighWaterMark`,void 0),C(this,`writableObjectMode`,void 0),this.writableObjectMode=(t=e.objectMode)==null?!1:t,this.writableHighWaterMark=(n=e.highWaterMark)==null?this.writableObjectMode?16:16384:n,e.write&&(this._write=e.write.bind(this)),e.writev&&(this._writev=e.writev.bind(this)),e.final&&(this._final=e.final.bind(this)),e.destroy&&(this._destroy=e.destroy.bind(this)),e.signal&&e.signal.addEventListener(`abort`,()=>this.destroy())}_write(e,t,n){n()}_final(e){e()}_destroy(e,t){t(e)}write(e,t,n){var r;if(this._destroyed||this._ended){let e=Error(`write after end`);return n&&queueMicrotask(()=>n(e)),this.emit(`error`,e),!1}let i=`utf8`,a;typeof t==`function`?a=t:(t&&(i=t),n&&(a=n));let o=(r=a)==null?(()=>{}):r,s=e;typeof e==`string`&&!this.writableObjectMode&&(s=new TextEncoder().encode(e));let c=this._getChunkSize(s);if(ns.trace(`Writable.write: size=${c} corked=${this._corked} writing=${this._writing} buffered=${this._buffer.length}`),this._corked>0)return this._buffer.push({chunk:s,encoding:i,callback:o}),this._bufferSize+=c,this._bufferSize<this.writableHighWaterMark;this._writing||this._buffer.length>0?(this._buffer.push({chunk:s,encoding:i,callback:o}),this._bufferSize+=c):this._doWrite(s,i,o);let l=this._bufferSize<this.writableHighWaterMark;return l||(this._needDrain=!0),l}end(e,t,n){var r;let i,a=`utf8`,o;typeof e==`function`?o=e:e==null?typeof t==`function`?o=t:n&&(o=n):(i=e,typeof t==`function`?o=t:(t&&(a=t),n&&(o=n)));let s=(r=o)==null?(()=>{}):r;if(this._ending||this._ended)return queueMicrotask(()=>s()),this;this._ending=!0;let c=()=>{this._ended=!0,this._final(e=>{if(e){queueMicrotask(()=>{this.emit(`error`,e),s(e)});return}this._finished=!0,queueMicrotask(()=>{this.emit(`finish`),s(),queueMicrotask(()=>{this._destroyed||this.emit(`close`)})})})};return i===void 0?this._buffer.length===0&&!this._writing?c():this.once(`_bufferEmpty`,c):this.write(i,a,e=>{if(e){s(e);return}this._buffer.length===0&&!this._writing?c():this.once(`_bufferEmpty`,c)}),this}cork(){this._corked++}uncork(){this._corked>0&&this._corked--,this._corked===0&&this._buffer.length>0&&(ns.trace(`Writable.uncork: flushing ${this._buffer.length} buffered writes`),this._flushBuffer())}destroy(e){return this._destroyed?this:(this._destroyed=!0,this._destroy(e==null?null:e,t=>{t?this.emit(`error`,t):e&&this.emit(`error`,e),this.emit(`close`)}),this)}setDefaultEncoding(e){return this}get writableEnded(){return this._ended}get writableFinished(){return this._finished}get writableLength(){return this._bufferSize}get writableCorked(){return this._corked}get destroyed(){return this._destroyed}get _writableState(){return{finished:this._finished,errorEmitted:!1,length:this._bufferSize,ended:this._ended,destroyed:this._destroyed}}_doWrite(e,t,n){this._writing=!0,this._write(e,t,e=>{if(this._writing=!1,e){n(e),this._destroyed||this.emit(`error`,e);return}n(),!this._destroyed&&(this._buffer.length>0?this._flushBuffer():(this.emit(`_bufferEmpty`),this._needDrain&&(this._needDrain=!1,this.emit(`drain`))))})}_flushBuffer(){if(this._writing||this._buffer.length===0)return;let e=this._buffer.shift();this._bufferSize-=this._getChunkSize(e.chunk),this._doWrite(e.chunk,e.encoding,e.callback)}_getChunkSize(e){return this.writableObjectMode?1:e instanceof Uint8Array||typeof e==`string`?e.length:1}static fromWeb(t,n){let r=t.getWriter();return new e(B(B({},n),{},{write(e,t,n){return T(function*(){let t;t=e instanceof Uint8Array?e:typeof e==`string`?new TextEncoder().encode(e):j.isBuffer(e)?new Uint8Array(e):new TextEncoder().encode(JSON.stringify(e));try{yield r.write(t),n()}catch(e){n(e instanceof Error?e:Error(String(e)))}})()},final(e){return T(function*(){try{yield r.close(),e()}catch(t){e(t instanceof Error?t:Error(String(t)))}})()},destroy(e,t){return T(function*(){try{yield r.abort(e==null?void 0:e.message)}catch(e){}t(e)})()}}))}static toWeb(e,t){return new WritableStream({write(t){return new Promise((n,r)=>{e.write(t,e=>{e?r(e):n()})||e.once(`drain`,()=>n())})},close(){return new Promise((t,n)=>{e.end(e=>{e?n(e):t()})})},abort(t){e.destroy(t instanceof Error?t:Error(String(t)))}},t==null?void 0:t.strategy)}},ls=class extends ss{constructor(e={}){var t,n;super(e),C(this,`_writableBuffer`,[]),C(this,`_writableBufferSize`,0),C(this,`_writableWriting`,!1),C(this,`_writableEnding`,!1),C(this,`_writableEnded`,!1),C(this,`_writableFinished`,!1),C(this,`_writableNeedDrain`,!1),C(this,`_writableCorked`,0),C(this,`writable`,!0),C(this,`writableHighWaterMark`,void 0),C(this,`writableObjectMode`,void 0),this.writableObjectMode=(t=e.objectMode)==null?!1:t,this.writableHighWaterMark=(n=e.highWaterMark)==null?this.writableObjectMode?16:16384:n,e.write&&(this._write=e.write.bind(this)),e.final&&(this._final=e.final.bind(this))}_write(e,t,n){n()}_final(e){e()}write(e,t,n){var r;let i=`utf8`,a;typeof t==`function`?a=t:(t&&(i=t),n&&(a=n));let o=(r=a)==null?(()=>{}):r,s=e;typeof e==`string`&&!this.writableObjectMode&&(s=new TextEncoder().encode(e));let c=this._getWritableChunkSize(s);if(this._writableCorked>0)return this._writableBuffer.push({chunk:s,encoding:i,callback:o}),this._writableBufferSize+=c,this._writableBufferSize<this.writableHighWaterMark;this._writableWriting||this._writableBuffer.length>0?(this._writableBuffer.push({chunk:s,encoding:i,callback:o}),this._writableBufferSize+=c):this._doWritableWrite(s,i,o);let l=this._writableBufferSize<this.writableHighWaterMark;return l||(this._writableNeedDrain=!0),l}end(e,t,n){var r;let i,a;typeof e==`function`?a=e:(e==null||(i=e),typeof t==`function`?a=t:n&&(a=n));let o=(r=a)==null?(()=>{}):r;this._writableEnding=!0;let s=()=>{this._writableEnded=!0,this._final(e=>{if(e){queueMicrotask(()=>{this.emit(`error`,e),o(e)});return}this._writableFinished=!0,queueMicrotask(()=>{this.emit(`finish`),o()})})};return i===void 0?this._writableBuffer.length===0&&s():this.write(i,void 0,()=>{this._writableBuffer.length===0&&s()}),this}get writableEnded(){return this._writableEnded}get writableFinished(){return this._writableFinished}get writableLength(){return this._writableBufferSize}cork(){this._writableCorked++}uncork(){this._writableCorked>0&&this._writableCorked--,this._writableCorked===0&&this._writableBuffer.length>0&&this._flushWritableBuffer()}get writableCorked(){return this._writableCorked}_flushWritableBuffer(){for(;this._writableBuffer.length>0&&!this._writableWriting;){let e=this._writableBuffer.shift();this._writableBufferSize-=this._getWritableChunkSize(e.chunk),this._doWritableWrite(e.chunk,e.encoding,e.callback)}}_doWritableWrite(e,t,n){this._writableWriting=!0,this._write(e,t,e=>{if(this._writableWriting=!1,n(e==null?void 0:e),this._writableBuffer.length>0){let e=this._writableBuffer.shift();this._writableBufferSize-=this._getWritableChunkSize(e.chunk),this._doWritableWrite(e.chunk,e.encoding,e.callback)}else this._writableNeedDrain&&(this._writableNeedDrain=!1,this.emit(`drain`))})}_getWritableChunkSize(e){return this.writableObjectMode?1:e instanceof Uint8Array||typeof e==`string`?e.length:1}},us=class extends ls{constructor(e={}){super(e),e.transform&&(this._transform=e.transform.bind(this)),e.flush&&(this._flush=e.flush.bind(this)),this._write=(e,t,n)=>{this._transform(e,t,(e,t)=>{if(e){n(e);return}t!==void 0&&this.push(t),n()})},this._final=e=>{this._flush((t,n)=>{if(t){e(t);return}n!==void 0&&this.push(n),this.push(null),e()})}}_transform(e,t,n){n(null,e)}_flush(e){e()}},ds=class extends us{constructor(e){super(e)}},Object.assign(os,{Stream:os,Readable:ss,Writable:cs,Duplex:ls,Transform:us,PassThrough:ds,pipeline:$o,finished:es})})),ps=a({Server:()=>bs,Socket:()=>ys,connect:()=>xs,createConnection:()=>hs,createServer:()=>ms,default:()=>Ss,isIP:()=>vs,isIPv4:()=>gs,isIPv6:()=>_s});function ms(e,t){return new bs(e,t)}function hs(e,t){return new ys().connect(e,t)}function gs(e){let t=e.split(`.`);if(t.length!==4)return!1;for(let e of t){let t=parseInt(e,10);if(isNaN(t)||t<0||t>255||e!==String(t))return!1}return!0}function _s(e){return/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/.test(e)||/^::$/.test(e)||/^(([0-9a-fA-F]{1,4}:)*):([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4}$/.test(e)}function vs(e){return gs(e)?4:_s(e)?6:0}var ys,bs,xs,Ss,Cs=i((()=>{fs(),rn(),kt(),Zo(),A(),w(),uo(),ys=class e extends ls{constructor(e={}){var t;super(),C(this,`_connId`,null),C(this,`_connecting`,!1),C(this,`_connected`,!1),C(this,`_allowHalfOpen`,void 0),C(this,`_localAddress`,void 0),C(this,`_localPort`,void 0),C(this,`_remoteAddress`,void 0),C(this,`_remotePort`,void 0),C(this,`_remoteFamily`,void 0),C(this,`_timeout`,0),C(this,`_timeoutTimer`,null),C(this,`_noDelay`,!1),C(this,`_keepAlive`,!1),C(this,`_keepAliveInitialDelay`,0),C(this,`_eventLoop`,null),C(this,`bytesRead`,0),C(this,`bytesWritten`,0),this._allowHalfOpen=(t=e.allowHalfOpen)==null?!1:t,e.fd!==void 0&&(this._connId=e.fd,this._connected=!0,this._setupEventHandlers())}static fromConnectionId(t,n={}){return new e(B(B({},n),{},{fd:t}))}connect(e,t,n){var r;let i,a;return typeof e==`number`?(i={port:e,host:typeof t==`string`?t:`localhost`},a=typeof t==`function`?t:n):(i=e,a=typeof t==`function`?t:n),a&&this.once(`connect`,a),this._connecting||this._connected?this:(this._connecting=!0,this._remotePort=i.port,this._remoteAddress=(r=i.host)==null?`localhost`:r,zt.debug(`Connecting to ${i.host}:${i.port}`),queueMicrotask(()=>{try{let e=process.pid,t=H(e).getEventQueueId();if(t==null)throw Error(`Process event loop has no kernel event queue`);let n=E(`net_connect`,{port:i.port,eq_id:t});zt.debug(`Connected, conn_id=${n.conn_id}`),this._connId=n.conn_id,this._connected=!0,this._connecting=!1,this._setupEventHandlers(),this.emit(`connect`),this.emit(`ready`)}catch(e){zt.debug(`Connection error:`,e instanceof Error?e.message:String(e)),this._connecting=!1,this.emit(`error`,e)}}),this)}_setConnectionId(e){this._connId=e,this._connected=!0,this._connecting=!1,this._setupEventHandlers(),queueMicrotask(()=>{this.emit(`connect`),this.emit(`ready`)})}_read(e){if(!(!this._connId||!this._connected))try{let t=E(`net_conn_read`,{conn_id:this._connId,max_bytes:e||16384});if(t.bytes.length>0){let e=j.from(t.bytes);this.bytesRead+=e.length,this._resetTimeout(),this.push(e)}}catch(e){let t=e;t.code===`ECONNRESET`?this.push(null):this.destroy(t)}}_write(e,t,n){if(!this._connId||!this._connected){n(Error(`Socket is not connected`));return}try{let t=typeof e==`string`?new TextEncoder().encode(e):e instanceof Uint8Array?e:new Uint8Array(e);zt.trace(`Socket._write: conn_id=${this._connId} bytes=${t.length}`),E(`net_conn_write`,{conn_id:this._connId,bytes:t}),this.bytesWritten+=t.length,this._resetTimeout(),n()}catch(e){n(e instanceof Error?e:Error(String(e)))}}_final(e){if(!this._allowHalfOpen&&this._connId){e(),queueMicrotask(()=>this.destroy());return}e()}_destroy(e,t){if(this._cleanupEventHandlers(),this._clearTimeout(),this._connId){try{E(`net_conn_close`,{conn_id:this._connId})}catch(e){}this._connId=null}this._connected=!1,t(e)}destroy(e){return this.destroyed?this:(this._destroy(e==null?null:e,t=>{queueMicrotask(()=>{(t||e)&&this.emit(`error`,t==null?e:t),this.emit(`close`,!!(t||e))})}),this._destroyed=!0,this)}end(e,t,n){return typeof e==`function`?super.end(e):typeof t==`function`?super.end(e,t):super.end(e,t,n),this}setTimeout(e,t){return this._timeout=e,t&&this.once(`timeout`,t),e===0?this._clearTimeout():this._resetTimeout(),this}setNoDelay(e=!0){return this._noDelay=e,this}setKeepAlive(e=!1,t=0){return this._keepAlive=e,this._keepAliveInitialDelay=t,this}address(){var e,t;return this._connected?{port:(e=this._localPort)==null?0:e,family:`IPv4`,address:(t=this._localAddress)==null?`0.0.0.0`:t}:null}ref(){return this}unref(){return this}get connId(){return this._connId}get connecting(){return this._connecting}get localAddress(){return this._localAddress}get localPort(){return this._localPort}get localFamily(){return`IPv4`}get remoteAddress(){return this._remoteAddress}get remotePort(){return this._remotePort}get remoteFamily(){var e;return(e=this._remoteFamily)==null?`IPv4`:e}get pending(){return this._connecting}get readyState(){return this._connecting?`opening`:this._connected?`open`:this.writableEnded?`writeOnly`:this.readableEnded?`readOnly`:`closed`}_setLocalAddress(e,t){this._localAddress=e,this._localPort=t}_setRemoteAddress(e,t,n=`IPv4`){this._remoteAddress=e,this._remotePort=t,this._remoteFamily=n}_setupEventHandlers(){if(!this._connId)return;let e=process.pid;this._eventLoop=H(e);let t=e=>{if(e.type!==`net_readable`)return;let{conn_id:t}=e;t===this._connId&&this._read(16384)},n=e=>{if(e.type!==`net_closed`)return;let{conn_id:t}=e;t===this._connId&&(this._connected=!1,this.destroy())};this._eventLoop.registerConnection(this._connId,e=>{switch(e.type){case`net_readable`:t(e);break;case`net_closed`:n(e);break;default:break}}),this._handlers={readable:t,closed:n}}_cleanupEventHandlers(){this._handlers&&this._eventLoop&&this._connId&&this._eventLoop.unregisterConnection(this._connId)}_resetTimeout(){this._timeout>0&&(this._clearTimeout(),this._timeoutTimer=setTimeout(()=>{this.emit(`timeout`)},this._timeout))}_clearTimeout(){this._timeoutTimer&&(clearTimeout(this._timeoutTimer),this._timeoutTimer=null)}},bs=class{constructor(e,t){var n,r;C(this,`_serverId`,null),C(this,`_port`,null),C(this,`_host`,null),C(this,`_listening`,!1),C(this,`_events`,new Map),C(this,`_connections`,new Set),C(this,`_maxConnections`,void 0),C(this,`_allowHalfOpen`,void 0),C(this,`_pauseOnConnect`,void 0),C(this,`_eventLoop`,null),C(this,`_handleAccept`,e=>{var t,n;if(e.type!==`net_accept`)return;let{server_id:r,conn_id:i,meta:a}=e;if(r!==this._serverId)return;if(this._maxConnections&&this._connections.size>=this._maxConnections){try{E(`net_conn_close`,{conn_id:i})}catch(e){}return}let o=ys.fromConnectionId(i,{allowHalfOpen:this._allowHalfOpen});if(o._setLocalAddress((t=this._host)==null?`0.0.0.0`:t,(n=this._port)==null?0:n),a.client_addr){var s;o._setRemoteAddress(a.client_addr,(s=a.client_port)==null?0:s)}this._connections.add(o),o.on(`close`,()=>{this._connections.delete(o)}),this._pauseOnConnect&&o.pause(),this.emit(`connection`,o)}),typeof e==`function`&&(t=e,e=void 0),this._allowHalfOpen=(n=e==null?void 0:e.allowHalfOpen)==null?!1:n,this._pauseOnConnect=(r=e==null?void 0:e.pauseOnConnect)==null?!1:r,t&&this.on(`connection`,t)}on(e,t){let n=this._events.get(e);return n||(n=new Set,this._events.set(e,n)),n.add(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.call(this,...r)};return this.on(e,n)}off(e,t){let n=this._events.get(e);return n&&n.delete(t),this}emit(e,...t){let n=this._events.get(e);if(!n||n.size===0)return!1;for(let e of n)e.call(this,...t);return!0}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}listen(e,t,n,r){let i,a=`0.0.0.0`;if(typeof t==`function`?i=t:(typeof t==`string`&&(a=t),typeof n==`function`?i=n:r&&(i=r)),this._listening)throw Error(`Server is already listening`);let o=process.pid;this._eventLoop=H(o);let s=this._eventLoop.getEventQueueId();if(s==null)throw Error(`Process event loop has no kernel event queue`);try{this._serverId=E(`net_listen`,{port:e,eq_id:s}).server_id,this._port=e,this._host=a,this._listening=!0,this._eventLoop&&this._serverId!==null&&this._eventLoop.registerServer(this._serverId,this._handleAccept),queueMicrotask(()=>{this.emit(`listening`),i&&i()})}catch(e){queueMicrotask(()=>{this.emit(`error`,e)})}return this}close(e){if(!this._listening)return e&&queueMicrotask(()=>e(Error(`Server is not running`))),this;this._eventLoop&&this._serverId!==null&&this._eventLoop.unregisterServer(this._serverId);for(let e of this._connections)e.destroy();return this._connections.clear(),this._listening=!1,this._serverId=null,this._port=null,queueMicrotask(()=>{this.emit(`close`),e&&e()}),this}address(){var e;return!this._listening||this._port===null?null:{port:this._port,family:`IPv4`,address:(e=this._host)==null?`0.0.0.0`:e}}getConnections(e){queueMicrotask(()=>e(null,this._connections.size))}ref(){return this}unref(){return this}get listening(){return this._listening}get maxConnections(){return this._maxConnections}set maxConnections(e){this._maxConnections=e}},xs=hs,Ss={Socket:ys,Server:bs,createServer:ms,createConnection:hs,connect:xs,isIP:vs,isIPv4:gs,isIPv6:_s}})),ws=a({Agent:()=>qs,ClientRequest:()=>Vs,IncomingMessage:()=>Rs,METHODS:()=>Hs,STATUS_CODES:()=>Us,Server:()=>Bs,ServerResponse:()=>zs,_cleanupServersForPid:()=>Ms,_getServer:()=>Ns,_registerServer:()=>As,_unregisterServer:()=>js,createServer:()=>Ds,default:()=>Ys,get:()=>Es,getListeningPorts:()=>Fs,globalAgent:()=>Js,isListening:()=>Ps,onPortEvent:()=>Os,request:()=>Ts,substrateFetch:()=>Is});function Ts(e,t,n){let r,i;if(typeof e==`string`||e instanceof URL){let a=typeof e==`string`?new URL(e):e;typeof t==`function`?(i=t,r={protocol:a.protocol,hostname:a.hostname,port:a.port||void 0,path:a.pathname+a.search}):(i=n,r=B({protocol:a.protocol,hostname:a.hostname,port:a.port||void 0,path:a.pathname+a.search},t))}else r=e,i=t;return new Vs(r,i)}function Es(e,t,n){let r=Ts(e,t,n);return r.end(),r}function Ds(e,t){return new Bs(e,t)}function Os(e){return Ks.add(e),()=>Ks.delete(e)}function ks(e,t,n){for(let r of Ks)try{r(e,t,n)}catch(e){}}function As(e,t,n,r){Ws.set(e,{serverId:t,server:n,pid:r});let i=Gs.get(r);i||(i=new Set,Gs.set(r,i)),i.add(e),ks(`listen`,e)}function js(e){let t=Ws.get(e);if(t){let n=Gs.get(t.pid);n&&(n.delete(e),n.size===0&&Gs.delete(t.pid))}Ws.delete(e),ks(`close`,e)}function Ms(e){let t=Gs.get(e);if(!(!t||t.size===0)){k.debug(`Cleaning up ${t.size} server(s) for exiting process ${e}`);for(let n of t)Ws.get(n)&&(k.debug(`Unregistering server on port ${n} (pid=${e})`),Ws.delete(n),ks(`close`,n));Gs.delete(e)}}function Ns(e){return Ws.get(e)}function Ps(e){return Ws.has(e)}function Fs(){return Array.from(Ws.keys())}function Is(e,t){return Ls.apply(this,arguments)}function Ls(){return Ls=T(function*(e,t){let n=new Request(e,t),r=new URL(n.url),i=r.hostname===`localhost`||r.hostname===`127.0.0.1`,a=parseInt(r.port)||(r.protocol===`https:`?443:80);if(k.debug(`substrateFetch: url=${r.href} isLocalhost=${i} port=${a} hasServer=${Ws.has(a)}`),!i)return k.debug(`substrateFetch: passing to real fetch`),fetch(n);if(!Ws.has(a))throw k.debug(`substrateFetch: no virtual server on port ${a}, refusing connection`),TypeError(`fetch failed: connect ECONNREFUSED 127.0.0.1:${a}`);let{serverId:o}=Ws.get(a);k.debug(`substrateFetch: routing to virtual server serverId=${o}`);let s=yt(),{eq_id:c}=E(`eq_create`,{});try{var l;let e;if(n.body){let t=yield n.arrayBuffer();e=new Uint8Array(t)}let t=Math.floor(Math.random()*2147483647),i=[];n.headers.forEach((e,t)=>i.push([t,e])),e&&!i.some(([e])=>e.toLowerCase()===`content-length`)&&i.push([`content-length`,String(e.length)]),k.debug(`substrateFetch: delivering NetAccept to kernel connId=${t} driverEqId=${c}`),s.deliver({type:`net_accept`,server_id:o,conn_id:t,meta:{protocol:`http`,method:n.method,url:r.pathname+r.search,headers:i},initial_bytes:e,driver_eq_id:c});let a=new Uint8Array,u=!1,d=200,f=null,p=-1,m=new Uint8Array,h=()=>{try{let e=E(`net_conn_drain_outbound`,{conn_id:t,max_bytes:65536});return e.bytes&&e.bytes.length>0?e.bytes:null}catch(e){return null}},g=(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},_=new Uint8Array([13,10,13,10]),v=e=>{for(let t=0;t<=e.length-4;t++)if(e[t]===_[0]&&e[t+1]===_[1]&&e[t+2]===_[2]&&e[t+3]===_[3])return t;return-1},y=e=>{var t;let n=new TextDecoder().decode(e).split(`\r
|
|
25
|
+
`),r=(t=n[0])==null?void 0:t.match(/HTTP\/[\d.]+\s+(\d+)/);r&&(d=parseInt(r[1],10)),f=new Headers;for(let e=1;e<n.length;e++){let t=n[e];if(!t)continue;let r=t.indexOf(`:`);if(r!==-1){let e=t.slice(0,r).trim(),n=t.slice(r+1).trim();f.append(e,n)}}let i=f.get(`content-length`);i&&(p=parseInt(i,10)),u=!0,k.debug(`substrateFetch: headers parsed, status=${d}, contentLength=${p}`)},b=e=>{if(u)m=g(m,e);else{a=g(a,e);let t=v(a);if(t>=0){y(a.slice(0,t));let e=a.slice(t+4);e.length>0&&(m=g(m,e)),a=new Uint8Array}}},ee=()=>u&&p>=0&&m.length>=p,te=()=>{let e;for(;(e=h())!==null;)b(e)},ne=Bn(`fetch:${t}`);Hn(ne);try{let e=Date.now()+3e4,t=!1;for(;!t;){let n=e-Date.now();if(n<=0)throw Error(`substrateFetch: request timeout (30s)`);yield ne.wait(n);let{events:r}=E(`eq_poll`,{eq_id:c,max:100});for(let e of r)if(e.type===`net_outbound_writable`){if(te(),ee()){t=!0;break}}else if(e.type===`net_closed`){te(),t=!0;break}}}finally{Un(ne)}return k.debug(`substrateFetch: completing response status=${d} bodyLen=${m.length}`),new Response(m.length>0?new Uint8Array(m):null,{status:d,headers:(l=f)==null?void 0:l})}finally{E(`eq_close`,{eq_id:c})}}),Ls.apply(this,arguments)}var Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs=i((()=>{fs(),Cs(),Qn(),kt(),Gn(),rn(),A(),Zo(),w(),Ke(),uo(),Rs=class extends ss{constructor(e,t){super(t),C(this,`httpVersion`,`1.1`),C(this,`httpVersionMajor`,1),C(this,`httpVersionMinor`,1),C(this,`headers`,{}),C(this,`rawHeaders`,[]),C(this,`trailers`,{}),C(this,`rawTrailers`,[]),C(this,`method`,void 0),C(this,`url`,void 0),C(this,`statusCode`,void 0),C(this,`statusMessage`,void 0),C(this,`socket`,void 0),C(this,`complete`,!1),C(this,`aborted`,!1),this.socket=e,this.on(`end`,()=>{k.debug(`IncomingMessage: 'end' event fired, setting complete=true`),this.complete=!0})}_setHeaders(e){for(let[t,n]of e){let e=t.toLowerCase();this.rawHeaders.push(t,n);let r=this.headers[e];r===void 0?this.headers[e]=n:Array.isArray(r)?r.push(n):this.headers[e]=[r,n]}}_pushFromKernel(e){return this.push(e===null?null:j.from(e))}_read(e){}},zs=class extends cs{constructor(e,t,n){super(n),C(this,`statusCode`,200),C(this,`statusMessage`,`OK`),C(this,`_headers`,new Map),C(this,`_headersSent`,!1),C(this,`_connId`,void 0),C(this,`req`,void 0),C(this,`socket`,void 0),this._connId=e,this.req=t,this.socket=t.socket}get headersSent(){return this._headersSent}setHeader(e,t){if(this._headersSent)throw Error(`Cannot set headers after they are sent`);return this._headers.set(e.toLowerCase(),t),this}getHeader(e){return this._headers.get(e.toLowerCase())}getHeaderNames(){return Array.from(this._headers.keys())}getHeaders(){let e={};for(let[t,n]of this._headers)e[t]=n;return e}hasHeader(e){return this._headers.has(e.toLowerCase())}removeHeader(e){if(this._headersSent)throw Error(`Cannot remove headers after they are sent`);this._headers.delete(e.toLowerCase())}writeHead(e,t,n){if(this._headersSent)throw Error(`Cannot call writeHead after headers are sent`);if(this.statusCode=e,typeof t==`string`){if(this.statusMessage=t,n)for(let[e,t]of Object.entries(n))t!==void 0&&this._headers.set(e.toLowerCase(),t)}else if(t)for(let[e,n]of Object.entries(t))n!==void 0&&this._headers.set(e.toLowerCase(),n);return this}flushHeaders(){this._sendHeaders()}_sendHeaders(){if(this._headersSent)return;this._headersSent=!0;let e=`HTTP/1.1 ${this.statusCode} ${this.statusMessage}\r\n`;this._headers.has(`date`)||this._headers.set(`date`,new Date().toUTCString());for(let[t,n]of this._headers)if(Array.isArray(n))for(let r of n)e+=`${t}: ${r}\r\n`;else e+=`${t}: ${n}\r\n`;e+=`\r
|
|
26
|
+
`;try{let t=new TextEncoder().encode(e);E(`net_conn_write`,{conn_id:this._connId,bytes:t})}catch(e){let t=e instanceof Error?e:Error(String(e));if(t.code===`ECONNRESET`)return;this.emit(`error`,t)}}_write(e,t,n){try{this._sendHeaders();let t;if(e instanceof Uint8Array)t=e;else if(typeof e==`string`)t=new TextEncoder().encode(e);else{n(Error(`Invalid chunk type`));return}E(`net_conn_write`,{conn_id:this._connId,bytes:t}),n()}catch(e){let t=e instanceof Error?e:Error(String(e));if(t.code===`ECONNRESET`){n();return}n(t)}}_final(e){try{this._sendHeaders(),E(`net_conn_close`,{conn_id:this._connId}),this.socket.destroy(),e()}catch(t){let n=t instanceof Error?t:Error(String(t));if(n.code===`ECONNRESET`){e();return}e(n)}}},Bs=class{constructor(e,t){C(this,`_serverId`,null),C(this,`_port`,null),C(this,`_listening`,!1),C(this,`_events`,new Map),C(this,`_requestListener`,null),C(this,`IncomingMessage`,Rs),C(this,`ServerResponse`,zs),C(this,`_eventLoop`,null),C(this,`keepAliveTimeout`,5e3),C(this,`headersTimeout`,6e4),C(this,`requestTimeout`,0),C(this,`maxHeadersCount`,2e3),C(this,`maxRequestsPerSocket`,0),C(this,`_handleNetAccept`,e=>{var t,n,r,i;if(e.type!==`net_accept`)return;let{server_id:a,conn_id:o,meta:s,initial_bytes:c}=e;if(a!==this._serverId)return;if(s.protocol===`tcp`||!s.method&&!s.url&&!s.headers){this._handleRawTcpConnection(o);return}let l=ys.fromConnectionId(o);l._setLocalAddress(`0.0.0.0`,(t=this._port)==null?0:t);let u=new this.IncomingMessage(l);u.method=(n=s.method)==null?`GET`:n,u.url=(r=s.url)==null?`/`:r,s.headers&&u._setHeaders(s.headers);let d=u.headers.upgrade,f=u.headers.connection;if(typeof d==`string`&&d.toLowerCase()===`websocket`&&typeof f==`string`&&f.toLowerCase().includes(`upgrade`)){let e=new Uint8Array;this.emit(`upgrade`,u,l,e);return}let p=new this.ServerResponse(o,u),m=u.headers[`content-length`],h=typeof m==`string`?parseInt(m,10):0,g=0,_=!1,v=![`GET`,`HEAD`,`DELETE`,`OPTIONS`,`TRACE`].includes((i=u.method)==null?`GET`:i)&&h>0,y=()=>{_||(_=!0,queueMicrotask(()=>{u._pushFromKernel(null)}))},b=e=>{_||(g+=e.length,u._pushFromKernel(e),v&&g>=h&&y())};if(c&&c.length>0&&b(new Uint8Array(c)),v&&!_){let e=t=>{b(t instanceof Uint8Array?t:j.from(t)),_&&l.off(`data`,e)};l.on(`data`,e),l.resume()}v||y(),this._safeEmitRequest(u,p)}),typeof e==`function`&&(t=e,e=void 0),e!=null&&e.IncomingMessage&&(this.IncomingMessage=e.IncomingMessage),e!=null&&e.ServerResponse&&(this.ServerResponse=e.ServerResponse),t&&(this._requestListener=t,this.on(`request`,t))}on(e,t){let n=this._events.get(e);return n||(n=new Set,this._events.set(e,n)),n.add(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.call(this,...r)};return this.on(e,n)}off(e,t){let n=this._events.get(e);return n&&n.delete(t),this}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}prependListener(e,t){let n=this._events.get(e);n||(n=new Set,this._events.set(e,n));let r=Array.from(n);return r.unshift(t),this._events.set(e,new Set(r)),this}prependOnceListener(e,t){let n=(...r)=>{this.off(e,n),t.call(this,...r)};return this.prependListener(e,n)}removeAllListeners(e){return e?this._events.delete(e):this._events.clear(),this}listeners(e){let t=this._events.get(e);return t?Array.from(t):[]}listenerCount(e){let t=this._events.get(e);return t?t.size:0}emit(e,...t){let n=this._events.get(e);if(!n||n.size===0)return!1;for(let e of n)e.call(this,...t);return!0}_safeEmitRequest(e,t){let n=this._events.get(`request`);if(!n||n.size===0){t.headersSent||(t.writeHead(404,{"Content-Type":`text/plain`}),t.end(`Not Found`));return}for(let r of n)try{r(e,t)}catch(e){k.error(`Error in request handler:`,e instanceof Error?e.message:String(e)),t.headersSent?t.writableEnded||t.end():(t.writeHead(500,{"Content-Type":`text/plain`}),t.end(`Internal Server Error`));return}}get listening(){return this._listening}setTimeout(e,t){return t&&this.on(`timeout`,t),this}setMaxListeners(e){return this}getMaxListeners(){return 10}ref(){return this}unref(){return this}eventNames(){return Array.from(this._events.keys())}rawListeners(e){return this.listeners(e)}listen(e,t,n){var r;let i,a;if(typeof e==`object`&&e){var o;i=(o=e.port)==null?0:o,a=typeof t==`function`?t:n}else i=e,a=typeof t==`function`?t:n;if(k.debug(`Server.listen() called with port=${i}`),this._listening)throw Error(`Server is already listening`);let s=process.pid;this._eventLoop=H(s);let c=(r=this._eventLoop)==null?void 0:r.getEventQueueId();if(c==null)throw Error(`Process event loop has no kernel event queue`);try{k.debug(`Calling net_listen syscall with eq_id=${c}...`);let e=E(`net_listen`,{port:i,eq_id:c});k.debug(`net_listen syscall returned: server_id=${e.server_id}`),this._serverId=e.server_id,this._port=i,this._listening=!0,k.debug(`Server listening on port ${i}, registering...`),As(i,this._serverId,this,s),this._eventLoop&&this._serverId!==null&&(this._eventLoop.registerServer(this._serverId,e=>{k.debug(`NetAccept event for server ${this._serverId}, processing...`),this._handleNetAccept(e)}),k.debug(`Registered server handle ${this._serverId} with event loop`)),this._eventLoop.queuePending(()=>{this.emit(`listening`),a&&a()})}catch(e){k.error(`Server.listen() error:`,e.message),this._eventLoop.queuePending(()=>{this.emit(`error`,e)})}return this}_handleRawTcpConnection(e){var t;let n=ys.fromConnectionId(e);n._setLocalAddress(`0.0.0.0`,(t=this._port)==null?0:t);let r=``,i=!1,a=`GET`,o=`/`,s=[],c=()=>{let e=r.indexOf(`\r
|
|
27
|
+
\r
|
|
28
|
+
`);if(e===-1)return!1;let t=r.slice(0,e);r=r.slice(e+4);let n=t.split(`\r
|
|
29
|
+
`),i=(n[0]||``).split(` `);a=i[0]||`GET`,o=i[1]||`/`;for(let e=1;e<n.length;e++){let t=n[e],r=t.indexOf(`:`);if(r>0){let e=t.slice(0,r).trim(),n=t.slice(r+1).trim();s.push([e,n])}}return!0},l=t=>{let u=typeof t==`string`?t:new TextDecoder().decode(t);if(r+=u,!i&&c()){var d,f;i=!0,n.off(`data`,l);let t=(d=s.find(([e])=>e.toLowerCase()===`upgrade`))==null?void 0:d[1],c=(f=s.find(([e])=>e.toLowerCase()===`connection`))==null?void 0:f[1];if((t==null?void 0:t.toLowerCase())===`websocket`&&c!=null&&c.toLowerCase().includes(`upgrade`)){let e=new this.IncomingMessage(n);e.method=a,e.url=o,e._setHeaders(s);let t=new TextEncoder().encode(r);this.emit(`upgrade`,e,n,t)}else{var p;let t=new this.IncomingMessage(n);t.method=a,t.url=o,t._setHeaders(s);let i=new this.ServerResponse(e,t);r.length>0&&t._pushFromKernel(new TextEncoder().encode(r));let c=(p=s.find(([e])=>e.toLowerCase()===`content-length`))==null?void 0:p[1],l=c?parseInt(c,10):0;([`GET`,`HEAD`,`DELETE`,`OPTIONS`,`TRACE`].includes(a)||r.length>=l)&&queueMicrotask(()=>t._pushFromKernel(null)),this._safeEmitRequest(t,i)}}};n.on(`data`,l);let u=setInterval(()=>{if(i){clearInterval(u);return}try{let t=E(`net_conn_read`,{conn_id:e,max_bytes:16384});t.bytes.length>0&&l(new Uint8Array(t.bytes))}catch(e){clearInterval(u)}},10);setTimeout(()=>{i||(clearInterval(u),n.destroy())},3e4)}close(e){var t;if(!this._listening){if(e){var n;((n=this._eventLoop)==null?H(process.pid):n).queuePending(()=>e(Error(`Server is not listening`)))}return this}let r=(t=this._eventLoop)==null?H(process.pid):t;try{this._port!==null&&js(this._port),this._eventLoop&&this._serverId!==null&&(this._eventLoop.unregisterServer(this._serverId),k.debug(`Unregistered server handle ${this._serverId} from event loop`)),this._eventLoop=null,this._listening=!1,this._serverId=null,this._port=null,r.queueClose(()=>{this.emit(`close`),e&&e()})}catch(t){e&&r.queuePending(()=>e(t instanceof Error?t:Error(String(t))))}return this}address(){return!this._listening||this._port===null?null:{port:this._port,family:`IPv4`,address:`0.0.0.0`}}},Vs=class extends cs{constructor(e,t){var n,r,i,a,o;super(),C(this,`method`,void 0),C(this,`path`,void 0),C(this,`host`,void 0),C(this,`protocol`,void 0),C(this,`_headers`,new Map),C(this,`_bodyChunks`,[]),C(this,`_sent`,!1),C(this,`_aborted`,!1),C(this,`_timeoutId`,void 0),C(this,`_responseCallback`,void 0),C(this,`_eventLoop`,null);let s;if(typeof e==`string`){let t=new URL(e);s={protocol:t.protocol,hostname:t.hostname,port:t.port,path:t.pathname+t.search,method:`GET`}}else s=e instanceof URL?{protocol:e.protocol,hostname:e.hostname,port:e.port,path:e.pathname+e.search,method:`GET`}:e;this.method=((n=s.method)==null?`GET`:n).toUpperCase(),this.path=(r=s.path)==null?`/`:r,this.host=(i=(a=s.hostname)==null?s.host:a)==null?`localhost`:i,this.protocol=(o=s.protocol)==null?`http:`:o;let c=s.port?String(s.port):this.protocol===`https:`?`443`:`80`;if(c!==`80`&&c!==`443`&&(this.host=`${this.host}:${c}`),k.trace(`ClientRequest: ${this.method} ${this.path} ${this.host} ${this.protocol}`),s.headers)for(let[e,t]of Object.entries(s.headers))t!==void 0&&this._headers.set(e.toLowerCase(),String(t));t&&(this._responseCallback=t,this.once(`response`,e=>t(e))),s.timeout&&(this._timeoutId=setTimeout(()=>{this.destroy(Error(`Request timeout`))},s.timeout));try{let e=globalThis.process.pid;this._eventLoop=H(e)}catch(e){this._eventLoop=null}}setHeader(e,t){return Array.isArray(t)?this._headers.set(e.toLowerCase(),t.join(`, `)):this._headers.set(e.toLowerCase(),String(t)),this}getHeader(e){return this._headers.get(e.toLowerCase())}removeHeader(e){this._headers.delete(e.toLowerCase())}getHeaders(){let e={};for(let[t,n]of this._headers)e[t]=n;return e}setTimeout(e,t){return this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=void 0),e>0&&(this._timeoutId=setTimeout(()=>{this.emit(`timeout`),t&&t()},e)),t&&e>0&&this.once(`timeout`,t),this}abort(){this._aborted=!0,this._timeoutId&&clearTimeout(this._timeoutId),this.destroy(Error(`Request aborted`))}_write(e,t,n){if(this._sent){n(Error(`Request already sent`));return}let r=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e);this._bodyChunks.push(r),n()}_final(e){if(this._sent||this._aborted){e();return}this._sent=!0,this._sendRequest().then(()=>e()).catch(t=>e(t))}end(e,t,n){return typeof e==`function`?(n=e,e=void 0,t=void 0):typeof t==`function`&&(n=t,t=void 0),e!=null&&(t===void 0?this.write(e):this.write(e,t)),super.end(n),this}_sendRequest(){var e=this;return T(function*(){var t;if(e._aborted)return;let n=e._headers.get(`connection`),r=e._headers.get(`upgrade`);if(typeof n==`string`&&n.toLowerCase().includes(`upgrade`)&&typeof r==`string`)return e._sendUpgradeRequest();let i=()=>{e._eventLoop&&(e._eventLoop.unref(),e._eventLoop=null)};(t=e._eventLoop)==null||t.ref(),e._timeoutId&&clearTimeout(e._timeoutId);let a=`${e.protocol}//${e.host}${e.path}`,o=new Headers;for(let[t,n]of e._headers)o.set(t,n);let s;if(e._bodyChunks.length>0){let t=e._bodyChunks.reduce((e,t)=>e+t.length,0);s=new Uint8Array(t);let n=0;for(let t of e._bodyChunks)s.set(t,n),n+=t.length}try{k.debug(`ClientRequest._sendRequest: ${e.method} ${a}`);let t=new ys;e.emit(`socket`,t),k.debug(`ClientRequest: calling fetch(${a})`);let n=yield fetch(a,{method:e.method,headers:o,body:s&&e.method!==`GET`&&e.method!==`HEAD`?s:void 0});k.debug(`ClientRequest: fetch returned ${n.status} ${n.statusText} for ${a}`);let r=new ys;r.authorized=a.startsWith(`https:`);let c=new Rs(r);if(c.statusCode=n.status,c.statusMessage=n.statusText||Us[n.status]||``,n.headers.forEach((e,t)=>{c.headers[t.toLowerCase()]=e,c.rawHeaders.push(t,e)}),k.debug(`ClientRequest: emitting 'response' event`),e.emit(`response`,c),n.body){k.debug(`ClientRequest[${a}]: streaming response body`);let e=ss.fromWeb(n.body);e.on(`data`,e=>{e instanceof Uint8Array||typeof e==`string`?c.push(j.from(e)):j.isBuffer(e)&&c.push(e)}),e.on(`end`,()=>{c.push(null),i()}),e.on(`error`,e=>{k.error(`ClientRequest[${a}]: stream error`,e),c.destroy(e instanceof Error?e:Error(String(e))),i()})}else k.debug(`ClientRequest[${a}]: no body, ending immediately`),c.push(null),i()}catch(t){i();let n=t,r=(n==null?void 0:n.message)||String(t);if(k.error(`ClientRequest: fetch FAILED ${e.method} ${a}: ${r}`),r.includes(`Failed to fetch`)||r.includes(`NetworkError`)||r.includes(`CORS`)){let t=Error(`Network request to ${a} failed. This is likely a CORS error - browser security prevents direct requests to external APIs. Consider using a CORS proxy or running npm install server-side.`);t.code=`ENETWORK`,e.emit(`error`,t)}else e.emit(`error`,t)}})()}_sendUpgradeRequest(){var e=this;return T(function*(){var t;let n=()=>{e._eventLoop&&(e._eventLoop.unref(),e._eventLoop=null)};(t=e._eventLoop)==null||t.ref(),e._timeoutId&&clearTimeout(e._timeoutId);let r=e.host.lastIndexOf(`:`),i,a;r>0?(i=e.host.slice(0,r),a=parseInt(e.host.slice(r+1),10)):(i=e.host,a=e.protocol===`https:`?443:80),k.debug(`ClientRequest._sendUpgradeRequest: ${e.method} ${e.path} → ${i}:${a}`);try{let t=new ys;e.emit(`socket`,t),t.on(`error`,t=>{k.error(`ClientRequest upgrade socket error:`,t.message),e.emit(`error`,t),n()});let r=j.alloc(0),o=!1,s=i=>{var a;if(o)return;let c=j.isBuffer(i)?i:j.from(i);r=j.concat([r,c]);let l=r.indexOf(`\r
|
|
30
|
+
\r
|
|
31
|
+
`);if(l===-1)return;o=!0,t.removeListener(`data`,s);let u=r.slice(0,l).toString(`utf8`),d=r.slice(l+4),f=u.split(`\r
|
|
32
|
+
`),p=(f[0]||``).match(/^HTTP\/\d\.\d (\d+)(?: (.*))?/),m=p?parseInt(p[1],10):0,h=(a=p==null?void 0:p[2])==null?``:a,g=new Rs(new ys);g.statusCode=m,g.statusMessage=h;for(let e=1;e<f.length;e++){let t=f[e],n=t.indexOf(`:`);if(n>0){let e=t.slice(0,n).trim(),r=t.slice(n+1).trim();g.headers[e.toLowerCase()]=r,g.rawHeaders.push(e,r)}}m===101?(k.debug(`ClientRequest: upgrade 101, emitting 'upgrade' event`),e.emit(`upgrade`,g,t,d),n()):(k.debug(`ClientRequest: upgrade failed ${m}, emitting 'response'`),e.emit(`response`,g),d.length>0&&g.push(d),t.on(`data`,(e=>{g.push(j.isBuffer(e)?e:j.from(e))})),t.on(`end`,(()=>{g.push(null),n()})))};t.on(`data`,s),t.on(`connect`,()=>{k.debug(`ClientRequest: upgrade socket connected, writing HTTP request`);let n=[`${e.method} ${e.path} HTTP/1.1`];e._headers.has(`host`)||n.push(`host: ${e.host}`);for(let[t,r]of e._headers)n.push(`${t}: ${r}`);n.push(``,``),t.write(n.join(`\r
|
|
33
|
+
`));for(let n of e._bodyChunks)t.write(j.from(n))}),t.connect(a,i)}catch(t){n(),e.emit(`error`,t)}})()}},Hs=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),Us={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,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:`Too Early`,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`},Ws=new Map,Gs=new Map,Ks=new Set,qs=class extends M{constructor(e){var t,n,r,i,a,o;super(),C(this,`maxSockets`,void 0),C(this,`maxTotalSockets`,void 0),C(this,`maxFreeSockets`,void 0),C(this,`keepAliveMsecs`,void 0),C(this,`keepAlive`,void 0),C(this,`scheduling`,void 0),C(this,`options`,void 0),C(this,`requests`,void 0),C(this,`sockets`,void 0),C(this,`freeSockets`,void 0),this.options=e==null?{}:e,this.keepAlive=(t=e==null?void 0:e.keepAlive)==null?!1:t,this.keepAliveMsecs=(n=e==null?void 0:e.keepAliveMsecs)==null?1e3:n,this.maxSockets=(r=e==null?void 0:e.maxSockets)==null?1/0:r,this.maxTotalSockets=(i=e==null?void 0:e.maxTotalSockets)==null?1/0:i,this.maxFreeSockets=(a=e==null?void 0:e.maxFreeSockets)==null?256:a,this.scheduling=(o=e==null?void 0:e.scheduling)==null?`lifo`:o,this.requests={},this.sockets={},this.freeSockets={}}createConnection(e,t){let n=new ys;return t&&queueMicrotask(()=>t(null,n)),n}getName(e){return`${e.host||`localhost`}:${e.port||80}:${e.localAddress||``}`}addRequest(e,t,n,r){}destroy(){}},Js=new qs({keepAlive:!1}),Ys={createServer:Ds,Server:Bs,IncomingMessage:Rs,ServerResponse:zs,ClientRequest:Vs,request:Ts,get:Es,METHODS:Hs,STATUS_CODES:Us,substrateFetch:Is,isListening:Ps,getListeningPorts:Fs,Agent:qs,globalAgent:Js}}));function Zs(){return ec||(ec=new $s),ec}var Qs,$s,ec,tc=i((()=>{A(),ir(),Xs(),w(),Ke(),Qs=D(`process-scheduler`),$s=class{constructor(){C(this,`processes`,new Map),C(this,`pumping`,!1)}register(e,t,n){if(Qs.debug(`Registering process ${e} with scheduler`),this.processes.has(e)){Qs.warn(`Process ${e} already registered with scheduler`);return}this.processes.set(e,{pid:e,eventLoop:t,onExit:n,started:!1}),this.ensurePumping()}startProcess(e,t){let n=this.processes.get(e);if(!n){Qs.warn(`Cannot start process ${e} - not registered`);return}if(n.started){Qs.warn(`Process ${e} already started`);return}n.started=!0,Qs.debug(`Starting process ${e}`);let{eventLoop:r}=n;r.ref();try{t()}catch(t){Qs.error(`Process ${e} script threw: ${t instanceof Error?t.message:String(t)}`),r.unref();let n=t instanceof nr?t.code:1;this.handleProcessExit(e,n,null);return}r.unref(),r.start().then(()=>{Qs.debug(`Process ${e} event loop completed normally`),this.handleProcessExit(e,0,null)}).catch(t=>{t instanceof nr?(Qs.debug(`Process ${e} called exit(${t.code})${t.signal?` signal=${t.signal}`:``}`),this.handleProcessExit(e,t.code,t.signal)):(Qs.error(`Process ${e} event loop error:`,t),this.handleProcessExit(e,1,null))})}unregister(e){this.processes.get(e)&&(Qs.debug(`Unregistering process ${e}`),this.processes.delete(e))}isRegistered(e){return this.processes.has(e)}get activeCount(){return this.processes.size}handleProcessExit(e,t,n){let r=this.processes.get(e);if(!r){Qs.trace(`Process ${e} already unregistered, skipping exit handling`);return}Qs.debug(`Process ${e} exiting with code ${t}`),this.processes.delete(e),Ms(e);try{r.onExit(t,n)}catch(t){Qs.error(`Process ${e} onExit callback threw:`,t)}}ensurePumping(){this.pumping||(this.pumping=!0,Qs.debug(`Starting scheduler pump loop`),this.pumpLoop().catch(e=>{Qs.error(`Scheduler pump loop error:`,e)}))}pumpLoop(){var e=this;return T(function*(){for(;e.processes.size>0;)yield new Promise(e=>setTimeout(e,10));Qs.debug(`Scheduler pump loop ending - no active processes`),e.pumping=!1})()}reset(){Qs.debug(`Resetting scheduler`),this.processes.clear(),this.pumping=!1}},ec=null}));function nc(e){oc=e}function rc(){if(!oc)throw Error(`Process manager not initialized`);return oc}var ic,ac,oc,sc=i((()=>{Jt(),Zo(),tc(),A(),w(),ic=D(`process-manager`),ac=class{constructor(e){C(this,`processes`,new Map),C(this,`kernel`,void 0),C(this,`rootProcess`,null),this.kernel=e}createRootProcess(e){if(this.rootProcess!==null)throw Error(`Root process already exists`);ic.debug(`Creating root process`);let t=new qt(1,{command:`init`,ppid:0,cwd:e.cwd,env:e.env,argv:e.argv,kernel:this.kernel});return this.processes.set(1,t),this.rootProcess=t,ic.debug(`Root process created with PID 1`),t}getRootProcess(){if(!this.rootProcess)throw Error(`The root process has not been created yet, run createRootProcess() first`);return this.rootProcess}createChildContext(e,t){if(!this.processes.get(t.ppid))throw Error(`Parent process ${t.ppid} not found`);if(this.processes.has(e))throw Error(`Process ${e} already has a context`);let n=new qt(e,t);return this.processes.set(e,n),ic.debug(`Child process created with PID ${e}`),n}getProcess(e){return this.processes.get(e)}hasProcess(e){return this.processes.has(e)}getAllProcesses(){return Array.from(this.processes.values())}getKernelBridge(){return this.kernel}},oc=null}));function cc(e,t,n=0){let r=JSON.parse(t),i=dc+n,a=r.mappings;i>0&&(a=`;`.repeat(i)+a),uc.set(e,{sources:r.sources,decodedMappings:Ya(a)})}function lc(e,t,n){let r=uc.get(e);if(!r)return null;let i=t-1,a=n-1,o=r.decodedMappings[i];if(!o||o.length===0)return null;let s=0,c=o.length-1;for(;s<c;){let e=s+c+1>>>1;o[e][0]<=a?s=e:c=e-1}let l=o[s];if(l.length<4)return null;let u=l[1],d=l[2],f=l[3],p=r.sources[u];return p===void 0?null:{source:p,line:d+1,column:f+1}}var uc,dc,fc=i((()=>{co(),uc=new Map,dc=2}));function pc(e){var t,n;return(t=(n=e.getScriptNameOrSourceURL)==null?void 0:n.call(e))==null?e.getFileName():t}function mc(e){let t=pc(e),n=e.getFunctionName();return!!(!(t!=null&&t.startsWith(`substrate://`))||n&&yc.has(n)||n&&bc.has(n)||n&&xc.has(n))}function hc(e){let t=e.trim();if(!t.startsWith(`at `))return!1;if(t.includes(`http://`)||t.includes(`https://`)||t.includes(`wasm://`)||t.includes(`wasm-function`))return!0;for(let e of yc)if(t.includes(`at ${e} `)||t.includes(`at ${e}(`))return!0;if(t.includes(`at c (substrate://`)||t.includes(`at d (substrate://`))return!0;for(let e of xc)if(t.includes(`at ${e} `)||t.includes(`at ${e}(`))return!0;return!1}function gc(e){let t=pc(e),n=e.getLineNumber(),r=e.getColumnNumber(),i;if(t!=null&&t.startsWith(`substrate://`)&&n!=null&&r!=null){let e=lc(t,n,r);if(e)i=`${e.source}:${e.line}:${e.column}`;else return null}else i=t?n==null?t:`${t}:${n}:${r==null?0:r}`:e.toString();let a=e.getFunctionName()||e.getMethodName(),o=e.getTypeName(),s;return s=a?o&&o!==`Object`&&o!==`global`?`${o}.${a}`:a:o?o+`.<anonymous>`:`<anonymous>`,e.isConstructor()?` at new ${s} (${i})`:` at ${s} (${i})`}function _c(){let e=Error;Sc=e.prepareStackTrace,e.stackTraceLimit!==void 0&&e.stackTraceLimit<30&&(e.stackTraceLimit=30),e.prepareStackTrace=(e,t)=>{if(Cc){let n=[`${e.name||`Error`}: ${e.message}`];for(let e of t)n.push(` at ${e.toString()}`);return n.join(`
|
|
34
|
+
`)}Cc=!0;try{if(!t.some(e=>{let t=pc(e);return t==null?void 0:t.startsWith(`substrate://`)})){if(Sc)return Sc(e,t);let n=[`${e.name||`Error`}: ${e.message}`];for(let e of t)n.push(` at ${e.toString()}`);return n.join(`
|
|
35
|
+
`)}let n=[`${e.name||`Error`}: ${e.message}`];for(let e of t){if(mc(e))continue;let t=gc(e);t&&n.push(t)}let r=e.__asyncStack;if(r){n.push(` --- async ---`);let e=r.split(`
|
|
36
|
+
`).slice(1);for(let t of e)!hc(t)&&t.trim().startsWith(`at `)&&n.push(t)}return n.join(`
|
|
37
|
+
`)}finally{Cc=!1}}}function vc(){typeof Error.captureStackTrace!=`function`&&(Error.captureStackTrace=function(e,t){let n=Error();Object.defineProperty(e,`stack`,{configurable:!0,enumerable:!1,get(){return n.stack}})})}var yc,bc,xc,Sc,Cc,wc=i((()=>{fc(),yc=new Set([`__async`,`__asyncGen`]),bc=new Set([`c`,`d`]),xc=new Set([`callAndRethrow`,`callAndDrainNextTickAndMicrotaskQueues`,`drainQueue`,`runCallbacks`,`pumpLoop`,`runWithGlobals`,`_runHandler`,`_enqueueHandler`,`drainNextTickAndMicrotaskQueues`]),Cc=!1}));function Tc(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=-1,r=!0;for(let t=e.length-1;t>=1;t--)if(e.charCodeAt(t)===47){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`/`:e.slice(0,n)}function Ec(e,t){let n=0,r=e.length,i=!0;for(let t=e.length-1;t>=0;t--)if(e.charCodeAt(t)===47){if(!i){n=t+1;break}}else i&&(i=!1,r=t+1);let a=e.slice(n,r);return t&&a.endsWith(t)?a.slice(0,a.length-t.length):a}function Dc(e){let t=-1,n=0,r=e.length,i=!0,a=0;for(let o=e.length-1;o>=0;o--){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}i&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)}function Oc(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47,r=e.split(`/`),i=[];for(let e of r)e===``||e===`.`||(e===`..`?i.length>0&&i[i.length-1]!==`..`?i.pop():t||i.push(`..`):i.push(e));let a=i.join(`/`);return t&&(a=`/`+a),n&&a.length>1&&(a+=`/`),a||(t?`/`:`.`)}function kc(...e){if(e.length===0)return`.`;let t=``;for(let n of e)n.length>0&&(t.length===0?t=n:t+=`/`+n);return Oc(t)}function Ac(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.length!==0&&(t=r+(t.length>0?`/`+t:``),r.charCodeAt(0)===47))break}return(t.length===0||t.charCodeAt(0)!==47)&&(t=`/`+t),Oc(t)}function jc(e){return e.length>0&&e.charCodeAt(0)===47}var Mc=i((()=>{})),Nc=a({basename:()=>zc,default:()=>pl,delimiter:()=>rl,dirname:()=>Rc,extname:()=>Bc,format:()=>Hc,isAbsolute:()=>Lc,join:()=>Fc,normalize:()=>Pc,parse:()=>Vc,posix:()=>il,relative:()=>Uc,resolve:()=>Ic,sep:()=>nl,win32:()=>fl});function Pc(e){return Oc(e)}function Fc(...e){return kc(...e)}function Ic(...e){return Ac(globalThis.process!==void 0&&typeof globalThis.process.cwd==`function`?globalThis.process.cwd():`/`,...e)}function Lc(e){return jc(e)}function Rc(e){return Tc(e)}function zc(e,t){return Ec(e,t)}function Bc(e){return Dc(e)}function Vc(e){let t=Lc(e)?`/`:``,n=Rc(e),r=zc(e),i=Bc(e);return{root:t,dir:n,base:r,ext:i,name:r.slice(0,r.length-i.length)}}function Hc(e){let t=e.dir||e.root||``,n=e.base||(e.name||``)+(e.ext||``);return t?t===e.root?t+n:t+`/`+n:n}function Uc(e,t){if(e===t||(e=Ic(e),t=Ic(t),e===t))return``;let n=e.slice(1).split(`/`).filter(Boolean),r=t.slice(1).split(`/`).filter(Boolean),i=0,a=Math.min(n.length,r.length);for(let e=0;e<a&&n[e]===r[e];e++)i++;let o=n.length-i,s=[];for(let e=0;e<o;e++)s.push(`..`);for(let e=i;e<r.length;e++)s.push(r[e]);return s.join(`/`)||`.`}function Wc(e){return e>=cl&&e<=ll||e>=ul&&e<=dl}function U(e){return e===al||e===ol}function Gc(e){let t=e.length;if(t===0)return!1;let n=e.charCodeAt(0);return!!(U(n)||Wc(n)&&t>2&&e.charCodeAt(1)===sl&&U(e.charCodeAt(2)))}function Kc(e){if(e.length===0)return`.`;let t=e.length,n=0,r=``,i=!1,a=e.charCodeAt(0);if(t===1)return U(a)?`\\`:e;if(U(a))if(i=!0,U(e.charCodeAt(1))){let i=2,a=i;for(;i<t&&!U(e.charCodeAt(i));)i++;if(i<t&&i!==a){let o=e.slice(a,i);for(a=i;i<t&&U(e.charCodeAt(i));)i++;if(i<t&&i!==a){for(a=i;i<t&&!U(e.charCodeAt(i));)i++;(i===t||i!==a)&&(r=`\\\\`+o+`\\`+e.slice(a,i),n=i)}}}else n=1;else Wc(a)&&e.charCodeAt(1)===sl&&(r=e.slice(0,2),n=2,t>2&&U(e.charCodeAt(2))&&(i=!0,n=3));let o=n<t?qc(e.slice(n),!i):``;return o.length===0&&!i&&(o=`.`),o.length>0&&U(e.charCodeAt(t-1))&&(o+=`\\`),r.length>0?i?r+`\\`+o:r+o:i?`\\`+o:o}function qc(e,t){let n=``,r=0,i=-1,a=0,o=0;for(let s=0;s<=e.length;s++){if(s<e.length)o=e.charCodeAt(s);else if(U(o))break;else o=al;if(U(o)){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`\\`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`\\`)),i=s,a=0;continue}else if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`\\..`:`..`,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 Jc(...e){if(e.length===0)return`.`;let t=``,n;for(let r of e)r.length>0&&(t.length===0?t=n=r:t+=`\\`+r);if(t.length===0)return`.`;let r=!0,i=0;if(n!==void 0&&U(n.charCodeAt(0))&&(i++,n.length>1&&U(n.charCodeAt(1))&&(i++,n.length>2&&U(n.charCodeAt(2))?i++:r=!1)),r){for(;i<t.length&&U(t.charCodeAt(i));)i++;i>=2&&(t=`\\`+t.slice(i))}return Kc(t)}function Yc(...e){let t=``,n=``,r=!1;for(let i=e.length-1;i>=-1;i--){let a;if(i>=0){if(a=e[i],a.length===0)continue}else a=t.length===0?`C:\\`:t+`\\`;let o=a.length,s=0,c=``,l=!1,u=a.charCodeAt(0);if(o===1)U(u)&&(s=1,l=!0);else if(U(u))if(l=!0,U(a.charCodeAt(1))){let e=2,t=e;for(;e<o&&!U(a.charCodeAt(e));)e++;if(e<o&&e!==t){let n=a.slice(t,e);for(t=e;e<o&&U(a.charCodeAt(e));)e++;if(e<o&&e!==t){for(t=e;e<o&&!U(a.charCodeAt(e));)e++;(e===o||e!==t)&&(c=`\\\\`+n+`\\`+a.slice(t,e),s=e)}}}else s=1;else Wc(u)&&a.charCodeAt(1)===sl&&(c=a.slice(0,2),s=2,o>2&&U(a.charCodeAt(2))&&(l=!0,s=3));if(c.length>0)if(t.length>0){if(c.toLowerCase()!==t.toLowerCase())continue}else t=c;if(r){if(t.length>0)break}else if(n=a.slice(s)+`\\`+n,r=l,l&&t.length>0)break}return n=qc(n,!r),r?t+`\\`+n:t+n||`.`}function Xc(e){let t=e.length;if(t===0)return`.`;let n=-1,r=0,i=e.charCodeAt(0);if(t===1)return U(i)?e:`.`;if(U(i)){if(n=r=1,U(e.charCodeAt(1))){let i=2,a=i;for(;i<t&&!U(e.charCodeAt(i));)i++;if(i<t&&i!==a){for(a=i;i<t&&U(e.charCodeAt(i));)i++;if(i<t&&i!==a){for(a=i;i<t&&!U(e.charCodeAt(i));)i++;if(i===t)return e;i!==a&&(n=r=i+1)}}}}else Wc(i)&&e.charCodeAt(1)===sl&&(n=t>2&&U(e.charCodeAt(2))?3:2,r=n);let a=-1,o=!0;for(let n=t-1;n>=r;n--)if(U(e.charCodeAt(n))){if(!o){a=n;break}}else o=!1;if(a===-1){if(n===-1)return`.`;a=n}return e.slice(0,a)}function Zc(e,t){let n=0,r=-1,i=!0;e.length>=2&&Wc(e.charCodeAt(0))&&e.charCodeAt(1)===sl&&(n=2);for(let t=e.length-1;t>=n;t--)if(U(e.charCodeAt(t))){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);if(r===-1)return``;let a=e.slice(n,r);return t&&a.endsWith(t)?a.slice(0,a.length-t.length):a}function Qc(e){let t=0,n=-1,r=0,i=-1,a=!0,o=0;e.length>=2&&e.charCodeAt(1)===sl&&Wc(e.charCodeAt(0))&&(t=r=2);for(let s=e.length-1;s>=t;s--){let t=e.charCodeAt(s);if(U(t)){if(!a){r=s+1;break}continue}i===-1&&(a=!1,i=s+1),t===46?n===-1?n=s:o!==1&&(o=1):n!==-1&&(o=-1)}return n===-1||i===-1||o===0||o===1&&n===i-1&&n===r+1?``:e.slice(n,i)}function $c(e){let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.length,r=0,i=e.charCodeAt(0);if(n===1)return U(i)?(t.root=t.dir=e,t):(t.base=t.name=e,t);if(U(i)){if(r=1,U(e.charCodeAt(1))){let t=2,i=t;for(;t<n&&!U(e.charCodeAt(t));)t++;if(t<n&&t!==i){for(i=t;t<n&&U(e.charCodeAt(t));)t++;if(t<n&&t!==i){for(i=t;t<n&&!U(e.charCodeAt(t));)t++;t===n?r=t:t!==i&&(r=t+1)}}}}else if(Wc(i)&&e.charCodeAt(1)===sl){if(n<=2)return t.root=t.dir=e,t;if(r=2,U(e.charCodeAt(2))){if(n===3)return t.root=t.dir=e,t;r=3}}r>0&&(t.root=e.slice(0,r));let a=-1,o=r,s=-1,c=!0,l=e.length-1,u=0;for(;l>=r;l--){if(i=e.charCodeAt(l),U(i)){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),i===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return s!==-1&&(a===-1||u===0||u===1&&a===s-1&&a===o+1?t.base=t.name=e.slice(o,s):(t.name=e.slice(o,a),t.base=e.slice(o,s),t.ext=e.slice(a,s))),o>0&&o!==r?t.dir=e.slice(0,o-1):t.dir=t.root,t}function el(e){let t=e.dir||e.root||``,n=e.base||(e.name||``)+(e.ext||``);return t?t===e.root?t+n:t+`\\`+n:n}function tl(e,t){if(e===t)return``;let n=Yc(e),r=Yc(t);if(n===r)return``;let i=n.toLowerCase(),a=r.toLowerCase();if(i===a)return``;let o=0;for(;o<n.length&&n.charCodeAt(o)===ol;)o++;let s=n.length;for(;s-1>o&&n.charCodeAt(s-1)===ol;)s--;let c=s-o,l=0;for(;l<r.length&&r.charCodeAt(l)===ol;)l++;let u=r.length;for(;u-1>l&&r.charCodeAt(u-1)===ol;)u--;let d=u-l,f=c<d?c:d,p=-1,m=0;for(;m<f;m++){let e=i.charCodeAt(o+m);if(e!==a.charCodeAt(l+m))break;e===ol&&(p=m)}if(m!==f){if(p===-1)return r}else{if(d>f){if(r.charCodeAt(l+m)===ol)return r.slice(l+m+1);if(m===2)return r.slice(l+m)}c>f&&(n.charCodeAt(o+m)===ol?p=m:m===2&&(p=3)),p===-1&&(p=0)}let h=``;for(m=o+p+1;m<=s;m++)(m===s||n.charCodeAt(m)===ol)&&(h+=h.length===0?`..`:`\\..`);return l+=p,h.length>0?h+r.slice(l,u):(r.charCodeAt(l)===ol&&l++,r.slice(l,u))}var nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml=i((()=>{Mc(),nl=`/`,rl=`:`,il={sep:nl,delimiter:rl,normalize:Pc,join:Fc,resolve:Ic,isAbsolute:Lc,dirname:Rc,basename:zc,extname:Bc,parse:Vc,format:Hc,relative:Uc},al=47,ol=92,sl=58,cl=65,ll=90,ul=97,dl=122,fl={sep:`\\`,delimiter:`;`,normalize:Kc,join:Jc,resolve:Yc,isAbsolute:Gc,dirname:Xc,basename:Zc,extname:Qc,parse:$c,format:el,relative:tl},pl={sep:nl,delimiter:rl,normalize:Pc,join:Fc,resolve:Ic,isAbsolute:Lc,dirname:Rc,basename:zc,extname:Bc,parse:Vc,format:Hc,relative:Uc,posix:il,win32:fl}})),hl=a({access:()=>Pl,appendFile:()=>jl,chmod:()=>Ll,close:()=>Kl,disableVfsTracking:()=>wl,enableVfsTracking:()=>Cl,exists:()=>W,fchmod:()=>Rl,fstat:()=>Xl,fsync:()=>$l,getVfsStats:()=>El,link:()=>Vl,lstat:()=>Nl,mkdir:()=>Il,open:()=>Gl,read:()=>ql,readFile:()=>Ol,readdir:()=>Fl,readlink:()=>Ul,realpath:()=>Wl,rename:()=>Bl,resetVfsStats:()=>Dl,setNativeBindingWriteHook:()=>gl,stat:()=>Ml,symlink:()=>Hl,trackVfsWrite:()=>Tl,truncate:()=>Yl,unlink:()=>zl,unwatch:()=>Ql,watch:()=>Zl,write:()=>Jl,writeAt:()=>Al,writeFile:()=>kl});function gl(e){tu=e,eu.trace(`Native binding write hook ${e?`enabled`:`disabled`}`)}function _l(e){tu&&e.includes(`/node_modules/`)&&tu(e)}function vl(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function yl(e,t){iu.set(e,t)}function bl(e){return iu.get(e)}function xl(e){iu.delete(e)}function Sl(){return globalThis.__SUBSTRATE_TRACK_VFS_SIZE===!0}function Cl(){globalThis.__SUBSTRATE_TRACK_VFS_SIZE=!0}function wl(){globalThis.__SUBSTRATE_TRACK_VFS_SIZE=!1}function Tl(e,t){if(!Sl())return;nu+=t;let n=t>100*1024,r=Math.floor(nu/(1024*1024))>Math.floor((nu-t)/(1024*1024));if(n)ru.push({path:e,size:t}),typeof self<`u`&&typeof self.postMessage==`function`&&self.postMessage({type:`log`,level:`info`,args:[`[VFS] 📦 ${e} (${vl(t)}) | Total: ${vl(nu)}`]});else if(r&&typeof self<`u`&&typeof self.postMessage==`function`){let e=``;try{let{getWasmMemoryInfo:t}=(_j(),s(RA));e=` | ${t()}`}catch(e){}self.postMessage({type:`log`,level:`info`,args:[`[VFS] 📊 Milestone: ${vl(nu)} total (${ru.length} files)${e}`]})}}function El(){return{totalBytesWritten:nu,largeFiles:[...ru]}}function Dl(){nu=0,ru.length=0}function Ol(e){eu.trace(`fs.readFile: ${e}`);let t=St();return t?t.readFile(e):E(`fs_read_file`,{path:e}).bytes}function kl(e,t,n){eu.trace(`fs.writeFile: ${e}`),Tl(e,t.length);let r=St();r&&n===void 0?(r.writeFile(e,t,3),Ct()):E(`fs_write_file`,B({path:e,bytes:t,create:!0,truncate:!0},n===void 0?{}:{mode:n})),_l(e)}function Al(e,t,n){return Tl(e,t.length),E(`fs_write_at`,{path:e,bytes:t,offset:n}).size}function jl(e,t){Tl(e,t.length);let n=St();if(n){let r=n.writeFile(e,t,1);return Ct(),r}return E(`fs_write_file`,{path:e,bytes:t,create:!0,truncate:!1}).size}function Ml(e){return E(`fs_stat`,{path:e,follow:!0})}function Nl(e){return E(`fs_stat`,{path:e,follow:!1})}function W(e){try{return E(`fs_stat`,{path:e,follow:!0}),!0}catch(e){return!1}}function Pl(e,t){let n=E(`fs_stat`,{path:e,follow:!0});if(t!==void 0&&t!==0){let r=n.mode&4095;if(t&1&&!(r&73))throw Object.assign(Error(`EACCES: permission denied, access '${e}'`),{code:`EACCES`})}}function Fl(e){return E(`fs_readdir`,{path:e}).entries}function Il(e,t,n){E(`fs_mkdir`,B({path:e,recursive:t},n===void 0?{}:{mode:n}))}function Ll(e,t){E(`fs_chmod`,{path:e,mode:t})}function Rl(e,t,n){E(`fs_fchmod`,{fd:t,pid:e,mode:n})}function zl(e){E(`fs_unlink`,{path:e})}function Bl(e,t){E(`fs_rename`,{from:e,to:t})}function Vl(e,t){E(`fs_link`,{from:e,to:t})}function Hl(e,t){E(`fs_symlink`,{target:e,path:t})}function Ul(e){return E(`fs_readlink`,{path:e}).target}function Wl(e){return E(`fs_realpath`,{path:e}).path}function Gl(e,t,n,r){eu.trace(`fs.open[${e}]: ${t} flags=${n} mode=${r}`);try{let i=E(`fs_open`,B({path:t,flags_str:n,pid:e},r===void 0?{}:{mode:r}));return eu.trace(`fs.open[${e}]: ${t} -> fd=${i.fd}`),yl(i.fd,t),i.fd}catch(n){throw eu.trace(`fs.open[${e}] failed: ${t} - ${n instanceof Error?n.message:String(n)}`),n}}function Kl(e,t){eu.trace(`fs.close[${e}]: fd=${t}`);try{let n=bl(t);E(`fs_close_fd`,{fd:t,pid:e}),xl(t),n&&_l(n)}catch(n){throw eu.trace(`fs.close[${e}] failed: fd=${t} - ${n instanceof Error?n.message:String(n)}`),n}}function ql(e,t,n,r){eu.trace(`fs.read[${e}]: fd=${t} length=${n} position=${r}`);try{let i=E(`fs_read_fd`,{fd:t,length:n,position:r==null?void 0:r,pid:e});return eu.trace(`fs.read[${e}]: fd=${t} read ${i.bytes_read} bytes`),t===0&&eu.debug(`fs.read[${e}]: stdin read returned ${i.bytes_read} bytes, eof=${i.eof}`),{bytes:i.bytes,bytes_read:i.bytes_read,eof:i.eof}}catch(n){throw eu.trace(`fs.read[${e}] failed: fd=${t} - ${n instanceof Error?n.message:String(n)}`),n}}function Jl(e,t,n,r){eu.trace(`fs.write[${e}]: fd=${t} length=${n.length} position=${r}`),t>=3&&eu.debug(`fs.write[${e}]: writing to fd=${t} (likely child stdin pipe), ${n.length} bytes`);try{let i=E(`fs_write_fd`,{fd:t,bytes:n,position:r==null?void 0:r,pid:e});eu.trace(`fs.write[${e}]: fd=${t} wrote ${i.bytes_written} bytes`);let a=bl(t);return a&&Tl(a,i.bytes_written),i.bytes_written}catch(n){throw eu.trace(`fs.write[${e}] failed: fd=${t} - ${n instanceof Error?n.message:String(n)}`),n}}function Yl(e,t,n){E(`fs_ftruncate`,{fd:t,size:n,pid:e})}function Xl(e,t){return eu.trace(`fs.fstat[${e}]: fd=${t}`),E(`fs_fstat`,{fd:t,pid:e})}function Zl(e,t,n){return eu.trace(`fs.watch: ${e} recursive=${t} eqId=${n}`),E(`fs_watch`,{path:e,recursive:t,eq_id:n}).watch_id}function Ql(e,t){eu.trace(`fs.unwatch[${e}]: watchId=${t}`),E(`fs_unwatch`,{watch_id:t})}function $l(e,t){eu.trace(`fs.fsync[${e}]: fd=${t}`),E(`fs_fsync`,{fd:t,pid:e})}var eu,tu,nu,ru,iu,au=i((()=>{kt(),A(),uo(),eu=D(`fs-interface`),tu=null,nu=0,ru=[],iu=new Map})),ou=a({E2BIG:()=>Uu,EACCES:()=>Wu,EADDRINUSE:()=>Gu,EADDRNOTAVAIL:()=>Ku,EAFNOSUPPORT:()=>qu,EAGAIN:()=>Ju,EALREADY:()=>Yu,EBADF:()=>Xu,EBADMSG:()=>Zu,EBUSY:()=>Qu,ECANCELED:()=>$u,ECHILD:()=>ed,ECONNABORTED:()=>td,ECONNREFUSED:()=>nd,ECONNRESET:()=>rd,EDEADLK:()=>id,EDESTADDRREQ:()=>ad,EDOM:()=>od,EDQUOT:()=>sd,EEXIST:()=>cd,EFAULT:()=>ld,EFBIG:()=>ud,EHOSTUNREACH:()=>dd,EIDRM:()=>fd,EILSEQ:()=>pd,EINPROGRESS:()=>md,EINTR:()=>hd,EINVAL:()=>gd,EIO:()=>_d,EISCONN:()=>vd,EISDIR:()=>yd,ELOOP:()=>bd,EMFILE:()=>xd,EMLINK:()=>Sd,EMSGSIZE:()=>Cd,EMULTIHOP:()=>wd,ENAMETOOLONG:()=>Td,ENETDOWN:()=>Ed,ENETRESET:()=>Dd,ENETUNREACH:()=>Od,ENFILE:()=>kd,ENOBUFS:()=>Ad,ENODATA:()=>jd,ENODEV:()=>Md,ENOENT:()=>Nd,ENOEXEC:()=>Pd,ENOLCK:()=>Fd,ENOLINK:()=>Id,ENOMEM:()=>Ld,ENOMSG:()=>Rd,ENOPROTOOPT:()=>zd,ENOSPC:()=>Bd,ENOSR:()=>Vd,ENOSTR:()=>Hd,ENOSYS:()=>Ud,ENOTCONN:()=>Wd,ENOTDIR:()=>Gd,ENOTEMPTY:()=>Kd,ENOTSOCK:()=>qd,ENOTSUP:()=>Jd,ENOTTY:()=>Yd,ENXIO:()=>Xd,EOPNOTSUPP:()=>Zd,EOVERFLOW:()=>Qd,EPERM:()=>$d,EPIPE:()=>ef,EPROTO:()=>tf,EPROTONOSUPPORT:()=>nf,EPROTOTYPE:()=>rf,ERANGE:()=>af,EROFS:()=>of,ESPIPE:()=>sf,ESRCH:()=>cf,ESTALE:()=>lf,ETIME:()=>uf,ETIMEDOUT:()=>df,ETXTBSY:()=>ff,EWOULDBLOCK:()=>pf,EXDEV:()=>mf,O_APPEND:()=>hu,O_CREAT:()=>du,O_DIRECTORY:()=>vu,O_DSYNC:()=>_u,O_EXCL:()=>fu,O_NOATIME:()=>bu,O_NOCTTY:()=>pu,O_NOFOLLOW:()=>yu,O_NONBLOCK:()=>gu,O_RDONLY:()=>cu,O_RDWR:()=>uu,O_SYMLINK:()=>Su,O_SYNC:()=>xu,O_TRUNC:()=>mu,O_WRONLY:()=>lu,SIGABRT:()=>bf,SIGALRM:()=>kf,SIGBUS:()=>Sf,SIGCHLD:()=>jf,SIGCONT:()=>Mf,SIGFPE:()=>Cf,SIGHUP:()=>hf,SIGILL:()=>vf,SIGINT:()=>gf,SIGIO:()=>Uf,SIGIOT:()=>xf,SIGKILL:()=>wf,SIGPIPE:()=>Of,SIGPOLL:()=>Wf,SIGPROF:()=>Vf,SIGPWR:()=>Gf,SIGQUIT:()=>_f,SIGSEGV:()=>Ef,SIGSTOP:()=>Nf,SIGSYS:()=>Kf,SIGTERM:()=>Af,SIGTRAP:()=>yf,SIGTSTP:()=>Pf,SIGTTIN:()=>Ff,SIGTTOU:()=>If,SIGURG:()=>Lf,SIGUSR1:()=>Tf,SIGUSR2:()=>Df,SIGVTALRM:()=>Bf,SIGWINCH:()=>Hf,SIGXCPU:()=>Rf,SIGXFSZ:()=>zf,S_IFBLK:()=>Du,S_IFCHR:()=>Eu,S_IFDIR:()=>Tu,S_IFIFO:()=>Ou,S_IFLNK:()=>ku,S_IFMT:()=>Cu,S_IFREG:()=>wu,S_IFSOCK:()=>Au,S_IRGRP:()=>Iu,S_IROTH:()=>Bu,S_IRUSR:()=>Mu,S_IRWXG:()=>Fu,S_IRWXO:()=>zu,S_IRWXU:()=>ju,S_IWGRP:()=>Lu,S_IWOTH:()=>Vu,S_IWUSR:()=>Nu,S_IXGRP:()=>Ru,S_IXOTH:()=>Hu,S_IXUSR:()=>Pu,default:()=>qf,flagsNumberToString:()=>su});function su(e){let t=e&3,n=(e&du)!==0,r=(e&mu)!==0,i=(e&hu)!==0,a=(e&fu)!==0,o=t===uu;return i?o?a?`ax+`:`a+`:a?`ax`:`a`:r||n?o?a?`wx+`:`w+`:a?`wx`:`w`:o?`r+`:t===lu?`w`:`r`}var cu,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff,If,Lf,Rf,zf,Bf,Vf,Hf,Uf,Wf,Gf,Kf,qf,Jf=i((()=>{cu=0,lu=1,uu=2,du=64,fu=128,pu=256,mu=512,hu=1024,gu=2048,_u=4096,vu=65536,yu=131072,bu=262144,xu=1052672,Su=2097152,Cu=61440,wu=32768,Tu=16384,Eu=8192,Du=24576,Ou=4096,ku=40960,Au=49152,ju=448,Mu=256,Nu=128,Pu=64,Fu=56,Iu=32,Lu=16,Ru=8,zu=7,Bu=4,Vu=2,Hu=1,Uu=7,Wu=13,Gu=98,Ku=99,qu=97,Ju=11,Yu=114,Xu=9,Zu=74,Qu=16,$u=125,ed=10,td=103,nd=111,rd=104,id=35,ad=89,od=33,sd=122,cd=17,ld=14,ud=27,dd=113,fd=43,pd=84,md=115,hd=4,gd=22,_d=5,vd=106,yd=21,bd=40,xd=24,Sd=31,Cd=90,wd=72,Td=36,Ed=100,Dd=102,Od=101,kd=23,Ad=105,jd=61,Md=19,Nd=2,Pd=8,Fd=37,Id=67,Ld=12,Rd=42,zd=92,Bd=28,Vd=63,Hd=60,Ud=38,Wd=107,Gd=20,Kd=39,qd=88,Jd=95,Yd=25,Xd=6,Zd=95,Qd=75,$d=1,ef=32,tf=71,nf=93,rf=91,af=34,of=30,sf=29,cf=3,lf=116,uf=62,df=110,ff=26,pf=11,mf=18,hf=1,gf=2,_f=3,vf=4,yf=5,bf=6,xf=6,Sf=7,Cf=8,wf=9,Tf=10,Ef=11,Df=12,Of=13,kf=14,Af=15,jf=17,Mf=18,Nf=19,Pf=20,Ff=21,If=22,Lf=23,Rf=24,zf=25,Bf=26,Vf=27,Hf=28,Uf=29,Wf=29,Gf=30,Kf=31,qf={O_RDONLY:cu,O_WRONLY:lu,O_RDWR:uu,O_CREAT:du,O_EXCL:fu,O_NOCTTY:pu,O_TRUNC:mu,O_APPEND:hu,O_DIRECTORY:vu,O_NOATIME:bu,O_NOFOLLOW:yu,O_SYNC:xu,O_DSYNC:_u,O_SYMLINK:Su,O_NONBLOCK:gu,S_IFMT:Cu,S_IFREG:wu,S_IFDIR:Tu,S_IFCHR:Eu,S_IFBLK:Du,S_IFIFO:Ou,S_IFLNK:ku,S_IFSOCK:Au,S_IRWXU:ju,S_IRUSR:Mu,S_IWUSR:Nu,S_IXUSR:Pu,S_IRWXG:Fu,S_IRGRP:Iu,S_IWGRP:Lu,S_IXGRP:Ru,S_IRWXO:zu,S_IROTH:Bu,S_IWOTH:Vu,S_IXOTH:Hu,E2BIG:Uu,EACCES:Wu,EADDRINUSE:Gu,EADDRNOTAVAIL:Ku,EAFNOSUPPORT:qu,EAGAIN:Ju,EALREADY:Yu,EBADF:Xu,EBADMSG:Zu,EBUSY:Qu,ECANCELED:$u,ECHILD:ed,ECONNABORTED:td,ECONNREFUSED:nd,ECONNRESET:rd,EDEADLK:id,EDESTADDRREQ:ad,EDOM:od,EDQUOT:sd,EEXIST:cd,EFAULT:ld,EFBIG:ud,EHOSTUNREACH:dd,EIDRM:fd,EILSEQ:pd,EINPROGRESS:md,EINTR:hd,EINVAL:gd,EIO:_d,EISCONN:vd,EISDIR:yd,ELOOP:bd,EMFILE:xd,EMLINK:Sd,EMSGSIZE:Cd,EMULTIHOP:wd,ENAMETOOLONG:Td,ENETDOWN:Ed,ENETRESET:Dd,ENETUNREACH:Od,ENFILE:kd,ENOBUFS:Ad,ENODATA:jd,ENODEV:Md,ENOENT:Nd,ENOEXEC:Pd,ENOLCK:Fd,ENOLINK:Id,ENOMEM:Ld,ENOMSG:Rd,ENOPROTOOPT:zd,ENOSPC:Bd,ENOSR:Vd,ENOSTR:Hd,ENOSYS:Ud,ENOTCONN:Wd,ENOTDIR:Gd,ENOTEMPTY:Kd,ENOTSOCK:qd,ENOTSUP:Jd,ENOTTY:Yd,ENXIO:Xd,EOPNOTSUPP:Zd,EOVERFLOW:Qd,EPERM:$d,EPIPE:ef,EPROTO:tf,EPROTONOSUPPORT:nf,EPROTOTYPE:rf,ERANGE:af,EROFS:of,ESPIPE:sf,ESRCH:cf,ESTALE:lf,ETIME:uf,ETIMEDOUT:df,ETXTBSY:ff,EWOULDBLOCK:pf,EXDEV:mf,SIGHUP:hf,SIGINT:gf,SIGQUIT:_f,SIGILL:vf,SIGTRAP:yf,SIGABRT:bf,SIGIOT:xf,SIGBUS:Sf,SIGFPE:Cf,SIGKILL:wf,SIGUSR1:Tf,SIGSEGV:Ef,SIGUSR2:Df,SIGPIPE:Of,SIGALRM:kf,SIGTERM:Af,SIGCHLD:jf,SIGCONT:Mf,SIGSTOP:Nf,SIGTSTP:Pf,SIGTTIN:Ff,SIGTTOU:If,SIGURG:Lf,SIGXCPU:Rf,SIGXFSZ:zf,SIGVTALRM:Bf,SIGPROF:Vf,SIGWINCH:Hf,SIGIO:Uf,SIGPOLL:Wf,SIGPWR:Gf,SIGSYS:Kf}})),Yf=a({FileHandle:()=>qp,access:()=>dp,appendFile:()=>ap,chmod:()=>Np,chown:()=>Fp,copyFile:()=>Tp,default:()=>Jp,lchmod:()=>Lp,lchown:()=>zp,link:()=>Gp,lstat:()=>lp,lutimes:()=>Up,mkdir:()=>hp,open:()=>Xf,readFile:()=>tp,readdir:()=>pp,readlink:()=>kp,realpath:()=>jp,rename:()=>Cp,rm:()=>_p,rmdir:()=>yp,stat:()=>sp,symlink:()=>Dp,unlink:()=>xp,utimes:()=>Vp,writeFile:()=>rp});function G(e,t){return new Promise((n,r)=>{e.queuePending(()=>{try{let r=t();e.nextTick(()=>n(r))}catch(t){e.nextTick(()=>r(t))}})})}function Xf(e,t,n){return Zf.apply(this,arguments)}function Zf(){return Zf=T(function*(e,t,n){let r=Qf(e),i=typeof t==`number`?su(t):t==null?`r`:t,a=H(process.pid);O.trace(`fs.promises.open: ${r}, flags=${i}`);let o=yield G(a,()=>Gl(process.pid,r,i,n));return O.trace(`fs.promises.open: success, fd=${o}`),new qp(o)}),Zf.apply(this,arguments)}function Qf(e){if(e instanceof URL){if(e.protocol!==`file:`)throw TypeError(`Only file: URLs are supported, got ${e.protocol}`);e=decodeURIComponent(e.pathname)}if(typeof e!=`string`)throw TypeError(`path must be a string or URL, got ${e===null?`null`:typeof e}`);return e.startsWith(`/`)?e:Ic(process.cwd(),e)}function $f(e){return{mode:e.mode,size:e.size,mtimeMs:e.mtime_ms,ctimeMs:e.ctime_ms,mtime:new Date(e.mtime_ms),ctime:new Date(e.ctime_ms),isFile:()=>e.kind===`file`,isDirectory:()=>e.kind===`dir`,isSymbolicLink:()=>e.kind===`symlink`}}function ep(e){return{name:e.name,isFile:()=>e.kind===`file`,isDirectory:()=>e.kind===`dir`,isSymbolicLink:()=>e.kind===`symlink`}}function tp(e,t){return np.apply(this,arguments)}function np(){return np=T(function*(e,t){let n=typeof t==`string`?t:t==null?void 0:t.encoding;if(e instanceof qp){O.trace(`fs.promises.readFile: FileHandle fd=${e.fd}`);let t=new Uint8Array(1024*1024),{bytesRead:r,buffer:i}=yield e.read(t,0,1024*1024,0),a=i.subarray(0,r);return n?new TextDecoder(n).decode(a):j.from(a)}let r=Qf(e),i=process.pid,a=yield G(H(i),()=>(O.trace(`fs.promises.readFile: ${r}`),Ol(r)));return n?new TextDecoder(n).decode(a):j.from(a)}),np.apply(this,arguments)}function rp(e,t,n){return ip.apply(this,arguments)}function ip(){return ip=T(function*(e,t,n){let r=typeof t==`string`?new TextEncoder().encode(t):t,i=typeof n==`object`&&n?n.mode:void 0;if(e instanceof qp){O.trace(`fs.promises.writeFile: FileHandle fd=${e.fd}, ${r.length} bytes`),yield e.write(r,0);return}if(typeof e==`object`&&e&&`fd`in e){let t=e.fd;if(typeof t==`number`){O.trace(`fs.promises.writeFile: duck-typed FileHandle fd=${t}, ${r.length} bytes`),yield G(H(process.pid),()=>Jl(process.pid,t,r,0));return}}let a=Qf(e),o=process.pid;yield G(H(o),()=>{O.trace(`fs.promises.writeFile: ${a}, ${r.length} bytes`),kl(a,r,i)})}),ip.apply(this,arguments)}function ap(e,t,n){return op.apply(this,arguments)}function op(){return op=T(function*(e,t,n){let r=typeof t==`string`?new TextEncoder().encode(t):t,i=Qf(e);yield G(H(process.pid),()=>jl(i,r))}),op.apply(this,arguments)}function sp(e){return cp.apply(this,arguments)}function cp(){return cp=T(function*(e){let t=Qf(e);return $f(yield G(H(process.pid),()=>Ml(t)))}),cp.apply(this,arguments)}function lp(e){return up.apply(this,arguments)}function up(){return up=T(function*(e){let t=Qf(e);return $f(yield G(H(process.pid),()=>Nl(t)))}),up.apply(this,arguments)}function dp(e,t){return fp.apply(this,arguments)}function fp(){return fp=T(function*(e,t){let n=Qf(e);yield G(H(process.pid),()=>Pl(n,t))}),fp.apply(this,arguments)}function pp(e,t){return mp.apply(this,arguments)}function mp(){return mp=T(function*(e,t){let n=Qf(e),r=yield G(H(process.pid),()=>Fl(n));return typeof t==`object`&&t&&t.withFileTypes?r.map(ep):r.map(e=>e.name)}),mp.apply(this,arguments)}function hp(e,t){return gp.apply(this,arguments)}function gp(){return gp=T(function*(e,t){let n=Qf(e),r=typeof t==`object`&&(t==null?void 0:t.recursive),i=typeof t==`object`?t==null?void 0:t.mode:typeof t==`number`?t:void 0,a=H(process.pid);O.trace(`fs.promises.mkdir: ${n}, recursive=${r}`);try{yield G(a,()=>Il(n,r==null?!1:r,i)),O.trace(`fs.promises.mkdir: success: ${n}`)}catch(e){throw O.error(`fs.promises.mkdir: failed: ${n}: ${e instanceof Error?e.message:String(e)}`),e}return r?n:void 0}),gp.apply(this,arguments)}function _p(e,t){return vp.apply(this,arguments)}function vp(){return vp=T(function*(e,t){try{let t=Qf(e);yield G(H(process.pid),()=>zl(t))}catch(e){if(t!=null&&t.force&&e.code===`ENOENT`)return;throw e}}),vp.apply(this,arguments)}function yp(e){return bp.apply(this,arguments)}function bp(){return bp=T(function*(e){let t=Qf(e);yield G(H(process.pid),()=>zl(t))}),bp.apply(this,arguments)}function xp(e){return Sp.apply(this,arguments)}function Sp(){return Sp=T(function*(e){let t=Qf(e);yield G(H(process.pid),()=>zl(t))}),Sp.apply(this,arguments)}function Cp(e,t){return wp.apply(this,arguments)}function wp(){return wp=T(function*(e,t){let n=Qf(e),r=Qf(t);yield G(H(process.pid),()=>Bl(n,r))}),wp.apply(this,arguments)}function Tp(e,t){return Ep.apply(this,arguments)}function Ep(){return Ep=T(function*(e,t){let n=yield tp(e),r=(yield sp(e)).mode&4095;yield rp(t,n),yield Np(t,r)}),Ep.apply(this,arguments)}function Dp(e,t){return Op.apply(this,arguments)}function Op(){return Op=T(function*(e,t){let n=Qf(t);yield G(H(process.pid),()=>Hl(e,n))}),Op.apply(this,arguments)}function kp(e){return Ap.apply(this,arguments)}function Ap(){return Ap=T(function*(e){let t=Qf(e);return G(H(process.pid),()=>Ul(t))}),Ap.apply(this,arguments)}function jp(e){return Mp.apply(this,arguments)}function Mp(){return Mp=T(function*(e){let t=Qf(e);return G(H(process.pid),()=>Wl(t))}),Mp.apply(this,arguments)}function Np(e,t){return Pp.apply(this,arguments)}function Pp(){return Pp=T(function*(e,t){let n=Qf(e);yield G(H(process.pid),()=>Ll(n,t))}),Pp.apply(this,arguments)}function Fp(e,t,n){return Ip.apply(this,arguments)}function Ip(){return Ip=T(function*(e,t,n){yield G(H(process.pid),()=>void 0)}),Ip.apply(this,arguments)}function Lp(e,t){return Rp.apply(this,arguments)}function Rp(){return Rp=T(function*(e,t){let n=Qf(e);yield G(H(process.pid),()=>Ll(n,t))}),Rp.apply(this,arguments)}function zp(e,t,n){return Bp.apply(this,arguments)}function Bp(){return Bp=T(function*(e,t,n){yield G(H(process.pid),()=>void 0)}),Bp.apply(this,arguments)}function Vp(e,t,n){return Hp.apply(this,arguments)}function Hp(){return Hp=T(function*(e,t,n){yield G(H(process.pid),()=>void 0)}),Hp.apply(this,arguments)}function Up(e,t,n){return Wp.apply(this,arguments)}function Wp(){return Wp=T(function*(e,t,n){yield G(H(process.pid),()=>void 0)}),Wp.apply(this,arguments)}function Gp(e,t){return Kp.apply(this,arguments)}function Kp(){return Kp=T(function*(e,t){yield G(H(process.pid),()=>{Vl(Ic(e),Ic(t))})}),Kp.apply(this,arguments)}var qp,Jp,Yp=i((()=>{ml(),A(),au(),Zo(),Jf(),rn(),w(),Ke(),qp=class{constructor(e){C(this,`fd`,void 0),C(this,`_closed`,!1),this.fd=e}read(e,t,n,r){var i=this;return T(function*(){if(i._closed)throw Error(`File handle closed`);let a=n==null?e.length:n,o=t==null?0:t,s=yield G(H(process.pid),()=>ql(process.pid,i.fd,a,r==null?null:r));return s.bytes.length>0&&e.set(s.bytes.subarray(0,s.bytes.length),o),{bytesRead:Number(s.bytes.length),buffer:e}})()}write(e,t,n,r){var i=this;return T(function*(){if(i._closed)throw Error(`File handle closed`);let a=n==null?e.length:n,o=t==null?0:t,s=e.subarray(o,o+a);O.trace(`FileHandle.write: fd=${i.fd}, ${s.length} bytes`);let c=yield G(H(process.pid),()=>Jl(process.pid,i.fd,s,r==null?null:r));return O.trace(`FileHandle.write: success, wrote ${c} bytes`),{bytesWritten:Number(c),buffer:e}})()}writeFile(e,t){var n=this;return T(function*(){if(n._closed)throw Error(`File handle closed`);let t=typeof e==`string`?new TextEncoder().encode(e):e;yield G(H(process.pid),()=>{Yl(process.pid,n.fd,0),Jl(process.pid,n.fd,t,0)})})()}readFile(e){var t=this;return T(function*(){if(t._closed)throw Error(`File handle closed`);O.trace(`FileHandle.readFile: fd=${t.fd}`);let{size:n,bytes:r}=yield G(H(process.pid),()=>{let e=Xl(process.pid,t.fd),n=ql(process.pid,t.fd,e.size,0);return{size:e.size,bytes:n.bytes}}),i=typeof e==`string`?e:e==null?void 0:e.encoding;return i?new TextDecoder(i).decode(r):j.from(r)})()}stat(){var e=this;return T(function*(){if(e._closed)throw Error(`File handle closed`);return $f(yield G(H(process.pid),()=>Xl(process.pid,e.fd)))})()}sync(){var e=this;return T(function*(){if(e._closed)throw Error(`File handle closed`);yield G(H(process.pid),()=>$l(process.pid,e.fd))})()}datasync(){var e=this;return T(function*(){if(e._closed)throw Error(`File handle closed`);yield G(H(process.pid),()=>$l(process.pid,e.fd))})()}truncate(e){var t=this;return T(function*(){if(t._closed)throw Error(`File handle closed`);yield G(H(process.pid),()=>Yl(process.pid,t.fd,e==null?0:e))})()}close(){var e=this;return T(function*(){e._closed||(e._closed=!0,yield G(H(process.pid),()=>{Kl(process.pid,e.fd),O.trace(`FileHandle.close: fd=${e.fd}`)}))})()}},Jp={open:Xf,FileHandle:qp,readFile:tp,writeFile:rp,appendFile:ap,stat:sp,lstat:lp,access:dp,readdir:pp,mkdir:hp,rm:_p,rmdir:yp,unlink:xp,rename:Cp,copyFile:Tp,symlink:Dp,readlink:kp,realpath:jp,chmod:Np,chown:Fp,lchmod:Lp,lchown:zp,utimes:Vp,lutimes:Up,link:Gp}})),Xp=a({FSWatcher:()=>bh,ReadStream:()=>xh,WriteStream:()=>Sh,access:()=>sh,accessSync:()=>lm,appendFile:()=>fh,appendFileSync:()=>am,chmod:()=>Bm,chmodSync:()=>Vm,chown:()=>Wm,chownSync:()=>Gm,close:()=>Sm,closeSync:()=>Cm,constants:()=>yh,copyFile:()=>uh,copyFileSync:()=>gm,createReadStream:()=>hh,createWriteStream:()=>gh,default:()=>Ch,exists:()=>dh,existsSync:()=>cm,fchmod:()=>Im,fchmodSync:()=>Lm,fchown:()=>Rm,fchownSync:()=>zm,fdatasync:()=>Em,fdatasyncSync:()=>Dm,fstat:()=>Mm,fstatSync:()=>Nm,fsync:()=>wm,fsyncSync:()=>Tm,futimes:()=>Pm,futimesSync:()=>Fm,isFsError:()=>Zp,lchmod:()=>Hm,lchmodSync:()=>Um,lchown:()=>Km,lchownSync:()=>qm,lstat:()=>th,lstatSync:()=>sm,lutimes:()=>Xm,lutimesSync:()=>Zm,mkdir:()=>rh,mkdirSync:()=>dm,open:()=>bm,openSync:()=>xm,promises:()=>Yf,read:()=>Om,readFile:()=>Qm,readFileSync:()=>rm,readSync:()=>km,readdir:()=>nh,readdirSync:()=>um,readlink:()=>lh,readlinkSync:()=>vm,realpath:()=>oh,realpathSync:()=>ym,rename:()=>ah,renameSync:()=>hm,rmSync:()=>fm,rmdir:()=>ph,rmdirSync:()=>pm,stat:()=>eh,statSync:()=>om,symlink:()=>ch,symlinkSync:()=>_m,unlink:()=>ih,unlinkSync:()=>mm,utimes:()=>Jm,utimesSync:()=>Ym,watch:()=>mh,write:()=>Am,writeFile:()=>$m,writeFileSync:()=>im,writeSync:()=>jm});function Zp(e){return e instanceof Error&&`code`in e&&`syscall`in e}function Qp(e,t,n,r){var i,a;let o=e instanceof Error?e:Error(String(e)),s=`code`in o&&typeof o.code==`string`?o.code:`EIO`,c=(i=vh[s])==null?`unknown error`:i;return o.code=s,o.errno=(a=_h[s])==null?-5:a,o.syscall=t,o.path=n,r?(o.dest=r,o.message=`${s}: ${c}, ${t} '${n}' -> '${r}'`):o.message=`${s}: ${c}, ${t} '${n}'`,o}function $p(e,t,n,r){try{return e()}catch(e){throw Qp(e,t,n,r)}}function K(e){H(process.pid).queuePending(e)}function em(e){if(e instanceof URL){if(e.protocol!==`file:`)throw TypeError(`Only file: URLs are supported, got ${e.protocol}`);e=decodeURIComponent(e.pathname)}if(typeof e!=`string`)throw O.error(`resolvePath called with non-string: ${typeof e}`,e),TypeError(`path must be a string or URL, got ${typeof e}`);return e.startsWith(`/`)?e:Ic(process.cwd(),e)}function tm(e){return{mode:e.mode,size:e.size,mtimeMs:e.mtime_ms,ctimeMs:e.ctime_ms,atimeMs:e.atime_ms,birthtimeMs:e.birthtime_ms,mtime:new Date(e.mtime_ms),ctime:new Date(e.ctime_ms),atime:new Date(e.atime_ms),birthtime:new Date(e.birthtime_ms),uid:e.uid,gid:e.gid,nlink:e.nlink,ino:e.ino,dev:e.dev,rdev:e.rdev,blksize:e.blksize,blocks:e.blocks,isFile:()=>e.kind===`file`,isDirectory:()=>e.kind===`dir`,isSymbolicLink:()=>e.kind===`symlink`,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>e.kind===`fifo`,isSocket:()=>!1}}function nm(e){return{name:e.name,isFile:()=>e.kind===`file`,isDirectory:()=>e.kind===`dir`,isSymbolicLink:()=>e.kind===`symlink`}}function rm(e,t){let n=em(e),r=$p(()=>Ol(n),`open`,n),i=typeof t==`string`?t:t==null?void 0:t.encoding;return i?new TextDecoder(i).decode(r):j.from(r)}function im(e,t,n){let r=em(e),i=typeof t==`string`?new TextEncoder().encode(t):t,a=typeof n==`object`&&n?n.mode:void 0;$p(()=>kl(r,i,a),`open`,r)}function am(e,t,n){let r=em(e),i=typeof t==`string`?new TextEncoder().encode(t):t;$p(()=>jl(r,i),`open`,r)}function om(e,t){let n=em(e);if((t==null?void 0:t.throwIfNoEntry)===!1)try{return tm(Ml(n))}catch(e){return}return $p(()=>tm(Ml(n)),`stat`,n)}function sm(e,t){let n=em(e);if((t==null?void 0:t.throwIfNoEntry)===!1)try{return tm(Nl(n))}catch(e){return}return $p(()=>tm(Nl(n)),`lstat`,n)}function cm(e){return W(em(e))}function lm(e,t){let n=em(e);$p(()=>Pl(n,t),`access`,n)}function um(e,t){let n=em(e),r=$p(()=>Fl(n),`scandir`,n);return typeof t==`object`&&t&&t.withFileTypes?r.map(nm):r.map(e=>e.name)}function dm(e,t){let n=em(e),r=typeof t==`object`&&(t==null?void 0:t.recursive),i=typeof t==`object`?t==null?void 0:t.mode:typeof t==`number`?t:void 0;return $p(()=>Il(n,r==null?!1:r,i),`mkdir`,n),r?n:void 0}function fm(e,t){let n=em(e);try{$p(()=>zl(n),`unlink`,n)}catch(e){if(t!=null&&t.force&&e.code===`ENOENT`)return;throw e}}function pm(e){let t=em(e);$p(()=>zl(t),`rmdir`,t)}function mm(e){let t=em(e);$p(()=>zl(t),`unlink`,t)}function hm(e,t){let n=em(e),r=em(t);$p(()=>Bl(n,r),`rename`,n,r)}function gm(e,t){let n=rm(e),r=om(e).mode&4095;im(t,typeof n==`string`?n:n.toUint8Array()),Vm(t,r)}function _m(e,t){let n=em(t);$p(()=>Hl(e,n),`symlink`,n)}function vm(e){let t=em(e);return $p(()=>Ul(t),`readlink`,t)}function ym(e){let t=em(e);return $p(()=>Wl(t),`realpath`,t)}function bm(e,t,n,r){let i=typeof n==`function`?n:r,a=typeof n==`number`?n:void 0,o=typeof t==`number`?su(t):t,s=em(e);K(()=>{try{let e=Gl(process.pid,s,o,a);i==null||i(null,e)}catch(e){i==null||i(Qp(e,`open`,s))}})}function xm(e,t,n){let r=typeof t==`number`?su(t):t==null?`r`:t,i=em(e);return $p(()=>Gl(process.pid,i,r,n),`open`,i)}function Sm(e,t){O.trace(`fs.close: fd=${e}`),K(()=>{try{Kl(process.pid,e),t==null||t(null)}catch(n){t==null||t(Qp(n,`close`,`fd=${e}`))}})}function Cm(e){return O.trace(`fs.closeSync: fd=${e}`),$p(()=>{Kl(process.pid,e)},`close`,`fd=${e}`)}function wm(e,t){K(()=>t(null))}function Tm(e){}function Em(e,t){K(()=>t(null))}function Dm(e){}function Om(e,t,n,r,i,a){let o=H(process.pid),s=!1,c=()=>{s||(s=!0,o.registerFdReadable(e,()=>{s=!1,o.unregisterFdReadable(e),l()}))},l=()=>{try{let o=ql(process.pid,e,r,i),s=o.bytes.length;if(s===0&&o.eof===!1&&i===null){c();return}let l=Math.min(s,t.length-n);t.set(o.bytes.subarray(0,l),n),a(null,s,t)}catch(t){a(Qp(t,`read`,`fd=${e}`))}};K(l)}function km(e,t,n,r,i){return $p(()=>{let a=n==null?0:n,o=r==null?t.length-a:r,s=ql(process.pid,e,o,i==null?null:i),c=s.bytes.length,l=Math.min(c,t.length-a);return t.set(s.bytes.subarray(0,l),a),c},`read`,`fd=${e}`)}function Am(e,t,n,r,i,a){let o=typeof n==`function`?n:typeof i==`function`?i:a,s=typeof n==`number`?n:0,c=typeof r==`number`?r:t.length,l=typeof i==`number`?i:null;K(()=>{try{let n;n=typeof t==`string`?new TextEncoder().encode(t):new Uint8Array(t.buffer,t.byteOffset+s,c);let r=Jl(process.pid,e,n,l==null?null:l);o==null||o(null,r,t)}catch(t){o==null||o(Qp(t,`write`,`fd=${e}`))}})}function jm(e,t,n,r,i){return $p(()=>{let a=n==null?0:n,o=r==null?typeof t==`string`?t.length:t.length-a:r,s;s=typeof t==`string`?new TextEncoder().encode(t):a===0&&o===t.length?t instanceof Uint8Array?t:new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset+a,o);let c=process.pid;if(typeof c!=`number`)throw Error(`process.pid is not a number: ${typeof c}`);let l=Jl(c,e,s,i==null?null:i);if(typeof l!=`number`)throw Error(`bytesWritten is not a number: ${typeof l}`);return l},`write`,`fd=${e}`)}function Mm(e,t){K(()=>{try{t(null,tm(Xl(process.pid,e)))}catch(n){t(Qp(n,`fstat`,`fd=${e}`))}})}function Nm(e){return $p(()=>tm(Xl(process.pid,e)),`fstat`,`fd=${e}`)}function Pm(e,t,n,r){K(()=>r(null))}function Fm(e,t,n){}function Im(e,t,n){K(()=>{try{Lm(e,t),n(null)}catch(e){n(e)}})}function Lm(e,t){$p(()=>Rl(process.pid,e,t),`fchmod`,String(e))}function Rm(e,t,n,r){K(()=>r(null))}function zm(e,t,n){}function Bm(e,t,n){K(()=>{try{Vm(e,t),n(null)}catch(e){n(e)}})}function Vm(e,t){let n=em(e);$p(()=>Ll(n,t),`chmod`,n)}function Hm(e,t,n){K(()=>{try{Um(e,t),n(null)}catch(e){n(e)}})}function Um(e,t){let n=em(e);$p(()=>Ll(n,t),`chmod`,n)}function Wm(e,t,n,r){K(()=>r(null))}function Gm(e,t,n){}function Km(e,t,n,r){K(()=>r(null))}function qm(e,t,n){}function Jm(e,t,n,r){K(()=>r(null))}function Ym(e,t,n){}function Xm(e,t,n,r){K(()=>r(null))}function Zm(e,t,n){}function Qm(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t,a=typeof i==`string`?i:i==null?void 0:i.encoding;tp(e,a?{encoding:a}:void 0).then(e=>{r(null,e instanceof Uint8Array?j.from(e):e)}).catch(e=>{r(e)})}function $m(e,t,n,r){let i=typeof n==`function`?n:r;rp(e,t,typeof n==`function`?void 0:n).then(()=>{i(null)}).catch(e=>{i(e)})}function eh(e,t){K(()=>{try{t(null,om(e))}catch(e){t(e)}})}function th(e,t){K(()=>{try{t(null,sm(e))}catch(e){t(e)}})}function nh(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;K(()=>{try{r(null,um(e,i))}catch(e){r(e)}})}function rh(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;K(()=>{try{r(null,dm(e,i))}catch(e){r(e)}})}function ih(e,t){K(()=>{try{mm(e),t(null)}catch(e){t(e)}})}function ah(e,t,n){K(()=>{try{hm(e,t),n(null)}catch(e){n(e)}})}function oh(e,t,n){let r=typeof t==`function`?t:n;K(()=>{try{r(null,ym(e))}catch(e){r(e)}})}function sh(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`number`?t:void 0;K(()=>{try{lm(e,i),r(null)}catch(e){r(e)}})}function ch(e,t,n,r){let i=typeof n==`function`?n:r;K(()=>{try{_m(e,t),i(null)}catch(e){i(e)}})}function lh(e,t,n){let r=typeof t==`function`?t:n;K(()=>{try{r(null,vm(e))}catch(e){r(e)}})}function uh(e,t,n,r){let i=typeof n==`function`?n:r;K(()=>{try{gm(e,t),i(null)}catch(e){i(e)}})}function dh(e,t){K(()=>{t(cm(e))})}function fh(e,t,n,r){let i=typeof n==`function`?n:r;K(()=>{try{am(e,t),i(null)}catch(e){i(e)}})}function ph(e,t){K(()=>{try{pm(e),t(null)}catch(e){t(e)}})}function mh(e,t,n){let r={},i;typeof t==`function`?i=t:typeof t==`string`?(r={encoding:t},i=n):(t&&(r=t),i=n);let a=new bh(e,r);return i&&a.on(`change`,i),a}function hh(e,t){return new xh(e,typeof t==`string`?{encoding:t}:t)}function gh(e,t){return new Sh(e,typeof t==`string`?{encoding:t}:t)}var _h,vh,yh,bh,xh,Sh,Ch,wh=i((()=>{ml(),Yp(),fs(),A(),Zo(),rn(),au(),Jf(),w(),_h={ENOENT:-2,EEXIST:-17,ENOTDIR:-20,EISDIR:-21,EACCES:-13,EINVAL:-22,EBADF:-9,ENOTEMPTY:-39,ELOOP:-40,EPERM:-1},vh={ENOENT:`no such file or directory`,EEXIST:`file already exists`,ENOTDIR:`not a directory`,EISDIR:`illegal operation on a directory`,EACCES:`permission denied`,EINVAL:`invalid argument`,EBADF:`bad file descriptor`,ENOTEMPTY:`directory not empty`,ELOOP:`too many symbolic links`,EPERM:`operation not permitted`},ym.native=ym,oh.native=oh,yh={F_OK:0,R_OK:4,W_OK:2,X_OK:1,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_NOCTTY:256,O_TRUNC:512,O_APPEND:1024,O_NONBLOCK:2048,O_DSYNC:4096,O_DIRECTORY:65536,O_NOFOLLOW:131072,O_SYNC:1052672,O_SYMLINK:2097152,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,UV_DIRENT_UNKNOWN:0,UV_DIRENT_FILE:1,UV_DIRENT_DIR:2,UV_DIRENT_LINK:3,UV_DIRENT_FIFO:4,UV_DIRENT_SOCKET:5,UV_DIRENT_CHAR:6,UV_DIRENT_BLOCK:7,UV_FS_O_FILEMAP:0,UV_FS_COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4},bh=class{constructor(e,t={}){C(this,`watchId`,null),C(this,`watchPath`,void 0),C(this,`closed`,!1),C(this,`listeners`,{change:new Set,error:new Set,close:new Set}),C(this,`unsubscribe`,null),this.watchPath=em(e);try{var n,r;let e=H(process.pid),i=(n=e.getEventQueueId())==null?void 0:n;if(this.watchId=Zl(this.watchPath,(r=t.recursive)==null?!1:r,i),this.watchId!==null){let n=t.persistent!==!1;e.registerFsWatch(this.watchId,e=>{let t=e;if(t.watch_id!==this.watchId)return;let n=this.mapEventType(t.kind),r=this.getFilename(t.path);this.emit(`change`,n,r)},n),this.unsubscribe=()=>e.unregisterFsWatch(this.watchId)}t.signal&&(t.signal.aborted?this.close():t.signal.addEventListener(`abort`,()=>this.close(),{once:!0}))}catch(e){queueMicrotask(()=>this.emit(`error`,e))}}mapEventType(e){switch(e){case`create`:case`delete`:case`rename`:return`rename`;default:return`change`}}getFilename(e){return e===this.watchPath?zc(e):e.startsWith(this.watchPath+`/`)?e.slice(this.watchPath.length+1):zc(e)}on(e,t){return e===`change`?this.listeners.change.add(t):e===`error`?this.listeners.error.add(t):e===`close`&&this.listeners.close.add(t),this}off(e,t){return e===`change`?this.listeners.change.delete(t):e===`error`?this.listeners.error.delete(t):e===`close`&&this.listeners.close.delete(t),this}once(e,t){if(e===`change`){let e=(n,r)=>{this.off(`change`,e),t(n,r)};return this.on(`change`,e)}else if(e===`error`){let e=n=>{this.off(`error`,e),t(n)};return this.on(`error`,e)}else{let e=()=>{this.off(`close`,e),t()};return this.on(`close`,e)}}addListener(e,t){return e===`change`?this.on(`change`,t):e===`error`?this.on(`error`,t):this.on(`close`,t)}removeListener(e,t){return e===`change`?this.off(`change`,t):e===`error`?this.off(`error`,t):this.off(`close`,t)}removeAllListeners(e){return e?e===`change`?this.listeners.change.clear():e===`error`?this.listeners.error.clear():e===`close`&&this.listeners.close.clear():(this.listeners.change.clear(),this.listeners.error.clear(),this.listeners.close.clear()),this}emit(e,...t){if(!(this.closed&&e!==`close`)){if(e===`change`)for(let e of this.listeners.change)try{e(t[0],t[1])}catch(e){O.error(`Error in fs.watch change listener:`,e)}else if(e===`error`)for(let e of this.listeners.error)try{e(t[0])}catch(e){O.error(`Error in fs.watch error listener:`,e)}else if(e===`close`)for(let e of this.listeners.close)try{e()}catch(e){O.error(`Error in fs.watch close listener:`,e)}}}close(){if(!this.closed){if(this.closed=!0,this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.watchId!==null){try{Ql(process.pid,this.watchId)}catch(e){}this.watchId=null}this.emit(`close`)}}ref(){return this}unref(){return this}},xh=class extends ss{constructor(e,t={}){var n,r,i,a;super({highWaterMark:(n=t.highWaterMark)==null?64*1024:n,encoding:t.encoding}),C(this,`path`,void 0),C(this,`_fd`,null),C(this,`_position`,void 0),C(this,`_end`,void 0),C(this,`_autoClose`,void 0),C(this,`_bytesRead`,0),C(this,`_flags`,void 0),C(this,`_mode`,void 0),C(this,`_closed`,!1),this.path=em(e),this._flags=(r=t.flags)==null?`r`:r,this._mode=(i=t.mode)==null?438:i,this._position=(a=t.start)==null?0:a,this._end=t.end,this._autoClose=t.autoClose!==!1,O.trace(`ReadStream created: ${this.path}, flags=${this._flags}`)}_ensureOpen(){this._fd===null&&(this._fd=Gl(process.pid,this.path,`r`),O.trace(`ReadStream: opened fd=${this._fd} for ${this.path}`))}_closeIfNeeded(){if(this._fd!==null&&this._autoClose&&!this._closed){this._closed=!0;try{Kl(process.pid,this._fd),O.trace(`ReadStream: closed fd=${this._fd} for ${this.path}`)}catch(e){}this._fd=null,this.emit(`close`)}}_read(e){try{if(this._ensureOpen(),!this._fd)throw Error(`File descriptor not open`);let t=e;if(this._end!==void 0){let n=this._end-this._position+1;if(n<=0){this.push(null),this._closeIfNeeded();return}t=Math.min(e,n)}let n=ql(process.pid,this._fd,t,this._position);if(n.bytes.length===0){this.push(null),this._closeIfNeeded();return}let r=j.from(n.bytes);this._position+=n.bytes.length,this._bytesRead+=n.bytes.length,O.trace(`ReadStream._read: ${this.path}, ${n.bytes.length} bytes at position ${this._position-n.bytes.length}`),this.push(r)}catch(e){this._closeIfNeeded(),this.destroy(e instanceof Error?e:Error(String(e)))}}destroy(e){return this._closeIfNeeded(),super.destroy(e)}get bytesRead(){return this._bytesRead}},Sh=class extends cs{constructor(e,t={}){var n,r,i,a;if(super({highWaterMark:(n=t.highWaterMark)==null?64*1024:n}),C(this,`path`,void 0),C(this,`_fd`,null),C(this,`_position`,void 0),C(this,`_autoClose`,void 0),C(this,`_bytesWritten`,0),C(this,`_flags`,void 0),C(this,`_mode`,void 0),C(this,`_fileCreated`,!1),this.path=em(e),this._flags=(r=t.flags)==null?`w`:r,this._mode=(i=t.mode)==null?438:i,this._position=(a=t.start)==null?0:a,this._autoClose=t.autoClose!==!1,O.trace(`WriteStream created: ${this.path}, flags=${this._flags}`),this._flags===`w`||this._flags===`w+`)try{let e=Rc(this.path);try{Il(e,!0),O.trace(`WriteStream: ensured parent dir: ${e}`)}catch(t){O.trace(`WriteStream: mkdir(${e}) error: ${t instanceof Error?t.message:String(t)}`)}kl(this.path,new Uint8Array),this._fileCreated=!0,O.trace(`WriteStream: file created/truncated: ${this.path}`)}catch(e){O.trace(`WriteStream: initial create failed for ${this.path}: ${e instanceof Error?e.message:String(e)}`)}}_write(e,t,n){try{let t;if(e instanceof Uint8Array)t=e;else if(typeof e==`string`)t=new TextEncoder().encode(e);else{n(Error(`Invalid chunk type`));return}O.trace(`WriteStream._write: ${this.path}, ${t.length} bytes at offset ${this._position}`),Al(this.path,t,this._position),this._position+=t.length,this._bytesWritten+=t.length,O.trace(`WriteStream._write: success, total written: ${this._bytesWritten}`),n()}catch(e){O.error(`WriteStream._write failed for ${this.path}: ${e instanceof Error?e.message:String(e)}`),n(e instanceof Error?e:Error(String(e)))}}_final(e){O.trace(`WriteStream._final: ${this.path}, total bytes: ${this._bytesWritten}`),e()}get bytesWritten(){return this._bytesWritten}},Ch={promises:Yf,readFileSync:rm,writeFileSync:im,appendFileSync:am,statSync:om,lstatSync:sm,existsSync:cm,accessSync:lm,readdirSync:um,mkdirSync:dm,rmSync:fm,rmdirSync:pm,unlinkSync:mm,renameSync:hm,copyFileSync:gm,symlinkSync:_m,readlinkSync:vm,realpathSync:ym,readFile:Qm,writeFile:$m,appendFile:fh,stat:eh,lstat:th,readdir:nh,mkdir:rh,unlink:ih,rename:ah,realpath:oh,access:sh,symlink:ch,readlink:lh,copyFile:uh,exists:dh,rmdir:ph,open:bm,openSync:xm,close:Sm,closeSync:Cm,fsync:wm,fsyncSync:Tm,fdatasync:Em,fdatasyncSync:Dm,read:Om,readSync:km,write:Am,writeSync:jm,fstat:Mm,fstatSync:Nm,futimes:Pm,futimesSync:Fm,fchmod:Im,fchmodSync:Lm,fchown:Rm,fchownSync:zm,chmod:Bm,chmodSync:Vm,lchmod:Hm,lchmodSync:Um,chown:Wm,chownSync:Gm,lchown:Km,lchownSync:qm,utimes:Jm,utimesSync:Ym,lutimes:Xm,lutimesSync:Zm,constants:yh,watch:mh,FSWatcher:bh,createReadStream:hh,createWriteStream:gh,ReadStream:xh,WriteStream:Sh}})),Th=a({EOL:()=>Gh,arch:()=>Eh,constants:()=>qh,cpus:()=>Ih,default:()=>Jh,devNull:()=>Kh,endianness:()=>Ph,freemem:()=>Rh,getPriority:()=>Uh,homedir:()=>Mh,hostname:()=>jh,loadavg:()=>Bh,machine:()=>Fh,networkInterfaces:()=>Vh,platform:()=>Dh,release:()=>kh,setPriority:()=>Wh,tmpdir:()=>Nh,totalmem:()=>Lh,type:()=>Oh,uptime:()=>zh,userInfo:()=>Hh,version:()=>Ah});function Eh(){return`x64`}function Dh(){return`linux`}function Oh(){return`Linux`}function kh(){return`6.1.0-substrate`}function Ah(){return`#1 SMP PREEMPT_DYNAMIC`}function jh(){return`substrate`}function Mh(){return`/home/user`}function Nh(){return`/tmp`}function Ph(){return`LE`}function Fh(){return`x86_64`}function Ih(){return[{model:`Virtual CPU`,speed:1e3,times:{user:0,nice:0,sys:0,idle:0,irq:0}}]}function Lh(){return 256*1024*1024}function Rh(){return 128*1024*1024}function zh(){return performance.now()/1e3}function Bh(){return[0,0,0]}function Vh(){return{lo:[{address:`127.0.0.1`,netmask:`255.0.0.0`,family:`IPv4`,mac:`00:00:00:00:00:00`,internal:!0,cidr:`127.0.0.1/8`}]}}function Hh(){return{uid:1e3,gid:1e3,username:`user`,homedir:`/home/user`,shell:`/bin/sh`}}function Uh(e){return 0}function Wh(e,t){}var Gh,Kh,qh,Jh,Yh=i((()=>{Gh=`
|
|
38
|
+
`,Kh=`/dev/null`,qh={signals:{SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGBUS:7,SIGFPE:8,SIGKILL:9,SIGUSR1:10,SIGSEGV:11,SIGUSR2:12,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:17,SIGCONT:18,SIGSTOP:19,SIGTSTP:20,SIGTTIN:21,SIGTTOU:22,SIGURG:23,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:29,SIGPWR:30,SIGSYS:31},errno:{E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18},priority:{PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20}},Jh={EOL:Gh,devNull:Kh,arch:Eh,platform:Dh,type:Oh,release:kh,version:Ah,hostname:jh,homedir:Mh,tmpdir:Nh,endianness:Ph,machine:Fh,cpus:Ih,totalmem:Lh,freemem:Rh,uptime:zh,loadavg:Bh,networkInterfaces:Vh,userInfo:Hh,getPriority:Uh,setPriority:Wh,constants:qh}})),Xh=a({Agent:()=>qs,ClientRequest:()=>Vs,IncomingMessage:()=>Rs,METHODS:()=>Hs,STATUS_CODES:()=>Us,Server:()=>Bs,ServerResponse:()=>zs,createServer:()=>$h,default:()=>eg,get:()=>Qh,globalAgent:()=>Js,request:()=>Zh});function Zh(e,t,n){if(Zh.__substrate_marker=!0,typeof e==`string`){let r=new URL(e);return(!r.protocol||r.protocol===`http:`)&&(r.protocol=`https:`),Ts(r.toString(),t,n)}else if(e instanceof URL){let r=new URL(e.toString());return(!r.protocol||r.protocol===`http:`)&&(r.protocol=`https:`),Ts(r,t,n)}else return Ts(B(B({},e),{},{protocol:`https:`}),t)}function Qh(e,t,n){let r=Zh(e,t,n);return r.end(),r}function $h(e,t){return Ds(e,t)}var eg,tg=i((()=>{Xs(),uo(),eg={createServer:$h,Server:Bs,IncomingMessage:Rs,ServerResponse:zs,ClientRequest:Vs,Agent:qs,globalAgent:Js,request:Zh,get:Qh,METHODS:Hs,STATUS_CODES:Us}}));
|
|
39
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
40
|
+
function ng(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function rg(e,t=``){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw Error(`${n}expected integer >= 0, got ${e}`)}}function ig(e,t,n=``){let r=ng(e),i=e==null?void 0:e.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`;throw Error(o+`expected Uint8Array`+s+`, got `+c)}return e}function ag(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash must wrapped by utils.createHasher`);rg(e.outputLen),rg(e.blockLen)}function og(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function sg(e,t){ig(e,void 0,`digestInto() output`);let n=t.outputLen;if(e.length<n)throw Error(`"digestInto() output" expected to be of length >=`+n)}function cg(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function lg(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ug(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function dg(e,t){return e<<32-t|e>>>t}function fg(e,t){return e<<t|e>>>32-t>>>0}function pg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function mg(e){for(let t=0;t<e.length;t++)e[t]=pg(e[t]);return e}function hg(e,t={}){let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var gg,_g,vg,yg=i((()=>{Ke(),gg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,_g=gg?e=>e:mg,typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex,function(){var e=T(function*(){});return function(){return e.apply(this,arguments)}}(),vg=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])})}));function bg(e,t,n){return e&t^~e&n}function xg(e,t,n){return e&t^e&n^t&n}var Sg,Cg,wg,Tg,Eg=i((()=>{yg(),w(),Sg=class{constructor(e,t,n,r){C(this,`blockLen`,void 0),C(this,`outputLen`,void 0),C(this,`padOffset`,void 0),C(this,`isLE`,void 0),C(this,`buffer`,void 0),C(this,`view`,void 0),C(this,`finished`,!1),C(this,`length`,0),C(this,`pos`,0),C(this,`destroyed`,!1),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=ug(this.buffer)}update(e){og(this),ig(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=ug(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){og(this),sg(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,lg(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;n.setBigUint64(r-8,BigInt(this.length*8),i),this.process(n,0);let o=ug(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen must be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},Cg=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),wg=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Tg=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])})),Dg,Og,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig,Lg,Rg,zg,Bg,Vg=i((()=>{Eg(),yg(),w(),Dg=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),Og=new Uint32Array(80),kg=class extends Sg{constructor(){super(64,20,8,!1),C(this,`A`,Dg[0]|0),C(this,`B`,Dg[1]|0),C(this,`C`,Dg[2]|0),C(this,`D`,Dg[3]|0),C(this,`E`,Dg[4]|0)}get(){let{A:e,B:t,C:n,D:r,E:i}=this;return[e,t,n,r,i]}set(e,t,n,r,i){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0}process(e,t){for(let n=0;n<16;n++,t+=4)Og[n]=e.getUint32(t,!1);for(let e=16;e<80;e++)Og[e]=fg(Og[e-3]^Og[e-8]^Og[e-14]^Og[e-16],1);let{A:n,B:r,C:i,D:a,E:o}=this;for(let e=0;e<80;e++){let t,s;e<20?(t=bg(r,i,a),s=1518500249):e<40?(t=r^i^a,s=1859775393):e<60?(t=xg(r,i,a),s=2400959708):(t=r^i^a,s=3395469782);let c=fg(n,5)+t+o+s+Og[e]|0;o=a,a=i,i=fg(r,30),r=n,n=c}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,this.set(n,r,i,a,o)}roundClean(){lg(Og)}destroy(){this.set(0,0,0,0,0),lg(this.buffer)}},Ag=hg(()=>new kg),jg=2**32,Mg=Array.from({length:64},(e,t)=>Math.floor(jg*Math.abs(Math.sin(t+1)))),Ng=Dg.slice(0,4),Pg=new Uint32Array(16),Fg=class extends Sg{constructor(){super(64,16,8,!0),C(this,`A`,Ng[0]|0),C(this,`B`,Ng[1]|0),C(this,`C`,Ng[2]|0),C(this,`D`,Ng[3]|0)}get(){let{A:e,B:t,C:n,D:r}=this;return[e,t,n,r]}set(e,t,n,r){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0}process(e,t){for(let n=0;n<16;n++,t+=4)Pg[n]=e.getUint32(t,!0);let{A:n,B:r,C:i,D:a}=this;for(let e=0;e<64;e++){let t,o,s;e<16?(t=bg(r,i,a),o=e,s=[7,12,17,22]):e<32?(t=bg(a,r,i),o=(5*e+1)%16,s=[5,9,14,20]):e<48?(t=r^i^a,o=(3*e+5)%16,s=[4,11,16,23]):(t=i^(r|~a),o=7*e%16,s=[6,10,15,21]),t=t+n+Mg[e]+Pg[o],n=a,a=i,i=r,r+=fg(t,s[e%4])}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,this.set(n,r,i,a)}roundClean(){lg(Pg)}destroy(){this.set(0,0,0,0),lg(this.buffer)}},Ig=hg(()=>new Fg),Lg=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Rg=Uint8Array.from(Array(16).fill(0).map((e,t)=>t)),zg=Rg.map(e=>(9*e+5)%16),Bg=(()=>{let e=[[Rg],[zg]];for(let t=0;t<4;t++)for(let n of e)n.push(n[t].map(e=>Lg[e]));return e})(),Bg[0],Bg[1]}));function Hg(e,t=!1){return t?{h:Number(e&Gg),l:Number(e>>Kg&Gg)}:{h:Number(e>>Kg&Gg)|0,l:Number(e&Gg)|0}}function Ug(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Hg(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}function Wg(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var Gg,Kg,qg,Jg,Yg,Xg,Zg,Qg,$g,e_,t_,n_,r_,i_,a_,o_,s_,c_,l_=i((()=>{Gg=BigInt(2**32-1),Kg=BigInt(32),qg=(e,t,n)=>e>>>n,Jg=(e,t,n)=>e<<32-n|t>>>n,Yg=(e,t,n)=>e>>>n|t<<32-n,Xg=(e,t,n)=>e<<32-n|t>>>n,Zg=(e,t,n)=>e<<64-n|t>>>n-32,Qg=(e,t,n)=>e>>>n-32|t<<64-n,$g=(e,t,n)=>e<<n|t>>>32-n,e_=(e,t,n)=>t<<n|e>>>32-n,t_=(e,t,n)=>t<<n-32|e>>>64-n,n_=(e,t,n)=>e<<n-32|t>>>64-n,r_=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),i_=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,a_=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),o_=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,s_=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),c_=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0})),u_,d_,f_,p_,m_,h_,g_,__,v_,y_,b_,x_,S_,C_,w_,T_=i((()=>{Eg(),l_(),yg(),w(),u_=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),d_=new Uint32Array(64),f_=class extends Sg{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)d_[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=d_[e-15],n=d_[e-2],r=dg(t,7)^dg(t,18)^t>>>3;d_[e]=(dg(n,17)^dg(n,19)^n>>>10)+d_[e-7]+r+d_[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=dg(o,6)^dg(o,11)^dg(o,25),u=l+t+bg(o,s,c)+u_[e]+d_[e]|0,d=(dg(n,2)^dg(n,13)^dg(n,22))+xg(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){lg(d_)}destroy(){this.set(0,0,0,0,0,0,0,0),lg(this.buffer)}},p_=class extends f_{constructor(){super(32),C(this,`A`,Cg[0]|0),C(this,`B`,Cg[1]|0),C(this,`C`,Cg[2]|0),C(this,`D`,Cg[3]|0),C(this,`E`,Cg[4]|0),C(this,`F`,Cg[5]|0),C(this,`G`,Cg[6]|0),C(this,`H`,Cg[7]|0)}},m_=Ug(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e))),h_=m_[0],g_=m_[1],__=new Uint32Array(80),v_=new Uint32Array(80),y_=class extends Sg{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=4)__[n]=e.getUint32(t),v_[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=__[e-15]|0,n=v_[e-15]|0,r=Yg(t,n,1)^Yg(t,n,8)^qg(t,n,7),i=Xg(t,n,1)^Xg(t,n,8)^Jg(t,n,7),a=__[e-2]|0,o=v_[e-2]|0,s=Yg(a,o,19)^Zg(a,o,61)^qg(a,o,6),c=Xg(a,o,19)^Qg(a,o,61)^Jg(a,o,6),l=a_(i,c,v_[e-7],v_[e-16]);__[e]=o_(l,r,s,__[e-7],__[e-16])|0,v_[e]=l|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=Yg(u,d,14)^Yg(u,d,18)^Zg(u,d,41),v=Xg(u,d,14)^Xg(u,d,18)^Qg(u,d,41),y=u&f^~u&m,b=d&p^~d&h,ee=s_(_,v,b,g_[e],v_[e]),te=c_(ee,g,t,y,h_[e],__[e]),ne=ee|0,x=Yg(n,r,28)^Zg(n,r,34)^Zg(n,r,39),S=Xg(n,r,28)^Qg(n,r,34)^Qg(n,r,39),re=n&i^n&o^i&o,C=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=Wg(c|0,l|0,te|0,ne|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let w=r_(ne,S,C);n=i_(w,te,x,re),r=w|0}({h:n,l:r}=Wg(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=Wg(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=Wg(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=Wg(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=Wg(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=Wg(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=Wg(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=Wg(this.Hh|0,this.Hl|0,g|0,_|0),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){lg(__,v_)}destroy(){lg(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},b_=class extends y_{constructor(){super(64),C(this,`Ah`,Tg[0]|0),C(this,`Al`,Tg[1]|0),C(this,`Bh`,Tg[2]|0),C(this,`Bl`,Tg[3]|0),C(this,`Ch`,Tg[4]|0),C(this,`Cl`,Tg[5]|0),C(this,`Dh`,Tg[6]|0),C(this,`Dl`,Tg[7]|0),C(this,`Eh`,Tg[8]|0),C(this,`El`,Tg[9]|0),C(this,`Fh`,Tg[10]|0),C(this,`Fl`,Tg[11]|0),C(this,`Gh`,Tg[12]|0),C(this,`Gl`,Tg[13]|0),C(this,`Hh`,Tg[14]|0),C(this,`Hl`,Tg[15]|0)}},x_=class extends y_{constructor(){super(48),C(this,`Ah`,wg[0]|0),C(this,`Al`,wg[1]|0),C(this,`Bh`,wg[2]|0),C(this,`Bl`,wg[3]|0),C(this,`Ch`,wg[4]|0),C(this,`Cl`,wg[5]|0),C(this,`Dh`,wg[6]|0),C(this,`Dl`,wg[7]|0),C(this,`Eh`,wg[8]|0),C(this,`El`,wg[9]|0),C(this,`Fh`,wg[10]|0),C(this,`Fl`,wg[11]|0),C(this,`Gh`,wg[12]|0),C(this,`Gl`,wg[13]|0),C(this,`Hh`,wg[14]|0),C(this,`Hl`,wg[15]|0)}},S_=hg(()=>new p_,vg(1)),C_=hg(()=>new b_,vg(3)),w_=hg(()=>new x_,vg(2))}));function E_(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=z_(a,o,1)^n[r],c=B_(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=P_[n],a=z_(t,i,r),o=B_(t,i,r),s=N_[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=L_[r],e[1]^=R_[r]}lg(n)}var D_,O_,k_,A_,j_,M_,N_,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_,W_,G_,K_=i((()=>{l_(),yg(),w(),D_=BigInt(0),O_=BigInt(1),k_=BigInt(2),A_=BigInt(7),j_=BigInt(256),M_=BigInt(113),N_=[],P_=[],F_=[];for(let e=0,t=O_,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],N_.push(2*(5*r+n)),P_.push((e+1)*(e+2)/2%64);let i=D_;for(let e=0;e<7;e++)t=(t<<O_^(t>>A_)*M_)%j_,t&k_&&(i^=O_<<(O_<<BigInt(e))-O_);F_.push(i)}I_=Ug(F_,!0),L_=I_[0],R_=I_[1],z_=(e,t,n)=>n>32?t_(e,t,n):$g(e,t,n),B_=(e,t,n)=>n>32?n_(e,t,n):e_(e,t,n),V_=class e{constructor(e,t,n,r=!1,i=24){if(C(this,`state`,void 0),C(this,`pos`,0),C(this,`posOut`,0),C(this,`finished`,!1),C(this,`state32`,void 0),C(this,`destroyed`,!1),C(this,`blockLen`,void 0),C(this,`suffix`,void 0),C(this,`outputLen`,void 0),C(this,`enableXOF`,!1),C(this,`rounds`,void 0),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,rg(n,`outputLen`),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=cg(this.state)}clone(){return this._cloneInto()}keccak(){_g(this.state32),E_(this.state32,this.rounds),_g(this.state32),this.posOut=0,this.pos=0}update(e){og(this),ig(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){og(this,!1),ig(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return rg(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(sg(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,lg(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||(t=new e(n,r,i,o,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}},H_=(e,t,n,r={})=>hg(()=>new V_(t,e,n),r),U_=H_(6,136,32,vg(8)),W_=H_(6,104,48,vg(9)),G_=H_(6,72,64,vg(10))})),q_,J_,Y_=i((()=>{yg(),w(),q_=class{constructor(e,t){if(C(this,`oHash`,void 0),C(this,`iHash`,void 0),C(this,`blockLen`,void 0),C(this,`outputLen`,void 0),C(this,`finished`,!1),C(this,`destroyed`,!1),ag(e),ig(t,void 0,`key`),this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,r=new Uint8Array(n);r.set(t.length>n?e.create().update(t).digest():t);for(let e=0;e<r.length;e++)r[e]^=54;this.iHash.update(r),this.oHash=e.create();for(let e=0;e<r.length;e++)r[e]^=106;this.oHash.update(r),lg(r)}update(e){return og(this),this.iHash.update(e),this}digestInto(e){og(this),ig(e,this.outputLen,`output`),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},J_=(e,t,n)=>new q_(e,t).update(n).digest(),J_.create=(e,t)=>new q_(e,t)})),X_=a({createHash:()=>Q_,createHmac:()=>$_,default:()=>hv,getCiphers:()=>sv,getHashes:()=>ov,getRandomValues:()=>dv,hash:()=>Z_,randomBytes:()=>ev,randomBytesSync:()=>tv,randomFill:()=>iv,randomFillSync:()=>rv,randomInt:()=>av,randomUUID:()=>nv,timingSafeEqual:()=>cv,webcrypto:()=>mv});function Z_(e,t,n){let r=Q_(e);return r.update(t),r.digest(n)}function Q_(e){let t=fv[e.toLowerCase().replace(/-/g,`_`)]||fv[e.toLowerCase()];if(!t)throw Error(`Unsupported hash algorithm: ${e}. Supported: md5, sha1, sha256, sha384, sha512, sha3-256, sha3-384, sha3-512`);let n=[],r=!1,i={update(e,t){if(r)throw Error(`Digest already called`);let a=lv(e,t);return n.push(a),i},digest(e){if(r)throw Error(`Digest already called`);r=!0;let i=n.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of n)a.set(e,o),o+=e.length;let s=t(a),c=j.from(s);return e===void 0?c:uv(c,e)},copy(){let t=Q_(e);for(let e of n)t.update(e);return t}};return i}function $_(e,t){let n=pv[e.toLowerCase()];if(!n)throw Error(`Unsupported HMAC algorithm: ${e}. Supported: sha1, sha256, sha384, sha512`);let r=lv(t),i=[],a=!1,o={update(e,t){if(a)throw Error(`Digest already called`);let n=lv(e,t);return i.push(n),o},digest(e){if(a)throw Error(`Digest already called`);a=!0;let t=i.reduce((e,t)=>e+t.length,0),o=new Uint8Array(t),s=0;for(let e of i)o.set(e,s),s+=e.length;let c=J_(n,r,o),l=j.from(c);return e===void 0?l:uv(l,e)}};return o}function ev(e,t){if(e<0||!Number.isInteger(e))throw RangeError(`The "size" argument must be a non-negative integer. Received ${e}`);let n=new Uint8Array(e);crypto.getRandomValues(n);let r=j.from(n);if(t){queueMicrotask(()=>t(null,r));return}return r}function tv(e){return ev(e)}function nv(){return crypto.randomUUID()}function rv(e,t=0,n){let r=n==null?e.length-t:n;if(t<0||t>e.length)throw RangeError(`offset is out of range`);if(r<0||t+r>e.length)throw RangeError(`size is out of range`);let i=new Uint8Array(e.buffer,e.byteOffset+t,r);return crypto.getRandomValues(i),e}function iv(e,t,n,r){let i=0,a,o;typeof t==`function`?o=t:typeof n==`function`?(i=t,o=n):(i=t,a=n,o=r);try{rv(e,i,a),queueMicrotask(()=>o(null,e))}catch(t){queueMicrotask(()=>o(t,e))}}function av(e,t,n){let r,i,a;if(typeof t==`function`?(r=0,i=e,a=t):typeof n==`function`?(r=e,i=t,a=n):t===void 0?(r=0,i=e):(r=e,i=t),!Number.isInteger(r)||!Number.isInteger(i))throw TypeError(`min and max must be integers`);if(r>=i)throw RangeError(`min must be less than max`);let o=i-r,s=ev(4),c=((s[0]<<24|s[1]<<16|s[2]<<8|s[3])>>>0)%o+r;if(a){queueMicrotask(()=>a(null,c));return}return c}function ov(){return[`md5`,`sha1`,`sha256`,`sha384`,`sha512`,`sha3-256`,`sha3-384`,`sha3-512`]}function sv(){return[]}function cv(e,t){if(e.length!==t.length)throw RangeError(`Input buffers must have the same byte length`);let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function lv(e,t){return typeof e==`string`?j.from(e,t||`utf8`).toUint8Array():e instanceof ArrayBuffer?new Uint8Array(e):e instanceof DataView?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):j.isBuffer(e)?e.toUint8Array():e}function uv(e,t){switch(t){case`hex`:return e.toString(`hex`);case`base64`:return e.toString(`base64`);case`base64url`:return e.toString(`base64url`);case`latin1`:case`binary`:return e.toString(`latin1`);default:let n=t;throw Error(`Unsupported encoding: ${n}`)}}function dv(e){if(e===null)throw TypeError(`The typedArray argument must not be null`);return crypto.getRandomValues(e)}var fv,pv,mv,hv,gv=i((()=>{Vg(),T_(),K_(),Y_(),rn(),fv={md5:Ig,sha1:Ag,"sha-1":Ag,sha256:S_,"sha-256":S_,sha384:w_,"sha-384":w_,sha512:C_,"sha-512":C_,sha3_256:U_,"sha3-256":U_,sha3_384:W_,"sha3-384":W_,sha3_512:G_,"sha3-512":G_},pv={sha1:Ag,"sha-1":Ag,sha256:S_,"sha-256":S_,sha384:w_,"sha-384":w_,sha512:C_,"sha-512":C_},mv=crypto,hv={hash:Z_,createHash:Q_,createHmac:$_,randomBytes:ev,randomBytesSync:tv,randomUUID:nv,randomFillSync:rv,randomFill:iv,randomInt:av,getRandomValues:dv,getHashes:ov,getCiphers:sv,timingSafeEqual:cv,webcrypto:mv}}));function _v(e){Dv=e}function vv(e,t){kv.set(e,t),Bt.debug(`Registered alias: ${e} -> ${t}`)}function yv(e){if(kv.has(e)){let t=kv.get(e);return Bt.debug(`applyAlias: exact match "${e}" -> "${t}"`),t}for(let[t,n]of kv)if(e.startsWith(t+`/`)){let r=e.slice(t.length);return Bt.debug(`applyAlias: subpath match "${e}" -> "${n+r}"`),n+r}if(Dv){let t=Dv(e);if(t)return Bt.debug(`applyAlias: native binding "${e}" -> "${t}"`),t}return e}function q(e,t){Ov.set(e,t)}function bv(e){let t=e.startsWith(`node:`)?e.slice(5):e;return Ov.has(t)}function xv(){return Array.from(Ov.entries())}function Sv(e){let t=[],n=e.split(`/`).filter(Boolean);for(let e=n.length;e>=0;e--){if(n[e-1]===`node_modules`)continue;let r=`/`+n.slice(0,e).join(`/`),i=r===`/`?`/node_modules`:Cv(r,`node_modules`);t.push(i)}return t}function Cv(e,t){return e.endsWith(`/`)?e+t:`${e}/${t}`}function wv(e){try{return Ml(e).kind===`file`}catch(e){return!1}}function Tv(e){try{return Ml(e).kind===`dir`}catch(e){return!1}}function Ev(e){try{for(let t of[/^\s*import\s+(?:[\w{},*\s]+\s+from\s+)?['"][^'"]+['"]/m,/^\s*import\s*\(/m,/^\s*export\s+(?:default|const|let|var|function|class|async|\{)/m])if(t.test(e))return!0;return!1}catch(e){return!1}}var Dv,Ov,kv,Av=i((()=>{A(),au(),Dv=null,Ov=new Map,kv=new Map}));function jv(e,t=`@`){if(!J)return Lv.then((()=>jv(e)));let n=e.length+1,r=(J.__heap_base.value||J.__heap_base)+4*n-J.memory.buffer.byteLength;r>0&&J.memory.grow(Math.ceil(r/65536));let i=J.sa(n-1);if((Fv?Nv:Mv)(e,new Uint16Array(J.memory.buffer,i,n)),!J.parse())throw Object.assign(Error(`Parse error ${t}:${e.slice(0,J.e()).split(`
|
|
41
|
+
`).length}:${J.e()-e.lastIndexOf(`
|
|
42
|
+
`,J.e()-1)}`),{idx:J.e()});let a=[],o=[];for(;J.ri();){let t=J.is(),n=J.ie(),r=J.it(),i=J.ai(),o=J.id(),l=J.ss(),u=J.se(),d;J.ip()&&(d=s(e.slice(o===-1?t-1:t,o===-1?n+1:n)));let f=[];for(J.rsa();J.ra();){let t=J.aks(),n=J.ake(),r=J.avs(),i=J.ave();f.push([c(e.slice(t,n)),c(e.slice(r,i))])}a.push({n:d,t:r,s:t,e:n,ss:l,se:u,d:o,a:i,at:f.length>0?f:null})}for(;J.re();){let t=J.es(),n=J.ee(),r=J.els(),i=J.ele(),a=c(e.slice(t,n)),s=r<0?void 0:c(e.slice(r,i));o.push({s:t,e:n,ls:r,le:i,n:a,ln:s})}function s(e){try{return(0,eval)(e)}catch(e){}}function c(e){if(!e)return e;let t=e[0];return(t===`"`||t===`'`)&&s(e)||e}return[a,o,!!J.f(),!!J.ms()]}function Mv(e,t){let n=e.length,r=0;for(;r<n;){let n=e.charCodeAt(r);t[r++]=(255&n)<<8|n>>>8}}function Nv(e,t){let n=e.length,r=0;for(;r<n;)t[r]=e.charCodeAt(r++)}var Pv,Fv,J,Iv,Lv,Rv=i((()=>{(function(e){e[e.Static=1]=`Static`,e[e.Dynamic=2]=`Dynamic`,e[e.ImportMeta=3]=`ImportMeta`,e[e.StaticSourcePhase=4]=`StaticSourcePhase`,e[e.DynamicSourcePhase=5]=`DynamicSourcePhase`,e[e.StaticDeferPhase=6]=`StaticDeferPhase`,e[e.DynamicDeferPhase=7]=`DynamicDeferPhase`})(Pv||(Pv={})),Fv=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,Iv=()=>{return e=`AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADNzYAAQECAgICAgICAgICAgICAgICAgICAgICAwIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUGw8gALfwBBsPIACwedARsGbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJpdAAIAmFpAAkCaWQACgJpcAALAmVzAAwCZWUADQNlbHMADgNlbGUADwJyaQAQAnJlABEBZgASAm1zABMCcmEAFANha3MAFQNha2UAFgNhdnMAFwNhdmUAGANyc2EAGQVwYXJzZQAaC19faGVhcF9iYXNlAwEKkkY2aAEBf0EAIAA2AvQJQQAoAtAJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgL4CUEAIAA2AvwJQQBBADYC1AlBAEEANgLkCUEAQQA2AtwJQQBBADYC2AlBAEEANgLsCUEAQQA2AuAJIAEL0wEBA39BACgC5AkhBEEAQQAoAvwJIgU2AuQJQQAgBDYC6AlBACAFQShqNgL8CSAEQSRqQdQJIAQbIAU2AgBBACgCyAkhBEEAKALECSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGIgAbIAQgA0YiBBs2AgwgBSADNgIUIAVBADYCECAFIAI2AgQgBUIANwIgIAVBA0EBQQIgABsgBBs2AhwgBUEAKALECSADRiICOgAYAkACQCACDQBBACgCyAkgA0cNAQtBAEEBOgCACgsLXgEBf0EAKALsCSIEQRBqQdgJIAQbQQAoAvwJIgQ2AgBBACAENgLsCUEAIARBFGo2AvwJQQBBAToAgAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKECgsVAEEAKALcCSgCAEEAKALQCWtBAXULHgEBf0EAKALcCSgCBCIAQQAoAtAJa0EBdUF/IAAbCxUAQQAoAtwJKAIIQQAoAtAJa0EBdQseAQF/QQAoAtwJKAIMIgBBACgC0AlrQQF1QX8gABsLCwBBACgC3AkoAhwLHgEBf0EAKALcCSgCECIAQQAoAtAJa0EBdUF/IAAbCzsBAX8CQEEAKALcCSgCFCIAQQAoAsQJRw0AQX8PCwJAIABBACgCyAlHDQBBfg8LIABBACgC0AlrQQF1CwsAQQAoAtwJLQAYCxUAQQAoAuAJKAIAQQAoAtAJa0EBdQsVAEEAKALgCSgCBEEAKALQCWtBAXULHgEBf0EAKALgCSgCCCIAQQAoAtAJa0EBdUF/IAAbCx4BAX9BACgC4AkoAgwiAEEAKALQCWtBAXVBfyAAGwslAQF/QQBBACgC3AkiAEEkakHUCSAAGygCACIANgLcCSAAQQBHCyUBAX9BAEEAKALgCSIAQRBqQdgJIAAbKAIAIgA2AuAJIABBAEcLCABBAC0AiAoLCABBAC0AgAoLKwEBf0EAQQAoAowKIgBBEGpBACgC3AlBIGogABsoAgAiADYCjAogAEEARwsVAEEAKAKMCigCAEEAKALQCWtBAXULFQBBACgCjAooAgRBACgC0AlrQQF1CxUAQQAoAowKKAIIQQAoAtAJa0EBdQsVAEEAKAKMCigCDEEAKALQCWtBAXULCgBBAEEANgKMCgvdDQEFfyMAQYDQAGsiACQAQQBBAToAiApBAEEAKALMCTYClApBAEEAKALQCUF+aiIBNgKoCkEAIAFBACgC9AlBAXRqIgI2AqwKQQBBADoAgApBAEEAOwGQCkEAQQA7AZIKQQBBADoAmApBAEEANgKECkEAQQA6APAJQQAgAEGAEGo2ApwKQQAgADYCoApBAEEAOgCkCgJAAkACQAJAA0BBACABQQJqIgM2AqgKIAEgAk8NAQJAIAMvAQAiAkF3akEFSQ0AAkACQAJAAkACQCACQZt/ag4FAQgICAIACyACQSBGDQQgAkEvRg0DIAJBO0YNAgwHC0EALwGSCg0BIAMQG0UNASABQQRqQYIIQQoQNQ0BEBxBAC0AiAoNAUEAQQAoAqgKIgE2ApQKDAcLIAMQG0UNACABQQRqQYwIQQoQNQ0AEB0LQQBBACgCqAo2ApQKDAELAkAgAS8BBCIDQSpGDQAgA0EvRw0EEB4MAQtBARAfC0EAKAKsCiECQQAoAqgKIQEMAAsLQQAhAiADIQFBAC0A8AkNAgwBC0EAIAE2AqgKQQBBADoAiAoLA0BBACABQQJqIgM2AqgKAkACQAJAAkACQAJAAkAgAUEAKAKsCk8NACADLwEAIgJBd2pBBUkNBgJAAkACQAJAAkACQAJAAkACQAJAIAJBYGoOChAPBg8PDw8FAQIACwJAAkACQAJAIAJBoH9qDgoLEhIDEgESEhICAAsgAkGFf2oOAwURBgkLQQAvAZIKDRAgAxAbRQ0QIAFBBGpBgghBChA1DRAQHAwQCyADEBtFDQ8gAUEEakGMCEEKEDUNDxAdDA8LIAMQG0UNDiABKQAEQuyAhIOwjsA5Ug0OIAEvAQwiA0F3aiIBQRdLDQxBASABdEGfgIAEcUUNDAwNC0EAQQAvAZIKIgFBAWo7AZIKQQAoApwKIAFBA3RqIgFBATYCACABQQAoApQKNgIEDA0LQQAvAZIKIgNFDQlBACADQX9qIgM7AZIKQQAvAZAKIgJFDQxBACgCnAogA0H//wNxQQN0aigCAEEFRw0MAkAgAkECdEEAKAKgCmpBfGooAgAiAygCBA0AIANBACgClApBAmo2AgQLQQAgAkF/ajsBkAogAyABQQRqNgIMDAwLAkBBACgClAoiAS8BAEEpRw0AQQAoAuQJIgNFDQAgAygCBCABRw0AQQBBACgC6AkiAzYC5AkCQCADRQ0AIANBADYCJAwBC0EAQQA2AtQJC0EAQQAvAZIKIgNBAWo7AZIKQQAoApwKIANBA3RqIgNBBkECQQAtAKQKGzYCACADIAE2AgRBAEEAOgCkCgwLC0EALwGSCiIBRQ0HQQAgAUF/aiIBOwGSCkEAKAKcCiABQf//A3FBA3RqKAIAQQRGDQQMCgtBJxAgDAkLQSIQIAwICyACQS9HDQcCQAJAIAEvAQQiAUEqRg0AIAFBL0cNARAeDAoLQQEQHwwJCwJAAkACQAJAQQAoApQKIgEvAQAiAxAhRQ0AAkACQCADQVVqDgQACQEDCQsgAUF+ai8BAEErRg0DDAgLIAFBfmovAQBBLUYNAgwHCyADQSlHDQFBACgCnApBAC8BkgoiAkEDdGooAgQQIkUNAgwGCyABQX5qLwEAQVBqQf//A3FBCk8NBQtBAC8BkgohAgsCQAJAIAJB//8DcSICRQ0AIANB5gBHDQBBACgCnAogAkF/akEDdGoiBCgCAEEBRw0AIAFBfmovAQBB7wBHDQEgBCgCBEGWCEEDECNFDQEMBQsgA0H9AEcNAEEAKAKcCiACQQN0aiICKAIEECQNBCACKAIAQQZGDQQLIAEQJQ0DIANFDQMgA0EvRkEALQCYCkEAR3ENAwJAQQAoAuwJIgJFDQAgASACKAIASQ0AIAEgAigCBE0NBAsgAUF+aiEBQQAoAtAJIQICQANAIAFBAmoiBCACTQ0BQQAgATYClAogAS8BACEDIAFBfmoiBCEBIAMQJkUNAAsgBEECaiEECwJAIANB//8DcRAnRQ0AIARBfmohAQJAA0AgAUECaiIDIAJNDQFBACABNgKUCiABLwEAIQMgAUF+aiIEIQEgAxAnDQALIARBAmohAwsgAxAoDQQLQQBBAToAmAoMBwtBACgCnApBAC8BkgoiAUEDdCIDakEAKAKUCjYCBEEAIAFBAWo7AZIKQQAoApwKIANqQQM2AgALECkMBQtBAC0A8AlBAC8BkApBAC8BkgpyckUhAgwHCxAqQQBBADoAmAoMAwsQK0EAIQIMBQsgA0GgAUcNAQtBAEEBOgCkCgtBAEEAKAKoCjYClAoLQQAoAqgKIQEMAAsLIABBgNAAaiQAIAILGgACQEEAKALQCSAARw0AQQEPCyAAQX5qECwL/goBBn9BAEEAKAKoCiIAQQxqIgE2AqgKQQAoAuwJIQJBARAvIQMCQAJAAkACQAJAAkACQAJAAkBBACgCqAoiBCABRw0AIAMQLkUNAQsCQAJAAkACQAJAAkACQCADQSpGDQAgA0H7AEcNAUEAIARBAmo2AqgKQQEQLyEDQQAoAqgKIQQDQAJAAkAgA0H//wNxIgNBIkYNACADQSdGDQAgAxAyGkEAKAKoCiEDDAELIAMQIEEAQQAoAqgKQQJqIgM2AqgKC0EBEC8aAkAgBCADEDMiA0EsRw0AQQBBACgCqApBAmo2AqgKQQEQLyEDCyADQf0ARg0DQQAoAqgKIgUgBEYNDyAFIQQgBUEAKAKsCk0NAAwPCwtBACAEQQJqNgKoCkEBEC8aQQAoAqgKIgMgAxAzGgwCC0EAQQA6AIgKAkACQAJAAkACQAJAIANBn39qDgwCCwQBCwMLCwsLCwUACyADQfYARg0EDAoLQQAgBEEOaiIDNgKoCgJAAkACQEEBEC9Bn39qDgYAEgISEgESC0EAKAKoCiIFKQACQvOA5IPgjcAxUg0RIAUvAQoQJ0UNEUEAIAVBCmo2AqgKQQAQLxoLQQAoAqgKIgVBAmpBsghBDhA1DRAgBS8BECICQXdqIgFBF0sNDUEBIAF0QZ+AgARxRQ0NDA4LQQAoAqgKIgUpAAJC7ICEg7COwDlSDQ8gBS8BCiICQXdqIgFBF00NBgwKC0EAIARBCmo2AqgKQQAQLxpBACgCqAohBAtBACAEQRBqNgKoCgJAQQEQLyIEQSpHDQBBAEEAKAKoCkECajYCqApBARAvIQQLQQAoAqgKIQMgBBAyGiADQQAoAqgKIgQgAyAEEAJBAEEAKAKoCkF+ajYCqAoPCwJAIAQpAAJC7ICEg7COwDlSDQAgBC8BChAmRQ0AQQAgBEEKajYCqApBARAvIQRBACgCqAohAyAEEDIaIANBACgCqAoiBCADIAQQAkEAQQAoAqgKQX5qNgKoCg8LQQAgBEEEaiIENgKoCgtBACAEQQZqNgKoCkEAQQA6AIgKQQEQLyEEQQAoAqgKIQMgBBAyIQRBACgCqAohAiAEQd//A3EiAUHbAEcNA0EAIAJBAmo2AqgKQQEQLyEFQQAoAqgKIQNBACEEDAQLQQBBAToAgApBAEEAKAKoCkECajYCqAoLQQEQLyEEQQAoAqgKIQMCQCAEQeYARw0AIANBAmpBrAhBBhA1DQBBACADQQhqNgKoCiAAQQEQL0EAEDEgAkEQakHYCSACGyEDA0AgAygCACIDRQ0FIANCADcCCCADQRBqIQMMAAsLQQAgA0F+ajYCqAoMAwtBASABdEGfgIAEcUUNAwwEC0EBIQQLA0ACQAJAIAQOAgABAQsgBUH//wNxEDIaQQEhBAwBCwJAAkBBACgCqAoiBCADRg0AIAMgBCADIAQQAkEBEC8hBAJAIAFB2wBHDQAgBEEgckH9AEYNBAtBACgCqAohAwJAIARBLEcNAEEAIANBAmo2AqgKQQEQLyEFQQAoAqgKIQMgBUEgckH7AEcNAgtBACADQX5qNgKoCgsgAUHbAEcNAkEAIAJBfmo2AqgKDwtBACEEDAALCw8LIAJBoAFGDQAgAkH7AEcNBAtBACAFQQpqNgKoCkEBEC8iBUH7AEYNAwwCCwJAIAJBWGoOAwEDAQALIAJBoAFHDQILQQAgBUEQajYCqAoCQEEBEC8iBUEqRw0AQQBBACgCqApBAmo2AqgKQQEQLyEFCyAFQShGDQELQQAoAqgKIQEgBRAyGkEAKAKoCiIFIAFNDQAgBCADIAEgBRACQQBBACgCqApBfmo2AqgKDwsgBCADQQBBABACQQAgBEEMajYCqAoPCxArC4UMAQp/QQBBACgCqAoiAEEMaiIBNgKoCkEBEC8hAkEAKAKoCiEDAkACQAJAAkACQAJAAkACQCACQS5HDQBBACADQQJqNgKoCgJAQQEQLyICQeQARg0AAkAgAkHzAEYNACACQe0ARw0HQQAoAqgKIgJBAmpBnAhBBhA1DQcCQEEAKAKUCiIDEDANACADLwEAQS5GDQgLIAAgACACQQhqQQAoAsgJEAEPC0EAKAKoCiICQQJqQaIIQQoQNQ0GAkBBACgClAoiAxAwDQAgAy8BAEEuRg0HC0EAIQRBACACQQxqNgKoCkEBIQVBBSEGQQEQLyECQQAhB0EBIQgMAgtBACgCqAoiAikAAkLlgJiD0IyAOVINBQJAQQAoApQKIgMQMA0AIAMvAQBBLkYNBgtBACEEQQAgAkEKajYCqApBAiEIQQchBkEBIQdBARAvIQJBASEFDAELAkACQAJAAkAgAkHzAEcNACADIAFNDQAgA0ECakGiCEEKEDUNAAJAIAMvAQwiBEF3aiIHQRdLDQBBASAHdEGfgIAEcQ0CCyAEQaABRg0BC0EAIQdBByEGQQEhBCACQeQARg0BDAILQQAhBEEAIANBDGoiAjYCqApBASEFQQEQLyEJAkBBACgCqAoiBiACRg0AQeYAIQICQCAJQeYARg0AQQUhBkEAIQdBASEIIAkhAgwEC0EAIQdBASEIIAZBAmpBrAhBBhA1DQQgBi8BCBAmRQ0EC0EAIQdBACADNgKoCkEHIQZBASEEQQAhBUEAIQggCSECDAILIAMgAEEKak0NAEEAIQhB5AAhAgJAIAMpAAJC5YCYg9CMgDlSDQACQAJAIAMvAQoiBEF3aiIHQRdLDQBBASAHdEGfgIAEcQ0BC0EAIQggBEGgAUcNAQtBACEFQQAgA0EKajYCqApBKiECQQEhB0ECIQhBARAvIglBKkYNBEEAIAM2AqgKQQEhBEEAIQdBACEIIAkhAgwCCyADIQZBACEHDAILQQAhBUEAIQgLAkAgAkEoRw0AQQAoApwKQQAvAZIKIgJBA3RqIgNBACgCqAo2AgRBACACQQFqOwGSCiADQQU2AgBBACgClAovAQBBLkYNBEEAQQAoAqgKIgNBAmo2AqgKQQEQLyECIABBACgCqApBACADEAECQAJAIAUNAEEAKALkCSEBDAELQQAoAuQJIgEgBjYCHAtBAEEALwGQCiIDQQFqOwGQCkEAKAKgCiADQQJ0aiABNgIAAkAgAkEiRg0AIAJBJ0YNAEEAQQAoAqgKQX5qNgKoCg8LIAIQIEEAQQAoAqgKQQJqIgI2AqgKAkACQAJAQQEQL0FXag4EAQICAAILQQBBACgCqApBAmo2AqgKQQEQLxpBACgC5AkiAyACNgIEIANBAToAGCADQQAoAqgKIgI2AhBBACACQX5qNgKoCg8LQQAoAuQJIgMgAjYCBCADQQE6ABhBAEEALwGSCkF/ajsBkgogA0EAKAKoCkECajYCDEEAQQAvAZAKQX9qOwGQCg8LQQBBACgCqApBfmo2AqgKDwsCQCAEQQFzIAJB+wBHcg0AQQAoAqgKIQJBAC8BkgoNBQNAAkACQAJAIAJBACgCrApPDQBBARAvIgJBIkYNASACQSdGDQEgAkH9AEcNAkEAQQAoAqgKQQJqNgKoCgtBARAvIQNBACgCqAohAgJAIANB5gBHDQAgAkECakGsCEEGEDUNBwtBACACQQhqNgKoCgJAQQEQLyICQSJGDQAgAkEnRw0HCyAAIAJBABAxDwsgAhAgC0EAQQAoAqgKQQJqIgI2AqgKDAALCwJAAkAgAkFZag4EAwEBAwALIAJBIkYNAgtBACgCqAohBgsgBiABRw0AQQAgAEEKajYCqAoPCyACQSpHIAdxDQNBAC8BkgpB//8DcQ0DQQAoAqgKIQJBACgCrAohAQNAIAIgAU8NAQJAAkAgAi8BACIDQSdGDQAgA0EiRw0BCyAAIAMgCBAxDwtBACACQQJqIgI2AqgKDAALCxArCw8LQQAgAkF+ajYCqAoPC0EAQQAoAqgKQX5qNgKoCgtHAQN/QQAoAqgKQQJqIQBBACgCrAohAQJAA0AgACICQX5qIAFPDQEgAkECaiEAIAIvAQBBdmoOBAEAAAEACwtBACACNgKoCguYAQEDf0EAQQAoAqgKIgFBAmo2AqgKIAFBBmohAUEAKAKsCiECA0ACQAJAAkAgAUF8aiACTw0AIAFBfmovAQAhAwJAAkAgAA0AIANBKkYNASADQXZqDgQCBAQCBAsgA0EqRw0DCyABLwEAQS9HDQJBACABQX5qNgKoCgwBCyABQX5qIQELQQAgATYCqAoPCyABQQJqIQEMAAsLiAEBBH9BACgCqAohAUEAKAKsCiECAkACQANAIAEiA0ECaiEBIAMgAk8NASABLwEAIgQgAEYNAgJAIARB3ABGDQAgBEF2ag4EAgEBAgELIANBBGohASADLwEEQQ1HDQAgA0EGaiABIAMvAQZBCkYbIQEMAAsLQQAgATYCqAoQKw8LQQAgATYCqAoLbAEBfwJAAkAgAEFfaiIBQQVLDQBBASABdEExcQ0BCyAAQUZqQf//A3FBBkkNACAAQSlHIABBWGpB//8DcUEHSXENAAJAIABBpX9qDgQBAAABAAsgAEH9AEcgAEGFf2pB//8DcUEESXEPC0EBCy4BAX9BASEBAkAgAEGcCUEFECMNACAAQZYIQQMQIw0AIABBpglBAhAjIQELIAELRgEDf0EAIQMCQCAAIAJBAXQiAmsiBEECaiIAQQAoAtAJIgVJDQAgACABIAIQNQ0AAkAgACAFRw0AQQEPCyAEECwhAwsgAwuDAQECf0EBIQECQAJAAkACQAJAAkAgAC8BACICQUVqDgQFBAQBAAsCQCACQZt/ag4EAwQEAgALIAJBKUYNBCACQfkARw0DIABBfmpBsglBBhAjDwsgAEF+ai8BAEE9Rg8LIABBfmpBqglBBBAjDwsgAEF+akG+CUEDECMPC0EAIQELIAELtAMBAn9BACEBAkACQAJAAkACQAJAAkACQAJAAkAgAC8BAEGcf2oOFAABAgkJCQkDCQkEBQkJBgkHCQkICQsCQAJAIABBfmovAQBBl39qDgQACgoBCgsgAEF8akHACEECECMPCyAAQXxqQcQIQQMQIw8LAkACQAJAIABBfmovAQBBjX9qDgMAAQIKCwJAIABBfGovAQAiAkHhAEYNACACQewARw0KIABBempB5QAQLQ8LIABBempB4wAQLQ8LIABBfGpByghBBBAjDwsgAEF8akHSCEEGECMPCyAAQX5qLwEAQe8ARw0GIABBfGovAQBB5QBHDQYCQCAAQXpqLwEAIgJB8ABGDQAgAkHjAEcNByAAQXhqQd4IQQYQIw8LIABBeGpB6ghBAhAjDwsgAEF+akHuCEEEECMPC0EBIQEgAEF+aiIAQekAEC0NBCAAQfYIQQUQIw8LIABBfmpB5AAQLQ8LIABBfmpBgAlBBxAjDwsgAEF+akGOCUEEECMPCwJAIABBfmovAQAiAkHvAEYNACACQeUARw0BIABBfGpB7gAQLQ8LIABBfGpBlglBAxAjIQELIAELNAEBf0EBIQECQCAAQXdqQf//A3FBBUkNACAAQYABckGgAUYNACAAQS5HIAAQLnEhAQsgAQswAQF/AkACQCAAQXdqIgFBF0sNAEEBIAF0QY2AgARxDQELIABBoAFGDQBBAA8LQQELTgECf0EAIQECQAJAIAAvAQAiAkHlAEYNACACQesARw0BIABBfmpB7ghBBBAjDwsgAEF+ai8BAEH1AEcNACAAQXxqQdIIQQYQIyEBCyABC94BAQR/QQAoAqgKIQBBACgCrAohAQJAAkACQANAIAAiAkECaiEAIAIgAU8NAQJAAkACQCAALwEAIgNBpH9qDgUCAwMDAQALIANBJEcNAiACLwEEQfsARw0CQQAgAkEEaiIANgKoCkEAQQAvAZIKIgJBAWo7AZIKQQAoApwKIAJBA3RqIgJBBDYCACACIAA2AgQPC0EAIAA2AqgKQQBBAC8BkgpBf2oiADsBkgpBACgCnAogAEH//wNxQQN0aigCAEEDRw0DDAQLIAJBBGohAAwACwtBACAANgKoCgsQKwsLcAECfwJAAkADQEEAQQAoAqgKIgBBAmoiATYCqAogAEEAKAKsCk8NAQJAAkACQCABLwEAIgFBpX9qDgIBAgALAkAgAUF2ag4EBAMDBAALIAFBL0cNAgwECxA0GgwBC0EAIABBBGo2AqgKDAALCxArCws1AQF/QQBBAToA8AlBACgCqAohAEEAQQAoAqwKQQJqNgKoCkEAIABBACgC0AlrQQF1NgKECgtDAQJ/QQEhAQJAIAAvAQAiAkF3akH//wNxQQVJDQAgAkGAAXJBoAFGDQBBACEBIAIQLkUNACACQS5HIAAQMHIPCyABCz0BAn9BACECAkBBACgC0AkiAyAASw0AIAAvAQAgAUcNAAJAIAMgAEcNAEEBDwsgAEF+ai8BABAmIQILIAILaAECf0EBIQECQAJAIABBX2oiAkEFSw0AQQEgAnRBMXENAQsgAEH4/wNxQShGDQAgAEFGakH//wNxQQZJDQACQCAAQaV/aiICQQNLDQAgAkEBRw0BCyAAQYV/akH//wNxQQRJIQELIAELnAEBA39BACgCqAohAQJAA0ACQAJAIAEvAQAiAkEvRw0AAkAgAS8BAiIBQSpGDQAgAUEvRw0EEB4MAgsgABAfDAELAkACQCAARQ0AIAJBd2oiAUEXSw0BQQEgAXRBn4CABHFFDQEMAgsgAhAnRQ0DDAELIAJBoAFHDQILQQBBACgCqAoiA0ECaiIBNgKoCiADQQAoAqwKSQ0ACwsgAgsxAQF/QQAhAQJAIAAvAQBBLkcNACAAQX5qLwEAQS5HDQAgAEF8ai8BAEEuRiEBCyABC9sEAQV/AkAgAUEiRg0AIAFBJ0YNABArDwtBACgCqAohAyABECAgACADQQJqQQAoAqgKQQAoAsQJEAECQCACQQFIDQBBACgC5AlBBEEGIAJBAUYbNgIcC0EAQQAoAqgKQQJqNgKoCkEAEC8hAkEAKAKoCiEBAkACQCACQfcARw0AIAEvAQJB6QBHDQAgAS8BBEH0AEcNACABLwEGQegARg0BC0EAIAFBfmo2AqgKDwtBACABQQhqNgKoCgJAQQEQL0H7AEYNAEEAIAE2AqgKDwtBACgCqAoiBCEDQQAhAANAQQAgA0ECajYCqAoCQAJAAkACQEEBEC8iAkEnRw0AQQAoAqgKIQVBJxAgQQAoAqgKQQJqIQMMAQtBACgCqAohBSACQSJHDQFBIhAgQQAoAqgKQQJqIQMLQQAgAzYCqApBARAvIQIMAQsgAhAyIQJBACgCqAohAwsCQCACQTpGDQBBACABNgKoCg8LQQBBACgCqApBAmo2AqgKAkBBARAvIgJBIkYNACACQSdGDQBBACABNgKoCg8LQQAoAqgKIQYgAhAgQQBBACgC/AkiAkEUajYC/AlBACgCqAohByACIAU2AgAgAkEANgIQIAIgBjYCCCACIAM2AgQgAiAHQQJqNgIMQQBBACgCqApBAmo2AqgKIABBEGpBACgC5AlBIGogABsgAjYCAAJAAkBBARAvIgBBLEYNACAAQf0ARg0BQQAgATYCqAoPC0EAQQAoAqgKQQJqIgM2AqgKIAIhAAwBCwtBACgC5AkiASAENgIQIAFBACgCqApBAmo2AgwLbQECfwJAAkADQAJAIABB//8DcSIBQXdqIgJBF0sNAEEBIAJ0QZ+AgARxDQILIAFBoAFGDQEgACECIAEQLg0CQQAhAkEAQQAoAqgKIgBBAmo2AqgKIAAvAQIiAA0ADAILCyAAIQILIAJB//8DcQurAQEEfwJAAkBBACgCqAoiAi8BACIDQeEARg0AIAEhBCAAIQUMAQtBACACQQRqNgKoCkEBEC8hAkEAKAKoCiEFAkACQCACQSJGDQAgAkEnRg0AIAIQMhpBACgCqAohBAwBCyACECBBAEEAKAKoCkECaiIENgKoCgtBARAvIQNBACgCqAohAgsCQCACIAVGDQAgBSAEQQAgACAAIAFGIgIbQQAgASACGxACCyADC3IBBH9BACgCqAohAEEAKAKsCiEBAkACQANAIABBAmohAiAAIAFPDQECQAJAIAIvAQAiA0Gkf2oOAgEEAAsgAiEAIANBdmoOBAIBAQIBCyAAQQRqIQAMAAsLQQAgAjYCqAoQK0EADwtBACACNgKoCkHdAAtJAQN/QQAhAwJAIAJFDQACQANAIAAtAAAiBCABLQAAIgVHDQEgAUEBaiEBIABBAWohACACQX9qIgINAAwCCwsgBCAFayEDCyADCwviAQIAQYAIC8QBAAB4AHAAbwByAHQAbQBwAG8AcgB0AGYAbwByAGUAdABhAG8AdQByAGMAZQByAG8AbQB1AG4AYwB0AGkAbwBuAHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABBxAkLEAEAAAACAAAAAAQAADA5AAA=`,typeof Buffer<`u`?Buffer.from(e,`base64`):Uint8Array.from(atob(e),(e=>e.charCodeAt(0)));var e},Lv=WebAssembly.compile(Iv()).then(WebAssembly.instantiate).then((({exports:e})=>{J=e}))}));function zv(e){if(e.startsWith(`#!`)){let t=e.indexOf(`
|
|
43
|
+
`);return t===-1?``:e.slice(t+1)}return e}var Bv=i((()=>{}));function Vv(e){let t=Tc(e);for(;t&&t!==`/`;){let e=kc(t,`package.json`);if(W(e))try{let n=new TextDecoder().decode(Ol(e)),r;try{r=JSON.parse(n)}catch(r){Uv.error(`isPackageTypeModule: Failed to parse package.json: ${e}`),Uv.error(`Content (first 200 chars): ${n.slice(0,200)}`);let i=Tc(t);if(i===t)break;t=i;continue}return r.type===`module`}catch(e){}let n=Tc(t);if(n===t)break;t=n}return!1}function Hv(e){let t=Dc(e);if(Uv.trace(`shouldUseESM: ${e} (ext: "${t}")`),t===`.mjs`)return Uv.trace(`shouldUseESM: ${e} -> ESM (mjs extension)`),!0;if(t===`.cjs`)return Uv.trace(`shouldUseESM: ${e} -> CJS (cjs extension)`),!1;if(t===`.js`||t===``){let t=Vv(e);return Uv.trace(`shouldUseESM: ${e} -> ${t?`ESM`:`CJS`} (package.json type)`),!t&&Ev(new TextDecoder().decode(Ol(e)))?(Uv.trace(`shouldUseESM: ${e} -> ESM (detected ESM syntax in file)`),!0):t}return Uv.trace(`shouldUseESM: ${e} -> CJS (default)`),!1}var Uv,Wv=i((()=>{Mc(),au(),Av(),A(),Uv=D(`module-type`)}));function Gv(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return`data:application/json;charset=utf-8;base64,${btoa(n)}`}function Kv(e,t){if(t<=0)return e;let n=JSON.parse(e);return n.mappings=`;`.repeat(t)+n.mappings,JSON.stringify(n)}function qv(e,t,n){let r=e;return n&&(r+=`\n//# sourceMappingURL=${Gv(n)}`),r+=`\n//# sourceURL=${t}`,r}function Jv(e){let t=0;for(let n=0;n<e.length;n++)e[n]===`
|
|
44
|
+
`&&t++;return t}var Yv=i((()=>{}));function Xv(e){let t=null,n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];if(r){a===`
|
|
45
|
+
`&&(r=!1);continue}if(n){a===`*`&&o===`/`&&(n=!1,i++);continue}if(t){a===t&&e[i-1]!==`\\`&&(t=null);continue}if(a===`/`&&o===`/`){r=!0,i++;continue}if(a===`/`&&o===`*`){n=!0,i++;continue}if(a===`"`||a===`'`||a==="`"){t=a;continue}if(e.slice(i,i+5)===`await`&&(i===0||/\s|[;,({[=]/.test(e[i-1]||``))&&(i+5>=e.length||/\s|[;,()[\].]/.test(e[i+5]||``)))return!0}return!1}function Zv(e){let t=``,n=null,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=e[a+1];if(i){t+=o,o===`
|
|
46
|
+
`&&(i=!1);continue}if(r){t+=o,o===`*`&&s===`/`&&(t+=s,r=!1,a++);continue}if(n){t+=o,o===n&&e[a-1]!==`\\`&&(n=null);continue}if(o===`/`&&s===`/`){i=!0,t+=o;continue}if(o===`/`&&s===`*`){r=!0,t+=o+s,a++;continue}if(o===`"`||o===`'`||o==="`"){n=o,t+=o;continue}if(e.slice(a,a+5)===`await`&&(a===0||/\s|[;,({[=]/.test(e[a-1]||``))&&(a+5>=e.length||/\s|[;,()[\].]/.test(e[a+5]||``))){t+=`yield`,a+=4;continue}t+=o}return t}function Qv(e){let t=[];for(let[n,r]of Object.entries(ay))e!=null&&e.has(n)||t.push(`var ${n} = ${r};`);return t.length>0?t.join(`
|
|
47
|
+
`)+`
|
|
48
|
+
`:``}function $v(e,t,n){let r=n==null?void 0:n.filename,i=n==null?void 0:n.importedNames;Ma(e,t,{sourceType:`module`});let a=t.generateMap({source:r==null?`<anonymous>`:r,includeContent:!0,hires:!0}),o=t.toString(),s=Xv(o),c=Qv(i),l=Jv(c),u,d=0;s?(u=oy+(c+Zv(o))+sy,d=Jv(oy)):u=c+o;let f=l+d,p=JSON.stringify(a);return f>0&&(p=Kv(p,f)),{code:u,map:p,hasTLA:s}}function ey(e,t){let n=H(e.pid);function r(e,t){return new e((r,i)=>{let a=()=>{try{r(t())}catch(e){i(e)}};if(n!=null&&n.isRunning()){n.queueMicrotask(a);return}if(typeof queueMicrotask==`function`){queueMicrotask(a);return}e.resolve().then(a).catch(i)})}let i=new Map,a=new Set;function o(e,t){if(Y.trace(`resolveESMSpecifier: specifier="${e}" fromDir="${t}"`),e.startsWith(`file://`)&&(e=e.slice(7)),e.startsWith(`node:`)){let t=e.slice(5);if(bv(t))return t}if(e.includes("${")||e.includes(`#{`))return Y.warn(`resolveESMSpecifier: skipping invalid specifier with template pattern: "${e}"`),`__INVALID_SPECIFIER__:${e}`;let n=yv(e);if(bv(n))return n;if(n.startsWith(`#`)){let e=c(n,t);if(e)return e;throw Error(`Cannot find module '${n}' from '${t}'`)}if(n.startsWith(`/`)){let e=s(n);return Y.trace(`resolveESMSpecifier: absolute path resolved to "${e}"`),e}if(n.startsWith(`./`)||n.startsWith(`../`)){let e=Ac(t,n);Y.trace(`resolveESMSpecifier: relative path "${n}" + fromDir="${t}" = "${e}"`);let r=s(e);return Y.trace(`resolveESMSpecifier: relative resolved to "${r}"`),r}let r,i;if(n.startsWith(`@`)){let e=n.split(`/`);e.length>=2?(r=e[0]+`/`+e[1],i=e.length>2?`./`+e.slice(2).join(`/`):`.`):(r=n,i=`.`)}else{let e=n.indexOf(`/`);e===-1?(r=n,i=`.`):(r=n.slice(0,e),i=`./`+n.slice(e+1))}Y.trace(`resolveESMSpecifier: bare specifier packageName="${r}" subpath="${i}"`);let a=Sv(t);for(let e of a){let t=kc(e,r);if(!W(t)||!Tv(t))continue;if(i===`.`)try{return s(t)}catch(e){continue}let a=kc(t,`package.json`);if(W(a))try{let e=new TextDecoder().decode(Ol(a)),r=JSON.parse(e);if(r.exports){let e=u(t,r.exports,i);if(e)return Y.trace(`resolveESMSpecifier: resolved "${n}" via exports to "${e}"`),e}}catch(e){}let o=kc(t,i.slice(2));try{return s(o)}catch(e){continue}}throw Error(`Cannot find module '${n}' from '${t}'`)}function s(e){if(W(e)&&wv(e))return e;for(let t of[`.js`,`.mjs`,`.json`]){let n=e+t;if(W(n)&&wv(n))return n}if(W(e)&&Tv(e)){let t=kc(e,`package.json`);if(W(t))try{let n=new TextDecoder().decode(Ol(t)),r=JSON.parse(n);if(r.exports){let t=u(e,r.exports,`.`);if(t)return t}if(typeof r.module==`string`){let t=kc(e,r.module);if(W(t))return t}if(typeof r.main==`string`){let t=kc(e,r.main);if(W(t))return t}}catch(e){}for(let t of[`.js`,`.mjs`]){let n=kc(e,`index`+t);if(W(n))return n}}throw Error(`Cannot resolve ESM module: ${e}`)}function c(e,t){let n=t;for(;n!==`/`&&n!==``;){let t=kc(n,`package.json`);if(W(t))try{let r=new TextDecoder().decode(Ol(t)),i=JSON.parse(r);if(i.imports&&typeof i.imports==`object`){let t=i.imports;if(e in t){let r=t[e];return l(n,r)}}}catch(e){}let r=Tc(n);if(r===n)break;n=r}return null}function l(e,t){if(typeof t==`string`){let n=kc(e,t);return W(n)?n:null}if(typeof t==`object`&&t){let n=t;for(let t of[`import`,`node`,`default`])if(t in n)return l(e,n[t])}return null}function u(e,t,n){if(typeof t==`string`){let n=kc(e,t);return W(n)?n:null}if(typeof t==`object`&&t){let r=t;if(n in r)return u(e,r[n],`.`);for(let t of[`import`,`node`,`default`])if(t in r)return u(e,r[t],n);if(`.`in r&&n===`.`)return u(e,r[`.`],`.`)}return null}function d(e){let[t,n]=jv(e),r=[],i=[],a=[],o=[],s=[],c=[];for(let l of t){if(l.d===-2){s.push({start:l.s,end:l.e});continue}if(l.d>=0&&c.push({start:l.ss,end:l.d+1}),l.n){let t=e.slice(l.ss,l.se);if(t.trimStart().startsWith(`export`)&&l.d===-1){let r=t.trimStart();if(r.startsWith(`export *`)||r.startsWith(`export*`))o.push({specifier:l.n,statementStart:l.ss,statementEnd:l.se});else{let t=f(n,l.ss,l.se,e);t.length>0&&a.push({specifier:l.n,names:t,statementStart:l.ss,statementEnd:l.se})}i.push([l.ss,l.se])}else r.push({specifier:l.n,statementStart:l.ss,statementEnd:l.se,isDynamic:l.d>-1}),l.d===-1&&i.push([l.ss,l.se])}}let l=[];for(let e of a)l.push({start:e.statementStart,end:e.statementEnd});for(let e of o)l.push({start:e.statementStart,end:e.statementEnd});let u=[],d=!1;for(let t of n){if(l.some(e=>t.s>=e.start&&t.e<=e.end))continue;t.n===`default`&&(d=!0);let n=m(e,t.s),r=e.slice(n+6).trimStart(),i;i=r.startsWith(`default`)?`default`:r.startsWith(`const`)||r.startsWith(`let`)||r.startsWith(`var`)||r.startsWith(`function`)||r.startsWith(`class`)||r.startsWith(`async`)?`declaration`:`named`,u.push({name:t.n,localName:t.ln,nameStart:t.s,nameEnd:t.e,localStart:t.ls,localEnd:t.le,exportType:i,exportKeywordStart:n})}return{imports:r,exports:u,removeRanges:i,hasDefaultExport:d,reexports:a,starExports:o,importMetaPositions:s,dynamicImportPositions:c}}function f(e,t,n,r){let i=[];for(let a of e)if(a.s>=t&&a.e<=n){let e;e=a.ln?a.ln:a.ls>=0&&a.le>=0?r.slice(a.ls,a.le):p(r,a.s,a.n),i.push({original:e,exported:a.n})}return i}function p(e,t,n){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r>=1&&e.slice(r-1,r+1)===`as`){for(r-=2;r>=0&&/\s/.test(e[r]);)r--;let t=r+1;for(;r>=0&&/[\w$]/.test(e[r]);)r--;let n=r+1;if(n<t)return e.slice(n,t)}return n}function m(e,t){let n=t-1;for(;n>=0;){for(;n>=0&&/\s/.test(e[n]);)n--;if(n>=5&&e.slice(n-5,n+1)===`export`)return n-5;n--}return 0}function h(e,t){let n=t+6;for(;n<e.length&&/\s/.test(e[n]);)n++;for(e.slice(n,n+7)===`default`&&(n+=7);n<e.length&&/\s/.test(e[n]);)n++;return n}function g(e,t){let n=t;for(;n<e.length&&e[n]!==`{`;)n++;if(n>=e.length)return n;let r=1;for(n++;n<e.length&&r>0;)e[n]===`{`?r++:e[n]===`}`&&r--,n++;for(;n<e.length&&/\s/.test(e[n]);)n++;return n<e.length&&e[n]===`;`&&n++,n}function _(e,t){let n={named:[]},r=e.lastIndexOf(` from `);if(r===-1)return n;let i=e.indexOf(`import`)+6,a=e.slice(i,r).trim();if(!a)return n;let o=b(a),s=o.indexOf(`*`);if(s!==-1){let e=o.slice(s+1).trim();if(e.startsWith(`as `)){let t=e.slice(3).trim();t&&v(t)&&(n.namespace=t)}let t=o.slice(0,s).trim();if(t){let e=t.replace(/,\s*$/,``).trim();e&&v(e)&&(n.default=e)}return n}let c=o.indexOf(`{`),l=o.lastIndexOf(`}`);if(c!==-1&&l!==-1&&l>c){let e=o.slice(c+1,l).split(`,`);for(let t of e){let e=t.trim();if(!e)continue;let r=y(e);if(r!==-1){let t=e.slice(0,r).trim(),i=e.slice(r+2).trim();t&&i&&v(t)&&v(i)&&n.named.push({name:t,alias:i})}else v(e)&&n.named.push({name:e})}let t=o.slice(0,c).trim();if(t){let e=t.replace(/,\s*$/,``).trim();e&&v(e)&&(n.default=e)}return n}return v(o)&&(n.default=o),n}function v(e){if(!e)return!1;let t=e.charCodeAt(0);if(!(t>=65&&t<=90||t>=97&&t<=122||t===95||t===36))return!1;for(let t=1;t<e.length;t++){let n=e.charCodeAt(t);if(!(n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57||n===95||n===36))return!1}return!0}function y(e){for(;0<e.length;){let t=e.indexOf(` as `,0);return t===-1?-1:t+1}return-1}function b(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`/`&&e[n+1]===`/`){for(;n<e.length&&e[n]!==`
|
|
49
|
+
`;)n++;continue}if(e[n]===`/`&&e[n+1]===`*`){for(n+=2;n<e.length-1&&!(e[n]===`*`&&e[n+1]===`/`);)n++;n+=2;continue}t+=e[n],n++}return t}function ee(e,t,n){let r=new Eo(e),i=[],a=[],o=[];for(let n of t.imports){if(n.isDynamic)continue;let t=_(e.slice(n.statementStart,n.statementEnd),n.specifier);t.default&&i.push(`const ${t.default} = __imports__["${n.specifier}"].default;`),t.namespace&&i.push(`const ${t.namespace} = __imports__["${n.specifier}"];`);for(let{name:e,alias:r}of t.named){let t=r||e;i.push(`const ${t} = __imports__["${n.specifier}"]["${e}"];`)}r.remove(n.statementStart,n.statementEnd)}for(let e of t.reexports){for(let{original:t,exported:n}of e.names)a.push(`Object.defineProperty(__exports__, "${n}", { get: () => __imports__["${e.specifier}"]["${t}"], enumerable: true });`);r.remove(e.statementStart,e.statementEnd)}for(let e of t.starExports)a.push(`Object.keys(__imports__["${e.specifier}"]).forEach(function(key) { if (key !== "default" && !Object.prototype.hasOwnProperty.call(__exports__, key)) { Object.defineProperty(__exports__, key, { get: function() { return __imports__["${e.specifier}"][key]; }, enumerable: true }); } });`),r.remove(e.statementStart,e.statementEnd);let s=new Map;for(let n of t.exports)if(n.exportType===`default`){let t=h(e,n.exportKeywordStart);r.overwrite(n.exportKeywordStart,t,`__exports__.default = `)}else if(n.exportType===`declaration`){let t=n.exportKeywordStart+6;for(;t<e.length&&/\s/.test(e[t]);)t++;r.remove(n.exportKeywordStart,t),o.push({local:n.name,exported:n.name})}else if(n.exportType===`named`){let e=s.get(n.exportKeywordStart);e?e.push(n):s.set(n.exportKeywordStart,[n])}for(let[t,n]of s){let i=g(e,t);if(!e.slice(i).trimStart().startsWith(`from`)){for(let e of n){let t=e.localName||e.name;o.push({local:t,exported:e.name})}r.remove(t,i)}}for(let{start:e,end:n}of t.importMetaPositions)r.overwrite(e,n,`__import_meta__`);for(let{start:e,end:n}of t.dynamicImportPositions)r.overwrite(e,n,`__dynamicImport__(`);let c=[`"use strict";`,...i,...a].join(`
|
|
50
|
+
`),l=o.map(({local:e,exported:t})=>`Object.defineProperty(__exports__, "${t}", { get: () => ${e}, enumerable: true });`).join(`
|
|
51
|
+
`);return r.prepend(c+`
|
|
52
|
+
`),l&&r.append(`
|
|
53
|
+
`+l),{code:r.toString(),magicString:r}}function te(e){let t=Tc(e.startsWith(`file://`)?e.slice(7):e);return{url:e,resolve:e=>`file://${o(e,t)}`}}function ne(n,r){let s=r||e.cwd;Y.trace(`importModule: specifier="${n}" fromDir="${r}" baseDir="${s}"`);let c=o(n,s);if(Y.trace(`importModule: resolvedPath (before realpath)="${c}"`),c.startsWith(`__INVALID_SPECIFIER__:`)){Y.warn(`importModule: returning empty module for invalid specifier: ${n}`);let e=new cy(`invalid:${n}`);return e.evaluated=!0,e}if(!bv(n))try{let e=Wl(c);e!==c&&(Y.trace(`importModule: realpath resolved "${c}" -> "${e}"`),c=e)}catch(e){}if(bv(n)){let e=n.startsWith(`node:`)?n.slice(5):n;Y.trace(`Loading builtin: ${e}`);let r=new cy(`node:${e}`),i=t._builtinModules.get(e);if(Y.trace(`Builtin ${e}: type=${typeof i}`),i&&(typeof i==`object`||typeof i==`function`)){let e=i;for(let[t,n]of Object.entries(e))r.defineExport(t,()=>n);r.setDefault(e)}return r.evaluated=!0,Y.trace(`Builtin loaded: ${e}`),r}let l=`file://${c}`;if(i.has(l))return i.get(l);if(a.has(l)){let e=i.get(l);if(e)return e;throw Error(`Circular dependency detected: ${l}`)}let u=new cy(l);i.set(l,u),a.add(l);try{let e=new TextDecoder().decode(Ol(c)),n=Dc(c);if(e=zv(e),n===`.json`)try{let t=JSON.parse(e);return u.setDefault(t),u.evaluated=!0,u}catch(e){throw Y.error(`Failed to parse JSON module: ${c}`),e}if(c.endsWith(`.cjs`))return Y.trace(`importModule: "${c}" is CommonJS (.cjs extension), using CJS loader`),x(u,t.createRequire(c)(c)),u;if(n===`.js`&&!Vv(c)&&/\b(module\.exports|exports\.\w+\s*=|require\s*\()/.test(e))return Y.trace(`importModule: "${c}" is CommonJS (package.json type != module, has CJS syntax), using CJS loader`),x(u,t.createRequire(c)(c)),u;let r=d(e),i=new Map,a=new Map;for(let e of r.imports)if(!e.isDynamic){let t=ne(e.specifier,Tc(c));i.set(e.specifier,t.namespace),a.set(e.specifier,t)}for(let e of r.reexports)if(!i.has(e.specifier)){let t=ne(e.specifier,Tc(c));i.set(e.specifier,t.namespace),a.set(e.specifier,t)}for(let e of r.starExports)if(!i.has(e.specifier)){let t=ne(e.specifier,Tc(c));i.set(e.specifier,t.namespace),a.set(e.specifier,t)}let o=new Set;for(let t of r.imports){if(t.isDynamic)continue;let n=_(e.slice(t.statementStart,t.statementEnd),t.specifier);n.default&&o.add(n.default),n.namespace&&o.add(n.namespace);for(let{name:e,alias:t}of n.named)o.add(t||e)}let s=ee(e,r,i),l=$v(e,s.magicString,{filename:c,importedNames:o}),{hasTLA:f}=l;f&&Y.debug(`Top-level await detected in ${c}; wrapping in generator-based async executor.`),Y.debug(`Executing ESM module: ${c}`);let p=te(`file://${c}`),m={},h={};for(let[e,t]of i)h[e]=t;let g=re(`file://${c}`),v=l.code,y=l.map,b=`substrate://${c}`,S=qv(v,b,y);y&&cc(b,y);let C;try{C=Function(`__exports__`,`__imports__`,`__import_meta__`,`__dynamicImport__`,S)}catch(e){throw Y.error(`Failed to parse ESM module: ${c}`),Y.trace(`hasTLA=${f}, transpiled code:\n${v}`),e}for(let e of r.exports)e.exportType===`default`?u.defineExport(`default`,()=>m.default):u.defineExport(e.name,()=>m[e.name]);for(let e of r.reexports)for(let{exported:t}of e.names)u.defineExport(t,()=>m[t]);let w=[];for(let e of a.values())e.tlaPromise&&w.push(e.tlaPromise);let ie=()=>{let e;try{e=C(m,h,p,g)}catch(e){let t=e instanceof Error?e.message:String(e),n=e instanceof Error?e.stack:void 0;throw Y.error(`Failed to execute ESM module: ${c}: ${t}`),n&&Y.error(`Stack: ${n}`),Y.trace(`hasTLA=${f}, transpiled code:\n${v}`),e}if(f&&e!=null&&typeof e.then==`function`)return Y.debug(`ESM module has pending TLA: ${c}`),e.then(()=>{Y.debug(`ESM module TLA resolved: ${c}`),u.evaluated=!0});Y.debug(`ESM module evaluation complete: ${c}`),u.evaluated=!0};if(w.length>0){Y.debug(`ESM module deferred (${w.length} dependency TLA(s) pending): ${c}`);let e=globalThis.Promise,t=()=>{for(let e of Object.keys(m))e===`default`?u.setDefault(m.default):Object.prototype.hasOwnProperty.call(u.namespace,e)||u.defineExport(e,()=>m[e])};return u.tlaPromise=e.all(w).then(()=>{let e=ie();if(e)return e.then(t);t()}),u}let ae=ie();if(ae)return u.tlaPromise=ae,u;for(let[e]of Object.entries(m))e===`default`?u.setDefault(m.default):u.namespace.hasOwnProperty(e)||u.defineExport(e,()=>m[e]);return u}finally{a.delete(l)}}function x(e,t){for(let[n,r]of Object.entries(t))n===`default`?e.setDefault(r):e.defineExport(n,()=>t[n]);`default`in t||e.setDefault(t),e.evaluated=!0}function S(e,t){let n=globalThis.Promise;return r(n,()=>{let n=ne(e,t);return n.tlaPromise?n.tlaPromise.then(()=>n.namespace):n.namespace})}function re(e){let t=Tc(e.startsWith(`file://`)?e.slice(7):e);return e=>{if(Y.trace(`dynamicImport called: specifier="${e}" from moduleDir="${t}"`),e.includes("${")||e.includes(`#{`)){Y.warn(`dynamicImport: skipping invalid specifier with template pattern: "${e}"`);let t=globalThis.Promise;return r(t,()=>({}))}return S(e,t)}}function C(){i.clear()}return{importModule:ne,dynamicImport:S,createDynamicImport:re,clearCache:C}}function ty(){if(!ly)throw Error(`ESM loader not initialized. Call initDefaultLoader(processContext, Module) first.`);return ly}function ny(e,t){ly=ey(e,t)}function ry(e,t){return ty().importModule(e,t)}function iy(e){return ty().createDynamicImport(e)}var Y,ay,oy,sy,cy,ly,uy=i((()=>{Rv(),Do(),Ga(),A(),Mc(),Av(),au(),Bv(),Zo(),Wv(),Yv(),fc(),w(),Y=D(`esm`),ay={global:`globalThis`,process:`globalThis.process`,Buffer:`globalThis.Buffer`,queueMicrotask:`globalThis.queueMicrotask`,setTimeout:`globalThis.setTimeout`,setInterval:`globalThis.setInterval`,setImmediate:`globalThis.setImmediate`,clearTimeout:`globalThis.clearTimeout`,clearInterval:`globalThis.clearInterval`,clearImmediate:`globalThis.clearImmediate`,ReadableStream:`globalThis.ReadableStream`,WritableStream:`globalThis.WritableStream`,TransformStream:`globalThis.TransformStream`,Response:`globalThis.Response`},oy=[`return (function() {`,`var __P = globalThis.Promise;`,`var __g = (function*() {`].join(`
|
|
54
|
+
`)+`
|
|
55
|
+
`,sy=[``,`})();`,`var __s = __g.next(), __v;`,`while (!__s.done) {`,` __v = __s.value;`,` if (__v !== null && __v !== void 0 && typeof __v === 'object' && typeof __v.then === 'function') {`,` if (__v._state === 1) { __s = __g.next(__v._value); continue; }`,` if (__v._state === 2) { __s = __g.throw(__v._value); continue; }`,` break;`,` }`,` __s = __g.next(__v);`,`}`,`if (__s.done) return;`,`function __c(k, a) {`,` try { var i = __g[k](a); var v = i.value; } catch (e) { return __P.reject(e); }`,` if (i.done) return __P.resolve(v);`,` if (v !== null && v !== void 0 && typeof v === 'object' && typeof v.then === 'function') {`,` if (v._state === 1) return __c('next', v._value);`,` if (v._state === 2) return __c('throw', v._value);`,` return __P.resolve(v).then(function(r) { return __c('next', r); }, function(e) { return __c('throw', e); });`,` }`,` return __c('next', v);`,`}`,`return __P.resolve(__v).then(function(r) { return __c('next', r); }, function(e) { return __c('throw', e); });`,`})();`].join(`
|
|
56
|
+
`),cy=class{constructor(e){C(this,`url`,void 0),C(this,`filename`,void 0),C(this,`namespace`,{}),C(this,`evaluated`,!1),C(this,`tlaPromise`,void 0),C(this,`_default`,void 0),C(this,`_exports`,new Map),this.url=e,this.filename=e.startsWith(`file://`)?e.slice(7):e}defineExport(e,t){this._exports.set(e,t),Object.prototype.hasOwnProperty.call(this.namespace,e)||Object.defineProperty(this.namespace,e,{enumerable:!0,configurable:!0,get:t})}setDefault(e){this._default=e,Object.prototype.hasOwnProperty.call(this.namespace,`default`)||Object.defineProperty(this.namespace,`default`,{enumerable:!0,configurable:!0,get:()=>this._default})}getExportNames(){return Array.from(this._exports.keys())}},ly=null}));function dy(e,t){let n=t?`Cannot find module '${e}' from '${t.filename}'`:`Cannot find module '${e}'`,r=Error(n);throw r.code=`MODULE_NOT_FOUND`,r}function fy(e,t){return py(e,t)||hy(e,t)}function py(e,t){if(W(e)&&wv(e))return e;for(let t of Object.keys(ky)){let n=e+t;if(W(n)&&wv(n))return n}return null}function my(e,t,n,r){if(typeof t==`string`)return py(kc(e,t),r);if(typeof t==`object`&&t){let i=t;if(n in i)return my(e,i[n],`.`,r);for(let t of[`require`,`node`,`default`])if(t in i)return my(e,i[t],n,r);if(`.`in i&&n===`.`)return my(e,i[`.`],`.`,r)}return null}function hy(e,t){if(!W(e)||!Tv(e))return null;let n=kc(e,`package.json`);if(W(n))try{let r=new TextDecoder().decode(Ol(n)),i=JSON.parse(r);if(i.exports){let n=my(e,i.exports,`.`,t);if(n)return n}if(typeof i.main==`string`){let n=kc(e,i.main),r=py(n,t);if(r)return r;let a=hy(n,t);if(a)return a}}catch(e){}return py(kc(e,`index`),t)}function gy(e){if(e.startsWith(`@`)){let t=e.split(`/`);return t.length>=2?{packageName:t[0]+`/`+t[1],subpath:t.length>2?t.slice(2).join(`/`):null}:{packageName:e,subpath:null}}let t=e.indexOf(`/`);return t===-1?{packageName:e,subpath:null}:{packageName:e.slice(0,t),subpath:e.slice(t+1)}}function _y(e,t,n,r=null){n.startsWith(`file://`)&&(n=n.slice(7));let i=n.startsWith(`node:`)?n.slice(5):n;if(e._builtinModules.has(i))return n;if(n.startsWith(`/`))return fy(n,e)||dy(n,r);if(n.startsWith(`#`)){let i=r?r.path:t,a=vy(n,i,e);if(a)return a;dy(n,r)}if(n===`.`||n===`..`||n.startsWith(`./`)||n.startsWith(`../`))return fy(Ac(r?r.path:t,n),e)||dy(n,r);let{packageName:a,subpath:o}=gy(n),s=r?r.paths:Sv(t);for(let t of s){let r=kc(t,a);if(o){let t=kc(r,`package.json`);if(W(t))try{let n=new TextDecoder().decode(Ol(t)),i=JSON.parse(n);if(i.exports){let t=`./`+o,n=my(r,i.exports,t,e);if(n)return n}}catch(e){}}let i=fy(kc(t,n),e);if(i)return i}dy(n,r)}function vy(e,t,n){let r=t;for(;r!==`/`&&r!==``;){let t=kc(r,`package.json`);if(W(t))try{let i=new TextDecoder().decode(Ol(t)),a=JSON.parse(i);if(a.imports&&typeof a.imports==`object`){let t=a.imports;if(e in t){let i=t[e];return yy(r,i,n)}}}catch(e){}let i=Tc(r);if(i===r)break;r=i}return null}function yy(e,t,n){if(typeof t==`string`)return fy(kc(e,t),n);if(typeof t==`object`&&t){let r=t;for(let t of[`require`,`node`,`default`])if(t in r)return yy(e,r[t],n)}return null}function by(e,t,n=null){let r=r=>xy(e,t,r,n);return r.resolve=r=>{let i=yv(r),a=_y(e,t.cwd,i,n);try{return Wl(a)}catch(e){return a}},r.cache=e._cache,r.main=e._mainModule,r}function xy(e,t,n,r=null){try{let i=yv(n);i!==n&&Ey.debug(`Aliased ${n} -> ${i}`);let a=i.startsWith(`node:`)?i.slice(5):i;if(e._builtinModules.has(a))return e._builtinModules.get(a);let o=_y(e,t.cwd,i,r);try{let e=Wl(o);e!==o&&(Ey.trace(`realpath: "${o}" -> "${e}"`),o=e)}catch(e){}let s=e._cache.get(o);if(s)return r&&!r.children.includes(s)&&r.children.push(s),s.exports;let c=new e(o,r);e._cache.set(o,c);let l=!0;try{c.load(o),l=!1}finally{l&&e._cache.delete(o)}return c.exports}catch(e){throw Ey.trace(`Failed to require module: ${n}, err=${e instanceof Error?e.message:String(e)}`),e}}function Sy(e,t,n,r,i){let a=i,o=Tc(i),s=by(e,t,n),c=Dy,l=Jv(c),u=[c,`var __cjs_exports__ = exports, __cjs_require__ = require, __cjs_module__ = module;`,`with(globalThis) {`,`(function () {`,`var exports = __cjs_exports__, require = __cjs_require__, module = __cjs_module__;`,r.code,`})();`,`}`].join(`
|
|
57
|
+
`),d=l+4,f=r.map;f&&(f=Kv(f,d));let p=`substrate://${i}`,m=qv(u,p,f);f&&cc(p,f,1);try{var h,g;let e=iy(`file://${i}`);Ey.trace(`<<<< Loading CJS module: ${i} [pid=${t.pid} ; parent=${(h=(g=n.parent)==null?void 0:g.filename)==null?`<no parent>`:h}]`),Function(`exports`,`require`,`module`,`__filename`,`__dirname`,`__dynamicImport__`,m)(n.exports,s,n,a,o,e),Ey.trace(`>>>> Loaded CJS module: ${i} [pid=${t.pid}]`)}catch(e){throw Ey.trace(`Failed to compile CJS module: ${i}, err=${e instanceof Error?e.stack:String(e)}`),e}}function Cy(e){let[t]=jv(e),n=new Eo(e);for(let e of t)e.d>=0&&n.overwrite(e.ss,e.d+1,`__dynamicImport__(`);return n}function wy(e,t){let n=zv(e),r=Cy(n);Ma(n,r,{sourceType:`script`});let i=r.toString(),a=r.generateMap({source:t==null?`<anonymous>`:t,includeContent:!0,hires:!0});return{code:i,map:JSON.stringify(a)}}function Ty(e,t){if(e===`process`)return t;if(e===`events`){let e=t.EventEmitter;if(typeof e==`function`){let t=e;return t.EventEmitter=e,t}}return typeof t==`function`?t:t&&typeof t==`object`?B({},t):t}var Ey,Dy,Oy,ky,Ay,jy=i((()=>{Mc(),A(),Av(),au(),Ga(),Rv(),Do(),Bv(),uy(),Yv(),fc(),uo(),Ey=D(`module`),Dy=[`const Promise = globalThis.Promise;`,`const Buffer = globalThis.Buffer;`,`const global = globalThis;`,`const process = globalThis.process;`,`const queueMicrotask = globalThis.queueMicrotask;`,`const setTimeout = globalThis.setTimeout;`,`const setInterval = globalThis.setInterval;`,`const setImmediate = globalThis.setImmediate;`,`const clearTimeout = globalThis.clearTimeout;`,`const clearInterval = globalThis.clearInterval;`,`const clearImmediate = globalThis.clearImmediate;`,`const ReadableStream = globalThis.ReadableStream;`,`const WritableStream = globalThis.WritableStream;`,`const TransformStream = globalThis.TransformStream;`,`const Response = globalThis.Response;`,`const Function = globalThis.__SubstratePatchedFunction || globalThis.Function;`].join(`
|
|
58
|
+
`),Oy=(e,t,n,r)=>{Sy(e,t,n,wy(new TextDecoder().decode(Ol(r)),r),r)},ky={"":Oy,".js":Oy,".cjs":Oy,".json":(e,t,n,r)=>{var i,a;Ey.trace(`<<<< Loading JSON file: ${r} [pid=${t.pid} ; parent=${(i=(a=n.parent)==null?void 0:a.filename)==null?`<no parent>`:i}]`);let o=new TextDecoder().decode(Ol(r));try{n.exports=JSON.parse(o),Ey.trace(`>>>> Loaded JSON file: ${r} [pid=${t.pid}]`)}catch(e){throw Ey.error(`Failed to parse JSON: ${r}`),e}},".node":()=>{throw Error(`Native modules are not supported in the substrate runtime`)}},Ay=e=>{let t=e.pid,n=function(e=``,t){this.id=e,this.path=Tc(e),this.parent=t==null?null:t,this.exports={},this.children=[],this.filename=null,this.loaded=!1,this.paths=[],t&&t.children.push(this)};n.prototype.load=function(t){if(typeof t!=`string`){let e=TypeError(`The "path" argument must be of type string. Received type ${typeof t}`);throw e.code=`ERR_INVALID_ARG_TYPE`,e}if(this.loaded){let e=Error(`Module ${this.id} has already been loaded`);throw e.code=`ERR_MODULE_ALREADY_LOADED`,e}try{let e=Wl(t);e!==t&&(t=e)}catch(e){}this.filename!=null||(this.filename=t),this.paths=Sv(Tc(this.filename));let r=Dc(t),i=ky[r];if(i)i(n,e,this,t);else throw Error(`No loader for extension: ${r}`)},n.Module=n,n._cache=new Map,n._builtinModules=new Map;for(let[e,t]of xv())n._builtinModules.set(e,Ty(e,t));return n._builtinModules.set(`module`,n),n.isBuiltin=e=>n._builtinModules.has(e),n.builtinModules=Array.from(n._builtinModules.keys()),n._getModulePaths=e=>Sv(e),n._nodeModulePaths=e=>Sv(e),n.createRequire=r=>{let i=typeof r==`string`?r:r.href;Ey.trace(`createRequire[${t}]: ${i}`),i.startsWith(`file://`)&&(i=i.slice(7));try{let e=Wl(i);e!==i&&(i=e)}catch(e){}let a=new n(i);return a.filename=i,a.paths=Sv(Tc(i)),by(n,e,a)},n.wrap=e=>`(function (exports, require, module, __filename, __dirname, __dynamicImport__) {\n${Dy}\nwith(globalThis) {\n(function () {\n${e}\n})();\n}\n})`,n.runMain=e=>{let t=new n(e);n._mainModule=t,t.load(e)},n}}));function My(e){var t;if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(e instanceof Error)return(t=e.stack)==null?e.message:t;if(e instanceof Uint8Array||e instanceof j)return`<Buffer ${Array.from(e.slice(0,50)).map(e=>e.toString(16).padStart(2,`0`)).join(` `)}${e.length>50?`...`:``}>`;try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}function Ny(e){return{log:(...t)=>{let n=t.map(e=>My(e)).join(` `)+`
|
|
59
|
+
`;e.writeStdout(n)},error:(...t)=>{let n=t.map(e=>My(e)).join(` `)+`
|
|
60
|
+
`;e.writeStderr(n)},warn:(...t)=>{let n=t.map(e=>My(e)).join(` `)+`
|
|
61
|
+
`;e.writeStderr(n)},info:(...t)=>{let n=t.map(e=>My(e)).join(` `)+`
|
|
62
|
+
`;e.writeStdout(n)},debug:(...t)=>{let n=t.map(e=>My(e)).join(` `)+`
|
|
63
|
+
`;e.writeStdout(n)},trace:(...t)=>{let n=t.map(e=>My(e)).join(` `)+`
|
|
64
|
+
`;e.writeStderr(n)},assert:()=>{},clear:()=>{},count:()=>{},countReset:()=>{},dir:()=>{},dirxml:()=>{},group:()=>{},groupCollapsed:()=>{},groupEnd:()=>{},table:()=>{},time:()=>{},timeEnd:()=>{},timeLog:()=>{},timeStamp:()=>{},profile:()=>{},profileEnd:()=>{}}}var Py=i((()=>{rn()}));function Fy(e,t,n,r){let i=rr(r.pid,r.kernel,[`node`,`[eval]`],r.cwd,r.env),a=Ny(r);i.stdout=r.stdout,i.stderr=r.stderr,i.nextTick=n.nextTick.bind(n),n.setGlobal(`process`,i),n.setGlobal(`console`,a),n.setGlobal(`Buffer`,j),typeof SharedArrayBuffer>`u`&&n.setGlobal(`SharedArrayBuffer`,ArrayBuffer);let o=Ay(r),s=new o(`[eval]`);s.filename=Ac(r.cwd,`[eval]`),s.paths=o._getModulePaths(r.cwd);let c=by(o,r,s);ny(r,o),n.setGlobal(`require`,c),o._builtinModules.set(`process`,i);let l=s.filename,u=Tc(l),d=(t?`return (${e})`:e)+`
|
|
65
|
+
//# sourceURL=substrate://[eval]`,f=Function(`exports`,`require`,`module`,`__filename`,`__dirname`,d),p=n.runWithGlobals(()=>f(s.exports,c,s,l,u));t&&p!==void 0&&r.writeStdout(String(p)+`
|
|
66
|
+
`)}function Iy(e,t,n){let r=Ac(t,e);if(!W(r))throw Error(`Cannot find module '${e}'`);let i=Ol(r),a=new TextDecoder().decode(i);try{Function(a),n.writeStdout(`Syntax OK
|
|
67
|
+
`)}catch(e){let t=e instanceof Error?e.message:String(e);throw n.writeStderr(`${r}: ${t}\n`),new nr(1)}}function Ly(e,t,n,r,i,a){let o=Ac(r,e);if(!W(o))throw Error(`Cannot find module '${e}'`);let s=rr(a.pid,a.kernel,[`node`,o,...t],r,a.env);Rt.debug(`setupScript: argv=${JSON.stringify([`node`,o,...t])}`);let c=Ny(a);s.stdout=a.stdout,s.stderr=a.stderr,s.nextTick=i.nextTick.bind(i),i.setGlobal(`process`,s),i.setGlobal(`console`,c),i.setGlobal(`Buffer`,j),typeof SharedArrayBuffer>`u`&&i.setGlobal(`SharedArrayBuffer`,ArrayBuffer);let l=Ay(a);l._builtinModules.set(`process`,s),ny(a,l),i.runWithGlobals(()=>{for(let e of n){let t=Ac(r,e);l.runMain(t)}});let u=Hv(o);Rt.debug(`Running ${o} as ${u?`ESM`:`CommonJS`}`),u?(Rt.debug(`setupScript: loading ESM module ${o}`),i.runWithGlobals(()=>{ry(o,Tc(o))}),Rt.debug(`setupScript: ESM module loaded ${o}`)):i.runWithGlobals(()=>{l.runMain(o)})}function Ry(e){let t={print:!1,check:!1,require:[],scriptArgs:[],nodeFlags:[]},n=0;for(;n<e.length;){let o=e[n];if(!o){n++;continue}if(o===`-e`||o===`--eval`){var r;t.eval=(r=e[++n])==null?``:r}else if(o===`-p`||o===`--print`){t.print=!0;let r=e[n+1];n+1<e.length&&r&&!r.startsWith(`-`)&&(t.eval=e[++n])}else if(o===`-c`||o===`--check`)t.check=!0;else if(o===`-r`||o===`--require`){let r=e[++n];r&&t.require.push(r)}else if(o.startsWith(`-e=`)||o.startsWith(`--eval=`)){var i;t.eval=(i=o.split(`=`)[1])==null?``:i}else if(o.startsWith(`-r=`)||o.startsWith(`--require=`)){let e=o.split(`=`)[1];e&&t.require.push(e)}else if(o===`--`){var a;t.script=(a=t.script)==null?e[++n]:a,t.scriptArgs=e.slice(n+1);break}else if(o.startsWith(`-`))t.nodeFlags.push(o),(o===`--inspect`||o===`--inspect-brk`||o===`--title`||o===`--max-old-space-size`)&&n++;else{t.script=o,t.scriptArgs=e.slice(n+1);break}n++}return t}var zy,By=i((()=>{A(),Zo(),tc(),Mc(),ir(),au(),jy(),rn(),uy(),Py(),Wv(),Ke(),zy={commands:[`node`,`nodejs`],install(e){return T(function*(){})()},start(e,t,n,r){let i=Ry(t),a=n.cwd,o=n.pid,s=Yo(o,n.kernel),c=Zs();c.register(o,s,r),c.startProcess(o,()=>{if(i.eval!==void 0)Fy(i.eval,i.print,s,n);else if(i.check)if(i.script)Iy(i.script,a,n);else throw n.writeStderr(`Error: --check requires a file
|
|
68
|
+
`),new nr(1);else if(i.script)Ly(i.script,i.scriptArgs,i.require,a,s,n);else throw n.writeStderr(`Error: Interactive REPL is not supported in Substrate
|
|
69
|
+
`),new nr(1)})}}}));function Vy(e,t){return Lb(e,t||{},0,0)}function Hy(e,t){return Sb(e,{i:2},t&&t.out,t&&t.dictionary)}function Uy(e,t){t||(t={});var n=Fb(),r=e.length;n.p(e);var i=Lb(e,t,Hb(t),8),a=i.length;return zb(i,t),Rb(i,a-8,n.d()),Rb(i,a-4,r),i}function Wy(e,t){var n=Bb(e);return n+8>e.length&&xb(6,`invalid gzip data`),Sb(e.subarray(n,-8),{i:2},t&&t.out||new qy(Vb(e)),t&&t.dictionary)}function Gy(e,t){t||(t={});var n=Ib();n.p(e);var r=Lb(e,t,t.dictionary?6:2,4);return Ub(r,t),Rb(r,r.length-4,n.d()),r}function Ky(e,t){return Sb(e.subarray(Wb(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,X,sb,cb,lb,ub,db,fb,pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb=i((()=>{for(qy=Uint8Array,Jy=Uint16Array,Yy=Int32Array,Xy=new qy([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Zy=new qy([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Qy=new qy([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$y=function(e,t){for(var n=new Jy(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Yy(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},eb=$y(Xy,2),tb=eb.b,nb=eb.r,tb[28]=258,nb[258]=28,rb=$y(Zy,0),ib=rb.b,ab=rb.r,ob=new Jy(32768),X=0;X<32768;++X)sb=(X&43690)>>1|(X&21845)<<1,sb=(sb&52428)>>2|(sb&13107)<<2,sb=(sb&61680)>>4|(sb&3855)<<4,ob[X]=((sb&65280)>>8|(sb&255)<<8)>>1;for(cb=(function(e,t,n){for(var r=e.length,i=0,a=new Jy(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Jy(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Jy(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ob[d]>>c]=l}else for(s=new Jy(r),i=0;i<r;++i)e[i]&&(s[i]=ob[o[e[i]-1]++]>>15-e[i]);return s}),lb=new qy(288),X=0;X<144;++X)lb[X]=8;for(X=144;X<256;++X)lb[X]=9;for(X=256;X<280;++X)lb[X]=7;for(X=280;X<288;++X)lb[X]=8;for(ub=new qy(32),X=0;X<32;++X)ub[X]=5;db=cb(lb,9,0),fb=cb(lb,9,1),pb=cb(ub,5,0),mb=cb(ub,5,1),hb=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},gb=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},_b=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},vb=function(e){return(e+7)/8|0},yb=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new qy(e.subarray(t,n))},bb=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],xb=function(e,t,n){var r=Error(t||bb[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,xb),!n)throw r;return r},Sb=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new qy(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new qy(i*3));var l=function(e){var t=n.length;if(e>t){var r=new qy(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=gb(e,d,1);var v=gb(e,d+1,3);if(d+=3,!v){var y=vb(d)+4,b=e[y-4]|e[y-3]<<8,ee=y+b;if(ee>i){c&&xb(0);break}s&&l(f+b),n.set(e.subarray(y,ee),f),t.b=f+=b,t.p=d=ee*8,t.f=u;continue}else if(v==1)p=fb,m=mb,h=9,g=5;else if(v==2){var te=gb(e,d,31)+257,ne=gb(e,d+10,15)+4,x=te+gb(e,d+5,31)+1;d+=14;for(var S=new qy(x),re=new qy(19),C=0;C<ne;++C)re[Qy[C]]=gb(e,d+C*3,7);d+=ne*3;for(var w=hb(re),ie=(1<<w)-1,ae=cb(re,w,1),C=0;C<x;){var oe=ae[gb(e,d,ie)];d+=oe&15;var y=oe>>4;if(y<16)S[C++]=y;else{var se=0,ce=0;for(y==16?(ce=3+gb(e,d,3),d+=2,se=S[C-1]):y==17?(ce=3+gb(e,d,7),d+=3):y==18&&(ce=11+gb(e,d,127),d+=7);ce--;)S[C++]=se}}var le=S.subarray(0,te),ue=S.subarray(te);h=hb(le),g=hb(ue),p=cb(le,h,1),m=cb(ue,g,1)}else xb(1);if(d>_){c&&xb(0);break}}s&&l(f+131072);for(var de=(1<<h)-1,fe=(1<<g)-1,pe=d;;pe=d){var se=p[_b(e,d)&de],me=se>>4;if(d+=se&15,d>_){c&&xb(0);break}if(se||xb(2),me<256)n[f++]=me;else if(me==256){pe=d,p=null;break}else{var he=me-254;if(me>264){var C=me-257,ge=Xy[C];he=gb(e,d,(1<<ge)-1)+tb[C],d+=ge}var _e=m[_b(e,d)&fe],ve=_e>>4;_e||xb(3),d+=_e&15;var ue=ib[ve];if(ve>3){var ge=Zy[ve];ue+=_b(e,d)&(1<<ge)-1,d+=ge}if(d>_){c&&xb(0);break}s&&l(f+131072);var ye=f+he;if(f<ue){var be=a-ue,xe=Math.min(ue,ye);for(be+f<0&&xb(3);f<xe;++f)n[f]=r[be+f]}for(;f<ye;++f)n[f]=n[f-ue]}}t.l=p,t.p=pe,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?yb(n,0,f):n.subarray(0,f)},Cb=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},wb=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Tb=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Mb,l:0};if(i==1){var o=new qy(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new Jy(f+1),m=Eb(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new qy(p),l:m}},Eb=function(e,t,n){return e.s==-1?Math.max(Eb(e.l,t,n+1),Eb(e.r,t,n+1)):t[e.s]=n},Db=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Jy(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Ob=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},kb=function(e,t,n){var r=n.length,i=vb(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},Ab=function(e,t,n,r,i,a,o,s,c,l,u){Cb(t,u++,n),++i[256];for(var d=Tb(i,15),f=d.t,p=d.l,m=Tb(a,15),h=m.t,g=m.l,_=Db(f),v=_.c,y=_.n,b=Db(h),ee=b.c,te=b.n,ne=new Jy(19),x=0;x<v.length;++x)++ne[v[x]&31];for(var x=0;x<ee.length;++x)++ne[ee[x]&31];for(var S=Tb(ne,7),re=S.t,C=S.l,w=19;w>4&&!re[Qy[w-1]];--w);var ie=l+5<<3,ae=Ob(i,lb)+Ob(a,ub)+o,oe=Ob(i,f)+Ob(a,h)+o+14+3*w+Ob(ne,re)+2*ne[16]+3*ne[17]+7*ne[18];if(c>=0&&ie<=ae&&ie<=oe)return kb(t,u,e.subarray(c,c+l));var se,ce,le,ue;if(Cb(t,u,1+(oe<ae)),u+=2,oe<ae){se=cb(f,p,0),ce=f,le=cb(h,g,0),ue=h;var de=cb(re,C,0);Cb(t,u,y-257),Cb(t,u+5,te-1),Cb(t,u+10,w-4),u+=14;for(var x=0;x<w;++x)Cb(t,u+3*x,re[Qy[x]]);u+=3*w;for(var fe=[v,ee],pe=0;pe<2;++pe)for(var me=fe[pe],x=0;x<me.length;++x){var he=me[x]&31;Cb(t,u,de[he]),u+=re[he],he>15&&(Cb(t,u,me[x]>>5&127),u+=me[x]>>12)}}else se=db,ce=lb,le=pb,ue=ub;for(var x=0;x<s;++x){var ge=r[x];if(ge>255){var he=ge>>18&31;wb(t,u,se[he+257]),u+=ce[he+257],he>7&&(Cb(t,u,ge>>23&31),u+=Xy[he]);var _e=ge&31;wb(t,u,le[_e]),u+=ue[_e],_e>3&&(wb(t,u,ge>>5&8191),u+=Zy[_e])}else wb(t,u,se[ge]),u+=ce[ge]}return wb(t,u,se[256]),u+ce[256]},jb=new Yy([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mb=new qy(0),Nb=function(e,t,n,r,i,a){var o=a.z||e.length,s=new qy(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=jb[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Jy(32768),g=a.h||new Jy(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new Yy(25e3),ee=new Jy(288),te=new Jy(32),ne=0,x=0,S=a.i||0,re=0,C=a.w||0,w=0;S+2<o;++S){var ie=y(S),ae=S&32767,oe=g[ie];if(h[ae]=oe,g[ie]=ae,C<=S){var se=o-S;if((ne>7e3||re>24576)&&(se>423||!l)){u=Ab(e,c,0,b,ee,te,x,re,w,S-w,u),re=ne=x=0,w=S;for(var ce=0;ce<286;++ce)ee[ce]=0;for(var ce=0;ce<30;++ce)te[ce]=0}var le=2,ue=0,de=p,fe=ae-oe&32767;if(se>2&&ie==y(S-fe))for(var pe=Math.min(f,se)-1,me=Math.min(32767,S),he=Math.min(258,se);fe<=me&&--de&&ae!=oe;){if(e[S+le]==e[S+le-fe]){for(var ge=0;ge<he&&e[S+ge]==e[S+ge-fe];++ge);if(ge>le){if(le=ge,ue=fe,ge>pe)break;for(var _e=Math.min(fe,ge-2),ve=0,ce=0;ce<_e;++ce){var ye=S-fe+ce&32767,be=ye-h[ye]&32767;be>ve&&(ve=be,oe=ye)}}}ae=oe,oe=h[ae],fe+=ae-oe&32767}if(ue){b[re++]=268435456|nb[le]<<18|ab[ue];var xe=nb[le]&31,Se=ab[ue]&31;x+=Xy[xe]+Zy[Se],++ee[257+xe],++te[Se],C=S+le,++ne}else b[re++]=e[S],++ee[e[S]]}}for(S=Math.max(S,C);S<o;++S)b[re++]=e[S],++ee[e[S]];u=Ab(e,c,l,b,ee,te,x,re,w,S-w,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=S,a.w=C)}else{for(var S=a.w||0;S<o+l;S+=65535){var Ce=S+65535;Ce>=o&&(c[u/8|0]=l,Ce=o),u=kb(c,u+1,e.subarray(S,Ce))}a.i=o}return yb(s,0,r+vb(u)+i)},Pb=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),Fb=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Pb[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},Ib=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},Lb=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new qy(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return Nb(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Rb=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},zb=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Rb(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},Bb=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&xb(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Vb=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Hb=function(e){return 10+(e.filename?e.filename.length+1:0)},Ub=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=Ib();i.p(t.dictionary),Rb(e,2,i.d())}},Wb=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&xb(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&xb(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2},Gb=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new qy(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(Lb(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||xb(5),this.s.l&&xb(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var r=new qy(n&-32768);r.set(this.b.subarray(0,this.s.z)),this.b=r}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||xb(5),this.s.l&&xb(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),Kb=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new qy(32768),this.p=new qy(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||xb(5),this.d&&xb(4),!this.p.length)this.p=e;else if(e.length){var t=new qy(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=Sb(this.p,this.s,this.o);this.ondata(yb(n,t,this.s.b),this.d),this.o=yb(n,this.s.b-32768),this.s.b=this.o.length,this.p=yb(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),qb=function(){function e(e,t){this.c=Fb(),this.l=0,this.v=1,Gb.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,Gb.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=Lb(e,this.o,this.v&&Hb(this.o),t&&8,this.s);this.v&&(zb(n,this.o),this.v=0),t&&(Rb(n,n.length-8,this.c.d()),Rb(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(){Gb.prototype.flush.call(this)},e}(),Jb=function(){function e(e,t){this.v=1,this.r=0,Kb.call(this,e,t)}return e.prototype.push=function(e,t){if(Kb.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),r=n.length>3?Bb(n):4;if(r>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(r),this.v=0}Kb.prototype.c.call(this,t),this.s.f&&!this.s.l&&!t&&(this.v=vb(this.s.p)+9,this.s={i:0},this.o=new qy(0),this.push(new qy(0),t))},e}(),Yb=function(){function e(e,t){this.c=Ib(),this.v=1,Gb.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),Gb.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=Lb(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(Ub(n,this.o),this.v=0),t&&Rb(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(){Gb.prototype.flush.call(this)},e}(),Xb=function(){function e(e,t){Kb.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Kb.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(Wb(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&xb(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),Kb.prototype.c.call(this,t)},e}(),Zb=typeof TextDecoder<`u`&&new TextDecoder;try{Zb.decode(Mb,{stream:!0})}catch(e){}}));function $b(e,t){let n=!0;for(let r=0;r<lx;r++)if(e[t+r]!==0){n=!1;break}if(n)return null;let r=ex(e,t,100),i=tx(e,t+100,8),a=tx(e,t+124,12),o=new Date(tx(e,t+136,12)*1e3),s=String.fromCharCode(e[t+156]),c=ex(e,t+157,100),l=ex(e,t+257,6),u=l===`ustar`||l===`ustar `,d=r;if(u){let n=ex(e,t+345,155);n&&(d=n+`/`+r)}let f;switch(s){case ux:case dx:f=`file`;break;case px:f=`directory`;break;case fx:f=`symlink`;break;default:f=`file`}return{name:d,type:f,mode:i,size:a,mtime:o,linkname:s===fx?c:void 0}}function ex(e,t,n){let r=t,i=t+n;for(;r<i&&e[r]!==0;)r++;return new TextDecoder().decode(e.subarray(t,r))}function tx(e,t,n){let r=ex(e,t,n).trim();if(!r)return 0;if(e[t]&128){let r=0;for(let i=t+1;i<t+n;i++)r=r*256+e[i];return r}return parseInt(r,8)||0}function*nx(e){let t=0;for(;t<e.length-lx;){let n=$b(e,t);if(!n)break;t+=lx,n.type===`file`&&n.size>0&&(n.content=e.subarray(t,t+n.size),t+=Math.ceil(n.size/cx)*cx),yield n}}function rx(e,t={}){let{strip:n=1,filter:r}=t,i=Wy(e instanceof ArrayBuffer?new Uint8Array(e):e),a=[];for(let e of nx(i)){let t=e.name;if(n>0){let e=t.split(`/`);if(e.length<=n||(t=e.slice(n).join(`/`),!t))continue}e.name=t,!(r&&!r(e))&&(e.type===`directory`&&!e.name.endsWith(`/`)&&(e.name+=`/`),a.push(e))}return a}function ix(e,t,n){return ax.apply(this,arguments)}function ax(){return ax=T(function*(e,t,n,r={}){let i=rx(e,r),a=0,o=0;i.sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name));let s=new Set;return Nt(()=>{for(let e of i){let r=ox(t,e.name),i=sx(r);switch(i&&!s.has(i)&&(n.mkdir(i,!0),s.add(i)),e.type){case`directory`:s.has(r)||(n.mkdir(r,!0),s.add(r),o++);break;case`file`:e.content&&(n.writeFile(r,e.content),a++);break;case`symlink`:if(n.symlink&&e.linkname)try{n.symlink(e.linkname,r)}catch(e){}break}}}),{files:a,directories:o}}),ax.apply(this,arguments)}function ox(...e){return e.join(`/`).replace(/\/+/g,`/`).replace(/\/$/,``)}function sx(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.substring(0,t)}var cx,lx,ux,dx,fx,px,mx=i((()=>{Qb(),A(),Ke(),cx=512,lx=512,ux=`0`,dx=`\0`,fx=`2`,px=`5`}));function hx(){try{return W(gx)}catch(e){return!1}}var gx,_x,vx=i((()=>{mx(),A(),au(),By(),Ke(),gx=`/usr/lib/node_modules/npm/bin/npm-cli.js`,_x={commands:[`npm`],install(e){return T(function*(){if(hx()){Rt.debug(`npm already installed`);return}Rt.debug(`Fetching npm bundle from ${e}...`);let t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch npm bundle: ${t.status}`);let n=yield t.arrayBuffer();Il(`/usr/lib/node_modules`,!0),Il(`/home/user/.npm`,!0),Il(`/home/user/.npm/_logs`,!0),Il(`/home/user/.npm/_cacache`,!0),kl(`/home/user/.npmrc`,new TextEncoder().encode(`cache=/home/user/.npm
|
|
70
|
+
registry=https://registry.npmjs.org/
|
|
71
|
+
`)),Rt.debug(`Extracting npm bundle to /usr/lib/node_modules...`),yield ix(new Uint8Array(n),`/usr/lib/node_modules`,hl,{strip:0})})()},start(e,t,n,r){zy.start(`node`,[gx,...t],n,r)}}})),yx,bx,xx=i((()=>{By(),yx=`/usr/lib/node_modules/npm/bin/npx-cli.js`,bx={commands:[`npx`],start(e,t,n,r){zy.start(`node`,[yx,...t],n,r)}}}));function Sx(){try{return W(Cx)}catch(e){return!1}}var Cx,wx,Tx=i((()=>{mx(),A(),au(),By(),Ke(),Cx=`/usr/lib/node_modules/pnpm/bin/pnpm.cjs`,wx={commands:[`pnpm`],install(e){return T(function*(){if(Sx()){Rt.debug(`pnpm already installed`);return}Rt.debug(`Fetching pnpm bundle from ${e}...`);let t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch pnpm bundle: ${t.status}`);let n=yield t.arrayBuffer();Il(`/usr/lib/node_modules`,!0),Rt.debug(`Extracting pnpm bundle to /usr/lib/node_modules...`),yield ix(new Uint8Array(n),`/usr/lib/node_modules`,hl,{strip:0})})()},start(e,t,n,r){zy.start(`node`,[Cx,...t],n,r)}}}));function Ex(){try{return W(Dx)}catch(e){return!1}}var Dx,Ox,kx=i((()=>{mx(),A(),au(),By(),Ke(),Dx=`/usr/lib/node_modules/yarn/bin/yarn.js`,Ox={commands:[`yarn`,`yarnpkg`],install(e){return T(function*(){if(Ex()){Rt.debug(`yarn already installed`);return}Rt.debug(`Fetching yarn bundle from ${e}...`);let t=yield fetch(e);if(!t.ok)throw Error(`Failed to fetch yarn bundle: ${t.status}`);let n=yield t.arrayBuffer();Il(`/usr/lib/node_modules`,!0),Rt.debug(`Extracting yarn bundle to /usr/lib/node_modules...`),yield ix(new Uint8Array(n),`/usr/lib/node_modules`,hl,{strip:0})})()},start(e,t,n,r){zy.start(`node`,[Dx,...t],n,r)}}}));function Ax(e){let t=e.trim();if(!t)return null;let n=[],r=``,i=!1,a=!1;for(let e=0;e<t.length;e++){let o=t[e];o===`'`&&!a?i=!i:o===`"`&&!i?a=!a:o===` `&&!i&&!a?r&&(n.push(r),r=``):r+=o}return r&&n.push(r),n.length===0?null:{command:n[0],args:n.slice(1)}}var jx,Mx,Nx=i((()=>{Vx(),A(),au(),jx=D(`shell`),Mx={commands:[`sh`,`bash`,`/bin/sh`,`/bin/bash`,`/usr/bin/sh`,`/usr/bin/bash`],start(e,t,n,r){jx.debug(`Shell handler: ${e} ${t.join(` `)}`);let i=t.indexOf(`-c`);if(i===-1)throw Error(`Shell scripts are not supported in Substrate. Only 'sh -c "command"' syntax is supported for simple commands.`);let a=t[i+1];if(!a)throw Error(`Missing command after -c flag`);jx.debug(`Shell command string: ${a}`);let o=Ax(a);if(!o)throw Error(`Could not parse shell command: ${a}`);if(jx.debug(`Parsed command: ${o.command} ${o.args.join(` `)}`),a.includes(`|`))throw Error(`Pipes are not supported in Substrate shell: ${a}`);if(a.includes(`>`)||a.includes(`<`))throw Error(`Redirects are not supported in Substrate shell: ${a}`);if(a.includes(`&&`)||a.includes(`||`))throw Error(`Command chaining is not supported in Substrate shell: ${a}`);if(!Ix(o.command)){var s;let e=(s=o.command.split(`/`).pop())==null?o.command:s;if(Ix(e)){jx.debug(`Resolved ${o.command} to handler for ${e}`),Fx(e).start(e,o.args,n,r);return}let t=`${n.cwd}/node_modules/.bin/${o.command}`;try{Ml(t),jx.debug(`Resolved ${o.command} to ${t}, running as node script`),Fx(`node`).start(`node`,[t,...o.args],n,r);return}catch(e){}if(o.command.startsWith(`/`))try{Ml(o.command),jx.debug(`Running ${o.command} as node script`),Fx(`node`).start(`node`,[o.command,...o.args],n,r);return}catch(e){}throw Error(`Unknown command in shell: ${o.command}. Substrate supports: node, npm, npx, pnpm, yarn. Shell builtins are not supported.`)}Fx(o.command).start(o.command,o.args,n,r)}}}));function Px(e){for(let t of e.commands){let e=Bx.findIndex(e=>e.commands.includes(t));e!==-1&&(zx.debug(`Replacing existing handler for: ${t}`),Bx.splice(e,1))}Bx.push(e),zx.debug(`Registered handler for: ${e.commands.join(`, `)}`)}function Fx(e){let t=Bx.find(t=>t.commands.includes(e));if(!t)throw Error(`Handler not found for command: ${e}`);return t}function Ix(e){return Bx.some(t=>t.commands.includes(e))}function Lx(e){return Rx.apply(this,arguments)}function Rx(){return Rx=T(function*(e){for(let[t,n]of Object.entries(e)){let e;switch(t){case`npm`:e=_x,Px(bx);break;case`pnpm`:e=wx;break;case`yarn`:e=Ox;break;default:throw Error(`Handler not found for binary: ${t}`)}Px(e),e.install&&(yield e.install(n.tarUrl))}}),Rx.apply(this,arguments)}var zx,Bx,Vx=i((()=>{By(),vx(),xx(),Tx(),kx(),Nx(),A(),Ke(),zx=D(`process-handler`),Bx=[zy,Mx]}));function Hx(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}var Ux=i((()=>{}));function Wx(e,t){if(e==null)return{};var n,r,i=Hx(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Gx=i((()=>{Ux()})),Kx=a({ChildProcess:()=>pS,clearHandlers:()=>Xx,clearProcessRegistry:()=>Zx,default:()=>gS,exec:()=>nS,execFile:()=>iS,execFileSync:()=>sS,execSync:()=>oS,fork:()=>tS,registerHandler:()=>Yx,spawn:()=>eS,spawnSync:()=>aS});function qx(e){hS.set(e.pid,e)}function Jx(e){hS.get(e.pid)===e&&hS.delete(e.pid)}function Yx(e){mS.push(e)}function Xx(){mS.length=0}function Zx(){hS.clear()}function Qx(e){return mS.find(t=>t.canHandle(e))}function $x(e){var t;let n=e.split(/[/\\]/);return(t=n[n.length-1])==null?e:t}function eS(e,t,n){let r,i;Array.isArray(t)?(r=t,i=n==null?{}:n):(r=[],i=t==null?{}:t);let a=$x(e),o=e,s=r,c=null;try{c=Fx(a)}catch(t){if(e.startsWith(`/`)&&!e.includes(` `)){Ht.debug(`No handler for ${a}, treating ${e} as node script`),a=`node`,o=`node`,s=[e,...r];try{c=Fx(`node`)}catch(e){c=null}}}let l=Qx(a),u=process.pid,d=null,f=null,p=null,m=null;if(c){var h;let e=rc(),t=(h=i.cwd)==null?process.cwd():h,n=B(B({},process.env),i.env),r=E(`proc_spawn`,{parent_pid:process.pid});u=r.pid,f=r.stdin_fd,p=r.stdout_fd,m=r.stderr_fd,d=e.createChildContext(u,{command:a,ppid:process.pid,cwd:t,env:n,argv:[a,...s],kernel:e.getKernelBridge()})}else{let e=Ot(`proc_spawn`,{parent_pid:process.pid});e&&(u=e.pid,f=e.stdin_fd,p=e.stdout_fd,m=e.stderr_fd)}let g=process.pid,_=new pS(o,s,u,g);f!==null&&p!==null&&m!==null&&_._setStdioFds(f,p,m),_._setupStdio(i),qx(_);let v=H(g);if(v.ref(),Ht.trace(`Refed parent event loop (PID ${g}) for child PID ${u}`),!c&&!l)return v.queuePending(()=>{_._handleError(Error(`spawn ${o} ENOENT: Command not supported. Substrate supports: node, npm, sh. For scripts, use absolute paths.`))}),_;Ht.debug(`Scheduling handler.spawn for ${o} (original: ${e}) args=${JSON.stringify(s)}`);let y=_.pid;return gn(()=>{if(hS.get(y)!==_){Ht.debug(`Skipping handler.spawn for ${e} - child process no longer registered`);return}if(c&&d){_._handleSpawn();let t=null,n=d.exit.bind(d);d.exit=e=>{t=e==null?0:e,n(e)},c.start(a,r,d,(n,r)=>{var i;if(hS.get(y)!==_){Ht.debug(`Skipping _handleExit for ${e} - child process no longer registered`);return}let a=(i=t)==null?n:i;_._handleExit(a,r)});let i=_._stdoutFd===null,o=_._stderrFd===null,s=d.kernel,l=H(g),u=(e,t,n,r,i,a)=>{for(;;){let o=s.syscall(`fs_read_fd`,{pid:g,fd:e,length:16384});if(!o.ok)break;if(o.result.bytes&&o.result.bytes.length>0){let e=o.result.bytes;Ht.trace(`pumpStdio: read ${e.length} bytes from ${i} for child ${y}`),t===`inherit`?s.syscall(`fs_write_fd`,{pid:g,fd:r,bytes:e}):t===`pipe`&&n&&n.pushData(new Uint8Array(e))}if(o.result.eof){Ht.trace(`pumpStdio: ${i} pipe closed for child ${y}`),a();break}if(!o.result.bytes||o.result.bytes.length<16384)break}};!i&&_._stdoutFd!==null&&l.registerFdReadable(_._stdoutFd,()=>{var e;i||u(_._stdoutFd,(e=_._stdioCfg[1])==null?`pipe`:e,_.stdout,1,`stdout`,()=>{i=!0,l.unregisterFdReadable(_._stdoutFd)})}),!o&&_._stderrFd!==null&&l.registerFdReadable(_._stderrFd,()=>{var e;o||u(_._stderrFd,(e=_._stdioCfg[2])==null?`pipe`:e,_.stderr,2,`stderr`,()=>{o=!0,l.unregisterFdReadable(_._stderrFd)})});return}l&&(Ht.debug(`Running handler.spawn for ${e}`),l.spawn(r,i,_).then(()=>{Ht.debug(`handler.spawn completed for ${e}`)}).catch(t=>{Ht.error(`handler.spawn error for ${e}:`,t),_._handleError(t instanceof Error?t:Error(String(t)))}))},0),_}function tS(e,t,n){var r;let i,a;Array.isArray(t)?(i=t,a=n==null?{}:n):(i=[],a=t==null?{}:t);let o={cwd:a.cwd,env:a.env,timeout:a.timeout,killSignal:a.killSignal,signal:a.signal,stdio:a.silent?[`pipe`,`pipe`,`pipe`,`ipc`]:[`inherit`,`inherit`,`inherit`,`ipc`]},s=eS(`node`,[...(r=a.execArgv)==null?[]:r,e,...i],o);return s.connected=!0,s}function nS(e,t,n){let r,i;typeof t==`function`?(i=t,r={}):(r=t==null?{}:t,i=n);let a=rS(e);if(a.length===0){let e=new pS(``,[],-1,process.pid);return H(process.pid).queuePending(()=>e._handleError(Error(`Empty command`))),e}let[o,...s]=a;if(!o){let e=new pS(``,[],-1,process.pid);return H(process.pid).queuePending(()=>e._handleError(Error(`Empty command`))),e}let{encoding:c}=r,l=eS(o,s,B(B({},Wx(r,cS)),{},{shell:!0}));if(i){var u,d,f;let t=``,n=``,a=(u=r.encoding)==null?`utf8`:u;(d=l.stdout)==null||d.on(`data`,e=>{t+=String(e)}),(f=l.stderr)==null||f.on(`data`,e=>{n+=String(e)}),l.on(`close`,r=>{let o=typeof r==`number`?r:null,s=o===0?null:Object.assign(Error(`Command failed: ${e}`),{code:o});a===`buffer`?i(s,j.from(t),j.from(n)):i(s,t,n)}),l.on(`error`,e=>{let t=e instanceof Error?e:Error(String(e));i(t,``,``)})}return l}function rS(e){let t=[],n=``,r=null;for(let i=0;i<e.length;i++){let a=e[i];r?a===r?r=null:n+=a:a===`"`||a===`'`?r=a:a===` `||a===` `?n&&(t.push(n),n=``):n+=a}return n&&t.push(n),t}function iS(e,t,n,r){let i,a,o;typeof t==`function`?(i=[],a={},o=t):Array.isArray(t)?(i=t,typeof n==`function`?(a={},o=n):(a=n==null?{}:n,o=r)):(i=[],a=t==null?{}:t,o=typeof n==`function`?n:r);let{encoding:s,maxBuffer:c}=a,l=Wx(a,lS),u=eS(e,i,l);if(o){var d,f,p,m;let t=``,n=``,r=(d=a.encoding)==null?`utf8`:d,i=(f=a.maxBuffer)==null?1024*1024:f;(p=u.stdout)==null||p.on(`data`,e=>{let n=String(e);if(t.length+n.length>i){u.kill(),u._handleError(Error(`stdout maxBuffer exceeded`));return}t+=n}),(m=u.stderr)==null||m.on(`data`,e=>{let t=String(e);if(n.length+t.length>i){u.kill(),u._handleError(Error(`stderr maxBuffer exceeded`));return}n+=t}),u.on(`close`,i=>{let a=typeof i==`number`?i:null,s=a===0?null:Object.assign(Error(`Command failed: ${e}`),{code:a});r===`buffer`?o(s,j.from(t),j.from(n)):o(s,t,n)}),u.on(`error`,e=>{let t=e instanceof Error?e:Error(String(e));o(t,``,``)})}return u}function aS(e,t,n){throw Error(`spawnSync is not supported in Substrate. Use spawn() with async/await instead.`)}function oS(e,t){throw Error(`execSync is not supported in Substrate. Use exec() with callbacks or promisify instead.`)}function sS(e,t,n){throw Error(`execFileSync is not supported in Substrate. Use execFile() with callbacks or promisify instead.`)}var cS,lS,uS,dS,fS,pS,mS,hS,gS,_S=i((()=>{fs(),rn(),kt(),A(),Vx(),sc(),Zo(),Cn(),w(),uo(),Gx(),cS=[`encoding`],lS=[`encoding`,`maxBuffer`],uS=class{constructor(){C(this,`_events`,new Map)}on(e,t){let n=this._events.get(e);return n||(n=new Set,this._events.set(e,n)),n.add(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.call(this,...r)};return this.on(e,n)}off(e,t){let n=this._events.get(e);return n&&(n.delete(t),n.size===0&&this._events.delete(e)),this}removeListener(e,t){return this.off(e,t)}removeAllListeners(e){return e?this._events.delete(e):this._events.clear(),this}emit(e,...t){let n=this._events.get(e);if(!n||n.size===0)return!1;for(let r of n)try{r.call(this,...t)}catch(t){Ht.error(`Error in event listener for '${e}':`,t)}return!0}listenerCount(e){var t,n;return(t=(n=this._events.get(e))==null?void 0:n.size)==null?0:t}addListener(e,t){return this.on(e,t)}},dS=class extends cs{constructor(e){super(),C(this,`_process`,void 0),this._process=e}_write(e,t,n){let r;if(typeof e==`string`)r=new TextEncoder().encode(e);else if(e instanceof Uint8Array)r=e;else if(e instanceof j)r=e.toUint8Array();else{n(Error(`Invalid chunk type for stdin`));return}let i=this._process._stdinFd;if(i===null){n(Error(`No stdin fd for child PID ${this._process.pid}`));return}Ht.trace(`Writing ${r.length} bytes to stdin fd=${i} of child PID ${this._process.pid}`);try{E(`fs_write_fd`,{pid:this._process._parentPid,fd:i,bytes:r}),n()}catch(e){let t=e.code;if(t===`EPIPE`||t===`EBADF`){Ht.trace(`stdin write failed (${t}) - process may have exited`),n();return}n(e instanceof Error?e:Error(String(e)))}}_final(e){let t=this._process._stdinFd;if(t===null){e();return}Ht.trace(`Closing stdin fd=${t} for child PID ${this._process.pid} (parentPid=${this._process._parentPid})`);try{let e=E(`fs_close_fd`,{pid:this._process._parentPid,fd:t});Ht.trace(`Closed stdin fd=${t} successfully, result=${JSON.stringify(e)}`)}catch(n){if(n.code!==`EBADF`){e(n instanceof Error?n:Error(String(n)));return}Ht.trace(`stdin fd=${t} already closed (EBADF)`)}e()}},fS=class extends ss{constructor(e){super(),C(this,`_pendingData`,[]),C(this,`_flushScheduled`,!1),C(this,`_parentPid`,void 0),this._parentPid=e}_read(){}pushData(e){let t=j.from(e);Ht.trace(`ChildProcessOutput.pushData: queueing ${t.length} bytes`),this._pendingData.push(t),this._scheduleFlush()}_scheduleFlush(){this._flushScheduled||(this._flushScheduled=!0,H(this._parentPid).setImmediate(()=>{this._flushScheduled=!1,this._flushPendingData()}))}_flushPendingData(){for(;this._pendingData.length>0;){let e=this._pendingData.shift();Ht.trace(`ChildProcessOutput._flushPendingData: pushing ${e.length} bytes`),this.push(e)}}pushEnd(){this._flushPendingData(),this.resume(),this.push(null)}},pS=class extends uS{constructor(e,t,n,r){super(),C(this,`pid`,void 0),C(this,`spawnfile`,void 0),C(this,`spawnargs`,void 0),C(this,`stdin`,null),C(this,`stdout`,null),C(this,`stderr`,null),C(this,`connected`,!1),C(this,`exitCode`,null),C(this,`signalCode`,null),C(this,`killed`,!1),C(this,`_exited`,!1),C(this,`_closeEmitted`,!1),C(this,`_refed`,!0),C(this,`_abortController`,null),C(this,`_parentPid`,void 0),C(this,`_stdinFd`,null),C(this,`_stdoutFd`,null),C(this,`_stderrFd`,null),C(this,`_stdioCfg`,[`pipe`,`pipe`,`pipe`]),this.pid=n,this._parentPid=r,this.spawnfile=e,this.spawnargs=[e,...t]}_setStdioFds(e,t,n){this._stdinFd=e,this._stdoutFd=t,this._stderrFd=n}_setupStdio(e){let t=this._normalizeStdio(e.stdio);this._stdioCfg=t,t[0]===`pipe`&&(this.stdin=new dS(this)),t[1]===`pipe`&&(this.stdout=new fS(this._parentPid)),t[2]===`pipe`&&(this.stderr=new fS(this._parentPid))}_normalizeStdio(e){var t,n,r;return e?typeof e==`string`?[e,e,e]:[(t=e[0])==null?`pipe`:t,(n=e[1])==null?`pipe`:n,(r=e[2])==null?`pipe`:r]:[`pipe`,`pipe`,`pipe`]}kill(e){if(this._exited)return!1;let t=typeof e==`number`?e:e==null?`SIGTERM`:e;return this.killed=!0,this.signalCode=typeof t==`string`?t:`SIG${t}`,this._abortController&&this._abortController.abort(),Ot(`proc_kill`,{pid:this.pid,signal:this.signalCode}),!0}send(e,t,n,r){return this.connected?(this.emit(`_send`,e,t,n,r),!0):(r&&r(Error(`Channel closed`)),!1)}disconnect(){this.connected&&(this.connected=!1,this.emit(`disconnect`))}ref(){return!this._refed&&!this._exited&&(this._refed=!0,H(this._parentPid).ref()),this}unref(){return this._refed&&!this._exited&&(this._refed=!1,H(this._parentPid).unref()),this}_handleSpawn(){this.emit(`spawn`)}_handleExit(e,t){if(this._exited)return;if(this._exited=!0,this.killed&&this.signalCode?e!==null&&e>=128?this.exitCode=null:(this.exitCode=e,this.signalCode=null):(this.exitCode=e,this.signalCode=t),Pt(`trace`,`child_process`)){var n,r;let e=Error().stack;Ht.trace(`_handleExit pid=${this.pid} code=${(n=this.exitCode)==null?`null`:n} signal=${(r=this.signalCode)==null?`null`:r}`,e)}Ot(`proc_exit`,{pid:this.pid,exit_code:e==null?0:e}),Jx(this);let i=H(this._parentPid);this._refed&&(i.unref(),Ht.trace(`Unrefed parent event loop (PID ${this._parentPid}) for child PID ${this.pid}`));let a=()=>{this.emit(`exit`,this.exitCode,this.signalCode),this.stdin&&this.stdin.end(),this.stdout&&this.stdout.pushEnd(),this.stderr&&this.stderr.pushEnd(),this._emitClose()};i?i.runWithGlobals(a):a()}_emitClose(){this._closeEmitted||(this._closeEmitted=!0,this.emit(`close`,this.exitCode,this.signalCode))}_handleError(e){this.emit(`error`,e)}_handleMessage(e,t){this.emit(`message`,e,t)}_setAbortController(e){this._abortController=e}},mS=[],hS=new Map,gS={spawn:eS,fork:tS,exec:nS,execFile:iS,spawnSync:aS,execSync:oS,execFileSync:sS,ChildProcess:pS,registerHandler:Yx}})),vS=a({TextDecoder:()=>qS,TextEncoder:()=>KS,callbackify:()=>wS,debuglog:()=>TS,default:()=>YS,deprecate:()=>DS,format:()=>xS,formatWithOptions:()=>bS,inherits:()=>ES,inspect:()=>SS,isArray:()=>OS,isBoolean:()=>kS,isBuffer:()=>HS,isDate:()=>RS,isError:()=>zS,isFunction:()=>BS,isNull:()=>AS,isNullOrUndefined:()=>jS,isNumber:()=>MS,isObject:()=>LS,isPrimitive:()=>VS,isRegExp:()=>IS,isString:()=>NS,isSymbol:()=>PS,isUndefined:()=>FS,promisify:()=>CS,stripVTControlCharacters:()=>US,toUSVString:()=>WS,types:()=>JS});function yS(e,t,n){if(typeof t!=`string`){let r=[];t!==void 0&&r.push(SS(t,e));for(let t of n)r.push(SS(t,e));return r.join(` `)}let r=0,i=n.length,a=String(t).replace(/%[sdjifoO%]/g,t=>{if(t===`%%`)return`%`;if(r>=i)return t;let a=n[r++];switch(t){case`%s`:return String(a);case`%d`:return String(Number(a));case`%i`:return String(parseInt(String(a),10));case`%f`:return String(parseFloat(String(a)));case`%j`:try{return JSON.stringify(a)}catch(e){return`[Circular]`}case`%o`:case`%O`:return SS(a,e);default:return t}});for(;r<i;){let t=n[r++];typeof t!=`object`||!t?a+=` `+t:a+=` `+SS(t,e)}return a}function bS(e,t,...n){return yS(e,t,n)}function xS(e,...t){return yS(void 0,e,t)}function SS(e,t){var n;let r=(n=t==null?void 0:t.depth)==null?2:n;function i(e,t){if(e===null)return`null`;if(e===void 0)return`undefined`;let n=typeof e;if(n===`string`)return`'${String(e)}'`;if(n===`number`||n===`boolean`)return String(e);if(n===`function`)return`[Function: ${e.name||`(anonymous)`}]`;if(n===`symbol`)return String(e);if(n===`bigint`)return`${String(e)}n`;if(t>r)return`[Object]`;if(Array.isArray(e))return e.length===0?`[]`:`[ ${e.map(e=>i(e,t+1)).join(`, `)} ]`;if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return String(e);if(e instanceof Error)return`${e.name}: ${e.message}`;if(e instanceof Map){let n=[...e.entries()].map(([e,n])=>`${i(e,t+1)} => ${i(n,t+1)}`);return`Map(${e.size}) { ${n.join(`, `)} }`}if(e instanceof Set){let n=[...e.values()].map(e=>i(e,t+1));return`Set(${e.size}) { ${n.join(`, `)} }`}let a=Object.keys(e);return a.length===0?`{}`:`{ ${a.map(n=>{let r=e[n];return`${n}: ${i(r,t+1)}`}).join(`, `)} }`}return i(e,0)}function CS(e){return function(...t){return new Promise((n,r)=>{e(...t,(e,t)=>{e?r(e):n(t)})})}}function wS(e){return function(...t){let n=t.pop();Promise.resolve(e(...t)).then(e=>n(null,e)).catch(e=>n(e))}}function TS(e){var t;let n=typeof process<`u`&&((t=process.env)==null?void 0:t.NODE_DEBUG)||``;return RegExp(`\\b${e}\\b`,`i`).test(n)?(...t)=>{var n,r;let i=xS.apply(null,t);console.error(`${e.toUpperCase()} ${(n=(r=process)==null?void 0:r.pid)==null?0:n}: ${i}`)}:()=>{}}function ES(e,t){e.super_=t,Object.setPrototypeOf(e.prototype,t.prototype)}function DS(e,t,n){let r=!1;return function(...n){return r||(console.warn(`DeprecationWarning: ${t}`),r=!0),e.apply(this,n)}}function OS(e){return Array.isArray(e)}function kS(e){return typeof e==`boolean`}function AS(e){return e===null}function jS(e){return e==null}function MS(e){return typeof e==`number`}function NS(e){return typeof e==`string`}function PS(e){return typeof e==`symbol`}function FS(e){return e===void 0}function IS(e){return e instanceof RegExp}function LS(e){return typeof e==`object`&&!!e}function RS(e){return e instanceof Date}function zS(e){return e instanceof Error}function BS(e){return typeof e==`function`}function VS(e){return e===null||typeof e!=`object`&&typeof e!=`function`}function HS(e){var t;return typeof e==`object`&&!!e&&typeof((t=e.constructor)==null?void 0:t.isBuffer)==`function`&&e.constructor.isBuffer(e)}function US(e){return e.replace(GS,``)}function WS(e){return String(e).replace(/[\uD800-\uDFFF]/g,`�`)}var GS,KS,qS,JS,YS,XS=i((()=>{SS.custom=Symbol.for(`nodejs.util.inspect.custom`),CS.custom=Symbol.for(`nodejs.util.promisify.custom`),GS=/[\x00-\x1f\x7f-\x9f]|\x1b\[[0-9;]*[a-zA-Z]/g,KS=globalThis.TextEncoder,qS=globalThis.TextDecoder,JS={isDate:RS,isRegExp:IS,isArray:OS,isArrayBuffer:e=>e instanceof ArrayBuffer,isAnyArrayBuffer:e=>e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer,isAsyncFunction:e=>{var t;return typeof e==`function`&&((t=e.constructor)==null?void 0:t.name)===`AsyncFunction`},isGeneratorFunction:e=>{var t;return typeof e==`function`&&((t=e.constructor)==null?void 0:t.name)===`GeneratorFunction`},isGeneratorObject:e=>typeof e==`object`&&!!e&&typeof e.next==`function`&&typeof e.throw==`function`,isPromise:e=>e instanceof Promise,isMap:e=>e instanceof Map,isSet:e=>e instanceof Set,isWeakMap:e=>e instanceof WeakMap,isWeakSet:e=>e instanceof WeakSet,isDataView:e=>e instanceof DataView,isTypedArray:e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),isNativeError:e=>e instanceof Error,isBoxedPrimitive:e=>typeof e!=`object`||!e?!1:e instanceof Number||e instanceof String||e instanceof Boolean||e instanceof BigInt||e instanceof Symbol,isNumberObject:e=>typeof e==`object`&&!!e&&e instanceof Number,isStringObject:e=>typeof e==`object`&&!!e&&e instanceof String,isBooleanObject:e=>typeof e==`object`&&!!e&&e instanceof Boolean,isUint8Array:e=>e instanceof Uint8Array,isUint16Array:e=>e instanceof Uint16Array,isUint32Array:e=>e instanceof Uint32Array,isInt8Array:e=>e instanceof Int8Array,isInt16Array:e=>e instanceof Int16Array,isInt32Array:e=>e instanceof Int32Array,isFloat32Array:e=>e instanceof Float32Array,isFloat64Array:e=>e instanceof Float64Array,isBigInt64Array:e=>e instanceof BigInt64Array,isBigUint64Array:e=>e instanceof BigUint64Array,isSharedArrayBuffer:e=>typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer,isExternal:e=>!1,isModuleNamespaceObject:e=>!1,isArgumentsObject:e=>!1,isProxy:e=>!1},YS={format:xS,formatWithOptions:bS,inspect:SS,promisify:CS,callbackify:wS,debuglog:TS,inherits:ES,deprecate:DS,isArray:OS,isBoolean:kS,isNull:AS,isNullOrUndefined:jS,isNumber:MS,isString:NS,isSymbol:PS,isUndefined:FS,isRegExp:IS,isObject:LS,isDate:RS,isError:zS,isFunction:BS,isPrimitive:VS,isBuffer:HS,toUSVString:WS,stripVTControlCharacters:US,TextEncoder:KS,TextDecoder:qS,types:JS}})),ZS=a({URL:()=>aC,URLSearchParams:()=>oC,default:()=>sC,domainToASCII:()=>rC,domainToUnicode:()=>iC,fileURLToPath:()=>nC,format:()=>$S,parse:()=>QS,pathToFileURL:()=>tC,resolve:()=>eC});function QS(e,t=!1,n=!1){try{var r;let i=e;n&&e.startsWith(`//`)&&(i=`http:`+e);let a;try{a=new globalThis.URL(i)}catch(e){a=new globalThis.URL(i,`http://localhost`)}return{protocol:a.protocol,slashes:a.protocol?!0:null,auth:a.username?a.password?`${a.username}:${a.password}`:a.username:null,host:a.host||null,port:a.port||null,hostname:a.hostname||null,hash:a.hash||null,search:a.search||null,query:t?Object.fromEntries(a.searchParams):((r=a.search)==null?void 0:r.slice(1))||null,pathname:a.pathname||null,path:(a.pathname||``)+(a.search||``),href:a.href}}catch(t){return{protocol:null,slashes:null,auth:null,host:null,port:null,hostname:null,hash:null,search:null,query:null,pathname:null,path:null,href:e}}}function $S(e){if(typeof e==`string`)return e;if(e instanceof globalThis.URL)return e.href;let t=``;return e.protocol&&(t+=e.protocol,e.protocol.endsWith(`:`)||(t+=`:`)),(e.slashes||e.protocol&&e.host)&&(t+=`//`),e.auth&&(t+=e.auth+`@`),e.host?t+=e.host:(e.hostname&&(t+=e.hostname),e.port&&(t+=`:`+e.port)),e.pathname&&(t+=e.pathname),e.search?t+=e.search.startsWith(`?`)?e.search:`?`+e.search:e.query&&(typeof e.query==`string`?t+=`?`+e.query:t+=`?`+new globalThis.URLSearchParams(e.query).toString()),e.hash&&(t+=e.hash.startsWith(`#`)?e.hash:`#`+e.hash),t}function eC(e,t){try{return new globalThis.URL(t,e).href}catch(e){return t}}function tC(e){let t=e.replace(/\\/g,`/`),n=t.startsWith(`/`)?t:`/`+t;return new globalThis.URL(`file://`+n)}function nC(e){let t=typeof e==`string`?new globalThis.URL(e):e;if(t.protocol!==`file:`)throw TypeError(`The URL must be of scheme file`);return decodeURIComponent(t.pathname)}function rC(e){try{return new globalThis.URL(`http://`+e).hostname}catch(e){return``}}function iC(e){return e}var aC,oC,sC,cC=i((()=>{aC=globalThis.URL,oC=globalThis.URLSearchParams,sC={URL:aC,URLSearchParams:oC,parse:QS,format:$S,resolve:eC,pathToFileURL:tC,fileURLToPath:nC,domainToASCII:rC,domainToUnicode:iC}})),lC=a({decode:()=>hC,default:()=>gC,encode:()=>mC,escape:()=>fC,parse:()=>uC,stringify:()=>dC,unescape:()=>pC});function uC(e,t=`&`,n=`=`,r){let i={};if(!e||typeof e!=`string`)return i;let a=(e.startsWith(`?`)?e.slice(1):e).split(t);for(let e of a){if(!e)continue;let t=e.indexOf(n),r,a;if(t>=0?(r=decodeURIComponent(e.slice(0,t).replace(/\+/g,` `)),a=decodeURIComponent(e.slice(t+1).replace(/\+/g,` `))):(r=decodeURIComponent(e.replace(/\+/g,` `)),a=``),r in i){let e=i[r];Array.isArray(e)?e.push(a):i[r]=[e,a]}else i[r]=a}return i}function dC(e,t=`&`,n=`=`,r){if(!e||typeof e!=`object`)return``;let i=[];for(let[t,r]of Object.entries(e)){let e=encodeURIComponent(t);if(Array.isArray(r))for(let t of r)i.push(`${e}${n}${encodeURIComponent(String(t))}`);else r==null?i.push(e):i.push(`${e}${n}${encodeURIComponent(String(r))}`)}return i.join(t)}function fC(e){return encodeURIComponent(e)}function pC(e){return decodeURIComponent(e.replace(/\+/g,` `))}function mC(e,t,n,r){return dC(e,t,n,r)}function hC(e,t,n,r){return uC(e,t,n,r)}var gC,_C=i((()=>{gC={parse:uC,stringify:dC,escape:fC,unescape:pC,encode:mC,decode:hC}})),vC=a({StringDecoder:()=>bC,default:()=>xC});function yC(e){switch(e.toLowerCase().replace(/-/g,``)){case`utf8`:case`utf-8`:return`utf8`;case`ascii`:return`ascii`;case`binary`:case`latin1`:return`latin1`;case`hex`:return`hex`;case`base64`:return`base64`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;default:return`utf8`}}var bC,xC,SC=i((()=>{w(),bC=class{constructor(e=`utf8`){C(this,`encoding`,void 0),C(this,`lastChar`,void 0),C(this,`lastNeed`,0),C(this,`lastTotal`,0),this.encoding=yC(e),this.lastChar=new Uint8Array(4)}end(e){let t=``;return e&&e.length>0&&(t=this.write(e)),this.lastNeed&&(t+=`�`,this.lastNeed=0),t}write(e){return typeof e==`string`?e:e.length===0?``:this.encoding===`ascii`||this.encoding===`binary`||this.encoding===`latin1`?this.decodeSimple(e):this.encoding===`hex`?this.decodeHex(e):this.encoding===`base64`?this.decodeBase64(e):this.decodeUtf8(e)}decodeSimple(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}decodeHex(e){let t=``;for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,`0`);return t}decodeBase64(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}decodeUtf8(e){let t=``,n=0;if(this.lastNeed>0){let r=Math.min(this.lastNeed,e.length);for(let t=0;t<r;t++)this.lastChar[this.lastTotal-this.lastNeed+t]=e[t];if(this.lastNeed-=r,n=r,this.lastNeed===0)t+=new TextDecoder(`utf-8`).decode(this.lastChar.subarray(0,this.lastTotal));else return``}if(e.length-n>0){let r=n===0?e:e.subarray(n),i=this.checkIncomplete(r);if(i>0){let e=r.length-i;e>0&&(t+=new TextDecoder(`utf-8`).decode(r.subarray(0,e)));for(let t=0;t<i;t++)this.lastChar[t]=r[e+t];this.lastTotal=this.getCharLength(r[e]),this.lastNeed=this.lastTotal-i}else t+=new TextDecoder(`utf-8`).decode(r)}return t}checkIncomplete(e){let t=e.length;if(t===0)return 0;for(let n=Math.min(3,t);n>0;n--){let r=e[t-n],i=this.getCharLength(r);if(i>0&&i>n)return n}return 0}getCharLength(e){return e&128?(e&224)==192?2:(e&240)==224?3:(e&248)==240?4:0:1}},xC={StringDecoder:bC}})),CC=a({ReadStream:()=>TC,WriteStream:()=>EC,default:()=>DC,isatty:()=>wC});function wC(e){return!1}var TC,EC,DC,OC=i((()=>{fs(),w(),TC=class extends ss{constructor(e){super(),C(this,`isTTY`,!1),C(this,`isRaw`,!1),C(this,`fd`,void 0),this.fd=e}setRawMode(e){return this.isRaw=e,this}},EC=class extends cs{constructor(e){super(),C(this,`isTTY`,!1),C(this,`fd`,void 0),C(this,`columns`,80),C(this,`rows`,24),this.fd=e}clearLine(e,t){return t==null||t(),!0}clearScreenDown(e){return e==null||e(),!0}cursorTo(e,t,n){return typeof t==`function`?t():n==null||n(),!0}getWindowSize(){return[this.columns,this.rows]}hasColors(e,t){return!1}getColorDepth(e){return 1}moveCursor(e,t,n){return n==null||n(),!0}},DC={isatty:wC,ReadStream:TC,WriteStream:EC}}));function kC(e,t,n,r){throw n instanceof Error?n:new XC({message:n,actual:e,expected:t,operator:r||`fail`})}function AC(e,t){e||kC(e,!0,t,`==`)}function jC(e,t){e||kC(e,!0,t,`==`)}function MC(e,t,n){e!=t&&kC(e,t,n,`==`)}function NC(e,t,n){e==t&&kC(e,t,n,`!=`)}function PC(e,t,n){e!==t&&kC(e,t,n,`===`)}function FC(e,t,n){e===t&&kC(e,t,n,`!==`)}function IC(e,t,n){BC(e,t,!1)||kC(e,t,n,`deepEqual`)}function LC(e,t,n){BC(e,t,!1)&&kC(e,t,n,`notDeepEqual`)}function RC(e,t,n){BC(e,t,!0)||kC(e,t,n,`deepStrictEqual`)}function zC(e,t,n){BC(e,t,!0)&&kC(e,t,n,`notDeepStrictEqual`)}function BC(e,t,n){if(n?e===t:e==t)return!0;if(e===null||t===null||typeof e!=typeof t)return!1;if(typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!BC(e[r],t[r],n))return!1;return!0}if(Array.isArray(e)!==Array.isArray(t))return!1;let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let a of r)if(!i.includes(a)||!BC(e[a],t[a],n))return!1;return!0}return!1}function VC(e,t,n){let r=!1,i;try{e()}catch(e){r=!0,i=e}if(r||kC(void 0,void 0,n||`Missing expected exception`,`throws`),t){if(typeof t==`string`)return;if(t instanceof RegExp){if(!t.test(String(i)))throw i}else if(typeof t==`function`){if(i instanceof t)return;if(!t(i))throw i}}}function HC(e,t,n){try{e()}catch(e){kC(e,void 0,(typeof t==`string`?t:n)||`Got unwanted exception`,`doesNotThrow`)}}function UC(e,t,n){return WC.apply(this,arguments)}function WC(){return WC=T(function*(e,t,n){let r=!1,i;try{yield typeof e==`function`?e():e}catch(e){r=!0,i=e}if(r||kC(void 0,void 0,n||`Missing expected rejection`,`rejects`),t&&typeof t!=`string`&&t instanceof RegExp&&!t.test(String(i)))throw i}),WC.apply(this,arguments)}function GC(e,t,n){return KC.apply(this,arguments)}function KC(){return KC=T(function*(e,t,n){try{yield typeof e==`function`?e():e}catch(e){kC(e,void 0,(typeof t==`string`?t:n)||`Got unwanted rejection`,`doesNotReject`)}}),KC.apply(this,arguments)}function qC(e){if(e!=null)throw e instanceof Error?e:new XC({actual:e,message:String(e)})}function JC(e,t,n){t.test(e)||kC(e,t,n,`match`)}function YC(e,t,n){t.test(e)&&kC(e,t,n,`doesNotMatch`)}var XC,ZC,QC,$C=i((()=>{w(),Ke(),XC=class extends Error{constructor(e){let{message:t,actual:n,expected:r,operator:i=`==`}=e;super(t||`${String(n)} ${i} ${String(r)}`),C(this,`actual`,void 0),C(this,`expected`,void 0),C(this,`operator`,void 0),C(this,`generatedMessage`,void 0),C(this,`code`,`ERR_ASSERTION`),this.name=`AssertionError`,this.actual=n,this.expected=r,this.operator=i,this.generatedMessage=!t}},ZC=Object.assign((e,t)=>jC(e,t),{AssertionError:XC,fail:kC,ok:jC,equal:PC,notEqual:FC,deepEqual:RC,notDeepEqual:zC,strictEqual:PC,notStrictEqual:FC,deepStrictEqual:RC,notDeepStrictEqual:zC,throws:VC,doesNotThrow:HC,rejects:UC,doesNotReject:GC,ifError:qC,match:JC,doesNotMatch:YC,strict:void 0}),ZC.strict=ZC,QC=Object.assign(AC,{AssertionError:XC,fail:kC,ok:jC,equal:MC,notEqual:NC,deepEqual:IC,notDeepEqual:LC,strictEqual:PC,notStrictEqual:FC,deepStrictEqual:RC,notDeepStrictEqual:zC,throws:VC,doesNotThrow:HC,rejects:UC,doesNotReject:GC,ifError:qC,match:JC,doesNotMatch:YC,strict:ZC})})),ew=a({BrotliCompress:()=>Qw,BrotliDecompress:()=>$w,Deflate:()=>Gw,DeflateRaw:()=>Yw,Gunzip:()=>Jw,Gzip:()=>qw,Inflate:()=>Kw,InflateRaw:()=>Xw,Unzip:()=>Zw,brotliCompress:()=>xw,brotliCompressSync:()=>yw,brotliDecompress:()=>Sw,brotliDecompressSync:()=>bw,constants:()=>Nw,createBrotliCompress:()=>jw,createBrotliDecompress:()=>Mw,createDeflate:()=>ww,createDeflateRaw:()=>Ow,createGunzip:()=>Dw,createGzip:()=>Ew,createInflate:()=>Tw,createInflateRaw:()=>kw,createUnzip:()=>Aw,default:()=>eT,deflate:()=>fw,deflateRaw:()=>gw,deflateRawSync:()=>lw,deflateSync:()=>aw,gunzip:()=>hw,gunzipSync:()=>cw,gzip:()=>mw,gzipSync:()=>sw,inflate:()=>pw,inflateRaw:()=>_w,inflateRawSync:()=>uw,inflateSync:()=>ow,unzip:()=>vw,unzipSync:()=>dw});function tw(e){H(process.pid).queuePending(e)}function nw(e){return j.from(e)}function rw(e){return typeof e==`string`?new TextEncoder().encode(e):j.isBuffer(e)?e.toUint8Array():e}function iw(e){return e===void 0||e===-1?6:Math.max(0,Math.min(9,e))}function aw(e,t){return nw(Gy(rw(e),{level:iw(t==null?void 0:t.level)}))}function ow(e,t){return nw(Ky(rw(e)))}function sw(e,t){return nw(Uy(rw(e),{level:iw(t==null?void 0:t.level)}))}function cw(e,t){return nw(Wy(rw(e)))}function lw(e,t){return nw(Vy(rw(e),{level:iw(t==null?void 0:t.level)}))}function uw(e,t){return nw(Hy(rw(e)))}function dw(e,t){let n=rw(e);try{return nw(Wy(n))}catch(e){return nw(Ky(n))}}function fw(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;try{let t=aw(e,i);tw(()=>r(null,t))}catch(e){tw(()=>r(e))}}function pw(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;try{let t=ow(e,i);tw(()=>r(null,t))}catch(e){tw(()=>r(e))}}function mw(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;try{let t=sw(e,i);tw(()=>r(null,t))}catch(e){tw(()=>r(e))}}function hw(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;try{let t=cw(e,i);tw(()=>r(null,t))}catch(e){tw(()=>r(e))}}function gw(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;try{let t=lw(e,i);tw(()=>r(null,t))}catch(e){tw(()=>r(e))}}function _w(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;try{let t=uw(e,i);tw(()=>r(null,t))}catch(e){tw(()=>r(e))}}function vw(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;try{let t=dw(e,i);tw(()=>r(null,t))}catch(e){tw(()=>r(e))}}function yw(){throw Error(`brotliCompressSync is not supported in Substrate`)}function bw(){throw Error(`brotliDecompressSync is not supported in Substrate`)}function xw(){throw Error(`brotliCompress is not supported in Substrate`)}function Sw(){throw Error(`brotliDecompress is not supported in Substrate`)}function Cw(e,t){let n=function(t){return new e(t)};return Object.defineProperty(n,`name`,{value:t}),n.prototype=e.prototype,n}function ww(e){return new Iw(e)}function Tw(e){return new Lw(e)}function Ew(e){return new Rw(e)}function Dw(e){return new zw(e)}function Ow(e){return new Bw(e)}function kw(e){return new Vw(e)}function Aw(e){return new Hw(e)}function jw(){return new Uw}function Mw(){return new Ww}var Nw,Pw,Fw,Iw,Lw,Rw,zw,Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw,Zw,Qw,$w,eT,tT=i((()=>{Qb(),rn(),fs(),Zo(),w(),Nw={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1},Pw=class{constructor(e){C(this,`_parent`,void 0),C(this,`_closed`,!1),this._parent=e}close(){this._closed=!0}reset(){this._closed=!1,this._parent.reset()}_processChunk(e,t){return this._parent._processChunkInternal(e,t)}},Fw=class extends us{constructor(e){super(),C(this,`_zlibOptions`,void 0),C(this,`_closed`,!1),C(this,`_finished`,!1),C(this,`_errorEmitted`,!1),C(this,`_handle`,void 0),C(this,`_outBuffer`,j.alloc(16384)),C(this,`_fflateStream`,null),C(this,`_pendingOutput`,[]),C(this,`_onFflateData`,(e,t)=>{if(e.length>0){let t=nw(e);this._pendingOutput.push(t),this.push(t)}}),this._zlibOptions=e||{},this._handle=new Pw(this),this._initFflateStream()}_transform(e,t,n){if(this._errorEmitted||this._closed){n();return}try{let t=j.isBuffer(e)?e.toUint8Array():e;this._fflateStream.push(t,!1),n()}catch(e){this._emitError(e,n)}}_flush(e){if(this._errorEmitted||this._closed){e();return}try{this._fflateStream.push(new Uint8Array,!0),this._finished=!0,e()}catch(t){this._emitError(t,e)}}_emitError(e,t){if(this._errorEmitted)return;this._errorEmitted=!0;let n=Error(`zlib: ${e.message}`);n.code=`Z_DATA_ERROR`,n.errno=Nw.Z_DATA_ERROR,this.emit(`error`,n),t&&t(n)}_processChunk(e,t){return this._processChunkInternal(e,t)}_processChunkInternal(e,t){if(!(this._errorEmitted||this._closed)){this._pendingOutput=[];try{let n=j.isBuffer(e)?e.toUint8Array():e,r=t===Nw.Z_FINISH;if((n.length>0||r)&&this._fflateStream.push(n,r),this._pendingOutput.length>0){let e=this._pendingOutput;return this._pendingOutput=[],e}return}catch(e){let t=Error(`zlib: ${e.message}`);throw t.code=`Z_DATA_ERROR`,t.errno=Nw.Z_DATA_ERROR,t}}}write(e,t,n){if(typeof t==`number`){let r=t;if(this._errorEmitted||this._closed)return n&&queueMicrotask(()=>n(null)),!0;try{let t=j.isBuffer(e)?e.toUint8Array():e instanceof Uint8Array?e:new TextEncoder().encode(String(e)),i=r===Nw.Z_FINISH;return(t.length>0||i)&&this._fflateStream.push(t,i),n&&queueMicrotask(()=>n(null)),!0}catch(e){return this._emitError(e),n&&queueMicrotask(()=>n(e)),!1}}return super.write(e,t,n)}close(e){this._closed||(this._closed=!0,e&&queueMicrotask(e),this.emit(`close`))}params(e,t,n){n&&queueMicrotask(n)}reset(){this._errorEmitted=!1,this._finished=!1,this._initFflateStream()}flush(e,t){let n=typeof e==`function`?e:t;if(this._fflateStream&&`flush`in this._fflateStream&&typeof this._fflateStream.flush==`function`)try{this._fflateStream.flush()}catch(e){}n&&queueMicrotask(n)}},Iw=class extends Fw{_initFflateStream(){this._fflateStream=new Yb({level:iw(this._zlibOptions.level)},this._onFflateData),this._fflateStream.ondata=this._onFflateData}},Lw=class extends Fw{_initFflateStream(){this._fflateStream=new Xb(this._onFflateData),this._fflateStream.ondata=this._onFflateData}},Rw=class extends Fw{_initFflateStream(){this._fflateStream=new qb({level:iw(this._zlibOptions.level)},this._onFflateData),this._fflateStream.ondata=this._onFflateData}},zw=class extends Fw{_initFflateStream(){this._fflateStream=new Jb(this._onFflateData),this._fflateStream.ondata=this._onFflateData}},Bw=class extends Fw{_initFflateStream(){this._fflateStream=new Gb({level:iw(this._zlibOptions.level)},this._onFflateData),this._fflateStream.ondata=this._onFflateData}},Vw=class extends Fw{_initFflateStream(){this._fflateStream=new Kb(this._onFflateData),this._fflateStream.ondata=this._onFflateData}},Hw=class extends Fw{constructor(...e){super(...e),C(this,`_headerBytes`,null),C(this,`_detectedFormat`,null)}_initFflateStream(){this._fflateStream=null,this._headerBytes=null,this._detectedFormat=null}_detectAndInit(e){e.length>=2&&e[0]===31&&e[1]===139?(this._detectedFormat=`gzip`,this._fflateStream=new Jb(this._onFflateData)):(this._detectedFormat=`zlib`,this._fflateStream=new Xb(this._onFflateData)),this._fflateStream.ondata=this._onFflateData}_transform(e,t,n){if(this._errorEmitted||this._closed){n();return}try{let t=j.isBuffer(e)?e.toUint8Array():e;if(this._fflateStream)this._fflateStream.push(t,!1);else if(this._headerBytes){let e=new Uint8Array(this._headerBytes.length+t.length);e.set(this._headerBytes,0),e.set(t,this._headerBytes.length),this._headerBytes=null,this._detectAndInit(e),this._fflateStream.push(e,!1)}else t.length>=2?(this._detectAndInit(t),this._fflateStream.push(t,!1)):this._headerBytes=t.slice();n()}catch(e){this._emitError(e,n)}}_flush(e){if(this._errorEmitted||this._closed){e();return}try{!this._fflateStream&&this._headerBytes?(this._detectAndInit(this._headerBytes),this._fflateStream.push(this._headerBytes,!0),this._headerBytes=null):this._fflateStream&&this._fflateStream.push(new Uint8Array,!0),this._finished=!0,e()}catch(t){this._emitError(t,e)}}_processChunkInternal(e,t){if(!(this._errorEmitted||this._closed)){this._pendingOutput=[];try{let n=j.isBuffer(e)?e.toUint8Array():e,r=t===Nw.Z_FINISH;if(this._fflateStream)(n.length>0||r)&&this._fflateStream.push(n,r);else if(this._headerBytes){let e=new Uint8Array(this._headerBytes.length+n.length);e.set(this._headerBytes,0),e.set(n,this._headerBytes.length),this._headerBytes=null,this._detectAndInit(e),this._fflateStream.push(e,r)}else n.length>=2?(this._detectAndInit(n),this._fflateStream.push(n,r)):n.length>0&&(this._headerBytes=n.slice(),r&&(this._detectAndInit(n),this._fflateStream.push(n,!0),this._headerBytes=null));if(this._pendingOutput.length>0){let e=this._pendingOutput;return this._pendingOutput=[],e}return}catch(e){let t=Error(`zlib: ${e.message}`);throw t.code=`Z_DATA_ERROR`,t.errno=Nw.Z_DATA_ERROR,t}}}write(e,t,n){if(typeof t==`number`){let r=t;if(this._errorEmitted||this._closed)return n&&queueMicrotask(()=>n(null)),!0;try{let t=j.isBuffer(e)?e.toUint8Array():e instanceof Uint8Array?e:new TextEncoder().encode(String(e)),i=r===Nw.Z_FINISH;if(this._fflateStream)(t.length>0||i)&&this._fflateStream.push(t,i);else if(this._headerBytes){let e=new Uint8Array(this._headerBytes.length+t.length);e.set(this._headerBytes,0),e.set(t,this._headerBytes.length),this._headerBytes=null,this._detectAndInit(e),this._fflateStream.push(e,i)}else t.length>=2?(this._detectAndInit(t),this._fflateStream.push(t,i)):t.length>0&&(this._headerBytes=t.slice(),i&&(this._detectAndInit(t),this._fflateStream.push(t,!0),this._headerBytes=null));return n&&queueMicrotask(()=>n(null)),!0}catch(e){return this._emitError(e),n&&queueMicrotask(()=>n(e)),!1}}return super.write(e,t,n)}},Uw=class extends Fw{_initFflateStream(){throw Error(`BrotliCompress is not supported in Substrate`)}_transform(e,t,n){n(Error(`BrotliCompress is not supported in Substrate`))}},Ww=class extends Fw{_initFflateStream(){throw Error(`BrotliDecompress is not supported in Substrate`)}_transform(e,t,n){n(Error(`BrotliDecompress is not supported in Substrate`))}},Gw=Cw(Iw,`Deflate`),Kw=Cw(Lw,`Inflate`),qw=Cw(Rw,`Gzip`),Jw=Cw(zw,`Gunzip`),Yw=Cw(Bw,`DeflateRaw`),Xw=Cw(Vw,`InflateRaw`),Zw=Cw(Hw,`Unzip`),Qw=Cw(Uw,`BrotliCompress`),$w=Cw(Ww,`BrotliDecompress`),eT={constants:Nw,deflate:fw,deflateSync:aw,inflate:pw,inflateSync:ow,gzip:mw,gzipSync:sw,gunzip:hw,gunzipSync:cw,deflateRaw:gw,deflateRawSync:lw,inflateRaw:_w,inflateRawSync:uw,unzip:vw,unzipSync:dw,brotliCompress:xw,brotliCompressSync:yw,brotliDecompress:Sw,brotliDecompressSync:bw,Deflate:Gw,Inflate:Kw,Gzip:qw,Gunzip:Jw,DeflateRaw:Yw,InflateRaw:Xw,Unzip:Zw,BrotliCompress:Qw,BrotliDecompress:$w,createDeflate:ww,createInflate:Tw,createGzip:Ew,createGunzip:Dw,createDeflateRaw:Ow,createInflateRaw:kw,createUnzip:Aw,createBrotliCompress:jw,createBrotliDecompress:Mw}})),nT=a({ADDRCONFIG:()=>KT,ADDRGETNETWORKPARAMS:()=>WT,ALL:()=>JT,BADFAMILY:()=>AT,BADFLAGS:()=>zT,BADHINTS:()=>VT,BADNAME:()=>kT,BADQUERY:()=>OT,BADRESP:()=>jT,BADSTR:()=>RT,CANCELLED:()=>GT,CONNREFUSED:()=>MT,DESTRUCTION:()=>LT,EOF:()=>PT,FILE:()=>FT,FORMERR:()=>CT,LOADIPHLPAPI:()=>UT,NODATA:()=>ST,NOMEM:()=>IT,NONAME:()=>BT,NOTFOUND:()=>TT,NOTIMP:()=>ET,NOTINITIALIZED:()=>HT,REFUSED:()=>DT,Resolver:()=>YT,SERVFAIL:()=>wT,TIMEOUT:()=>NT,V4MAPPED:()=>qT,default:()=>ZT,getDefaultResultOrder:()=>xT,getServers:()=>yT,lookup:()=>rT,lookupService:()=>iT,promises:()=>XT,resolve:()=>aT,resolve4:()=>oT,resolve6:()=>sT,resolveCaa:()=>gT,resolveCname:()=>cT,resolveMx:()=>lT,resolveNaptr:()=>mT,resolveNs:()=>uT,resolvePtr:()=>pT,resolveSoa:()=>hT,resolveSrv:()=>fT,resolveTxt:()=>dT,reverse:()=>_T,setDefaultResultOrder:()=>bT,setServers:()=>vT});function rT(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?{}:t;if(e===`localhost`||e===`127.0.0.1`||e===`::1`){let e=i.family===6?6:4,t=e===6?`::1`:`127.0.0.1`;i.all?queueMicrotask(()=>r(null,[{address:t,family:e}])):queueMicrotask(()=>r(null,t,e));return}let a=i.family===6?6:4;i.all?queueMicrotask(()=>r(null,[{address:e,family:a}])):queueMicrotask(()=>r(null,e,a))}function iT(e,t,n){queueMicrotask(()=>n(Error(`dns.lookupService is not supported in Substrate`)))}function aT(e,t,n){let r=typeof t==`function`?t:n;queueMicrotask(()=>r(null,[e]))}function oT(e,t,n){let r=typeof t==`function`?t:n;queueMicrotask(()=>r(null,[e]))}function sT(e,t,n){let r=typeof t==`function`?t:n;queueMicrotask(()=>r(null,[e]))}function cT(e,t){queueMicrotask(()=>t(null,[]))}function lT(e,t){queueMicrotask(()=>t(null,[]))}function uT(e,t){queueMicrotask(()=>t(null,[]))}function dT(e,t){queueMicrotask(()=>t(null,[]))}function fT(e,t){queueMicrotask(()=>t(null,[]))}function pT(e,t){queueMicrotask(()=>t(null,[]))}function mT(e,t){queueMicrotask(()=>t(null,[]))}function hT(e,t){queueMicrotask(()=>t(null,null))}function gT(e,t){queueMicrotask(()=>t(null,[]))}function _T(e,t){queueMicrotask(()=>t(Error(`dns.reverse is not supported in Substrate`)))}function vT(e){}function yT(){return[]}function bT(e){}function xT(){return`verbatim`}var ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT=i((()=>{w(),ST=`ENODATA`,CT=`EFORMERR`,wT=`ESERVFAIL`,TT=`ENOTFOUND`,ET=`ENOTIMP`,DT=`EREFUSED`,OT=`EBADQUERY`,kT=`EBADNAME`,AT=`EBADFAMILY`,jT=`EBADRESP`,MT=`ECONNREFUSED`,NT=`ETIMEOUT`,PT=`EOF`,FT=`EFILE`,IT=`ENOMEM`,LT=`EDESTRUCTION`,RT=`EBADSTR`,zT=`EBADFLAGS`,BT=`ENONAME`,VT=`EBADHINTS`,HT=`ENOTINITIALIZED`,UT=`ELOADIPHLPAPI`,WT=`EADDRGETNETWORKPARAMS`,GT=`ECANCELLED`,KT=0,qT=0,JT=0,YT=class{constructor(){C(this,`resolve`,aT),C(this,`resolve4`,oT),C(this,`resolve6`,sT),C(this,`resolveCname`,cT),C(this,`resolveMx`,lT),C(this,`resolveNs`,uT),C(this,`resolveTxt`,dT),C(this,`resolveSrv`,fT),C(this,`resolvePtr`,pT),C(this,`resolveNaptr`,mT),C(this,`resolveSoa`,hT),C(this,`resolveCaa`,gT),C(this,`reverse`,_T)}cancel(){}setLocalAddress(e,t){}getServers(){return[]}setServers(e){}},XT={lookup:(e,t)=>new Promise((n,r)=>{rT(e,t||{},(e,i,a)=>{e?r(e):t!=null&&t.all?n(i):n({address:i,family:a})})}),lookupService:(e,t)=>Promise.reject(Error(`dns.promises.lookupService is not supported in Substrate`)),resolve:(e,t)=>Promise.resolve([e]),resolve4:(e,t)=>Promise.resolve([e]),resolve6:(e,t)=>Promise.resolve([e]),resolveCname:e=>Promise.resolve([]),resolveMx:e=>Promise.resolve([]),resolveNs:e=>Promise.resolve([]),resolveTxt:e=>Promise.resolve([]),resolveSrv:e=>Promise.resolve([]),resolvePtr:e=>Promise.resolve([]),resolveNaptr:e=>Promise.resolve([]),resolveSoa:e=>Promise.resolve(null),resolveCaa:e=>Promise.resolve([]),reverse:e=>Promise.reject(Error(`dns.promises.reverse is not supported in Substrate`)),setServers:e=>{},getServers:()=>[],setDefaultResultOrder:e=>{},getDefaultResultOrder:()=>`verbatim`,Resolver:YT},ZT={lookup:rT,lookupService:iT,resolve:aT,resolve4:oT,resolve6:sT,resolveCname:cT,resolveMx:lT,resolveNs:uT,resolveTxt:dT,resolveSrv:fT,resolvePtr:pT,resolveNaptr:mT,resolveSoa:hT,resolveCaa:gT,reverse:_T,setServers:vT,getServers:yT,setDefaultResultOrder:bT,getDefaultResultOrder:xT,Resolver:YT,promises:XT,NODATA:ST,FORMERR:CT,SERVFAIL:wT,NOTFOUND:TT,NOTIMP:ET,REFUSED:DT,BADQUERY:OT,BADNAME:kT,BADFAMILY:AT,BADRESP:jT,CONNREFUSED:MT,TIMEOUT:NT,EOF:PT,FILE:FT,NOMEM:IT,DESTRUCTION:LT,BADSTR:RT,BADFLAGS:zT,NONAME:BT,BADHINTS:VT,NOTINITIALIZED:HT,LOADIPHLPAPI:UT,ADDRGETNETWORKPARAMS:WT,CANCELLED:GT,ADDRCONFIG:KT,V4MAPPED:qT,ALL:JT}})),$T=a({DEFAULT_CIPHERS:()=>cE,DEFAULT_ECDH_CURVE:()=>aE,DEFAULT_MAX_VERSION:()=>sE,DEFAULT_MIN_VERSION:()=>oE,Server:()=>uE,TLSSocket:()=>lE,connect:()=>eE,createSecureContext:()=>tE,createServer:()=>nE,default:()=>fE,getCiphers:()=>rE,rootCertificates:()=>iE,rootCertificatesArray:()=>dE});function eE(e,t,n){let r=new lE,i=typeof t==`function`?t:n;return queueMicrotask(()=>{r.emit(`error`,Error(`tls.connect is not supported in Substrate. Use https module or fetch() instead.`))}),i&&r.once(`secureConnect`,i),r}function tE(e){throw Error(`tls.createSecureContext() is not supported in Substrate. Use https module or fetch() instead.`)}function nE(e,t){return new uE(e)}function rE(){return[`TLS_AES_256_GCM_SHA384`,`TLS_CHACHA20_POLY1305_SHA256`,`TLS_AES_128_GCM_SHA256`,`ECDHE-ECDSA-AES256-GCM-SHA384`,`ECDHE-RSA-AES256-GCM-SHA384`,`ECDHE-ECDSA-AES128-GCM-SHA256`,`ECDHE-RSA-AES128-GCM-SHA256`]}function iE(){throw Error(`tls.rootCertificates() is not supported in Substrate.`)}var aE,oE,sE,cE,lE,uE,dE,fE,pE=i((()=>{Qn(),fs(),w(),aE=`auto`,oE=`TLSv1.2`,sE=`TLSv1.3`,cE=`TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256`,lE=class extends ls{constructor(e,t){super(),C(this,`encrypted`,!0),C(this,`authorized`,!0),C(this,`authorizationError`,null),C(this,`alpnProtocol`,!1),C(this,`servername`,null)}getCipher(){throw Error(`TLSSocket.getCipher() is not supported in Substrate. Use https module or fetch() instead.`)}getEphemeralKeyInfo(){throw Error(`TLSSocket.getEphemeralKeyInfo() is not supported in Substrate. Use https module or fetch() instead.`)}getFinished(){throw Error(`TLSSocket.getFinished() is not supported in Substrate. Use https module or fetch() instead.`)}getPeerCertificate(e){throw Error(`TLSSocket.getPeerCertificate() is not supported in Substrate. Use https module or fetch() instead.`)}getPeerFinished(){throw Error(`TLSSocket.getPeerFinished() is not supported in Substrate. Use https module or fetch() instead.`)}getPeerX509Certificate(){throw Error(`TLSSocket.getPeerX509Certificate() is not supported in Substrate. Use https module or fetch() instead.`)}getProtocol(){throw Error(`TLSSocket.getProtocol() is not supported in Substrate. Use https module or fetch() instead.`)}getSession(){throw Error(`TLSSocket.getSession() is not supported in Substrate. Use https module or fetch() instead.`)}getSharedSigalgs(){throw Error(`TLSSocket.getSharedSigalgs() is not supported in Substrate. Use https module or fetch() instead.`)}getTLSTicket(){throw Error(`TLSSocket.getTLSTicket() is not supported in Substrate. Use https module or fetch() instead.`)}getX509Certificate(){throw Error(`TLSSocket.getX509Certificate() is not supported in Substrate. Use https module or fetch() instead.`)}isSessionReused(){throw Error(`TLSSocket.isSessionReused() is not supported in Substrate. Use https module or fetch() instead.`)}renegotiate(e,t){throw Error(`TLSSocket.renegotiate() is not supported in Substrate. Use https module or fetch() instead.`)}setMaxSendFragment(e){throw Error(`TLSSocket.setMaxSendFragment() is not supported in Substrate. Use https module or fetch() instead.`)}disableRenegotiation(){}enableTrace(){}exportKeyingMaterial(e,t,n){throw Error(`TLSSocket.exportKeyingMaterial() is not supported in Substrate. Use https module or fetch() instead.`)}setSession(e){throw Error(`TLSSocket.setSession() is not supported in Substrate. Use https module or fetch() instead.`)}},uE=class extends M{constructor(e,t){super()}addContext(e,t){throw Error(`tls.Server.addContext() is not supported in Substrate.`)}getTicketKeys(){throw Error(`tls.Server.getTicketKeys() is not supported in Substrate.`)}setSecureContext(e){throw Error(`tls.Server.setSecureContext() is not supported in Substrate.`)}setTicketKeys(e){throw Error(`tls.Server.setTicketKeys() is not supported in Substrate.`)}listen(){throw Error(`tls.Server.listen() is not supported in Substrate.`)}close(e){return this}address(){return null}getConnections(e){throw Error(`tls.Server.getConnections() is not supported in Substrate.`)}},dE=[],fE={DEFAULT_ECDH_CURVE:aE,DEFAULT_MIN_VERSION:oE,DEFAULT_MAX_VERSION:sE,DEFAULT_CIPHERS:cE,TLSSocket:lE,Server:uE,connect:eE,createSecureContext:tE,createServer:nE,getCiphers:rE,rootCertificates:dE}})),mE=a({clearImmediate:()=>bE,clearInterval:()=>yE,clearTimeout:()=>vE,default:()=>SE,promises:()=>xE,setImmediate:()=>_E,setInterval:()=>gE,setTimeout:()=>hE});function hE(e,t,...n){return H(process.pid).setTimeout(e,t==null?0:t,...n)}function gE(e,t,...n){return H(process.pid).setInterval(e,t==null?0:t,...n)}function _E(e,...t){return H(process.pid).setImmediate(e,...t)}function vE(e){e!==void 0&&H(process.pid).clearTimeout(e)}function yE(e){e!==void 0&&H(process.pid).clearInterval(e)}function bE(e){e!==void 0&&H(process.pid).clearImmediate(e)}var xE,SE,CE=i((()=>{Zo(),Qe(),tt(),xE={setTimeout:(e,t,n)=>new Promise((r,i)=>{var a;if(!(n==null||(a=n.signal)==null)&&a.aborted){i(new DOMException(`The operation was aborted`,`AbortError`));return}let o=H(process.pid),s=o.setTimeout(()=>r(t),e==null?0:e);n!=null&&n.signal&&n.signal.addEventListener(`abort`,()=>{o.clearTimeout(s),i(new DOMException(`The operation was aborted`,`AbortError`))})}),setInterval:(e,t,n)=>({[Symbol.asyncIterator](){return $e(function*(){var r;let i=H(process.pid);if(!(n==null||(r=n.signal)==null)&&r.aborted)throw new DOMException(`The operation was aborted`,`AbortError`);let a=!0,o=null,s=i.setInterval(()=>{o&&(o(t),o=null)},e==null?0:e);n!=null&&n.signal&&n.signal.addEventListener(`abort`,()=>{a=!1,i.clearInterval(s)});try{for(;a;)yield yield Ze(new Promise((e,t)=>{if(!a){t(new DOMException(`The operation was aborted`,`AbortError`));return}o=e}))}finally{i.clearInterval(s)}})()}}),setImmediate:(e,t)=>{let n=H(process.pid);return new Promise((r,i)=>{var a;if(!(t==null||(a=t.signal)==null)&&a.aborted){i(new DOMException(`The operation was aborted`,`AbortError`));return}let o=n.setImmediate(()=>r(e));t!=null&&t.signal&&t.signal.addEventListener(`abort`,()=>{n.clearImmediate(o),i(new DOMException(`The operation was aborted`,`AbortError`))})})},scheduler:{wait:(e,t)=>{let n=H(process.pid);return new Promise((r,i)=>{var a;if(!(t==null||(a=t.signal)==null)&&a.aborted){i(new DOMException(`The operation was aborted`,`AbortError`));return}let o=n.setTimeout(()=>r(),e==null?0:e);t!=null&&t.signal&&t.signal.addEventListener(`abort`,()=>{n.clearTimeout(o),i(new DOMException(`The operation was aborted`,`AbortError`))})})},yield:()=>{let e=H(process.pid);return new Promise(t=>{e.setImmediate(()=>t())})}}},SE={setTimeout:hE,setInterval:gE,setImmediate:_E,clearTimeout:vE,clearInterval:yE,clearImmediate:bE,promises:xE}})),wE=a({ClientHttp2Session:()=>RE,Http2SecureServer:()=>WE,Http2Server:()=>UE,Http2ServerRequest:()=>VE,Http2ServerResponse:()=>HE,Http2Session:()=>LE,Http2Stream:()=>BE,NGHTTP2_NV_FLAG_NONE:()=>NE,NGHTTP2_NV_FLAG_NO_COPY_NAME:()=>FE,NGHTTP2_NV_FLAG_NO_COPY_VALUE:()=>IE,NGHTTP2_NV_FLAG_NO_INDEX:()=>PE,ServerHttp2Session:()=>zE,connect:()=>TE,constants:()=>ME,createSecureServer:()=>DE,createServer:()=>EE,default:()=>GE,getDefaultSettings:()=>OE,getPackedSettings:()=>kE,getUnpackedSettings:()=>AE,sensitiveHeaders:()=>jE});function TE(e,t,n){throw Error(`http2.connect is not supported in Substrate. Use fetch() which handles HTTP/2 automatically.`)}function EE(e,t){throw Error(`http2.createServer is not supported in Substrate. Use http.createServer() instead.`)}function DE(e,t){throw Error(`http2.createSecureServer is not supported in Substrate. Use http.createServer() instead.`)}function OE(){return{headerTableSize:4096,enablePush:1,initialWindowSize:65535,maxFrameSize:16384,maxConcurrentStreams:4294967295,maxHeaderListSize:65535,enableConnectProtocol:0}}function kE(e){return Buffer.alloc(0)}function AE(e){return OE()}function jE(){return Symbol(`nodejs.http2.sensitiveHeaders`)}var ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE=i((()=>{Qn(),w(),ME={NGHTTP2_SESSION_SERVER:0,NGHTTP2_SESSION_CLIENT:1,NGHTTP2_STREAM_STATE_IDLE:1,NGHTTP2_STREAM_STATE_OPEN:2,NGHTTP2_STREAM_STATE_RESERVED_LOCAL:3,NGHTTP2_STREAM_STATE_RESERVED_REMOTE:4,NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL:5,NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE:6,NGHTTP2_STREAM_STATE_CLOSED:7,NGHTTP2_NO_ERROR:0,NGHTTP2_PROTOCOL_ERROR:1,NGHTTP2_INTERNAL_ERROR:2,NGHTTP2_FLOW_CONTROL_ERROR:3,NGHTTP2_SETTINGS_TIMEOUT:4,NGHTTP2_STREAM_CLOSED:5,NGHTTP2_FRAME_SIZE_ERROR:6,NGHTTP2_REFUSED_STREAM:7,NGHTTP2_CANCEL:8,NGHTTP2_COMPRESSION_ERROR:9,NGHTTP2_CONNECT_ERROR:10,NGHTTP2_ENHANCE_YOUR_CALM:11,NGHTTP2_INADEQUATE_SECURITY:12,NGHTTP2_HTTP_1_1_REQUIRED:13,NGHTTP2_DEFAULT_WEIGHT:16,HTTP2_HEADER_STATUS:`:status`,HTTP2_HEADER_METHOD:`:method`,HTTP2_HEADER_AUTHORITY:`:authority`,HTTP2_HEADER_SCHEME:`:scheme`,HTTP2_HEADER_PATH:`:path`,HTTP2_HEADER_PROTOCOL:`:protocol`,HTTP2_HEADER_ACCEPT_ENCODING:`accept-encoding`,HTTP2_HEADER_ACCEPT_LANGUAGE:`accept-language`,HTTP2_HEADER_ACCEPT_RANGES:`accept-ranges`,HTTP2_HEADER_ACCEPT:`accept`,HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS:`access-control-allow-credentials`,HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS:`access-control-allow-headers`,HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS:`access-control-allow-methods`,HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN:`access-control-allow-origin`,HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS:`access-control-expose-headers`,HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE:`access-control-max-age`,HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS:`access-control-request-headers`,HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD:`access-control-request-method`,HTTP2_HEADER_AGE:`age`,HTTP2_HEADER_AUTHORIZATION:`authorization`,HTTP2_HEADER_CACHE_CONTROL:`cache-control`,HTTP2_HEADER_CONNECTION:`connection`,HTTP2_HEADER_CONTENT_DISPOSITION:`content-disposition`,HTTP2_HEADER_CONTENT_ENCODING:`content-encoding`,HTTP2_HEADER_CONTENT_LENGTH:`content-length`,HTTP2_HEADER_CONTENT_TYPE:`content-type`,HTTP2_HEADER_COOKIE:`cookie`,HTTP2_HEADER_DATE:`date`,HTTP2_HEADER_ETAG:`etag`,HTTP2_HEADER_FORWARDED:`forwarded`,HTTP2_HEADER_HOST:`host`,HTTP2_HEADER_IF_MODIFIED_SINCE:`if-modified-since`,HTTP2_HEADER_IF_NONE_MATCH:`if-none-match`,HTTP2_HEADER_IF_RANGE:`if-range`,HTTP2_HEADER_LAST_MODIFIED:`last-modified`,HTTP2_HEADER_LINK:`link`,HTTP2_HEADER_LOCATION:`location`,HTTP2_HEADER_RANGE:`range`,HTTP2_HEADER_REFERER:`referer`,HTTP2_HEADER_SERVER:`server`,HTTP2_HEADER_SET_COOKIE:`set-cookie`,HTTP2_HEADER_STRICT_TRANSPORT_SECURITY:`strict-transport-security`,HTTP2_HEADER_TRANSFER_ENCODING:`transfer-encoding`,HTTP2_HEADER_TE:`te`,HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS:`upgrade-insecure-requests`,HTTP2_HEADER_UPGRADE:`upgrade`,HTTP2_HEADER_USER_AGENT:`user-agent`,HTTP2_HEADER_VARY:`vary`,HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS:`x-content-type-options`,HTTP2_HEADER_X_FRAME_OPTIONS:`x-frame-options`,HTTP2_HEADER_KEEP_ALIVE:`keep-alive`,HTTP2_HEADER_PROXY_CONNECTION:`proxy-connection`,HTTP2_HEADER_X_XSS_PROTECTION:`x-xss-protection`,HTTP2_HEADER_ALT_SVC:`alt-svc`,HTTP2_HEADER_CONTENT_SECURITY_POLICY:`content-security-policy`,HTTP2_HEADER_EARLY_DATA:`early-data`,HTTP2_HEADER_EXPECT_CT:`expect-ct`,HTTP2_HEADER_ORIGIN:`origin`,HTTP2_HEADER_PURPOSE:`purpose`,HTTP2_HEADER_TIMING_ALLOW_ORIGIN:`timing-allow-origin`,HTTP2_HEADER_X_FORWARDED_FOR:`x-forwarded-for`,HTTP2_HEADER_PRIORITY:`priority`,HTTP2_HEADER_ACCEPT_CHARSET:`accept-charset`,HTTP2_HEADER_ACCESS_CONTROL_MAX_AGE_LOWERCASE:`access-control-max-age`,HTTP2_HEADER_ALT_USED:`alt-used`,HTTP2_HEADER_CONTENT_LANGUAGE:`content-language`,HTTP2_HEADER_CONTENT_LOCATION:`content-location`,HTTP2_HEADER_CONTENT_MD5:`content-md5`,HTTP2_HEADER_CONTENT_RANGE:`content-range`,HTTP2_HEADER_DNT:`dnt`,HTTP2_HEADER_EXPECT:`expect`,HTTP2_HEADER_EXPIRES:`expires`,HTTP2_HEADER_FROM:`from`,HTTP2_HEADER_IF_MATCH:`if-match`,HTTP2_HEADER_IF_UNMODIFIED_SINCE:`if-unmodified-since`,HTTP2_HEADER_MAX_FORWARDS:`max-forwards`,HTTP2_HEADER_PREFER:`prefer`,HTTP2_HEADER_PROXY_AUTHENTICATE:`proxy-authenticate`,HTTP2_HEADER_PROXY_AUTHORIZATION:`proxy-authorization`,HTTP2_HEADER_REFRESH:`refresh`,HTTP2_HEADER_RETRY_AFTER:`retry-after`,HTTP2_HEADER_TRAILER:`trailer`,HTTP2_HEADER_TK:`tk`,HTTP2_HEADER_VIA:`via`,HTTP2_HEADER_WARNING:`warning`,HTTP2_HEADER_WWW_AUTHENTICATE:`www-authenticate`,HTTP2_HEADER_HTTP2_SETTINGS:`http2-settings`,HTTP2_METHOD_ACL:`ACL`,HTTP2_METHOD_BASELINE_CONTROL:`BASELINE-CONTROL`,HTTP2_METHOD_BIND:`BIND`,HTTP2_METHOD_CHECKIN:`CHECKIN`,HTTP2_METHOD_CHECKOUT:`CHECKOUT`,HTTP2_METHOD_CONNECT:`CONNECT`,HTTP2_METHOD_COPY:`COPY`,HTTP2_METHOD_DELETE:`DELETE`,HTTP2_METHOD_GET:`GET`,HTTP2_METHOD_HEAD:`HEAD`,HTTP2_METHOD_LABEL:`LABEL`,HTTP2_METHOD_LINK:`LINK`,HTTP2_METHOD_LOCK:`LOCK`,HTTP2_METHOD_MERGE:`MERGE`,HTTP2_METHOD_MKACTIVITY:`MKACTIVITY`,HTTP2_METHOD_MKCALENDAR:`MKCALENDAR`,HTTP2_METHOD_MKCOL:`MKCOL`,HTTP2_METHOD_MKREDIRECTREF:`MKREDIRECTREF`,HTTP2_METHOD_MKWORKSPACE:`MKWORKSPACE`,HTTP2_METHOD_MOVE:`MOVE`,HTTP2_METHOD_OPTIONS:`OPTIONS`,HTTP2_METHOD_ORDERPATCH:`ORDERPATCH`,HTTP2_METHOD_PATCH:`PATCH`,HTTP2_METHOD_POST:`POST`,HTTP2_METHOD_PRI:`PRI`,HTTP2_METHOD_PROPFIND:`PROPFIND`,HTTP2_METHOD_PROPPATCH:`PROPPATCH`,HTTP2_METHOD_PUT:`PUT`,HTTP2_METHOD_REBIND:`REBIND`,HTTP2_METHOD_REPORT:`REPORT`,HTTP2_METHOD_SEARCH:`SEARCH`,HTTP2_METHOD_TRACE:`TRACE`,HTTP2_METHOD_UNBIND:`UNBIND`,HTTP2_METHOD_UNCHECKOUT:`UNCHECKOUT`,HTTP2_METHOD_UNLINK:`UNLINK`,HTTP2_METHOD_UNLOCK:`UNLOCK`,HTTP2_METHOD_UPDATE:`UPDATE`,HTTP2_METHOD_UPDATEREDIRECTREF:`UPDATEREDIRECTREF`,HTTP2_METHOD_VERSION_CONTROL:`VERSION-CONTROL`},NE=0,PE=1,FE=2,IE=4,LE=class extends M{constructor(...e){super(...e),C(this,`alpnProtocol`,`h2`),C(this,`closed`,!1),C(this,`connecting`,!1),C(this,`destroyed`,!1),C(this,`encrypted`,!0),C(this,`localSettings`,{}),C(this,`originSet`,[]),C(this,`pendingSettingsAck`,!1),C(this,`remoteSettings`,{}),C(this,`socket`,null),C(this,`state`,{}),C(this,`type`,0)}close(e){this.closed=!0}destroy(e,t){this.destroyed=!0}goaway(e,t,n){}ping(e,t){return!1}ref(){}unref(){}setLocalWindowSize(e){}setTimeout(e,t){}settings(e,t){}},RE=class extends LE{constructor(...e){super(...e),C(this,`type`,ME.NGHTTP2_SESSION_CLIENT)}request(e,t){throw Error(`http2.ClientHttp2Session.request is not supported in Substrate. Use fetch() instead.`)}},zE=class extends LE{constructor(...e){super(...e),C(this,`type`,ME.NGHTTP2_SESSION_SERVER)}altsvc(e,t){}origin(...e){}},BE=class extends M{constructor(...e){super(...e),C(this,`aborted`,!1),C(this,`bufferSize`,0),C(this,`closed`,!1),C(this,`destroyed`,!1),C(this,`endAfterHeaders`,!1),C(this,`id`,void 0),C(this,`pending`,!0),C(this,`rstCode`,0),C(this,`sentHeaders`,{}),C(this,`sentInfoHeaders`,[]),C(this,`sentTrailers`,{}),C(this,`session`,void 0),C(this,`state`,{})}close(e,t){this.closed=!0}destroy(e){this.destroyed=!0}priority(e){}setTimeout(e,t){}sendTrailers(e){}},VE=class extends M{constructor(...e){super(...e),C(this,`aborted`,!1),C(this,`authority`,``),C(this,`complete`,!1),C(this,`headers`,{}),C(this,`httpVersion`,`2.0`),C(this,`httpVersionMajor`,2),C(this,`httpVersionMinor`,0),C(this,`method`,`GET`),C(this,`rawHeaders`,[]),C(this,`rawTrailers`,[]),C(this,`scheme`,`https`),C(this,`socket`,null),C(this,`stream`,void 0),C(this,`trailers`,{}),C(this,`url`,`/`)}destroy(e){}setTimeout(e,t){}},HE=class extends M{constructor(...e){super(...e),C(this,`finished`,!1),C(this,`headersSent`,!1),C(this,`sendDate`,!0),C(this,`socket`,null),C(this,`statusCode`,200),C(this,`statusMessage`,``),C(this,`stream`,void 0)}addTrailers(e){}end(e,t,n){return this.finished=!0,this}getHeader(e){}getHeaderNames(){return[]}getHeaders(){return{}}hasHeader(e){return!1}removeHeader(e){}setHeader(e,t){return this}setTimeout(e,t){}write(e,t,n){return!0}writeContinue(){}writeEarlyHints(e){}writeHead(e,t,n){return this.headersSent=!0,this}createPushResponse(e,t){}},UE=class extends M{setTimeout(e,t){return this}close(e){return this}listen(){throw Error(`http2.Http2Server.listen is not supported in Substrate. Use http.createServer() instead.`)}},WE=class extends UE{},GE={constants:ME,connect:TE,createServer:EE,createSecureServer:DE,getDefaultSettings:OE,getPackedSettings:kE,getUnpackedSettings:AE,sensitiveHeaders:jE,Http2Session:LE,ClientHttp2Session:RE,ServerHttp2Session:zE,Http2Stream:BE,Http2ServerRequest:VE,Http2ServerResponse:HE,Http2Server:UE,Http2SecureServer:WE}})),qE=a({DefaultDeserializer:()=>sD,DefaultSerializer:()=>oD,Deserializer:()=>aD,Serializer:()=>iD,cachedDataVersionTag:()=>rD,default:()=>cD,deserialize:()=>$E,getHeapCodeStatistics:()=>XE,getHeapSnapshot:()=>tD,getHeapSpaceStatistics:()=>YE,getHeapStatistics:()=>JE,serialize:()=>QE,setFlagsFromString:()=>ZE,setHeapSnapshotNearHeapLimit:()=>nD,writeHeapSnapshot:()=>eD});function JE(){return{total_heap_size:50*1024*1024,total_heap_size_executable:5*1024*1024,total_physical_size:50*1024*1024,total_available_size:1024*1024*1024,used_heap_size:25*1024*1024,heap_size_limit:2048*1024*1024,malloced_memory:1024*1024,peak_malloced_memory:2*1024*1024,does_zap_garbage:0,number_of_native_contexts:1,number_of_detached_contexts:0,total_global_handles_size:1024,used_global_handles_size:512,external_memory:0}}function YE(){return[{space_name:`new_space`,space_size:2*1024*1024,space_used_size:1*1024*1024,space_available_size:1*1024*1024,physical_space_size:2*1024*1024},{space_name:`old_space`,space_size:20*1024*1024,space_used_size:15*1024*1024,space_available_size:5*1024*1024,physical_space_size:20*1024*1024},{space_name:`code_space`,space_size:5*1024*1024,space_used_size:3*1024*1024,space_available_size:2*1024*1024,physical_space_size:5*1024*1024},{space_name:`large_object_space`,space_size:10*1024*1024,space_used_size:5*1024*1024,space_available_size:5*1024*1024,physical_space_size:10*1024*1024}]}function XE(){return{code_and_metadata_size:1024*1024,bytecode_and_metadata_size:512*1024,external_script_source_size:256*1024,cpu_profiler_metadata_size:0}}function ZE(e){}function QE(e){try{let t=JSON.stringify(e);return j.from(t,`utf-8`)}catch(e){throw Error(`v8.serialize: Value is not serializable`)}}function $E(e){try{let t=e.toString(`utf-8`);return JSON.parse(t)}catch(e){throw Error(`v8.deserialize: Invalid serialized data`)}}function eD(e){throw Error(`v8.writeHeapSnapshot is not supported in Substrate`)}function tD(){throw Error(`v8.getHeapSnapshot is not supported in Substrate`)}function nD(e){}function rD(){return 0}var iD,aD,oD,sD,cD,lD=i((()=>{rn(),w(),iD=class{constructor(){C(this,`_buffer`,j.alloc(0))}writeHeader(){}writeValue(e){try{return this._buffer=QE(e),!0}catch(e){return!1}}releaseBuffer(){let e=this._buffer;return this._buffer=j.alloc(0),e}transferArrayBuffer(e,t){}writeUint32(e){}writeUint64(e,t){}writeDouble(e){}writeRawBytes(e){}},aD=class{constructor(e){C(this,`_buffer`,void 0),C(this,`_offset`,0),this._buffer=e}readHeader(){return!0}readValue(){return $E(this._buffer)}transferArrayBuffer(e,t){}getWireFormatVersion(){return 15}readUint32(){return 0}readUint64(){return[0,0]}readDouble(){return 0}readRawBytes(e){return j.alloc(0)}},oD=class extends iD{},sD=class extends aD{},cD={getHeapStatistics:JE,getHeapSpaceStatistics:YE,getHeapCodeStatistics:XE,setFlagsFromString:ZE,serialize:QE,deserialize:$E,Serializer:iD,Deserializer:aD,DefaultSerializer:oD,DefaultDeserializer:sD,writeHeapSnapshot:eD,getHeapSnapshot:tD,setHeapSnapshotNearHeapLimit:nD,cachedDataVersionTag:rD}})),uD=a({BroadcastChannel:()=>ND,MessageChannel:()=>AD,MessagePort:()=>kD,NodeMessageChannel:()=>AD,NodeMessagePort:()=>kD,SHARE_ENV:()=>CD,Worker:()=>jD,clearWorkerRegistry:()=>dD,default:()=>PD,getEnvironmentData:()=>yD,isMainThread:()=>wD,isMarkedAsUntransferable:()=>vD,markAsUntransferable:()=>_D,moveMessagePortToContext:()=>hD,parentPort:()=>TD,receiveMessageOnPort:()=>gD,resourceLimits:()=>OD,setEnvironmentData:()=>bD,threadId:()=>DD,workerData:()=>ED});function dD(){for(let e of SD)_n(e);SD.clear()}function fD(e,t,n,r,i){var a;let o=r.cwd,s=t.eval===!0,c=s?`[worker eval]`:Ac(o,e);if(!s&&!W(c))throw Error(`Cannot find module '${e}'`);let l=r.pid,u=rr(l,r.kernel,r.argv,o,r.env),d=Ny(r);u.stdout=r.stdout,u.stderr=r.stderr,u.nextTick=n.nextTick.bind(n),n.setGlobal(`process`,u),n.setGlobal(`console`,d),n.setGlobal(`Buffer`,j);let f=Ay(r);f._builtinModules.set(`process`,u),i.start();let p=pD(l,i,(a=t.workerData)==null?null:a);if(f._builtinModules.set(`worker_threads`,p),ny(r,f),s){let t=new f(`[worker eval]`);t.filename=Ac(o,`[worker eval]`),t.paths=f._getModulePaths(o);let i=by(f,r,t);n.setGlobal(`require`,i);let a=t.filename,s=Tc(a),c=Function(`exports`,`require`,`module`,`__filename`,`__dirname`,e+`
|
|
72
|
+
//# sourceURL=substrate://[worker eval]`);n.runWithGlobals(()=>{c(t.exports,i,t,a,s)})}else{let e=Hv(c);xD.debug(`Running worker ${c} as ${e?`ESM`:`CommonJS`}`),e?n.runWithGlobals(()=>{ry(c,Tc(c))}):n.runWithGlobals(()=>{f.runMain(c)})}}function pD(e,t,n){let r={isMainThread:!1,parentPort:t,workerData:n,threadId:e,resourceLimits:Object.freeze({}),SHARE_ENV:CD,Worker:jD,MessageChannel:AD,MessagePort:kD,BroadcastChannel:globalThis.BroadcastChannel===void 0?class{constructor(e){throw Error(`BroadcastChannel is not available in this environment`)}}:globalThis.BroadcastChannel,moveMessagePortToContext:hD,receiveMessageOnPort:gD,markAsUntransferable:_D,isMarkedAsUntransferable:vD,getEnvironmentData:yD,setEnvironmentData:bD};return r.default=r,r}function mD(e){return e===CD?process.env:e?B({},e):B({},process.env)}function hD(e,t){throw Error(`moveMessagePortToContext is not supported in Substrate`)}function gD(e){if(e instanceof kD)return e._syncQueue.length===0?void 0:{message:e._syncQueue.shift()}}function _D(e){}function vD(e){return!1}function yD(e){return MD.get(e)}function bD(e,t){t===void 0?MD.delete(e):MD.set(e,t)}var xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD,MD,ND,PD,FD=i((()=>{Qn(),rn(),ir(),kt(),sc(),Zo(),tc(),jy(),uy(),Py(),Wv(),Mc(),au(),A(),Cn(),w(),uo(),xD=D(`worker-threads`),SD=new Set,CD=Symbol.for(`nodejs.worker_threads.SHARE_ENV`),wD=!0,TD=null,ED=null,DD=0,OD=Object.freeze({}),kD=class extends M{constructor(e,t){super(),C(this,`_port`,void 0),C(this,`_eventLoop`,void 0),C(this,`_started`,!1),C(this,`_closed`,!1),C(this,`_refed`,!1),C(this,`_syncQueue`,[]),this._port=e,this._eventLoop=t,this._port.onmessage=e=>{this._handleNativeMessage(e)}}on(e,t){return super.on(e,t),e===`message`&&this.ref(),this}removeListener(e,t){return super.removeListener(e,t),e===`message`&&this.listenerCount(`message`)===0&&this.unref(),this}removeAllListeners(e){return super.removeAllListeners(e),(!e||e===`message`)&&this.unref(),this}_handleNativeMessage(e){if(this._closed)return;this._syncQueue.push(e.data);let t=this._eventLoop;t?t.queuePending(()=>{t.runWithGlobals(()=>{this.emit(`message`,e.data)})}):this.emit(`message`,e.data)}postMessage(e,t){this._closed||this._port.postMessage(e,t==null?[]:t)}start(){this._started||(this._started=!0,this._port.start())}close(){this._closed||(this._closed=!0,this._port.close(),this.unref(),this.emit(`close`))}ref(){return!this._refed&&this._eventLoop&&(this._eventLoop.ref(),this._refed=!0),this}unref(){return this._refed&&this._eventLoop&&(this._eventLoop.unref(),this._refed=!1),this}},AD=class{constructor(){C(this,`port1`,void 0),C(this,`port2`,void 0);let e=new globalThis.MessageChannel;this.port1=new kD(e.port1,null),this.port2=new kD(e.port2,null)}},jD=class extends M{constructor(e,t){super(),C(this,`threadId`,void 0),C(this,`stdin`,null),C(this,`stdout`,null),C(this,`stderr`,null),C(this,`resourceLimits`,Object.freeze({})),C(this,`performance`,globalThis.performance),C(this,`_parentPort`,void 0),C(this,`_exited`,!1),C(this,`_exitCode`,null);let n=e instanceof URL?e.pathname:e,r=rc(),i=r.getKernelBridge(),a=process.pid,o=E(`proc_spawn`,{parent_pid:a}).pid;this.threadId=o,xD.debug(`Creating worker thread PID ${o} for "${n}"`);let s=new globalThis.MessageChannel,c=H(a);this._parentPort=new kD(s.port1,c),this._parentPort.start(),this._parentPort.on(`message`,e=>{this.emit(`message`,e)}),c.ref();let l=process.cwd(),u=mD(t==null?void 0:t.env),d=r.createChildContext(o,{command:`worker_thread`,ppid:a,cwd:l,env:u,argv:t!=null&&t.argv?[`worker_thread`,...t.argv.map(String)]:[`worker_thread`,n],kernel:i}),f=Yo(o,i),p=Zs();p.register(o,f,(e,t)=>{this._handleWorkerExit(e,c)});let m=new kD(s.port2,f),h=gn(()=>{SD.delete(h),!this._exited&&(p.startProcess(o,()=>{fD(n,t==null?{}:t,f,d,m)}),c.queuePending(()=>{c.runWithGlobals(()=>{this.emit(`online`)})}))},0);SD.add(h)}postMessage(e,t){this._parentPort.postMessage(e,t)}terminate(){var e;if(this._exited)return Promise.resolve((e=this._exitCode)==null?0:e);try{E(`proc_kill`,{pid:this.threadId,signal:`SIGTERM`})}catch(e){}return new Promise(e=>{if(this._exited){var t;e((t=this._exitCode)==null?0:t);return}this.once(`exit`,t=>e(t))})}ref(){return this._parentPort.ref(),this}unref(){return this._parentPort.unref(),this}getHeapSnapshot(){return Promise.reject(Error(`getHeapSnapshot is not supported in Substrate`))}_handleWorkerExit(e,t){this._exited||(this._exited=!0,this._exitCode=e,xD.debug(`Worker PID ${this.threadId} exited with code ${e}`),Ot(`proc_exit`,{pid:this.threadId,exit_code:e}),t.unref(),t.queuePending(()=>{t.runWithGlobals(()=>{this.emit(`exit`,e),this._parentPort.close()})}))}},MD=new Map,ND=globalThis.BroadcastChannel===void 0?class{constructor(e){throw Error(`BroadcastChannel is not available in this environment`)}}:globalThis.BroadcastChannel,PD={isMainThread:wD,parentPort:TD,workerData:ED,threadId:DD,resourceLimits:OD,SHARE_ENV:CD,Worker:jD,MessageChannel:AD,MessagePort:kD,BroadcastChannel:ND,moveMessagePortToContext:hD,receiveMessageOnPort:gD,markAsUntransferable:_D,isMarkedAsUntransferable:vD,getEnvironmentData:yD,setEnvironmentData:bD}})),ID=a({Interface:()=>WD,clearLine:()=>RD,clearScreenDown:()=>zD,createInterface:()=>LD,cursorTo:()=>BD,default:()=>KD,emitKeypressEvents:()=>HD,moveCursor:()=>VD,promises:()=>GD});function LD(e){return new WD(e)}function RD(e,t,n){return n==null||n(),!0}function zD(e,t){return t==null||t(),!0}function BD(e,t,n,r){return typeof n==`function`?n():r==null||r(),!0}function VD(e,t,n,r){return r==null||r(),!0}function HD(e,t){}var UD,WD,GD,KD,qD=i((()=>{Qn(),w(),UD=Symbol.asyncIterator,WD=class extends M{constructor(e){var t;super(),C(this,`terminal`,void 0),C(this,`line`,``),C(this,`cursor`,0),this.terminal=(t=e.terminal)==null?!1:t}close(){this.emit(`close`)}pause(){return this.emit(`pause`),this}resume(){return this.emit(`resume`),this}write(e,t){}question(e,t,n){let r=typeof t==`function`?t:n;queueMicrotask(()=>r==null?void 0:r(``))}prompt(e){}setPrompt(e){}getPrompt(){return``}getCursorPos(){return{rows:0,cols:0}}[UD](){return{next:()=>Promise.resolve({done:!0,value:void 0}),[Symbol.asyncIterator](){return this}}}},GD={createInterface:LD,Interface:WD},KD={Interface:WD,createInterface:LD,clearLine:RD,clearScreenDown:zD,cursorTo:BD,moveCursor:VD,emitKeypressEvents:HD,promises:GD}})),JD=a({Script:()=>lO,compileFunction:()=>aO,constants:()=>uO,createContext:()=>rO,createScript:()=>$D,default:()=>dO,isContext:()=>iO,measureMemory:()=>oO,runInContext:()=>nO,runInNewContext:()=>tO,runInThisContext:()=>eO});function YD(e){let t=function(...t){let n=e.apply(this,t),r=globalThis.Promise;return n instanceof r?n:new r((e,t)=>{n.then(e,t)})};return Object.defineProperty(t,`length`,{value:e.length}),Object.defineProperty(t,`name`,{value:e.name}),t}function XD(e){return typeof e==`function`&&e instanceof cO?YD(e):e}function ZD(e,t){return t?e+`
|
|
73
|
+
//# sourceURL=`+t:e}function QD(e,t){let n=new Proxy(t,{has(e,t){return!0},get(e,t,n){if(t!==Symbol.unscopables)return t in e?Reflect.get(e,t,n):globalThis[t]},set(e,t,n){return e[t]=n,!0}});return XD(Function(`__sandbox_proxy__`,`with(__sandbox_proxy__) { return eval(`+JSON.stringify(e)+`); }`)(n))}function $D(e,t){return new lO(e,t)}function eO(e,t){return new lO(e).runInThisContext(t)}function tO(e,t,n){return new lO(e).runInNewContext(t,n)}function nO(e,t,n){return new lO(e).runInContext(t,n)}function rO(e,t){let n=e==null?{}:e;return sO.add(n),n}function iO(e){return typeof e!=`object`||!e?!1:sO.has(e)}function aO(e,t,n){let r=t==null?[]:t,i=ZD(e,n==null?void 0:n.filename);return Function(...r,i)}function oO(e){return Promise.resolve({total:{jsMemoryEstimate:0,jsMemoryRange:[0,0]}})}var sO,cO,lO,uO,dO,fO=i((()=>{rn(),Ke(),w(),sO=new WeakSet,cO=Object.getPrototypeOf(T(function*(){})).constructor,lO=class{constructor(e,t){C(this,`_code`,void 0),C(this,`_filename`,void 0),C(this,`cachedData`,void 0),C(this,`cachedDataProduced`,void 0),C(this,`cachedDataRejected`,void 0);let n=typeof t==`string`?{filename:t}:t;this._code=e,this._filename=n==null?void 0:n.filename,this.cachedData=n==null?void 0:n.cachedData,this.cachedDataProduced=!1,this.cachedDataRejected=!1}runInThisContext(e){var t;let n=typeof e==`string`?{filename:e}:e,r=(t=n==null?void 0:n.filename)==null?this._filename:t,i=ZD(this._code,r);return XD((0,eval)(i))}runInNewContext(e,t){let n=e==null?{}:e;return sO.has(n)||sO.add(n),this.runInContext(n,t)}runInContext(e,t){var n;let r=typeof t==`string`?{filename:t}:t,i=(n=r==null?void 0:r.filename)==null?this._filename:n;return QD(ZD(this._code,i),e)}createCachedData(){return this.cachedDataProduced=!1,j.alloc(0)}},uO={USE_MAIN_CONTEXT_DEFAULT_LOADER:0,DONT_CONTEXTIFY:1},dO={Script:lO,createScript:$D,runInThisContext:eO,runInNewContext:tO,runInContext:nO,createContext:rO,isContext:iO,compileFunction:aO,measureMemory:oO,constants:uO}})),pO=a({AsyncLocalStorage:()=>vO,AsyncResource:()=>yO,createHook:()=>mO,executionAsyncId:()=>hO,executionAsyncResource:()=>gO,triggerAsyncId:()=>_O});function mO(e){return{enable(){return this},disable(){return this}}}function hO(){return 0}function gO(){return{}}function _O(){return 0}var vO,yO,bO=i((()=>{Zo(),w(),vO=class{getStore(){let e=H(process.pid).captureAsyncContext();return e==null?void 0:e.get(this)}run(e,t,...n){let r=H(process.pid),i=r.captureAsyncContext(),a=i?new Map(i):new Map;return a.set(this,e),r.runInAsyncContext(a,()=>t(...n))}exit(e,...t){let n=H(process.pid),r=n.captureAsyncContext(),i=r?new Map(r):null;return i&&i.delete(this),n.runInAsyncContext(i,()=>e(...t))}enterWith(e){let t=H(process.pid),n=t.captureAsyncContext(),r=n?new Map(n):new Map;r.set(this,e),t.setCurrentAsyncContext(r)}disable(){let e=H(process.pid),t=e.captureAsyncContext();if(t){let n=new Map(t);n.delete(this),e.setCurrentAsyncContext(n)}}static snapshot(){let e=H(process.pid),t=e.captureAsyncContext();return(n,...r)=>e.runInAsyncContext(t,()=>n(...r))}static bind(e){let t=H(process.pid),n=t.captureAsyncContext();return((...r)=>t.runInAsyncContext(n,()=>e(...r)))}},yO=class e{constructor(e,t){C(this,`type`,void 0),C(this,`_asyncContext`,void 0),this.type=e,this._asyncContext=H(process.pid).captureAsyncContext()}runInAsyncScope(e,t,...n){return H(process.pid).runInAsyncContext(this._asyncContext,()=>e.apply(t,n))}emitDestroy(){return this}asyncId(){return 0}triggerAsyncId(){return 0}static bind(t,n,r){let i=new e(n==null?`bound-anonymous-fn`:n);return((...e)=>i.runInAsyncScope(t,r,...e))}}})),xO=a({Channel:()=>OO,TracingChannel:()=>kO,channel:()=>SO,hasSubscribers:()=>CO,subscribe:()=>wO,tracingChannel:()=>EO,unsubscribe:()=>TO});function SO(e){let t=DO.get(e);return t||(t=new OO(e),DO.set(e,t)),t}function CO(e){let t=DO.get(e);return t?t.hasSubscribers:!1}function wO(e,t){SO(e).subscribe(t)}function TO(e,t){return SO(e).unsubscribe(t)}function EO(e){return new kO(e)}var DO,OO,kO,AO=i((()=>{w(),DO=new Map,OO=class{constructor(e){C(this,`name`,void 0),C(this,`_subscribers`,new Set),this.name=e}get hasSubscribers(){return this._subscribers.size>0}subscribe(e){this._subscribers.add(e)}unsubscribe(e){return this._subscribers.delete(e)}publish(e){if(this._subscribers.size!==0)for(let t of this._subscribers)t(e,this.name)}bindStore(e,t){}unbindStore(e){}runStores(e,t,n,...r){return t.apply(n,r)}},kO=class{constructor(e){C(this,`start`,void 0),C(this,`end`,void 0),C(this,`asyncStart`,void 0),C(this,`asyncEnd`,void 0),C(this,`error`,void 0),typeof e==`string`?(this.start=SO(`tracing:${e}:start`),this.end=SO(`tracing:${e}:end`),this.asyncStart=SO(`tracing:${e}:asyncStart`),this.asyncEnd=SO(`tracing:${e}:asyncEnd`),this.error=SO(`tracing:${e}:error`)):(this.start=e.start,this.end=e.end,this.asyncStart=e.asyncStart,this.asyncEnd=e.asyncEnd,this.error=e.error)}subscribe(e){for(let[t,n]of Object.entries(e)){let e=this[t];e&&typeof e.subscribe==`function`&&e.subscribe(n)}}unsubscribe(e){for(let[t,n]of Object.entries(e)){let e=this[t];e&&typeof e.unsubscribe==`function`&&e.unsubscribe(n)}}traceSync(e,t,n,...r){this.start.publish(t);try{let i=e.apply(n,r);return this.end.publish(t),i}catch(e){throw t.error=e,this.error.publish(t),e}}tracePromise(e,t,n,...r){this.start.publish(t);try{let i=e.apply(n,r);return i&&typeof i.then==`function`?i.then(()=>this.asyncEnd.publish(t),e=>{t.error=e,this.error.publish(t)}):this.end.publish(t),i}catch(e){throw t.error=e,this.error.publish(t),e}}traceCallback(e,t,n,r,...i){this.start.publish(n);try{let t=e.apply(r,i);return this.end.publish(n),t}catch(e){throw n.error=e,this.error.publish(n),e}}}})),jO=a({SCHED_NONE:()=>HO,SCHED_RR:()=>UO,Worker:()=>FO,addListener:()=>XO,disconnect:()=>NO,emit:()=>YO,fork:()=>MO,isMaster:()=>RO,isPrimary:()=>LO,isWorker:()=>zO,off:()=>JO,on:()=>KO,once:()=>qO,removeAllListeners:()=>QO,removeListener:()=>ZO,schedulingPolicy:()=>WO,settings:()=>VO,setupMaster:()=>GO,setupPrimary:()=>PO,workers:()=>BO});function MO(e){throw Error(`cluster.fork() is not supported in Substrate`)}function NO(e){e&&e()}function PO(e){}var FO,IO,LO,RO,zO,BO,VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O=i((()=>{Qn(),w(),FO=class extends M{constructor(...e){super(...e),C(this,`id`,0),C(this,`process`,null),C(this,`exitedAfterDisconnect`,!1)}send(e,t,n,r){return!1}kill(e){}disconnect(){}isConnected(){return!1}isDead(){return!0}},IO=new M,LO=!0,RO=!0,zO=!1,BO={},VO={},HO=1,UO=2,WO=UO,GO=PO,KO=IO.on.bind(IO),qO=IO.once.bind(IO),JO=IO.off.bind(IO),YO=IO.emit.bind(IO),XO=IO.addListener.bind(IO),ZO=IO.removeListener.bind(IO),QO=IO.removeAllListeners.bind(IO)})),ek=a({decode:()=>ik,encode:()=>ak,toASCII:()=>ok,toUnicode:()=>sk,ucs2:()=>_k,version:()=>gk});function tk(e,t,n){e=n?Math.floor(e/fk):e>>1,e+=Math.floor(e/t);let r=0;for(;e>(ck-lk)*uk>>1;)e=Math.floor(e/(ck-lk)),r+=ck;return Math.floor(r+(ck-lk+1)*e/(e+dk))}function nk(e){return e+22+75*Number(e<26)}function rk(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:ck}function ik(e){let t=[],n=e.length,r=0,i=mk,a=pk,o=e.lastIndexOf(hk);o<0&&(o=0);for(let n=0;n<o;++n)t.push(e.charCodeAt(n));let s=o>0?o+1:0;for(;s<n;){let o=r,c=1;for(let t=ck;;t+=ck){if(s>=n)throw RangeError(`Invalid input`);let i=rk(e.charCodeAt(s++));if(i>=ck)throw RangeError(`Invalid input`);if(i>Math.floor((2147483647-r)/c))throw RangeError(`Overflow`);r+=i*c;let o=t<=a?lk:t>=a+uk?uk:t-a;if(i<o)break;if(c>Math.floor(2147483647/(ck-o)))throw RangeError(`Overflow`);c*=ck-o}let l=t.length+1;if(a=tk(r-o,l,o===0),Math.floor(r/l)>2147483647-i)throw RangeError(`Overflow`);i+=Math.floor(r/l),r%=l,t.splice(r++,0,i)}return String.fromCodePoint(...t)}function ak(e){let t=[],n=Array.from(e).map(e=>e.codePointAt(0)),r=n.length,i=mk,a=0,o=pk;for(let e of n)e<128&&t.push(String.fromCharCode(e));let s=t.length,c=s;for(s&&t.push(hk);c<r;){let e=2147483647;for(let t of n)t>=i&&t<e&&(e=t);if(e-i>Math.floor((2147483647-a)/(c+1)))throw RangeError(`Overflow`);a+=(e-i)*(c+1),i=e;for(let e of n){if(e<i&&++a>2147483647)throw RangeError(`Overflow`);if(e===i){let e=a;for(let n=ck;;n+=ck){let r=n<=o?lk:n>=o+uk?uk:n-o;if(e<r)break;t.push(String.fromCharCode(nk(r+(e-r)%(ck-r)))),e=Math.floor((e-r)/(ck-r))}t.push(String.fromCharCode(nk(e))),o=tk(a,c+1,c===s),a=0,++c}}++a,++i}return t.join(``)}function ok(e){return e.split(`.`).map(e=>e.split(``).some(e=>e.charCodeAt(0)>126)?`xn--`+ak(e):e).join(`.`)}function sk(e){return e.split(`.`).map(e=>{if(e.startsWith(`xn--`))try{return ik(e.slice(4))}catch(t){return e}return e}).join(`.`)}var ck,lk,uk,dk,fk,pk,mk,hk,gk,_k,vk=i((()=>{ck=36,lk=1,uk=26,dk=38,fk=700,pk=72,mk=128,hk=`-`,gk=`2.3.1`,_k={decode(e){return Array.from(e).map(e=>e.codePointAt(0))},encode(e){return String.fromCodePoint(...e)}}})),yk=a({Domain:()=>xk,create:()=>bk});function bk(){return new xk}var xk,Sk=i((()=>{Qn(),w(),xk=class extends M{constructor(...e){super(...e),C(this,`members`,[])}add(e){this.members.push(e)}remove(e){let t=this.members.indexOf(e);t>=0&&this.members.splice(t,1)}run(e){return e()}bind(e){return e}intercept(e){return e}enter(){}exit(){}dispose(){this.members=[],this.removeAllListeners()}}})),Ck=a({Session:()=>Ok,close:()=>Tk,open:()=>wk,promises:()=>kk,url:()=>Ek,waitForDebugger:()=>Dk});function wk(e,t,n){}function Tk(){}function Ek(){}function Dk(){}var Ok,kk,Ak=i((()=>{Qn(),Ok=class extends M{connect(){}connectToMainThread(){}disconnect(){}post(e,t,n){let r=typeof t==`function`?t:n;r&&r(Error(`Inspector is not available in Substrate`),void 0)}},kk={Session:Ok,open:wk,close:Tk,url:Ek,waitForDebugger:Dk}})),jk=a({createTracing:()=>Mk,getEnabledCategories:()=>Nk});function Mk(e){return{enabled:!1,categories:e.categories.join(`,`),enable(){},disable(){}}}function Nk(){}var Pk=i((()=>{})),Fk=a({Socket:()=>Lk,createSocket:()=>Ik});function Ik(e,t){return new Lk(typeof e==`string`?e:e.type)}var Lk,Rk=i((()=>{Qn(),w(),Lk=class extends M{constructor(e){super(),C(this,`_type`,void 0),this._type=e}bind(e,t,n){return this}close(e){e&&e()}send(e,t,n,r,i,a){throw Error(`dgram.Socket.send() is not supported in Substrate (no UDP in browser)`)}address(){return{address:`0.0.0.0`,family:`IPv4`,port:0}}ref(){return this}unref(){return this}setMulticastTTL(e){return this}setMulticastLoopback(e){return this}addMembership(e,t){}dropMembership(e,t){}setBroadcast(e){}setTTL(e){return this}getRecvBufferSize(){return 0}getSendBufferSize(){return 0}setRecvBufferSize(e){}setSendBufferSize(e){}remoteAddress(){return{address:`0.0.0.0`,family:`IPv4`,port:0}}getSendQueueSize(){return 0}getSendQueueCount(){return 0}}})),zk=a({WASI:()=>Bk}),Bk,Vk=i((()=>{w(),Bk=class{constructor(e){C(this,`wasiImport`,void 0),this.wasiImport={}}start(e){throw Error(`WASI.start() is not supported in Substrate`)}initialize(e){throw Error(`WASI.initialize() is not supported in Substrate`)}getImportObject(){return{}}}}));function Hk(e){return{packageName:e.packageName,getWasmPackage:t=>`${e.wasmPackage}@${t}`,nativeBindingPatterns:e.nativeBindingPatterns.map(e=>new RegExp(e)),wasmExportPath:e.wasmExportPath}}function Uk(e){iA.set(e.packageName,e);for(let t of e.nativeBindingPatterns)aA.set(t,e.packageName);Z.trace(`Registered WASM package config for: ${e.packageName}`)}function Wk(e){if(_v(tA),gl(Gk),Kk(),e)for(let t of e)Uk(Hk(t));Z.trace(`WASM package interceptor initialized`)}function Gk(e){let t=qk(e);t&&(Z.trace(`Native binding detected via write: ${t.nativePackage}`),Jk(t.packageName,t.nativePackage,t.nodeModulesPath))}function Kk(){Uk({packageName:`rollup`,getWasmPackage:e=>`@rollup/wasm-node@${e}`,nativeBindingPatterns:[/^@rollup\/rollup-(linux|darwin|win32|freebsd|android)-/],wasmExportPath:`dist/native.js`}),Uk({packageName:`esbuild`,getWasmPackage:e=>`esbuild-wasm@${e}`,nativeBindingPatterns:[/^@esbuild\/(linux|darwin|win32|freebsd|netbsd|openbsd|sunos|aix|android|openharmony)-/]}),Uk({packageName:`rolldown`,getWasmPackage:e=>`@rolldown/binding-wasm32-wasi@${e}`,nativeBindingPatterns:[/^@rolldown\/binding-(?!wasm32-wasi)/]}),Z.trace(`Registered default WASM package configurations`)}function qk(e){if(!e.endsWith(`/package.json`))return null;let t=e.match(/^(.+\/node_modules)\/(.+)\/package\.json$/);if(!t)return null;let n=t[1],r=t[2];for(let[e,t]of aA)if(e.test(r))return Z.debug(`Detected native binding: ${r} (main: ${t})`),{packageName:t,nativePackage:r,nodeModulesPath:n};return null}function Jk(e,t,n){let r=`${n}/${e}/package.json`,i;try{let t=Ol(r);i=JSON.parse(new TextDecoder().decode(t)).version,Z.debug(`Found main package ${e}@${i}`)}catch(r){try{let e=Ol(`${n}/${t}/package.json`);i=JSON.parse(new TextDecoder().decode(e)).version,Z.debug(`Using native package version: ${t}@${i}`)}catch(t){return Z.warn(`Could not determine version for ${e}, skipping WASM installation`),vn.resolve()}}let a=`${e}@${i}`;if(sA.has(a))return Z.debug(`WASM package already installed: ${a}`),vn.resolve();let o=oA.get(a);if(o)return Z.debug(`WASM package installation already in progress: ${a}`),o;let s=Yk(e,i).then(()=>{Z.debug(`WASM package installed successfully: ${a}`)}).catch(e=>{Z.error(`Failed to install WASM package ${a}:`,e)}).finally(()=>{oA.delete(a),Wn()});return oA.set(a,s),Wn(),s}function Yk(e,t){let n=iA.get(e);if(!n)return Z.warn(`No WASM package config for: ${e}`),vn.resolve();let r=n.getWasmPackage(t);Z.debug(`Installing WASM package: ${r}`);let i=r.lastIndexOf(`@`),a=r.slice(0,i),o=Zk(a,r.slice(i+1));return Z.debug(`Fetching WASM package tarball: ${o}`),yn(o).then(e=>{if(!e.ok)throw Error(`Failed to fetch WASM package tarball: ${e.status} ${e.statusText}`);return e.arrayBuffer()}).then(r=>{let i=new Uint8Array(r);Z.debug(`Downloaded ${i.length} bytes`);let o=`${cA}/${a}`;if(Qk(cA),a.startsWith(`@`)){let e=a.split(`/`)[0];Qk(`${cA}/${e}`)}let s=rx(i,{strip:1});Z.debug(`Extracting ${s.length} files to ${o}`);for(let e of s)if(e.type===`file`&&e.content){let t=`${o}/${e.name}`;Qk(t.substring(0,t.lastIndexOf(`/`))),Xk(t,e.content)}else e.type===`directory`&&Qk(`${o}/${e.name}`);let c=`${e}@${t}`;sA.set(c,o),$k(n,o),Z.debug(`WASM package installed: ${a} at ${o}`)})}function Xk(e,t){kl(e,t)}function Zk(e,t){let n=`https://registry.npmjs.org`;if(e.startsWith(`@`)){let[r,i]=e.split(`/`);return`${n}/${r}/${i}/-/${i}-${t}.tgz`}else return`${n}/${e}/-/${e}-${t}.tgz`}function Qk(e){W(e)||Il(e,!0)}function $k(e,t){let n=e.wasmExportPath?`${t}/${e.wasmExportPath}`:t;for(let t of e.nativeBindingPatterns)eA(t,n);e.packageName===`esbuild`&&(vv(`esbuild`,t),Z.debug(`Registered alias: esbuild -> ${t}`))}function eA(e,t){lA.set(e,t),Z.debug(`Registered native binding pattern: ${e} -> ${t}`)}function tA(e){for(let[t,n]of lA)if(t.test(e))return Z.debug(`Native binding resolved: ${e} -> ${n}`),n;return null}function nA(){if(!W(cA))return;let e=Fl(cA);for(let t of e){if(t.kind!==`dir`)continue;let e=t.name,n;if(e.startsWith(`@`)){let t=`${cA}/${e}`;n=Fl(t).filter(e=>e.kind===`dir`).map(n=>({name:`${e}/${n.name}`,path:`${t}/${n.name}`}))}else n=[{name:e,path:`${cA}/${e}`}];for(let e of n){let t=`${e.path}/package.json`;if(W(t))try{let n=Ol(t),r=JSON.parse(new TextDecoder().decode(n)),i=r.name,a=r.version;for(let t of iA.values()){let n=t.getWasmPackage(a),r=n.lastIndexOf(`@`);if(n.slice(0,r)===i){let n=`${t.packageName}@${a}`;sA.has(n)||(sA.set(n,e.path),$k(t,e.path),Z.debug(`scanAndRegisterAliases: restored ${i}@${a} at ${e.path}`));break}}}catch(e){Z.debug(`scanAndRegisterAliases: failed to read ${t}`)}}}}function rA(){return oA.size===0?vn.resolve():(Z.debug(`Waiting for ${oA.size} pending WASM installations`),vn.all(Array.from(oA.values())).then(()=>{}))}var Z,iA,aA,oA,sA,cA,lA,uA=i((()=>{mx(),A(),Av(),au(),Cn(),Gn(),Z=D(`wasm-intercept`),iA=new Map,aA=new Map,oA=new Map,sA=new Map,cA=`/node_aliases`,lA=new Map})),dA=a({default:()=>OA,fsFlush:()=>jA,fsMountPersistent:()=>MA,fsReadFdDirect:()=>SA,fsReadFileDirect:()=>yA,fsWriteFdDirect:()=>CA,fsWriteFileDirect:()=>xA,getDataBuf:()=>bA,getMemory:()=>gA,initSync:()=>AA,kernel_deliver:()=>hA,kernel_init:()=>pA,kernel_syscall:()=>mA,setHostImports:()=>wA,wasmAlloc:()=>_A,wasmDealloc:()=>vA});function fA(e,t){let n=t.length,r=Q.alloc(n);new Uint8Array(Q.memory.buffer).set(t,r),e(r,n),Q.dealloc(r,n);let i=Q.result_ptr(),a=Q.result_len(),o=new Uint8Array(Q.memory.buffer,i,a).slice();return Q.dealloc(i,a),o}function pA(e){return fA(Q.kernel_init,e)}function mA(e){return fA(Q.kernel_syscall,e)}function hA(e){return fA(Q.kernel_deliver,e)}function gA(){return Q.memory}function _A(e){return Q.alloc(e)}function vA(e,t){Q.dealloc(e,t)}function yA(e){let t=new TextEncoder().encode(e),n=Q.alloc(t.length);new Uint8Array(Q.memory.buffer).set(t,n);let r=Q.fs_read_file_direct(n,t.length);return Q.dealloc(n,t.length),r}function bA(){let e=Q.data_buf_ptr(),t=Q.data_buf_len();return e===0||t===0?new Uint8Array:new Uint8Array(Q.memory.buffer,e,t)}function xA(e,t,n){let r=new TextEncoder().encode(e),i=Q.alloc(r.length);new Uint8Array(Q.memory.buffer).set(r,i);let a=0;t.length>0&&(a=Q.alloc(t.length),new Uint8Array(Q.memory.buffer).set(t,a));let o=Q.fs_write_file_direct(i,r.length,a,t.length,n);return Q.dealloc(i,r.length),t.length>0&&Q.dealloc(a,t.length),o}function SA(e,t,n,r){return Q.fs_read_fd_direct(e,t,n,r)}function CA(e,t,n,r){let i=0;n.length>0&&(i=Q.alloc(n.length),new Uint8Array(Q.memory.buffer).set(n,i));let a=Q.fs_write_fd_direct(e,t,i,n.length,r);return n.length>0&&Q.dealloc(i,n.length),a}function wA(e){FA=B(B({},FA),e)}function TA(){return{env:{now_ms:()=>Date.now(),host_read_file:(e,t,n,r)=>FA.host_read_file(e,t,n,r),host_write_file:(e,t,n,r)=>FA.host_write_file(e,t,n,r),host_truncate_file:(e,t)=>FA.host_truncate_file(e,t),host_file_size:e=>FA.host_file_size(e),host_create_file:e=>FA.host_create_file(e),host_delete_file:e=>FA.host_delete_file(e),host_load_metadata:(e,t)=>FA.host_load_metadata(e,t),host_save_metadata:(e,t)=>FA.host_save_metadata(e,t)}}}function EA(e,t){return DA.apply(this,arguments)}function DA(){return DA=T(function*(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return yield WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&IA.has(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}let n=yield e.arrayBuffer();return yield WebAssembly.instantiate(n,t)}else{let n=yield WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}),DA.apply(this,arguments)}function OA(e){return kA.apply(this,arguments)}function kA(){return kA=T(function*(e){if(Q!==void 0)return Q;let t;t=e!==void 0&&typeof e==`object`&&`module_or_path`in e?e.module_or_path:e;let n=TA();(typeof t==`string`||typeof Request==`function`&&t instanceof Request||typeof URL==`function`&&t instanceof URL)&&(t=fetch(t));let{instance:r}=yield EA(yield t,n);return Q=r.exports,Q}),kA.apply(this,arguments)}function AA(e){if(Q!==void 0)return Q;let t=e;typeof e==`object`&&e&&`module`in e&&(t=e.module);let n=TA();return t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t)),Q=new WebAssembly.Instance(t,n).exports,Q}function jA(){return Q.fs_flush()}function MA(){return Q.fs_mount_persistent()}var Q,NA,PA,FA,IA,LA=i((()=>{uo(),Ke(),NA=new Map,PA=null,FA={host_read_file:(e,t,n,r)=>{let i=NA.get(e);if(!i)return-1;if(t>=i.length)return 0;let a=Math.min(r,i.length-t);return new Uint8Array(Q.memory.buffer).set(i.subarray(t,t+a),n),a},host_write_file:(e,t,n,r)=>{let i=NA.get(e);i||(i=new Uint8Array);let a=t+r;if(a>i.length){let e=new Uint8Array(a);e.set(i),i=e}return i.set(new Uint8Array(Q.memory.buffer,n,r),t),NA.set(e,i),r},host_truncate_file:(e,t)=>{let n=NA.get(e);if(!n)return NA.set(e,new Uint8Array(t)),0;if(t===n.length)return 0;let r=new Uint8Array(t);return r.set(n.subarray(0,Math.min(t,n.length))),NA.set(e,r),0},host_file_size:e=>{let t=NA.get(e);return t?t.length:-1},host_create_file:e=>(NA.set(e,new Uint8Array),0),host_delete_file:e=>(NA.delete(e),0),host_load_metadata:(e,t)=>!PA||PA.length>t?-1:(new Uint8Array(Q.memory.buffer).set(PA,e),PA.length),host_save_metadata:(e,t)=>(PA=new Uint8Array(Q.memory.buffer,e,t).slice(),0)},IA=new Set([`basic`,`cors`,`default`])})),RA=a({ProcessManager:()=>ac,SubstrateKernel:()=>cj,createSubstrate:()=>UA,ensureLexerInit:()=>XA,getWasmMemoryInfo:()=>HA,getWasmMemorySize:()=>VA,registerBuiltins:()=>nj});function zA(e){switch(e){case`error`:case`warn`:case`info`:case`debug`:case`trace`:return e;default:return`info`}}function BA(e){for(let t of e){let e=zA(t.level);sj.log(e,`[${t.component}] ${t.msg}`)}}function VA(){return oj!=null&&oj.memory?oj.memory.buffer.byteLength:null}function HA(){let e=VA();return e===null?`WASM not initialized`:`WASM memory: ${(e/(1024*1024)).toFixed(2)} MB`}function UA(e){return WA.apply(this,arguments)}function WA(){return WA=T(function*(e){var t,n,r,i,a;Wt.trace(`Loading Kernel with options: ${JSON.stringify(e)}`);let o=yield JA(e.kernel);Wt.trace(`Kernel loaded`);let s=o.init((t=e.config)==null?{}:t);if(Wt.trace(`Kernel initialized: ${JSON.stringify(s)}`),!s.ok)throw Error(`Failed to initialize kernel: ${s.error.message}`);vt(o),!((n=e.config)==null||(n=n.logging)==null)&&n.level||Ot(`debug_set_log_level`,{level:At()}),_t(Wn),yield XA().catch(e=>{Wt.warn(`Failed to initialize es-module-lexer:`,e)});let c=(r=e.cwd)==null?`/`:r;c!==`/`&&(Ot(`fs_mkdir`,{path:c,recursive:!0}),Wt.debug(`Created cwd directory: ${c}`)),Ot(`fs_mkdir`,{path:`/tmp`,recursive:!0}),Ot(`fs_mkdir`,{path:`/usr/bin`,recursive:!0}),Ot(`fs_write_file`,{path:`/usr/bin/node`,bytes:new TextEncoder().encode(`#!/usr/bin/env node
|
|
74
|
+
`),create:!0,truncate:!0});let l=new ac(o),u=B({PATH:`/usr/bin:/usr/local/bin`,HOME:`/home/user`},e.env),d=l.createRootProcess({cwd:c,env:u,argv:(i=e.argv)==null?[`substrate`,``]:i});return nc(l),Wt.debug(`Root process created with PID ${d.pid}`),nj(e.wasmPackages),yield Lx((a=e.binaries)==null?{}:a),{kernel:o,processManager:l,rootProcess:d,deliver(e){let t=o.deliver(e);return t.ok?t.result.delivered:!1},shutdown(){bt()}}}),WA.apply(this,arguments)}function GA(e){let t=e instanceof Error?e.message:String(e);return t.includes(`Response body loading was aborted`)||t.includes(`Network error`)||t.includes(`compilation aborted`)}function KA(e){switch(e){case-1:return{code:`ENOENT`,message:`no such file or directory`};case-2:return{code:`EISDIR`,message:`illegal operation on a directory`};case-3:return{code:`EIO`,message:`input/output error`};case-4:return{code:`EINVAL`,message:`invalid argument`};case-5:return{code:`EMFILE`,message:`too many open files`};case-6:return{code:`EBADF`,message:`bad file descriptor`};case-7:return{code:`ENOTDIR`,message:`not a directory`};case-8:return{code:`EEXIST`,message:`file already exists`};default:return{code:`EIO`,message:`unknown direct error (${e})`}}}function qA(e,t){let n=KA(e),r=Error(`${n.code}: ${n.message}, ${t}`);throw r.code=n.code,r}function JA(e){return YA.apply(this,arguments)}function YA(){return YA=T(function*(e){let t=yield Promise.resolve().then(()=>(LA(),dA));for(let n=0;n<=2;n++)try{if(n===0)oj=yield t.default({module_or_path:e});else{Wt.warn(`Retrying WASM load (attempt ${n+1}/3), using ArrayBuffer fallback...`);let r=yield fetch(e);if(!r.ok)throw Error(`Failed to fetch kernel WASM: ${r.status} ${r.statusText}`);let i=yield r.arrayBuffer();oj=yield t.default({module_or_path:i})}break}catch(e){if(n<2&&GA(e)){Wt.warn(`WASM load attempt ${n+1} failed with transient error, will retry: ${e instanceof Error?e.message:String(e)}`);continue}throw e}return xt({readFile(e){let n=t.fsReadFileDirect(e);return n<0&&qA(n,`read '${e}'`),t.getDataBuf().slice()},writeFile(e,n,r){let i=t.fsWriteFileDirect(e,n,r);return i<0&&qA(i,`write '${e}'`),i}}),new cj({kernel_init:t.kernel_init,kernel_syscall:t.kernel_syscall,kernel_deliver:t.kernel_deliver})}),YA.apply(this,arguments)}function XA(){return ZA.apply(this,arguments)}function ZA(){return ZA=T(function*(){if(!lj)return uj||(uj=T(function*(){try{Wt.debug(`Initializing es-module-lexer...`),yield Lv,lj=!0,Wt.debug(`es-module-lexer initialized successfully`)}catch(e){throw Wt.error(`Failed to initialize es-module-lexer:`,e),e}})(),uj)}),ZA.apply(this,arguments)}function QA(e){var t,n;return e&&typeof e==`object`&&`toUint8Array`in e&&typeof e.toUint8Array==`function`?(Wt.trace(`Converting Buffer to Uint8Array for WebAssembly`),e.toUint8Array()):(Wt.trace(`WebAssembly input type: ${(t=e==null||(n=e.constructor)==null?void 0:n.name)==null?typeof e:t}`),e)}function $A(e){let t=globalThis.Promise;return e instanceof t?e:new t((t,n)=>{e.then(t,n)})}function ej(){Wt.trace(`Patching WebAssembly APIs to handle Buffer type`);let e=function(e){return Wt.trace(`WebAssembly.Module called, converting buffer if needed`),new dj(QA(e))};Object.setPrototypeOf(e,dj),Object.defineProperties(e,Object.getOwnPropertyDescriptors(dj)),WebAssembly.Module=e,WebAssembly.compile=function(e){return $A(pj(QA(e)))},WebAssembly.instantiate=function(e,t){return e instanceof dj?$A(mj(e,t)):$A(mj(QA(e),t))},hj&&(WebAssembly.compileStreaming=function(e){return $A(hj(e))}),gj&&(WebAssembly.instantiateStreaming=function(e,t){return $A(gj(e,t))});let t=function(e,t){Wt.trace(`WebAssembly.Instance called`);try{let n=new fj(e,t);return Wt.trace(`WebAssembly.Instance succeeded`),n}catch(e){throw Wt.error(`WebAssembly.Instance failed:`,e instanceof Error?e.message:String(e)),e instanceof Error&&e.message.includes(`import`)&&Wt.error(`This is likely a missing or mismatched import in the importObject`),e}};Object.setPrototypeOf(t,fj),Object.defineProperties(t,Object.getOwnPropertyDescriptors(fj)),WebAssembly.Instance=t}function tj(){let e=Object.getPrototypeOf(T(function*(){})),t=e.constructor;function n(...e){let n=new t(...e),r=function(...e){let t=n.apply(this,e),r=globalThis.Promise;return t instanceof r?t:new r((e,n)=>{t.then(e,n)})};return Object.defineProperty(r,`length`,{value:n.length}),Object.defineProperty(r,`name`,{value:n.name}),r}n.prototype=t.prototype,Object.defineProperty(n,`name`,{value:`AsyncFunction`}),Object.defineProperty(e,`constructor`,{value:n,writable:!0,configurable:!0,enumerable:!1})}function nj(e){Wk(e),ej(),tj(),_c(),vc();let t=new Proxy({},{get(e,t){let n=globalThis.process;return n?n[t]:void 0},set(e,t,n){let r=globalThis.process;return r?(r[t]=n,!0):!1},has(e,t){let n=globalThis.process;return!!n&&t in n},ownKeys(){let e=globalThis.process;return e?Reflect.ownKeys(e):[]},getOwnPropertyDescriptor(e,t){var n;let r=globalThis.process;if(r)return(n=Object.getOwnPropertyDescriptor(r,t))==null?{configurable:!0,enumerable:!0,writable:!0,value:r[t]}:n}});q(`module`,{}),q(`fs`,Xp),q(`fs/promises`,Yf),q(`path`,Nc),q(`os`,Th),q(`http`,ws),q(`https`,Xh),q(`net`,ps),q(`crypto`,X_),q(`child_process`,Kx),q(`constants`,B({},ou)),q(`stream`,Object.assign(os,B(B({},Qo),{},{default:os})));let n=[`ReadableStream`,`WritableStream`,`TransformStream`];q(`stream/web`,new Proxy({},{get(e,t){return globalThis[t]},ownKeys(){return n},getOwnPropertyDescriptor(e,t){if(n.includes(String(t)))return{configurable:!0,enumerable:!0,get:()=>globalThis[t]}}})),q(`util`,vS),q(`url`,B({},ZS)),q(`querystring`,B({},lC)),q(`events`,Object.assign(M,{EventEmitter:M,once:Yn,on:Xn,listenerCount:qn,getEventListeners:Jn,defaultMaxListeners:Zn})),q(`string_decoder`,B(B({},vC),{},{StringDecoder:bC})),q(`process`,t),q(`tty`,B({},CC)),q(`assert`,QC);let r={MAX_LENGTH:2147483647,MAX_STRING_LENGTH:536870888};q(`buffer`,{Buffer:j,kMaxLength:r.MAX_LENGTH,constants:r}),q(`zlib`,B(B({},ew),{},{constants:Nw})),q(`dns`,B({},nT)),q(`tls`,B({},$T)),q(`timers`,B({},mE)),q(`timers/promises`,xE),q(`http2`,B(B({},wE),{},{constants:ME})),q(`v8`,B({},qE)),q(`worker_threads`,B({},uD)),q(`readline`,B({},ID)),q(`readline/promises`,GD),q(`vm`,B({},JD)),q(`perf_hooks`,{performance:globalThis.performance,PerformanceObserver:class{constructor(e){}observe(e){}disconnect(){}},constants:{NODE_PERFORMANCE_GC_MAJOR:4,NODE_PERFORMANCE_GC_MINOR:1,NODE_PERFORMANCE_GC_INCREMENTAL:8,NODE_PERFORMANCE_GC_WEAKCB:16}}),q(`async_hooks`,B({},pO)),q(`diagnostics_channel`,B({},xO)),q(`cluster`,B({},jO)),q(`punycode`,B({},ek)),q(`domain`,B({},yk)),q(`inspector`,B({},Ck)),q(`inspector/promises`,kk),q(`trace_events`,B({},jk)),q(`dgram`,B({},Fk)),q(`wasi`,B({},zk))}var rj,ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,gj,_j=i((()=>{gt(),kt(),sc(),wc(),wh(),ml(),Yh(),Xs(),tg(),Cs(),gv(),_S(),Jf(),fs(),XS(),cC(),_C(),Qn(),SC(),OC(),$C(),tT(),QT(),pE(),CE(),KE(),lD(),FD(),qD(),fO(),bO(),AO(),$O(),vk(),Sk(),Ak(),Pk(),Rk(),Vk(),A(),Rv(),Vx(),Av(),rn(),Gn(),uA(),w(),uo(),Ke(),aj=new Set([`net_connect`,`net_conn_write`,`net_conn_close`,`fs_write_fd`,`fs_close_fd`,`fs_write_file`,`fs_write_at`,`fs_open`,`fs_ftruncate`,`fs_mkdir`,`fs_unlink`,`fs_rename`,`fs_symlink`,`proc_spawn`,`proc_exit`,`proc_kill`]),oj=null,sj=D(`kernel`),cj=class{constructor(e){C(this,`exports`,void 0),this.exports=e}init(e={}){let t=Pe(e),n=this.exports.kernel_init(new Uint8Array(t));return this.parseResponse(n)}syscall(e,t){let n=Pe({op:e,args:t}),r=this.exports.kernel_syscall(new Uint8Array(n)),i=this.parseResponse(r);return aj.has(e)&&Wn(),i}deliver(e){let t=Pe(e),n=this.exports.kernel_deliver(new Uint8Array(t));return Wn(),this.parseResponse(n)}parseResponse(e){let t=mt(e);return t.logs&&t.logs.length>0&&BA(t.logs),t.error?{ok:!1,error:{code:t.error.code,message:t.error.message,details:t.error.details},logs:t.logs}:{ok:!0,result:t.result,logs:t.logs}}},lj=!1,uj=null,dj=WebAssembly.Module,fj=WebAssembly.Instance,pj=WebAssembly.compile.bind(WebAssembly),mj=WebAssembly.instantiate.bind(WebAssembly),hj=(rj=WebAssembly.compileStreaming)==null?void 0:rj.bind(WebAssembly),gj=(ij=WebAssembly.instantiateStreaming)==null?void 0:ij.bind(WebAssembly)}));_j(),Ke();const vj={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},yj={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3};function bj(e){if(e.length<2)return null;let t=(e[0]&128)!=0,n=e[0]&15,r=(e[1]&128)!=0,i=e[1]&127,a=2;if(i===126){if(e.length<4)return null;i=e[2]<<8|e[3],a=4}else if(i===127){if(e.length<10)return null;i=e[6]<<24|e[7]<<16|e[8]<<8|e[9],a=10}let o=null;if(r){if(e.length<a+4)return null;o=e.slice(a,a+4),a+=4}if(e.length<a+i)return null;let s=new Uint8Array(i);for(let t=0;t<i;t++){let n=e[a+t];s[t]=o?n^o[t%4]:n}return{fin:t,opcode:n,masked:r,payload:s,frameLength:a+i}}function xj(e,t,n=!1){let r=t.length,i=2;r>65535?i+=8:r>125&&(i+=2),n&&(i+=4);let a=new Uint8Array(i+r);a[0]=128|e;let o=2;if(r>65535?(a[1]=n?255:127,a[2]=0,a[3]=0,a[4]=0,a[5]=0,a[6]=r>>24&255,a[7]=r>>16&255,a[8]=r>>8&255,a[9]=r&255,o=10):r>125?(a[1]=n?254:126,a[2]=r>>8&255,a[3]=r&255,o=4):a[1]=n?128|r:r,n){let e=new Uint8Array(4);crypto.getRandomValues(e),a[o]=e[0],a[o+1]=e[1],a[o+2]=e[2],a[o+3]=e[3],o+=4;for(let n=0;n<r;n++)a[o+n]=t[n]^e[n%4]}else a.set(t,o);return a}function Sj(e,t){let n=new TextEncoder().encode(t),r=new Uint8Array(2+n.length);return r[0]=e>>8&255,r[1]=e&255,r.set(n,2),r}function Cj(e){return{code:e.length>=2?e[0]<<8|e[1]:1e3,reason:e.length>2?new TextDecoder().decode(e.slice(2)):``}}function wj(){let e=new Uint8Array(16);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Tj(e){return Ej.apply(this,arguments)}function Ej(){return Ej=T(function*(e){let t=new TextEncoder().encode(e+`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`),n=yield crypto.subtle.digest(`SHA-1`,t),r=new Uint8Array(n);return btoa(String.fromCharCode(...r))}),Ej.apply(this,arguments)}function Dj(e,t,n,r,i=[]){let a=[`GET ${n} HTTP/1.1`,`Host: ${e}:${t}`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Key: ${r}`,`Sec-WebSocket-Version: 13`];return i.length>0&&a.push(`Sec-WebSocket-Protocol: ${i.join(`, `)}`),a.push(``,``),a.join(`\r
|
|
75
|
+
`)}function Oj(e){let t=new TextDecoder().decode(e),n=t.indexOf(`\r
|
|
76
|
+
\r
|
|
77
|
+
`);if(n===-1)return null;let r=t.slice(0,n).split(`\r
|
|
78
|
+
`),i=r[0]||``,a=new Map;for(let e=1;e<r.length;e++){let t=r[e],n=t.indexOf(`:`);if(n>0){let e=t.slice(0,n).toLowerCase(),r=t.slice(n+1).trim();a.set(e,r)}}return{statusLine:i,headers:a,headerEndIndex:n+4}}kt(),A(),Cn(),Gn(),w(),Ke();const kj=D(`runtime-ws`);var Aj=class{constructor(e,t){C(this,`_readyState`,yj.CONNECTING),C(this,`_url`,void 0),C(this,`_protocol`,``),C(this,`_connId`,null),C(this,`_key`,void 0),C(this,`_protocols`,void 0),C(this,`onopen`,null),C(this,`onmessage`,null),C(this,`onerror`,null),C(this,`onclose`,null),C(this,`_receiveBuffer`,new Uint8Array),C(this,`_handshakeComplete`,!1),C(this,`_eqId`,null),C(this,`_waker`,null),this._url=typeof e==`string`?e:e.toString(),this._protocols=Array.isArray(t)?t:t?[t]:[],this._key=wj(),this._connect()}get readyState(){return this._readyState}get url(){return this._url}get protocol(){return this._protocol}_connect(){kj.trace(`RuntimeWebSocket._connect: ${this._url}`);try{let e=new URL(this._url),t=e.hostname,n=parseInt(e.port)||(e.protocol===`wss:`?443:80),r=e.pathname+e.search||`/`;if(kj.debug(`RuntimeWebSocket connecting to ${t}:${n}${r}`),Ot(`net_server_info`,{port:n})===null)throw Error(`No server listening on port ${n}`);let{eq_id:i}=E(`eq_create`,{});this._eqId=i,kj.debug(`RuntimeWebSocket created event queue: eq_id=${i}`),this._connId=E(`net_connect`,{port:n,eq_id:i}).conn_id,kj.debug(`RuntimeWebSocket connected, conn_id=${this._connId}`);let a=Dj(t,n,r,this._key,this._protocols),o=new TextEncoder().encode(a);E(`net_conn_write`,{conn_id:this._connId,bytes:o}),this._waker=Bn(`ws:${this._connId}`),Hn(this._waker),this._runEventLoop().catch(e=>{kj.error(`RuntimeWebSocket event loop error:`,e)})}catch(e){kj.error(`RuntimeWebSocket connection failed:`,e instanceof Error?e.message:String(e)),this._readyState=yj.CLOSED,this._emitError(e instanceof Error?e.message:`Connection failed`),this._emitClose(1006,e instanceof Error?e.message:`Connection failed`,!1)}}_runEventLoop(){var e=this;return T(function*(){for(yield new Promise(e=>gn(e,0));e._readyState!==yj.CLOSED&&e._connId!==null&&e._eqId!==null&&e._waker!==null&&(yield e._waker.wait(3e4),!(e._readyState===yj.CLOSED||e._connId===null||e._eqId===null));)try{let{events:t}=E(`eq_poll`,{eq_id:e._eqId,max:100});for(let n of t)if(n.type===`net_readable`)e._drainInbound();else if(n.type===`net_closed`){e._drainInbound(),e._readyState!==yj.CLOSED&&(e._readyState=yj.CLOSED,e._emitClose(1006,`peer closed`,!1),e._cleanup());return}}catch(e){}})()}_drainInbound(){if(this._connId!==null)for(;;){let e=Ot(`net_conn_read`,{conn_id:this._connId,max_bytes:16384});if(!e||!e.bytes||e.bytes.length===0)break;kj.trace(`RuntimeWebSocket: conn_id=${this._connId} read ${e.bytes.length} bytes`),this._handleData(new Uint8Array(e.bytes))}}_handleData(e){let t=new Uint8Array(this._receiveBuffer.length+e.length);if(t.set(this._receiveBuffer),t.set(e,this._receiveBuffer.length),this._receiveBuffer=t,!this._handshakeComplete){let e=Oj(this._receiveBuffer);if(!e)return;let{statusLine:t,headers:n,headerEndIndex:r}=e;if(!t.includes(`101`)){this._readyState=yj.CLOSED,this._emitError(`Unexpected response: ${t}`),this._emitClose(1006,`Unexpected response: ${t}`,!1),this._cleanup();return}let i=n.get(`sec-websocket-accept`);Tj(this._key).then(e=>{i!==e&&this._readyState===yj.OPEN&&kj.warn(`Invalid Sec-WebSocket-Accept: got ${i}, expected ${e}`)}).catch(()=>{});let a=n.get(`sec-websocket-protocol`);a&&(this._protocol=a),this._handshakeComplete=!0,this._readyState=yj.OPEN,this._receiveBuffer=this._receiveBuffer.slice(r),kj.debug(`RuntimeWebSocket handshake complete, protocol=${this._protocol}`),this._emitOpen()}this._processFrames()}_processFrames(){for(;this._receiveBuffer.length>0;){var e;let t=bj(this._receiveBuffer);if(!t)break;this._receiveBuffer=this._receiveBuffer.slice(t.frameLength);let n=(e={[vj.TEXT]:`TEXT`,[vj.BINARY]:`BINARY`,[vj.CLOSE]:`CLOSE`,[vj.PING]:`PING`,[vj.PONG]:`PONG`}[t.opcode])==null?`0x${t.opcode.toString(16)}`:e,r=t.opcode===vj.TEXT?new TextDecoder().decode(t.payload).slice(0,120):`${t.payload.byteLength}b`;switch(kj.trace(`RuntimeWebSocket frame: conn_id=${this._connId} op=${n} payload=${r}`),t.opcode){case vj.TEXT:{let e=new TextDecoder().decode(t.payload);this._emitMessage(e);break}case vj.BINARY:{let e=new ArrayBuffer(t.payload.byteLength);new Uint8Array(e).set(t.payload),this._emitMessage(e);break}case vj.CLOSE:{let{code:e,reason:n}=Cj(t.payload);this._readyState===yj.OPEN&&this._sendCloseFrame(e,n),this._readyState=yj.CLOSED,this._emitClose(e,n,!0),this._cleanup();break}case vj.PING:kj.trace(`RuntimeWebSocket: responding to PING with PONG`),this._sendFrame(vj.PONG,t.payload);break;case vj.PONG:break}}}_sendFrame(e,t){if(this._connId===null||this._readyState!==yj.OPEN)return;let n=xj(e,t,!0);try{E(`net_conn_write`,{conn_id:this._connId,bytes:n})}catch(e){kj.error(`RuntimeWebSocket send failed:`,e)}}_sendCloseFrame(e,t){let n=Sj(e,t);this._sendFrame(vj.CLOSE,n)}_cleanup(){if(this._waker!==null&&(Un(this._waker),this._waker.signal(),this._waker=null),this._connId!==null){try{Ot(`net_conn_close`,{conn_id:this._connId})}catch(e){}this._connId=null}if(this._eqId!==null){try{E(`eq_close`,{eq_id:this._eqId})}catch(e){}this._eqId=null}}_emitOpen(){try{var e;(e=this.onopen)==null||e.call(this,{protocol:this._protocol})}catch(e){kj.error(`RuntimeWebSocket onopen handler error:`,e)}}_emitMessage(e){try{var t;(t=this.onmessage)==null||t.call(this,{data:e})}catch(e){kj.error(`RuntimeWebSocket onmessage handler error:`,e)}}_emitClose(e,t,n){try{var r;(r=this.onclose)==null||r.call(this,{code:e,reason:t,wasClean:n})}catch(e){kj.error(`RuntimeWebSocket onclose handler error:`,e)}}_emitError(e){try{var t;(t=this.onerror)==null||t.call(this,{message:e})}catch(e){kj.error(`RuntimeWebSocket onerror handler error:`,e)}}send(e){if(this._readyState!==yj.OPEN)throw Error(`WebSocket is not open`);let t,n;typeof e==`string`?(t=new TextEncoder().encode(e),n=vj.TEXT):e instanceof ArrayBuffer?(t=new Uint8Array(e),n=vj.BINARY):(t=e,n=vj.BINARY),this._sendFrame(n,t)}close(e=1e3,t=``){this._readyState===yj.CLOSED||this._readyState===yj.CLOSING||(this._readyState=yj.CLOSING,this._connId!==null&&this._handshakeComplete?(this._sendCloseFrame(e,t),gn(()=>{this._readyState===yj.CLOSING&&(this._readyState=yj.CLOSED,this._emitClose(e,t,!0),this._cleanup())},100)):(this._readyState=yj.CLOSED,this._emitClose(e,t,!0),this._cleanup()))}};C(Aj,`CONNECTING`,yj.CONNECTING),C(Aj,`OPEN`,yj.OPEN),C(Aj,`CLOSING`,yj.CLOSING),C(Aj,`CLOSED`,yj.CLOSED),A(),w(),We(),Ke();const jj=D(`opfs-store`);var Mj=class e{constructor(e,t,n,r,i){C(this,`rootDir`,void 0),C(this,`inodesDir`,void 0),C(this,`metaHandle`,void 0),C(this,`inodeHandles`,void 0),C(this,`pendingInodes`,void 0),C(this,`pendingDeletes`,void 0),C(this,`getMemory`,void 0),this.rootDir=e,this.inodesDir=t,this.metaHandle=n,this.inodeHandles=r,this.pendingInodes=new Map,this.pendingDeletes=new Set,this.getMemory=i}static create(t,n){return T(function*(){let r=yield(yield(yield navigator.storage.getDirectory()).getDirectoryHandle(`substrate-stores`,{create:!0})).getDirectoryHandle(t,{create:!0}),i=yield r.getDirectoryHandle(`inodes`,{create:!0}),a=yield(yield r.getFileHandle(`.meta`,{create:!0})).createSyncAccessHandle(),o=new Map;var s=!1,c=!1,l;try{for(var u=He(i.entries()),d;s=!(d=yield u.next()).done;s=!1){let[e,t]=d.value;if(t.kind===`file`){let n=parseInt(e);if(!isNaN(n)){let e=yield t.createSyncAccessHandle();o.set(n,e)}}}}catch(e){c=!0,l=e}finally{try{s&&u.return!=null&&(yield u.return())}finally{if(c)throw l}}return jj.debug(`Opened store "${t}" with ${o.size} existing inodes, meta size=${a.getSize()}`),new e(r,i,a,o,n)})()}readFile(e,t,n,r){let i=this.pendingInodes.get(e);if(i){let e=Math.max(0,i.data.length-t),a=Math.min(r,e);if(a>0){let e=this.getMemory();new Uint8Array(e.buffer,n,a).set(i.data.subarray(t,t+a))}return a}let a=this.inodeHandles.get(e);if(!a)return-1;let o=this.getMemory(),s=new Uint8Array(o.buffer,n,r);return a.read(s,{at:t})}writeFile(e,t,n,r){let i=this.pendingInodes.get(e);if(i){let e=t+r;if(e>i.data.length){let t=new Uint8Array(e);t.set(i.data),i.data=t}let a=this.getMemory(),o=new Uint8Array(a.buffer,n,r);return i.data.set(o,t),r}let a=this.inodeHandles.get(e);if(!a)return-1;let o=this.getMemory(),s=new Uint8Array(o.buffer,n,r),c=a.write(s,{at:t});return a.flush(),c}truncateFile(e,t){let n=this.pendingInodes.get(e);if(n){if(t<n.data.length)n.data=n.data.slice(0,t);else if(t>n.data.length){let e=new Uint8Array(t);e.set(n.data),n.data=e}return 0}let r=this.inodeHandles.get(e);return r?(r.truncate(t),r.flush(),0):-1}fileSize(e){let t=this.pendingInodes.get(e);if(t)return t.data.length;let n=this.inodeHandles.get(e);return n?n.getSize():-1}createFile(e){let t=this.inodeHandles.get(e);return t?(t.truncate(0),t.flush(),0):(this.pendingInodes.set(e,{data:new Uint8Array}),this.pendingDeletes.delete(e),0)}deleteFile(e){if(this.pendingInodes.delete(e))return 0;let t=this.inodeHandles.get(e);return t&&(t.close(),this.inodeHandles.delete(e)),this.pendingDeletes.add(e),0}readMetadata(e,t){if(this.metaHandle.getSize()===0)return-1;let n=this.getMemory(),r=new Uint8Array(n.buffer,e,t),i=this.metaHandle.read(r,{at:0});return jj.debug(`readMetadata: ${i} bytes`),i}writeMetadata(e,t){let n=this.getMemory(),r=new Uint8Array(n.buffer,e,t);return this.metaHandle.truncate(0),this.metaHandle.write(r,{at:0}),this.metaHandle.flush(),jj.debug(`writeMetadata: ${t} bytes`),0}flushPending(){var e=this;return T(function*(){for(let[t,n]of e.pendingInodes){let r=yield(yield e.inodesDir.getFileHandle(String(t),{create:!0})).createSyncAccessHandle();r.truncate(0),n.data.length>0&&r.write(n.data,{at:0}),r.flush(),e.inodeHandles.set(t,r),jj.trace(`flushPending: materialized inode ${t} (${n.data.length} bytes)`)}let t=e.pendingInodes.size;e.pendingInodes.clear();for(let t of e.pendingDeletes)try{yield e.inodesDir.removeEntry(String(t)),jj.trace(`flushPending: deleted inode ${t}`)}catch(e){}let n=e.pendingDeletes.size;e.pendingDeletes.clear(),(t>0||n>0)&&jj.debug(`flushPending: ${t} materialized, ${n} deleted`)})()}close(){var e=this;return T(function*(){e.metaHandle.close();for(let t of e.inodeHandles.values())t.close();e.inodeHandles.clear(),e.pendingInodes.clear(),jj.debug(`Store closed`)})()}static list(){return T(function*(){try{let a=yield(yield navigator.storage.getDirectory()).getDirectoryHandle(`substrate-stores`),o=[];var e=!1,t=!1,n;try{for(var r=He(a.entries()),i;e=!(i=yield r.next()).done;e=!1){let[e,t]=i.value;t.kind===`directory`&&o.push(e)}}catch(e){t=!0,n=e}finally{try{e&&r.return!=null&&(yield r.return())}finally{if(t)throw n}}return o}catch(e){return[]}})()}static delete(e){return T(function*(){yield(yield(yield navigator.storage.getDirectory()).getDirectoryHandle(`substrate-stores`)).removeEntry(e,{recursive:!0}),jj.debug(`Deleted store "${e}"`)})()}};Xs(),A(),Mc(),kt(),Vx(),au(),uA(),Ke(),uo();const $=D(`host`);let Nj=null,Pj=null;const Fj=new Map;function Ij(e){return(...t)=>{let n=t.map(e=>{if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(e instanceof Error)return{__error:!0,message:e.message,stack:e.stack};if(e instanceof URL)return e.href;try{return structuredClone(e),e}catch(t){try{return String(e)}catch(e){return`[unserializable]`}}});postMessage({type:`log`,level:e,args:n})}}console.log=Ij(`log`),console.info=Ij(`info`),console.warn=Ij(`warn`),console.error=Ij(`error`),console.debug=Ij(`debug`);function Lj(e,t){for(let[n,r]of Object.entries(e)){let e=kc(t,n);if(`file`in r){Il(Tc(e),!0);let t=r.file.contents;kl(e,typeof t==`string`?new TextEncoder().encode(t):new Uint8Array(t))}else `directory`in r&&(Il(e,!0),Lj(r.directory,e))}}function Rj(e){return zj.apply(this,arguments)}function zj(){return zj=T(function*(e){var t,n,r,i,a,o;if(Nj)return{initialized:!0};e.logging&&(e.logging.level&&(globalThis.__SUBSTRATE_LOG_LEVEL=e.logging.level),e.logging.components&&(globalThis.__SUBSTRATE_LOG_COMPONENTS=e.logging.components,e.logging.components.length>0&&$.info(`Log components filter: ${e.logging.components.join(`, `)}`))),$.debug(`Initializing Substrate runtime...`),$.debug(`Log level set to: ${(t=(n=e.logging)==null?void 0:n.level)==null?`<not set>`:t}`),$.debug(`Log components filter: ${(r=(i=e.logging)==null||(i=i.components)==null?void 0:i.join(`, `))==null?`none`:r}`),(a=e.debug)!=null&&a.trackVfs&&(globalThis.__SUBSTRATE_TRACK_VFS_SIZE=!0,$.info(`VFS tracking enabled`));let s=(o=e.config)==null?void 0:o.storeName;return s&&(yield Jj(s)),Nj=yield UA({kernel:e.kernel,cwd:e.cwd,env:e.env,argv:e.argv,config:e.config,binaries:e.binaries,wasmPackages:e.wasmPackages}),s&&Pj&&((yield Promise.resolve().then(()=>(LA(),dA))).fsMountPersistent()<0?$.debug(`No persistent data to mount (new or empty store)`):($.debug(`Mounted persistent VFS from store "${s}"`),nA())),Os((e,t,n)=>{Ut.debug(`[Worker] Port event: ${e} port=${t} hostname=${n}`),e===`listen`?postMessage({type:`port_listen`,port:t,hostname:n}):postMessage({type:`port_close`,port:t})}),$.debug(`Substrate runtime initialized`),{initialized:!0}}),zj.apply(this,arguments)}function Bj(e){return Vj.apply(this,arguments)}function Vj(){return Vj=T(function*(e){if(!Nj)throw Error(`Runtime not initialized`);return $.trace(`mounting tree: files=[${Object.keys(e.tree).join(`, `)}] mountPoint=${e.mountPoint}`),Lj(e.tree,e.mountPoint),yield rA(),{mounted:!0}}),Vj.apply(this,arguments)}function Hj(e){var t;if(!Nj)throw Error(`Runtime not initialized`);let{command:n,args:r,options:i={}}=e;$.debug(`handleSpawn: command=${n} args=${JSON.stringify(r)} options=${JSON.stringify(i)}`);let a=Fx(n),o=(t=i.cwd)==null?Nj.rootProcess.cwd:t,s=B(B({},Nj.rootProcess.env),i.env),c=E(`proc_spawn`,{parent_pid:1});if(!c.pid)throw Error(`Failed to spawn process`);let l=c.pid,u=c.stdout_fd,d=c.stderr_fd;$.debug(`handleSpawn: spawned pid=${l} parent_stdout_fd=${u} parent_stderr_fd=${d}`);let f=Nj.processManager.createChildContext(l,{command:n,ppid:1,cwd:o,env:s,argv:r,kernel:Nj.kernel});a.start(n,r,f,e=>{$.debug(`Process ${n} exited with code ${e}`),f.exit(e)});let p=!1,m=!1,h=!0,g=()=>{if(!p){let e=Ot(`fs_read_fd`,{pid:1,fd:u,length:16384});if(e){if(e.bytes&&e.bytes.length>0){let t=new TextDecoder().decode(new Uint8Array(e.bytes));$.trace(`handleSpawn: pumping ${t.length} chars stdout for pid=${l}`),postMessage({type:`proc_stdout`,pid:l,data:t})}e.eof&&($.trace(`handleSpawn: stdout pipe closed for pid=${l}`),p=!0)}}if(!m){let e=Ot(`fs_read_fd`,{pid:1,fd:d,length:16384});if(e){if(e.bytes&&e.bytes.length>0){let t=new TextDecoder().decode(new Uint8Array(e.bytes));$.trace(`handleSpawn: pumping ${t.length} chars stderr for pid=${l}`),postMessage({type:`proc_stderr`,pid:l,data:t})}e.eof&&($.trace(`handleSpawn: stderr pipe closed for pid=${l}`),m=!0)}}return!p||!m},_=()=>{if(!h)return;g();let e=Ot(`proc_wait`,{pid:l});if(e&&`exit_code`in e){$.debug(`Process ${l} exited with code ${e.exit_code} signal=${e.signal}`),g(),Ms(l),h=!1;let t=e.exit_code;rA().then(()=>{postMessage({type:`proc_exit`,pid:l,exitCode:t})}).catch(e=>{$.error(`Error waiting for pending installations: ${e}`),postMessage({type:`proc_exit`,pid:l,exitCode:t})});return}h&&setTimeout(_,0)};return setTimeout(_,0),$.debug(`Process ${n} spawned with pid=${l}`),{spawned:!0,pid:l}}function Uj(e){return Wj.apply(this,arguments)}function Wj(){return Wj=T(function*(e){if(!Nj)throw Error(`Runtime not initialized`);$.debug(`handleHttpFetch: url=${e.url} method=${e.method}`);let t=new Headers;for(let[n,r]of e.headers)t.append(n,r);let n=e.body;$.debug(`handleHttpFetch: calling substrateFetch...`);let r=yield Is(e.url,{method:e.method,headers:t,body:n});$.debug(`handleHttpFetch: substrateFetch returned status=${r.status}`);let i=yield r.arrayBuffer(),a=[];if(r.headers.forEach((e,t)=>{a.push([t,e])}),(r.headers.get(`content-type`)||``).includes(`text/html`)){let e=new TextDecoder().decode(i),t=`<script>(function() {
|
|
79
|
+
if (typeof window === "undefined" || !navigator.serviceWorker?.controller) return;
|
|
80
|
+
|
|
81
|
+
var NativeWebSocket = window.WebSocket;
|
|
82
|
+
var activeWebSockets = new Map();
|
|
83
|
+
var nextWsId = 1;
|
|
84
|
+
var clientId = Date.now() + "-" + Math.random().toString(36).slice(2);
|
|
85
|
+
|
|
86
|
+
function ShimWebSocket(url, protocols) {
|
|
87
|
+
var self = this;
|
|
88
|
+
this._listeners = { open: [], message: [], error: [], close: [] };
|
|
89
|
+
this.url = typeof url === "string" ? url : url.toString();
|
|
90
|
+
this._readyState = 0;
|
|
91
|
+
this._protocol = "";
|
|
92
|
+
this._extensions = "";
|
|
93
|
+
this._bufferedAmount = 0;
|
|
94
|
+
this.binaryType = "blob";
|
|
95
|
+
this.onopen = null;
|
|
96
|
+
this.onmessage = null;
|
|
97
|
+
this.onerror = null;
|
|
98
|
+
this.onclose = null;
|
|
99
|
+
|
|
100
|
+
var parsedUrl = new URL(this.url, window.location.href);
|
|
101
|
+
var isLocalhost = parsedUrl.hostname === "localhost" || parsedUrl.hostname === "127.0.0.1";
|
|
102
|
+
|
|
103
|
+
if (!isLocalhost) {
|
|
104
|
+
this._native = new NativeWebSocket(url, protocols);
|
|
105
|
+
this._native.onopen = function(e) {
|
|
106
|
+
self._readyState = 1;
|
|
107
|
+
if (self.onopen) self.onopen.call(self, e);
|
|
108
|
+
self._dispatch("open", e);
|
|
109
|
+
};
|
|
110
|
+
this._native.onmessage = function(e) {
|
|
111
|
+
if (self.onmessage) self.onmessage.call(self, e);
|
|
112
|
+
self._dispatch("message", e);
|
|
113
|
+
};
|
|
114
|
+
this._native.onerror = function(e) {
|
|
115
|
+
if (self.onerror) self.onerror.call(self, e);
|
|
116
|
+
self._dispatch("error", e);
|
|
117
|
+
};
|
|
118
|
+
this._native.onclose = function(e) {
|
|
119
|
+
self._readyState = 3;
|
|
120
|
+
if (self.onclose) self.onclose.call(self, e);
|
|
121
|
+
self._dispatch("close", e);
|
|
122
|
+
};
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
this._wsId = nextWsId++;
|
|
127
|
+
activeWebSockets.set(this._wsId, this);
|
|
128
|
+
|
|
129
|
+
var protocolArray = Array.isArray(protocols) ? protocols : protocols ? [protocols] : [];
|
|
130
|
+
navigator.serviceWorker.controller.postMessage({
|
|
131
|
+
type: "substrate_ws_connect",
|
|
132
|
+
clientId: clientId,
|
|
133
|
+
wsId: this._wsId,
|
|
134
|
+
url: this.url,
|
|
135
|
+
protocols: protocolArray
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
ShimWebSocket.CONNECTING = 0;
|
|
140
|
+
ShimWebSocket.OPEN = 1;
|
|
141
|
+
ShimWebSocket.CLOSING = 2;
|
|
142
|
+
ShimWebSocket.CLOSED = 3;
|
|
143
|
+
|
|
144
|
+
ShimWebSocket.prototype = {
|
|
145
|
+
get readyState() { return this._native ? this._native.readyState : this._readyState; },
|
|
146
|
+
get protocol() { return this._native ? this._native.protocol : this._protocol; },
|
|
147
|
+
get extensions() { return this._native ? this._native.extensions : this._extensions; },
|
|
148
|
+
get bufferedAmount() { return this._native ? this._native.bufferedAmount : this._bufferedAmount; },
|
|
149
|
+
|
|
150
|
+
send: function(data) {
|
|
151
|
+
if (this._native) { this._native.send(data); return; }
|
|
152
|
+
if (this._readyState !== 1) throw new DOMException("WebSocket is not open", "InvalidStateError");
|
|
153
|
+
|
|
154
|
+
var payload;
|
|
155
|
+
if (typeof data === "string") {
|
|
156
|
+
payload = data;
|
|
157
|
+
} else if (data instanceof ArrayBuffer) {
|
|
158
|
+
payload = new Uint8Array(data);
|
|
159
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
160
|
+
payload = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
161
|
+
} else if (data instanceof Blob) {
|
|
162
|
+
var self = this;
|
|
163
|
+
data.arrayBuffer().then(function(buffer) {
|
|
164
|
+
if (self._readyState === 1) {
|
|
165
|
+
navigator.serviceWorker.controller.postMessage({
|
|
166
|
+
type: "substrate_ws_send", clientId: clientId, wsId: self._wsId,
|
|
167
|
+
data: new Uint8Array(buffer)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
return;
|
|
172
|
+
} else {
|
|
173
|
+
throw new TypeError("Invalid data type");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
navigator.serviceWorker.controller.postMessage({
|
|
177
|
+
type: "substrate_ws_send", clientId: clientId, wsId: this._wsId, data: payload
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
close: function(code, reason) {
|
|
182
|
+
if (this._native) { this._native.close(code, reason); return; }
|
|
183
|
+
if (this._readyState >= 2) return;
|
|
184
|
+
this._readyState = 2;
|
|
185
|
+
navigator.serviceWorker.controller.postMessage({
|
|
186
|
+
type: "substrate_ws_close", clientId: clientId, wsId: this._wsId, code: code, reason: reason
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
addEventListener: function(type, listener) {
|
|
191
|
+
if (this._native) { this._native.addEventListener(type, listener); return; }
|
|
192
|
+
if (this._listeners[type]) this._listeners[type].push(listener);
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
removeEventListener: function(type, listener) {
|
|
196
|
+
if (this._native) { this._native.removeEventListener(type, listener); return; }
|
|
197
|
+
var arr = this._listeners[type];
|
|
198
|
+
if (arr) {
|
|
199
|
+
var idx = arr.indexOf(listener);
|
|
200
|
+
if (idx !== -1) arr.splice(idx, 1);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
dispatchEvent: function(event) {
|
|
205
|
+
this._dispatch(event.type, event);
|
|
206
|
+
return true;
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
_dispatch: function(type, event) {
|
|
210
|
+
var arr = this._listeners[type];
|
|
211
|
+
if (arr) arr.forEach(function(fn) { try { fn(event); } catch(e) { console.error("[substrate-ws-shim] listener error:", e); } });
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
_handleOpen: function(protocol) {
|
|
215
|
+
if (this._readyState !== 0) return;
|
|
216
|
+
this._readyState = 1;
|
|
217
|
+
this._protocol = protocol;
|
|
218
|
+
var e = new Event("open");
|
|
219
|
+
if (this.onopen) this.onopen.call(this, e);
|
|
220
|
+
this._dispatch("open", e);
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
_handleMessage: function(data) {
|
|
224
|
+
if (this._readyState !== 1) return;
|
|
225
|
+
var messageData = typeof data === "string" ? data : data.buffer;
|
|
226
|
+
var e = new MessageEvent("message", { data: messageData });
|
|
227
|
+
if (this.onmessage) this.onmessage.call(this, e);
|
|
228
|
+
this._dispatch("message", e);
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
_handleClose: function(code, reason, wasClean) {
|
|
232
|
+
if (this._readyState === 3) return;
|
|
233
|
+
this._readyState = 3;
|
|
234
|
+
activeWebSockets.delete(this._wsId);
|
|
235
|
+
var e = new CloseEvent("close", { code: code, reason: reason, wasClean: wasClean });
|
|
236
|
+
if (this.onclose) this.onclose.call(this, e);
|
|
237
|
+
this._dispatch("close", e);
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
_handleError: function(message) {
|
|
241
|
+
var e = new Event("error");
|
|
242
|
+
e.message = message;
|
|
243
|
+
if (this.onerror) this.onerror.call(this, e);
|
|
244
|
+
this._dispatch("error", e);
|
|
245
|
+
if (this._readyState !== 3) this._handleClose(1006, message, false);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
navigator.serviceWorker.addEventListener("message", function(event) {
|
|
250
|
+
var msg = event.data;
|
|
251
|
+
if (!msg || typeof msg !== "object" || msg.clientId !== clientId) return;
|
|
252
|
+
var ws = activeWebSockets.get(msg.wsId);
|
|
253
|
+
if (!ws) return;
|
|
254
|
+
switch (msg.type) {
|
|
255
|
+
case "substrate_ws_open": ws._handleOpen(msg.protocol || ""); break;
|
|
256
|
+
case "substrate_ws_message": ws._handleMessage(msg.data); break;
|
|
257
|
+
case "substrate_ws_close": ws._handleClose(msg.code || 1000, msg.reason || "", msg.wasClean !== false); break;
|
|
258
|
+
case "substrate_ws_error": ws._handleError(msg.message || "WebSocket error"); break;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
window.WebSocket = ShimWebSocket;
|
|
263
|
+
})();<\/script>`,n;n=e.includes(`<head>`)?e.replace(`<head>`,`<head>${t}`):e.includes(`<head `)?e.replace(/<head\s[^>]*>/,e=>`${e}${t}`):e.includes(`<body>`)?e.replace(`<body>`,`<body>${t}`):e.includes(`<body `)?e.replace(/<body\s[^>]*>/,e=>`${e}${t}`):e.includes(`<!DOCTYPE`)||e.includes(`<!doctype`)?e.replace(/(<!DOCTYPE[^>]*>|<!doctype[^>]*>)/i,`$1${t}`):t+e,i=new TextEncoder().encode(n).buffer,$.debug(`handleHttpFetch: injected WebSocket shim into HTML response`)}return $.debug(`handleHttpFetch: returning ${i.byteLength} bytes`),{status:r.status,headers:a,body:new Uint8Array(i)}}),Wj.apply(this,arguments)}function Gj(e){if(!Nj)throw Error(`Runtime not initialized`);let{wsId:t,url:n,protocols:r}=e;Vt.debug(`handleWsConnect: wsId=${t}, url=${n}`);let i=new Aj(n,r);return Fj.set(t,i),i.onopen=e=>{postMessage({type:`ws_open`,wsId:t,protocol:e.protocol})},i.onmessage=e=>{let n;n=typeof e.data==`string`?e.data:new Uint8Array(e.data),postMessage({type:`ws_message`,wsId:t,data:n})},i.onclose=e=>{postMessage({type:`ws_close`,wsId:t,code:e.code,reason:e.reason,wasClean:e.wasClean}),Fj.delete(t)},i.onerror=e=>{postMessage({type:`ws_error`,wsId:t,message:e.message||`WebSocket error`})},{connected:!0}}function Kj(e){let t=Fj.get(e.wsId);if(!t)throw Error(`WebSocket ${e.wsId} not found`);return e.data,t.send(e.data),{sent:!0}}function qj(e){let t=Fj.get(e.wsId);if(!t)throw Error(`WebSocket ${e.wsId} not found`);return t.close(e.code,e.reason),{closed:!0}}function Jj(e){return Yj.apply(this,arguments)}function Yj(){return Yj=T(function*(e){Pj&&(yield Pj.close(),Pj=null),$.debug(`Opening OPFS store: ${e}`);let t=yield Promise.resolve().then(()=>(LA(),dA));Pj=yield Mj.create(e,()=>t.getMemory()),t.setHostImports({host_read_file:(e,t,n,r)=>Pj.readFile(e,t,n,r),host_write_file:(e,t,n,r)=>Pj.writeFile(e,t,n,r),host_truncate_file:(e,t)=>Pj.truncateFile(e,t),host_file_size:e=>Pj.fileSize(e),host_create_file:e=>Pj.createFile(e),host_delete_file:e=>Pj.deleteFile(e),host_load_metadata:(e,t)=>Pj.readMetadata(e,t),host_save_metadata:(e,t)=>Pj.writeMetadata(e,t)}),$.debug(`Host imports wired to OPFS store`)}),Yj.apply(this,arguments)}function Xj(e){return Zj.apply(this,arguments)}function Zj(){return Zj=T(function*(e){if(!Nj)throw Error(`Runtime not initialized`);return yield Jj(e),(yield Promise.resolve().then(()=>(LA(),dA))).fsMountPersistent()<0?$.debug(`No persistent data to mount (new or empty store)`):($.debug(`Mounted persistent VFS from store "${e}"`),nA()),{mounted:!0}}),Zj.apply(this,arguments)}function Qj(){return $j.apply(this,arguments)}function $j(){return $j=T(function*(){return{stores:yield Mj.list()}}),$j.apply(this,arguments)}function eM(e){return tM.apply(this,arguments)}function tM(){return tM=T(function*(e){return Pj&&(yield Pj.close(),Pj=null),yield Mj.delete(e),{deleted:!0}}),tM.apply(this,arguments)}function nM(){return rM.apply(this,arguments)}function rM(){return rM=T(function*(){if(!Nj)throw Error(`Runtime not initialized`);$.debug(`Flushing VFS to persistent store...`);let e=(yield Promise.resolve().then(()=>(LA(),dA))).fsFlush();return Pj&&(yield Pj.flushPending()),$.debug(`Flush complete (result=${e})`),{flushed:!0}}),rM.apply(this,arguments)}function iM(){return aM.apply(this,arguments)}function aM(){return aM=T(function*(){for(let e of Fj.values())try{e.close()}catch(e){}return Fj.clear(),Pj&&(yield Pj.close(),Pj=null),Nj&&(Nj.shutdown(),Nj=null),{shutdown:!0}}),aM.apply(this,arguments)}function oM(e){return sM.apply(this,arguments)}function sM(){return sM=T(function*(e){switch(e.type){case`init`:return Rj(e);case`syscall`:if(!Nj)throw Error(`Runtime not initialized`);if(e.op===`mount`)return Bj(e.args);if(e.op===`spawn`)return Hj(e.args);if(e.op===`fs_read_file`){let{path:t,encoding:n}=e.args,r=n==null?`utf8`:n,i=E(`fs_read_file`,{path:t});return{content:new TextDecoder(r).decode(i.bytes)}}if(e.op===`fs_write_file`){let{path:t,content:n}=e.args;return E(`fs_write_file`,{path:t,bytes:typeof n==`string`?new TextEncoder().encode(n):new Uint8Array(n),create:!0,truncate:!0}),{written:!0}}if(e.op===`fs_readdir`){let{path:t}=e.args;return E(`fs_readdir`,{path:t})}if(e.op===`fs_stat`){let{path:t}=e.args,n=E(`fs_stat`,{path:t});return{isFile:n.kind===`file`,isDirectory:n.kind===`dir`,size:n.size,mtime:n.mtime_ms}}if(e.op===`fs_exists`){let{path:t}=e.args;try{return E(`fs_stat`,{path:t}),!0}catch(e){return!1}}if(e.op===`fs_mkdir`){let{path:t,recursive:n}=e.args;return E(`fs_mkdir`,{path:t,recursive:n==null?!0:n}),{created:!0}}if(e.op===`fs_rm`){let{path:t,recursive:n}=e.args;return E(`fs_unlink`,{path:t,recursive:n==null?!0:n}),{removed:!0}}if(e.op===`proc_kill`){let{pid:t,signal:n}=e.args;return E(`proc_kill`,{pid:t,signal:n==null?`SIGTERM`:n}),{killed:!0}}if(e.op===`proc_list`){let{include_exited:t}=e.args,n=E(`proc_list`,{include_exited:t});return $.debug(`proc_list: ${JSON.stringify(n)}`),n}throw Error(`Unknown syscall: ${e.op}`);case`deliver`:if(!Nj)throw Error(`Runtime not initialized`);return Nj.deliver(e.msg);case`http_listen`:if(!Nj)throw Error(`Runtime not initialized`);return{ports:Fs()};case`http_fetch`:return Uj(e);case`ws_connect`:return Gj(e);case`ws_send`:return Kj(e);case`ws_close`:return qj(e);case`flush`:return nM();case`mount_store`:return Xj(e.storeName);case`list_stores`:return Qj();case`delete_store`:return eM(e.storeName);case`shutdown`:return iM();default:throw Error(`Unknown message type: ${e.type}`)}}),sM.apply(this,arguments)}self.onmessage=function(){var e=T(function*(e){let t=e.data,n=t.id;Ut.debug(`[Worker] Received message: type=${t.type} id=${n}`),Ut.trace(`Received message: type=${t.type} id=${n}`);try{Ut.trace(`Processing message: type=${t.type} id=${n}`);let e=yield oM(t);Ut.trace(`Message handled successfully: type=${t.type} id=${n}`),postMessage({type:`success`,id:n,result:e}),Ut.trace(`Response posted: type=${t.type} id=${n}`)}catch(e){let r=e instanceof Error?e:Error(String(e));$.error(`Worker message error: type=${t.type} id=${n} error=${r.message}`),postMessage({type:`error`,id:n,error:{message:r.message,code:r.code,stack:r.stack}})}});return function(t){return e.apply(this,arguments)}}(),postMessage({type:`ready`});
|
|
264
|
+
//# sourceMappingURL=runtime.js.map
|