@degreesign/chat 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @degreesign/chat
2
2
 
3
3
  One-shot on-device AI chat for browsers, workers and Node, running a wllama CPU
4
- engine with a wasm fallback. The host owns the messages and the UI; the package
5
- loads one model, streams one reply and reports status.
4
+ engine or a LiteRT-LM WebGPU engine. The host owns the messages and the UI; the
5
+ package loads one model, streams one reply and reports status.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@degreesign/chat.svg)](https://www.npmjs.com/package/@degreesign/chat)
8
8
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](#licensing)
@@ -32,8 +32,8 @@ loads one model, streams one reply and reports status.
32
32
  - On device: model weights download once, then every reply is generated locally.
33
33
  - Headless: the package returns text through callbacks and renders no UI.
34
34
  - Stateless: the host passes the whole message list and keeps its own history.
35
- - One engine: CPU through wllama with a wasm fallback, behind one `startLLM`
36
- runtime contract.
35
+ - Two engines: CPU through wllama and WebGPU through LiteRT-LM, behind one
36
+ `startLLM` runtime contract.
37
37
  - Images: a user turn can carry image URLs, sent only to a vision model and
38
38
  capped by the prompt budgets.
39
39
  - Reusable: the loaded model stays in memory for the next call.
@@ -55,20 +55,22 @@ yarn add @degreesign/chat
55
55
  pnpm add @degreesign/chat
56
56
  ```
57
57
 
58
- `@wllama/wllama` and `@wllama/wllama-compat` are build-time dependencies. The
59
- engine is bundled into the published build as a dynamic chunk and its wasm
60
- assets ship beside it, so a consumer installs nothing extra and resolves no
61
- engine import. Only the model weights are downloaded at runtime.
58
+ `@wllama/wllama`, `@wllama/wllama-compat` and `@litert-lm/core` are build-time
59
+ dependencies. The engines are bundled into the published build as dynamic
60
+ chunks and their wasm assets ship beside them, so a consumer installs nothing
61
+ extra and resolves no engine import. Only the model weights are downloaded at
62
+ runtime.
62
63
 
63
64
  The build emits:
64
65
 
65
66
  - `dist/browser/chat.min.mjs`, the ESM browser entry.
66
- - `dist/browser/engine-wllama.min.mjs`, the bundled engine, fetched only when a
67
- model starts.
67
+ - `dist/browser/engine-wllama.min.mjs` and
68
+ `dist/browser/engine-litert.min.mjs`, the bundled engines, fetched only when
69
+ a matching model starts.
68
70
  - `dist/node/chat.node.min.js` and `chat.node.min.mjs`, the CommonJS and ESM
69
- Node entries, with the same engine chunk beside them.
70
- - `dist/assets/wllama/`, the wllama wasm binaries and compat worker served next
71
- to the browser entry.
71
+ Node entries, with the same engine chunks beside them.
72
+ - `dist/assets/wllama/`, the wllama wasm binaries and compat worker.
73
+ - `dist/assets/litert/`, the LiteRT-LM wasm glue and binary.
72
74
  - `dist/index.d.ts`, declarations for every export.
73
75
 
74
76
  Build from source with `yarn build`; typecheck with `yarn typecheck`; test the
@@ -187,7 +189,7 @@ on failure. A preload owns no cancel function; a new load replaces it.
187
189
  | ----- | ----------- |
188
190
  | `availability` | `ChatStatus.online`, `.away` or `.offline`, derived from `status`. |
189
191
  | `status` | `LlmStatus`: `idle`, `downloading`, `ready`, `error` or `unsupported`. |
190
- | `backend` | `LlmBackend.cpu` or `.none`. |
192
+ | `backend` | `LlmBackend.cpu`, `.gpu` or `.none`. |
191
193
  | `supportsImages` | Whether the requested model accepts images. |
192
194
  | `ready` | Whether a model is loaded and accepts a reply. |
193
195
  | `loading` | Whether a download or load is in flight. |
@@ -202,20 +204,27 @@ with `requesting: false` marks the end of the call.
202
204
  ## Logging
203
205
 
204
206
  Console output stays off by default. Pass `logging: true` in a call to receive
205
- the package's censored engine logs and the engine's own logs for that call. The
206
- flag is per call, so a later call without it goes quiet again.
207
+ the package's censored engine logs and the wllama engine's own logs for that
208
+ call. The flag is per call, so a later call without it goes quiet again.
209
+ LiteRT-LM writes its wasm diagnostics straight to the console and does not
210
+ follow the flag.
207
211
 
208
212
  ## Models
209
213
 
210
- | `ChatModelId` | Name | Reasoning | Images | CPU |
211
- | ------------- | ---- | --------- | ------ | --- |
212
- | `qwen3_vl_2b` | Qwen3-VL 2B | Yes | Yes | Yes |
214
+ | `ChatModelId` | Name | Reasoning | Images | CPU | WebGPU |
215
+ | ------------- | ---- | --------- | ------ | --- | ------ |
216
+ | `qwen3_vl_2b` | Qwen3-VL 2B | Yes | Yes | Yes | No |
217
+ | `gemma4_e2b` | Gemma 4 E2B | Yes | Yes | No | Yes |
213
218
 
214
- The first call downloads the model through the CPU engine and caches it. Later
219
+ The first call downloads the model through its engine and caches it. Later
215
220
  calls reuse the loaded runtime. Only one model stays in memory.
216
221
 
217
222
  Qwen3-VL 2B downloads a vision projector of about 445 MB with the model, so its
218
- total download is about 1.5 GB.
223
+ total download is about 1.5 GB. It runs on the CPU engine.
224
+
225
+ Gemma 4 E2B downloads one `gemma-4-E2B-it.litertlm` file of about 2.6 GB. It
226
+ runs on the WebGPU engine with its vision encoder in the same file, so an
227
+ image prompt does not download a projector.
219
228
 
220
229
  ## Prompt assembly
221
230
 
@@ -247,22 +256,25 @@ user: {next turn}
247
256
 
248
257
  ## Engines and assets
249
258
 
250
- The engine is chosen per request:
259
+ The engine is chosen per model:
251
260
 
252
- 1. CPU through wllama when a browser exposes `WebAssembly`.
253
- 2. `LlmStatus.unsupported` in Node or in a process without wasm.
261
+ 1. WebGPU through LiteRT-LM when the model has a `litert` artifact and the
262
+ browser exposes `navigator.gpu` and `WebAssembly`.
263
+ 2. CPU through wllama when the model has a `cpu` artifact and the process
264
+ exposes `WebAssembly`.
265
+ 3. `LlmStatus.unsupported` otherwise, including Node.
254
266
 
255
- The CPU engine implements the internal `startLLM({ model, limits, signal,
256
- onProgress })` contract and returns the runtime object with `model`, `backend`,
257
- `contextSize`, `chat()` and `unload()`. `createChat` starts it for the requested
258
- model.
267
+ Both engines implement the internal `startLLM({ model, limits, signal,
268
+ onProgress })` contract and return the runtime object with `model`, `backend`,
269
+ `contextSize`, `chat()` and `unload()`. `createChat` starts the engine that
270
+ matches the requested model.
259
271
 
260
272
  The CPU engine derives a raw thread count from the device, then caps it at
261
273
  `limits.maxThreads`, default 2. The cap is applied after the raw maximum, so the
262
274
  engine never exceeds the device or the caller budget.
263
275
 
264
- Threads only take effect when the host page is cross-origin isolated. Serve it
265
- with both headers:
276
+ The CPU engine needs cross-origin isolation for its threads. Serve the page with
277
+ both headers:
266
278
 
267
279
  ```
268
280
  Cross-Origin-Opener-Policy: same-origin
@@ -281,21 +293,30 @@ self hosted. Chromium also accepts
281
293
  changed. A page inside an iframe is isolated only when every ancestor sets the
282
294
  same headers.
283
295
 
284
- Only one model stays on device. Loading a new model unloads the previous runtime
285
- and deletes other model caches. A quota failure purges every model cache before
286
- retrying, so a half written download never blocks the next attempt.
296
+ Each engine keeps its own cache. Loading a model unloads the previous runtime
297
+ and removes the previous model's cache. The CPU engine uses the wllama cache
298
+ manager; the GPU engine stores the single `.litertlm` file in Cache Storage
299
+ under `litertlm-models`. A quota failure purges the cache of the engine being
300
+ loaded. The GPU cache write is best effort: if the browser rejects it, the model
301
+ still loads from the network stream and the next call downloads it again.
302
+
303
+ A CPU vision model downloads its projector with the model and caches both. A
304
+ GPU vision model keeps its encoder in the single `.litertlm` file.
287
305
 
288
- A vision model downloads its projector with the model and caches both. A cache
289
- written before image support is replaced once, so the projector is fetched.
306
+ Both engines are bundled into `dist/browser` and `dist/node` as dynamic chunks.
307
+ The package ships the wllama binaries under `dist/assets/wllama` and the LiteRT
308
+ wasm under `dist/assets/litert`; model weights remain external.
290
309
 
291
- The engine is bundled into `dist/browser` and `dist/node` as a dynamic chunk.
292
- The package also ships the wllama binaries under `dist/assets/wllama`, and model
293
- weights remain external.
310
+ LiteRT-LM needs WebGPU and the JSPI and relaxed SIMD wasm features, currently
311
+ available in Chromium. It loads a 22.7 MB wasm binary from `dist/assets/litert`
312
+ and the 2.6 GB model file. The GPU engine reports progress while the file
313
+ downloads and 100% of the load phase while the model compiles.
294
314
 
295
315
  wllama needs the compat worker on the same origin. When the app serves the
296
316
  package from `node_modules` in development, auto resolution works. In
297
317
  production, copy `dist/assets/wllama` next to the app bundle so the resolved
298
- asset URLs stay valid.
318
+ asset URLs stay valid. The LiteRT wasm glue finds its binary in the same
319
+ directory, so copy `dist/assets/litert` beside the bundle as well.
299
320
 
300
321
  ## Node.js
301
322
 
@@ -303,10 +324,11 @@ The package imports and runs without a DOM, so it works in scripts, tests, SSR
303
324
  and server side orchestration. Everything except inference is available: prompt
304
325
  assembly, budgets, status state and cancellation.
305
326
 
306
- The wllama engine needs a browser worker and wasm runtime. In Node,
307
- `createChat` reports `LlmStatus.unsupported` and `ChatStatus.offline` through
308
- `onStatus`, and the reply callbacks stay silent. `preloadModel` resolves `false`
309
- and reports the same unsupported status.
327
+ Both engines need a browser: wllama needs a worker and a wasm runtime, and
328
+ LiteRT-LM needs WebGPU. In Node, `createChat` reports
329
+ `LlmStatus.unsupported` and `ChatStatus.offline` through `onStatus`, and the
330
+ reply callbacks stay silent. `preloadModel` resolves `false` and reports the
331
+ same unsupported status.
310
332
 
311
333
  ```js
312
334
  const { createChat, preloadModel, ChatModelId, LlmRole } = require("@degreesign/chat");
@@ -389,10 +411,11 @@ No. The host passes the full prompt on every call and keeps the reply.
389
411
  ### Does it support images?
390
412
 
391
413
  Yes, on models with vision support. Put image URLs in a user turn's `images`
392
- array. Qwen3-VL 2B is the shipped model, it accepts images and runs on the CPU
393
- engine. Each image is center-cropped to a square and resized to 288 x 288
394
- before the engine sees it. A model without vision drops images when the turn
395
- also has text; an image-only turn reports `Model does not accept images`.
414
+ array. Qwen3-VL 2B accepts images on the CPU engine and Gemma 4 E2B accepts
415
+ images on the WebGPU engine. Each image is center-cropped to a square and
416
+ resized to 288 x 288 before the engine sees it. A model without vision drops
417
+ images when the turn also has text; an image-only turn reports
418
+ `Model does not accept images`.
396
419
 
397
420
  ### Does it need a server?
398
421
 
@@ -401,20 +424,23 @@ includes no server component.
401
424
 
402
425
  ### Does it have runtime dependencies?
403
426
 
404
- No runtime dependencies. `@wllama/wllama` and `@wllama/wllama-compat` are
405
- build-time dependencies, bundled into the dynamic engine chunk and its wasm
406
- assets, so consumers resolve no engine import and download no engine code beyond
407
- the chunk they use.
427
+ No runtime dependencies. `@wllama/wllama`, `@wllama/wllama-compat` and
428
+ `@litert-lm/core` are build-time dependencies, bundled into the dynamic engine
429
+ chunks and their wasm assets, so consumers resolve no engine import and
430
+ download no engine code beyond the chunk they use.
408
431
 
409
432
  ### Where are the models stored?
410
433
 
411
- The CPU engine owns its cache through the wllama cache manager. The package
412
- stores no model data itself.
434
+ The CPU engine owns its cache through the wllama cache manager. The GPU engine
435
+ stores its model in Cache Storage under `litertlm-models`. The package stores no
436
+ model data itself.
413
437
 
414
438
  ### Which model should I pick?
415
439
 
416
- Qwen3-VL 2B is the only catalog model. It supports reasoning and images and runs
417
- on the CPU engine.
440
+ Qwen3-VL 2B supports reasoning and images on the CPU. Gemma 4 E2B supports
441
+ reasoning and images on WebGPU, with much faster image prompts but a larger
442
+ download and a slower first compile. Use Qwen for broad browser support and
443
+ Gemma when the host has Chromium WebGPU.
418
444
 
419
445
  ## Licensing
420
446
 
@@ -424,5 +450,6 @@ listed in `THIRD_PARTIES.md`. See `LICENSE`.
424
450
 
425
451
  ## Keywords
426
452
 
427
- `@degreesign/chat`, on-device AI chat, local LLM, wllama, wasm, chat controller,
428
- headless chat, TypeScript, browser, speech friendly replies.
453
+ `@degreesign/chat`, on-device AI chat, local LLM, wllama, litert, webgpu, gemma,
454
+ wasm, chat controller, headless chat, TypeScript, browser, speech friendly
455
+ replies.
@@ -0,0 +1 @@
1
+ var ModuleFactory=(()=>{var e=globalThis.document?.currentScript?.src;return async function(r={}){var t=r,n=!!globalThis.window,o=!!globalThis.WorkerGlobalScope,a=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type,i="./this.program",s=(e,r)=>{throw r};"undefined"!=typeof __filename?e=__filename:o&&(e=self.location.href);var u,l,c="";if(a){var m=require("node:fs");c=__dirname+"/",l=e=>(e=h(e)?new URL(e):e,m.readFileSync(e)),u=async(e,r=!0)=>(e=h(e)?new URL(e):e,m.readFileSync(e,r?void 0:"utf8")),process.argv.length>1&&(i=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),s=(e,r)=>{throw process.exitCode=e,r}}else if(n||o){try{c=new URL(".",e).href}catch{}o&&(l=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),u=async e=>{if(h(e))return new Promise((r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t(n.status)},n.onerror=t,n.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}var d,p,f=console.log.bind(console),g=console.error.bind(console),v=!1;var h=e=>e.startsWith("file://");var y;function w(){if(!$?.buffer?.resizable){var e=Ut.buffer;$=new Int8Array(e),ye=new Int16Array(e),t.HEAPU8=B=new Uint8Array(e),Be=new Uint16Array(e),t.HEAP32=F=new Int32Array(e),t.HEAPU32=j=new Uint32Array(e),Cr=new Float32Array(e),t.HEAPF64=xr=new Float64Array(e),I=new BigInt64Array(e),Ie=new BigUint64Array(e)}}function b(e){throw t.onAbort?.(e),g(e=`Aborted(${e})`),v=!0,e+=". Build with -sASSERTIONS for more info.",new WebAssembly.RuntimeError(e)}function _(){return e="litertlm_wasm_internal.wasm",t.locateFile?t.locateFile(e,c):c+e;var e}async function S(e){try{var r=await u(e);return new Uint8Array(r)}catch{}return function(e){if(l)return l(e);throw"both async and sync fetching of the wasm failed"}(e)}async function k(e,r,t){if(!e&&!h(r)&&!a)try{var n=fetch(r,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,t)}catch(e){g(`wasm streaming compile failed: ${e}`),g("falling back to ArrayBuffer instantiation")}return async function(e,r){try{var t=await S(e);return await WebAssembly.instantiate(t,r)}catch(e){g(`failed to asynchronously prepare wasm: ${e}`),b(e)}}(r,t)}var E=e=>{if(e instanceof C||"unwind"==e)return p;s(1,e)};class C{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var x=()=>R||!1,T=e=>{p=e,x()||(t.onExit?.(e),v=!0),s(e,new C(e))},P=(e,r)=>{p=e,T(e)},O=e=>{if(!v)try{return e()}catch(e){E(e)}finally{(()=>{if(!x())try{P(p)}catch(e){E(e)}})()}};function D(){return document.fullscreenElement??document.webkitFullscreenElement}var F,j,$,B,I,A=(e,r)=>setTimeout(()=>{O(e)},r),M=[],V={useWebGL:!1,isFullscreen:!1,pointerLock:!1,moduleContextCreatedCallbacks:[],preloadedImages:{},preloadedAudios:{},getCanvas:()=>t.canvas,init(){if(!V.initted){V.initted=!0;var e={canHandle:e=>!t.noImageDecoding&&/\.(jpg|jpeg|png|bmp|webp)$/i.test(e),handle:async(e,r)=>{var t=new Blob([e],{type:V.getMimetype(r)});t.size!==e.length&&(t=new Blob([new Uint8Array(e).buffer],{type:V.getMimetype(r)}));var n=URL.createObjectURL(t);return new Promise((t,o)=>{var a=new Image;a.onload=()=>{var o=document.createElement("canvas");o.width=a.width,o.height=a.height,o.getContext("2d").drawImage(a,0,0),V.preloadedImages[r]=o,URL.revokeObjectURL(n),t(e)},a.onerror=e=>{g(`Image ${n} could not be decoded`),o()},a.src=n})}};M.push(e);var r={canHandle:e=>!t.noAudioDecoding&&e.slice(-4)in{".ogg":1,".wav":1,".mp3":1},handle:async(e,r)=>new Promise((t,n)=>{var o=!1;function a(n){o||(o=!0,V.preloadedAudios[r]=n,t(e))}var i=new Blob([e],{type:V.getMimetype(r)}),s=URL.createObjectURL(i),u=new Audio;u.addEventListener("canplaythrough",()=>a(u)),u.onerror=t=>{o||(g(`warning: browser could not fully decode audio ${r}, trying slower base64 approach`),u.src="data:audio/x-"+r.slice(-3)+";base64,"+function(e){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="",n=0,o=0;for(var a of e)for(n=n<<8|a,o+=8;o>=6;){var i=n>>o-6&63;o-=6,t+=r[i]}return 2==o?(t+=r[(3&n)<<4],t+="=="):4==o&&(t+=r[(15&n)<<2],t+="="),t}(e),a(u))},u.src=s,A(()=>{a(u)},1e4)})};M.push(r);var n=V.getCanvas();n&&(document.addEventListener("pointerlockchange",function(){var e=V.getCanvas();V.pointerLock=document.pointerLockElement===e}),t.elementPointerLock&&n.addEventListener("click",e=>{!V.pointerLock&&V.getCanvas().requestPointerLock&&(V.getCanvas().requestPointerLock(),e.preventDefault())}))}},createContext(e,r,n,o){if(r&&t.ctx&&e==V.getCanvas())return t.ctx;var a,i;if(r){var s={antialias:!1,alpha:!1,majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1};if(o)for(var u in o)s[u]=o[u];"undefined"!=typeof GL&&(i=GL.createContext(e,s))&&(a=GL.getContext(i).GLctx)}else a=e.getContext("2d");return a?(n&&(t.ctx=a,r&&GL.makeContextCurrent(i),V.useWebGL=r,V.moduleContextCreatedCallbacks.forEach(e=>e()),V.init()),a):null},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen(e,r){V.lockPointer=e,V.resizeCanvas=r,void 0===V.lockPointer&&(V.lockPointer=!0),void 0===V.resizeCanvas&&(V.resizeCanvas=!1);var t=V.getCanvas();function n(){V.isFullscreen=!1;var e=t.parentNode;D()===e?(t.exitFullscreen=V.exitFullscreen,V.lockPointer&&t.requestPointerLock(),V.isFullscreen=!0,V.resizeCanvas?V.setFullscreenCanvasSize():V.updateCanvasDimensions(t)):(e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e),V.resizeCanvas?V.setWindowedCanvasSize():V.updateCanvasDimensions(t))}V.fullscreenHandlersInstalled||(V.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",n),document.addEventListener("webkitfullscreenchange",n));var o=document.createElement("div");t.parentNode.insertBefore(o,t),o.appendChild(t),o.requestFullscreen??=(o.webkitRequestFullscreen?()=>o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):null)??(o.webkitRequestFullScreen?()=>o.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):null),o.requestFullscreen()},exitFullscreen:()=>!!V.isFullscreen&&((document.exitFullscreen??document.webkitCancelFullScreen).apply(document,[]),!0),safeSetTimeout:(e,r)=>A(e,r),getMimetype:e=>({jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.slice(e.lastIndexOf(".")+1)]),getUserMedia:e=>navigator.mediaDevices.getUserMedia(e),getMouseWheelDelta(e){var r=0;switch(e.type){case"DOMMouseScroll":r=e.detail/3;break;case"mousewheel":r=e.wheelDelta/120;break;case"wheel":switch(r=e.deltaY,e.deltaMode){case 0:r/=100;break;case 1:r/=3;break;case 2:r*=80;break;default:b("unrecognized mouse wheel delta mode: "+e.deltaMode)}break;default:b("unrecognized mouse wheel event: "+e.type)}return r},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseCoords(e,r){var t=V.getCanvas(),n=t.getBoundingClientRect(),o=e-(window.scrollX+n.left),a=r-(window.scrollY+n.top);return{x:o*=t.width/n.width,y:a*=t.height/n.height}},setMouseCoords(e,r){const{x:t,y:n}=V.calculateMouseCoords(e,r);V.mouseMovementX=t-V.mouseX,V.mouseMovementY=n-V.mouseY,V.mouseX=t,V.mouseY=n},calculateMouseEvent(e){if(V.pointerLock)V.mouseMovementX=e.movementX,V.mouseMovementY=e.movementY,V.mouseX+=V.mouseMovementX,V.mouseY+=V.mouseMovementY;else{if("touchstart"===e.type||"touchend"===e.type||"touchmove"===e.type){var r=e.touch;if(void 0===r)return;var t=V.calculateMouseCoords(r.pageX,r.pageY);if("touchstart"===e.type)V.lastTouches[r.identifier]=t,V.touches[r.identifier]=t;else if("touchend"===e.type||"touchmove"===e.type){var n=V.touches[r.identifier];n||=t,V.lastTouches[r.identifier]=n,V.touches[r.identifier]=t}return}V.setMouseCoords(e.pageX,e.pageY)}},resizeListeners:[],updateResizeListeners(){var e=V.getCanvas();V.resizeListeners.forEach(r=>r(e.width,e.height))},setCanvasSize(e,r,t){var n=V.getCanvas();V.updateCanvasDimensions(n,e,r),t||V.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize(){if("undefined"!=typeof SDL){var e=j[SDL.screen>>>2>>>0];e|=8388608,F[SDL.screen>>>2>>>0]=e}V.updateCanvasDimensions(V.getCanvas()),V.updateResizeListeners()},setWindowedCanvasSize(){if("undefined"!=typeof SDL){var e=j[SDL.screen>>>2>>>0];e&=-8388609,F[SDL.screen>>>2>>>0]=e}V.updateCanvasDimensions(V.getCanvas()),V.updateResizeListeners()},updateCanvasDimensions(e,r,t){r&&t?(e.widthNative=r,e.heightNative=t):(r=e.widthNative,t=e.heightNative);var n=r,o=t;if(D()===e.parentNode&&"undefined"!=typeof screen){var a=Math.min(screen.width/n,screen.height/o);n=Math.round(n*a),o=Math.round(o*a)}V.resizeCanvas?(e.width!=n&&(e.width=n),e.height!=o&&(e.height=o),void 0!==e.style&&(e.style.removeProperty("width"),e.style.removeProperty("height"))):(e.width!=r&&(e.width=r),e.height!=t&&(e.height=t),void 0!==e.style&&(n!=r||o!=t?(e.style.setProperty("width",n+"px","important"),e.style.setProperty("height",o+"px","important")):(e.style.removeProperty("width"),e.style.removeProperty("height"))))}},z=e=>{for(;e.length>0;)e.shift()(t)},L=[],W=[],R=!0,U=e=>Lt(e),J=()=>Rt(),N={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=N.isAbs(e),t="/"===e.slice(-1);return(e=N.normalizeArray(e.split("/").filter(e=>!!e),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=N.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.slice(0,-1)),t+n):"."},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>N.normalize(e.join("/")),join2:(e,r)=>N.normalize(e+"/"+r)},G=e=>(G=(()=>{if(a){var e=require("node:crypto");return r=>(e.randomFillSync(r),0)}return e=>(crypto.getRandomValues(e),0)})())(e),H={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:fe.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=N.isAbs(o)}return(t?"/":"")+(r=N.normalizeArray(r.split("/").filter(e=>!!e),!t).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r<e.length&&""===e[r];r++);for(var t=e.length-1;t>=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=H.resolve(e).slice(1),r=H.resolve(r).slice(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}var u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(i))).join("/")}},q=new TextDecoder,Y=(e,r,t,n)=>{var o=r+t;if(n)return o;for(;e[r]&&!(r>=o);)++r;return r},X=(e,r=0,t,n)=>{var o=Y(e,r>>>=0,t,n);return q.decode(e.buffer?e.subarray(r,o):new Uint8Array(e.slice(r,o)))},Q=[],K=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},Z=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t>>>=0,a=t+n-1,i=0;i<e.length;++i){var s=e.codePointAt(i);if(s<=127){if(t>=a)break;r[t++>>>0]=s}else if(s<=2047){if(t+1>=a)break;r[t++>>>0]=192|s>>6,r[t++>>>0]=128|63&s}else if(s<=65535){if(t+2>=a)break;r[t++>>>0]=224|s>>12,r[t++>>>0]=128|s>>6&63,r[t++>>>0]=128|63&s}else{if(t+3>=a)break;r[t++>>>0]=240|s>>18,r[t++>>>0]=128|s>>12&63,r[t++>>>0]=128|s>>6&63,r[t++>>>0]=128|63&s,i++}}return r[t>>>0]=0,t-o},ee=(e,r,t)=>{var n=t>0?t:K(e)+1,o=new Array(n),a=Z(e,o,0,o.length);return r&&(o.length=a),o},re={ttys:[],init(){},shutdown(){},register(e,r){re.ttys[e]={input:[],output:[],ops:r},fe.registerDevice(e,re.stream_ops)},stream_ops:{open(e){var r=re.ttys[e.node.rdev];if(!r)throw new fe.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new fe.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new fe.ErrnoError(29)}if(void 0===s&&!a)throw new fe.ErrnoError(6);if(null==s)break;if(a++,r[t+i]=s,10===s)break}return a&&(e.node.atime=Date.now()),a},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new fe.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch(e){throw new fe.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char:e=>(()=>{if(!Q.length){var e=null;if(a){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=m.readSync(n,r,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}t>0&&(e=r.slice(0,t).toString("utf-8"))}else globalThis.window?.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e)return null;Q=ee(e,!0)}return Q.shift()})(),put_char(e,r){null===r||10===r?(f(X(e.output)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output?.length>0&&(f(X(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(g(X(e.output)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output?.length>0&&(g(X(e.output)),e.output=[])}}},te=(e,r)=>Math.ceil(e/r)*r,ne=e=>{e=te(e,65536);var r=Vt(65536,e);return r&&((e,r)=>{B.fill(0,e,e+r)})(r,e),r},oe={ops_table:null,mount:e=>oe.createNode(null,"/",16895,0),createNode(e,r,t,n){if(fe.isBlkdev(t)||fe.isFIFO(t))throw new fe.ErrnoError(63);oe.ops_table||={dir:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr,lookup:oe.node_ops.lookup,mknod:oe.node_ops.mknod,rename:oe.node_ops.rename,unlink:oe.node_ops.unlink,rmdir:oe.node_ops.rmdir,readdir:oe.node_ops.readdir,symlink:oe.node_ops.symlink},stream:{llseek:oe.stream_ops.llseek}},file:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr},stream:{llseek:oe.stream_ops.llseek,read:oe.stream_ops.read,write:oe.stream_ops.write,mmap:oe.stream_ops.mmap,msync:oe.stream_ops.msync}},link:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr,readlink:oe.node_ops.readlink},stream:{}},chrdev:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr},stream:fe.chrdev_stream_ops}};var o=fe.createNode(e,r,t,n);return fe.isDir(o.mode)?(o.node_ops=oe.ops_table.dir.node,o.stream_ops=oe.ops_table.dir.stream,o.contents={}):fe.isFile(o.mode)?(o.node_ops=oe.ops_table.file.node,o.stream_ops=oe.ops_table.file.stream,o.usedBytes=0,o.contents=oe.emptyFileContents??=new Uint8Array(0)):fe.isLink(o.mode)?(o.node_ops=oe.ops_table.link.node,o.stream_ops=oe.ops_table.link.stream):fe.isChrdev(o.mode)&&(o.node_ops=oe.ops_table.chrdev.node,o.stream_ops=oe.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[r]=o,e.atime=e.mtime=e.ctime=o.atime),o},getFileDataAsTypedArray:e=>e.contents.subarray(0,e.usedBytes),expandFileStorage(e,r){var t=e.contents.length;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),t&&(r=Math.max(r,256));var n=oe.getFileDataAsTypedArray(e);e.contents=new Uint8Array(r),e.contents.set(n)}},resizeFileStorage(e,r){if(e.usedBytes!=r){var t=e.contents;e.contents=new Uint8Array(r),e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=fe.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,fe.isDir(e.mode)?r.size=4096:fe.isFile(e.mode)?r.size=e.usedBytes:fe.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(const t of["mode","atime","mtime","ctime"])null!=r[t]&&(e[t]=r[t]);void 0!==r.size&&oe.resizeFileStorage(e,r.size)},lookup(e,r){throw oe.doesNotExistError||(oe.doesNotExistError=new fe.ErrnoError(44),oe.doesNotExistError.stack="<generic error, no stack>"),oe.doesNotExistError},mknod:(e,r,t,n)=>oe.createNode(e,r,t,n),rename(e,r,t){var n;try{n=fe.lookupNode(r,t)}catch(e){}if(n){if(fe.isDir(e.mode))for(var o in n.contents)throw new fe.ErrnoError(55);fe.hashRemoveNode(n)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=fe.lookupNode(e,r);for(var n in t.contents)throw new fe.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.contents)],symlink(e,r,t){var n=oe.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!fe.isLink(e.mode))throw new fe.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,n);return r.set(a.subarray(o,o+i),t),i},write(e,r,t,n,o,a){if(r.buffer===$.buffer&&(a=!1),!n)return 0;var i=e.node;return i.mtime=i.ctime=Date.now(),a?(i.contents=r.subarray(t,t+n),i.usedBytes=n):i.usedBytes||o?(oe.expandFileStorage(i,o+n),i.contents.set(r.subarray(t,t+n),o),i.usedBytes=Math.max(i.usedBytes,o+n)):(i.contents=r.slice(t,t+n),i.usedBytes=n),n},llseek(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&fe.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new fe.ErrnoError(28);return n},mmap(e,r,t,n,o){if(!fe.isFile(e.node.mode))throw new fe.ErrnoError(43);var a,i,s=e.node.contents;if(2&o||s.buffer!==$.buffer){if(i=!0,!(a=ne(r)))throw new fe.ErrnoError(48);s&&((t>0||t+r<s.length)&&(s=s.subarray?s.subarray(t,t+r):Array.prototype.slice.call(s,t,t+r)),$.set(s,a>>>0))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(e,r,t,n,o)=>(oe.stream_ops.write(e,r,0,n,t,!1),0)}},ae=e=>("string"==typeof e&&(e=ee(e,!0)),e.subarray||(e=new Uint8Array(e)),e),ie=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},se=(...e)=>fe.createDataFile(...e),ue=null,le=0,ce=null,me=e=>{le--,t.monitorRunDependencies?.(le),le||ce()},de=e=>{le||(ue=new Promise(e=>ce=e)),le++,t.monitorRunDependencies?.(le)},pe=async(e,r,t,n,o,a,i,s)=>{var l=r?H.resolve(N.join2(e,r)):e;de();try{var c=t;"string"==typeof t&&(c=await(async e=>{var r=await u(e);return new Uint8Array(r)})(t)),c=await(async(e,r)=>{for(var t of(void 0!==V&&V.init(),M))if(t.canHandle(r))return t.handle(e,r);return e})(c,l),s?.(),a||se(e,r,c,n,o,i)}finally{me()}},fe={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=fe.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return fe.isDir(this.mode)}get isDevice(){return fe.isChrdev(this.mode)}addListener(e,r=!1){var t={cb:e,exclusive:r},n=this.listeners??=new Set;return n.add(t),{listeners:n,entry:t}}notifyListeners(e){if(this.listeners){var r;for(var t of this.listeners)t.exclusive?(r||=[]).push(t):t.cb(e);if(r){var n=(this.exclTurn||0)%r.length;this.exclTurn=n+1,r[n].cb(e)}}}},lookupPath(e,r={}){if(!e)throw new fe.ErrnoError(44);r.follow_mount??=!0,N.isAbs(e)||(e=fe.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(e=>!!e),o=fe.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&r.parent)break;if("."!==n[i])if(".."!==n[i]){a=N.join2(a,n[i]);try{o=fe.lookupNode(o,n[i])}catch(e){if(44===e?.errno&&s&&r.noent_okay)return{path:a};throw e}if(!fe.isMountpoint(o)||s&&!r.follow_mount||(o=o.mounted.root),fe.isLink(o.mode)&&(!s||r.follow)){if(!o.node_ops.readlink)throw new fe.ErrnoError(52);var u=o.node_ops.readlink(o);N.isAbs(u)||(u=N.dirname(a)+"/"+u),e=u+"/"+n.slice(i+1).join("/");continue e}}else{if(a=N.dirname(a),fe.isRoot(o)){e=a+"/"+n.slice(i+1).join("/"),t--;continue e}o=o.parent}}return{path:a,node:o}}throw new fe.ErrnoError(32)},getPath(e){for(var r;;){if(fe.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%fe.nameTable.length},hashAddNode(e){var r=fe.hashName(e.parent.id,e.name);e.name_next=fe.nameTable[r],fe.nameTable[r]=e},hashRemoveNode(e){var r=fe.hashName(e.parent.id,e.name);if(fe.nameTable[r]===e)fe.nameTable[r]=e.name_next;else for(var t=fe.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=fe.mayLookup(e);if(t)throw new fe.ErrnoError(t);for(var n=fe.hashName(e.id,r),o=fe.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return fe.lookup(e,r)},createNode(e,r,t,n){var o=new fe.FSNode(e,r,t,n);return fe.hashAddNode(o),o},destroyNode(e){fe.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>fe.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup(e){if(!fe.isDir(e.mode))return 54;var r=fe.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!fe.isDir(e.mode))return 54;try{fe.lookupNode(e,r);return 20}catch(e){}return fe.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=fe.lookupNode(e,r)}catch(e){return e.errno}var o=fe.nodePermissions(e,"wx");if(o)return o;if(t){if(!fe.isDir(n.mode))return 54;if(fe.isRoot(n)||fe.getPath(n)===fe.cwd())return 10}else if(fe.isDir(n.mode))return 31;return 0},mayOpen(e,r){if(!e)return 44;if(fe.isLink(e.mode))return 32;var t=fe.flagsToPermissionString(r);return fe.isDir(e.mode)&&("r"!==t||576&r)?31:fe.nodePermissions(e,t)},checkOpExists(e,r){if(!e)throw new fe.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=fe.MAX_OPEN_FDS;e++)if(!fe.streams[e])return e;throw new fe.ErrnoError(33)},getStreamChecked(e){var r=fe.getStream(e);if(!r)throw new fe.ErrnoError(8);return r},getStream:e=>fe.streams[e],createStream:(e,r=-1)=>(e=Object.assign(new fe.FSStream,e),-1==r&&(r=fe.nextfd()),e.fd=r,fe.streams[r]=e,e),closeStream(e){fe.streams[e]=null},dupStream(e,r=-1){var t=fe.createStream(e,r);return t.stream_ops?.dup?.(t),t},doSetAttr(e,r,t){var n=e?.stream_ops.setattr,o=n?e:r;n??=r.node_ops.setattr,fe.checkOpExists(n,63);try{n(o,t)}catch(e){if(e instanceof RangeError)throw new fe.ErrnoError(22);throw e}},chrdev_stream_ops:{open(e){var r=fe.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new fe.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){fe.devices[e]={stream_ops:r}},getDevice:e=>fe.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){"function"==typeof e&&(r=e,e=!1),fe.syncFSRequests++,fe.syncFSRequests>1&&g(`warning: ${fe.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=fe.getMounts(fe.root.mount),n=0;function o(e){return fe.syncFSRequests--,r(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=t.length&&o(null)}for(var i of t)i.type.syncfs?i.type.syncfs(i,e,a):a(null)},mount(e,r,t){var n,o="/"===t,a=!t;if(o&&fe.root)throw new fe.ErrnoError(10);if(!o&&!a){var i=fe.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,fe.isMountpoint(n))throw new fe.ErrnoError(10);if(!fe.isDir(n.mode))throw new fe.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?fe.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var r=fe.lookupPath(e,{follow_mount:!1});if(!fe.isMountpoint(r.node))throw new fe.ErrnoError(28);var t=r.node,n=t.mounted,o=fe.getMounts(n);for(var[a,i]of Object.entries(fe.nameTable))for(;i;){var s=i.name_next;o.includes(i.mount)&&fe.destroyNode(i),i=s}t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod(e,r,t){var n=fe.lookupPath(e,{parent:!0}).node,o=N.basename(e);if(!o)throw new fe.ErrnoError(28);if("."===o||".."===o)throw new fe.ErrnoError(20);var a=fe.mayCreate(n,o);if(a)throw new fe.ErrnoError(a);if(!n.node_ops.mknod)throw new fe.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},statfs:e=>fe.statfsNode(fe.lookupPath(e,{follow:!0}).node),statfsStream:e=>fe.statfsNode(e.node),statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:fe.nextInode,ffree:fe.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create:(e,r=438)=>(r&=4095,r|=32768,fe.mknod(e,r,0)),mkdir:(e,r=511)=>(r&=1023,r|=16384,fe.mknod(e,r,0)),mkdirTree(e,r){var t=e.split("/"),n="";for(var o of t)if(o){(n||N.isAbs(e))&&(n+="/"),n+=o;try{fe.mkdir(n,r)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,r,t)=>(void 0===t&&(t=r,r=438),r|=8192,fe.mknod(e,r,t)),symlink(e,r){if(!H.resolve(e))throw new fe.ErrnoError(44);var t=fe.lookupPath(r,{parent:!0}).node;if(!t)throw new fe.ErrnoError(44);var n=N.basename(r),o=fe.mayCreate(t,n);if(o)throw new fe.ErrnoError(o);if(!t.node_ops.symlink)throw new fe.ErrnoError(63);return t.node_ops.symlink(t,n,e)},link(e,r,t){var n=fe.lookupPath(r,{parent:!0}).node;if(!n)throw new fe.ErrnoError(44);var o=N.basename(r),a=fe.mayCreate(n,o);if(a)throw new fe.ErrnoError(a);if(!n.node_ops.link)throw new fe.ErrnoError(34);return n.node_ops.link(n,o,e,t)},rename(e,r){var t,n,o=N.dirname(e),a=N.dirname(r),i=N.basename(e),s=N.basename(r);if(t=fe.lookupPath(e,{parent:!0}).node,n=fe.lookupPath(r,{parent:!0}).node,!t||!n)throw new fe.ErrnoError(44);if(t.mount!==n.mount)throw new fe.ErrnoError(75);var u,l=fe.lookupNode(t,i),c=H.relative(e,a);if("."!==c.charAt(0))throw new fe.ErrnoError(28);if("."!==(c=H.relative(r,o)).charAt(0))throw new fe.ErrnoError(55);try{u=fe.lookupNode(n,s)}catch(e){}if(l!==u){var m=fe.isDir(l.mode),d=fe.mayDelete(t,i,m);if(d)throw new fe.ErrnoError(d);if(d=u?fe.mayDelete(n,s,m):fe.mayCreate(n,s))throw new fe.ErrnoError(d);if(!t.node_ops.rename)throw new fe.ErrnoError(63);if(fe.isMountpoint(l)||u&&fe.isMountpoint(u))throw new fe.ErrnoError(10);if(n!==t&&(d=fe.nodePermissions(t,"w")))throw new fe.ErrnoError(d);fe.hashRemoveNode(l);try{t.node_ops.rename(l,n,s),l.parent=n}catch(e){throw e}finally{fe.hashAddNode(l)}}},rmdir(e){var r=fe.lookupPath(e,{parent:!0}).node,t=N.basename(e),n=fe.lookupNode(r,t),o=fe.mayDelete(r,t,!0);if(o)throw new fe.ErrnoError(o);if(!r.node_ops.rmdir)throw new fe.ErrnoError(63);if(fe.isMountpoint(n))throw new fe.ErrnoError(10);r.node_ops.rmdir(r,t),fe.destroyNode(n)},readdir(e){var r=fe.lookupPath(e,{follow:!0}).node;return fe.checkOpExists(r.node_ops.readdir,54)(r)},unlink(e){var r=fe.lookupPath(e,{parent:!0}).node;if(!r)throw new fe.ErrnoError(44);var t=N.basename(e),n=fe.lookupNode(r,t),o=fe.mayDelete(r,t,!1);if(o)throw new fe.ErrnoError(o);if(!r.node_ops.unlink)throw new fe.ErrnoError(63);if(fe.isMountpoint(n))throw new fe.ErrnoError(10);r.node_ops.unlink(r,t),fe.destroyNode(n)},readlink(e){var r=fe.lookupPath(e).node;if(!r)throw new fe.ErrnoError(44);if(!r.node_ops.readlink)throw new fe.ErrnoError(28);return r.node_ops.readlink(r)},stat(e,r){var t=fe.lookupPath(e,{follow:!r}).node;return fe.checkOpExists(t.node_ops.getattr,63)(t)},fstat(e){var r=fe.getStreamChecked(e),t=r.node,n=r.stream_ops.getattr,o=n?r:t;return n??=t.node_ops.getattr,fe.checkOpExists(n,63),n(o)},lstat:e=>fe.stat(e,!0),doChmod(e,r,t,n){fe.doSetAttr(e,r,{mode:4095&t|-4096&r.mode,ctime:Date.now(),dontFollow:n})},chmod(e,r,t){var n;"string"==typeof e?n=fe.lookupPath(e,{follow:!t}).node:n=e;fe.doChmod(null,n,r,t)},lchmod(e,r){fe.chmod(e,r,!0)},fchmod(e,r){var t=fe.getStreamChecked(e);fe.doChmod(t,t.node,r,!1)},doChown(e,r,t){fe.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,n){var o;"string"==typeof e?o=fe.lookupPath(e,{follow:!n}).node:o=e;fe.doChown(null,o,n)},lchown(e,r,t){fe.chown(e,r,t,!0)},fchown(e,r,t){var n=fe.getStreamChecked(e);fe.doChown(n,n.node,!1)},doTruncate(e,r,t){if(fe.isDir(r.mode))throw new fe.ErrnoError(31);if(!fe.isFile(r.mode))throw new fe.ErrnoError(28);var n=fe.nodePermissions(r,"w");if(n)throw new fe.ErrnoError(n);fe.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new fe.ErrnoError(28);var t;"string"==typeof e?t=fe.lookupPath(e,{follow:!0}).node:t=e;fe.doTruncate(null,t,r)},ftruncate(e,r){var t=fe.getStreamChecked(e);if(r<0||!(2097155&t.flags))throw new fe.ErrnoError(28);fe.doTruncate(t,t.node,r)},utime(e,r,t,n){var o=fe.lookupPath(e,{follow:!n});fe.doSetAttr(null,o.node,{atime:r,mtime:t,dontFollow:n})},open(e,r,t=438){if(""===e)throw new fe.ErrnoError(44);var n,o;if(t=64&(r=(e=>{if("string"!=typeof e)return e;var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r))?4095&t|32768:0,"object"==typeof e)n=e;else{o=e.endsWith("/");var a=fe.lookupPath(e,{follow:!(131072&r),noent_okay:!0});n=a.node,e=a.path}var i=!1;if(64&r)if(n){if(128&r)throw new fe.ErrnoError(20)}else{if(o)throw new fe.ErrnoError(31);n=fe.mknod(e,511|t,0),i=!0}if(!n)throw new fe.ErrnoError(44);if(fe.isChrdev(n.mode)&&(r&=-513),65536&r&&!fe.isDir(n.mode))throw new fe.ErrnoError(54);if(!i){var s=fe.mayOpen(n,r);if(s)throw new fe.ErrnoError(s)}512&r&&!i&&fe.truncate(n,0),r&=-131713;var u=fe.createStream({node:n,path:fe.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),i&&fe.chmod(n,511&t),u},close(e){if(fe.isClosed(e))throw new fe.ErrnoError(8);e.getdents&&(e.getdents=null),e.node?.notifyListeners(32);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{fe.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(fe.isClosed(e))throw new fe.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new fe.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new fe.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new fe.ErrnoError(28);if(fe.isClosed(e))throw new fe.ErrnoError(8);if(1==(2097155&e.flags))throw new fe.ErrnoError(8);if(fe.isDir(e.node.mode))throw new fe.ErrnoError(31);if(!e.stream_ops.read)throw new fe.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new fe.ErrnoError(70)}else o=e.position;var i=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=i),i},write(e,r,t,n,o,a){if(n<0||o<0)throw new fe.ErrnoError(28);if(fe.isClosed(e))throw new fe.ErrnoError(8);if(!(2097155&e.flags))throw new fe.ErrnoError(8);if(fe.isDir(e.node.mode))throw new fe.ErrnoError(31);if(!e.stream_ops.write)throw new fe.ErrnoError(28);e.seekable&&1024&e.flags&&fe.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new fe.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,a);return i||(e.position+=s),s},mmap(e,r,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&e.flags))throw new fe.ErrnoError(2);if(1==(2097155&e.flags))throw new fe.ErrnoError(2);if(!e.stream_ops.mmap)throw new fe.ErrnoError(43);if(!r)throw new fe.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new fe.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){r.flags=r.flags??0,r.encoding=r.encoding??"binary","utf8"!==r.encoding&&"binary"!==r.encoding&&b(`Invalid encoding type "${r.encoding}"`);var t=fe.open(e,r.flags),n=fe.stat(e).size,o=new Uint8Array(n);return fe.read(t,o,0,n,0),"utf8"===r.encoding&&(o=X(o)),fe.close(t),o},writeFile(e,r,t={}){t.flags=t.flags??577;var n=fe.open(e,t.flags,t.mode);r=ae(r),fe.write(n,r,0,r.byteLength,void 0,t.canOwn),fe.close(n)},cwd:()=>fe.currentPath,chdir(e){var r=fe.lookupPath(e,{follow:!0});if(null===r.node)throw new fe.ErrnoError(44);if(!fe.isDir(r.node.mode))throw new fe.ErrnoError(54);var t=fe.nodePermissions(r.node,"x");if(t)throw new fe.ErrnoError(t);fe.currentPath=r.path},createDefaultDirectories(){fe.mkdir("/tmp"),fe.mkdir("/home"),fe.mkdir("/home/web_user")},createDefaultDevices(){fe.mkdir("/dev"),fe.registerDevice(fe.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n,llseek:()=>0}),fe.mkdev("/dev/null",fe.makedev(1,3)),re.register(fe.makedev(5,0),re.default_tty_ops),re.register(fe.makedev(6,0),re.default_tty1_ops),fe.mkdev("/dev/tty",fe.makedev(5,0)),fe.mkdev("/dev/tty1",fe.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r||(G(e),r=e.byteLength),e[--r]);fe.createDevice("/dev","random",t),fe.createDevice("/dev","urandom",t),fe.mkdir("/dev/shm"),fe.mkdir("/dev/shm/tmp")},createSpecialDirectories(){fe.mkdir("/proc");var e=fe.mkdir("/proc/self");fe.mkdir("/proc/self/fd"),fe.mount({mount(){var r=fe.createNode(e,"fd",16895,73);return r.stream_ops={llseek:oe.stream_ops.llseek},r.node_ops={lookup(e,r){var t=+r,n=fe.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:t+1};return o.parent=o,o},readdir:()=>Array.from(fe.streams.entries()).filter(([e,r])=>r).map(([e,r])=>e.toString())},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?fe.createDevice("/dev","stdin",e):fe.symlink("/dev/tty","/dev/stdin"),r?fe.createDevice("/dev","stdout",null,r):fe.symlink("/dev/tty","/dev/stdout"),t?fe.createDevice("/dev","stderr",null,t):fe.symlink("/dev/tty1","/dev/stderr");fe.open("/dev/stdin",0),fe.open("/dev/stdout",1),fe.open("/dev/stderr",1)},staticInit(){fe.nameTable=new Array(4096),fe.mount(oe,{},"/"),fe.createDefaultDirectories(),fe.createDefaultDevices(),fe.createSpecialDirectories(),fe.filesystems={MEMFS:oe}},init(e,r,n){fe.initialized=!0,e??=t.stdin,r??=t.stdout,n??=t.stderr,fe.createStandardStreams(e,r,n)},quit(){for(var e of(fe.initialized=!1,fe.streams))e&&fe.close(e)},findObject(e,r){var t=fe.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{e=(n=fe.lookupPath(e,{follow:!r})).path}catch(e){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=fe.lookupPath(e,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=N.basename(e),n=fe.lookupPath(e,{follow:!r}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(e){t.error=e.errno}return t},createPath(e,r,t,n){e="string"==typeof e?e:fe.getPath(e);for(var o=r.split("/").reverse();o.length;){var a=o.pop();if(a){var i=N.join2(e,a);try{fe.mkdir(i)}catch(e){if(20!=e.errno)throw e}e=i}}return i},createFile(e,r,t,n,o){var a=N.join2("string"==typeof e?e:fe.getPath(e),r),i=ie(n,o);return fe.create(a,i)},createDataFile(e,r,t,n,o,a){var i=r;e&&(e="string"==typeof e?e:fe.getPath(e),i=r?N.join2(e,r):e);var s=ie(n,o),u=fe.create(i,s);if(t){t=ae(t),fe.chmod(u,146|s);var l=fe.open(u,577);fe.write(l,t,0,t.length,0,a),fe.close(l),fe.chmod(u,s)}},createDevice(e,r,t,n){var o=N.join2("string"==typeof e?e:fe.getPath(e),r),a=ie(!!t,!!n);fe.createDevice.major??=64;var i=fe.makedev(fe.createDevice.major++,0);return fe.registerDevice(i,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,r,n,o,a){for(var i=0,s=0;s<o;s++){var u;try{u=t()}catch(e){throw new fe.ErrnoError(29)}if(void 0===u&&!i)throw new fe.ErrnoError(6);if(null==u)break;i++,r[n+s]=u}return i&&(e.node.atime=Date.now()),i},write(e,r,t,o,a){for(var i=0;i<o;i++)try{n(r[t+i])}catch(e){throw new fe.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),i}}),fe.mkdev(o,a,i)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)b("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=l(e.url)}catch(e){throw new fe.ErrnoError(29)}},createLazyFile(e,r,t,n,a){class i{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open("HEAD",t,!1),e.send(null),e.status>=200&&e.status<300||304===e.status||b(`Couldn't load ${t}. Status: ${e.status}`);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,a=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,i=1048576;o||(i=n);var s=this;s.setDataGetter(e=>{var r=e*i,o=(e+1)*i-1;return o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,r)=>{e>r&&b(`invalid range (${e}, ${r}) or no bytes requested!`),r>n-1&&b(`only ${n} bytes available! programmer error!`);var o=new XMLHttpRequest;return o.open("GET",t,!1),n!==i&&o.setRequestHeader("Range",`bytes=${e}-${r}`),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),o.status>=200&&o.status<300||304===o.status||b(`Couldn't load ${t}. Status: ${o.status}`),void 0!==o.response?new Uint8Array(o.response||[]):ee(o.responseText??"",!0)})(r,o)),void 0===s.chunks[e]&&b("doXHR failed!"),s.chunks[e]}),!a&&n||(i=n=1,n=this.getter(0).length,i=n,f("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){o||b("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s={isDevice:!1,contents:new i}}else s={isDevice:!1,url:t};var u=fe.createFile(e,r,s,n,a);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};for(const[e,r]of Object.entries(u.stream_ops))l[e]=(...e)=>(fe.forceLoadFile(u),r(...e));function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s<i;s++)r[t+s]=a[o+s];else for(s=0;s<i;s++)r[t+s]=a.get(o+s);return i}return l.read=(e,r,t,n,o)=>(fe.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{fe.forceLoadFile(u);var a=ne(r);if(!a)throw new fe.ErrnoError(48);return c(e,$,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ge=(e,r,t)=>{if(!(e>>>=0))return"";var n=Y(B,e,r,t);return q.decode(B.subarray(e>>>0,n>>>0))},ve={currentUmask:18,calculateAt(e,r,t){if(N.isAbs(r))return r;var n;-100===e?n=fe.cwd():n=ve.getStreamFromFD(e).path;if(0==r.length){if(!t)throw new fe.ErrnoError(44);return n}return n+"/"+r},writeStat(e,r){j[e>>>2>>>0]=r.dev,j[e+4>>>2>>>0]=r.mode,j[e+8>>>2>>>0]=r.nlink,j[e+12>>>2>>>0]=r.uid,j[e+16>>>2>>>0]=r.gid,j[e+20>>>2>>>0]=r.rdev,I[e+24>>>3>>>0]=BigInt(r.size),F[e+32>>>2>>>0]=4096,F[e+36>>>2>>>0]=r.blocks;var t=r.atime.getTime(),n=r.mtime.getTime(),o=r.ctime.getTime();return I[e+40>>>3>>>0]=BigInt(Math.floor(t/1e3)),j[e+48>>>2>>>0]=t%1e3*1e3*1e3,I[e+56>>>3>>>0]=BigInt(Math.floor(n/1e3)),j[e+64>>>2>>>0]=n%1e3*1e3*1e3,I[e+72>>>3>>>0]=BigInt(Math.floor(o/1e3)),j[e+80>>>2>>>0]=o%1e3*1e3*1e3,I[e+88>>>3>>>0]=BigInt(r.ino),0},writeStatFs(e,r){j[e+4>>>2>>>0]=r.bsize,j[e+60>>>2>>>0]=r.bsize,I[e+8>>>3>>>0]=BigInt(r.blocks),I[e+16>>>3>>>0]=BigInt(r.bfree),I[e+24>>>3>>>0]=BigInt(r.bavail),I[e+32>>>3>>>0]=BigInt(r.files),I[e+40>>>3>>>0]=BigInt(r.ffree),j[e+48>>>2>>>0]=r.fsid,j[e+64>>>2>>>0]=r.flags,j[e+56>>>2>>>0]=r.namelen},doMsync(e,r,t,n,o){if(!fe.isFile(r.node.mode))throw new fe.ErrnoError(43);if(2&n)return 0;var a=B.subarray(e>>>0,e+t>>>0);fe.msync(r,a,o,t,n)},getStreamFromFD:e=>fe.getStreamChecked(e),varargs:void 0,getStr:e=>ge(e)};var he=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e);var ye,we=()=>{var e=F[+ve.varargs>>>2>>>0];return ve.varargs+=4,e},be=we;var _e=(e,r,t)=>Z(e,B,r,t);var Se=e=>j[e>>>2>>>0]+4294967296*F[e+4>>>2>>>0];var ke={},Ee=e=>{for(;e.length;){var r=e.pop();e.pop()(r)}};function Ce(e){return this.fromWireType(j[e>>>2>>>0])}var xe={},Te={},Pe={};class Oe extends Error{constructor(e){super(e),this.name="InternalError"}}var De=e=>{throw new Oe(e)},Fe=(e,r,t)=>{function n(r){var n=t(r);n.length!==e.length&&De("Mismatched type converter count");for(var o=0;o<e.length;++o)Me(e[o],n[o])}e.forEach(e=>Pe[e]=r);var o=new Array(r.length),a=[],i=0;for(let[e,t]of r.entries())Te.hasOwnProperty(t)?o[e]=Te[t]:(a.push(t),xe.hasOwnProperty(t)||(xe[t]=[]),xe[t].push(()=>{o[e]=Te[t],++i===a.length&&n(o)}));0===a.length&&n(o)},je=e=>{e>>>=0;for(var r="";;){var t=B[e++>>>0];if(!t)return r;r+=String.fromCharCode(t)}};class $e extends Error{constructor(e){super(e),this.name="BindingError"}}var Be,Ie,Ae=e=>{throw new $e(e)};function Me(e,r,t={}){return function(e,r,t={}){var n=r.name;if(e||Ae(`type "${n}" must have a positive integer typeid pointer`),Te.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;Ae(`Cannot register type '${n}' twice`)}if(Te[e]=r,delete Pe[e],xe.hasOwnProperty(e)){var o=xe[e];delete xe[e],o.forEach(e=>e())}}(e,r,t)}var Ve=(e,r,t)=>{switch(r){case 1:return t?e=>$[e>>>0]:e=>B[e>>>0];case 2:return t?e=>ye[e>>>1>>>0]:e=>Be[e>>>1>>>0];case 4:return t?e=>F[e>>>2>>>0]:e=>j[e>>>2>>>0];case 8:return t?e=>I[e>>>3>>>0]:e=>Ie[e>>>3>>>0];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};var ze=e=>{Ae(e.$$.ptrType.registeredClass.name+" instance already deleted")},Le=!1,We=e=>{},Re=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},Ue=e=>globalThis.FinalizationRegistry?(Le=new FinalizationRegistry(e=>{Re(e.$$)}),Ue=e=>{var r=e.$$;if(!!r.smartPtr){var t={$$:r};Le.register(e,t,e)}return e},We=e=>Le.unregister(e),Ue(e)):(Ue=e=>e,e),Je=[];function Ne(){}var Ge=(e,r)=>Object.defineProperty(r,"name",{value:e}),He={},qe=(e,r,t)=>{if(void 0===e[r].overloadTable){var n=e[r];e[r]=function(...n){return e[r].overloadTable.hasOwnProperty(n.length)||Ae(`Function '${t}' called with an invalid number of arguments (${n.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[n.length].apply(this,n)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Ye=(e,r,n)=>{t.hasOwnProperty(e)?((void 0===n||void 0!==t[e].overloadTable&&void 0!==t[e].overloadTable[n])&&Ae(`Cannot register public name '${e}' twice`),qe(t,e,e),t[e].overloadTable.hasOwnProperty(n)&&Ae(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),t[e].overloadTable[n]=r):(t[e]=r,t[e].argCount=n)};function Xe(e,r,t,n,o,a,i,s){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=a,this.upcast=i,this.downcast=s,this.pureVirtualFunctions=[]}var Qe=(e,r,t)=>{for(;r!==t;)r.upcast||Ae(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e},Ke=e=>{if(null===e)return"null";var r=typeof e;return"object"===r||"array"===r||"function"===r?e.toString():""+e};function Ze(e,r){if(null===r)return this.isReference&&Ae(`null is not a valid ${this.name}`),0;r.$$||Ae(`Cannot pass "${Ke(r)}" as a ${this.name}`),r.$$.ptr||Ae(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass;return Qe(r.$$.ptr,t,this.registeredClass)}function er(e,r){var t;if(null===r)return this.isReference&&Ae(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,t),t):0;r&&r.$$||Ae(`Cannot pass "${Ke(r)}" as a ${this.name}`),r.$$.ptr||Ae(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&Ae(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Qe(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===r.$$.smartPtr&&Ae("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:Ae(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,Sr.toHandle(()=>o.delete())),null!==e&&e.push(this.rawDestructor,t)}break;default:Ae("Unsupported sharing policy")}return t}function rr(e,r){if(null===r)return this.isReference&&Ae(`null is not a valid ${this.name}`),0;r.$$||Ae(`Cannot pass "${Ke(r)}" as a ${this.name}`),r.$$.ptr||Ae(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&Ae(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass;return Qe(r.$$.ptr,t,this.registeredClass)}var tr=(e,r,t)=>{if(r===t)return e;if(void 0===t.baseClass)return null;var n=tr(e,r,t.baseClass);return null===n?null:t.downcast(n)},nr={},or=(e,r)=>(r=((e,r)=>{for(void 0===r&&Ae("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r})(e,r),nr[r]),ar=(e,r)=>(r.ptrType&&r.ptr||De("makeClassHandle requires ptr and ptrType"),!!r.smartPtrType!==!!r.smartPtr&&De("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Ue(Object.create(e,{$$:{value:r,writable:!0}})));function ir(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=or(this.registeredClass,r);if(void 0!==t){if(0===t.$$.count.value)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?ar(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):ar(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a,i=this.registeredClass.getActualType(r),s=He[i];if(!s)return o.call(this);a=this.isConst?s.constPointerType:s.pointerType;var u=tr(r,this.registeredClass,a.registeredClass);return null===u?o.call(this):this.isSmartPointer?ar(a.registeredClass.instancePrototype,{ptrType:a,ptr:u,smartPtrType:this,smartPtr:e}):ar(a.registeredClass.instancePrototype,{ptrType:a,ptr:u})}function sr(e,r,t,n,o,a,i,s,u,l,c){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=i,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=l,this.rawDestructor=c,o||void 0!==r.baseClass?this.toWireType=er:n?(this.toWireType=Ze,this.destructorFunction=null):(this.toWireType=rr,this.destructorFunction=null)}var ur=(e,r,n)=>{t.hasOwnProperty(e)||De("Replacing nonexistent public symbol"),void 0!==t[e].overloadTable&&void 0!==n?t[e].overloadTable[n]=r:(t[e]=r,t[e].argCount=n)},lr=[],cr=e=>{var r=lr[e];return r||(lr[e]=r=Jt.get(e),Vr.isAsyncExport(r)&&(lr[e]=r=Vr.makeAsyncFunction(r))),r},mr=(e,r,t=!1)=>(...n)=>((e,r,t=[],n=!1)=>{var o=cr(r);n&&(o=WebAssembly.promising(o));var a=o(...t);function i(r){return"p"==e[0]?r>>>0:r}return n?a.then(i):i(a)})(e,r,n,t),dr=(e,r,t=!1)=>{e=je(e);var n=function(){if(e.includes("p"))return mr(e,r,t);var n=cr(r);return t&&(n=WebAssembly.promising(n)),n}();return"function"!=typeof n&&Ae(`unknown function pointer with signature ${e}: ${r}`),n};class pr extends Error{}var fr=e=>{var r=Mt(e),t=je(r);return ct(r),t},gr=(e,r)=>{var t=[],n={};throw r.forEach(function e(r){n[r]||Te[r]||(Pe[r]?Pe[r].forEach(e):(t.push(r),n[r]=!0))}),new pr(`${e}: `+t.map(fr).join([", "]))};function vr(e,r,t,n,o,a){var i=r.length;i<2&&Ae("argTypes array size mismatch! Must at least get return value and receiver (this) types!");var s=null!==r[1]&&null!==t,u=function(e){for(var r=1;r<e.length;++r)if(null!==e[r]&&void 0===e[r].destructorFunction)return!0;return!1}(r),l=!r[0].isVoid,c=i-2,m=new Array(c),d=[],p=[];return Ge(e,function(...e){var t;p.length=0,d.length=s?2:1,d[0]=o,s&&(t=r[1].toWireType(p,this),d[1]=t);for(var i=0;i<c;++i)m[i]=r[i+2].toWireType(p,e[i]),d.push(m[i]);var f=n(...d);function g(e){if(u)Ee(p);else for(var n=s?1:2;n<r.length;n++){var o=1===n?t:m[n-2];null!==r[n].destructorFunction&&r[n].destructorFunction(o)}if(l)return r[0].fromWireType(e)}return a?f.then(g):g(f)})}var hr=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(j[r+4*n>>>2>>>0]);return t},yr=e=>{const r=(e=e.trim()).indexOf("(");return-1===r?e:e.slice(0,r)},wr=[],br=[0,1,,1,null,1,!0,1,!1,1];function _r(e){if((e>>>=0)>9&&0===--br[e+1]){br[e];br[e]=void 0,wr.push(e)}}var Sr={toValue:e=>(e||Ae(`Cannot use deleted val. handle = ${e}`),br[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const r=wr.pop()||br.length;return br[r]=e,br[r+1]=1,r}}}},kr={name:"emscripten::val",fromWireType:e=>{var r=Sr.toValue(e);return _r(e),r},toWireType:(e,r)=>Sr.toHandle(r),readValueFromPointer:Ce,destructorFunction:null};var Er=(e,r,t)=>{switch(r){case 1:return t?function(e){return this.fromWireType($[e>>>0])}:function(e){return this.fromWireType(B[e>>>0])};case 2:return t?function(e){return this.fromWireType(ye[e>>>1>>>0])}:function(e){return this.fromWireType(Be[e>>>1>>>0])};case 4:return t?function(e){return this.fromWireType(F[e>>>2>>>0])}:function(e){return this.fromWireType(j[e>>>2>>>0])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};var Cr,xr,Tr=(e,r)=>{var t=Te[e];return void 0===t&&Ae(`${r} has unknown type ${fr(e)}`),t};var Pr=(e,r)=>{switch(r){case 4:return function(e){return this.fromWireType(Cr[e>>>2>>>0])};case 8:return function(e){return this.fromWireType(xr[e>>>3>>>0])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}};var Or=(e,r,t)=>{const n=(e,r)=>{let t=0;return{next(){if(t>=e)return{done:!0};const n=t;t++;return{value:r(n),done:!1}},[Symbol.iterator](){return this}}};e[Symbol.iterator]||(e[Symbol.iterator]=function(){const e=this[r]();return n(e,e=>this[t](e))})};var Dr=Object.assign({optional:!0},kr);var Fr=new TextDecoder("utf-16le"),jr=(e,r,t)=>{var n=e>>>1,o=Y(Be,n,r/2,t);return Fr.decode(Be.subarray(n>>>0,o>>>0))},$r=(e,r,t=2147483647)=>{if(t<2)return 0;for(var n=r,o=(t-=2)<2*e.length?t/2:e.length,a=0;a<o;++a){var i=e.charCodeAt(a);ye[r>>>1>>>0]=i,r+=2}return ye[r>>>1>>>0]=0,r-n},Br=e=>2*e.length,Ir=(e,r,t)=>{for(var n="",o=e>>>2,a=0;!(a>=r/4);a++){var i=j[o+a>>>0];if(!i&&!t)break;n+=String.fromCodePoint(i)}return n},Ar=(e,r,t=2147483647)=>{if(t<4)return 0;for(var n=r>>>=0,o=n+t-4,a=0;a<e.length;++a){var i=e.codePointAt(a);if(i>65535&&a++,F[r>>>2>>>0]=i,(r+=4)+4>o)break}return F[r>>>2>>>0]=0,r-n},Mr=e=>{for(var r=0,t=0;t<e.length;++t){e.codePointAt(t)>65535&&t++,r+=4}return r};var Vr={instrumentWasmImports(e){var r=/^(invoke_.*|__asyncjs__.*)$/;for(let[t,n]of Object.entries(e))if("function"==typeof n){(n.isAsync||r.test(t))&&(e[t]=n=new WebAssembly.Suspending(n))}},instrumentWasmExports(e){var r=/^(main|__main_argc_argv)$/;Vr.asyncExports=new Set;var t={};for(let[n,o]of Object.entries(e))if("function"==typeof o){r.test(n)&&(Vr.asyncExports.add(o),o=Vr.makeAsyncFunction(o)),t[n]=o}else t[n]=o;return t},asyncExports:null,isAsyncExport:e=>Vr.asyncExports?.has(e),handleAsync:async e=>{try{return await e()}finally{}},handleSleep:e=>Vr.handleAsync(()=>new Promise(e)),makeAsyncFunction:e=>WebAssembly.promising(e)},zr=function(e){return Vr.handleAsync(async()=>{e>>>=0;var r=await Sr.toValue(e);return Sr.toHandle(r)})};zr.isAsync=!0;var Lr=[],Wr={},Rr=e=>{var r=Wr[e];return void 0===r?je(e):r};var Ur=[0,31,60,91,121,152,182,213,244,274,305,335],Jr=[0,31,59,90,120,151,181,212,243,273,304,334],Nr=e=>{var r;return((r=e.getFullYear())%4==0&&(r%100!=0||r%400==0)?Ur:Jr)[e.getMonth()]+e.getDate()-1};var Gr=()=>performance.now();var Hr=[],qr=(e,r,t)=>{var n=((e,r)=>{var t;for(Hr.length=0;t=B[e++>>>0];){var n=105!=t;r+=(n&=112!=t)&&r%8?4:0,Hr.push(112==t?j[r>>>2>>>0]:106==t?I[r>>>3>>>0]:105==t?F[r>>>2>>>0]:xr[r>>>3>>>0]),r+=n?8:4}return Hr})(r,t);return Nt[e](...n)};var Yr={},Xr=e=>{var r=K(e)+1,t=lt(r);return t&&_e(e,t,r),t},Qr=e=>{var r;return(r=/\bwasm-function\[\d+\]:(0x[0-9a-f]+)/.exec(e))?+r[1]:(r=/:(\d+):\d+(?:\)|$)/.exec(e))?2147483648|+r[1]:0},Kr=e=>{for(var r of e){var t=Qr(r);t&&(Yr[t]=r)}},Zr=()=>(new Error).stack.toString();var et=e=>{var r=(e-Ut.buffer.byteLength+65535)/65536|0;try{return Ut.grow(r),w(),1}catch(e){}};var rt=function(e){return Vr.handleAsync(()=>new Promise(r=>setTimeout(r,e)))};rt.isAsync=!0;var tt=e=>{var r=K(e)+1,t=Wt(r);return _e(e,t,r),t},nt={Internals:{jsObjects:[],jsObjectInsert:(e,r)=>{e>>>=0,nt.Internals.jsObjects[e]=r},bufferOnUnmaps:[],futures:[],futureInsert:(e,r)=>{nt.Internals.futures[e]=new Promise(t=>r.finally(()=>t(e)))}},getJsObject:e=>{if(e)return e>>>=0,nt.Internals.jsObjects[e]},importJsAdapter:(e,r=0)=>{var t=Ot(r);return nt.Internals.jsObjects[t]=e,t},importJsBindGroup:(e,r=0)=>{var t=dt(r);return nt.Internals.jsObjects[t]=e,t},importJsBindGroupLayout:(e,r=0)=>{var t=pt(r);return nt.Internals.jsObjects[t]=e,t},importJsBuffer:(e,r=0)=>{var t;"unmapped"===e.mapState||b(t);var n=Dt(r);return nt.Internals.jsObjectInsert(n,e),n},importJsCommandBuffer:(e,r=0)=>{var t=ft(r);return nt.Internals.jsObjects[t]=e,t},importJsCommandEncoder:(e,r=0)=>{var t=gt(r);return nt.Internals.jsObjects[t]=e,t},importJsComputePassEncoder:(e,r=0)=>{var t=vt(r);return nt.Internals.jsObjects[t]=e,t},importJsComputePipeline:(e,r=0)=>{var t=ht(r);return nt.Internals.jsObjects[t]=e,t},importJsDevice:(e,r=0)=>{var t=jt(r),n=Ft(r,t);return nt.Internals.jsObjectInsert(t,e.queue),nt.Internals.jsObjectInsert(n,e),n},importJsExternalTexture:(e,r=0)=>{var t=yt(r);return nt.Internals.jsObjects[t]=e,t},importJsPipelineLayout:(e,r=0)=>{var t=wt(r);return nt.Internals.jsObjects[t]=e,t},importJsQuerySet:(e,r=0)=>{var t=bt(r);return nt.Internals.jsObjects[t]=e,t},importJsQueue:(e,r=0)=>{var t=jt(r);return nt.Internals.jsObjects[t]=e,t},importJsRenderBundle:(e,r=0)=>{var t=_t(r);return nt.Internals.jsObjects[t]=e,t},importJsRenderBundleEncoder:(e,r=0)=>{var t=St(r);return nt.Internals.jsObjects[t]=e,t},importJsRenderPassEncoder:(e,r=0)=>{var t=kt(r);return nt.Internals.jsObjects[t]=e,t},importJsRenderPipeline:(e,r=0)=>{var t=Et(r);return nt.Internals.jsObjects[t]=e,t},importJsSampler:(e,r=0)=>{var t=Ct(r);return nt.Internals.jsObjects[t]=e,t},importJsShaderModule:(e,r=0)=>{var t=$t(r);return nt.Internals.jsObjects[t]=e,t},importJsSurface:(e,r=0)=>{var t=xt(r);return nt.Internals.jsObjects[t]=e,t},importJsTexture:(e,r=0)=>{var t=Tt(r);return nt.Internals.jsObjects[t]=e,t},importJsTextureView:(e,r=0)=>{var t=Pt(r);return nt.Internals.jsObjects[t]=e,t},errorCallback:(e,r,t,n)=>{var o=J(),a=tt(t);cr(e)(r,a,n),U(o)},iterateExtensions:(e,r)=>{for(var t=j[e>>>2>>>0];t;t=j[t>>>2>>>0])r[F[t+4>>>2>>>0]](t)},setStringView:(e,r,t)=>{j[e>>>2>>>0]=r,j[e+4>>>2>>>0]=t},makeStringFromStringView:e=>{var r=j[e>>>2>>>0],t=j[e+4>>>2>>>0];return ge(r,t)},makeStringFromOptionalStringView:e=>{var r=j[e>>>2>>>0],t=j[e+4>>>2>>>0];return r?ge(r,t):0===t?"":void 0},makeColor:e=>({r:xr[e>>>3>>>0],g:xr[e+8>>>3>>>0],b:xr[e+16>>>3>>>0],a:xr[e+24>>>3>>>0]}),makeExtent3D:e=>({width:j[e>>>2>>>0],height:j[e+4>>>2>>>0],depthOrArrayLayers:j[e+8>>>2>>>0]}),makeOrigin3D:e=>({x:j[e>>>2>>>0],y:j[e+4>>>2>>>0],z:j[e+8>>>2>>>0]}),makeTexelCopyTextureInfo:e=>({texture:nt.getJsObject(j[e>>>2>>>0]),mipLevel:j[e+4>>>2>>>0],origin:nt.makeOrigin3D(e+8),aspect:nt.TextureAspect[F[e+20>>>2>>>0]]}),makeTexelCopyBufferLayout:e=>{var r=j[e+8>>>2>>>0],t=j[e+12>>>2>>>0];return{offset:Se(e),bytesPerRow:4294967295===r?void 0:r,rowsPerImage:4294967295===t?void 0:t}},makeTexelCopyBufferInfo:e=>{var r=e+0,t=nt.makeTexelCopyBufferLayout(r);return t.buffer=nt.getJsObject(j[e+16>>>2>>>0]),t},makePassTimestampWrites:e=>{if(0!==e)return{querySet:nt.getJsObject(j[e+4>>>2>>>0]),beginningOfPassWriteIndex:j[e+8>>>2>>>0],endOfPassWriteIndex:j[e+12>>>2>>>0]}},makePipelineConstants:(e,r)=>{if(e){for(var t={},n=0;n<e;++n){var o=r+24*n;t[nt.makeStringFromStringView(o+4)]=xr[o+16>>>3>>>0]}return t}},makePipelineLayout:e=>e?nt.getJsObject(e):"auto",makeComputeState:e=>{if(e)return{module:nt.getJsObject(j[e+4>>>2>>>0]),constants:nt.makePipelineConstants(j[e+16>>>2>>>0],j[e+20>>>2>>>0]),entryPoint:nt.makeStringFromOptionalStringView(e+8)}},makeComputePipelineDesc:e=>({label:nt.makeStringFromOptionalStringView(e+4),layout:nt.makePipelineLayout(j[e+12>>>2>>>0]),compute:nt.makeComputeState(e+16)}),makeRenderPipelineDesc:e=>{function r(e){if(e)return{operation:nt.BlendOperation[F[e>>>2>>>0]],srcFactor:nt.BlendFactor[F[e+4>>>2>>>0]],dstFactor:nt.BlendFactor[F[e+8>>>2>>>0]]}}function t(e){if(e)return{alpha:r(e+12),color:r(e+0)}}function n(e){var r=nt.TextureFormat[F[e+4>>>2>>>0]];return r?{format:r,blend:t(j[e+8>>>2>>>0]),writeMask:j[e+16>>>2>>>0]}:void 0}function o(e,r){for(var t=[],o=0;o<e;++o)t.push(n(r+24*o));return t}function a(e){return{compare:nt.CompareFunction[F[e>>>2>>>0]],failOp:nt.StencilOperation[F[e+4>>>2>>>0]],depthFailOp:nt.StencilOperation[F[e+8>>>2>>>0]],passOp:nt.StencilOperation[F[e+12>>>2>>>0]]}}function i(e){return{format:nt.VertexFormat[F[e+4>>>2>>>0]],offset:Se(e+8),shaderLocation:j[e+16>>>2>>>0]}}function s(e,r){for(var t=[],n=0;n<e;++n)t.push(i(r+24*n));return t}function u(e){if(e){var r=nt.VertexStepMode[F[e+4>>>2>>>0]],t=j[e+16>>>2>>>0];return r||t?{arrayStride:Se(e+8),stepMode:r,attributes:s(t,j[e+20>>>2>>>0])}:null}}function l(e,r){if(e){for(var t=[],n=0;n<e;++n)t.push(u(r+24*n));return t}}return{label:nt.makeStringFromOptionalStringView(e+4),layout:nt.makePipelineLayout(j[e+12>>>2>>>0]),vertex:function(e){if(e)return{module:nt.getJsObject(j[e+4>>>2>>>0]),constants:nt.makePipelineConstants(j[e+16>>>2>>>0],j[e+20>>>2>>>0]),buffers:l(j[e+24>>>2>>>0],j[e+28>>>2>>>0]),entryPoint:nt.makeStringFromOptionalStringView(e+8)}}(e+16),primitive:function(e){if(e)return{topology:nt.PrimitiveTopology[F[e+4>>>2>>>0]],stripIndexFormat:nt.IndexFormat[F[e+8>>>2>>>0]],frontFace:nt.FrontFace[F[e+12>>>2>>>0]],cullMode:nt.CullMode[F[e+16>>>2>>>0]],unclippedDepth:!!j[e+20>>>2>>>0]}}(e+48),depthStencil:function(e){if(e)return{format:nt.TextureFormat[F[e+4>>>2>>>0]],depthWriteEnabled:!!j[e+8>>>2>>>0],depthCompare:nt.CompareFunction[F[e+12>>>2>>>0]],stencilFront:a(e+16),stencilBack:a(e+32),stencilReadMask:j[e+48>>>2>>>0],stencilWriteMask:j[e+52>>>2>>>0],depthBias:F[e+56>>>2>>>0],depthBiasSlopeScale:Cr[e+60>>>2>>>0],depthBiasClamp:Cr[e+64>>>2>>>0]}}(j[e+72>>>2>>>0]),multisample:function(e){if(e)return{count:j[e+4>>>2>>>0],mask:j[e+8>>>2>>>0],alphaToCoverageEnabled:!!j[e+12>>>2>>>0]}}(e+76),fragment:function(e){if(e)return{module:nt.getJsObject(j[e+4>>>2>>>0]),constants:nt.makePipelineConstants(j[e+16>>>2>>>0],j[e+20>>>2>>>0]),targets:o(j[e+24>>>2>>>0],j[e+28>>>2>>>0]),entryPoint:nt.makeStringFromOptionalStringView(e+8)}}(j[e+92>>>2>>>0])}},fillLimitStruct:(e,r)=>{var t=j[r>>>2>>>0];function n(r,t,n,o=0){var a=e[r]??o;j[t+n>>>2>>>0]=a}function o(r,t,n,o=0){((e,r)=>{j[e>>>2>>>0]=r;var t=j[e>>>2>>>0];j[e+4>>>2>>>0]=(r-t)/4294967296})(t+n,e[r]??o)}if(n("maxTextureDimension1D",r,4),n("maxTextureDimension2D",r,8),n("maxTextureDimension3D",r,12),n("maxTextureArrayLayers",r,16),n("maxBindGroups",r,20),n("maxBindGroupsPlusVertexBuffers",r,24),n("maxBindingsPerBindGroup",r,28),n("maxDynamicUniformBuffersPerPipelineLayout",r,32),n("maxDynamicStorageBuffersPerPipelineLayout",r,36),n("maxSampledTexturesPerShaderStage",r,40),n("maxSamplersPerShaderStage",r,44),n("maxStorageBuffersPerShaderStage",r,48),n("maxStorageTexturesPerShaderStage",r,52),n("maxUniformBuffersPerShaderStage",r,56),n("minUniformBufferOffsetAlignment",r,80),n("minStorageBufferOffsetAlignment",r,84),o("maxUniformBufferBindingSize",r,64),o("maxStorageBufferBindingSize",r,72),n("maxVertexBuffers",r,88),o("maxBufferSize",r,96),n("maxVertexAttributes",r,104),n("maxVertexBufferArrayStride",r,108),n("maxInterStageShaderVariables",r,112),n("maxColorAttachments",r,116),n("maxColorAttachmentBytesPerSample",r,120),n("maxComputeWorkgroupStorageSize",r,124),n("maxComputeInvocationsPerWorkgroup",r,128),n("maxComputeWorkgroupSizeX",r,132),n("maxComputeWorkgroupSizeY",r,136),n("maxComputeWorkgroupSizeZ",r,140),n("maxComputeWorkgroupsPerDimension",r,144),n("maxImmediateSize",r,148),0!==t){F[t+4>>>2>>>0];var a=t;n("maxStorageBuffersInVertexStage",a,8,e.maxStorageBuffersPerShaderStage),n("maxStorageBuffersInFragmentStage",a,16,e.maxStorageBuffersPerShaderStage),n("maxStorageTexturesInVertexStage",a,12,e.maxStorageTexturesPerShaderStage),n("maxStorageTexturesInFragmentStage",a,20,e.maxStorageTexturesPerShaderStage)}},fillAdapterInfoStruct:(e,r)=>{j[r+52>>>2>>>0]=e.subgroupMinSize,j[r+56>>>2>>>0]=e.subgroupMaxSize;var t=e.vendor+e.architecture+e.device+e.description,n=Xr(t),o=K(e.vendor);nt.setStringView(r+4,n,o),n+=o;var a=K(e.architecture);nt.setStringView(r+12,n,a),n+=a;var i=K(e.device);nt.setStringView(r+20,n,i),n+=i;var s=K(e.description);nt.setStringView(r+28,n,s),n+=s,F[r+36>>>2>>>0]=2;var u=e.isFallbackAdapter?3:4;F[r+40>>>2>>>0]=u,j[r+44>>>2>>>0]=0,j[r+48>>>2>>>0]=0,nt.iterateExtensions(r,{327739:r=>{let t=0,n=0;if(e.subgroupMatrixConfigs){t=e.subgroupMatrixConfigs.length,n=lt(28*t);for(const[r,t]of e.subgroupMatrixConfigs.entries()){const e=n+28*r,o=nt.SubgroupMatrixComponentType.indexOf(t.componentType),a=nt.SubgroupMatrixComponentType.indexOf(t.resultComponentType);F[e>>>2>>>0]=o,F[e+4>>>2>>>0]=a,j[e+8>>>2>>>0]=t.M,j[e+12>>>2>>>0]=t.N,j[e+16>>>2>>>0]=t.K}}j[r+12>>>2>>>0]=n,j[r+8>>>2>>>0]=t}})},AddressMode:[,"clamp-to-edge","repeat","mirror-repeat"],BlendFactor:[,"zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1-alpha","one-minus-src1-alpha"],BlendOperation:[,"add","subtract","reverse-subtract","min","max"],BufferBindingType:[,,"uniform","storage","read-only-storage"],BufferMapState:[,"unmapped","pending","mapped"],CompareFunction:[,"never","less","equal","less-equal","greater","not-equal","greater-equal","always"],CompilationInfoRequestStatus:[,"success","callback-cancelled"],ComponentSwizzle:[,"0","1","r","g","b","a"],CompositeAlphaMode:[,"opaque","premultiplied","unpremultiplied","inherit"],CullMode:[,"none","front","back"],ErrorFilter:[,"validation","out-of-memory","internal"],FeatureLevel:[,"compatibility","core"],FeatureName:{1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",22:"texture-component-swizzle",23:"subgroup-size-control",24:"texture-compression-unaligned",25:"atomic-vec2u-min-max",327692:"chromium-experimental-unorm16-texture-formats",327729:"chromium-experimental-multi-draw-indirect",327732:"chromium-experimental-subgroup-matrix"},FilterMode:[,"nearest","linear"],FrontFace:[,"ccw","cw"],IndexFormat:[,"uint16","uint32"],InstanceFeatureName:[,"timed-wait-any","shader-source-spirv","multiple-devices-per-adapter"],LoadOp:[,"load","clear"],MipmapFilterMode:[,"nearest","linear"],OptionalBool:["false","true"],PowerPreference:[,"low-power","high-performance"],PredefinedColorSpace:[,"srgb","display-p3"],PrimitiveTopology:[,"point-list","line-list","line-strip","triangle-list","triangle-strip"],QueryType:[,"occlusion","timestamp"],SamplerBindingType:[,,"filtering","non-filtering","comparison"],Status:[,"success","error"],StencilOperation:[,"keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],StorageTextureAccess:[,,"write-only","read-only","read-write"],StoreOp:[,"store","discard"],SubgroupMatrixComponentType:[,"f32","f16","u32","i32","u8","i8"],SurfaceGetCurrentTextureStatus:[,"success-optimal","success-suboptimal","timeout","outdated","lost","error"],TextureAspect:[,"all","stencil-only","depth-only"],TextureDimension:[,"1d","2d","3d"],TextureFormat:[,"r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32float","r32uint","r32sint","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rgb9e5ufloat","rg32float","rg32uint","rg32sint","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32float","rgba32uint","rgba32sint","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],TextureSampleType:[,,"float","unfilterable-float","depth","sint","uint"],TextureViewDimension:[,"1d","2d","2d-array","cube","cube-array","3d"],ToneMappingMode:[,"standard","extended"],VertexFormat:[,"uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra","snorm10-10-10-2"],VertexStepMode:[,"vertex","instance"],WGSLLanguageFeatureName:[,"readonly_and_readwrite_storage_textures","packed_4x8_integer_dot_product","unrestricted_pointer_parameters","pointer_composite_access","uniform_buffer_standard_layout","subgroup_id","texture_and_sampler_let","subgroup_uniformity","texture_formats_tier1","linear_indexing","immediate_address_space","buffer_view","swizzle_assignment","fragment_depth"]};var ot=function(e,r,t){return e>>>=0,r>>>=0,t>>>=0,Vr.handleAsync(async()=>{var n=[];if(t){var o=F[t>>>2>>>0];n.length=r+1,n[r]=new Promise(e=>setTimeout(e,o,0))}else n.length=r;for(var a=0;a<r;++a){var i=Se(e+8*a);if(!(i in nt.Internals.futures))return i;n[a]=nt.Internals.futures[i]}const s=await Promise.race(n);return delete nt.Internals.futures[s],s})};ot.isAsync=!0;var at={},it=()=>{if(!it.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:i};for(var r in at)void 0===at[r]?delete e[r]:e[r]=at[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);it.strings=t}return it.strings};var st=(e,r,t,n)=>{for(var o=0,a=0;a<t;a++){var i=j[r>>>2>>>0],s=j[r+4>>>2>>>0];r+=8;try{var u=fe.read(e,$,i,s,n)}catch(e){if(o>0&&e instanceof fe.ErrnoError&&(6==e.errno||6==e.errno))break;throw e}if(u<0)return-1;if(o+=u,u<s)break;void 0!==n&&(n+=u)}return o};fe.createPreloadedFile=(e,r,t,n,o,a,i,s,u,l)=>{pe(e,r,t,n,o,s,u,l).then(a).catch(i)},fe.preloadFile=pe,fe.staticInit(),(()=>{let e=Ne.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof Ne))return!1;if(!(e instanceof Ne))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||ze(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,r=Ue(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return r.$$.count.value+=1,r.$$.deleteScheduled=!1,r},delete(){this.$$.ptr||ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ae("Object already scheduled for deletion"),We(this),Re(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ae("Object already scheduled for deletion"),Je.push(this),Je.length,this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)})(),Object.assign(sr.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:Ce,fromWireType:ir}),t.noExitRuntime&&(R=t.noExitRuntime),t.print&&(f=t.print),t.printErr&&(g=t.printErr),t.arguments&&t.arguments,t.thisProgram&&(i=t.thisProgram);var ut=t.preInit;if(ut)for("function"==typeof ut&&(t.preInit=ut=[ut]);ut.length>0;)ut.shift()();t.addRunDependency=de,t.removeRunDependency=me,t.FS_preloadFile=pe,t.FS_unlink=(...e)=>fe.unlink(...e),t.FS_createPath=(...e)=>fe.createPath(...e),t.FS_createDevice=(...e)=>fe.createDevice(...e),t.FS=fe,t.FS_createDataFile=se,t.FS_createLazyFile=(...e)=>fe.createLazyFile(...e),t.WebGPU=nt;var lt,ct,mt,dt,pt,ft,gt,vt,ht,yt,wt,bt,_t,St,kt,Et,Ct,xt,Tt,Pt,Ot,Dt,Ft,jt,$t,Bt,It,At,Mt,Vt,zt,Lt,Wt,Rt,Ut,Jt,Nt={2403337:()=>!!t.preinitializedWebGPUDevice,2403388:e=>nt.getJsObject(e).features.has("subgroups")};function Gt(e,r){if("undefined"!=typeof dbg)dbg(ge(e,r));else{if(void 0===t)function t(e){console.warn.apply(console,arguments)}t(ge(e,r))}}function Ht(e){throw new Error(ge(e))}function qt(e){throw Sr.toValue(e)}function Yt(){const e=t.preinitializedWebGPUDevice,r=e.adapterInfo?e.adapterInfo.architecture:"Unknown";return Xr(r)}function Xt(){const e=t.preinitializedWebGPUDevice,r=e.adapterInfo?e.adapterInfo.description:"Unknown";return Xr(r)}function Qt(){const e=t.preinitializedWebGPUDevice,r=e.adapterInfo?e.adapterInfo.device:"Unknown";return Xr(r)}function Kt(){const e=t.preinitializedWebGPUDevice,r=e.adapterInfo?e.adapterInfo.vendor:"Unknown";return Xr(r)}function Zt(e){const r=nt.getJsObject(e);return r.adapterInfo.subgroupMinSize||r.limits.minSubgroupSize}function en(e){const r=nt.getJsObject(e);return r.adapterInfo.subgroupMaxSize||r.limits.maxSubgroupSize}function rn(e,r){return Vr.handleAsync(async()=>{const t=nt.getJsObject(e);await t.mapAsync(GPUMapMode.READ);const n=t.getMappedRange(),o=new Uint8Array(n);B.set(o,r>>>0>>>0),t.unmap()})}Gt.sig="vii",Ht.sig="vi",qt.sig="vi",Yt.sig="i",Xt.sig="i",Qt.sig="i",Kt.sig="i",Zt.sig="ii",en.sig="ii",rn.sig="vii";var tn,nn={DefaultErrorReporter:Ht,GetAdapterArchitecture:Yt,GetAdapterDescription:Xt,GetAdapterDeviceName:Qt,GetAdapterVendor:Kt,JsGetDeviceMaxSubgroupSize:en,JsGetDeviceMinSubgroupSize:Zt,ThrowError:qt,_Unwind_RaiseException:e=>{b()},__asyncjs__ReadBufferDataJs:rn,__syscall_dup:function(e){try{var r=ve.getStreamFromFD(e);return fe.dupStream(r).fd}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_faccessat:function(e,r,t,n){r>>>=0;try{if(r=ve.getStr(r),r=ve.calculateAt(e,r),-8&t)return-28;var o=fe.lookupPath(r,{follow:!0}).node;if(!o)return-44;var a="";return 4&t&&(a+="r"),2&t&&(a+="w"),1&t&&(a+="x"),a&&fe.nodePermissions(o,a)?-2:0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_fcntl64:function(e,r,t){t>>>=0,ve.varargs=t;try{var n=ve.getStreamFromFD(e);switch(r){case 0:if((o=we())<0)return-28;for(;fe.streams[o];)o++;return fe.dupStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=we(),a=289792;return n.flags=n.flags&~a|o&a,0;case 12:o=be();return ye[o+0>>>1>>>0]=2,0}return-28}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_fstat64:function(e,r){r>>>=0;try{return ve.writeStat(r,fe.fstat(e))}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_ftruncate64:function(e,r){r=he(r);try{return isNaN(r)?-22:(fe.ftruncate(e,r),0)}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getcwd:function(e,r){e>>>=0,r>>>=0;try{if(!r)return-28;var t=fe.cwd(),n=K(t)+1;return r<n?-68:(_e(t,e,r),n)}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getdents64:function(e,r,t){r>>>=0,t>>>=0;try{var n=ve.getStreamFromFD(e);n.getdents||=fe.readdir(n.path);for(var o=280,a=0,i=fe.llseek(n,0,1),s=Math.floor(i/o),u=Math.min(n.getdents.length,s+Math.floor(t/o)),l=s;l<u;l++){var c,m,d=n.getdents[l];if("."===d)c=n.node.id,m=4;else if(".."===d){c=fe.lookupPath(n.path,{parent:!0}).node.id,m=4}else{var p;try{p=fe.lookupNode(n.node,d)}catch(e){if(28===e?.errno)continue;throw e}c=p.id,m=fe.isChrdev(p.mode)?2:fe.isDir(p.mode)?4:fe.isLink(p.mode)?10:8}I[r+a>>>3>>>0]=BigInt(c),I[r+a+8>>>3>>>0]=BigInt((l+1)*o),ye[r+a+16>>>1>>>0]=280,$[r+a+18>>>0]=m,_e(d,r+a+19,256),a+=o}return fe.llseek(n,l*o,0),a}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_getuid32:()=>0,__syscall_ioctl:function(e,r,t){t>>>=0,ve.varargs=t;try{var n=ve.getStreamFromFD(e);switch(r){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),a=be();F[a>>>2>>>0]=o.c_iflag||0,F[a+4>>>2>>>0]=o.c_oflag||0,F[a+8>>>2>>>0]=o.c_cflag||0,F[a+12>>>2>>>0]=o.c_lflag||0;for(var i=0;i<32;i++)$[a+i+17>>>0]=o.c_cc[i]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){a=be();var s=F[a>>>2>>>0],u=F[a+4>>>2>>>0],l=F[a+8>>>2>>>0],c=F[a+12>>>2>>>0],m=[];for(i=0;i<32;i++)m.push($[a+i+17>>>0]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:s,c_oflag:u,c_cflag:l,c_lflag:c,c_cc:m})}return 0;case 21519:if(!n.tty)return-59;a=be();return F[a>>>2>>>0]=0,0;case 21520:return n.tty?-28:-59;case 21537:case 21531:a=be();return fe.ioctl(n,r,a);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var d=n.tty.ops.ioctl_tiocgwinsz(n.tty);a=be();ye[a>>>1>>>0]=d[0],ye[a+2>>>1>>>0]=d[1]}return 0;default:return-28}}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_lstat64:function(e,r){e>>>=0,r>>>=0;try{return e=ve.getStr(e),ve.writeStat(r,fe.lstat(e))}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_mkdirat:function(e,r,t){r>>>=0;try{return r=ve.getStr(r),r=ve.calculateAt(e,r),t&=~ve.currentUmask,fe.mkdir(r,t,0),0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_newfstatat:function(e,r,t,n){r>>>=0,t>>>=0;try{r=ve.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=ve.calculateAt(e,r,a),ve.writeStat(t,o?fe.lstat(r):fe.stat(r))}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_openat:function(e,r,t,n){r>>>=0,n>>>=0,ve.varargs=n;try{r=ve.getStr(r),r=ve.calculateAt(e,r);var o=n?we():0;return 64&t&&(o&=~ve.currentUmask),fe.open(r,t,o).fd}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_readlinkat:function(e,r,t,n){r>>>=0,t>>>=0,n>>>=0;try{if(r=ve.getStr(r),r=ve.calculateAt(e,r),n<=0)return-28;var o=fe.readlink(r),a=Math.min(n,K(o)),i=$[t+a>>>0];return _e(o,t,n+1),$[t+a>>>0]=i,a}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_rmdir:function(e){e>>>=0;try{return e=ve.getStr(e),fe.rmdir(e),0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_stat64:function(e,r){e>>>=0,r>>>=0;try{return e=ve.getStr(e),ve.writeStat(r,fe.stat(e))}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_unlinkat:function(e,r,t){r>>>=0;try{if(r=ve.getStr(r),r=ve.calculateAt(e,r),t){if(512!==t)return-28;fe.rmdir(r)}else fe.unlink(r);return 0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},__syscall_utimensat:function(e,r,t,n){r>>>=0,t>>>=0;try{var o=256&n;r=ve.getStr(r),r=ve.calculateAt(e,r,!0);var a,i,s=Date.now();if(t){var u=Se(t),l=F[t+8>>>2>>>0];a=1073741823==l?s:1073741822==l?null:1e3*u+l/1e6,u=Se(t+=16),i=1073741823==(l=F[t+8>>>2>>>0])?s:1073741822==l?null:1e3*u+l/1e6}else a=s,i=s;return null!==(i??a)&&fe.utime(r,a,i,o),0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},_abort_js:()=>b(""),_embind_finalize_value_object:function(e){var r=ke[e>>>=0];delete ke[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,a=o.map(e=>e.getterReturnType).concat(o.map(e=>e.setterArgumentType));Fe([e],a,e=>{var a={};for(var[i,s]of o.entries()){const r=e[i],t=s.getter,n=s.getterContext,u=e[i+o.length],l=s.setter,c=s.setterContext;a[s.fieldName]={read:e=>r.fromWireType(t(n,e)),write:(e,r)=>{var t=[];l(c,e,u.toWireType(t,r)),Ee(t)},optional:r.optional}}return[{name:r.name,fromWireType:e=>{var r={};for(var t in a)r[t]=a[t].read(e);return n(e),r},toWireType:(e,r)=>{for(var o in a)if(!(o in r)&&!a[o].optional)throw new TypeError(`Missing field: "${o}"`);var i=t();for(o in a)a[o].write(i,r[o]);return null!==e&&e.push(n,i),i},readValueFromPointer:Ce,destructorFunction:n}]})},_embind_register_bigint:function(e,r,t,n,o){e>>>=0,t>>>=0,r=je(r>>>=0);const a=0n===n;let i=e=>e;if(a){const e=8*t;i=r=>BigInt.asUintN(e,r),o=i(o)}Me(e,{name:r,fromWireType:i,toWireType:(e,r)=>("number"==typeof r&&(r=BigInt(r)),r),readValueFromPointer:Ve(r,t,!a),destructorFunction:null})},_embind_register_bool:function(e,r,t,n){Me(e>>>=0,{name:r=je(r>>>=0),fromWireType:function(e){return!!e},toWireType:function(e,r){return r?t:n},readValueFromPointer:function(e){return this.fromWireType(B[e>>>0])},destructorFunction:null})},_embind_register_class:function(e,r,t,n,o,a,i,s,u,l,c,m,d){e>>>=0,r>>>=0,t>>>=0,n>>>=0,o>>>=0,a>>>=0,i>>>=0,s>>>=0,u>>>=0,l>>>=0,m>>>=0,d>>>=0,c=je(c>>>=0),a=dr(o,a),s&&=dr(i,s),l&&=dr(u,l),d=dr(m,d);var p=(e=>{var r=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=48&&r<=57?`_${e}`:e})(c);Ye(p,function(){gr(`Cannot construct ${c} due to unbound types`,[n])}),Fe([e,r,t],n?[n]:[],r=>{var t,o;r=r[0],o=n?(t=r.registeredClass).instancePrototype:Ne.prototype;var i=Ge(c,function(...e){if(Object.getPrototypeOf(this)!==u)throw new $e(`Use 'new' to construct ${c}`);if(void 0===m.constructor_body)throw new $e(`${c} has no accessible constructor`);var r=m.constructor_body[e.length];if(void 0===r)throw new $e(`Tried to invoke ctor of ${c} with invalid number of parameters (${e.length}) - expected (${Object.keys(m.constructor_body).toString()}) parameters instead!`);return r.apply(this,e)}),u=Object.create(o,{constructor:{value:i}});i.prototype=u;var m=new Xe(c,i,u,d,t,a,s,l);m.baseClass&&(m.baseClass.__derivedClasses??=[],m.baseClass.__derivedClasses.push(m));var f=new sr(c,m,!0,!1,!1),g=new sr(c+"*",m,!1,!1,!1),v=new sr(c+" const*",m,!1,!0,!1);return He[e]={pointerType:g,constPointerType:v},ur(p,i),[f,g,v]})},_embind_register_class_class_function:function(e,r,t,n,o,a,i,s,u){e>>>=0,r>>>=0,o>>>=0,a>>>=0,i>>>=0;var l=hr(t,n>>>=0);r=je(r),r=yr(r),a=dr(o,a,s),Fe([],[e],e=>{var n=`${(e=e[0]).name}.${r}`;function o(){gr(`Cannot call ${n} due to unbound types`,l)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var u=e.registeredClass.constructor;return void 0===u[r]?(o.argCount=t-1,u[r]=o):(qe(u,r,n),u[r].overloadTable[t-1]=o),Fe([],l,o=>{var l=[o[0],null].concat(o.slice(1)),c=vr(n,l,null,a,i,s);if(void 0===u[r].overloadTable?(c.argCount=t-1,u[r]=c):u[r].overloadTable[t-1]=c,e.registeredClass.__derivedClasses)for(const t of e.registeredClass.__derivedClasses)t.constructor.hasOwnProperty(r)||(t.constructor[r]=c);return[]}),[]})},_embind_register_class_constructor:function(e,r,t,n,o,a){e>>>=0,n>>>=0,o>>>=0,a>>>=0;var i=hr(r,t>>>=0);o=dr(n,o),Fe([],[e],e=>{var t=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[r-1])throw new $e(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[r-1]=()=>{gr(`Cannot construct ${e.name} due to unbound types`,i)},Fe([],i,n=>(n.splice(1,0,null),e.registeredClass.constructor_body[r-1]=vr(t,n,null,o,a),[])),[]})},_embind_register_class_function:function(e,r,t,n,o,a,i,s,u,l){e>>>=0,r>>>=0,o>>>=0,a>>>=0,i>>>=0;var c=hr(t,n>>>=0);r=je(r),r=yr(r),a=dr(o,a,u),Fe([],[e],e=>{var n=`${(e=e[0]).name}.${r}`;function o(){gr(`Cannot call ${n} due to unbound types`,c)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(r);var l=e.registeredClass.instancePrototype,m=l[r];return void 0===m||void 0===m.overloadTable&&m.className!==e.name&&m.argCount===t-2?(o.argCount=t-2,o.className=e.name,l[r]=o):(qe(l,r,n),l[r].overloadTable[t-2]=o),Fe([],c,o=>{var s=vr(n,o,e,a,i,u);return void 0===l[r].overloadTable?(s.argCount=t-2,l[r]=s):l[r].overloadTable[t-2]=s,[]}),[]})},_embind_register_emval:function(e){return Me(e>>>=0,kr)},_embind_register_enum:function(e,r,n,o,a){e>>>=0,n>>>=0,r=je(r>>>=0);const i=function(e){return e?1===e?"number":"string":"object"}(a);switch(i){case"object":{function s(){}s.values={},Me(e,{name:r,constructor:s,valueType:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,r)=>r.value,readValueFromPointer:Er(r,n,o),destructorFunction:null}),Ye(r,s);break}case"number":Me(e,{name:r,keysMap:u={},valueType:i,fromWireType:e=>e,toWireType:(e,r)=>r,readValueFromPointer:Er(r,n,o),destructorFunction:null}),Ye(r,u),delete t[r].argCount;break;case"string":var u;Me(e,{name:r,valuesMap:{},reverseMap:{},keysMap:u={},valueType:i,fromWireType:function(e){return this.reverseMap[e]},toWireType:function(e,r){return this.valuesMap[r]},readValueFromPointer:Er(r,n,o),destructorFunction:null}),Ye(r,u),delete t[r].argCount}},_embind_register_enum_value:function(e,r,t){r>>>=0;var n=Tr(e>>>=0,"enum");switch(r=je(r),n.valueType){case"object":var o=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Ge(`${n.name}_${r}`,function(){})}});o.values[t]=a,o[r]=a;break;case"number":n.keysMap[r]=t;break;case"string":n.valuesMap[r]=t,n.reverseMap[t]=r,n.keysMap[r]=r}},_embind_register_float:function(e,r,t){t>>>=0,Me(e>>>=0,{name:r=je(r>>>=0),fromWireType:e=>e,toWireType:(e,r)=>r,readValueFromPointer:Pr(r,t),destructorFunction:null})},_embind_register_function:function(e,r,t,n,o,a,i,s){e>>>=0,n>>>=0,o>>>=0,a>>>=0;var u=hr(r,t>>>=0);e=je(e),e=yr(e),o=dr(n,o,i),Ye(e,function(){gr(`Cannot call ${e} due to unbound types`,u)},r-1),Fe([],u,t=>{var n=[t[0],null].concat(t.slice(1));return ur(e,vr(e,n,null,o,a,i),r-1),[]})},_embind_register_integer:function(e,r,t,n,o){e>>>=0,t>>>=0,r=je(r>>>=0);let a=e=>e;if(0===n){var i=32-8*t;a=e=>e<<i>>>i,o=a(o)}Me(e,{name:r,fromWireType:a,toWireType:(e,r)=>r,readValueFromPointer:Ve(r,t,0!==n),destructorFunction:null})},_embind_register_iterable:function(e,r,t,n){e>>>=0,r>>>=0,n>>>=0,t=je(t>>>=0),n=je(n),Fe([],[e,r],e=>{const r=e[0];return Or(r.registeredClass.instancePrototype,t,n),[]})},_embind_register_memory_view:function(e,r,t){t>>>=0;var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][r];function o(e){var r=j[e>>>2>>>0],t=j[e+4>>>2>>>0];return new n($.buffer,t,r)}Me(e>>>=0,{name:t=je(t),fromWireType:o,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},_embind_register_optional:function(e,r){Me(e>>>=0,Dr)},_embind_register_smart_ptr:function(e,r,t,n,o,a,i,s,u,l,c,m){e>>>=0,r>>>=0,o>>>=0,a>>>=0,i>>>=0,s>>>=0,u>>>=0,l>>>=0,c>>>=0,m>>>=0,t=je(t>>>=0),a=dr(o,a),s=dr(i,s),l=dr(u,l),m=dr(c,m),Fe([e],[r],e=>(e=e[0],[new sr(t,e.registeredClass,!1,!1,!0,e,n,a,s,l,m)]))},_embind_register_std_string:function(e,r){e>>>=0,r=je(r>>>=0),Me(e,{name:r,fromWireType(e){var r,t=j[e>>>2>>>0],n=e+4;return r=ge(n,t,!0),ct(e),r},toWireType(e,r){var t;r instanceof ArrayBuffer&&(r=new Uint8Array(r));var n="string"==typeof r;n||ArrayBuffer.isView(r)&&1==r.BYTES_PER_ELEMENT||Ae("Cannot pass non-string to std::string"),t=n?K(r):r.length;var o=lt(4+t+1),a=o+4;(j[o>>>2>>>0]=t,n)?_e(r,a,t+1):B.set(r,a>>>0);return null!==e&&e.push(ct,o),o},readValueFromPointer:Ce,destructorFunction(e){ct(e)}})},_embind_register_std_wstring:function(e,r,t){var n,o,a;e>>>=0,r>>>=0,t=je(t>>>=0),2===r?(n=jr,o=$r,a=Br):(n=Ir,o=Ar,a=Mr),Me(e,{name:t,fromWireType:e=>{var t=j[e>>>2>>>0],o=n(e+4,t*r,!0);return ct(e),o},toWireType:(e,n)=>{"string"!=typeof n&&Ae(`Cannot pass non-string to C++ string type ${t}`);var i=a(n),s=lt(4+i+r);return j[s>>>2>>>0]=i/r,o(n,s+4,i+r),null!==e&&e.push(ct,s),s},readValueFromPointer:Ce,destructorFunction(e){ct(e)}})},_embind_register_value_object:function(e,r,t,n,o,a){r>>>=0,t>>>=0,n>>>=0,o>>>=0,a>>>=0,ke[e>>>=0]={name:je(r),rawConstructor:dr(t,n),rawDestructor:dr(o,a),fields:[]}},_embind_register_value_object_field:function(e,r,t,n,o,a,i,s,u,l){r>>>=0,t>>>=0,n>>>=0,o>>>=0,a>>>=0,i>>>=0,s>>>=0,u>>>=0,l>>>=0,ke[e>>>=0].fields.push({fieldName:je(r),getterReturnType:t,getter:dr(n,o),getterContext:a,setterArgumentType:i,setter:dr(s,u),setterContext:l})},_embind_register_void:function(e,r){Me(e>>>=0,{isVoid:!0,name:r=je(r>>>=0),fromWireType:()=>{},toWireType:(e,r)=>{}})},_emval_await:zr,_emval_create_invoker:function(e,r,t){r>>>=0;var[n,...o]=((e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=Tr(j[r+4*n>>>2>>>0],`parameter ${n}`);return t})(e,r),a=n.toWireType.bind(n),i=o.map(e=>e.readValueFromPointer.bind(e));e--;var s,u,l=new Array(e),c=`methodCaller<(${o.map(e=>e.name)}) => ${n.name}>`;return s=Ge(c,(r,n,o,s)=>{for(var u,c=0,m=0;m<e;++m)l[m]=i[m](s+c),c+=8;switch(t){case 0:u=Sr.toValue(r).apply(null,l);break;case 2:u=Reflect.construct(Sr.toValue(r),l);break;case 3:u=l[0];break;case 1:u=Sr.toValue(r)[Rr(n)](...l)}return((e,r,t)=>{var n=[],o=e(n,t);return n.length&&(j[r>>>2>>>0]=Sr.toHandle(n)),o})(a,o,u)}),u=Lr.length,Lr.push(s),u},_emval_decref:_r,_emval_get_global:function(e){return(e>>>=0)?(e=Rr(e),Sr.toHandle(globalThis[e])):Sr.toHandle(globalThis)},_emval_get_property:function(e,r){return e>>>=0,r>>>=0,e=Sr.toValue(e),r=Sr.toValue(r),Sr.toHandle(e[r])},_emval_incref:function(e){(e>>>=0)>9&&(br[e+1]+=1)},_emval_instanceof:function(e,r){return e>>>=0,r>>>=0,(e=Sr.toValue(e))instanceof(r=Sr.toValue(r))},_emval_invoke:function(e,r,t,n,o){return r>>>=0,t>>>=0,n>>>=0,o>>>=0,Lr[e>>>=0](r,t,n,o)},_emval_is_string:function(e){return e>>>=0,"string"==typeof(e=Sr.toValue(e))},_emval_new_cstring:function(e){return e>>>=0,Sr.toHandle(Rr(e))},_emval_run_destructors:function(e){e>>>=0;var r=Sr.toValue(e);Ee(r),_r(e)},_emval_typeof:function(e){return e>>>=0,e=Sr.toValue(e),Sr.toHandle(typeof e)},_gmtime_js:function(e,r){e=he(e),r>>>=0;var t=new Date(1e3*e);if(isNaN(t.getTime()))return 1;F[r>>>2>>>0]=t.getUTCSeconds(),F[r+4>>>2>>>0]=t.getUTCMinutes(),F[r+8>>>2>>>0]=t.getUTCHours(),F[r+12>>>2>>>0]=t.getUTCDate(),F[r+16>>>2>>>0]=t.getUTCMonth(),F[r+20>>>2>>>0]=t.getUTCFullYear()-1900,F[r+24>>>2>>>0]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return F[r+28>>>2>>>0]=o,0},_localtime_js:function(e,r){e=he(e),r>>>=0;var t=new Date(1e3*e);if(isNaN(t.getTime()))return 1;F[r>>>2>>>0]=t.getSeconds(),F[r+4>>>2>>>0]=t.getMinutes(),F[r+8>>>2>>>0]=t.getHours(),F[r+12>>>2>>>0]=t.getDate(),F[r+16>>>2>>>0]=t.getMonth(),F[r+20>>>2>>>0]=t.getFullYear()-1900,F[r+24>>>2>>>0]=t.getDay();var n=0|Nr(t);F[r+28>>>2>>>0]=n,F[r+36>>>2>>>0]=-60*t.getTimezoneOffset();var o=new Date(t.getFullYear(),0,1),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),i=o.getTimezoneOffset(),s=0|(a!=i&&t.getTimezoneOffset()==Math.min(i,a));return F[r+32>>>2>>>0]=s,0},_mktime_js:function(e){e>>>=0;var r=(()=>{var r=new Date(F[e+20>>>2>>>0]+1900,F[e+16>>>2>>>0],F[e+12>>>2>>>0],F[e+8>>>2>>>0],F[e+4>>>2>>>0],F[e>>>2>>>0],0);if(isNaN(r.getTime()))return-1;var t=F[e+32>>>2>>>0],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),i=o.getTimezoneOffset(),s=Math.min(i,a);if(t<0)t=Number(a!=i&&s==n);else if(t>0!=(s==n)){var u=Math.max(i,a),l=t>0?s:u;if(r.setTime(r.getTime()+6e4*(l-n)),isNaN(r.getTime()))return-1}F[e+32>>>2>>>0]=t,F[e+24>>>2>>>0]=r.getDay();var c=0|Nr(r);return F[e+28>>>2>>>0]=c,F[e>>>2>>>0]=r.getSeconds(),F[e+4>>>2>>>0]=r.getMinutes(),F[e+8>>>2>>>0]=r.getHours(),F[e+12>>>2>>>0]=r.getDate(),F[e+16>>>2>>>0]=r.getMonth(),F[e+20>>>2>>>0]=r.getYear(),r.getTime()/1e3})();return BigInt(r)},_mmap_js:function(e,r,t,n,o,a,i){e>>>=0,o=he(o),a>>>=0,i>>>=0;try{var s=ve.getStreamFromFD(n),u=fe.mmap(s,e,o,r,t),l=u.ptr;return F[a>>>2>>>0]=u.allocated,j[i>>>2>>>0]=l,0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},_munmap_js:function(e,r,t,n,o,a){e>>>=0,r>>>=0,a=he(a);try{var i=ve.getStreamFromFD(o);2&t&&ve.doMsync(e,i,r,n,a)}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return-e.errno}},_tzset_js:function(e,r,t,n){e>>>=0,r>>>=0,t>>>=0,n>>>=0;var o=(new Date).getFullYear(),a=new Date(o,0,1),i=new Date(o,6,1),s=a.getTimezoneOffset(),u=i.getTimezoneOffset(),l=Math.max(s,u);j[e>>>2>>>0]=60*l,F[r>>>2>>>0]=Number(s!=u);var c=e=>{var r=e>=0?"-":"+",t=Math.abs(e);return`UTC${r}${String(Math.floor(t/60)).padStart(2,"0")}${String(t%60).padStart(2,"0")}`},m=c(s),d=c(u);u<s?(_e(m,t,17),_e(d,n,17)):(_e(m,n,17),_e(d,t,17))},clock_time_get:function(e,r,t){if(r=he(r),t>>>=0,!((n=e)>=0&&n<=3))return 28;var n,o;o=0===e?Date.now():Gr();var a=Math.round(1e3*o*1e3);return I[t>>>3>>>0]=BigInt(a),0},custom_emscripten_dbgn:Gt,emscripten_asm_const_int:function(e,r,t){return qr(e>>>=0,r>>>=0,t>>>=0)},emscripten_errn:function(e,r){return g(ge(e>>>=0,r>>>=0))},emscripten_get_heap_max:function(){return 4294901760},emscripten_get_now:Gr,emscripten_has_asyncify:()=>2,emscripten_outn:function(e,r){return f(ge(e>>>=0,r>>>=0))},emscripten_pc_get_function:function e(r){var t,n,o=Yr[r>>>=0];if(!o)return 0;if(n=/^\s+at .*\.wasm\.(.*) \(.*\)$/.exec(o))t=n[1];else if(n=/^\s+at (.*) \(.*\)$/.exec(o))t=n[1];else{if(!(n=/^(.+?)@/.exec(o)))return 0;t=n[1]}return ct(e.ret??0),e.ret=Xr(t)},emscripten_resize_heap:function(e){e>>>=0;var r=B.length,t=4294901760;if(e>t)return!1;for(var n=1;n<=4;n*=2){var o=r*(1+.2/n);o=Math.min(o,e+100663296);var a=Math.min(t,te(Math.max(e,o),65536));if(et(a))return!0}return!1},emscripten_sleep:rt,emscripten_stack_snapshot:function(){var e=Zr().split("\n");return"Error"==e[0]&&e.shift(),Kr(e),Yr.last_addr=Qr(e[3]),Yr.last_stack=e,Yr.last_addr},emscripten_stack_unwind_buffer:function(e,r,t){var n;e>>>=0,r>>>=0,Yr.last_addr==e?n=Yr.last_stack:("Error"==(n=Zr().split("\n"))[0]&&n.shift(),Kr(n));for(var o=3;n[o]&&Qr(n[o])!=e;)++o;for(var a=0;a<t&&n[a+o];++a)j[r+4*a>>>2>>>0]=Qr(n[a+o]);return a},emscripten_webgpu_get_device:function(){return void 0===nt.preinitializedDeviceId&&(nt.preinitializedDeviceId=nt.importJsDevice(t.preinitializedWebGPUDevice),mt(nt.preinitializedDeviceId)),mt(nt.preinitializedDeviceId),nt.preinitializedDeviceId},emwgpuBufferDestroy:function(e){e>>>=0;var r=nt.getJsObject(e),t=nt.Internals.bufferOnUnmaps[e];if(t){for(var n=0;n<t.length;++n)t[n]();delete nt.Internals.bufferOnUnmaps[e]}r.destroy()},emwgpuBufferGetConstMappedRange:function(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n,o=nt.getJsObject(e);4294967295==t&&(t=void 0);try{n=o.getMappedRange(r,t)}catch(e){return 0}var a=zt(16,n.byteLength);return B.set(new Uint8Array(n),a>>>0),nt.Internals.bufferOnUnmaps[e].push(()=>ct(a)),a},emwgpuBufferGetMappedRange:function(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n,o=nt.getJsObject(e);4294967295==t&&(t=void 0);try{n=o.getMappedRange(r,t)}catch(e){return 0}var a=zt(16,n.byteLength);return B.fill(0,a,n.byteLength),nt.Internals.bufferOnUnmaps[e].push(()=>{new Uint8Array(n).set(B.subarray(a>>>0,a+n.byteLength>>>0)),ct(a)}),a},emwgpuBufferMapAsync:function(e,r,t,n,o){e>>>=0,r=he(r),t=he(t),n>>>=0,o>>>=0;var a=nt.getJsObject(e);nt.Internals.bufferOnUnmaps[e]=[],4294967295==o&&(o=void 0),nt.Internals.futureInsert(r,a.mapAsync(t,n,o).then(()=>{O(()=>{It(r,1,0)})},t=>{O(()=>{J();var n=tt(t.message),o="AbortError"===t.name?4:"OperationError"===t.name?3:0;It(r,o,n),delete nt.Internals.bufferOnUnmaps[e]})}))},emwgpuBufferUnmap:function(e){e>>>=0;var r=nt.getJsObject(e),t=nt.Internals.bufferOnUnmaps[e];if(t){for(var n=0;n<t.length;++n)t[n]();delete nt.Internals.bufferOnUnmaps[e],r.unmap()}},emwgpuBufferWriteMappedRange:function(e,r,t,n){e>>>=0,r>>>=0,t>>>=0,n>>>=0;var o,a=nt.getJsObject(e);try{o=a.getMappedRange(r,n)}catch(e){return 2}return new Uint8Array(o).set(B.subarray(t>>>0,t+n>>>0)),1},emwgpuDelete:function(e){e>>>=0,delete nt.Internals.jsObjects[e]},emwgpuDeviceCreateBuffer:function(e,r,t){e>>>=0,t>>>=0;var n,o=!!j[(r>>>=0)+32>>>2>>>0],a={label:nt.makeStringFromOptionalStringView(r+4),usage:j[r+16>>>2>>>0],size:Se(r+24),mappedAtCreation:o},i=nt.getJsObject(e);try{n=i.createBuffer(a)}catch(e){return!1}return nt.Internals.jsObjectInsert(t,n),o&&(nt.Internals.bufferOnUnmaps[t]=[]),!0},emwgpuDeviceCreateComputePipelineAsync:function(e,r,t,n){e>>>=0,r=he(r),t>>>=0,n>>>=0;var o=nt.makeComputePipelineDesc(t),a=nt.getJsObject(e);nt.Internals.futureInsert(r,a.createComputePipelineAsync(o).then(e=>{O(()=>{nt.Internals.jsObjectInsert(n,e),Bt(r,1,n,0)})},e=>{O(()=>{var t=J(),o=tt(e.message),a="validation"===e.reason?3:"internal"===e.reason?4:0;Bt(r,a,n,o),U(t)})}))},emwgpuDeviceCreateShaderModule:function(e,r,t){e>>>=0,t>>>=0;var n=j[(r>>>=0)>>>2>>>0],o=F[n+4>>>2>>>0],a={label:nt.makeStringFromOptionalStringView(r+4),code:""};if(2===o)a.code=nt.makeStringFromStringView(n+8);var i=nt.getJsObject(e);nt.Internals.jsObjectInsert(t,i.createShaderModule(a))},emwgpuDeviceDestroy:e=>{const r=nt.getJsObject(e);r.onuncapturederror=null,r.destroy()},emwgpuQueueOnSubmittedWorkDone:function(e,r){e>>>=0,r=he(r);var t=nt.getJsObject(e);nt.Internals.futureInsert(r,t.onSubmittedWorkDone().then(()=>{O(()=>{At(r,1)})}))},emwgpuWaitAny:ot,environ_get:function(e,r){e>>>=0,r>>>=0;var t=0,n=0;for(var o of it()){var a=r+t;j[e+n>>>2>>>0]=a,t+=_e(o,a,1/0)+1,n+=4}return 0},environ_sizes_get:function(e,r){e>>>=0,r>>>=0;var t=it();j[e>>>2>>>0]=t.length;var n=0;for(var o of t)n+=K(o)+1;return j[r>>>2>>>0]=n,0},exit:P,fd_close:function(e){try{var r=ve.getStreamFromFD(e);return fe.close(r),0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return e.errno}},fd_pread:function(e,r,t,n,o){r>>>=0,t>>>=0,n=he(n),o>>>=0;try{if(isNaN(n))return 22;var a=ve.getStreamFromFD(e),i=st(a,r,t,n);return j[o>>>2>>>0]=i,0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return e.errno}},fd_read:function(e,r,t,n){r>>>=0,t>>>=0,n>>>=0;try{var o=ve.getStreamFromFD(e),a=st(o,r,t);return j[n>>>2>>>0]=a,0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return e.errno}},fd_seek:function(e,r,t,n){r=he(r),n>>>=0;try{if(isNaN(r))return 22;var o=ve.getStreamFromFD(e);return fe.llseek(o,r,t),I[n>>>3>>>0]=BigInt(o.position),o.getdents&&!r&&0===t&&(o.getdents=null),0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return e.errno}},fd_write:function(e,r,t,n){r>>>=0,t>>>=0,n>>>=0;try{var o=((e,r,t,n)=>{if(1==t)return fe.write(e,$,j[r>>>2>>>0],j[r+4>>>2>>>0],n);for(var o=0,a=0,i=r;a<t;a++,i+=8)o+=j[i+4>>>2>>>0];var s=new Uint8Array(o),u=0;for(a=0;a<t;a++,r+=8){var l=j[r>>>2>>>0],c=j[r+4>>>2>>>0];s.set(B.subarray(l>>>0,l+c>>>0),u),u+=c}return fe.write(e,s,0,o,n)})(ve.getStreamFromFD(e),r,t);return j[n>>>2>>>0]=o,0}catch(e){if(void 0===fe||"ErrnoError"!==e.name)throw e;return e.errno}},proc_exit:T,random_get:function(e,r){return e>>>=0,r>>>=0,G(B.subarray(e>>>0,e+r>>>0))},wgpuBufferGetSize:function(e){e>>>=0;var r=nt.getJsObject(e).size;return BigInt(r)},wgpuBufferGetUsage:function(e){e>>>=0;var r=nt.getJsObject(e).usage;return BigInt(r)},wgpuCommandEncoderBeginComputePass:function(e,r){var t;e>>>=0,(r>>>=0)&&(t={label:nt.makeStringFromOptionalStringView(r+4),timestampWrites:nt.makePassTimestampWrites(j[r+12>>>2>>>0])});var n=nt.getJsObject(e),o=vt(0);return nt.Internals.jsObjectInsert(o,n.beginComputePass(t)),o},wgpuCommandEncoderClearBuffer:function(e,r,t,n){e>>>=0,r>>>=0,t=he(t),n=he(n);var o=nt.getJsObject(e);-1==n&&(n=void 0);var a=nt.getJsObject(r);o.clearBuffer(a,t,n)},wgpuCommandEncoderCopyBufferToBuffer:function(e,r,t,n,o,a){e>>>=0,r>>>=0,t=he(t),n>>>=0,o=he(o),a=he(a);var i=nt.getJsObject(e),s=nt.getJsObject(r),u=nt.getJsObject(n);i.copyBufferToBuffer(s,t,u,o,a)},wgpuCommandEncoderCopyBufferToTexture:function(e,r,t,n){e>>>=0,r>>>=0,t>>>=0,n>>>=0;var o=nt.getJsObject(e),a=nt.makeExtent3D(n);o.copyBufferToTexture(nt.makeTexelCopyBufferInfo(r),nt.makeTexelCopyTextureInfo(t),a)},wgpuCommandEncoderCopyTextureToBuffer:function(e,r,t,n){e>>>=0,r>>>=0,t>>>=0,n>>>=0;var o=nt.getJsObject(e),a=nt.makeExtent3D(n);o.copyTextureToBuffer(nt.makeTexelCopyTextureInfo(r),nt.makeTexelCopyBufferInfo(t),a)},wgpuCommandEncoderCopyTextureToTexture:function(e,r,t,n){e>>>=0,r>>>=0,t>>>=0,n>>>=0;var o=nt.getJsObject(e),a=nt.makeExtent3D(n);o.copyTextureToTexture(nt.makeTexelCopyTextureInfo(r),nt.makeTexelCopyTextureInfo(t),a)},wgpuCommandEncoderFinish:function(e,r){e>>>=0;var t=nt.getJsObject(e),n=ft(0);return nt.Internals.jsObjectInsert(n,t.finish()),n},wgpuCommandEncoderResolveQuerySet:function(e,r,t,n,o,a){e>>>=0,r>>>=0,o>>>=0,a=he(a);var i=nt.getJsObject(e),s=nt.getJsObject(r),u=nt.getJsObject(o);i.resolveQuerySet(s,t,n,u,a)},wgpuComputePassEncoderDispatchWorkgroups:function(e,r,t,n){e>>>=0,nt.getJsObject(e).dispatchWorkgroups(r,t,n)},wgpuComputePassEncoderEnd:function(e){e>>>=0,nt.getJsObject(e).end()},wgpuComputePassEncoderSetBindGroup:function(e,r,t,n,o){e>>>=0,t>>>=0,n>>>=0,o>>>=0;var a=nt.getJsObject(e),i=nt.getJsObject(t);0==n?a.setBindGroup(r,i):a.setBindGroup(r,i,j,o>>>2,n)},wgpuComputePassEncoderSetPipeline:function(e,r){e>>>=0,r>>>=0;var t=nt.getJsObject(e),n=nt.getJsObject(r);t.setPipeline(n)},wgpuDeviceCreateBindGroup:function(e,r){function t(e){var r,t=j[e+8>>>2>>>0],n=j[e+32>>>2>>>0],o=j[e+36>>>2>>>0],a=0;if(nt.iterateExtensions(e,{14:e=>{a=j[e+8>>>2>>>0]}}),t){var i=Se(e+24);-1==i&&(i=void 0),r={buffer:nt.getJsObject(t),offset:Se(e+16),size:i}}else r=nt.getJsObject(n||o||a);return{binding:j[e+4>>>2>>>0],resource:r}}e>>>=0,r>>>=0;var n={label:nt.makeStringFromOptionalStringView(r+4),layout:nt.getJsObject(j[r+12>>>2>>>0]),entries:function(e,r){for(var n=[],o=0;o<e;++o)n.push(t(r+40*o));return n}(j[r+16>>>2>>>0],j[r+20>>>2>>>0])},o=nt.getJsObject(e),a=dt(0);return nt.Internals.jsObjectInsert(a,o.createBindGroup(n)),a},wgpuDeviceCreateBindGroupLayout:function(e,r){function t(e){var r=j[e+4>>>2>>>0];if(r)return{type:nt.BufferBindingType[r],hasDynamicOffset:!!j[e+8>>>2>>>0],minBindingSize:Se(e+16)}}function n(e){var r=j[e+4>>>2>>>0];if(r)return{type:nt.SamplerBindingType[r]}}function o(e){var r=j[e+4>>>2>>>0];if(r)return{sampleType:nt.TextureSampleType[r],viewDimension:nt.TextureViewDimension[F[e+8>>>2>>>0]],multisampled:!!j[e+12>>>2>>>0]}}function a(e){var r=j[e+4>>>2>>>0];if(r)return{access:nt.StorageTextureAccess[r],format:nt.TextureFormat[F[e+8>>>2>>>0]],viewDimension:nt.TextureViewDimension[F[e+12>>>2>>>0]]}}function i(e){var r={binding:j[e+4>>>2>>>0],visibility:j[e+8>>>2>>>0],buffer:t(e+24),sampler:n(e+48),texture:o(e+56),storageTexture:a(e+72)};return nt.iterateExtensions(e,{13:e=>{r.externalTexture={}}}),r}e>>>=0,r>>>=0;var s={label:nt.makeStringFromOptionalStringView(r+4),entries:function(e,r){for(var t=[],n=0;n<e;++n)t.push(i(r+88*n));return t}(j[r+12>>>2>>>0],j[r+16>>>2>>>0])},u=nt.getJsObject(e),l=pt(0);return nt.Internals.jsObjectInsert(l,u.createBindGroupLayout(s)),l},wgpuDeviceCreateCommandEncoder:function(e,r){var t;e>>>=0,(r>>>=0)&&(t={label:nt.makeStringFromOptionalStringView(r+4)});var n=nt.getJsObject(e),o=gt(0);return nt.Internals.jsObjectInsert(o,n.createCommandEncoder(t)),o},wgpuDeviceCreateComputePipeline:function(e,r){e>>>=0,r>>>=0;var t=nt.makeComputePipelineDesc(r),n=nt.getJsObject(e),o=ht(0);return nt.Internals.jsObjectInsert(o,n.createComputePipeline(t)),o},wgpuDeviceCreatePipelineLayout:function(e,r){e>>>=0;for(var t=j[(r>>>=0)+12>>>2>>>0],n=j[r+16>>>2>>>0],o=[],a=0;a<t;++a)o.push(nt.getJsObject(j[n+4*a>>>2>>>0]));var i={label:nt.makeStringFromOptionalStringView(r+4),bindGroupLayouts:o,immediateSize:j[r+20>>>2>>>0]},s=nt.getJsObject(e),u=wt(0);return nt.Internals.jsObjectInsert(u,s.createPipelineLayout(i)),u},wgpuDeviceCreateQuerySet:function(e,r){e>>>=0,r>>>=0;var t={type:nt.QueryType[F[r+12>>>2>>>0]],count:j[r+16>>>2>>>0]},n=nt.getJsObject(e),o=bt(0);return nt.Internals.jsObjectInsert(o,n.createQuerySet(t)),o},wgpuDeviceCreateTexture:function(e,r){e>>>=0;var t,n=j[(r>>>=0)>>>2>>>0];if(0!==n){F[n+4>>>2>>>0];var o=n;t=nt.TextureViewDimension[F[o+8>>>2>>>0]]}var a={label:nt.makeStringFromOptionalStringView(r+4),size:nt.makeExtent3D(r+28),mipLevelCount:j[r+44>>>2>>>0],sampleCount:j[r+48>>>2>>>0],dimension:nt.TextureDimension[F[r+24>>>2>>>0]],format:nt.TextureFormat[F[r+40>>>2>>>0]],usage:j[r+16>>>2>>>0],textureBindingViewDimension:t},i=j[r+52>>>2>>>0];if(i){var s=j[r+56>>>2>>>0];a.viewFormats=Array.from(F.subarray(s>>>2>>>0,s+4*i>>>2>>>0),e=>nt.TextureFormat[e])}var u=nt.getJsObject(e),l=Tt(0);return nt.Internals.jsObjectInsert(l,u.createTexture(a)),l},wgpuDeviceGetAdapterInfo:function(e,r){e>>>=0,r>>>=0;var t=nt.getJsObject(e);return nt.fillAdapterInfoStruct(t.adapterInfo,r),1},wgpuDeviceGetLimits:function(e,r){e>>>=0,r>>>=0;var t=nt.getJsObject(e);return nt.fillLimitStruct(t.limits,r),1},wgpuDeviceHasFeature:function(e,r){return e>>>=0,nt.getJsObject(e).features.has(nt.FeatureName[r])},wgpuQueueSubmit:function(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=nt.getJsObject(e),o=Array.from(F.subarray(t>>>2>>>0,t+4*r>>>2>>>0),e=>nt.getJsObject(e));n.submit(o)},wgpuQueueWriteBuffer:function(e,r,t,n,o){e>>>=0,r>>>=0,t=he(t),n>>>=0,o>>>=0;var a=nt.getJsObject(e),i=nt.getJsObject(r),s=B.subarray(n>>>0,n+o>>>0);a.writeBuffer(i,t,s,0,o)},wgpuQueueWriteTexture:function(e,r,t,n,o,a){e>>>=0,r>>>=0,t>>>=0,n>>>=0,o>>>=0,a>>>=0;var i=nt.getJsObject(e),s=nt.makeTexelCopyTextureInfo(r),u=nt.makeTexelCopyBufferLayout(o),l=nt.makeExtent3D(a),c=B.subarray(t>>>0,t+n>>>0);i.writeTexture(s,c,u,l)},wgpuTextureCreateView:function(e,r){var t;if(e>>>=0,r>>>=0){var n,o=j[r>>>2>>>0];if(0!==o){F[o+4>>>2>>>0];var a=o+8;n=`${nt.ComponentSwizzle[F[a>>>2>>>0]]||"r"}${nt.ComponentSwizzle[F[a+4>>>2>>>0]]||"g"}${nt.ComponentSwizzle[F[a+8>>>2>>>0]]||"b"}${nt.ComponentSwizzle[F[a+12>>>2>>>0]]||"a"}`}var i=j[r+24>>>2>>>0],s=j[r+32>>>2>>>0];t={label:nt.makeStringFromOptionalStringView(r+4),format:nt.TextureFormat[F[r+12>>>2>>>0]],dimension:nt.TextureViewDimension[F[r+16>>>2>>>0]],baseMipLevel:j[r+20>>>2>>>0],mipLevelCount:4294967295===i?void 0:i,baseArrayLayer:j[r+28>>>2>>>0],arrayLayerCount:4294967295===s?void 0:s,aspect:nt.TextureAspect[F[r+36>>>2>>>0]],usage:j[r+40>>>2>>>0],swizzle:n}}var u=nt.getJsObject(e),l=Pt(0);return nt.Internals.jsObjectInsert(l,u.createView(t)),l},wgpuTextureDestroy:function(e){e>>>=0,nt.getJsObject(e).destroy()},wgpuTextureGetDepthOrArrayLayers:function(e){return e>>>=0,nt.getJsObject(e).depthOrArrayLayers},wgpuTextureGetHeight:function(e){return e>>>=0,nt.getJsObject(e).height},wgpuTextureGetWidth:function(e){return e>>>=0,nt.getJsObject(e).width}};return tn=await async function(){function e(e){return tn=e.exports,function(e){lt=t._malloc=e.malloc,ct=t._free=e.free,t._ma_device__on_notification_unlocked=e.ma_device__on_notification_unlocked,t._ma_malloc_emscripten=e.ma_malloc_emscripten,t._ma_free_emscripten=e.ma_free_emscripten,t._ma_device_process_pcm_frames_capture__webaudio=e.ma_device_process_pcm_frames_capture__webaudio,t._ma_device_process_pcm_frames_playback__webaudio=e.ma_device_process_pcm_frames_playback__webaudio,mt=e.wgpuDeviceAddRef,dt=e.emwgpuCreateBindGroup,pt=e.emwgpuCreateBindGroupLayout,ft=e.emwgpuCreateCommandBuffer,gt=e.emwgpuCreateCommandEncoder,vt=e.emwgpuCreateComputePassEncoder,ht=e.emwgpuCreateComputePipeline,yt=e.emwgpuCreateExternalTexture,wt=e.emwgpuCreatePipelineLayout,bt=e.emwgpuCreateQuerySet,_t=e.emwgpuCreateRenderBundle,St=e.emwgpuCreateRenderBundleEncoder,kt=e.emwgpuCreateRenderPassEncoder,Et=e.emwgpuCreateRenderPipeline,Ct=e.emwgpuCreateSampler,xt=e.emwgpuCreateSurface,Tt=e.emwgpuCreateTexture,Pt=e.emwgpuCreateTextureView,Ot=e.emwgpuCreateAdapter,Dt=e.emwgpuImportBuffer,Ft=e.emwgpuCreateDevice,jt=e.emwgpuCreateQueue,$t=e.emwgpuCreateShaderModule,Bt=e.emwgpuOnCreateComputePipelineCompleted,It=e.emwgpuOnMapAsyncCompleted,At=e.emwgpuOnWorkDoneCompleted,Mt=e.__getTypeName,Vt=e.emscripten_builtin_memalign,zt=e.memalign,Lt=e._emscripten_stack_restore,Wt=e._emscripten_stack_alloc,Rt=e.emscripten_stack_get_current,Ut=e.memory,t._kVersionStampBuildChangelistStr=e.kVersionStampBuildChangelistStr.value>>>0,t._kVersionStampCitcSnapshotStr=e.kVersionStampCitcSnapshotStr.value>>>0,t._kVersionStampCitcWorkspaceIdStr=e.kVersionStampCitcWorkspaceIdStr.value>>>0,t._kVersionStampSourceUriStr=e.kVersionStampSourceUriStr.value>>>0,t._kVersionStampBuildClientStr=e.kVersionStampBuildClientStr.value>>>0,t._kVersionStampBuildClientMintStatusStr=e.kVersionStampBuildClientMintStatusStr.value>>>0,t._kVersionStampBuildCompilerStr=e.kVersionStampBuildCompilerStr.value>>>0,t._kVersionStampBuildDateTimePstStr=e.kVersionStampBuildDateTimePstStr.value>>>0,t._kVersionStampBuildDepotPathStr=e.kVersionStampBuildDepotPathStr.value>>>0,t._kVersionStampBuildIdStr=e.kVersionStampBuildIdStr.value>>>0,t._kVersionStampBuildInfoStr=e.kVersionStampBuildInfoStr.value>>>0,t._kVersionStampBuildLabelStr=e.kVersionStampBuildLabelStr.value>>>0,t._kVersionStampBuildTargetStr=e.kVersionStampBuildTargetStr.value>>>0,t._kVersionStampBuildTimestampStr=e.kVersionStampBuildTimestampStr.value>>>0,t._kVersionStampBuildToolStr=e.kVersionStampBuildToolStr.value>>>0,t._kVersionStampG3BuildTargetStr=e.kVersionStampG3BuildTargetStr.value>>>0,t._kVersionStampVerifiableStr=e.kVersionStampVerifiableStr.value>>>0,t._kVersionStampBuildFdoTypeStr=e.kVersionStampBuildFdoTypeStr.value>>>0,t._kVersionStampBuildBaselineChangelistStr=e.kVersionStampBuildBaselineChangelistStr.value>>>0,t._kVersionStampBuildLtoTypeStr=e.kVersionStampBuildLtoTypeStr.value>>>0,t._kVersionStampBuildPropellerTypeStr=e.kVersionStampBuildPropellerTypeStr.value>>>0,t._kVersionStampBuildPghoTypeStr=e.kVersionStampBuildPghoTypeStr.value>>>0,t._kVersionStampBuildFdoProfileChangelistStr=e.kVersionStampBuildFdoProfileChangelistStr.value>>>0,t._kVersionStampBuildMemprofProfileChangelistStr=e.kVersionStampBuildMemprofProfileChangelistStr.value>>>0,t._kVersionStampBuildUsernameStr=e.kVersionStampBuildUsernameStr.value>>>0,t._kVersionStampBuildHostnameStr=e.kVersionStampBuildHostnameStr.value>>>0,t._kVersionStampBuildDirectoryStr=e.kVersionStampBuildDirectoryStr.value>>>0,t._kVersionStampBuildChangelistInt=e.kVersionStampBuildChangelistInt.value>>>0,t._kVersionStampCitcSnapshotInt=e.kVersionStampCitcSnapshotInt.value>>>0,t._kVersionStampBuildClientMintStatusInt=e.kVersionStampBuildClientMintStatusInt.value>>>0,t._kVersionStampBuildTimestampInt=e.kVersionStampBuildTimestampInt.value>>>0,t._kVersionStampVerifiableInt=e.kVersionStampVerifiableInt.value>>>0,t._kVersionStampBuildCoverageEnabledInt=e.kVersionStampBuildCoverageEnabledInt.value>>>0,t._kVersionStampBuildBaselineChangelistInt=e.kVersionStampBuildBaselineChangelistInt.value>>>0,t._kVersionStampPrecookedTimestampStr=e.kVersionStampPrecookedTimestampStr.value>>>0,t._kVersionStampPrecookedClientInfoStr=e.kVersionStampPrecookedClientInfoStr.value>>>0,Jt=e.__indirect_function_table,t._kVersionStampBuildHasHardeningProtobuf=e.kVersionStampBuildHasHardeningProtobuf.value>>>0}(tn=function(e){e=Object.assign({},e);var r=e=>r=>e(r)>>>0,t=e=>(r,t)=>e(r,t)>>>0,n=e=>()=>e()>>>0;return e.malloc=r(e.malloc),e.realloc=t(e.realloc),e.__getTypeName=r(e.__getTypeName),e.emscripten_builtin_memalign=t(e.emscripten_builtin_memalign),e.memalign=t(e.memalign),e._emscripten_stack_alloc=r(e._emscripten_stack_alloc),e.emscripten_stack_get_current=n(e.emscripten_stack_get_current),e}(tn=Vr.instrumentWasmExports(tn))),w(),tn}var r=(Vr.instrumentWasmImports(nn),{env:nn,wasi_snapshot_preview1:nn}),n=t.instantiateWasm;return n?new Promise(t=>{n(r,r=>t(e(r)))}):(y??=_(),function(r){return e(r.instance)}(await k(d,y,r)))}(),await async function(){!function(){var e=t.preRun;e&&("function"==typeof e&&(e=[e]),W.push(...e)),z(W)}(),le&&await(async()=>ue)();var e=t.setStatus;e&&(e("Running..."),await new Promise(e=>setTimeout(e,1)),setTimeout(e,1,"")),v||(t.noFSInit||fe.initialized||fe.init(),re.init(),tn.__wasm_call_ctors(),fe.ignorePermissions=!1,t.onRuntimeInitialized?.(),function(){var e=t.postRun;e&&("function"==typeof e&&(e=[e]),L.push(...e)),z(L)}())}(),t}})();"object"==typeof exports&&"object"==typeof module?(module.exports=ModuleFactory,module.exports.default=ModuleFactory):"function"==typeof define&&define.amd&&define([],()=>ModuleFactory);