@miris-inc/core 0.0.8-e6a4189 → 0.0.8-e6a94a6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AquaApi.wasm +0 -0
- package/dist/aqua-parser.wasm +0 -0
- package/dist/core.d.ts +87 -32
- package/dist/core.js +2111 -2195
- package/dist/core.prod.js +1 -1
- package/dist/core.standalone.js +5754 -5121
- package/dist/core.standalone.prod.js +1 -1
- package/package.json +16 -16
- package/dist/AquaApi.js +0 -15
- package/dist/aqua-parser.js +0 -14
package/dist/core.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{#e=/* @__PURE__ */new Map;#t=/* @__PURE__ */new Map;forKey(e){return this.#e.get(e)}forId(e){return this.#t.get(e)}setKey(e,t){this.#e.set(e,t)}setId(e,t){return this.#t.set(e,t)}delete(e){this.#e.delete(e.key),this.#t.delete(e.id)}deleteKey(e){this.#e.delete(e)}deleteId(e){this.#t.delete(e)}}class t{#r;useExtSplats=!1;#n=null;splatsExtendedData=null;#a=null;#i=new Float32Array(6);#s=null;#o=null;#c=0;sh1Data=null;sh1Max=1;sh2Data=null;sh2Max=1;sh3Data=null;sh3Max=1;sh3ExtendedData=null;get key(){return this.#r??null}set key(e){this.store.deleteKey(this.key),(e||0===e)&&this.store.setKey(e,this),this.#r=e}set splats(e){this.#n=e}get splats(){return this.#n}set bounds(e){this.#a=e}get bounds(){return this.#a}set _boundsStreamSpace(e){this.#i=e}get _boundsStreamSpace(){return this.#i}set lodIndex(e){this.#o=e}get lodIndex(){return this.#o}set paddingCount(e){this.#c=e}get paddingCount(){return this.#c}set transform(e){this.#s=e}get transform(){return this.#s}setSh1(e,t){this.sh1Data=e,this.sh1Max=t}setSh2(e,t){this.sh2Data=e,this.sh2Max=t}setSh3(e,t){this.sh3Data=e,this.sh3Max=t}dispose(){const e=this.#r;this.store.delete(this),this.#r=null,e?.dispose?.(),this.#n=null,this.splatsExtendedData=null,this.#a=null,this.#s=null,this.sh1Data=null,this.sh2Data=null,this.sh3Data=null,this.sh3ExtendedData=null,this.modelRoot?.lods?.delete(this)}constructor({id:e,modelRoot:t,lodStore:r}){Object.defineProperties(this,{id:{value:e},modelRoot:{value:t},store:{value:r}}),r.setId(e,this),t.add(this)}}class r{constructor({type:e,lod:t}){Object.defineProperties(this,{type:{value:e},lod:{value:t}})}}class n{static#e=/* @__PURE__ */new Map;static#t=/* @__PURE__ */new Map;static forKey(e){return this.#e.get(e)}static forId(e){return this.#t.get(e)}#r;get key(){return this.#r??null}set key(e){n.#e.delete(this.key),(e||0===e)&&n.#e.set(e,this),this.#r=e}#u=/* @__PURE__ */new Set;get lods(){return this.#u}#s;set transform(e){this.#s=e}get transform(){return this.#s}constructor({id:e,stream:t}){Object.defineProperties(this,{id:{value:e},stream:{value:t}}),n.#t.set(e,this),t.add(this)}add(e){this.#u.add(e)}dispose(){const e=[...this.#u];this.#u.clear();for(const t of e)t.dispose();n.#e.delete(this.key),n.#t.delete(this.id),this.#r=null}}class a{static#l=/* @__PURE__ */new Map;static#d=1;static#h=0;static#p=2**32;static#m=0;static#f(e){this.#h=(this.#h+e)%this.#p}static#g(e){this.#h=(this.#h-e)%this.#p,this.#h<0&&(this.#h+=this.#p)}static getCheckSum(){return this.#h}static getConsecutiveIds(e){const t=this.#d;return this.#d+=e,t}static addWithId(e,t){this.#f(t),this.#l.set(t,e)}static add(e){const t=this.#d++;return this.addWithId(e,t),t}static get(e){const t=this.#l.get(e);if(void 0===t)throw new Error(`Attribute with id ${e} not found in cache`);return t}static remove(e){if(Array.isArray(e))for(const t of e)this.#l.delete(t),this.#g(t);else this.#l.delete(e),this.#g(e)}static validateCheckSum(e){if(e!=this.getCheckSum()){let t=e-this.getCheckSum();t<0&&(t+=this.#p),t!=this.#m&&(console.error(`ID checksum mismatch between WASM and TypeScript sides! ${e} ${this.getCheckSum()}`),this.#m=t)}}}class i extends EventTarget{static _idMap=/* @__PURE__ */new Map;static _keyMap=/* @__PURE__ */new Map;static forId(e){if(e)return this._idMap.get(e)}static forKey(e){return this._keyMap.get(e)}#r;#y=!1;#v={};_addVariantCollection(e){this.#v[e]||(this.#v[e]={id:e,children:[]})}_findAndAddToVariantSet(e,t){const r=n=>{if(!n)return!1;if(n.id===e)return n.children?n.children.push(t):"option"===t.type?(n.options||(n.options=[]),n.options.push(t)):(n.nestedSets||(n.nestedSets=[]),n.nestedSets.push(t)),!0;if(Array.isArray(n.children))for(const e of n.children)if(r(e))return!0;if(Array.isArray(n.nestedSets))for(const e of n.nestedSets)if(r(e))return!0;if(Array.isArray(n.options))for(const e of n.options)if(r(e))return!0;return!1};for(const n of Object.values(this.#v))if(r(n))return}_addVariant(e,t){this._findAndAddToVariantSet(e,t)}_exportVariantHierarchies(){return Object.entries(this.#v).map(([e,t])=>({hierarchyId:Number(e),hierarchy:t}))}_setVariantSelection(e){this.client.setVariantSelection(e)}get key(){return this.#r??null}set key(e){i._keyMap.delete(this.key),(e||0===e)&&i._keyMap.set(e,this),this.#r=e}#b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];get matrix(){return this.#b}set matrix(e){this.#b=e;const{engine:t,client:r}=this,n=t.malloc(4*this.#b.length);t.heapF32.set(Float32Array.from(this.#b),n/4),r.setSceneObjectTransform(this.id,n),t.free(n)}get boundingBox(){const{engine:e,client:t}=this,r=e.malloc(24);t.getWorldBoundingBox(this.id,r);const[n,a,i,s,o,c]=Float32Array.from(e.heapF32.subarray(r/4,r/4+6));if(void 0===n||void 0===a||void 0===i||void 0===s||void 0===o||void 0===c)return;const u={min:{x:n-s/2,y:a-o/2,z:i-c/2},max:{x:n+s/2,y:a+o/2,z:i+c/2},size:{x:s,y:o,z:c},center:{x:n,y:a,z:i}};return Object.freeze(u),u}#S=/* @__PURE__ */new Set;get modelRoots(){return new Set(this.#S)}get chunks(){return this.modelRoots}constructor(e){super();const{scene:t,uuid:r}=e;Object.defineProperties(this,{uuid:{value:r,enumerable:!0},scene:{value:t,enumerable:!0},client:{value:t.client,enumerable:!0},miris:{value:t.miris,enumerable:!0},engine:{value:t.miris.engine,enumerable:!0}}),this._initStream(e),i._idMap.set(this.id,this),t.add(this)}_initStream({uuid:e}){const t=this.client.addStreamById(e,e,!1);Object.defineProperty(this,"id",{value:t})}async _onStreamLoaded(){this.#y||(this.dispatchEvent(new Event("streamloaded")),this.scene._onSceneLoaded(),this.#y=!0)}_onRootLoaded(){this.dispatchEvent(new Event("rootloaded"))}add(e){this.#S.add(e)}end(){this.client.removeStream(this.id);for(const e of this.#S)e.dispose();this.#S.clear(),i._idMap.delete(this.id),i._keyMap.delete(this.key),this.scene.streams.has(this)&&this.scene.delete(this)}}let s,o;const c=(u=new URL("AquaApi.wasm",import.meta.url).href).includes("/.vite/")?u.replace(/\.vite\/[^?#]*/,()=>"node_modules/@miris-inc/core/dist/AquaApi.wasm"):u;var u;function l(e){return e.default||e}function d(...e){var t;return s||(o=fetch(c).then(e=>!e.ok||(e.headers.get("content-type")||"").includes("text/html")?null:e.arrayBuffer()).catch(()=>null),s=(t=(e=>e.includes("/.vite/")?new URL("/node_modules/@miris-inc/core/dist/AquaApi.js",e).href:e)(new URL("./AquaApi.js",import.meta.url).href),import(/* webpackIgnore: true */ /* turbopackIgnore: true */ t).then(e=>{const t=l(e);if("function"==typeof t)return t;throw new Error("bad module")}).catch(()=>fetch(t).then(e=>{if(!e.ok)throw new Error(e.status+" "+t);return e.text()}).then(e=>{const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"}));return import(/* webpackIgnore: true */ /* turbopackIgnore: true */ t).then(e=>(URL.revokeObjectURL(t),l(e)))}))).catch(e=>{throw s=o=void 0,e})),Promise.all([s,o]).then(([t,r])=>{if(r){const[n={},...a]=e;return t({...n,wasmBinary:r},...a)}return t(...e)})}class h{static name="thread";static get Worker(){throw new Error("Thread could not be initialized because no Worker was supplied. Do you forget to set `static Worker = Worker` on the child class?")}constructor({engine:e}){Object.defineProperty(this,"engine",{value:e,enumerable:!0}),Object.defineProperty(this,"ready",{enumerable:!0,value:new Promise(e=>{this.#w.set(0,async()=>{this.#_=!1,this.#w.delete(0),e(this)})})}),this.#k=new this.constructor.Worker({name:`decoder-${h.#T()}`}),this.#k.addEventListener("message",this.#C.bind(this))}static#$=0;static#T(){return this.#$+=1}#_=!0;get pending(){return this.#_}#k;#w=/* @__PURE__ */new Map;get pendingRequests(){return this.#w.size}get terminated(){return!this.#k}#A=0;#P(){return this.#A+=1}async _execute(e,...t){if(this.pending)throw new Error(`Unable to execute ${e} because decoder has not yet been initialized`);if(!this.#k)throw new Error(`Unable to execute ${e} because decoder has already been terminated`);return new Promise(r=>{if(!this.#k)throw new Error(`Unable to execute ${e} because decoder has already been terminated`);const n=this.#P();this.#w.set(n,async e=>{this.#w.delete(n),r(e)});const a=t.filter(e=>e instanceof ArrayBuffer);this.#k.postMessage({id:n,action:e,args:t},a)})}#C({data:e}){"ready"===e&&(e={id:0,result:void 0});const{id:t,result:r}=e;this.#w.get(t)?.(r)}_postToWorker(e,t){this.#k?.postMessage(e,t??[])}terminate(){this.#k&&(this.#k.terminate(),this.#k.removeEventListener("message",this.#C),this.#k=null)}}const p='const e={sparkPackedSplat:{elementsPerSplat:4,discard:!1},extendedPackedSplatLow:{elementsPerSplat:4,discard:!1},extendedPackedSplatHigh:{elementsPerSplat:4,discard:!1},packedSh1:{elementsPerSplat:2,discard:!1},packedSh2:{elementsPerSplat:4,discard:!1},packedSh3:{elementsPerSplat:4,discard:!1},sh1Extended:{elementsPerSplat:4,discard:!1},sh2Extended:{elementsPerSplat:4,discard:!1},sh3Extended_0:{elementsPerSplat:4,discard:!1},sh3Extended_1:{elementsPerSplat:4,discard:!1},splatterEllipsoids:{elementsPerSplat:12,discard:!1},splatterSphericalHarmonics:{elementsPerSplat:16,discard:!1}};function t(t,r,n){const a=e[t];if(void 0===a)throw new Error("attribute name"+t+" is unknown");const i=n.length,o=(s=i,u=2048*a.elementsPerSplat,Math.ceil(s/u)*u);var s,u;const c=new Uint32Array(o);return c.set(n),{paddedData:c,originalSize:i,id:r}}const{wasmBinary:r}=await new Promise(e=>{self.addEventListener("message",function t(r){"wasm-init"===r.data?.type&&(self.removeEventListener("message",t),e(r.data))})});if(!r)throw new Error("Decoder worker did not receive WASM binary. The main thread failed to fetch aqua-parser.wasm.");const n=await async function(e={}){var t,r,n=e,a="./this.program",i=(e,t)=>{throw t},o=import.meta.url,s="";try{s=new URL(".",o).href}catch{}r=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},t=async e=>{var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)};var u,c,l,p,d,f,h,v,m,y,g,_,w,$,b,T,P=console.log.bind(console),C=console.error.bind(console),k=!1,S=!1;function F(){var e=d.buffer;n.HEAP8=f=new Int8Array(e),v=new Int16Array(e),n.HEAPU8=h=new Uint8Array(e),m=new Uint16Array(e),n.HEAP32=y=new Int32Array(e),n.HEAPU32=g=new Uint32Array(e),n.HEAPF32=_=new Float32Array(e),n.HEAPF64=w=new Float64Array(e),$=new BigInt64Array(e),b=new BigUint64Array(e)}function A(e){n.onAbort?.(e),C(e="Aborted("+e+")"),k=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw p?.(t),t}function D(){return n.locateFile?(e="aqua-parser.wasm",n.locateFile?n.locateFile(e,s):s+e):"";var e}async function W(e){if(!u)try{var n=await t(e);return new Uint8Array(n)}catch{}return function(e){if(e==T&&u)return new Uint8Array(u);if(r)return r(e);throw"both async and sync fetching of the wasm failed"}(e)}async function E(e,t,r){if(!e)try{var n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,r)}catch(a){C(`wasm streaming compile failed: ${a}`),C("falling back to ArrayBuffer instantiation")}return async function(e,t){try{var r=await W(e);return await WebAssembly.instantiate(r,t)}catch(n){C(`failed to asynchronously prepare wasm: ${n}`),A(n)}}(t,r)}class x{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var O=e=>{for(;e.length>0;)e.shift()(n)},R=[],j=e=>R.push(e),U=[],H=e=>U.push(e),I=!0,V=e=>Ne(e),B=()=>Ye(),M=[],q=0,L=0;class z{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){g[this.ptr+4>>2]=e}get_type(){return g[this.ptr+4>>2]}set_destructor(e){g[this.ptr+8>>2]=e}get_destructor(){return g[this.ptr+8>>2]}set_caught(e){e=e?1:0,f[this.ptr+12]=e}get_caught(){return 0!=f[this.ptr+12]}set_rethrown(e){e=e?1:0,f[this.ptr+13]=e}get_rethrown(){return 0!=f[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){g[this.ptr+16>>2]=e}get_adjusted_ptr(){return g[this.ptr+16>>2]}}var N=e=>ze(e),J=e=>{var t=L;if(!t)return N(0),0;var r=new z(t);r.set_adjusted_ptr(t);var n=r.get_type();if(!n)return N(0),t;for(var a of e){if(0===a||a===n)break;var i=r.ptr+16;if(Ze(a,n,i))return N(a),t}return N(n),t},Y=e=>{for(var t="";;){var r=h[e++];if(!r)return t;t+=String.fromCharCode(r)}},G={},X={},Z={},K=class extends Error{constructor(e){super(e),this.name="BindingError"}},Q=e=>{throw new K(e)};function ee(e,t,r={}){return function(e,t,r={}){var n=t.name;if(e||Q(`type "${n}" must have a positive integer typeid pointer`),X.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Q(`Cannot register type \'${n}\' twice`)}if(X[e]=t,delete Z[e],G.hasOwnProperty(e)){var a=G[e];delete G[e],a.forEach(e=>e())}}(e,t,r)}var te=(e,t,r)=>{switch(t){case 1:return r?e=>f[e]:e=>h[e];case 2:return r?e=>v[e>>1]:e=>m[e>>1];case 4:return r?e=>y[e>>2]:e=>g[e>>2];case 8:return r?e=>$[e>>3]:e=>b[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},re=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),ne=e=>{Q(e.$$.ptrType.registeredClass.name+" instance already deleted")},ae=!1,ie=e=>{},oe=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},se=e=>typeof FinalizationRegistry>"u"?(se=e=>e,e):(ae=new FinalizationRegistry(e=>{oe(e.$$)}),ie=e=>ae.unregister(e),(se=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};ae.register(e,r,e)}return e})(e));function ue(){}var ce=(e,t)=>Object.defineProperty(t,"name",{value:e}),le={},pe=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||Q(`Function \'${r}\' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},de=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&Q(`Cannot register public name \'${e}\' twice`),pe(n,e,e),n[e].overloadTable.hasOwnProperty(r)&&Q(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,n[e].argCount=r)};function fe(e,t,r,n,a,i,o,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=i,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var he=(e,t,r)=>{for(;t!==r;)t.upcast||Q(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},ve=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function me(e,t){if(null===t)return this.isReference&&Q(`null is not a valid ${this.name}`),0;t.$$||Q(`Cannot pass "${ve(t)}" as a ${this.name}`),t.$$.ptr||Q(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return he(t.$$.ptr,r,this.registeredClass)}function ye(e,t){var r;if(null===t)return this.isReference&&Q(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;(!t||!t.$$)&&Q(`Cannot pass "${ve(t)}" as a ${this.name}`),t.$$.ptr||Q(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&Q(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=he(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Q("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Q(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var a=t.clone();r=this.rawShare(r,it.toHandle(()=>a.delete())),null!==e&&e.push(this.rawDestructor,r)}break;default:Q("Unsupporting sharing policy")}return r}function ge(e,t){if(null===t)return this.isReference&&Q(`null is not a valid ${this.name}`),0;t.$$||Q(`Cannot pass "${ve(t)}" as a ${this.name}`),t.$$.ptr||Q(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&Q(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return he(t.$$.ptr,r,this.registeredClass)}function _e(e){return this.fromWireType(g[e>>2])}var we=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=we(e,t,r.baseClass);return null===n?null:r.downcast(n)},$e={},be=(e,t)=>(t=((e,t)=>{for(void 0===t&&Q("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),$e[t]),Te=class extends Error{constructor(e){super(e),this.name="InternalError"}},Pe=e=>{throw new Te(e)},Ce=(e,t)=>((!t.ptrType||!t.ptr)&&Pe("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&Pe("Both smartPtrType and smartPtr must be specified"),t.count={value:1},se(Object.create(e,{$$:{value:t,writable:!0}})));function ke(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=be(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?Ce(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ce(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,o=this.registeredClass.getActualType(t),s=le[o];if(!s)return a.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=we(t,this.registeredClass,i.registeredClass);return null===u?a.call(this):this.isSmartPointer?Ce(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:e}):Ce(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}function Se(e,t,r,n,a,i,o,s,u,c,l){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=i,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,a||void 0!==t.baseClass?this.toWireType=ye:n?(this.toWireType=me,this.destructorFunction=null):(this.toWireType=ge,this.destructorFunction=null)}var Fe,Ae=(e,t,r)=>{n.hasOwnProperty(e)||Pe("Replacing nonexistent public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},De=[],We=e=>{var t=De[e];return t||(De[e]=t=Fe.get(e)),t},Ee=(e,t,r=!1)=>{e=Y(e);var n=We(t);return"function"!=typeof n&&Q(`unknown function pointer with signature ${e}: ${t}`),n};class xe extends Error{}var Oe=e=>{var t=Ve(e),r=Y(t);return Me(t),r},Re=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){if(!n[t]&&!X[t]){if(Z[t])return void Z[t].forEach(e);r.push(t),n[t]=!0}}),new xe(`${e}: `+r.map(Oe).join([", "]))},je=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&Pe("Mismatched type converter count");for(var a=0;a<e.length;++a)ee(e[a],n[a])}e.forEach(e=>Z[e]=t);var a=new Array(t.length),i=[],o=0;t.forEach((e,t)=>{X.hasOwnProperty(e)?a[t]=X[e]:(i.push(e),G.hasOwnProperty(e)||(G[e]=[]),G[e].push(()=>{a[t]=X[e],++o===i.length&&n(a)}))}),0===i.length&&n(a)},Ue=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function He(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function Ie(e,t,r,n,a,i){var o=t.length;o<2&&Q("argTypes array size mismatch! Must at least get return value and \'this\' types!");for(var s=null!==t[1]&&null!==r,u=He(t),c=!t[0].isVoid,l=t[0],p=t[1],d=[e,Q,n,a,Ue,l.fromWireType.bind(l),p?.toWireType.bind(p)],f=2;f<o;++f){var h=t[f];d.push(h.toWireType.bind(h))}if(!u)for(f=s?1:2;f<t.length;++f)null!==t[f].destructorFunction&&d.push(t[f].destructorFunction);var v=function(e,t,r,n){var a=He(e),i=e.length-2,o=[],s=["fn"];t&&s.push("thisWired");for(var u=0;u<i;++u)o.push(`arg${u}`),s.push(`arg${u}Wired`);o=o.join(","),s=s.join(",");var c=`return function (${o}) {\\n`;a&&(c+="var destructors = [];\\n");var l=a?"destructors":"null",p=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];for(t&&(c+=`var thisWired = toClassParamWire(${l}, this);\\n`),u=0;u<i;++u){var d=`toArg${u}Wire`;c+=`var arg${u}Wired = ${d}(${l}, arg${u});\\n`,p.push(d)}if(c+=(r||n?"var rv = ":"")+`invoker(${s});\\n`,a)c+="runDestructors(destructors);\\n";else for(u=t?1:2;u<e.length;++u){var f=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(c+=`${f}_dtor(${f});\\n`,p.push(`${f}_dtor`))}return r&&(c+="var ret = fromRetWire(rv);\\nreturn ret;\\n"),c+="}\\n",new Function(p,c)}(t,s,c,i)(...d);return ce(e,v)}var Ve,Be,Me,qe,Le,ze,Ne,Je,Ye,Ge,Xe,Ze,Ke,Qe=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(g[t+4*n>>2]);return r},et=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},tt=(e,t,r)=>(e instanceof Object||Q(`${r} with invalid "this": ${e}`),e instanceof t.registeredClass.constructor||Q(`${r} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||Q(`cannot call emscripten binding method ${r} on deleted object`),he(e.$$.ptr,e.$$.ptrType.registeredClass,t.registeredClass)),rt=[],nt=[0,1,,1,null,1,!0,1,!1,1],at=e=>{e>9&&0===--nt[e+1]&&(nt[e]=void 0,rt.push(e))},it={toValue:e=>(e||Q(`Cannot use deleted val. handle = ${e}`),nt[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=rt.pop()||nt.length;return nt[t]=e,nt[t+1]=1,t}}}},ot={name:"emscripten::val",fromWireType:e=>{var t=it.toValue(e);return at(e),t},toWireType:(e,t)=>it.toHandle(t),readValueFromPointer:_e,destructorFunction:null},st=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(f[e])}:function(e){return this.fromWireType(h[e])};case 2:return r?function(e){return this.fromWireType(v[e>>1])}:function(e){return this.fromWireType(m[e>>1])};case 4:return r?function(e){return this.fromWireType(y[e>>2])}:function(e){return this.fromWireType(g[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},ut=(e,t)=>{var r=X[e];return void 0===r&&Q(`${t} has unknown type ${Oe(e)}`),r},ct=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(_[e>>2])};case 8:return function(e){return this.fromWireType(w[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},lt=(e,t,r)=>((e,t,r,n)=>{if(!(n>0))return 0;for(var a=r,i=r+n-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(r>=i)break;t[r++]=s}else if(s<=2047){if(r+1>=i)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=i)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s,o++}}return t[r]=0,r-a})(e,h,t,r),pt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},dt=typeof TextDecoder<"u"?new TextDecoder:void 0,ft=(e,t,r,n)=>{var a=t+r;if(n)return a;for(;e[t]&&!(t>=a);)++t;return t},ht=(e,t=0,r,n)=>{var a=ft(e,t,r,n);if(a-t>16&&e.buffer&&dt)return dt.decode(e.subarray(t,a));for(var i="";t<a;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var c=o-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&o)<<6|s)}else i+=String.fromCharCode(o)}return i},vt=(e,t,r)=>e?ht(h,e,t,r):"",mt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,yt=(e,t,r)=>{var n=e>>1,a=ft(m,n,t/2,r);if(a-n>16&&mt)return mt.decode(m.subarray(n,a));for(var i="",o=n;o<a;++o){var s=m[o];i+=String.fromCharCode(s)}return i},gt=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,a=(r-=2)<2*e.length?r/2:e.length,i=0;i<a;++i){var o=e.charCodeAt(i);v[t>>1]=o,t+=2}return v[t>>1]=0,t-n},_t=e=>2*e.length,wt=(e,t,r)=>{for(var n="",a=e>>2,i=0;!(i>=t/4);i++){var o=g[a+i];if(!o&&!r)break;n+=String.fromCodePoint(o)}return n},$t=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,a=n+r-4,i=0;i<e.length;++i){var o=e.codePointAt(i);if(o>65535&&i++,y[t>>2]=o,(t+=4)+4>a)break}return y[t>>2]=0,t-n},bt=e=>{for(var t=0,r=0;r<e.length;++r){e.codePointAt(r)>65535&&r++,t+=4}return t},Tt=0,Pt=[],Ct=(e,t,r)=>{var n=[],a=e(n,r);return n.length&&(g[t>>2]=it.toHandle(n)),a},kt={},St=e=>{var t=kt[e];return void 0===t?Y(e):t},Ft=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),At=[0,31,60,91,121,152,182,213,244,274,305,335],Dt=[0,31,59,90,120,151,181,212,243,273,304,334],Wt={},Et=e=>{if(e instanceof x||"unwind"==e)return c;i(0,e)},xt=()=>I||Tt>0,Ot=e=>{c=e,xt()||(n.onExit?.(e),k=!0),i(0,new x(e))},Rt=(e,t)=>{c=e,Ot(e)},jt=e=>{if(!k)try{e(),(()=>{if(!xt())try{Rt(c)}catch(e){Et(e)}})()}catch(t){Et(t)}},Ut=()=>performance.now(),Ht=(e,t)=>Math.ceil(e/t)*t,It=e=>{var t=(e-d.buffer.byteLength+65535)/65536|0;try{return d.grow(t),F(),1}catch{}},Vt={},Bt=()=>{if(!Bt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:a||"./this.program"};for(var t in Vt)void 0===Vt[t]?delete e[t]:e[t]=Vt[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Bt.strings=r}return Bt.strings},Mt=[null,[],[]],qt=(e,t)=>{var r=Mt[e];0===t||10===t?((1===e?P:C)(ht(r)),r.length=0):r.push(t)},Lt=e=>n["_"+e],zt=e=>Je(e),Nt=(e,t,r,n,a)=>{var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=(e=>{var t=pt(e)+1,r=zt(t);return lt(e,r,t),r})(e)),t},array:e=>{var t=zt(e.length);return((e,t)=>{f.set(e,t)})(e,t),t}};var o=Lt(e),s=[],u=0;if(n)for(var c=0;c<n.length;c++){var l=i[r[c]];l?(0===u&&(u=B()),s[c]=l(n[c])):s[c]=n[c]}var p,d=o(...s);return p=d,0!==u&&V(u),d=function(e){return"string"===t?vt(e):"boolean"===t?!!e:e}(p),d};if((()=>{let e=ue.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof ue&&e instanceof ue))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,a=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return t===n&&r===a},clone(){if(this.$$.ptr||ne(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=se(Object.create(Object.getPrototypeOf(this),{$$:{value:re(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||ne(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),ie(this),oe(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ne(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(Se.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:_e,fromWireType:ke}),n.noExitRuntime&&(I=n.noExitRuntime),n.print&&(P=n.print),n.printErr&&(C=n.printErr),n.wasmBinary&&(u=n.wasmBinary),n.arguments&&n.arguments,n.thisProgram&&(a=n.thisProgram),n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();n.ENV=Vt,n.ccall=Nt,n.cwrap=(e,t,r,n)=>{var a=!r||r.every(e=>"number"===e||"boolean"===e);return"string"!==t&&a&&!n?Lt(e):(...n)=>Nt(e,t,r,n)};var Jt,Yt={__cxa_begin_catch:e=>{var t=new z(e);return t.get_caught()||(t.set_caught(!0),q--),t.set_rethrown(!1),M.push(t),Xe(e),Ke(e)},__cxa_end_catch:()=>{Le(0,0);var e=M.pop();Ge(e.excPtr),L=0},__cxa_find_matching_catch_2:()=>J([]),__cxa_find_matching_catch_3:e=>J([e]),__cxa_find_matching_catch_4:(e,t)=>J([e,t]),__cxa_rethrow:()=>{var e=M.pop();e||A("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(M.push(e),e.set_rethrown(!0),e.set_caught(!1),q++),L=t},__cxa_throw:(e,t,r)=>{throw new z(e).init(t,r),q++,L=e},__cxa_uncaught_exceptions:()=>q,__resumeException:e=>{throw L||(L=e),L},_abort_js:()=>A(""),_embind_register_bigint:(e,t,r,n,a)=>{t=Y(t);const i=0n===n;let o=e=>e;if(i){const e=8*r;o=t=>BigInt.asUintN(e,t),a=o(a)}ee(e,{name:t,fromWireType:o,toWireType:(e,t)=>("number"==typeof t&&(t=BigInt(t)),t),readValueFromPointer:te(t,r,!i),destructorFunction:null})},_embind_register_bool:(e,t,r,n)=>{ee(e,{name:t=Y(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},readValueFromPointer:function(e){return this.fromWireType(h[e])},destructorFunction:null})},_embind_register_class:(e,t,r,n,a,i,o,s,u,c,l,p,d)=>{l=Y(l),i=Ee(a,i),s&&=Ee(o,s),c&&=Ee(u,c),d=Ee(p,d);var f=(e=>{var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(l);de(f,function(){Re(`Cannot construct ${l} due to unbound types`,[n])}),je([e,t,r],n?[n]:[],t=>{var r,a;t=t[0],n?a=(r=t.registeredClass).instancePrototype:a=ue.prototype;var o=ce(l,function(...e){if(Object.getPrototypeOf(this)!==u)throw new K(`Use \'new\' to construct ${l}`);if(void 0===p.constructor_body)throw new K(`${l} has no accessible constructor`);var t=p.constructor_body[e.length];if(void 0===t)throw new K(`Tried to invoke ctor of ${l} with invalid number of parameters (${e.length}) - expected (${Object.keys(p.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),u=Object.create(a,{constructor:{value:o}});o.prototype=u;var p=new fe(l,o,u,d,r,i,s,c);p.baseClass&&(p.baseClass.__derivedClasses??=[],p.baseClass.__derivedClasses.push(p));var h=new Se(l,p,!0,!1,!1),v=new Se(l+"*",p,!1,!1,!1),m=new Se(l+" const*",p,!1,!0,!1);return le[e]={pointerType:v,constPointerType:m},Ae(f,o),[h,v,m]})},_embind_register_class_class_function:(e,t,r,n,a,i,o,s,u)=>{var c=Qe(r,n);t=Y(t),t=et(t),i=Ee(a,i,s),je([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function a(){Re(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var u=e.registeredClass.constructor;return void 0===u[t]?(a.argCount=r-1,u[t]=a):(pe(u,t,n),u[t].overloadTable[r-1]=a),je([],c,a=>{var c=[a[0],null].concat(a.slice(1)),l=Ie(n,c,null,i,o,s);if(void 0===u[t].overloadTable?(l.argCount=r-1,u[t]=l):u[t].overloadTable[r-1]=l,e.registeredClass.__derivedClasses)for(const r of e.registeredClass.__derivedClasses)r.constructor.hasOwnProperty(t)||(r.constructor[t]=l);return[]}),[]})},_embind_register_class_constructor:(e,t,r,n,a,i)=>{var o=Qe(t,r);a=Ee(n,a),je([],[e],e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new K(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class \'${e.name}\'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Re(`Cannot construct ${e.name} due to unbound types`,o)},je([],o,n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ie(r,n,null,a,i),[])),[]})},_embind_register_class_function:(e,t,r,n,a,i,o,s,u,c)=>{var l=Qe(r,n);t=Y(t),t=et(t),i=Ee(a,i,u),je([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function a(){Re(`Cannot call ${n} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,p=c[t];return void 0===p||void 0===p.overloadTable&&p.className!==e.name&&p.argCount===r-2?(a.argCount=r-2,a.className=e.name,c[t]=a):(pe(c,t,n),c[t].overloadTable[r-2]=a),je([],l,a=>{var s=Ie(n,a,e,i,o,u);return void 0===c[t].overloadTable?(s.argCount=r-2,c[t]=s):c[t].overloadTable[r-2]=s,[]}),[]})},_embind_register_class_property:(e,t,r,n,a,i,o,s,u,c)=>{t=Y(t),a=Ee(n,a),je([],[e],e=>{var n=`${(e=e[0]).name}.${t}`,l={get(){Re(`Cannot access ${n} due to unbound types`,[r,o])},enumerable:!0,configurable:!0};return l.set=u?()=>Re(`Cannot access ${n} due to unbound types`,[r,o]):e=>Q(n+" is a read-only property"),Object.defineProperty(e.registeredClass.instancePrototype,t,l),je([],u?[r,o]:[r],r=>{var o=r[0],l={get(){var t=tt(this,e,n+" getter");return o.fromWireType(a(i,t))},enumerable:!0};if(u){u=Ee(s,u);var p=r[1];l.set=function(t){var r=tt(this,e,n+" setter"),a=[];u(c,r,p.toWireType(a,t)),Ue(a)}}return Object.defineProperty(e.registeredClass.instancePrototype,t,l),[]}),[]})},_embind_register_emval:e=>ee(e,ot),_embind_register_enum:(e,t,r,n)=>{function a(){}t=Y(t),a.values={},ee(e,{name:t,constructor:a,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,readValueFromPointer:st(t,r,n),destructorFunction:null}),de(t,a)},_embind_register_enum_value:(e,t,r)=>{var n=ut(e,"enum");t=Y(t);var a=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:ce(`${n.name}_${t}`,function(){})}});a.values[r]=i,a[t]=i},_embind_register_float:(e,t,r)=>{ee(e,{name:t=Y(t),fromWireType:e=>e,toWireType:(e,t)=>t,readValueFromPointer:ct(t,r),destructorFunction:null})},_embind_register_function:(e,t,r,n,a,i,o,s)=>{var u=Qe(t,r);e=Y(e),e=et(e),a=Ee(n,a,o),de(e,function(){Re(`Cannot call ${e} due to unbound types`,u)},t-1),je([],u,r=>{var n=[r[0],null].concat(r.slice(1));return Ae(e,Ie(e,n,null,a,i,o),t-1),[]})},_embind_register_integer:(e,t,r,n,a)=>{t=Y(t);let i=e=>e;if(0===n){var o=32-8*r;i=e=>e<<o>>>o,a=i(a)}ee(e,{name:t,fromWireType:i,toWireType:(e,t)=>t,readValueFromPointer:te(t,r,0!==n),destructorFunction:null})},_embind_register_memory_view:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function a(e){var t=g[e>>2],r=g[e+4>>2];return new n(f.buffer,r,t)}ee(e,{name:r=Y(r),fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},_embind_register_std_string:(e,t)=>{ee(e,{name:t=Y(t),fromWireType(e){var t,r=g[e>>2];return t=vt(e+4,r,!0),Me(e),t},toWireType(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r,n="string"==typeof t;n||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||Q("Cannot pass non-string to std::string"),r=n?pt(t):t.length;var a=Be(4+r+1),i=a+4;return g[a>>2]=r,n?lt(t,i,r+1):h.set(t,i),null!==e&&e.push(Me,a),a},readValueFromPointer:_e,destructorFunction(e){Me(e)}})},_embind_register_std_wstring:(e,t,r)=>{var n,a,i;r=Y(r),2===t?(n=yt,a=gt,i=_t):(n=wt,a=$t,i=bt),ee(e,{name:r,fromWireType:e=>{var r=g[e>>2],a=n(e+4,r*t,!0);return Me(e),a},toWireType:(e,n)=>{"string"!=typeof n&&Q(`Cannot pass non-string to C++ string type ${r}`);var o=i(n),s=Be(4+o+t);return g[s>>2]=o/t,a(n,s+4,o+t),null!==e&&e.push(Me,s),s},readValueFromPointer:_e,destructorFunction(e){Me(e)}})},_embind_register_void:(e,t)=>{ee(e,{isVoid:!0,name:t=Y(t),fromWireType:()=>{},toWireType:(e,t)=>{}})},_emscripten_runtime_keepalive_clear:()=>{I=!1,Tt=0},_emval_create_invoker:(e,t,r)=>{var[n,...a]=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=ut(g[t+4*n>>2],`parameter ${n}`);return r})(e,t),i=n.toWireType.bind(n),o=a.map(e=>e.readValueFromPointer.bind(e));e--;var s,u={toValue:it.toValue},c=o.map((e,t)=>{var r=`argFromPtr${t}`;return u[r]=e,`${r}(args${t?"+"+8*t:""})`});switch(r){case 0:s="toValue(handle)";break;case 2:s="new (toValue(handle))";break;case 3:s="";break;case 1:u.getStringOrSymbol=St,s="toValue(handle)[getStringOrSymbol(methodName)]"}s+=`(${c})`,n.isVoid||(u.toReturnWire=i,u.emval_returnValue=Ct,s=`return emval_returnValue(toReturnWire, destructorsRef, ${s})`),s=`return function (handle, methodName, destructorsRef, args) {\\n ${s}\\n }`;var l=new Function(Object.keys(u),s)(...Object.values(u)),p=`methodCaller<(${a.map(e=>e.name)}) => ${n.name}>`;return(e=>{var t=Pt.length;return Pt.push(e),t})(ce(p,l))},_emval_decref:at,_emval_invoke:(e,t,r,n,a)=>Pt[e](t,r,n,a),_emval_new_object:()=>it.toHandle({}),_emval_run_destructors:e=>{var t=it.toValue(e);Ue(t),at(e)},_emval_set_property:(e,t,r)=>{e=it.toValue(e),t=it.toValue(t),r=it.toValue(r),e[t]=r},_gmtime_js:function(e,t){e=Ft(e);var r=new Date(1e3*e);y[t>>2]=r.getUTCSeconds(),y[t+4>>2]=r.getUTCMinutes(),y[t+8>>2]=r.getUTCHours(),y[t+12>>2]=r.getUTCDate(),y[t+16>>2]=r.getUTCMonth(),y[t+20>>2]=r.getUTCFullYear()-1900,y[t+24>>2]=r.getUTCDay();var n=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),a=(r.getTime()-n)/864e5|0;y[t+28>>2]=a},_localtime_js:function(e,t){e=Ft(e);var r=new Date(1e3*e);y[t>>2]=r.getSeconds(),y[t+4>>2]=r.getMinutes(),y[t+8>>2]=r.getHours(),y[t+12>>2]=r.getDate(),y[t+16>>2]=r.getMonth(),y[t+20>>2]=r.getFullYear()-1900,y[t+24>>2]=r.getDay();var n=0|(e=>((e=>e%4==0&&(e%100!=0||e%400==0))(e.getFullYear())?At:Dt)[e.getMonth()]+e.getDate()-1)(r);y[t+28>>2]=n,y[t+36>>2]=-60*r.getTimezoneOffset();var a=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),s=0|(i!=o&&r.getTimezoneOffset()==Math.min(o,i));y[t+32>>2]=s},_setitimer_js:(e,t)=>{if(Wt[e]&&(clearTimeout(Wt[e].id),delete Wt[e]),!t)return 0;var r=setTimeout(()=>{delete Wt[e],jt(()=>qe(e,Ut()))},t);return Wt[e]={id:r,timeout_ms:t},0},_tzset_js:(e,t,r,n)=>{var a=/* @__PURE__ */(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1),s=i.getTimezoneOffset(),u=o.getTimezoneOffset(),c=Math.max(s,u);g[e>>2]=60*c,y[t>>2]=+(s!=u);var l=e=>{var t=e>=0?"-":"+",r=Math.abs(e);return`UTC${t}${String(Math.floor(r/60)).padStart(2,"0")}${String(r%60).padStart(2,"0")}`},p=l(s),d=l(u);u<s?(lt(p,r,17),lt(d,n,17)):(lt(p,n,17),lt(d,r,17))},clock_time_get:function(e,t,r){if(!(e=>e>=0&&e<=3)(e))return 28;var n;n=0===e?Date.now():Ut();var a=Math.round(1e3*n*1e3);return $[r>>3]=BigInt(a),0},emscripten_get_heap_max:()=>2147483648,emscripten_resize_heap:e=>{var t=h.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var a=t*(1+.2/n);a=Math.min(a,e+100663296);var i=Math.min(r,Ht(Math.max(e,a),65536));if(It(i))return!0}return!1},environ_get:(e,t)=>{var r=0,n=0;for(var a of Bt()){var i=t+r;g[e+n>>2]=i,r+=lt(a,i,1/0)+1,n+=4}return 0},environ_sizes_get:(e,t)=>{var r=Bt();g[e>>2]=r.length;var n=0;for(var a of r)n+=pt(a)+1;return g[t>>2]=n,0},fd_close:e=>52,fd_fdstat_get:(e,t)=>{var r=0;return 0==e?r=2:(1==e||2==e)&&(r=64),f[t]=2,v[t+2>>1]=1,$[t+8>>3]=BigInt(r),$[t+16>>3]=BigInt(0),0},fd_seek:function(e,t,r,n){return 70},fd_write:(e,t,r,n)=>{for(var a=0,i=0;i<r;i++){var o=g[t>>2],s=g[t+4>>2];t+=8;for(var u=0;u<s;u++)qt(e,h[o+u]);a+=s}return g[n>>2]=a,0},invoke_diii:function(e,t,r,n){var a=B();try{return We(e)(t,r,n)}catch(i){if(V(a),i!==i+0)throw i;Le(1,0)}},invoke_fi:function(e,t){var r=B();try{return We(e)(t)}catch(n){if(V(r),n!==n+0)throw n;Le(1,0)}},invoke_fiii:function(e,t,r,n){var a=B();try{return We(e)(t,r,n)}catch(i){if(V(a),i!==i+0)throw i;Le(1,0)}},invoke_i:function(e){var t=B();try{return We(e)()}catch(r){if(V(t),r!==r+0)throw r;Le(1,0)}},invoke_ii:function(e,t){var r=B();try{return We(e)(t)}catch(n){if(V(r),n!==n+0)throw n;Le(1,0)}},invoke_iii:function(e,t,r){var n=B();try{return We(e)(t,r)}catch(a){if(V(n),a!==a+0)throw a;Le(1,0)}},invoke_iiii:function(e,t,r,n){var a=B();try{return We(e)(t,r,n)}catch(i){if(V(a),i!==i+0)throw i;Le(1,0)}},invoke_iiiid:function(e,t,r,n,a){var i=B();try{return We(e)(t,r,n,a)}catch(o){if(V(i),o!==o+0)throw o;Le(1,0)}},invoke_iiiii:function(e,t,r,n,a){var i=B();try{return We(e)(t,r,n,a)}catch(o){if(V(i),o!==o+0)throw o;Le(1,0)}},invoke_iiiiid:function(e,t,r,n,a,i){var o=B();try{return We(e)(t,r,n,a,i)}catch(s){if(V(o),s!==s+0)throw s;Le(1,0)}},invoke_iiiiii:function(e,t,r,n,a,i){var o=B();try{return We(e)(t,r,n,a,i)}catch(s){if(V(o),s!==s+0)throw s;Le(1,0)}},invoke_iiiiiii:function(e,t,r,n,a,i,o){var s=B();try{return We(e)(t,r,n,a,i,o)}catch(u){if(V(s),u!==u+0)throw u;Le(1,0)}},invoke_iiiiiiii:function(e,t,r,n,a,i,o,s){var u=B();try{return We(e)(t,r,n,a,i,o,s)}catch(c){if(V(u),c!==c+0)throw c;Le(1,0)}},invoke_iiiiiiiiii:function(e,t,r,n,a,i,o,s,u,c){var l=B();try{return We(e)(t,r,n,a,i,o,s,u,c)}catch(p){if(V(l),p!==p+0)throw p;Le(1,0)}},invoke_iiiiiiiiiii:function(e,t,r,n,a,i,o,s,u,c,l){var p=B();try{return We(e)(t,r,n,a,i,o,s,u,c,l)}catch(d){if(V(p),d!==d+0)throw d;Le(1,0)}},invoke_iiiiiiiiiiii:function(e,t,r,n,a,i,o,s,u,c,l,p){var d=B();try{return We(e)(t,r,n,a,i,o,s,u,c,l,p)}catch(f){if(V(d),f!==f+0)throw f;Le(1,0)}},invoke_iiiiijj:function(e,t,r,n,a,i,o){var s=B();try{return We(e)(t,r,n,a,i,o)}catch(u){if(V(s),u!==u+0)throw u;Le(1,0)}},invoke_iiiijj:function(e,t,r,n,a,i){var o=B();try{return We(e)(t,r,n,a,i)}catch(s){if(V(o),s!==s+0)throw s;Le(1,0)}},invoke_iiij:function(e,t,r,n){var a=B();try{return We(e)(t,r,n)}catch(i){if(V(a),i!==i+0)throw i;Le(1,0)}},invoke_j:function(e){var t=B();try{return We(e)()}catch(r){if(V(t),r!==r+0)throw r;return Le(1,0),0n}},invoke_jiiii:function(e,t,r,n,a){var i=B();try{return We(e)(t,r,n,a)}catch(o){if(V(i),o!==o+0)throw o;return Le(1,0),0n}},invoke_v:function(e){var t=B();try{We(e)()}catch(r){if(V(t),r!==r+0)throw r;Le(1,0)}},invoke_vi:function(e,t){var r=B();try{We(e)(t)}catch(n){if(V(r),n!==n+0)throw n;Le(1,0)}},invoke_vii:function(e,t,r){var n=B();try{We(e)(t,r)}catch(a){if(V(n),a!==a+0)throw a;Le(1,0)}},invoke_viii:function(e,t,r,n){var a=B();try{We(e)(t,r,n)}catch(i){if(V(a),i!==i+0)throw i;Le(1,0)}},invoke_viiii:function(e,t,r,n,a){var i=B();try{We(e)(t,r,n,a)}catch(o){if(V(i),o!==o+0)throw o;Le(1,0)}},invoke_viiiii:function(e,t,r,n,a,i){var o=B();try{We(e)(t,r,n,a,i)}catch(s){if(V(o),s!==s+0)throw s;Le(1,0)}},invoke_viiiiii:function(e,t,r,n,a,i,o){var s=B();try{We(e)(t,r,n,a,i,o)}catch(u){if(V(s),u!==u+0)throw u;Le(1,0)}},invoke_viiiiiii:function(e,t,r,n,a,i,o,s){var u=B();try{We(e)(t,r,n,a,i,o,s)}catch(c){if(V(u),c!==c+0)throw c;Le(1,0)}},invoke_viiiiiiii:function(e,t,r,n,a,i,o,s,u){var c=B();try{We(e)(t,r,n,a,i,o,s,u)}catch(l){if(V(c),l!==l+0)throw l;Le(1,0)}},invoke_viiiiiiiiii:function(e,t,r,n,a,i,o,s,u,c,l){var p=B();try{We(e)(t,r,n,a,i,o,s,u,c,l)}catch(d){if(V(p),d!==d+0)throw d;Le(1,0)}},invoke_viiiiiiiiiiiiiii:function(e,t,r,n,a,i,o,s,u,c,l,p,d,f,h,v){var m=B();try{We(e)(t,r,n,a,i,o,s,u,c,l,p,d,f,h,v)}catch(y){if(V(m),y!==y+0)throw y;Le(1,0)}},invoke_viiji:function(e,t,r,n,a){var i=B();try{We(e)(t,r,n,a)}catch(o){if(V(i),o!==o+0)throw o;Le(1,0)}},invoke_viijii:function(e,t,r,n,a,i){var o=B();try{We(e)(t,r,n,a,i)}catch(s){if(V(o),s!==s+0)throw s;Le(1,0)}},llvm_eh_typeid_for:e=>e,proc_exit:Ot};return Jt=await async function(){function e(e,t){return Jt=e.exports,d=Jt.memory,F(),Fe=Jt.__indirect_function_table,function(e){Ve=e.__getTypeName,n._malloc=Be=e.malloc,n._parseDropFile=e.parseDropFile,n._getAttributeFromDropFile=e.getAttributeFromDropFile,n._takeAttributeFromDropFile=e.takeAttributeFromDropFile,n._flattenDropFile=e.flattenDropFile,n._destroyDropFileHandle=e.destroyDropFileHandle,e.__cxa_free_exception,n._free=Me=e.free,qe=e._emscripten_timeout,Le=e.setThrew,ze=e._emscripten_tempret_set,Ne=e._emscripten_stack_restore,Je=e._emscripten_stack_alloc,Ye=e.emscripten_stack_get_current,Ge=e.__cxa_decrement_exception_refcount,Xe=e.__cxa_increment_exception_refcount,Ze=e.__cxa_can_catch,Ke=e.__cxa_get_exception_ptr}(Jt),Jt}var t={env:Yt,wasi_snapshot_preview1:Yt};return n.instantiateWasm?new Promise((r,a)=>{n.instantiateWasm(t,(t,n)=>{r(e(t))})}):(T??=D(),e((await E(u,T,t)).instance))}(),function(){function e(){n.calledRun=!0,!k&&(S=!0,Jt.__wasm_call_ctors(),l?.(n),n.onRuntimeInitialized?.(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)j(n.postRun.shift());O(R)}())}!function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)H(n.preRun.shift());O(U)}(),n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e()}(),S?n:new Promise((e,t)=>{l=e,p=t})}({wasmBinary:r}),a=/* @__PURE__ */new Map,i={get AttributeInfo(){return n.AttributeInfo},get AquaStatus(){return n.AquaStatus},get heapU8(){return n.HEAPU8},get heapU32(){return n.HEAPU32},get SceneRequestDescriptor(){return n.SceneRequestDescriptor},get WorkerDataType(){return n.WorkerDataType},dataPtrView:e=>n.dataPtrView(e),free:(...e)=>n.ccall("free","number",["number"],e),malloc:(...e)=>n.ccall("malloc","number",["number"],e),parseDropFile:(e,t)=>n.parseDropFile(e,t),getAttributeFromDropFile:(e,t,r)=>n.getAttributeFromDropFile(e,t,r),takeAttributeFromDropFile:(e,t,r)=>n.takeAttributeFromDropFile(e,t,r),flattenDropFile:(e,t,r)=>n.flattenDropFile(e,t,r),destroyDropFileHandle:e=>n.destroyDropFileHandle(e)};var o;o={async cancel(e,t){const r=`${t}-${e}`,n=a.get(r);return n&&(n.abort(),a.delete(r)),[{cancelled:!!n}]},heapSnapshot:async e=>"function"!=typeof n.TakeHeapSnapshot?[{snapshotJson:null}]:[{snapshotJson:n.TakeHeapSnapshot(e)}],heapTrackingControl:async e=>"function"!=typeof n.SetHeapTrackingEnabled?[{success:!1}]:(n.SetHeapTrackingEnabled(e),[{success:!0}]),heapTrackingReset:async()=>"function"!=typeof n.ResetHeapTracking?[{success:!1}]:(n.ResetHeapTracking(),[{success:!0}]),async decode(r,o,s,u,c){const l=`${o}-${r}`,p=new AbortController;a.set(l,p);try{const{free:a,malloc:l,parseDropFile:f,getAttributeFromDropFile:h,takeAttributeFromDropFile:v,flattenDropFile:m,destroyDropFileHandle:y}=i,g=s.byteLength,_=l(g);i.heapU8.set(new Uint8Array(s),_);const w=n.SceneRequestDescriptor.deserializeFromBinary(_,g);a(_);const $=w.getUrl(),b=w.getBody()||null,T=b?"POST":"GET",P=w.getHeaders();w.delete();const C=performance.now(),k=await fetch($,{method:T,headers:P,body:b,signal:p.signal}),S=JSON.stringify({"x-cache":k.headers.get("x-cache")??""});if(!k.ok){const e=performance.now()-C;return[{requestIdLow:r,requestIdHigh:o,resultBuffer:new ArrayBuffer(0),success:!1,parsed:!1,error:`HTTP error! status: ${k.status}`,dataType:n.WorkerDataType.Raw.value,contextPtr:u,attributes:[],duration:e,ttfb:e,httpStatus:k.status,responseHeadersJson:S},{transfer:[]}]}const F=performance.now()-C,A=await k.arrayBuffer(),D=performance.now()-C,W=[];if(!$.split(/[?#]/,1)[0].endsWith(".drop"))return[{requestIdLow:r,requestIdHigh:o,resultBuffer:A,success:!0,parsed:!1,error:void 0,dataType:n.WorkerDataType.Raw.value,contextPtr:u,attributes:W,duration:D,ttfb:F,httpStatus:k.status,responseHeadersJson:S},{transfer:[A]}];const E=A.byteLength,x=l(E);i.heapU8.set(new Uint8Array(A),x);const O=l(4),R=l(4);i.heapU32[O/4]=0,i.heapU32[R/4]=0;let j=0,U=0;const H=new i.AttributeInfo;try{if(j=f(x,E),0===j)throw new Error("parseDropFile failed");let a=c;for(const[r,n]of Object.entries(e)){if(n.discard)v(j,r,a);else if(h(j,r,H)===i.AquaStatus.Success){const e=t(r,a,i.dataPtrView(H));v(j,r,a)===i.AquaStatus.Success&&W.push(e)}a++}if(m(j,O,R)!==i.AquaStatus.Success)throw new Error("flattenDropFile failed");U=i.heapU32[O/4];const s=i.heapU32[R/4];if(0===U)throw new Error("flattenDropFile gave nullptr");const l=i.heapU8.buffer.slice(U,U+s),p=W.map(e=>e.paddedData.buffer);return[{requestIdLow:r,requestIdHigh:o,resultBuffer:l,success:!0,parsed:!0,error:void 0,dataType:n.WorkerDataType.Drop.value,contextPtr:u,attributes:W,duration:D,ttfb:F,httpStatus:k.status,responseHeadersJson:S},{transfer:[l,...p]}]}catch(d){console.error("Exception when parsing dropfile",d);const e=d instanceof Error?d.stack??d.message:String(d),t=(new Uint8Array).buffer;return[{requestIdLow:r,requestIdHigh:o,resultBuffer:t,success:!1,parsed:!1,error:e,dataType:n.WorkerDataType.Drop.value,contextPtr:u,attributes:void 0,duration:D,ttfb:F,httpStatus:k.status,responseHeadersJson:S},{transfer:[t]}]}finally{y(j),a(x),a(O),a(R),0!==U&&a(U),H.delete()}}catch(d){const e=d instanceof Error?d.message:String(d),t=d instanceof Error&&"AbortError"===d.name;return[{requestIdLow:r,requestIdHigh:o,resultBuffer:new ArrayBuffer(0),success:!1,parsed:!1,error:t?"Cancelled":e,dataType:n.WorkerDataType.Raw.value,contextPtr:u,attributes:[],duration:0,ttfb:0,httpStatus:0,responseHeadersJson:"{}"},{transfer:[]}]}finally{a.delete(l)}}},self.postMessage("ready"),self.addEventListener("message",async({data:e})=>{if("ready"===e)return;const{id:t,action:r,args:n}=e,[a,...i]=await Reflect.apply(o[r],void 0,[...n,t]);self.postMessage({id:t,result:a},...i)});\n',m="undefined"!=typeof self&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",p],{type:"text/javascript;charset=utf-8"});function f(e){let t;try{if(t=m&&(self.URL||self.webkitURL).createObjectURL(m),!t)throw"";const r=new Worker(t,{type:"module",name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(r){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(p),{type:"module",name:e?.name})}}const g=(e=>e.includes("/.vite/")?e.replace(/\.vite\/[^?#]*/,()=>"@miris-inc/core/dist/aqua-parser.wasm"):e)(new URL("aqua-parser.wasm",import.meta.url).href);class y extends h{static name="decoder";static Worker=f;constructor(e){super(e),this.#x()}async#x(){try{const e=await fetch(g);if(!e.ok)throw new Error(`HTTP ${e.status} fetching aqua-parser.wasm`);const t=await e.arrayBuffer();this._postToWorker({type:"wasm-init",wasmBinary:t},[t])}catch(e){console.error("Failed to load aqua-parser.wasm for decoder worker",e),this._postToWorker({type:"wasm-init"})}}get AttributeInfo(){return this.module.AttributeInfo}async heapSnapshot(e){return this._execute("heapSnapshot",e)}async heapTrackingControl(e){return this._execute("heapTrackingControl",e)}async heapTrackingReset(){return this._execute("heapTrackingReset")}async cancel(e,t){await this.ready,this._execute("cancel",e,t).catch(()=>{})}async decode(...e){const{requestIdLow:t,requestIdHigh:r,resultBuffer:n,success:i,dataType:s,contextPtr:o,attributes:c,duration:u,ttfb:l,httpStatus:d,responseHeadersJson:h}=await this._execute("decode",...e);if(void 0!==c)for(const{paddedData:g,originalSize:y,id:v}of c)a.addWithId({paddedData:g,originalSize:y},v);const{engine:p}=this,m=n.byteLength,f=p.malloc(m);p.heapU8.set(new Uint8Array(n),f),p.onWorkerResult(t,r,f,m,d,u,l,i,s,"",h,o)}}const v={sparkPackedSplat:{elementsPerSplat:4,discard:!1},extendedPackedSplatLow:{elementsPerSplat:4,discard:!1},extendedPackedSplatHigh:{elementsPerSplat:4,discard:!1},packedSh1:{elementsPerSplat:2,discard:!1},packedSh2:{elementsPerSplat:4,discard:!1},packedSh3:{elementsPerSplat:4,discard:!1},sh1Extended:{elementsPerSplat:4,discard:!1},sh2Extended:{elementsPerSplat:4,discard:!1},sh3Extended_0:{elementsPerSplat:4,discard:!1},sh3Extended_1:{elementsPerSplat:4,discard:!1},splatterEllipsoids:{elementsPerSplat:12,discard:!1},splatterSphericalHarmonics:{elementsPerSplat:16,discard:!1}};function b(e,t,r){const n=v[e];if(void 0===n)throw new Error("attribute name"+e+" is unknown");const a=r.length,i=(s=a,o=2048*n.elementsPerSplat,Math.ceil(s/o)*o);var s,o;const c=new Uint32Array(i);return c.set(r),{paddedData:c,originalSize:a,id:t}}class S{static SPARK_PACKED_SPLAT="sparkPackedSplat";static SPARK_EXTENDED_SPLAT_LOW="extendedPackedSplatLow";static SPARK_EXTENDED_SPLAT_HIGH="extendedPackedSplatHigh";static SPARK_PACKED_SH1="packedSh1";static SPARK_PACKED_SH2="packedSh2";static SPARK_PACKED_SH3="packedSh3";static SPARK_EXTENDED_SH1="sh1Extended";static SPARK_EXTENDED_SH2="sh2Extended";static SPARK_EXTENDED_SH3_A="sh3Extended_0";static SPARK_EXTENDED_SH3_B="sh3Extended_1";static UNUSED="unused";static SPLATTER_ELLIPSOIDS="splatterEllipsoids";static SPLATTER_SPHERICAL_HARMONICS="splatterSphericalHarmonics"}class w{static AquaStatus={Success:0,Failure:1};static SceneObjectType={ModelRoot:0,SceneObject:1,StreamObject:2,GaussianSplats:3,PointsObject:4,Camera:5,LodOctree:6,VariantSetCollection:7,VariantSet:8,VariantSetOption:9};static Feature={DrMap:0};static FeatureState={NotLoaded:0,Pending:1,Loaded:2,Failed:3};#D;get module(){if(!this.#D)throw new Error("Engine has not yet been initialized. Did you forget to `await engine.ready()?`");return this.#D}#E=/* @__PURE__ */new Set;#I=/* @__PURE__ */new Map;constructor(e={}){Object.defineProperty(this,"pending",{value:!0,configurable:!0,enumerable:!0}),Object.defineProperty(this,"ready",{enumerable:!0,value:this.#F(e)})}async#F(e){return this.#D=await d({createDeserializeWorker:this.createDeserializeWorker.bind(this),submitToWorker:this.submitToWorker.bind(this),cancelRequest:this.cancelRequest.bind(this),terminateWorker:this.terminateWorker.bind(this),workerUrl:"aqua-parser",...e,preRun:[e=>Object.assign(e.ENV,w.#O())]}),Object.defineProperty(this,"pending",{value:!1,configurable:!1}),this}get AttributeInfo(){return this.module.AttributeInfo}get Handedness(){return this.module.Handedness}get heapF32(){return this.module.HEAPF32}get heapU8(){return this.module.HEAPU8}get MatrixOrder(){return this.module.MatrixOrder}get SceneChangeIds(){return this.module.SceneChangeIds}get SceneMetadata(){return this.module.SceneMetadata}get RuntimeSettings(){return this.module.RuntimeSettings}get SpatialFormat(){return this.module.SpatialFormat}get StringVector(){return this.module.StringVector}get UpAxis(){return this.module.UpAxis}activatedObjectIdsView(...e){return this.module.activatedObjectIdsView(...e)}addStreamById(...e){return this.module.ccall("AddStreamById","number",["number","string","string","number"],e)}allocateSceneChangesArrays(...e){return this.module.AllocateSceneChangesArrays(...e)}createContext(...e){return this.module.ccall("CreateAquaContext","number",[],e)}destroyContext(...e){return this.module.ccall("DestroyAquaContext","number",["number"],e)}createClient(e,...t){return e?this.module.ccall("CreateClientForContext","number",["number"],[e,...t]):this.module.ccall("CreateClient","number",[],t)}createdObjectIdsView(...e){return this.module.createdObjectIdsView(...e)}deletedObjectIdsView(...e){return this.module.deletedObjectIdsView(...e)}dataPtrView(...e){return this.module.dataPtrView(...e)}deactivatedObjectIdsView(...e){return this.module.deactivatedObjectIdsView(...e)}destroyClient(...e){return this.module.ccall("DestroyClient","number",["number"],e)}free(...e){return this.module.ccall("free","number",["number"],e)}getAssetsAsync(...e){return this.module.GetAssetsAsync(...e)}getAttribute(...e){return this.module.ccall("GetAttribute","number",["number","number","string","number"],e)}getDefaultCameraId(...e){return this.module.ccall("GetDefaultCameraId","number",["number"],e)}getLocalBoundingBox(...e){return this.module.ccall("GetLocalBoundingBox","number",["number","number","number"],e)}getWorldBoundingBox(...e){return this.module.ccall("GetWorldBoundingBox","number",["number","number","number"],e)}getLodIndex(...e){return this.module.ccall("GetLodIndex","number",["number","number"],e)}getSceneChanges(...e){return this.module.GetSceneChanges(...e)}getSceneChangesCounts(...e){return this.module.GetSceneChangesCounts(...e)}getSceneMetadata(...e){return this.module.GetSceneMetadata(...e).value}getSceneObjectParent(...e){return this.module.ccall("GetSceneObjectParent","number",["number","number"],e)}getSceneObjectType(...e){return this.module.ccall("GetSceneObjectType","number",["number","number"],e)}getLocalTransform(...e){return this.module.ccall("MirisGetLocalTransform","number",["number","number","number"],e)}getWorldTransform(...e){return this.module.ccall("MirisGetWorldTransform","number",["number","number","number"],e)}hasAttribute(...e){return this.module.ccall("HasAttribute","boolean",["number","number","string"],e)}isSceneObjectAncestorOf(...e){return this.module.ccall("IsSceneObjectAncestorOf","boolean",["number","number","number"],e)}lockScene(...e){return this.module.ccall("LockScene","number",["number"],e)}malloc(...e){return this.module.ccall("malloc","number",["number"],e)}modifiedObjectIdsView(...e){return this.module.modifiedObjectIdsView(...e)}onWorkerResult(...e){const t=`${e[1]}-${e[0]}`;return this.#I.delete(t),this.module.ccall("onWorkerResult",null,["number","number","number","number","number","number","number","number","number","string","string","number"],e)}removeStream(...e){return this.module.ccall("RemoveStream","boolean",["pointer","number"],e)}setAssetViewerKey(...e){return this.module.ccall("SetAssetViewerKey","number",["number","string"],e)}setClientSpatialFormat(...e){return this.module.SetClientSpatialFormat(...e).value}setRuntimeSettings(...e){return this.module.SetRuntimeSettings(...e).value}setMainCameraTransform(...e){return this.module.ccall("SetMainCameraTransform","number",["number","number"],e)}setMainCameraViewFrustum(...e){return this.module.ccall("SetMainCameraViewFrustum","number",["number","number","number","number","number"],e)}setMaxCacheSize(...e){return this.module.setMaxCacheSize(...e)}setSceneObjectTransform(...e){return this.module.ccall("SetSceneObjectTransform","number",["number","number","number"],e)}hasFeature(...e){return this.module.HasFeature(...e)}getFeatureVersion(...e){return this.module.GetFeatureVersion(...e)}getFeatureState(...e){return this.module.GetFeatureState(...e)}getName(...e){return this.module.GetName(...e)}setVariantSelection(...e){return this.module.ccall("SetVariantSelection","number",["number","number"],e)}takeAttribute(...e){return this.module.ccall("TakeAttribute","number",["number","number","string","bigint"],e)}takeEvictedClientSideAttributeIds(...e){return this.module.TakeEvictedClientSideAttributeIds(...e)}getActiveClientSideIdsCheckSum(){return this.module.GetActiveClientSideIdsCheckSum()}unlockScene(...e){return this.module.ccall("UnlockScene","number",["number"],e)}updateSceneExecution(...e){return this.module.ccall("UpdateSceneExecution","number",["number"],e)}recordFrameTime(...e){return this.module.ccall("RecordFrameTime","number",["number","number"],e)}takeRenderRequired(...e){return this.module.TakeRenderRequired(...e)}createDeserializeWorker(e,t,r){for(let n=1;n<r;n+=1)this.#E.add(new y({engine:this}));return!0}cancelRequest(e,t){const r=`${t}-${e}`,n=this.#I.get(r);return n&&(n.cancel(e,t),this.#I.delete(r)),!0}submitToWorker(e,t,r,n){const i=[...this.#E.values()].reduce((e,t)=>e?t.pendingRequests<e.pendingRequests?t:e:t),s=`${t}-${e}`;this.#I.set(s,i);const o=a.getConsecutiveIds(Object.keys(v).length);return i.ready.then(()=>i.decode(e,t,r,n,o)),!0}terminateWorker(){for(const e of this.#E)e.terminate();this.#E.clear()}async requestWorkerHeapSnapshots(e){const t=[...this.#E];return(await Promise.allSettled(t.map(t=>t.ready.then(()=>{let r;const n=new Promise(e=>{r=setTimeout(()=>e(null),5e3)});return Promise.race([t.heapSnapshot(e).then(e=>e.snapshotJson),n]).finally(()=>clearTimeout(r))})))).map(e=>"fulfilled"===e.status?e.value:null)}async setWorkerHeapTrackingEnabled(e){await Promise.allSettled([...this.#E].map(t=>t.ready.then(()=>t.heapTrackingControl(e))))}async resetWorkerHeapTracking(){await Promise.allSettled([...this.#E].map(e=>e.ready.then(()=>e.heapTrackingReset())))}static#O(){return{AQUA_USE_SINGLETON_NETWORK_TRANSPORT:"true",AQUA_SERVER_BASE_URL:"https://app.miris.com/viewer/v1"}}}const _=[30,60,72,90,120,144,165,240];class k{static _instance;static async instance(){const e=this._instance??=new this;return await e.ready,e}#R;get sharedContext(){return this.#R}#j;get viewerKey(){return this.#j}set viewerKey(e){this.#j=e}#W=/* @__PURE__ */new Set;get scenes(){return new Set(this.#W)}#M=[];#L=null;#V=/* @__PURE__ */new Set;#B=/* @__PURE__ */new Map;constructor(){this.constructor.prototype._instance||(this.constructor.prototype._instance=this),Object.defineProperties(this,{pending:{value:!0,configurable:!0,enumerable:!0},engine:{value:new w,enumerable:!0}}),Object.defineProperty(this,"ready",{enumerable:!0,value:this.#U()})}async#U(){const{engine:e}=this;await e.ready,this.#R=this.engine.createContext();const t=1048576,r=new URLSearchParams(window.location.search).get("aquaMaxCacheSize");let n=0;if(r){const e=parseInt(r,10);!isNaN(e)&&e>0&&(n=e)}return n>0?this.engine.setMaxCacheSize(n*t):navigator.userAgent.includes("iPhone")?this.engine.setMaxCacheSize(128*t):navigator.userAgent.includes("Android")&&this.engine.setMaxCacheSize(256*t),this.#H(),Object.defineProperty(this,"pending",{value:!1,configurable:!1}),this}dispose(){this.#R&&(this.engine.destroyContext(this.#R)!==w.AquaStatus.Success&&console.error(`Failed to destroy aqua context with handle '${this.#R}'`),this.#R=0)}updateParentedTransform(e,t){}#q=function(){let e=[],t=null,r=0;return screen.addEventListener?.("change",()=>{e=[],r=0,t=null}),{update(n){if(!r){if(null!==t&&(e.push(n-t),e.length>60&&e.shift(),!r&&60===e.length)){const t=1e3/(e.reduce((e,t)=>e+t,0)/e.length);r=_.reduce((e,r)=>Math.abs(r-t)<Math.abs(e-t)?r:e)}t=n}},get nativeHz(){return r}}}();#K=this.#H.bind(this);#z=!1;#N=null;#G=72;#Q=!1;#Y(){const e=new this.engine.RuntimeSettings;e.targetFramesPerSecond=this.#G,e.xrModeActive=this.#Q;for(const t of this.#W)t.client.setRuntimeSettings(e);e.delete()}_setXRModeActive(e,t){this.#Q=e,void 0!==t&&(this.#G=t),this.#Y()}#H(){this.#z||(this._update(),requestAnimationFrame(this.#K))}_update(){this.#q&&(this.#q.update(performance.now()),this.#q.nativeHz>0&&(this.#G=this.#q.nativeHz,this.#Y(),this.#q=null));const e=performance.now(),t=null===this.#N?null:e-this.#N;this.#N=e;const r=null!==t&&t<=1e3?t:null;for(const n of this.#W){const{client:e}=n;null!==r&&e.recordFrameTime(r),e.updateSceneExecution();const t=e.takeEvictedClientSideAttributeIds();try{const e=t.size();if(e>0){const r=[];for(let n=0;n<e;n++)r.push(Number(t.get(n)));a.remove(r)}}finally{t.delete()}const i=this.engine.getActiveClientSideIdsCheckSum();a.validateCheckSum(i);if(!e.lockScene())return;try{this.#J(n)}finally{e.unlockScene()}}this.#M.length&&(this.applyChanges(this.#M),this.#M.length=0)}#X(e,t,r){const n=this.engine.malloc(4*t);r(e,n);const a=this.engine.heapF32.subarray(n>>2,(n>>2)+t).slice();return this.engine.free(n),a}getLocalTransform(e,t){if(Number.isInteger(t)&&t>=0)return this.#X(t,16,e.getLocalTransform.bind(e))}getWorldTransform(e,t){if(Number.isInteger(t)&&t>=0)return this.#X(t,16,e.getWorldTransform.bind(e))}#Z(){return!!this.#L&&(this.#L.createdObjectsCount>0||(this.#L.activatedObjectsCount>0||(this.#L.deactivatedObjectsCount>0||(this.#L.modifiedObjectsCount>0||this.#L.deletedObjectsCount>0))))}#ee(e,t,r,n){const{engine:i}=this;if(!e.hasAttribute(t,r))return null;const{ptr:s}=n.$$,o=e.getAttribute(t,r,s);if(o!==w.AquaStatus.Success)return console.warn(`GetAttribute failed for object id ${t} and attribute name ${r}: status ${o}`),null;let c,u;if(0n!=n.clientSideId)({paddedData:c,originalSize:u}=a.get(Number(n.clientSideId)));else{const s=b(r,0,i.dataPtrView(n));c=s.paddedData,u=s.originalSize;const o=a.add({paddedData:s.paddedData,originalSize:s.originalSize}),l=e.takeAttribute(t,r,BigInt(o));if(l!==w.AquaStatus.Success)return a.remove(o),console.warn(`Failed to take attribute ${r} for scene object ${t}: status ${l}`),null}return{paddedData:c,originalSize:u}}#J(e){const{engine:a}=this,{client:s,camera:o,lods:c}=e;if(o&&o.update(),null===this.#L&&(this.#L=new a.SceneChangeIds),s.getSceneChangesCounts(this.#L),!this.#Z())return;a.allocateSceneChangesArrays(this.#L),s.getSceneChanges(this.#L);const u=/* @__PURE__ */new Set;for(const h of a.createdObjectIdsView(this.#L)){const a=s.getSceneObjectType(h);if(a!==w.SceneObjectType.StreamObject){if(a===w.SceneObjectType.ModelRoot){const t=e.getStreamForDescendentId(h);if(!t)continue;const r=new n({id:h,stream:t}),a=this.getLocalTransform(s,h);if(!a)continue;const i=s.getSceneObjectParent(h),o=this.getLocalTransform(s,i);if(!o)continue;const c=this.updateParentedTransform(a,o);if(!c)continue;r.transform=c}else if(a==w.SceneObjectType.GaussianSplats){const n=e.getModelRootForDescendentId(h);if(!n)continue;const a=new t({id:h,modelRoot:n,lodStore:c});a.transform=this.getLocalTransform(s,h),u.add(h);const i=new r({type:"created",lod:a});this.#M.push(i)}else if(a==w.SceneObjectType.VariantSetCollection){const t=e.getStreamForDescendentId(h);t?._addVariantCollection(h)}else if(a==w.SceneObjectType.VariantSet){const t=e.getStreamForDescendentId(h),r=s.getName(h),n=s.getSceneObjectParent(h);t?._addVariant(n,{id:h,name:r,options:[],nestedSets:[]})}else if(a==w.SceneObjectType.VariantSetOption){const t=e.getStreamForDescendentId(h),r=s.getName(h),n=s.getSceneObjectParent(h);t?._addVariant(n,{id:h,name:r,type:"option"})}}else i.forId(h)}for(const t of a.deletedObjectIdsView(this.#L)){const e=c.forId(t);if(!e)continue;const n=new r({type:"deleted",lod:e});this.#M.push(n)}for(const t of a.modifiedObjectIdsView(this.#L)){const n=s.getSceneObjectType(t);if(n===w.SceneObjectType.LodOctree)e._onFeatureData(t);else if(n===w.SceneObjectType.GaussianSplats){const n=this.#X(t,6,s.getWorldBoundingBox.bind(s)),i=s.getLodIndex(t),o=new a.AttributeInfo,u=new a.AttributeInfo;try{let a=this.#ee(s,t,S.SPARK_EXTENDED_SPLAT_LOW,o),l=null,d=!0;if(null===a?(a=this.#ee(s,t,S.SPARK_PACKED_SPLAT,o),d=!1):l=this.#ee(s,t,S.SPARK_EXTENDED_SPLAT_HIGH,u),null===a){console.error(`Could not retrieve primary splats attribute for scene object ${t}! skipping scene object`);continue}const h=c.forId(t);if(!h){console.warn(`Received modified event for LOD ${t} which does not exist.`);continue}h.splats=a?.paddedData,h.splatsExtendedData=l?.paddedData??null,h.useExtSplats=d,h.bounds=n,h.lodIndex=i,h.paddingCount=(a?.paddedData.length-a.originalSize)/4,this.#te(e,t,h);const p=new r({type:"modified",lod:h});if(this.#M.push(p),this.#V.delete(t)){this.#M.push(new r({type:"activated",lod:h}));for(const[,e]of this.#B)this.#M.push(new r({type:"deactivated",lod:e}));this.#B.clear()}}finally{o.delete(),u.delete()}}}if(this.#M.some(e=>"created"===e.type))try{const e=new a.SceneMetadata;s.getSceneMetadata(e),this.onColorSpaceDetected("linear"===e.inputColorSpace),e.delete()}catch(d){console.warn("Failed to read scene metadata:",d)}let l=!1;for(const t of a.activatedObjectIdsView(this.#L)){if(s.getSceneObjectType(t)==w.SceneObjectType.GaussianSplats){const e=c.forId(t);if(e&&e.splats){const t=new r({type:"activated",lod:e});this.#M.push(t)}else e&&(this.#V.add(t),l=!0)}}for(const t of a.deactivatedObjectIdsView(this.#L)){if(s.getSceneObjectType(t)==w.SceneObjectType.GaussianSplats&&(this.#V.delete(t),!u.has(t))){const e=c.forId(t);if(e&&e.splats)if(l)this.#B.set(t,e);else{const t=new r({type:"deactivated",lod:e});this.#M.push(t)}}}}#te(e,t,r){const{engine:n}=this,{client:a}=e,i=(e,i,s)=>{const o=r.useExtSplats?i:e;if(a.hasAttribute(t,o)){const e=new n.AttributeInfo;try{const r=this.#ee(a,t,o,e);null!==r&&s(r.paddedData,e.maxValue.x)}finally{e.delete()}}};i(S.SPARK_PACKED_SH1,S.SPARK_EXTENDED_SH1,(e,t)=>r.setSh1(e,t)),i(S.SPARK_PACKED_SH2,S.SPARK_EXTENDED_SH2,(e,t)=>r.setSh2(e,t)),i(S.SPARK_PACKED_SH3,S.SPARK_EXTENDED_SH3_A,(e,t)=>r.setSh3(e,t)),i(S.UNUSED,S.SPARK_EXTENDED_SH3_B,(e,t)=>r.sh3ExtendedData=e)}update(){this.#z=!0,this._update();let e=!1;for(const t of this.#W)t.client.takeRenderRequired()&&(e=!0);return e||this._computeAdditionalRenderNeeded()}applyChanges(e){}_computeAdditionalRenderNeeded(){return!1}onColorSpaceDetected(e){}add(e){this.#W.add(e)}delete(e){this.#W.delete(e),e.miris&&e.close(),0===this.#W.size&&null!==this.#L&&(this.#L.delete(),this.#L=null)}}class T{update(){const{engine:e}=this,{client:t}=this.scene,r=e.malloc(4*this.#b.length);e.heapF32.set(Float32Array.from(this.#b),r/4),t.setMainCameraTransform(r),e.free(r),t.setMainCameraViewFrustum(this.#re,this.#ne,this.#ae,this.#ie)}#re;get aspect(){return this.#re}set aspect(e){this.#re=e}#ne;get fov(){return this.#ne}set fov(e){this.#ne=e}#ae;get near(){return this.#ae}set near(e){this.#ae=e}#ie;get far(){return this.#ie}set far(e){this.#ie=e}#b;get matrix(){return this.#b}set matrix(e){this.#b=e}constructor({aspect:e,fov:t,near:r,far:n,matrix:a,scene:i}){this.#re=e,this.#ne=t,this.#ae=r,this.#ie=n,this.#b=a,Object.defineProperties(this,{scene:{value:i},miris:{value:i.miris},engine:{value:i.miris.engine}})}}class C{#j=null;get viewerKey(){return this.#j}set viewerKey(e){e&&this.setAssetViewerKey(e),this.#j=e}constructor({engine:e,context:t}){Object.defineProperties(this,{engine:{value:e,enumerable:!0},handle:{value:e.createClient(t),enumerable:!0}})}dispose(){this.engine.destroyClient(this.handle)!==w.AquaStatus.Success&&console.error(`Failed to destroy client with handle '${this.handle}'`)}addStreamById(...e){return this.engine.addStreamById(this.handle,...e)}destroyClient(...e){return this.engine.destroyClient(this.handle,...e)}getAssetsAsync(...e){return this.engine.getAssetsAsync(this.handle,...e)}getAttribute(...e){return this.engine.getAttribute(this.handle,...e)}getDefaultCameraId(...e){return this.engine.getDefaultCameraId(this.handle,...e)}getLocalBoundingBox(...e){return this.engine.getLocalBoundingBox(this.handle,...e)}getWorldBoundingBox(...e){return this.engine.getWorldBoundingBox(this.handle,...e)}getLodIndex(...e){return this.engine.getLodIndex(this.handle,...e)}getSceneChanges(...e){return this.engine.getSceneChanges(this.handle,...e)}getSceneChangesCounts(...e){return this.engine.getSceneChangesCounts(this.handle,...e)}getSceneMetadata(...e){return this.engine.getSceneMetadata(this.handle,...e)}getSceneObjectParent(...e){return this.engine.getSceneObjectParent(this.handle,...e)}getSceneObjectType(...e){return this.engine.getSceneObjectType(this.handle,...e)}getLocalTransform(...e){return this.engine.getLocalTransform(this.handle,...e)}getWorldTransform(...e){return this.engine.getWorldTransform(this.handle,...e)}hasAttribute(...e){return this.engine.hasAttribute(this.handle,...e)}isSceneObjectAncestorOf(...e){return this.engine.isSceneObjectAncestorOf(this.handle,...e)}lockScene(...e){return this.engine.lockScene(this.handle,...e)}removeStream(...e){return this.engine.removeStream(this.handle,...e)}setAssetViewerKey(...e){return this.engine.setAssetViewerKey(this.handle,...e)}setClientSpatialFormat(...e){return this.engine.setClientSpatialFormat(this.handle,...e)}setRuntimeSettings(...e){return this.engine.setRuntimeSettings(this.handle,...e)}setMainCameraTransform(...e){return this.engine.setMainCameraTransform(this.handle,...e)}setMainCameraViewFrustum(...e){return this.engine.setMainCameraViewFrustum(this.handle,...e)}setSceneObjectTransform(...e){return this.engine.setSceneObjectTransform(this.handle,...e)}hasFeature(...e){return this.engine.hasFeature(this.handle,...e)}getFeatureVersion(...e){return this.engine.getFeatureVersion(this.handle,...e)}getFeatureState(...e){return this.engine.getFeatureState(this.handle,...e)}getName(...e){return this.engine.getName(this.handle,...e)}setVariantSelection(...e){return this.engine.setVariantSelection(this.handle,...e)}takeAttribute(...e){return this.engine.takeAttribute(this.handle,...e)}takeEvictedClientSideAttributeIds(...e){return this.engine.takeEvictedClientSideAttributeIds(this.handle,...e)}takeRenderRequired(...e){return this.engine.takeRenderRequired(this.handle,...e)}unlockScene(...e){return this.engine.unlockScene(this.handle,...e)}updateSceneExecution(...e){return this.engine.updateSceneExecution(this.handle,...e)}recordFrameTime(...e){return this.engine.recordFrameTime(this.handle,...e)}}class $ extends EventTarget{static#t=/* @__PURE__ */new Map;static#e=/* @__PURE__ */new Map;#se=null;get camera(){return this.#se}set camera(e){this.#se=e}#oe=null;static forId(e){return $.#t.get(e)}static forKey(e){return $.#e.get(e)}#r;get key(){return this.#r??null}set key(e){$.#e.delete(this.key),(e||0===e)&&$.#e.set(e,this),this.#r=e}#ce=/* @__PURE__ */new Set;#ue=/* @__PURE__ */new Map;get viewerKey(){return this.client.viewerKey}set viewerKey(e){e&&(this.client.viewerKey=e)}get streams(){return new Set(this.#ce)}#u=new e;get lods(){return this.#u}constructor({miris:e,viewerKey:t}){super(),Object.defineProperties(this,{miris:{value:e,enumerable:!0},engine:{value:e.engine,enumerable:!0},client:{value:new C({engine:e.engine,context:e.sharedContext})}}),t&&(this.viewerKey=t);const r=new this.engine.SpatialFormat;r.metersPerUnit=1,r.upAxis=this.engine.UpAxis.Y,r.matrixOrder=this.engine.MatrixOrder.ColumnMajor,r.handedness=this.engine.Handedness.Right,this.client.setClientSpatialFormat(r),r.delete(),$.#t.set(this.id,this),e.add(this)}dispose(){this.close(),this.client.dispose()}#le(){const e=this.client.getDefaultCameraId();this.#oe=e>=0?e:null}async fetchAssets(e){if(!this.viewerKey)throw new Error("Could not fetch assets because there is no viewer key");const t=new this.engine.StringVector;let r=[];"string"==typeof e?r=e.split(","):e?.[Symbol.iterator]&&(r=[...e]);for(const s of r)t.push_back(s);const n=await this.client.getAssetsAsync(t),a=[],i=new TextDecoder;for(const{name:s,tags:o,thumbnailUrl:c,uuid:u}of n){const e={name:s,thumbnailUrl:c,uuid:u,tags:[]},t=o.size();for(let r=0;r<t;r+=1){let t=o.get(r);t&&("string"!=typeof t&&(t=i.decode(t)),e.tags.push(t))}a.push(e)}return t.delete(),a}getDefaultCameraTransform(){return null===this.#oe?null:this.miris.getWorldTransform(this.client,this.#oe)}add(e){this.#ce.add(e),this.#ue.set(e.id,e)}getStreamForId(e){return this.#ue.get(e)}getStreamForDescendentId(e){for(const[t,r]of this.#ue)if(this.client.isSceneObjectAncestorOf(t,e))return r;return null}getModelRootForDescendentId(e){for(const[,t]of this.#ue)for(const r of t.modelRoots)if(this.client.isSceneObjectAncestorOf(r.id,e))return r;return null}async _getDrMap(e){if(!this.client.hasFeature(e,w.Feature.DrMap))return null;if(this.client.getFeatureState(e,w.Feature.DrMap)!==w.FeatureState.Loaded)return null;const t=this.client.getFeatureVersion(e,w.Feature.DrMap);if(1===t){const r=`drMap_v${t}`,n=new this.engine.AttributeInfo;try{if(this.client.getAttribute(e,r,n.$$.ptr)!==w.AquaStatus.Success)return null;const t=this.engine.dataPtrView(n),a=new Uint8Array(t.buffer).subarray(t.byteOffset,t.byteOffset+t.byteLength).slice(),i=new Blob([a],{type:"image/png"});return await createImageBitmap(i)}finally{n.delete()}}return console.warn(`getDrMap: unsupported DR map version ${t}`),null}async _onFeatureData(e){const t=await this._getDrMap(e);this.dispatchEvent(new CustomEvent("drmaploaded",{detail:{bitmap:t,sceneObjectId:e}}))}_onSceneLoaded(){this.#le(),this.dispatchEvent(new Event("sceneloaded"))}delete(e){this.#ce.delete(e),this.#ue.delete(e.id),i.forId(e.id)&&e.end()}close(){for(const e of this.streams)e.end();$.#t.delete(this.id),$.#e.delete(this.key),this.miris.scenes.has(this)&&this.miris.delete(this)}}export{T as Camera,t as Lod,e as LodStore,k as Miris,n as ModelRoot,$ as Scene,i as Stream};
|
|
1
|
+
var t,e,r,n=class{static#t=/* @__PURE__ */new Map;static#e=1;static#r=0;static#n=2**32;static#i=0;static#a(t){this.#r=(this.#r+t)%this.#n}static#s(t){this.#r=(this.#r-t)%this.#n,this.#r<0&&(this.#r+=this.#n)}static getCheckSum(){return this.#r}static getConsecutiveIds(t){const e=this.#e;return this.#e+=t,e}static addWithId(t,e){this.#a(e),this.#t.set(e,t)}static add(t){const e=this.#e++;return this.addWithId(t,e),e}static get(t){const e=this.#t.get(t);if(void 0===e)throw new Error(`Attribute with id ${t} not found in cache`);return e}static remove(t){if(Array.isArray(t))for(const e of t)this.#t.delete(e),this.#s(e);else this.#t.delete(t),this.#s(t)}static validateCheckSum(t){if(t!=this.getCheckSum()){let e=t-this.getCheckSum();e<0&&(e+=this.#n),e!=this.#i&&(console.error(`ID checksum mismatch between WASM and TypeScript sides! ${t} ${this.getCheckSum()}`),this.#i=e)}}},i=(r=new URL("AquaApi.wasm",import.meta.url).href).includes("/.vite/")?r.replace(/\.vite\/[^?#]*/,()=>"@miris-inc/core/dist/AquaApi.wasm"):r;var a=function(...r){return t||(e=fetch(i).then(t=>!t.ok||(t.headers.get("content-type")||"").includes("text/html")?null:t.arrayBuffer()).catch(()=>null),t=function(){const t=URL.createObjectURL(new Blob(['async function tc($t={}){var Ye,l=$t,Sr=typeof window=="object",ge=typeof WorkerGlobalScope<"u",Dt=typeof process=="object"&&process.versions?.node&&process.type!="renderer",nc=!Sr&&!Dt&&!ge,Rt=[],kr="./this.program",Er=(e,r)=>{throw r},It=import.meta.url,Je="";function jt(e){return l.locateFile?l.locateFile(e,Je):Je+e}var Qe,Fe;if(Sr||ge){try{Je=new URL(".",It).href}catch{}ge&&(Fe=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Qe=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}var we=console.log.bind(console),ee=console.error.bind(console),be,Pe=!1,Ae;function ic(e,r){e||ce(r)}var ac=e=>e.startsWith("file://"),Cr,Tr,$e,G,L,A,ve,C,m,De,Re,U,Fr,Pr=!1;function Ar(){var e=$e.buffer;l.HEAP8=G=new Int8Array(e),A=new Int16Array(e),l.HEAPU8=L=new Uint8Array(e),ve=new Uint16Array(e),l.HEAP32=C=new Int32Array(e),l.HEAPU32=m=new Uint32Array(e),l.HEAPF32=De=new Float32Array(e),l.HEAPF64=Re=new Float64Array(e),U=new BigInt64Array(e),Fr=new BigUint64Array(e)}function Ot(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)zt(l.preRun.shift());Dr(Ir)}function Mt(){Pr=!0,!l.noFSInit&&!o.initialized&&o.init(),ae.init(),de.__wasm_call_ctors(),o.ignorePermissions=!1}function xt(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)Ht(l.postRun.shift());Dr(Rr)}function ce(e){l.onAbort?.(e),e="Aborted("+e+")",ee(e),Pe=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw Tr?.(r),r}var er;function Gt(){return l.locateFile?jt("AquaApi.wasm"):new URL("AquaApi.wasm",import.meta.url).href}function Nt(e){if(e==er&&be)return new Uint8Array(be);if(Fe)return Fe(e);throw"both async and sync fetching of the wasm failed"}async function Lt(e){if(!be)try{var r=await Qe(e);return new Uint8Array(r)}catch{}return Nt(e)}async function Wt(e,r){try{var t=await Lt(e),n=await WebAssembly.instantiate(t,r);return n}catch(i){ee(`failed to asynchronously prepare wasm: ${i}`),ce(i)}}async function Ut(e,r,t){if(!e)try{var n=fetch(r,{credentials:"same-origin"}),i=await WebAssembly.instantiateStreaming(n,t);return i}catch(a){ee(`wasm streaming compile failed: ${a}`),ee("falling back to ArrayBuffer instantiation")}return Wt(r,t)}function Bt(){return{env:At,wasi_snapshot_preview1:At}}async function Vt(){function e(a,s){return de=a.exports,$e=de.memory,Ar(),Yr=de.__indirect_function_table,Qo(de),de}function r(a){return e(a.instance)}var t=Bt();if(l.instantiateWasm)return new Promise((a,s)=>{l.instantiateWasm(t,(c,u)=>{a(e(c,u))})});er??=Gt();var n=await Ut(be,er,t),i=r(n);return i}class $r{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var Dr=e=>{for(;e.length>0;)e.shift()(l)},Rr=[],Ht=e=>Rr.push(e),Ir=[],zt=e=>Ir.push(e);function oc(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return G[e];case"i8":return G[e];case"i16":return A[e>>1];case"i32":return C[e>>2];case"i64":return U[e>>3];case"float":return De[e>>2];case"double":return Re[e>>3];case"*":return m[e>>2];default:ce(`invalid type for getValue: ${r}`)}}var rr=!0;function sc(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":G[e]=r;break;case"i8":G[e]=r;break;case"i16":A[e>>1]=r;break;case"i32":C[e>>2]=r;break;case"i64":U[e>>3]=BigInt(r);break;case"float":De[e>>2]=r;break;case"double":Re[e>>3]=r;break;case"*":m[e>>2]=r;break;default:ce(`invalid type for setValue: ${t}`)}}var w=e=>St(e),b=()=>Et(),Ie=[],je=0,qt=e=>{var r=new tr(e);return r.get_caught()||(r.set_caught(!0),je--),r.set_rethrown(!1),Ie.push(r),Tt(e),Pt(e)},re=0,Xt=()=>{g(0,0);var e=Ie.pop();Ct(e.excPtr),re=0};class tr{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){m[this.ptr+4>>2]=r}get_type(){return m[this.ptr+4>>2]}set_destructor(r){m[this.ptr+8>>2]=r}get_destructor(){return m[this.ptr+8>>2]}set_caught(r){r=r?1:0,G[this.ptr+12]=r}get_caught(){return G[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,G[this.ptr+13]=r}get_rethrown(){return G[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){m[this.ptr+16>>2]=r}get_adjusted_ptr(){return m[this.ptr+16>>2]}}var Oe=e=>bt(e),nr=e=>{var r=re;if(!r)return Oe(0),0;var t=new tr(r);t.set_adjusted_ptr(r);var n=t.get_type();if(!n)return Oe(0),r;for(var i of e){if(i===0||i===n)break;var a=t.ptr+16;if(Ft(i,n,a))return Oe(i),r}return Oe(n),r},Zt=()=>nr([]),Kt=e=>nr([e]),Yt=(e,r)=>nr([e,r]),Jt=()=>{var e=Ie.pop();e||ce("no exception to throw");var r=e.excPtr;throw e.get_rethrown()||(Ie.push(e),e.set_rethrown(!0),e.set_caught(!1),je++),re=r,re},Qt=(e,r,t)=>{var n=new tr(e);throw n.init(r,t),re=e,je++,re},en=()=>je,rn=e=>{throw re||(re=e),re},Me=()=>{var e=C[+R.varargs>>2];return R.varargs+=4,e},_e=Me,D={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var i=e[n];i==="."?e.splice(n,1):i===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=D.isAbs(e),t=e.slice(-1)==="/";return e=D.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=D.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)=>D.normalize(e.join("/")),join2:(e,r)=>D.normalize(e+"/"+r)},tn=()=>e=>crypto.getRandomValues(e),ir=e=>{(ir=tn())(e)},he={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var i=n>=0?e[n]:o.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";r=i+"/"+r,t=D.isAbs(i)}return r=D.normalizeArray(r.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=he.resolve(e).slice(1),r=he.resolve(r).slice(1);function t(f){for(var d=0;d<f.length&&f[d]==="";d++);for(var _=f.length-1;_>=0&&f[_]==="";_--);return d>_?[]:f.slice(d,_-d+1)}for(var n=t(e.split("/")),i=t(r.split("/")),a=Math.min(n.length,i.length),s=a,c=0;c<a;c++)if(n[c]!==i[c]){s=c;break}for(var u=[],c=s;c<n.length;c++)u.push("..");return u=u.concat(i.slice(s)),u.join("/")}},jr=typeof TextDecoder<"u"?new TextDecoder:void 0,Or=(e,r,t,n)=>{var i=r+t;if(n)return i;for(;e[r]&&!(r>=i);)++r;return r},me=(e,r=0,t,n)=>{var i=Or(e,r,t,n);if(i-r>16&&e.buffer&&jr)return jr.decode(e.subarray(r,i));for(var a="";r<i;){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var c=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|c);continue}var u=e[r++]&63;if((s&240)==224?s=(s&15)<<12|c<<6|u:s=(s&7)<<18|c<<12|u<<6|e[r++]&63,s<65536)a+=String.fromCharCode(s);else{var f=s-65536;a+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return a},ar=[],Y=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},Mr=(e,r,t,n)=>{if(!(n>0))return 0;for(var i=t,a=t+n-1,s=0;s<e.length;++s){var c=e.codePointAt(s);if(c<=127){if(t>=a)break;r[t++]=c}else if(c<=2047){if(t+1>=a)break;r[t++]=192|c>>6,r[t++]=128|c&63}else if(c<=65535){if(t+2>=a)break;r[t++]=224|c>>12,r[t++]=128|c>>6&63,r[t++]=128|c&63}else{if(t+3>=a)break;r[t++]=240|c>>18,r[t++]=128|c>>12&63,r[t++]=128|c>>6&63,r[t++]=128|c&63,s++}}return r[t]=0,t-i},or=(e,r,t)=>{var n=t>0?t:Y(e)+1,i=new Array(n),a=Mr(e,i,0,i.length);return r&&(i.length=a),i},nn=()=>{if(!ar.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`\n`)),!e)return null;ar=or(e,!0)}return ar.shift()},ae={ttys:[],init(){},shutdown(){},register(e,r){ae.ttys[e]={input:[],output:[],ops:r},o.registerDevice(e,ae.stream_ops)},stream_ops:{open(e){var r=ae.ttys[e.node.rdev];if(!r)throw new o.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,i){if(!e.tty||!e.tty.ops.get_char)throw new o.ErrnoError(60);for(var a=0,s=0;s<n;s++){var c;try{c=e.tty.ops.get_char(e.tty)}catch{throw new o.ErrnoError(29)}if(c===void 0&&a===0)throw new o.ErrnoError(6);if(c==null)break;a++,r[t+s]=c}return a&&(e.node.atime=Date.now()),a},write(e,r,t,n,i){if(!e.tty||!e.tty.ops.put_char)throw new o.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch{throw new o.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return nn()},put_char(e,r){r===null||r===10?(we(me(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(we(me(e.output)),e.output=[])},ioctl_tcgets(e){return{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){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(ee(me(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(ee(me(e.output)),e.output=[])}}},xr=e=>{ce()},E={ops_table:null,mount(e){return E.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(o.isBlkdev(t)||o.isFIFO(t))throw new o.ErrnoError(63);E.ops_table||={dir:{node:{getattr:E.node_ops.getattr,setattr:E.node_ops.setattr,lookup:E.node_ops.lookup,mknod:E.node_ops.mknod,rename:E.node_ops.rename,unlink:E.node_ops.unlink,rmdir:E.node_ops.rmdir,readdir:E.node_ops.readdir,symlink:E.node_ops.symlink},stream:{llseek:E.stream_ops.llseek}},file:{node:{getattr:E.node_ops.getattr,setattr:E.node_ops.setattr},stream:{llseek:E.stream_ops.llseek,read:E.stream_ops.read,write:E.stream_ops.write,mmap:E.stream_ops.mmap,msync:E.stream_ops.msync}},link:{node:{getattr:E.node_ops.getattr,setattr:E.node_ops.setattr,readlink:E.node_ops.readlink},stream:{}},chrdev:{node:{getattr:E.node_ops.getattr,setattr:E.node_ops.setattr},stream:o.chrdev_stream_ops}};var i=o.createNode(e,r,t,n);return o.isDir(i.mode)?(i.node_ops=E.ops_table.dir.node,i.stream_ops=E.ops_table.dir.stream,i.contents={}):o.isFile(i.mode)?(i.node_ops=E.ops_table.file.node,i.stream_ops=E.ops_table.file.stream,i.usedBytes=0,i.contents=null):o.isLink(i.mode)?(i.node_ops=E.ops_table.link.node,i.stream_ops=E.ops_table.link.stream):o.isChrdev(i.mode)&&(i.node_ops=E.ops_table.chrdev.node,i.stream_ops=E.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[r]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var i=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=o.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,o.isDir(e.mode)?r.size=4096:o.isFile(e.mode)?r.size=e.usedBytes:o.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"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&E.resizeFileStorage(e,r.size)},lookup(e,r){throw E.doesNotExistError||(E.doesNotExistError=new o.ErrnoError(44),E.doesNotExistError.stack="<generic error, no stack>"),E.doesNotExistError},mknod(e,r,t,n){return E.createNode(e,r,t,n)},rename(e,r,t){var n;try{n=o.lookupNode(r,t)}catch{}if(n){if(o.isDir(e.mode))for(var i in n.contents)throw new o.ErrnoError(55);o.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=o.lookupNode(e,r);for(var n in t.contents)throw new o.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var n=E.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!o.isLink(e.mode))throw new o.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-i,n);if(s>8&&a.subarray)r.set(a.subarray(i,i+s),t);else for(var c=0;c<s;c++)r[t+c]=a[i+c];return s},write(e,r,t,n,i,a){if(r.buffer===G.buffer&&(a=!1),!n)return 0;var s=e.node;if(s.mtime=s.ctime=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(a)return s.contents=r.subarray(t,t+n),s.usedBytes=n,n;if(s.usedBytes===0&&i===0)return s.contents=r.slice(t,t+n),s.usedBytes=n,n;if(i+n<=s.usedBytes)return s.contents.set(r.subarray(t,t+n),i),n}if(E.expandFileStorage(s,i+n),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+n),i);else for(var c=0;c<n;c++)s.contents[i+c]=r[t+c];return s.usedBytes=Math.max(s.usedBytes,i+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&o.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new o.ErrnoError(28);return n},mmap(e,r,t,n,i){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);var a,s,c=e.node.contents;if(!(i&2)&&c&&c.buffer===G.buffer)s=!1,a=c.byteOffset;else{if(s=!0,a=xr(r),!a)throw new o.ErrnoError(48);c&&((t>0||t+r<c.length)&&(c.subarray?c=c.subarray(t,t+r):c=Array.prototype.slice.call(c,t,t+r)),G.set(c,a))}return{ptr:a,allocated:s}},msync(e,r,t,n,i){return E.stream_ops.write(e,r,0,n,t,!1),0}}},an=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},sr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},on=async e=>{var r=await Qe(e);return new Uint8Array(r)},sn=(...e)=>o.createDataFile(...e),cn=e=>e,ue=0,Se=null,Gr=e=>{if(ue--,l.monitorRunDependencies?.(ue),ue==0&&Se){var r=Se;Se=null,r()}},Nr=e=>{ue++,l.monitorRunDependencies?.(ue)},Lr=[],un=async(e,r)=>{typeof Browser<"u"&&Browser.init();for(var t of Lr)if(t.canHandle(r))return t.handle(e,r);return e},Wr=async(e,r,t,n,i,a,s,c)=>{var u=r?he.resolve(D.join2(e,r)):e,f=cn(`cp ${u}`);Nr(f);try{var d=t;typeof t=="string"&&(d=await on(t)),d=await un(d,u),c?.(),a||sn(e,r,d,n,i,s)}finally{Gr(f)}},ln=(e,r,t,n,i,a,s,c,u,f)=>{Wr(e,r,t,n,i,c,u,f).then(a).catch(s)},o={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},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(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}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=o.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 o.isDir(this.mode)}get isDevice(){return o.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)throw new o.ErrnoError(44);r.follow_mount??=!0,D.isAbs(e)||(e=o.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(f=>!!f),i=o.root,a="/",s=0;s<n.length;s++){var c=s===n.length-1;if(c&&r.parent)break;if(n[s]!=="."){if(n[s]===".."){if(a=D.dirname(a),o.isRoot(i)){e=a+"/"+n.slice(s+1).join("/"),t--;continue e}else i=i.parent;continue}a=D.join2(a,n[s]);try{i=o.lookupNode(i,n[s])}catch(f){if(f?.errno===44&&c&&r.noent_okay)return{path:a};throw f}if(o.isMountpoint(i)&&(!c||r.follow_mount)&&(i=i.mounted.root),o.isLink(i.mode)&&(!c||r.follow)){if(!i.node_ops.readlink)throw new o.ErrnoError(52);var u=i.node_ops.readlink(i);D.isAbs(u)||(u=D.dirname(a)+"/"+u),e=u+"/"+n.slice(s+1).join("/");continue e}}}return{path:a,node:i}}throw new o.ErrnoError(32)},getPath(e){for(var r;;){if(o.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)%o.nameTable.length},hashAddNode(e){var r=o.hashName(e.parent.id,e.name);e.name_next=o.nameTable[r],o.nameTable[r]=e},hashRemoveNode(e){var r=o.hashName(e.parent.id,e.name);if(o.nameTable[r]===e)o.nameTable[r]=e.name_next;else for(var t=o.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=o.mayLookup(e);if(t)throw new o.ErrnoError(t);for(var n=o.hashName(e.id,r),i=o.nameTable[n];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===r)return i}return o.lookup(e,r)},createNode(e,r,t,n){var i=new o.FSNode(e,r,t,n);return o.hashAddNode(i),i},destroyNode(e){o.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return o.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!o.isDir(e.mode))return 54;var r=o.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!o.isDir(e.mode))return 54;try{var t=o.lookupNode(e,r);return 20}catch{}return o.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=o.lookupNode(e,r)}catch(a){return a.errno}var i=o.nodePermissions(e,"wx");if(i)return i;if(t){if(!o.isDir(n.mode))return 54;if(o.isRoot(n)||o.getPath(n)===o.cwd())return 10}else if(o.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?o.isLink(e.mode)?32:o.isDir(e.mode)&&(o.flagsToPermissionString(r)!=="r"||r&576)?31:o.nodePermissions(e,o.flagsToPermissionString(r)):44},checkOpExists(e,r){if(!e)throw new o.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=o.MAX_OPEN_FDS;e++)if(!o.streams[e])return e;throw new o.ErrnoError(33)},getStreamChecked(e){var r=o.getStream(e);if(!r)throw new o.ErrnoError(8);return r},getStream:e=>o.streams[e],createStream(e,r=-1){return e=Object.assign(new o.FSStream,e),r==-1&&(r=o.nextfd()),e.fd=r,o.streams[r]=e,e},closeStream(e){o.streams[e]=null},dupStream(e,r=-1){var t=o.createStream(e,r);return t.stream_ops?.dup?.(t),t},doSetAttr(e,r,t){var n=e?.stream_ops.setattr,i=n?e:r;n??=r.node_ops.setattr,o.checkOpExists(n,63),n(i,t)},chrdev_stream_ops:{open(e){var r=o.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new o.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){o.devices[e]={stream_ops:r}},getDevice:e=>o.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){typeof e=="function"&&(r=e,e=!1),o.syncFSRequests++,o.syncFSRequests>1&&ee(`warning: ${o.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=o.getMounts(o.root.mount),n=0;function i(s){return o.syncFSRequests--,r(s)}function a(s){if(s)return a.errored?void 0:(a.errored=!0,i(s));++n>=t.length&&i(null)}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,e,a)})},mount(e,r,t){var n=t==="/",i=!t,a;if(n&&o.root)throw new o.ErrnoError(10);if(!n&&!i){var s=o.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,o.isMountpoint(a))throw new o.ErrnoError(10);if(!o.isDir(a.mode))throw new o.ErrnoError(54)}var c={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(c);return u.mount=c,c.root=u,n?o.root=u:a&&(a.mounted=c,a.mount&&a.mount.mounts.push(c)),u},unmount(e){var r=o.lookupPath(e,{follow_mount:!1});if(!o.isMountpoint(r.node))throw new o.ErrnoError(28);var t=r.node,n=t.mounted,i=o.getMounts(n);Object.keys(o.nameTable).forEach(s=>{for(var c=o.nameTable[s];c;){var u=c.name_next;i.includes(c.mount)&&o.destroyNode(c),c=u}}),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=o.lookupPath(e,{parent:!0}),i=n.node,a=D.basename(e);if(!a)throw new o.ErrnoError(28);if(a==="."||a==="..")throw new o.ErrnoError(20);var s=o.mayCreate(i,a);if(s)throw new o.ErrnoError(s);if(!i.node_ops.mknod)throw new o.ErrnoError(63);return i.node_ops.mknod(i,a,r,t)},statfs(e){return o.statfsNode(o.lookupPath(e,{follow:!0}).node)},statfsStream(e){return o.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:o.nextInode,ffree:o.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){return r&=4095,r|=32768,o.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,o.mknod(e,r,0)},mkdirTree(e,r){var t=e.split("/"),n="";for(var i of t)if(i){(n||D.isAbs(e))&&(n+="/"),n+=i;try{o.mkdir(n,r)}catch(a){if(a.errno!=20)throw a}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,o.mknod(e,r,t)},symlink(e,r){if(!he.resolve(e))throw new o.ErrnoError(44);var t=o.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new o.ErrnoError(44);var i=D.basename(r),a=o.mayCreate(n,i);if(a)throw new o.ErrnoError(a);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,i,e)},rename(e,r){var t=D.dirname(e),n=D.dirname(r),i=D.basename(e),a=D.basename(r),s,c,u;if(s=o.lookupPath(e,{parent:!0}),c=s.node,s=o.lookupPath(r,{parent:!0}),u=s.node,!c||!u)throw new o.ErrnoError(44);if(c.mount!==u.mount)throw new o.ErrnoError(75);var f=o.lookupNode(c,i),d=he.relative(e,n);if(d.charAt(0)!==".")throw new o.ErrnoError(28);if(d=he.relative(r,t),d.charAt(0)!==".")throw new o.ErrnoError(55);var _;try{_=o.lookupNode(u,a)}catch{}if(f!==_){var p=o.isDir(f.mode),v=o.mayDelete(c,i,p);if(v)throw new o.ErrnoError(v);if(v=_?o.mayDelete(u,a,p):o.mayCreate(u,a),v)throw new o.ErrnoError(v);if(!c.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(f)||_&&o.isMountpoint(_))throw new o.ErrnoError(10);if(u!==c&&(v=o.nodePermissions(c,"w"),v))throw new o.ErrnoError(v);o.hashRemoveNode(f);try{c.node_ops.rename(f,u,a),f.parent=u}catch(h){throw h}finally{o.hashAddNode(f)}}},rmdir(e){var r=o.lookupPath(e,{parent:!0}),t=r.node,n=D.basename(e),i=o.lookupNode(t,n),a=o.mayDelete(t,n,!0);if(a)throw new o.ErrnoError(a);if(!t.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.rmdir(t,n),o.destroyNode(i)},readdir(e){var r=o.lookupPath(e,{follow:!0}),t=r.node,n=o.checkOpExists(t.node_ops.readdir,54);return n(t)},unlink(e){var r=o.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new o.ErrnoError(44);var n=D.basename(e),i=o.lookupNode(t,n),a=o.mayDelete(t,n,!1);if(a)throw new o.ErrnoError(a);if(!t.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.unlink(t,n),o.destroyNode(i)},readlink(e){var r=o.lookupPath(e),t=r.node;if(!t)throw new o.ErrnoError(44);if(!t.node_ops.readlink)throw new o.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=o.lookupPath(e,{follow:!r}),n=t.node,i=o.checkOpExists(n.node_ops.getattr,63);return i(n)},fstat(e){var r=o.getStreamChecked(e),t=r.node,n=r.stream_ops.getattr,i=n?r:t;return n??=t.node_ops.getattr,o.checkOpExists(n,63),n(i)},lstat(e){return o.stat(e,!0)},doChmod(e,r,t,n){o.doSetAttr(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),dontFollow:n})},chmod(e,r,t){var n;if(typeof e=="string"){var i=o.lookupPath(e,{follow:!t});n=i.node}else n=e;o.doChmod(null,n,r,t)},lchmod(e,r){o.chmod(e,r,!0)},fchmod(e,r){var t=o.getStreamChecked(e);o.doChmod(t,t.node,r,!1)},doChown(e,r,t){o.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,n){var i;if(typeof e=="string"){var a=o.lookupPath(e,{follow:!n});i=a.node}else i=e;o.doChown(null,i,n)},lchown(e,r,t){o.chown(e,r,t,!0)},fchown(e,r,t){var n=o.getStreamChecked(e);o.doChown(n,n.node,!1)},doTruncate(e,r,t){if(o.isDir(r.mode))throw new o.ErrnoError(31);if(!o.isFile(r.mode))throw new o.ErrnoError(28);var n=o.nodePermissions(r,"w");if(n)throw new o.ErrnoError(n);o.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new o.ErrnoError(28);var t;if(typeof e=="string"){var n=o.lookupPath(e,{follow:!0});t=n.node}else t=e;o.doTruncate(null,t,r)},ftruncate(e,r){var t=o.getStreamChecked(e);if(r<0||(t.flags&2097155)===0)throw new o.ErrnoError(28);o.doTruncate(t,t.node,r)},utime(e,r,t){var n=o.lookupPath(e,{follow:!0}),i=n.node,a=o.checkOpExists(i.node_ops.setattr,63);a(i,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new o.ErrnoError(44);r=typeof r=="string"?an(r):r,r&64?t=t&4095|32768:t=0;var n,i;if(typeof e=="object")n=e;else{i=e.endsWith("/");var a=o.lookupPath(e,{follow:!(r&131072),noent_okay:!0});n=a.node,e=a.path}var s=!1;if(r&64)if(n){if(r&128)throw new o.ErrnoError(20)}else{if(i)throw new o.ErrnoError(31);n=o.mknod(e,t|511,0),s=!0}if(!n)throw new o.ErrnoError(44);if(o.isChrdev(n.mode)&&(r&=-513),r&65536&&!o.isDir(n.mode))throw new o.ErrnoError(54);if(!s){var c=o.mayOpen(n,r);if(c)throw new o.ErrnoError(c)}r&512&&!s&&o.truncate(n,0),r&=-131713;var u=o.createStream({node:n,path:o.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),s&&o.chmod(n,t&511),l.logReadFiles&&!(r&1)&&(e in o.readFiles||(o.readFiles[e]=1)),u},close(e){if(o.isClosed(e))throw new o.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{o.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(o.isClosed(e))throw new o.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new o.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new o.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,i){if(n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===1)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.read)throw new o.ErrnoError(28);var a=typeof i<"u";if(!a)i=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var s=e.stream_ops.read(e,r,t,n,i);return a||(e.position+=s),s},write(e,r,t,n,i,a){if(n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===0)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.write)throw new o.ErrnoError(28);e.seekable&&e.flags&1024&&o.llseek(e,0,2);var s=typeof i<"u";if(!s)i=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var c=e.stream_ops.write(e,r,t,n,i,a);return s||(e.position+=c),c},mmap(e,r,t,n,i){if((n&2)!==0&&(i&2)===0&&(e.flags&2097155)!==2)throw new o.ErrnoError(2);if((e.flags&2097155)===1)throw new o.ErrnoError(2);if(!e.stream_ops.mmap)throw new o.ErrnoError(43);if(!r)throw new o.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,i)},msync(e,r,t,n,i){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,i):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new o.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t=o.open(e,r.flags),n=o.stat(e),i=n.size,a=new Uint8Array(i);return o.read(t,a,0,i,0),r.encoding==="utf8"&&(a=me(a)),o.close(t),a},writeFile(e,r,t={}){t.flags=t.flags||577;var n=o.open(e,t.flags,t.mode);if(typeof r=="string"&&(r=new Uint8Array(or(r,!0))),ArrayBuffer.isView(r))o.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");o.close(n)},cwd:()=>o.currentPath,chdir(e){var r=o.lookupPath(e,{follow:!0});if(r.node===null)throw new o.ErrnoError(44);if(!o.isDir(r.node.mode))throw new o.ErrnoError(54);var t=o.nodePermissions(r.node,"x");if(t)throw new o.ErrnoError(t);o.currentPath=r.path},createDefaultDirectories(){o.mkdir("/tmp"),o.mkdir("/home"),o.mkdir("/home/web_user")},createDefaultDevices(){o.mkdir("/dev"),o.registerDevice(o.makedev(1,3),{read:()=>0,write:(n,i,a,s,c)=>s,llseek:()=>0}),o.mkdev("/dev/null",o.makedev(1,3)),ae.register(o.makedev(5,0),ae.default_tty_ops),ae.register(o.makedev(6,0),ae.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(ir(e),r=e.byteLength),e[--r]);o.createDevice("/dev","random",t),o.createDevice("/dev","urandom",t),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp")},createSpecialDirectories(){o.mkdir("/proc");var e=o.mkdir("/proc/self");o.mkdir("/proc/self/fd"),o.mount({mount(){var r=o.createNode(e,"fd",16895,73);return r.stream_ops={llseek:E.stream_ops.llseek},r.node_ops={lookup(t,n){var i=+n,a=o.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path},id:i+1};return s.parent=s,s},readdir(){return Array.from(o.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?o.createDevice("/dev","stdin",e):o.symlink("/dev/tty","/dev/stdin"),r?o.createDevice("/dev","stdout",null,r):o.symlink("/dev/tty","/dev/stdout"),t?o.createDevice("/dev","stderr",null,t):o.symlink("/dev/tty1","/dev/stderr");var n=o.open("/dev/stdin",0),i=o.open("/dev/stdout",1),a=o.open("/dev/stderr",1)},staticInit(){o.nameTable=new Array(4096),o.mount(E,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories(),o.filesystems={MEMFS:E}},init(e,r,t){o.initialized=!0,e??=l.stdin,r??=l.stdout,t??=l.stderr,o.createStandardStreams(e,r,t)},quit(){o.initialized=!1;for(var e of o.streams)e&&o.close(e)},findObject(e,r){var t=o.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=o.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=o.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=D.basename(e),t=o.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(i){n.error=i.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:o.getPath(e);for(var i=r.split("/").reverse();i.length;){var a=i.pop();if(a){var s=D.join2(e,a);try{o.mkdir(s)}catch(c){if(c.errno!=20)throw c}e=s}}return s},createFile(e,r,t,n,i){var a=D.join2(typeof e=="string"?e:o.getPath(e),r),s=sr(n,i);return o.create(a,s)},createDataFile(e,r,t,n,i,a){var s=r;e&&(e=typeof e=="string"?e:o.getPath(e),s=r?D.join2(e,r):e);var c=sr(n,i),u=o.create(s,c);if(t){if(typeof t=="string"){for(var f=new Array(t.length),d=0,_=t.length;d<_;++d)f[d]=t.charCodeAt(d);t=f}o.chmod(u,c|146);var p=o.open(u,577);o.write(p,t,0,t.length,0,a),o.close(p),o.chmod(u,c)}},createDevice(e,r,t,n){var i=D.join2(typeof e=="string"?e:o.getPath(e),r),a=sr(!!t,!!n);o.createDevice.major??=64;var s=o.makedev(o.createDevice.major++,0);return o.registerDevice(s,{open(c){c.seekable=!1},close(c){n?.buffer?.length&&n(10)},read(c,u,f,d,_){for(var p=0,v=0;v<d;v++){var h;try{h=t()}catch{throw new o.ErrnoError(29)}if(h===void 0&&p===0)throw new o.ErrnoError(6);if(h==null)break;p++,u[f+v]=h}return p&&(c.node.atime=Date.now()),p},write(c,u,f,d,_){for(var p=0;p<d;p++)try{n(u[f+p])}catch{throw new o.ErrnoError(29)}return d&&(c.node.mtime=c.node.ctime=Date.now()),p}}),o.mkdev(i,a,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("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.");try{e.contents=Fe(e.url)}catch{throw new o.ErrnoError(29)}},createLazyFile(e,r,t,n,i){class a{lengthKnown=!1;chunks=[];get(v){if(!(v>this.length-1||v<0)){var h=v%this.chunkSize,k=v/this.chunkSize|0;return this.getter(k)[h]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn\'t load "+t+". Status: "+v.status);var h=Number(v.getResponseHeader("Content-length")),k,$=(k=v.getResponseHeader("Accept-Ranges"))&&k==="bytes",T=(k=v.getResponseHeader("Content-Encoding"))&&k==="gzip",x=1024*1024;$||(x=h);var P=(H,S)=>{if(H>S)throw new Error("invalid range ("+H+", "+S+") or no bytes requested!");if(S>h-1)throw new Error("only "+h+" bytes available! programmer error!");var I=new XMLHttpRequest;if(I.open("GET",t,!1),h!==x&&I.setRequestHeader("Range","bytes="+H+"-"+S),I.responseType="arraybuffer",I.overrideMimeType&&I.overrideMimeType("text/plain; charset=x-user-defined"),I.send(null),!(I.status>=200&&I.status<300||I.status===304))throw new Error("Couldn\'t load "+t+". Status: "+I.status);return I.response!==void 0?new Uint8Array(I.response||[]):or(I.responseText||"",!0)},K=this;K.setDataGetter(H=>{var S=H*x,I=(H+1)*x-1;if(I=Math.min(I,h-1),typeof K.chunks[H]>"u"&&(K.chunks[H]=P(S,I)),typeof K.chunks[H]>"u")throw new Error("doXHR failed!");return K.chunks[H]}),(T||!h)&&(x=h=1,h=this.getter(0).length,x=h,we("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=h,this._chunkSize=x,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!ge)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a,c={isDevice:!1,contents:s}}else var c={isDevice:!1,url:t};var u=o.createFile(e,r,c,n,i);c.contents?u.contents=c.contents:c.url&&(u.contents=null,u.url=c.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var f={},d=Object.keys(u.stream_ops);d.forEach(p=>{var v=u.stream_ops[p];f[p]=(...h)=>(o.forceLoadFile(u),v(...h))});function _(p,v,h,k,$){var T=p.node.contents;if($>=T.length)return 0;var x=Math.min(T.length-$,k);if(T.slice)for(var P=0;P<x;P++)v[h+P]=T[$+P];else for(var P=0;P<x;P++)v[h+P]=T.get($+P);return x}return f.read=(p,v,h,k,$)=>(o.forceLoadFile(u),_(p,v,h,k,$)),f.mmap=(p,v,h,k,$)=>{o.forceLoadFile(u);var T=xr(v);if(!T)throw new o.ErrnoError(48);return _(p,G,T,v,h),{ptr:T,allocated:!0}},u.stream_ops=f,u}},j=(e,r,t)=>e?me(L,e,r,t):"",R={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(D.isAbs(r))return r;var n;if(e===-100)n=o.cwd();else{var i=R.getStreamFromFD(e);n=i.path}if(r.length==0){if(!t)throw new o.ErrnoError(44);return n}return n+"/"+r},writeStat(e,r){m[e>>2]=r.dev,m[e+4>>2]=r.mode,m[e+8>>2]=r.nlink,m[e+12>>2]=r.uid,m[e+16>>2]=r.gid,m[e+20>>2]=r.rdev,U[e+24>>3]=BigInt(r.size),C[e+32>>2]=4096,C[e+36>>2]=r.blocks;var t=r.atime.getTime(),n=r.mtime.getTime(),i=r.ctime.getTime();return U[e+40>>3]=BigInt(Math.floor(t/1e3)),m[e+48>>2]=t%1e3*1e3*1e3,U[e+56>>3]=BigInt(Math.floor(n/1e3)),m[e+64>>2]=n%1e3*1e3*1e3,U[e+72>>3]=BigInt(Math.floor(i/1e3)),m[e+80>>2]=i%1e3*1e3*1e3,U[e+88>>3]=BigInt(r.ino),0},writeStatFs(e,r){m[e+4>>2]=r.bsize,m[e+60>>2]=r.bsize,U[e+8>>3]=BigInt(r.blocks),U[e+16>>3]=BigInt(r.bfree),U[e+24>>3]=BigInt(r.bavail),U[e+32>>3]=BigInt(r.files),U[e+40>>3]=BigInt(r.ffree),m[e+48>>2]=r.fsid,m[e+64>>2]=r.flags,m[e+56>>2]=r.namelen},doMsync(e,r,t,n,i){if(!o.isFile(r.node.mode))throw new o.ErrnoError(43);if(n&2)return 0;var a=L.slice(e,e+t);o.msync(r,a,i,t,n)},getStreamFromFD(e){var r=o.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=j(e);return r}};function fn(e,r,t){R.varargs=t;try{var n=R.getStreamFromFD(e);switch(r){case 0:{var i=Me();if(i<0)return-28;for(;o.streams[i];)i++;var a;return a=o.dupStream(n,i),a.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var i=Me();return n.flags|=i,0}case 12:{var i=_e(),s=0;return A[i+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(c){if(typeof o>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function dn(e,r){try{return R.writeStat(r,o.fstat(e))}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function vn(e,r,t){R.varargs=t;try{var n=R.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var i=n.tty.ops.ioctl_tcgets(n),a=_e();C[a>>2]=i.c_iflag||0,C[a+4>>2]=i.c_oflag||0,C[a+8>>2]=i.c_cflag||0,C[a+12>>2]=i.c_lflag||0;for(var s=0;s<32;s++)G[a+s+17]=i.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var a=_e(),c=C[a>>2],u=C[a+4>>2],f=C[a+8>>2],d=C[a+12>>2],_=[],s=0;s<32;s++)_.push(G[a+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:c,c_oflag:u,c_cflag:f,c_lflag:d,c_cc:_})}return 0}case 21519:{if(!n.tty)return-59;var a=_e();return C[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21537:case 21531:{var a=_e();return o.ioctl(n,r,a)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var p=n.tty.ops.ioctl_tiocgwinsz(n.tty),a=_e();A[a>>1]=p[0],A[a+2>>1]=p[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(v){if(typeof o>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function _n(e,r){try{return e=R.getStr(e),R.writeStat(r,o.lstat(e))}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function hn(e,r,t,n){try{r=R.getStr(r);var i=n&256,a=n&4096;return n=n&-6401,r=R.calculateAt(e,r,a),R.writeStat(t,i?o.lstat(r):o.stat(r))}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function mn(e,r,t,n){R.varargs=n;try{r=R.getStr(r),r=R.calculateAt(e,r);var i=n?Me():0;return o.open(r,t,i).fd}catch(a){if(typeof o>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function pn(e){try{return e=R.getStr(e),o.rmdir(e),0}catch(r){if(typeof o>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function yn(e,r){try{return e=R.getStr(e),R.writeStat(r,o.stat(e))}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function gn(e,r,t){try{if(r=R.getStr(r),r=R.calculateAt(e,r),!t)o.unlink(r);else if(t===512)o.rmdir(r);else return-28;return 0}catch(n){if(typeof o>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var wn=()=>ce(""),V=e=>{for(var r="";;){var t=L[e++];if(!t)return r;r+=String.fromCharCode(t)}},pe={},le={},xe={},ke=class extends Error{constructor(r){super(r),this.name="BindingError"}},F=e=>{throw new ke(e)};function bn(e,r,t={}){var n=r.name;if(e||F(`type "${n}" must have a positive integer typeid pointer`),le.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;F(`Cannot register type \'${n}\' twice`)}if(le[e]=r,delete xe[e],pe.hasOwnProperty(e)){var i=pe[e];delete pe[e],i.forEach(a=>a())}}function q(e,r,t={}){return bn(e,r,t)}var Ur=(e,r,t)=>{switch(r){case 1:return t?n=>G[n]:n=>L[n];case 2:return t?n=>A[n>>1]:n=>ve[n>>1];case 4:return t?n=>C[n>>2]:n=>m[n>>2];case 8:return t?n=>U[n>>3]:n=>Fr[n>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Sn=(e,r,t,n,i)=>{r=V(r);const a=n===0n;let s=c=>c;if(a){const c=t*8;s=u=>BigInt.asUintN(c,u),i=s(i)}q(e,{name:r,fromWireType:s,toWireType:(c,u)=>(typeof u=="number"&&(u=BigInt(u)),u),readValueFromPointer:Ur(r,t,!a),destructorFunction:null})},kn=(e,r,t,n)=>{r=V(r),q(e,{name:r,fromWireType:function(i){return!!i},toWireType:function(i,a){return a?t:n},readValueFromPointer:function(i){return this.fromWireType(L[i])},destructorFunction:null})},En=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),cr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}F(r(e)+" instance already deleted")},ur=!1,Br=e=>{},Cn=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Vr=e=>{e.count.value-=1;var r=e.count.value===0;r&&Cn(e)},Ee=e=>typeof FinalizationRegistry>"u"?(Ee=r=>r,e):(ur=new FinalizationRegistry(r=>{Vr(r.$$)}),Ee=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var i={$$:t};ur.register(r,i,r)}return r},Br=r=>ur.unregister(r),Ee(e)),Ge=[],Tn=()=>{for(;Ge.length;){var e=Ge.pop();e.$$.deleteScheduled=!1,e.delete()}},Hr,Fn=()=>{let e=Ne.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof Ne)||!(t instanceof Ne))return!1;var n=this.$$.ptrType.registeredClass,i=this.$$.ptr;t.$$=t.$$;for(var a=t.$$.ptrType.registeredClass,s=t.$$.ptr;n.baseClass;)i=n.upcast(i),n=n.baseClass;for(;a.baseClass;)s=a.upcast(s),a=a.baseClass;return n===a&&i===s},clone(){if(this.$$.ptr||cr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=Ee(Object.create(Object.getPrototypeOf(this),{$$:{value:En(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||cr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&F("Object already scheduled for deletion"),Br(this),Vr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||cr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&F("Object already scheduled for deletion"),Ge.push(this),Ge.length===1&&Hr&&Hr(Tn),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)};function Ne(){}var Le=(e,r)=>Object.defineProperty(r,"name",{value:e}),zr={},qr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...i){return e[r].overloadTable.hasOwnProperty(i.length)||F(`Function \'${t}\' called with an invalid number of arguments (${i.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[i.length].apply(this,i)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},lr=(e,r,t)=>{l.hasOwnProperty(e)?((t===void 0||l[e].overloadTable!==void 0&&l[e].overloadTable[t]!==void 0)&&F(`Cannot register public name \'${e}\' twice`),qr(l,e,e),l[e].overloadTable.hasOwnProperty(t)&&F(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),l[e].overloadTable[t]=r):(l[e]=r,l[e].argCount=t)},Pn=48,An=57,$n=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Pn&&r<=An?`_${e}`:e};function Dn(e,r,t,n,i,a,s,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=s,this.downcast=c,this.pureVirtualFunctions=[]}var We=(e,r,t)=>{for(;r!==t;)r.upcast||F(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e},fr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e};function Rn(e,r){if(r===null)return this.isReference&&F(`null is not a valid ${this.name}`),0;r.$$||F(`Cannot pass "${fr(r)}" as a ${this.name}`),r.$$.ptr||F(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=We(r.$$.ptr,t,this.registeredClass);return n}function In(e,r){var t;if(r===null)return this.isReference&&F(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&F(`Cannot pass "${fr(r)}" as a ${this.name}`),r.$$.ptr||F(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&F(`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=We(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&F("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:F(`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 i=r.clone();t=this.rawShare(t,W.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:F("Unsupporting sharing policy")}return t}function jn(e,r){if(r===null)return this.isReference&&F(`null is not a valid ${this.name}`),0;r.$$||F(`Cannot pass "${fr(r)}" as a ${this.name}`),r.$$.ptr||F(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&F(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=We(r.$$.ptr,t,this.registeredClass);return n}function Ue(e){return this.fromWireType(m[e>>2])}var Xr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=Xr(e,r,t.baseClass);return n===null?null:t.downcast(n)},On={},Mn=(e,r)=>{for(r===void 0&&F("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},xn=(e,r)=>(r=Mn(e,r),On[r]),Gn=class extends Error{constructor(r){super(r),this.name="InternalError"}},Be=e=>{throw new Gn(e)},Ve=(e,r)=>{(!r.ptrType||!r.ptr)&&Be("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Be("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Ee(Object.create(e,{$$:{value:r,writable:!0}}))};function Nn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=xn(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?Ve(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Ve(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=this.registeredClass.getActualType(r),s=zr[a];if(!s)return i.call(this);var c;this.isConst?c=s.constPointerType:c=s.pointerType;var u=Xr(r,this.registeredClass,c.registeredClass);return u===null?i.call(this):this.isSmartPointer?Ve(c.registeredClass.instancePrototype,{ptrType:c,ptr:u,smartPtrType:this,smartPtr:e}):Ve(c.registeredClass.instancePrototype,{ptrType:c,ptr:u})}var Ln=()=>{Object.assign(He.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:Ue,fromWireType:Nn})};function He(e,r,t,n,i,a,s,c,u,f,d){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=s,this.rawGetPointee=c,this.rawConstructor=u,this.rawShare=f,this.rawDestructor=d,!i&&r.baseClass===void 0?n?(this.toWireType=Rn,this.destructorFunction=null):(this.toWireType=jn,this.destructorFunction=null):this.toWireType=In}var Zr=(e,r,t)=>{l.hasOwnProperty(e)||Be("Replacing nonexistent public symbol"),l[e].overloadTable!==void 0&&t!==void 0?l[e].overloadTable[t]=r:(l[e]=r,l[e].argCount=t)},Kr=[],Yr,y=e=>{var r=Kr[e];return r||(Kr[e]=r=Yr.get(e)),r},te=(e,r,t=!1)=>{e=V(e);function n(){var a=y(r);return a}var i=n();return typeof i!="function"&&F(`unknown function pointer with signature ${e}: ${r}`),i};class Wn extends Error{}var Jr=e=>{var r=gt(e),t=V(r);return J(r),t},ye=(e,r)=>{var t=[],n={};function i(a){if(!n[a]&&!le[a]){if(xe[a]){xe[a].forEach(i);return}t.push(a),n[a]=!0}}throw r.forEach(i),new Wn(`${e}: `+t.map(Jr).join([", "]))},oe=(e,r,t)=>{e.forEach(c=>xe[c]=r);function n(c){var u=t(c);u.length!==e.length&&Be("Mismatched type converter count");for(var f=0;f<e.length;++f)q(e[f],u[f])}var i=new Array(r.length),a=[],s=0;r.forEach((c,u)=>{le.hasOwnProperty(c)?i[u]=le[c]:(a.push(c),pe.hasOwnProperty(c)||(pe[c]=[]),pe[c].push(()=>{i[u]=le[c],++s,s===a.length&&n(i)}))}),a.length===0&&n(i)},Un=(e,r,t,n,i,a,s,c,u,f,d,_,p)=>{d=V(d),a=te(i,a),c&&=te(s,c),f&&=te(u,f),p=te(_,p);var v=$n(d);lr(v,function(){ye(`Cannot construct ${d} due to unbound types`,[n])}),oe([e,r,t],n?[n]:[],h=>{h=h[0];var k,$;n?(k=h.registeredClass,$=k.instancePrototype):$=Ne.prototype;var T=Le(d,function(...I){if(Object.getPrototypeOf(this)!==x)throw new ke(`Use \'new\' to construct ${d}`);if(P.constructor_body===void 0)throw new ke(`${d} has no accessible constructor`);var se=P.constructor_body[I.length];if(se===void 0)throw new ke(`Tried to invoke ctor of ${d} with invalid number of parameters (${I.length}) - expected (${Object.keys(P.constructor_body).toString()}) parameters instead!`);return se.apply(this,I)}),x=Object.create($,{constructor:{value:T}});T.prototype=x;var P=new Dn(d,T,x,p,k,a,c,f);P.baseClass&&(P.baseClass.__derivedClasses??=[],P.baseClass.__derivedClasses.push(P));var K=new He(d,P,!0,!1,!1),H=new He(d+"*",P,!1,!1,!1),S=new He(d+" const*",P,!1,!0,!1);return zr[e]={pointerType:H,constPointerType:S},Zr(v,T),[K,H,S]})},dr=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(m[r+n*4>>2]);return t},vr=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function Qr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function Bn(e,r,t,n){var i=Qr(e),a=e.length-2,s=[],c=["fn"];r&&c.push("thisWired");for(var u=0;u<a;++u)s.push(`arg${u}`),c.push(`arg${u}Wired`);s=s.join(","),c=c.join(",");var f=`return function (${s}) {\n`;i&&(f+=`var destructors = [];\n`);var d=i?"destructors":"null",_=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];r&&(f+=`var thisWired = toClassParamWire(${d}, this);\n`);for(var u=0;u<a;++u){var p=`toArg${u}Wire`;f+=`var arg${u}Wired = ${p}(${d}, arg${u});\n`,_.push(p)}f+=(t||n?"var rv = ":"")+`invoker(${c});\n`;var v=t?"rv":"";if(i)f+=`runDestructors(destructors);\n`;else for(var u=r?1:2;u<e.length;++u){var h=u===1?"thisWired":"arg"+(u-2)+"Wired";e[u].destructorFunction!==null&&(f+=`${h}_dtor(${h});\n`,_.push(`${h}_dtor`))}return t&&(f+=`var ret = fromRetWire(rv);\nreturn ret;\n`),f+=`}\n`,new Function(_,f)}function _r(e,r,t,n,i,a){var s=r.length;s<2&&F("argTypes array size mismatch! Must at least get return value and \'this\' types!");for(var c=r[1]!==null&&t!==null,u=Qr(r),f=!r[0].isVoid,d=s-2,_=r[0],p=r[1],v=[e,F,n,i,vr,_.fromWireType.bind(_),p?.toWireType.bind(p)],h=2;h<s;++h){var k=r[h];v.push(k.toWireType.bind(k))}if(!u)for(var h=c?1:2;h<r.length;++h)r[h].destructorFunction!==null&&v.push(r[h].destructorFunction);var T=Bn(r,c,f,a)(...v);return Le(e,T)}var Vn=(e,r,t,n,i,a)=>{var s=dr(r,t);i=te(n,i);var c=[a],u=[];oe([],[e],f=>{f=f[0];var d=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[r-1]!==void 0)throw new ke(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class \'${f.name}\'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[r-1]=()=>{ye(`Cannot construct ${f.name} due to unbound types`,s)},oe([],s,_=>(_.splice(1,0,null),f.registeredClass.constructor_body[r-1]=_r(d,_,null,i,a),[])),[]})},et=e=>{e=e.trim();const r=e.indexOf("(");return r===-1?e:e.slice(0,r)},Hn=(e,r,t,n,i,a,s,c,u,f)=>{var d=dr(t,n);r=V(r),r=et(r),a=te(i,a,u),oe([],[e],_=>{_=_[0];var p=`${_.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),c&&_.registeredClass.pureVirtualFunctions.push(r);function v(){ye(`Cannot call ${p} due to unbound types`,d)}var h=_.registeredClass.instancePrototype,k=h[r];return k===void 0||k.overloadTable===void 0&&k.className!==_.name&&k.argCount===t-2?(v.argCount=t-2,v.className=_.name,h[r]=v):(qr(h,r,p),h[r].overloadTable[t-2]=v),oe([],d,$=>{var T=_r(p,$,_,a,s,u);return h[r].overloadTable===void 0?(T.argCount=t-2,h[r]=T):h[r].overloadTable[t-2]=T,[]}),[]})},rt=(e,r,t)=>(e instanceof Object||F(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||F(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||F(`cannot call emscripten binding method ${t} on deleted object`),We(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),zn=(e,r,t,n,i,a,s,c,u,f)=>{r=V(r),i=te(n,i),oe([],[e],d=>{d=d[0];var _=`${d.name}.${r}`,p={get(){ye(`Cannot access ${_} due to unbound types`,[t,s])},enumerable:!0,configurable:!0};return u?p.set=()=>ye(`Cannot access ${_} due to unbound types`,[t,s]):p.set=v=>F(_+" is a read-only property"),Object.defineProperty(d.registeredClass.instancePrototype,r,p),oe([],u?[t,s]:[t],v=>{var h=v[0],k={get(){var T=rt(this,d,_+" getter");return h.fromWireType(i(a,T))},enumerable:!0};if(u){u=te(c,u);var $=v[1];k.set=function(T){var x=rt(this,d,_+" setter"),P=[];u(f,x,$.toWireType(P,T)),vr(P)}}return Object.defineProperty(d.registeredClass.instancePrototype,r,k),[]}),[]})},tt=[],fe=[0,1,,1,null,1,!0,1,!1,1],hr=e=>{e>9&&--fe[e+1]===0&&(fe[e]=void 0,tt.push(e))},W={toValue:e=>(e||F(`Cannot use deleted val. handle = ${e}`),fe[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=tt.pop()||fe.length;return fe[r]=e,fe[r+1]=1,r}}}},nt={name:"emscripten::val",fromWireType:e=>{var r=W.toValue(e);return hr(e),r},toWireType:(e,r)=>W.toHandle(r),readValueFromPointer:Ue,destructorFunction:null},qn=e=>q(e,nt),Xn=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType(G[n])}:function(n){return this.fromWireType(L[n])};case 2:return t?function(n){return this.fromWireType(A[n>>1])}:function(n){return this.fromWireType(ve[n>>1])};case 4:return t?function(n){return this.fromWireType(C[n>>2])}:function(n){return this.fromWireType(m[n>>2])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Zn=(e,r,t,n)=>{r=V(r);function i(){}i.values={},q(e,{name:r,constructor:i,fromWireType:function(a){return this.constructor.values[a]},toWireType:(a,s)=>s.value,readValueFromPointer:Xn(r,t,n),destructorFunction:null}),lr(r,i)},it=(e,r)=>{var t=le[e];return t===void 0&&F(`${r} has unknown type ${Jr(e)}`),t},Kn=(e,r,t)=>{var n=it(e,"enum");r=V(r);var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Le(`${n.name}_${r}`,function(){})}});i.values[t]=a,i[r]=a},Yn=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(De[t>>2])};case 8:return function(t){return this.fromWireType(Re[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Jn=(e,r,t)=>{r=V(r),q(e,{name:r,fromWireType:n=>n,toWireType:(n,i)=>i,readValueFromPointer:Yn(r,t),destructorFunction:null})},Qn=(e,r,t,n,i,a,s,c)=>{var u=dr(r,t);e=V(e),e=et(e),i=te(n,i,s),lr(e,function(){ye(`Cannot call ${e} due to unbound types`,u)},r-1),oe([],u,f=>{var d=[f[0],null].concat(f.slice(1));return Zr(e,_r(e,d,null,i,a,s),r-1),[]})},ei=(e,r,t,n,i)=>{r=V(r);const a=n===0;let s=u=>u;if(a){var c=32-8*t;s=u=>u<<c>>>c,i=s(i)}q(e,{name:r,fromWireType:s,toWireType:(u,f)=>f,readValueFromPointer:Ur(r,t,n!==0),destructorFunction:null})},ri=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],i=n[r];function a(s){var c=m[s>>2],u=m[s+4>>2];return new i(G.buffer,u,c)}t=V(t),q(e,{name:t,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},ti=Object.assign({optional:!0},nt),ni=(e,r)=>{q(e,ti)},M=(e,r,t)=>Mr(e,L,r,t),ii=(e,r)=>{r=V(r);var t=!0;q(e,{name:r,fromWireType(n){var i=m[n>>2],a=n+4,s;if(t)s=j(a,i,!0);else{s="";for(var c=0;c<i;++c)s+=String.fromCharCode(L[a+c])}return J(n),s},toWireType(n,i){i instanceof ArrayBuffer&&(i=new Uint8Array(i));var a,s=typeof i=="string";s||ArrayBuffer.isView(i)&&i.BYTES_PER_ELEMENT==1||F("Cannot pass non-string to std::string"),t&&s?a=Y(i):a=i.length;var c=Z(4+a+1),u=c+4;if(m[c>>2]=a,s)if(t)M(i,u,a+1);else for(var f=0;f<a;++f){var d=i.charCodeAt(f);d>255&&(J(c),F("String has UTF-16 code units that do not fit in 8 bits")),L[u+f]=d}else L.set(i,u);return n!==null&&n.push(J,c),c},readValueFromPointer:Ue,destructorFunction(n){J(n)}})},at=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,ai=(e,r,t)=>{var n=e>>1,i=Or(ve,n,r/2,t);if(i-n>16&&at)return at.decode(ve.subarray(n,i));for(var a="",s=n;s<i;++s){var c=ve[s];a+=String.fromCharCode(c)}return a},oi=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;for(var n=r,i=t<e.length*2?t/2:e.length,a=0;a<i;++a){var s=e.charCodeAt(a);A[r>>1]=s,r+=2}return A[r>>1]=0,r-n},si=e=>e.length*2,ci=(e,r,t)=>{for(var n="",i=e>>2,a=0;!(a>=r/4);a++){var s=m[i+a];if(!s&&!t)break;n+=String.fromCodePoint(s)}return n},ui=(e,r,t)=>{if(t??=2147483647,t<4)return 0;for(var n=r,i=n+t-4,a=0;a<e.length;++a){var s=e.codePointAt(a);if(s>65535&&a++,C[r>>2]=s,r+=4,r+4>i)break}return C[r>>2]=0,r-n},li=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.codePointAt(t);n>65535&&t++,r+=4}return r},fi=(e,r,t)=>{t=V(t);var n,i,a;r===2?(n=ai,i=oi,a=si):(n=ci,i=ui,a=li),q(e,{name:t,fromWireType:s=>{var c=m[s>>2],u=n(s+4,c*r,!0);return J(s),u},toWireType:(s,c)=>{typeof c!="string"&&F(`Cannot pass non-string to C++ string type ${t}`);var u=a(c),f=Z(4+u+r);return m[f>>2]=u/r,i(c,f+4,u+r),s!==null&&s.push(J,f),f},readValueFromPointer:Ue,destructorFunction(s){J(s)}})},di=(e,r)=>{r=V(r),q(e,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(t,n)=>{}})},ot=0,vi=()=>{rr=!1,ot=0},mr=[],_i=e=>{var r=mr.length;return mr.push(e),r},hi=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=it(m[r+n*4>>2],`parameter ${n}`);return t},mi=(e,r,t)=>{var n=[],i=e(n,t);return n.length&&(m[r>>2]=W.toHandle(n)),i},pi={},pr=e=>{var r=pi[e];return r===void 0?V(e):r},yi=(e,r,t)=>{var n=8,[i,...a]=hi(e,r),s=i.toWireType.bind(i),c=a.map(v=>v.readValueFromPointer.bind(v));e--;var u={toValue:W.toValue},f=c.map((v,h)=>{var k=`argFromPtr${h}`;return u[k]=v,`${k}(args${h?"+"+h*n:""})`}),d;switch(t){case 0:d="toValue(handle)";break;case 2:d="new (toValue(handle))";break;case 3:d="";break;case 1:u.getStringOrSymbol=pr,d="toValue(handle)[getStringOrSymbol(methodName)]";break}d+=`(${f})`,i.isVoid||(u.toReturnWire=s,u.emval_returnValue=mi,d=`return emval_returnValue(toReturnWire, destructorsRef, ${d})`),d=`return function (handle, methodName, destructorsRef, args) {\n ${d}\n }`;var _=new Function(Object.keys(u),d)(...Object.values(u)),p=`methodCaller<(${a.map(v=>v.name)}) => ${i.name}>`;return _i(Le(p,_))},st=()=>globalThis,gi=e=>e===0?W.toHandle(st()):(e=pr(e),W.toHandle(st()[e])),wi=(e,r)=>(e=W.toValue(e),r=W.toValue(r),W.toHandle(e[r])),bi=e=>{e>9&&(fe[e+1]+=1)},Si=(e,r,t,n,i)=>mr[e](r,t,n,i),ki=()=>W.toHandle([]),Ei=e=>W.toHandle(pr(e)),Ci=e=>{var r=W.toValue(e);vr(r),hr(e)},Ti=(e,r,t)=>{e=W.toValue(e),r=W.toValue(r),t=W.toValue(t),e[r]=t},Fi=9007199254740992,Pi=-9007199254740992,ze=e=>e<Pi||e>Fi?NaN:Number(e);function Ai(e,r){e=ze(e);var t=new Date(e*1e3);C[r>>2]=t.getUTCSeconds(),C[r+4>>2]=t.getUTCMinutes(),C[r+8>>2]=t.getUTCHours(),C[r+12>>2]=t.getUTCDate(),C[r+16>>2]=t.getUTCMonth(),C[r+20>>2]=t.getUTCFullYear()-1900,C[r+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),i=(t.getTime()-n)/(1e3*60*60*24)|0;C[r+28>>2]=i}var $i=e=>e%4===0&&(e%100!==0||e%400===0),Di=[0,31,60,91,121,152,182,213,244,274,305,335],Ri=[0,31,59,90,120,151,181,212,243,273,304,334],Ii=e=>{var r=$i(e.getFullYear()),t=r?Di:Ri,n=t[e.getMonth()]+e.getDate()-1;return n};function ji(e,r){e=ze(e);var t=new Date(e*1e3);C[r>>2]=t.getSeconds(),C[r+4>>2]=t.getMinutes(),C[r+8>>2]=t.getHours(),C[r+12>>2]=t.getDate(),C[r+16>>2]=t.getMonth(),C[r+20>>2]=t.getFullYear()-1900,C[r+24>>2]=t.getDay();var n=Ii(t)|0;C[r+28>>2]=n,C[r+36>>2]=-(t.getTimezoneOffset()*60);var i=new Date(t.getFullYear(),0,1),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),c=(a!=s&&t.getTimezoneOffset()==Math.min(s,a))|0;C[r+32>>2]=c}var Ce={},ct=e=>{if(e instanceof $r||e=="unwind")return Ae;Er(1,e)},ut=()=>rr||ot>0,lt=e=>{Ae=e,ut()||(l.onExit?.(e),Pe=!0),Er(e,new $r(e))},Oi=(e,r)=>{Ae=e,lt(e)},Mi=Oi,xi=()=>{if(!ut())try{Mi(Ae)}catch(e){ct(e)}},ft=e=>{if(!Pe)try{e(),xi()}catch(r){ct(r)}},yr=()=>performance.now(),Gi=(e,r)=>{if(Ce[e]&&(clearTimeout(Ce[e].id),delete Ce[e]),!r)return 0;var t=setTimeout(()=>{delete Ce[e],ft(()=>wt(e,yr()))},r);return Ce[e]={id:t,timeout_ms:r},0},Ni=(e,r,t,n)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),s=new Date(i,6,1),c=a.getTimezoneOffset(),u=s.getTimezoneOffset(),f=Math.max(c,u);m[e>>2]=f*60,C[r>>2]=+(c!=u);var d=v=>{var h=v>=0?"-":"+",k=Math.abs(v),$=String(Math.floor(k/60)).padStart(2,"0"),T=String(k%60).padStart(2,"0");return`UTC${h}${$}${T}`},_=d(c),p=d(u);u<c?(M(_,t,17),M(p,n,17)):(M(_,n,17),M(p,t,17))},dt=()=>Date.now(),Li=1,Wi=e=>e>=0&&e<=3;function Ui(e,r,t){if(r=ze(r),!Wi(e))return 28;var n;if(e===0)n=dt();else if(Li)n=yr();else return 52;var i=Math.round(n*1e3*1e3);return U[t>>3]=BigInt(i),0}var Bi=e=>{console.warn(j(e))},Vi=(e,r)=>ee(j(e,r));function Hi(e){if(B.xhrs.has(e)){var r=B.xhrs.get(e);B.xhrs.free(e),r.readyState>0&&r.readyState<4&&r.abort()}}var vt=()=>2147483648,zi=()=>vt(),qi=()=>!ge,Xi=(e,r)=>we(j(e,r)),Zi=(e,r)=>Math.ceil(e/r)*r,Ki=e=>{var r=$e.buffer.byteLength,t=(e-r+65535)/65536|0;try{return $e.grow(t),Ar(),1}catch{}},Yi=e=>{var r=L.length;e>>>=0;var t=vt();if(e>t)return!1;for(var n=1;n<=4;n*=2){var i=r*(1+.2/n);i=Math.min(i,e+100663296);var a=Math.min(t,Zi(Math.max(e,i),65536)),s=Ki(a);if(s)return!0}return!1};class Ji{allocated=[void 0];freelist=[];get(r){return this.allocated[r]}has(r){return this.allocated[r]!==void 0}allocate(r){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=r,t}free(r){this.allocated[r]=void 0,this.freelist.push(r)}}var B={async openDatabase(e,r){return new Promise((t,n)=>{try{var i=indexedDB.open(e,r)}catch(a){return n(a)}i.onupgradeneeded=a=>{var s=a.target.result;s.objectStoreNames.contains("FILES")&&s.deleteObjectStore("FILES"),s.createObjectStore("FILES")},i.onsuccess=a=>t(a.target.result),i.onerror=n})},async init(){B.xhrs=new Ji,Nr("library_fetch_init");try{var e=await B.openDatabase("emscripten_filesystem",1);B.dbInstance=e}catch{B.dbInstance=!1}finally{Gr("library_fetch_init")}}};function gr(e,r,t,n,i){var a=m[e+8>>2];if(!a){t(e,"no url specified!");return}var s=j(a),c=e+108,u=j(c+0);u||="GET";var f=m[c+56>>2],d=m[c+68>>2],_=m[c+72>>2],p=m[c+76>>2],v=m[c+80>>2],h=m[c+84>>2],k=m[c+88>>2],$=m[c+52>>2],T=!!($&1),x=!!($&2),P=!!($&64),K=d?j(d):void 0,H=_?j(_):void 0,S=new XMLHttpRequest;if(S.withCredentials=!!L[c+60],S.open(u,s,!P,K,H),P||(S.timeout=f),S.url_=s,S.responseType="arraybuffer",v){var I=j(v);S.overrideMimeType(I)}if(p)for(;;){var se=m[p>>2];if(!se)break;var Xe=m[p+4>>2];if(!Xe)break;p+=8;var N=j(se),ne=j(Xe);S.setRequestHeader(N,ne)}var Q=B.xhrs.allocate(S);m[e>>2]=Q;var br=h&&k?L.slice(h,h+k):null;function Ze(){var O=0,z=0;S.response&&T&&m[e+12>>2]===0&&(z=S.response.byteLength),z>0&&(O=Z(z),L.set(new Uint8Array(S.response),O)),m[e+12>>2]=O,X(e+16,z),X(e+24,0);var ie=S.response?S.response.byteLength:0;if(ie&&X(e+32,ie),A[e+40>>1]=S.readyState,A[e+42>>1]=S.status,S.statusText&&M(S.statusText,e+44,64),P){var Ke=_t(S.responseURL);m[e+200>>2]=Ke}}S.onload=O=>{B.xhrs.has(Q)&&(Ze(),S.status>=200&&S.status<300?r(e,S,O):t(e,O))},S.onerror=O=>{B.xhrs.has(Q)&&(Ze(),t(e,O))},S.ontimeout=O=>{B.xhrs.has(Q)&&t(e,O)},S.onprogress=O=>{if(B.xhrs.has(Q)){var z=T&&x&&S.response?S.response.byteLength:0,ie=0;z>0&&T&&x&&(ie=Z(z),L.set(new Uint8Array(S.response),ie)),m[e+12>>2]=ie,X(e+16,z),X(e+24,O.loaded-z),X(e+32,O.total),A[e+40>>1]=S.readyState;var Ke=S.status;S.readyState>=3&&S.status===0&&O.loaded>0&&(Ke=200),A[e+42>>1]=Ke,S.statusText&&M(S.statusText,e+44,64),n(e,O),J(ie)}},S.onreadystatechange=O=>{if(B.xhrs.has(Q)){if(A[e+40>>1]=S.readyState,S.readyState>=2&&(A[e+42>>1]=S.status),!P&&S.readyState===2&&S.responseURL.length>0){var z=_t(S.responseURL);m[e+200>>2]=z}i(e,O)}};try{S.send(br)}catch(O){t(e,O)}}var X=(e,r)=>{m[e>>2]=r;var t=m[e>>2];m[e+4>>2]=(r-t)/4294967296},_t=e=>{var r=Y(e)+1,t=Z(r);return t&&M(e,t,r),t};function ht(e,r,t,n,i){if(!e){i(r,0,"IndexedDB not available!");return}var a=r+108,s=m[a+64>>2];s||=m[r+8>>2];var c=j(s);try{var u=e.transaction(["FILES"],"readwrite"),f=u.objectStore("FILES"),d=f.put(t,c);d.onsuccess=_=>{A[r+40>>1]=4,A[r+42>>1]=200,M("OK",r+44,64),n(r,0,c)},d.onerror=_=>{A[r+40>>1]=4,A[r+42>>1]=413,M("Payload Too Large",r+44,64),i(r,0,_)}}catch(_){i(r,0,_)}}function Qi(e,r,t,n){if(!e){n(r,0,"IndexedDB not available!");return}var i=r+108,a=m[i+64>>2];a||=m[r+8>>2];var s=j(a);try{var c=e.transaction(["FILES"],"readonly"),u=c.objectStore("FILES"),f=u.get(s);f.onsuccess=d=>{if(d.target.result){var _=d.target.result,p=_.byteLength||_.length,v=Z(p);L.set(new Uint8Array(_),v),m[r+12>>2]=v,X(r+16,p),X(r+24,0),X(r+32,p),A[r+40>>1]=4,A[r+42>>1]=200,M("OK",r+44,64),t(r,0,_)}else A[r+40>>1]=4,A[r+42>>1]=404,M("Not Found",r+44,64),n(r,0,"no data")},f.onerror=d=>{A[r+40>>1]=4,A[r+42>>1]=404,M("Not Found",r+44,64),n(r,0,d)}}catch(d){n(r,0,d)}}function ea(e,r,t,n){if(!e){n(r,0,"IndexedDB not available!");return}var i=r+108,a=m[i+64>>2];a||=m[r+8>>2];var s=j(a);try{var c=e.transaction(["FILES"],"readwrite"),u=c.objectStore("FILES"),f=u.delete(s);f.onsuccess=d=>{var _=d.target.result;m[r+12>>2]=0,X(r+16,0),X(r+24,0),X(r+32,0),A[r+40>>1]=4,A[r+42>>1]=200,M("OK",r+44,64),t(r,0,_)},f.onerror=d=>{A[r+40>>1]=4,A[r+42>>1]=404,M("Not Found",r+44,64),n(r,0,d)}}catch(d){n(r,0,d)}}function ra(e,r,t,n,i){var a=e+108,s=m[a+36>>2],c=m[a+40>>2],u=m[a+44>>2],f=m[a+48>>2],d=m[a+52>>2],_=!!(d&64);function p(N){_?N():ft(N)}var v=(N,ne,Q)=>{p(()=>{s?y(s)(N):r?.(N)})},h=(N,ne)=>{p(()=>{u?y(u)(N):n?.(N)})},k=(N,ne)=>{p(()=>{c?y(c)(N):t?.(N)})},$=(N,ne)=>{p(()=>{f?y(f)(N):i?.(N)})},T=(N,ne,Q)=>{gr(N,v,k,h,$)},x=(N,ne,Q)=>{var br=(O,z,ie)=>{p(()=>{s?y(s)(O):r?.(O)})},Ze=(O,z,ie)=>{p(()=>{s?y(s)(O):r?.(O)})};ht(B.dbInstance,N,ne.response,br,Ze)},P=(N,ne,Q)=>{gr(N,x,k,h,$)},K=j(a+0),H=!!(d&16),S=!!(d&4),I=!!(d&32);if(K==="EM_IDB_STORE"){var se=m[a+84>>2],Xe=m[a+88>>2];ht(B.dbInstance,e,L.slice(se,se+Xe),v,k)}else if(K==="EM_IDB_DELETE")ea(B.dbInstance,e,v,k);else if(!H)Qi(B.dbInstance,e,v,I?k:S?P:T);else if(!I)gr(e,S?x:v,k,h,$);else return 0;return e}var qe={},ta=()=>kr||"./this.program",Te=()=>{if(!Te.strings){var e=(typeof navigator=="object"&&navigator.language||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:ta()};for(var t in qe)qe[t]===void 0?delete r[t]:r[t]=qe[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Te.strings=n}return Te.strings},na=(e,r)=>{var t=0,n=0;for(var i of Te()){var a=r+t;m[e+n>>2]=a,t+=M(i,a,1/0)+1,n+=4}return 0},ia=(e,r)=>{var t=Te();m[e>>2]=t.length;var n=0;for(var i of t)n+=Y(i)+1;return m[r>>2]=n,0};function aa(e){try{var r=R.getStreamFromFD(e);return o.close(r),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}}function oa(e,r){try{var t=0,n=0,i=0,a=R.getStreamFromFD(e),s=a.tty?2:o.isDir(a.mode)?3:o.isLink(a.mode)?7:4;return G[r]=s,A[r+2>>1]=i,U[r+8>>3]=BigInt(t),U[r+16>>3]=BigInt(n),0}catch(c){if(typeof o>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var sa=(e,r,t,n)=>{for(var i=0,a=0;a<t;a++){var s=m[r>>2],c=m[r+4>>2];r+=8;var u=o.read(e,G,s,c,n);if(u<0)return-1;if(i+=u,u<c)break;typeof n<"u"&&(n+=u)}return i};function ca(e,r,t,n){try{var i=R.getStreamFromFD(e),a=sa(i,r,t);return m[n>>2]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function ua(e,r,t,n){r=ze(r);try{if(isNaN(r))return 61;var i=R.getStreamFromFD(e);return o.llseek(i,r,t),U[n>>3]=BigInt(i.position),i.getdents&&r===0&&t===0&&(i.getdents=null),0}catch(a){if(typeof o>"u"||a.name!=="ErrnoError")throw a;return a.errno}}var la=(e,r,t,n)=>{for(var i=0,a=0;a<t;a++){var s=m[r>>2],c=m[r+4>>2];r+=8;var u=o.write(e,G,s,c,n);if(u<0)return-1;if(i+=u,u<c)break;typeof n<"u"&&(n+=u)}return i};function fa(e,r,t,n){try{var i=R.getStreamFromFD(e),a=la(i,r,t);return m[n>>2]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var da=e=>e;function va(e,r){try{return ir(L.subarray(e,e+r)),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var cc=e=>(e>>>=0,"0x"+e.toString(16).padStart(8,"0")),mt=e=>{var r=l["_"+e];return r},_a=(e,r)=>{G.set(e,r)},pt=e=>kt(e),ha=e=>{var r=Y(e)+1,t=pt(r);return M(e,t,r),t},yt=(e,r,t,n,i)=>{var a={string:h=>{var k=0;return h!=null&&h!==0&&(k=ha(h)),k},array:h=>{var k=pt(h.length);return _a(h,k),k}};function s(h){return r==="string"?j(h):r==="boolean"?!!h:h}var c=mt(e),u=[],f=0;if(n)for(var d=0;d<n.length;d++){var _=a[t[d]];_?(f===0&&(f=b()),u[d]=_(n[d])):u[d]=n[d]}var p=c(...u);function v(h){return f!==0&&w(f),s(h)}return p=v(p),p},ma=(e,r,t,n)=>{var i=!t||t.every(s=>s==="number"||s==="boolean"),a=r!=="string";return a&&i&&!n?mt(e):(...s)=>yt(e,r,t,s,n)};if(o.createPreloadedFile=ln,o.preloadFile=Wr,o.staticInit(),Fn(),Ln(),B.init(),l.noExitRuntime&&(rr=l.noExitRuntime),l.preloadPlugins&&(Lr=l.preloadPlugins),l.print&&(we=l.print),l.printErr&&(ee=l.printErr),l.wasmBinary&&(be=l.wasmBinary),l.arguments&&(Rt=l.arguments),l.thisProgram&&(kr=l.thisProgram),l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.shift()();l.ENV=qe,l.ccall=yt,l.cwrap=ma,l.lengthBytesUTF8=Y,l.stringToUTF8=M;function pa(e){if(typeof l.locateFile=="function")try{const r=l.locateFile(j(e));if(r){const t=Y(r)+1,n=Z(t);if(n)return M(r,n,t),n}}catch(r){console.warn("Module.locateFile failed:",r)}return 0}function ya(e){try{if(typeof l<"u"&&l.workerUrl){var r=l.workerUrl,t=Y(r)+1,n=Z(t);return M(r,n,t),n}}catch(i){console.warn("Failed to read Module.workerUrl:",i)}if(e){var t=Y(j(e))+1,n=Z(t);return M(j(e),n,t),n}return 0}function ga(){return navigator.hardwareConcurrency||1}function wa(e){l._aquaLiveTransports||(l._aquaLiveTransports=new Set),l._aquaLiveTransports.add(e),queueMicrotask(function(){l._aquaLiveTransports&&l._aquaLiveTransports.has(e)&&l._aquaDrainDeferredCompletions(e)})}function ba(e){l._aquaLiveTransports&&l._aquaLiveTransports.delete(e)}function Sa(e,r){if(!l.createDeserializeWorker)return console.error("createDeserializeWorker not available - worker-bridge.ts not loaded"),0;const t=j(e);return l.createDeserializeWorker(t,l,r)?1:0}function ka(e,r,t,n,i){if(!l.submitToWorker)return console.error("submitToWorker not available - worker-bridge.ts not loaded"),0;try{const a=t,s=n,c=new ArrayBuffer(s);return new Uint8Array(c).set(l.HEAPU8.subarray(a,a+s)),l.submitToWorker(e,r,c,i)?1:0}catch(a){return console.error("submitToWorker failed:",a),0}}function Ea(e,r){l.cancelRequest&&l.cancelRequest(e,r)}function uc(){return l.isWorkerReady&&l.isWorkerReady()?1:0}function Ca(){l.terminateWorker&&l.terminateWorker()}function Ta(e,r){typeof globalThis.Sentry<"u"&&typeof globalThis.Sentry.captureException=="function"&&globalThis.Sentry.captureException(new Error(j(e,r)))}function Fa(e){const r=j(e);try{const t=new URL(r)}catch{return 0}return 1}function Pa(e,r){const t=j(e);let n;try{n=new URL(t)}catch(c){return console.error(`Failed to parse URL ${t} due to error : ${c}`),0}function i(c){return c>>>0}function a(c){const u=Y(c)+1,f=Z(u);return M(c,f,u),i(f)}let s=i(r)>>2;return m[s]=a(n.origin),m[s+1]=a(n.pathname.substring(1)),m[s+2]=a(n.search.substring(1)),m[s+3]=a(n.hash.substring(1)),1}function Aa(e){const r=j(e),t=encodeURIComponent(r),n=Y(t)+1,i=Z(n);return M(t,i,n),i>>>0}function $a(e){l.__mirisPrivatePromiseTracker||(l.__mirisPrivatePromiseTracker=new Map);let r,t;const n=new Promise(function(i,a){r=i,t=a});return l.__mirisPrivatePromiseTracker.set(e,{resolve:r,reject:t}),W.toHandle(n)}function Da(e,r){const t=l.__mirisPrivatePromiseTracker;if(!t||!t.has(e)){console.error("[miris] No resolver for tracked promise ID:",e);return}const{resolve:n}=t.get(e);if(!n){console.error("[miris] No resolver for tracked promise ID:",e);return}t.delete(e),n(W.toValue(r))}function lc(e,r){const t=l.__mirisPrivatePromiseTracker;if(!t||!t.has(e)){console.error("[miris] No rejector for tracked promise ID:",e);return}const{reject:n}=t.get(e);if(!n){console.error("[miris] No rejector for tracked promise ID:",e);return}t.delete(e),n(W.toValue(r))}var gt,Ra,Ia,ja,Oa,Ma,xa,Ga,Na,La,Wa,Ua,Ba,Va,Ha,za,qa,Xa,Za,Ka,Ya,Ja,Qa,eo,ro,to,no,io,ao,oo,so,co,uo,lo,fo,vo,_o,ho,mo,po,yo,go,wo,bo,So,ko,Eo,Co,To,Fo,Po,Ao,$o,Do,Ro,Io,jo,Oo,Mo,xo,Go,No,Lo,Wo,Uo,Bo,Vo,Ho,zo,qo,Xo,Zo,Ko,Z,J,Yo,Jo,wt,g,bt,St,kt,Et,Ct,Tt,Ft,Pt;function Qo(e){gt=e.__getTypeName,l._CreateAquaContext=Ra=e.CreateAquaContext,l._DestroyAquaContext=Ia=e.DestroyAquaContext,l._TriggerTestError=ja=e.TriggerTestError,l._CreateClientForContext=Oa=e.CreateClientForContext,l._CreateClient=Ma=e.CreateClient,l._DestroyClient=xa=e.DestroyClient,l._ClearScene=Ga=e.ClearScene,l._WaitForSceneExecution=Na=e.WaitForSceneExecution,l._SetPersistentDataDirectory=La=e.SetPersistentDataDirectory,l._SetClientSpatialFormat=Wa=e.SetClientSpatialFormat,l._SetAssetViewerKey=Ua=e.SetAssetViewerKey,l._PrefetchContent=Ba=e.PrefetchContent,l._PrintSceneObjectHierarchy=Va=e.PrintSceneObjectHierarchy,l._CancelAllSceneExecution=Ha=e.CancelAllSceneExecution,l._AddStream=za=e.AddStream,l._AddStreamById=qa=e.AddStreamById,l._RemoveStream=Xa=e.RemoveStream,l._UpdateSceneExecution=Za=e.UpdateSceneExecution,l._RecordFrameTime=Ka=e.RecordFrameTime,l._TakeRenderRequired=Ya=e.TakeRenderRequired,l._LockScene=Ja=e.LockScene,l._UnlockScene=Qa=e.UnlockScene,l._SetMainCameraTransform=eo=e.SetMainCameraTransform,l._SetMainCameraViewFrustum=ro=e.SetMainCameraViewFrustum,l._SetSceneObjectTransform=to=e.SetSceneObjectTransform,l._SetRuntimeSettings=no=e.SetRuntimeSettings,l._SetOctreeSolverMode=io=e.SetOctreeSolverMode,l._SetOctreeDepthFavor=ao=e.SetOctreeDepthFavor,l._SetBudgetControllerType=oo=e.SetBudgetControllerType,l._SetMaxCacheSize=so=e.SetMaxCacheSize,l._HasFeature=co=e.HasFeature,l._GetFeatureVersion=uo=e.GetFeatureVersion,l._GetFeatureState=lo=e.GetFeatureState,l._GetSceneChangesCounts=fo=e.GetSceneChangesCounts,l._GetSceneChanges=vo=e.GetSceneChanges,l._GetSceneRootObjectId=_o=e.GetSceneRootObjectId,l._GetSceneObjectChildrenCount=ho=e.GetSceneObjectChildrenCount,l._GetSceneObjectChildren=mo=e.GetSceneObjectChildren,l._GetSceneObjectType=po=e.GetSceneObjectType,l._GetDrawnOctantMask=yo=e.GetDrawnOctantMask,l._LogOctreeStats=go=e.LogOctreeStats,l._GetSceneObjectParent=wo=e.GetSceneObjectParent,l._IsSceneObjectAncestorOf=bo=e.IsSceneObjectAncestorOf,l._GetSceneObjectName=So=e.GetSceneObjectName,l._GetAttributeCount=ko=e.GetAttributeCount,l._HasAttribute=Eo=e.HasAttribute,l._GetMosaicDescriptors=Co=e.GetMosaicDescriptors,l._GetEccLutData=To=e.GetEccLutData,l._GetAttribute=Fo=e.GetAttribute,l._TakeAttribute=Po=e.TakeAttribute,l._GetBufferHash=Ao=e.GetBufferHash,l._GetWorldBoundingBox=$o=e.GetWorldBoundingBox,l._GetLocalBoundingBox=Do=e.GetLocalBoundingBox,l._MirisGetLocalTransform=Ro=e.MirisGetLocalTransform,l._MirisGetWorldTransform=Io=e.MirisGetWorldTransform,l._GetMetadata=jo=e.GetMetadata,l._GetLodIndex=Oo=e.GetLodIndex,l._GetLibAquaVersion=Mo=e.GetLibAquaVersion,l._GetLodMinMaxIndices=xo=e.GetLodMinMaxIndices,l._GetCameraCount=Go=e.GetCameraCount,l._GetCameraIds=No=e.GetCameraIds,l._GetDefaultCameraId=Lo=e.GetDefaultCameraId,l._GetViewingVolumeId=Wo=e.GetViewingVolumeId,l._GetSceneMetadata=Uo=e.GetSceneMetadata,l._GetSceneOperatorCount=Bo=e.GetSceneOperatorCount,l._SetVariantSelection=Vo=e.SetVariantSelection,l.__Z26GetSceneObjectNameAsStringP10AquaClienti=Ho=e._Z26GetSceneObjectNameAsStringP10AquaClienti,l.__Z14GetAssetsAsyncP10AquaClientRKNSt3__26vectorINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS6_IS8_EEEEiPN4aqua6v0_0_013ArrayCallbackINSE_9AssetInfoEEE=zo=e._Z14GetAssetsAsyncP10AquaClientRKNSt3__26vectorINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS6_IS8_EEEEiPN4aqua6v0_0_013ArrayCallbackINSE_9AssetInfoEEE,l.__Z21GetAvailableTagsAsyncP10AquaClientPN4aqua6v0_0_013ArrayCallbackINSt3__212basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEE=qo=e._Z21GetAvailableTagsAsyncP10AquaClientPN4aqua6v0_0_013ArrayCallbackINSt3__212basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEE,l.__Z33TakeEvictedClientSideAttributeIdsP10AquaClient=Xo=e._Z33TakeEvictedClientSideAttributeIdsP10AquaClient,l.__Z30GetActiveClientSideIdsCheckSumv=Zo=e._Z30GetActiveClientSideIdsCheckSumv,Ko=e.__cxa_free_exception,l._malloc=Z=e.malloc,l._free=J=e.free,l._aquaDrainDeferredCompletions=Yo=e.aquaDrainDeferredCompletions,l._onWorkerResult=Jo=e.onWorkerResult,wt=e._emscripten_timeout,g=e.setThrew,bt=e._emscripten_tempret_set,St=e._emscripten_stack_restore,kt=e._emscripten_stack_alloc,Et=e.emscripten_stack_get_current,Ct=e.__cxa_decrement_exception_refcount,Tt=e.__cxa_increment_exception_refcount,Ft=e.__cxa_can_catch,Pt=e.__cxa_get_exception_ptr}var At={__cxa_begin_catch:qt,__cxa_end_catch:Xt,__cxa_find_matching_catch_2:Zt,__cxa_find_matching_catch_3:Kt,__cxa_find_matching_catch_4:Yt,__cxa_rethrow:Jt,__cxa_throw:Qt,__cxa_uncaught_exceptions:en,__resumeException:rn,__syscall_fcntl64:fn,__syscall_fstat64:dn,__syscall_ioctl:vn,__syscall_lstat64:_n,__syscall_newfstatat:hn,__syscall_openat:mn,__syscall_rmdir:pn,__syscall_stat64:yn,__syscall_unlinkat:gn,_abort_js:wn,_embind_register_bigint:Sn,_embind_register_bool:kn,_embind_register_class:Un,_embind_register_class_constructor:Vn,_embind_register_class_function:Hn,_embind_register_class_property:zn,_embind_register_emval:qn,_embind_register_enum:Zn,_embind_register_enum_value:Kn,_embind_register_float:Jn,_embind_register_function:Qn,_embind_register_integer:ei,_embind_register_memory_view:ri,_embind_register_optional:ni,_embind_register_std_string:ii,_embind_register_std_wstring:fi,_embind_register_void:di,_emscripten_runtime_keepalive_clear:vi,_emval_create_invoker:yi,_emval_decref:hr,_emval_get_global:gi,_emval_get_property:wi,_emval_incref:bi,_emval_invoke:Si,_emval_new_array:ki,_emval_new_cstring:Ei,_emval_run_destructors:Ci,_emval_set_property:Ti,_gmtime_js:Ai,_localtime_js:ji,_setitimer_js:Gi,_tzset_js:Ni,clock_time_get:Ui,emjsCreateTrackedPromise:$a,emjsEncodeUriComponent:Aa,emjsGetPartsFromUrl:Pa,emjsIsValidUrl:Fa,emjsResolveTrackedPromise:Da,emjsSentryCaptureException:Ta,emscripten_console_warn:Bi,emscripten_date_now:dt,emscripten_errn:Vi,emscripten_fetch_free:Hi,emscripten_get_heap_max:zi,emscripten_get_now:yr,emscripten_is_main_browser_thread:qi,emscripten_outn:Xi,emscripten_resize_heap:Yi,emscripten_start_fetch:ra,environ_get:na,environ_sizes_get:ia,fd_close:aa,fd_fdstat_get:oa,fd_read:ca,fd_seek:ua,fd_write:fa,getHardwareConcurrency:ga,getWorkerUrlFromModule:ya,impl_cancelRequest:Ea,impl_createDeserializeWorker:Sa,impl_submitToWorker:ka,impl_terminateWorker:Ca,invoke_diii:zs,invoke_djj:Rs,invoke_fi:Es,invoke_fiii:Hs,invoke_i:ls,invoke_ii:rs,invoke_iii:os,invoke_iiii:hs,invoke_iiiid:qs,invoke_iiiii:cs,invoke_iiiiid:Bs,invoke_iiiiii:vs,invoke_iiiiiii:Gs,invoke_iiiiiiii:Ps,invoke_iiiiiiiii:$s,invoke_iiiiiiiiii:Ss,invoke_iiiiiiiiiii:ws,invoke_iiiiiiiiiiii:bs,invoke_iiiiij:ec,invoke_iiiiijj:Xs,invoke_iiiij:Qs,invoke_iiiijj:Zs,invoke_iiij:Js,invoke_iij:ds,invoke_iiji:Ls,invoke_iijiiii:_s,invoke_j:Ts,invoke_jii:ps,invoke_jiiii:Vs,invoke_v:ss,invoke_vi:es,invoke_viddi:Is,invoke_vif:xs,invoke_vii:as,invoke_viif:rc,invoke_viii:ts,invoke_viiifi:Ms,invoke_viiii:us,invoke_viiiiddi:Os,invoke_viiiii:is,invoke_viiiiii:ns,invoke_viiiiiii:gs,invoke_viiiiiiii:Cs,invoke_viiiiiiiiii:Ks,invoke_viiiiiiiiiii:fs,invoke_viiiiiiiiiiiiiii:Ys,invoke_viiiij:Ds,invoke_viiij:As,invoke_viij:js,invoke_viiji:ys,invoke_viijii:ks,invoke_viijiii:Ns,invoke_vij:Us,invoke_viji:Ws,invoke_vijii:Fs,invoke_vijiiii:ms,llvm_eh_typeid_for:da,proc_exit:lt,random_get:va,scheduleMicrotaskDrain:wa,tryLocateWorkerFile:pa,unregisterTransportInstance:ba};function es(e,r){var t=b();try{y(e)(r)}catch(n){if(w(t),n!==n+0)throw n;g(1,0)}}function rs(e,r){var t=b();try{return y(e)(r)}catch(n){if(w(t),n!==n+0)throw n;g(1,0)}}function ts(e,r,t,n){var i=b();try{y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function ns(e,r,t,n,i,a,s){var c=b();try{y(e)(r,t,n,i,a,s)}catch(u){if(w(c),u!==u+0)throw u;g(1,0)}}function is(e,r,t,n,i,a){var s=b();try{y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function as(e,r,t){var n=b();try{y(e)(r,t)}catch(i){if(w(n),i!==i+0)throw i;g(1,0)}}function os(e,r,t){var n=b();try{return y(e)(r,t)}catch(i){if(w(n),i!==i+0)throw i;g(1,0)}}function ss(e){var r=b();try{y(e)()}catch(t){if(w(r),t!==t+0)throw t;g(1,0)}}function cs(e,r,t,n,i){var a=b();try{return y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function us(e,r,t,n,i){var a=b();try{y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function ls(e){var r=b();try{return y(e)()}catch(t){if(w(r),t!==t+0)throw t;g(1,0)}}function fs(e,r,t,n,i,a,s,c,u,f,d,_){var p=b();try{y(e)(r,t,n,i,a,s,c,u,f,d,_)}catch(v){if(w(p),v!==v+0)throw v;g(1,0)}}function ds(e,r,t){var n=b();try{return y(e)(r,t)}catch(i){if(w(n),i!==i+0)throw i;g(1,0)}}function vs(e,r,t,n,i,a){var s=b();try{return y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function _s(e,r,t,n,i,a,s){var c=b();try{return y(e)(r,t,n,i,a,s)}catch(u){if(w(c),u!==u+0)throw u;g(1,0)}}function hs(e,r,t,n){var i=b();try{return y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function ms(e,r,t,n,i,a,s){var c=b();try{y(e)(r,t,n,i,a,s)}catch(u){if(w(c),u!==u+0)throw u;g(1,0)}}function ps(e,r,t){var n=b();try{return y(e)(r,t)}catch(i){if(w(n),i!==i+0)throw i;return g(1,0),0n}}function ys(e,r,t,n,i){var a=b();try{y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function gs(e,r,t,n,i,a,s,c){var u=b();try{y(e)(r,t,n,i,a,s,c)}catch(f){if(w(u),f!==f+0)throw f;g(1,0)}}function ws(e,r,t,n,i,a,s,c,u,f,d){var _=b();try{return y(e)(r,t,n,i,a,s,c,u,f,d)}catch(p){if(w(_),p!==p+0)throw p;g(1,0)}}function bs(e,r,t,n,i,a,s,c,u,f,d,_){var p=b();try{return y(e)(r,t,n,i,a,s,c,u,f,d,_)}catch(v){if(w(p),v!==v+0)throw v;g(1,0)}}function Ss(e,r,t,n,i,a,s,c,u,f){var d=b();try{return y(e)(r,t,n,i,a,s,c,u,f)}catch(_){if(w(d),_!==_+0)throw _;g(1,0)}}function ks(e,r,t,n,i,a){var s=b();try{y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function Es(e,r){var t=b();try{return y(e)(r)}catch(n){if(w(t),n!==n+0)throw n;g(1,0)}}function Cs(e,r,t,n,i,a,s,c,u){var f=b();try{y(e)(r,t,n,i,a,s,c,u)}catch(d){if(w(f),d!==d+0)throw d;g(1,0)}}function Ts(e){var r=b();try{return y(e)()}catch(t){if(w(r),t!==t+0)throw t;return g(1,0),0n}}function Fs(e,r,t,n,i){var a=b();try{y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function Ps(e,r,t,n,i,a,s,c){var u=b();try{return y(e)(r,t,n,i,a,s,c)}catch(f){if(w(u),f!==f+0)throw f;g(1,0)}}function As(e,r,t,n,i){var a=b();try{y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function $s(e,r,t,n,i,a,s,c,u){var f=b();try{return y(e)(r,t,n,i,a,s,c,u)}catch(d){if(w(f),d!==d+0)throw d;g(1,0)}}function Ds(e,r,t,n,i,a){var s=b();try{y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function Rs(e,r,t){var n=b();try{return y(e)(r,t)}catch(i){if(w(n),i!==i+0)throw i;g(1,0)}}function Is(e,r,t,n,i){var a=b();try{y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function js(e,r,t,n){var i=b();try{y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function Os(e,r,t,n,i,a,s,c){var u=b();try{y(e)(r,t,n,i,a,s,c)}catch(f){if(w(u),f!==f+0)throw f;g(1,0)}}function Ms(e,r,t,n,i,a){var s=b();try{y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function xs(e,r,t){var n=b();try{y(e)(r,t)}catch(i){if(w(n),i!==i+0)throw i;g(1,0)}}function Gs(e,r,t,n,i,a,s){var c=b();try{return y(e)(r,t,n,i,a,s)}catch(u){if(w(c),u!==u+0)throw u;g(1,0)}}function Ns(e,r,t,n,i,a,s){var c=b();try{y(e)(r,t,n,i,a,s)}catch(u){if(w(c),u!==u+0)throw u;g(1,0)}}function Ls(e,r,t,n){var i=b();try{return y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function Ws(e,r,t,n){var i=b();try{y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function Us(e,r,t){var n=b();try{y(e)(r,t)}catch(i){if(w(n),i!==i+0)throw i;g(1,0)}}function Bs(e,r,t,n,i,a){var s=b();try{return y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function Vs(e,r,t,n,i){var a=b();try{return y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;return g(1,0),0n}}function Hs(e,r,t,n){var i=b();try{return y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function zs(e,r,t,n){var i=b();try{return y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function qs(e,r,t,n,i){var a=b();try{return y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function Xs(e,r,t,n,i,a,s){var c=b();try{return y(e)(r,t,n,i,a,s)}catch(u){if(w(c),u!==u+0)throw u;g(1,0)}}function Zs(e,r,t,n,i,a){var s=b();try{return y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function Ks(e,r,t,n,i,a,s,c,u,f,d){var _=b();try{y(e)(r,t,n,i,a,s,c,u,f,d)}catch(p){if(w(_),p!==p+0)throw p;g(1,0)}}function Ys(e,r,t,n,i,a,s,c,u,f,d,_,p,v,h,k){var $=b();try{y(e)(r,t,n,i,a,s,c,u,f,d,_,p,v,h,k)}catch(T){if(w($),T!==T+0)throw T;g(1,0)}}function Js(e,r,t,n){var i=b();try{return y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function Qs(e,r,t,n,i){var a=b();try{return y(e)(r,t,n,i)}catch(s){if(w(a),s!==s+0)throw s;g(1,0)}}function ec(e,r,t,n,i,a){var s=b();try{return y(e)(r,t,n,i,a)}catch(c){if(w(s),c!==c+0)throw c;g(1,0)}}function rc(e,r,t,n){var i=b();try{y(e)(r,t,n)}catch(a){if(w(i),a!==a+0)throw a;g(1,0)}}function wr(){if(ue>0){Se=wr;return}if(Ot(),ue>0){Se=wr;return}function e(){l.calledRun=!0,!Pe&&(Mt(),Cr?.(l),l.onRuntimeInitialized?.(),xt())}l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1),e()},1)):e()}var de;return de=await Vt(),wr(),Pr?Ye=l:Ye=new Promise((e,r)=>{Cr=e,Tr=r}),Ye}export default tc;\n\n'],{type:"text/javascript"}));return import(/* webpackIgnore: true */ /* turbopackIgnore: true */ t).finally(()=>URL.revokeObjectURL(t)).then(t=>{const e=function(t){return t.default||t}(t);if("function"==typeof e)return e;throw new Error("bad module")})}().catch(r=>{throw t=e=void 0,r})),Promise.all([t,e]).then(([t,e])=>{const[n={},...a]=r,s=i?{locateFile:(t,e)=>t.endsWith(".wasm")?i:e+t,...n}:{...n};return e&&(s.wasmBinary=e),t(s,...a)})},s=class t{static name="thread";static get Worker(){throw new Error("Thread could not be initialized because no Worker was supplied. Do you forget to set `static Worker = Worker` on the child class?")}constructor({engine:e}){Object.defineProperty(this,"engine",{value:e,enumerable:!0}),Object.defineProperty(this,"ready",{enumerable:!0,value:new Promise(t=>{this.#o.set(0,async()=>{this.#c=!1,this.#o.delete(0),t(this)})})}),this.#u=new this.constructor.Worker({name:`decoder-${t.#l()}`}),this.#u.addEventListener("message",this.#d.bind(this))}static#h=0;static#l(){return this.#h+=1}#c=!0;get pending(){return this.#c}#u;#o=/* @__PURE__ */new Map;get pendingRequests(){return this.#o.size}get terminated(){return!this.#u}#f=0;#p(){return this.#f+=1}async _execute(t,...e){if(this.pending)throw new Error(`Unable to execute ${t} because decoder has not yet been initialized`);if(!this.#u)throw new Error(`Unable to execute ${t} because decoder has already been terminated`);return new Promise(r=>{if(!this.#u)throw new Error(`Unable to execute ${t} because decoder has already been terminated`);const n=this.#p();this.#o.set(n,async t=>{this.#o.delete(n),r(t)});const i=e.filter(t=>t instanceof ArrayBuffer);this.#u.postMessage({id:n,action:t,args:e},i)})}#d({data:t}){"ready"===t&&(t={id:0,result:void 0});const{id:e,result:r}=t;this.#o.get(e)?.(r)}_postToWorker(t,e){this.#u?.postMessage(t,e??[])}terminate(){this.#u&&(this.#u.terminate(),this.#u.removeEventListener("message",this.#d),this.#u=null)}},o='const e = {\n\tsparkPackedSplat: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\textendedPackedSplatLow: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\textendedPackedSplatHigh: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\tpackedSh1: {\n\t\telementsPerSplat: 2,\n\t\tdiscard: !1\n\t},\n\tpackedSh2: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\tpackedSh3: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\tsh1Extended: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\tsh2Extended: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\tsh3Extended_0: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\tsh3Extended_1: {\n\t\telementsPerSplat: 4,\n\t\tdiscard: !1\n\t},\n\tsharkEllipsoids: {\n\t\telementsPerSplat: 12,\n\t\tdiscard: !1\n\t},\n\tsharkSphericalHarmonics: {\n\t\telementsPerSplat: 16,\n\t\tdiscard: !1\n\t}\n};\nfunction t(t, r, n) {\n\tconst a = e[t];\n\tif (void 0 === a) throw new Error("attribute name" + t + " is unknown");\n\tconst i = n.length, o = (s = i, u = 2048 * a.elementsPerSplat, Math.ceil(s / u) * u);\n\tvar s, u;\n\tconst c = new Uint32Array(o);\n\treturn c.set(n), {\n\t\tpaddedData: c,\n\t\toriginalSizeInUints: i,\n\t\tid: r\n\t};\n}\nconst { wasmBinary: r } = await new Promise((e) => {\n\tself.addEventListener("message", function t(r) {\n\t\t"wasm-init" === r.data?.type && (self.removeEventListener("message", t), e(r.data));\n\t});\n});\nif (!r) throw new Error("Decoder worker did not receive WASM binary. The main thread failed to fetch aqua-parser.wasm.");\nconst n = await async function(e = {}) {\n\tvar t, r, n = e, a = "./this.program", i = (e, t) => {\n\t\tthrow t;\n\t}, o = import.meta.url, s = "";\n\ttry {\n\t\ts = new URL(".", o).href;\n\t} catch {}\n\tr = (e) => {\n\t\tvar t = new XMLHttpRequest();\n\t\treturn t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response);\n\t}, t = async (e) => {\n\t\tvar t = await fetch(e, { credentials: "same-origin" });\n\t\tif (t.ok) return t.arrayBuffer();\n\t\tthrow new Error(t.status + " : " + t.url);\n\t};\n\tvar u, c, l, p, d, f, h, v, m, y, g, _, w, $, b, T, P = console.log.bind(console), C = console.error.bind(console), k = !1, S = !1;\n\tfunction F() {\n\t\tvar e = d.buffer;\n\t\tn.HEAP8 = f = new Int8Array(e), v = new Int16Array(e), n.HEAPU8 = h = new Uint8Array(e), m = new Uint16Array(e), n.HEAP32 = y = new Int32Array(e), n.HEAPU32 = g = new Uint32Array(e), n.HEAPF32 = _ = new Float32Array(e), n.HEAPF64 = w = new Float64Array(e), $ = new BigInt64Array(e), b = new BigUint64Array(e);\n\t}\n\tfunction A(e) {\n\t\tn.onAbort?.(e), C(e = "Aborted(" + e + ")"), k = !0, e += ". Build with -sASSERTIONS for more info.";\n\t\tvar t = new WebAssembly.RuntimeError(e);\n\t\tthrow p?.(t), t;\n\t}\n\tfunction D() {\n\t\treturn n.locateFile ? (e = "aqua-parser.wasm", n.locateFile ? n.locateFile(e, s) : s + e) : "";\n\t\tvar e;\n\t}\n\tasync function W(e) {\n\t\tif (!u) try {\n\t\t\tvar n = await t(e);\n\t\t\treturn new Uint8Array(n);\n\t\t} catch {}\n\t\treturn function(e) {\n\t\t\tif (e == T && u) return new Uint8Array(u);\n\t\t\tif (r) return r(e);\n\t\t\tthrow "both async and sync fetching of the wasm failed";\n\t\t}(e);\n\t}\n\tasync function E(e, t, r) {\n\t\tif (!e) try {\n\t\t\tvar n = fetch(t, { credentials: "same-origin" });\n\t\t\treturn await WebAssembly.instantiateStreaming(n, r);\n\t\t} catch (a) {\n\t\t\tC(`wasm streaming compile failed: ${a}`), C("falling back to ArrayBuffer instantiation");\n\t\t}\n\t\treturn async function(e, t) {\n\t\t\ttry {\n\t\t\t\tvar r = await W(e);\n\t\t\t\treturn await WebAssembly.instantiate(r, t);\n\t\t\t} catch (n) {\n\t\t\t\tC(`failed to asynchronously prepare wasm: ${n}`), A(n);\n\t\t\t}\n\t\t}(t, r);\n\t}\n\tclass x {\n\t\tname = "ExitStatus";\n\t\tconstructor(e) {\n\t\t\tthis.message = `Program terminated with exit(${e})`, this.status = e;\n\t\t}\n\t}\n\tvar O = (e) => {\n\t\tfor (; e.length > 0;) e.shift()(n);\n\t}, R = [], U = (e) => R.push(e), j = [], H = (e) => j.push(e), I = !0, V = (e) => Je(e), B = () => Ge(), M = [], q = 0, L = 0;\n\tclass z {\n\t\tconstructor(e) {\n\t\t\tthis.excPtr = e, this.ptr = e - 24;\n\t\t}\n\t\tset_type(e) {\n\t\t\tg[this.ptr + 4 >> 2] = e;\n\t\t}\n\t\tget_type() {\n\t\t\treturn g[this.ptr + 4 >> 2];\n\t\t}\n\t\tset_destructor(e) {\n\t\t\tg[this.ptr + 8 >> 2] = e;\n\t\t}\n\t\tget_destructor() {\n\t\t\treturn g[this.ptr + 8 >> 2];\n\t\t}\n\t\tset_caught(e) {\n\t\t\te = e ? 1 : 0, f[this.ptr + 12] = e;\n\t\t}\n\t\tget_caught() {\n\t\t\treturn 0 != f[this.ptr + 12];\n\t\t}\n\t\tset_rethrown(e) {\n\t\t\te = e ? 1 : 0, f[this.ptr + 13] = e;\n\t\t}\n\t\tget_rethrown() {\n\t\t\treturn 0 != f[this.ptr + 13];\n\t\t}\n\t\tinit(e, t) {\n\t\t\tthis.set_adjusted_ptr(0), this.set_type(e), this.set_destructor(t);\n\t\t}\n\t\tset_adjusted_ptr(e) {\n\t\t\tg[this.ptr + 16 >> 2] = e;\n\t\t}\n\t\tget_adjusted_ptr() {\n\t\t\treturn g[this.ptr + 16 >> 2];\n\t\t}\n\t}\n\tvar N = (e) => Ne(e), J = (e) => {\n\t\tvar t = L;\n\t\tif (!t) return N(0), 0;\n\t\tvar r = new z(t);\n\t\tr.set_adjusted_ptr(t);\n\t\tvar n = r.get_type();\n\t\tif (!n) return N(0), t;\n\t\tfor (var a of e) {\n\t\t\tif (0 === a || a === n) break;\n\t\t\tvar i = r.ptr + 16;\n\t\t\tif (Ke(a, n, i)) return N(a), t;\n\t\t}\n\t\treturn N(n), t;\n\t}, Y = (e) => {\n\t\tfor (var t = "";;) {\n\t\t\tvar r = h[e++];\n\t\t\tif (!r) return t;\n\t\t\tt += String.fromCharCode(r);\n\t\t}\n\t}, G = {}, X = {}, Z = {}, K = class extends Error {\n\t\tconstructor(e) {\n\t\t\tsuper(e), this.name = "BindingError";\n\t\t}\n\t}, Q = (e) => {\n\t\tthrow new K(e);\n\t};\n\tfunction ee(e, t, r = {}) {\n\t\treturn function(e, t, r = {}) {\n\t\t\tvar n = t.name;\n\t\t\tif (e || Q(`type "${n}" must have a positive integer typeid pointer`), X.hasOwnProperty(e)) {\n\t\t\t\tif (r.ignoreDuplicateRegistrations) return;\n\t\t\t\tQ(`Cannot register type \'${n}\' twice`);\n\t\t\t}\n\t\t\tif (X[e] = t, delete Z[e], G.hasOwnProperty(e)) {\n\t\t\t\tvar a = G[e];\n\t\t\t\tdelete G[e], a.forEach((e) => e());\n\t\t\t}\n\t\t}(e, t, r);\n\t}\n\tvar te = (e, t, r) => {\n\t\tswitch (t) {\n\t\t\tcase 1: return r ? (e) => f[e] : (e) => h[e];\n\t\t\tcase 2: return r ? (e) => v[e >> 1] : (e) => m[e >> 1];\n\t\t\tcase 4: return r ? (e) => y[e >> 2] : (e) => g[e >> 2];\n\t\t\tcase 8: return r ? (e) => $[e >> 3] : (e) => b[e >> 3];\n\t\t\tdefault: throw new TypeError(`invalid integer width (${t}): ${e}`);\n\t\t}\n\t}, re = (e) => ({\n\t\tcount: e.count,\n\t\tdeleteScheduled: e.deleteScheduled,\n\t\tpreservePointerOnDelete: e.preservePointerOnDelete,\n\t\tptr: e.ptr,\n\t\tptrType: e.ptrType,\n\t\tsmartPtr: e.smartPtr,\n\t\tsmartPtrType: e.smartPtrType\n\t}), ne = (e) => {\n\t\tQ(e.$$.ptrType.registeredClass.name + " instance already deleted");\n\t}, ae = !1, ie = (e) => {}, oe = (e) => {\n\t\te.count.value -= 1, 0 === e.count.value && ((e) => {\n\t\t\te.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr);\n\t\t})(e);\n\t}, se = (e) => typeof FinalizationRegistry > "u" ? (se = (e) => e, e) : (ae = new FinalizationRegistry((e) => {\n\t\toe(e.$$);\n\t}), ie = (e) => ae.unregister(e), (se = (e) => {\n\t\tvar t = e.$$;\n\t\tif (t.smartPtr) {\n\t\t\tvar r = { $$: t };\n\t\t\tae.register(e, r, e);\n\t\t}\n\t\treturn e;\n\t})(e)), ue = [];\n\tfunction ce() {}\n\tvar le = (e, t) => Object.defineProperty(t, "name", { value: e }), pe = {}, de = (e, t, r) => {\n\t\tif (void 0 === e[t].overloadTable) {\n\t\t\tvar n = e[t];\n\t\t\te[t] = function(...n) {\n\t\t\t\treturn e[t].overloadTable.hasOwnProperty(n.length) || Q(`Function \'${r}\' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`), e[t].overloadTable[n.length].apply(this, n);\n\t\t\t}, e[t].overloadTable = [], e[t].overloadTable[n.argCount] = n;\n\t\t}\n\t}, fe = (e, t, r) => {\n\t\tn.hasOwnProperty(e) ? ((void 0 === r || void 0 !== n[e].overloadTable && void 0 !== n[e].overloadTable[r]) && Q(`Cannot register public name \'${e}\' twice`), de(n, e, e), n[e].overloadTable.hasOwnProperty(r) && Q(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`), n[e].overloadTable[r] = t) : (n[e] = t, n[e].argCount = r);\n\t};\n\tfunction he(e, t, r, n, a, i, o, s) {\n\t\tthis.name = e, this.constructor = t, this.instancePrototype = r, this.rawDestructor = n, this.baseClass = a, this.getActualType = i, this.upcast = o, this.downcast = s, this.pureVirtualFunctions = [];\n\t}\n\tvar ve = (e, t, r) => {\n\t\tfor (; t !== r;) t.upcast || Q(`Expected null or instance of ${r.name}, got an instance of ${t.name}`), e = t.upcast(e), t = t.baseClass;\n\t\treturn e;\n\t}, me = (e) => {\n\t\tif (null === e) return "null";\n\t\tvar t = typeof e;\n\t\treturn "object" === t || "array" === t || "function" === t ? e.toString() : "" + e;\n\t};\n\tfunction ye(e, t) {\n\t\tif (null === t) return this.isReference && Q(`null is not a valid ${this.name}`), 0;\n\t\tt.$$ || Q(`Cannot pass "${me(t)}" as a ${this.name}`), t.$$.ptr || Q(`Cannot pass deleted object as a pointer of type ${this.name}`);\n\t\tvar r = t.$$.ptrType.registeredClass;\n\t\treturn ve(t.$$.ptr, r, this.registeredClass);\n\t}\n\tfunction ge(e, t) {\n\t\tvar r;\n\t\tif (null === t) return this.isReference && Q(`null is not a valid ${this.name}`), this.isSmartPointer ? (r = this.rawConstructor(), null !== e && e.push(this.rawDestructor, r), r) : 0;\n\t\t(!t || !t.$$) && Q(`Cannot pass "${me(t)}" as a ${this.name}`), t.$$.ptr || Q(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && Q(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);\n\t\tvar n = t.$$.ptrType.registeredClass;\n\t\tif (r = ve(t.$$.ptr, n, this.registeredClass), this.isSmartPointer) switch (void 0 === t.$$.smartPtr && Q("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {\n\t\t\tcase 0:\n\t\t\t\tt.$$.smartPtrType === this ? r = t.$$.smartPtr : Q(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tr = t.$$.smartPtr;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif (t.$$.smartPtrType === this) r = t.$$.smartPtr;\n\t\t\t\telse {\n\t\t\t\t\tvar a = t.clone();\n\t\t\t\t\tr = this.rawShare(r, ot.toHandle(() => a.delete())), null !== e && e.push(this.rawDestructor, r);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault: Q("Unsupporting sharing policy");\n\t\t}\n\t\treturn r;\n\t}\n\tfunction _e(e, t) {\n\t\tif (null === t) return this.isReference && Q(`null is not a valid ${this.name}`), 0;\n\t\tt.$$ || Q(`Cannot pass "${me(t)}" as a ${this.name}`), t.$$.ptr || Q(`Cannot pass deleted object as a pointer of type ${this.name}`), t.$$.ptrType.isConst && Q(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);\n\t\tvar r = t.$$.ptrType.registeredClass;\n\t\treturn ve(t.$$.ptr, r, this.registeredClass);\n\t}\n\tfunction we(e) {\n\t\treturn this.fromWireType(g[e >> 2]);\n\t}\n\tvar $e = (e, t, r) => {\n\t\tif (t === r) return e;\n\t\tif (void 0 === r.baseClass) return null;\n\t\tvar n = $e(e, t, r.baseClass);\n\t\treturn null === n ? null : r.downcast(n);\n\t}, be = {}, Te = (e, t) => (t = ((e, t) => {\n\t\tfor (void 0 === t && Q("ptr should not be undefined"); e.baseClass;) t = e.upcast(t), e = e.baseClass;\n\t\treturn t;\n\t})(e, t), be[t]), Pe = class extends Error {\n\t\tconstructor(e) {\n\t\t\tsuper(e), this.name = "InternalError";\n\t\t}\n\t}, Ce = (e) => {\n\t\tthrow new Pe(e);\n\t}, ke = (e, t) => ((!t.ptrType || !t.ptr) && Ce("makeClassHandle requires ptr and ptrType"), !!t.smartPtrType != !!t.smartPtr && Ce("Both smartPtrType and smartPtr must be specified"), t.count = { value: 1 }, se(Object.create(e, { $$: {\n\t\tvalue: t,\n\t\twritable: !0\n\t} })));\n\tfunction Se(e) {\n\t\tvar t = this.getPointee(e);\n\t\tif (!t) return this.destructor(e), null;\n\t\tvar r = Te(this.registeredClass, t);\n\t\tif (void 0 !== r) {\n\t\t\tif (0 === r.$$.count.value) return r.$$.ptr = t, r.$$.smartPtr = e, r.clone();\n\t\t\tvar n = r.clone();\n\t\t\treturn this.destructor(e), n;\n\t\t}\n\t\tfunction a() {\n\t\t\treturn this.isSmartPointer ? ke(this.registeredClass.instancePrototype, {\n\t\t\t\tptrType: this.pointeeType,\n\t\t\t\tptr: t,\n\t\t\t\tsmartPtrType: this,\n\t\t\t\tsmartPtr: e\n\t\t\t}) : ke(this.registeredClass.instancePrototype, {\n\t\t\t\tptrType: this,\n\t\t\t\tptr: e\n\t\t\t});\n\t\t}\n\t\tvar i, o = pe[this.registeredClass.getActualType(t)];\n\t\tif (!o) return a.call(this);\n\t\ti = this.isConst ? o.constPointerType : o.pointerType;\n\t\tvar s = $e(t, this.registeredClass, i.registeredClass);\n\t\treturn null === s ? a.call(this) : this.isSmartPointer ? ke(i.registeredClass.instancePrototype, {\n\t\t\tptrType: i,\n\t\t\tptr: s,\n\t\t\tsmartPtrType: this,\n\t\t\tsmartPtr: e\n\t\t}) : ke(i.registeredClass.instancePrototype, {\n\t\t\tptrType: i,\n\t\t\tptr: s\n\t\t});\n\t}\n\tfunction Fe(e, t, r, n, a, i, o, s, u, c, l) {\n\t\tthis.name = e, this.registeredClass = t, this.isReference = r, this.isConst = n, this.isSmartPointer = a, this.pointeeType = i, this.sharingPolicy = o, this.rawGetPointee = s, this.rawConstructor = u, this.rawShare = c, this.rawDestructor = l, a || void 0 !== t.baseClass ? this.toWireType = ge : n ? (this.toWireType = ye, this.destructorFunction = null) : (this.toWireType = _e, this.destructorFunction = null);\n\t}\n\tvar Ae, De = (e, t, r) => {\n\t\tn.hasOwnProperty(e) || Ce("Replacing nonexistent public symbol"), void 0 !== n[e].overloadTable && void 0 !== r ? n[e].overloadTable[r] = t : (n[e] = t, n[e].argCount = r);\n\t}, We = [], Ee = (e) => {\n\t\tvar t = We[e];\n\t\treturn t || (We[e] = t = Ae.get(e)), t;\n\t}, xe = (e, t, r = !1) => {\n\t\te = Y(e);\n\t\tvar n = Ee(t);\n\t\treturn "function" != typeof n && Q(`unknown function pointer with signature ${e}: ${t}`), n;\n\t};\n\tclass Oe extends Error {}\n\tvar Re = (e) => {\n\t\tvar t = Be(e), r = Y(t);\n\t\treturn qe(t), r;\n\t}, Ue = (e, t) => {\n\t\tvar r = [], n = {};\n\t\tthrow t.forEach(function e(t) {\n\t\t\tif (!n[t] && !X[t]) {\n\t\t\t\tif (Z[t]) return void Z[t].forEach(e);\n\t\t\t\tr.push(t), n[t] = !0;\n\t\t\t}\n\t\t}), new Oe(`${e}: ` + r.map(Re).join([", "]));\n\t}, je = (e, t, r) => {\n\t\tfunction n(t) {\n\t\t\tvar n = r(t);\n\t\t\tn.length !== e.length && Ce("Mismatched type converter count");\n\t\t\tfor (var a = 0; a < e.length; ++a) ee(e[a], n[a]);\n\t\t}\n\t\te.forEach((e) => Z[e] = t);\n\t\tvar a = new Array(t.length), i = [], o = 0;\n\t\tt.forEach((e, t) => {\n\t\t\tX.hasOwnProperty(e) ? a[t] = X[e] : (i.push(e), G.hasOwnProperty(e) || (G[e] = []), G[e].push(() => {\n\t\t\t\ta[t] = X[e], ++o === i.length && n(a);\n\t\t\t}));\n\t\t}), 0 === i.length && n(a);\n\t}, He = (e) => {\n\t\tfor (; e.length;) {\n\t\t\tvar t = e.pop();\n\t\t\te.pop()(t);\n\t\t}\n\t};\n\tfunction Ie(e) {\n\t\tfor (var t = 1; t < e.length; ++t) if (null !== e[t] && void 0 === e[t].destructorFunction) return !0;\n\t\treturn !1;\n\t}\n\tfunction Ve(e, t, r, n, a, i) {\n\t\tvar o = t.length;\n\t\to < 2 && Q("argTypes array size mismatch! Must at least get return value and \'this\' types!");\n\t\tfor (var s = null !== t[1] && null !== r, u = Ie(t), c = !t[0].isVoid, l = t[0], p = t[1], d = [\n\t\t\te,\n\t\t\tQ,\n\t\t\tn,\n\t\t\ta,\n\t\t\tHe,\n\t\t\tl.fromWireType.bind(l),\n\t\t\tp?.toWireType.bind(p)\n\t\t], f = 2; f < o; ++f) {\n\t\t\tvar h = t[f];\n\t\t\td.push(h.toWireType.bind(h));\n\t\t}\n\t\tif (!u) for (f = s ? 1 : 2; f < t.length; ++f) null !== t[f].destructorFunction && d.push(t[f].destructorFunction);\n\t\treturn le(e, function(e, t, r, n) {\n\t\t\tvar a = Ie(e), i = e.length - 2, o = [], s = ["fn"];\n\t\t\tt && s.push("thisWired");\n\t\t\tfor (var u = 0; u < i; ++u) o.push(`arg${u}`), s.push(`arg${u}Wired`);\n\t\t\to = o.join(","), s = s.join(",");\n\t\t\tvar c = `return function (${o}) {\\n`;\n\t\t\ta && (c += "var destructors = [];\\n");\n\t\t\tvar l = a ? "destructors" : "null", p = [\n\t\t\t\t"humanName",\n\t\t\t\t"throwBindingError",\n\t\t\t\t"invoker",\n\t\t\t\t"fn",\n\t\t\t\t"runDestructors",\n\t\t\t\t"fromRetWire",\n\t\t\t\t"toClassParamWire"\n\t\t\t];\n\t\t\tfor (t && (c += `var thisWired = toClassParamWire(${l}, this);\\n`), u = 0; u < i; ++u) {\n\t\t\t\tvar d = `toArg${u}Wire`;\n\t\t\t\tc += `var arg${u}Wired = ${d}(${l}, arg${u});\\n`, p.push(d);\n\t\t\t}\n\t\t\tif (c += (r || n ? "var rv = " : "") + `invoker(${s});\\n`, a) c += "runDestructors(destructors);\\n";\n\t\t\telse for (u = t ? 1 : 2; u < e.length; ++u) {\n\t\t\t\tvar f = 1 === u ? "thisWired" : "arg" + (u - 2) + "Wired";\n\t\t\t\tnull !== e[u].destructorFunction && (c += `${f}_dtor(${f});\\n`, p.push(`${f}_dtor`));\n\t\t\t}\n\t\t\treturn r && (c += "var ret = fromRetWire(rv);\\nreturn ret;\\n"), c += "}\\n", new Function(p, c);\n\t\t}(t, s, c, i)(...d));\n\t}\n\tvar Be, Me, qe, Le, ze, Ne, Je, Ye, Ge, Xe, Ze, Ke, Qe, et = (e, t) => {\n\t\tfor (var r = [], n = 0; n < e; n++) r.push(g[t + 4 * n >> 2]);\n\t\treturn r;\n\t}, tt = (e) => {\n\t\tconst t = (e = e.trim()).indexOf("(");\n\t\treturn -1 === t ? e : e.slice(0, t);\n\t}, rt = (e, t, r) => (e instanceof Object || Q(`${r} with invalid "this": ${e}`), e instanceof t.registeredClass.constructor || Q(`${r} incompatible with "this" of type ${e.constructor.name}`), e.$$.ptr || Q(`cannot call emscripten binding method ${r} on deleted object`), ve(e.$$.ptr, e.$$.ptrType.registeredClass, t.registeredClass)), nt = [], at = [\n\t\t0,\n\t\t1,\n\t\t,\n\t\t1,\n\t\tnull,\n\t\t1,\n\t\t!0,\n\t\t1,\n\t\t!1,\n\t\t1\n\t], it = (e) => {\n\t\te > 9 && 0 === --at[e + 1] && (at[e] = void 0, nt.push(e));\n\t}, ot = {\n\t\ttoValue: (e) => (e || Q(`Cannot use deleted val. handle = ${e}`), at[e]),\n\t\ttoHandle: (e) => {\n\t\t\tswitch (e) {\n\t\t\t\tcase void 0: return 2;\n\t\t\t\tcase null: return 4;\n\t\t\t\tcase !0: return 6;\n\t\t\t\tcase !1: return 8;\n\t\t\t\tdefault: {\n\t\t\t\t\tconst t = nt.pop() || at.length;\n\t\t\t\t\treturn at[t] = e, at[t + 1] = 1, t;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, st = {\n\t\tname: "emscripten::val",\n\t\tfromWireType: (e) => {\n\t\t\tvar t = ot.toValue(e);\n\t\t\treturn it(e), t;\n\t\t},\n\t\ttoWireType: (e, t) => ot.toHandle(t),\n\t\treadValueFromPointer: we,\n\t\tdestructorFunction: null\n\t}, ut = (e, t, r) => {\n\t\tswitch (t) {\n\t\t\tcase 1: return r ? function(e) {\n\t\t\t\treturn this.fromWireType(f[e]);\n\t\t\t} : function(e) {\n\t\t\t\treturn this.fromWireType(h[e]);\n\t\t\t};\n\t\t\tcase 2: return r ? function(e) {\n\t\t\t\treturn this.fromWireType(v[e >> 1]);\n\t\t\t} : function(e) {\n\t\t\t\treturn this.fromWireType(m[e >> 1]);\n\t\t\t};\n\t\t\tcase 4: return r ? function(e) {\n\t\t\t\treturn this.fromWireType(y[e >> 2]);\n\t\t\t} : function(e) {\n\t\t\t\treturn this.fromWireType(g[e >> 2]);\n\t\t\t};\n\t\t\tdefault: throw new TypeError(`invalid integer width (${t}): ${e}`);\n\t\t}\n\t}, ct = (e, t) => {\n\t\tvar r = X[e];\n\t\treturn void 0 === r && Q(`${t} has unknown type ${Re(e)}`), r;\n\t}, lt = (e, t) => {\n\t\tswitch (t) {\n\t\t\tcase 4: return function(e) {\n\t\t\t\treturn this.fromWireType(_[e >> 2]);\n\t\t\t};\n\t\t\tcase 8: return function(e) {\n\t\t\t\treturn this.fromWireType(w[e >> 3]);\n\t\t\t};\n\t\t\tdefault: throw new TypeError(`invalid float width (${t}): ${e}`);\n\t\t}\n\t}, pt = (e, t, r) => ((e, t, r, n) => {\n\t\tif (!(n > 0)) return 0;\n\t\tfor (var a = r, i = r + n - 1, o = 0; o < e.length; ++o) {\n\t\t\tvar s = e.codePointAt(o);\n\t\t\tif (s <= 127) {\n\t\t\t\tif (r >= i) break;\n\t\t\t\tt[r++] = s;\n\t\t\t} else if (s <= 2047) {\n\t\t\t\tif (r + 1 >= i) break;\n\t\t\t\tt[r++] = 192 | s >> 6, t[r++] = 128 | 63 & s;\n\t\t\t} else if (s <= 65535) {\n\t\t\t\tif (r + 2 >= i) break;\n\t\t\t\tt[r++] = 224 | s >> 12, t[r++] = 128 | s >> 6 & 63, t[r++] = 128 | 63 & s;\n\t\t\t} else {\n\t\t\t\tif (r + 3 >= i) break;\n\t\t\t\tt[r++] = 240 | s >> 18, t[r++] = 128 | s >> 12 & 63, t[r++] = 128 | s >> 6 & 63, t[r++] = 128 | 63 & s, o++;\n\t\t\t}\n\t\t}\n\t\treturn t[r] = 0, r - a;\n\t})(e, h, t, r), dt = (e) => {\n\t\tfor (var t = 0, r = 0; r < e.length; ++r) {\n\t\t\tvar n = e.charCodeAt(r);\n\t\t\tn <= 127 ? t++ : n <= 2047 ? t += 2 : n >= 55296 && n <= 57343 ? (t += 4, ++r) : t += 3;\n\t\t}\n\t\treturn t;\n\t}, ft = typeof TextDecoder < "u" ? new TextDecoder() : void 0, ht = (e, t, r, n) => {\n\t\tvar a = t + r;\n\t\tif (n) return a;\n\t\tfor (; e[t] && !(t >= a);) ++t;\n\t\treturn t;\n\t}, vt = (e, t = 0, r, n) => {\n\t\tvar a = ht(e, t, r, n);\n\t\tif (a - t > 16 && e.buffer && ft) return ft.decode(e.subarray(t, a));\n\t\tfor (var i = ""; t < a;) {\n\t\t\tvar o = e[t++];\n\t\t\tif (128 & o) {\n\t\t\t\tvar s = 63 & e[t++];\n\t\t\t\tif (192 != (224 & o)) {\n\t\t\t\t\tvar u = 63 & e[t++];\n\t\t\t\t\tif ((o = 224 == (240 & o) ? (15 & o) << 12 | s << 6 | u : (7 & o) << 18 | s << 12 | u << 6 | 63 & e[t++]) < 65536) i += String.fromCharCode(o);\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar c = o - 65536;\n\t\t\t\t\t\ti += String.fromCharCode(55296 | c >> 10, 56320 | 1023 & c);\n\t\t\t\t\t}\n\t\t\t\t} else i += String.fromCharCode((31 & o) << 6 | s);\n\t\t\t} else i += String.fromCharCode(o);\n\t\t}\n\t\treturn i;\n\t}, mt = (e, t, r) => e ? vt(h, e, t, r) : "", yt = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, gt = (e, t, r) => {\n\t\tvar n = e >> 1, a = ht(m, n, t / 2, r);\n\t\tif (a - n > 16 && yt) return yt.decode(m.subarray(n, a));\n\t\tfor (var i = "", o = n; o < a; ++o) {\n\t\t\tvar s = m[o];\n\t\t\ti += String.fromCharCode(s);\n\t\t}\n\t\treturn i;\n\t}, _t = (e, t, r) => {\n\t\tif (r ??= 2147483647, r < 2) return 0;\n\t\tfor (var n = t, a = (r -= 2) < 2 * e.length ? r / 2 : e.length, i = 0; i < a; ++i) {\n\t\t\tvar o = e.charCodeAt(i);\n\t\t\tv[t >> 1] = o, t += 2;\n\t\t}\n\t\treturn v[t >> 1] = 0, t - n;\n\t}, wt = (e) => 2 * e.length, $t = (e, t, r) => {\n\t\tfor (var n = "", a = e >> 2, i = 0; !(i >= t / 4); i++) {\n\t\t\tvar o = g[a + i];\n\t\t\tif (!o && !r) break;\n\t\t\tn += String.fromCodePoint(o);\n\t\t}\n\t\treturn n;\n\t}, bt = (e, t, r) => {\n\t\tif (r ??= 2147483647, r < 4) return 0;\n\t\tfor (var n = t, a = n + r - 4, i = 0; i < e.length; ++i) {\n\t\t\tvar o = e.codePointAt(i);\n\t\t\tif (o > 65535 && i++, y[t >> 2] = o, (t += 4) + 4 > a) break;\n\t\t}\n\t\treturn y[t >> 2] = 0, t - n;\n\t}, Tt = (e) => {\n\t\tfor (var t = 0, r = 0; r < e.length; ++r) e.codePointAt(r) > 65535 && r++, t += 4;\n\t\treturn t;\n\t}, Pt = 0, Ct = [], kt = (e, t, r) => {\n\t\tvar n = [], a = e(n, r);\n\t\treturn n.length && (g[t >> 2] = ot.toHandle(n)), a;\n\t}, St = {}, Ft = (e) => {\n\t\tvar t = St[e];\n\t\treturn void 0 === t ? Y(e) : t;\n\t}, At = (e) => e < -9007199254740992 || e > 9007199254740992 ? NaN : Number(e), Dt = [\n\t\t0,\n\t\t31,\n\t\t60,\n\t\t91,\n\t\t121,\n\t\t152,\n\t\t182,\n\t\t213,\n\t\t244,\n\t\t274,\n\t\t305,\n\t\t335\n\t], Wt = [\n\t\t0,\n\t\t31,\n\t\t59,\n\t\t90,\n\t\t120,\n\t\t151,\n\t\t181,\n\t\t212,\n\t\t243,\n\t\t273,\n\t\t304,\n\t\t334\n\t], Et = {}, xt = (e) => {\n\t\tif (e instanceof x || "unwind" == e) return c;\n\t\ti(0, e);\n\t}, Ot = () => I || Pt > 0, Rt = (e) => {\n\t\tc = e, Ot() || (n.onExit?.(e), k = !0), i(0, new x(e));\n\t}, Ut = (e, t) => {\n\t\tc = e, Rt(e);\n\t}, jt = (e) => {\n\t\tif (!k) try {\n\t\t\te(), (() => {\n\t\t\t\tif (!Ot()) try {\n\t\t\t\t\tUt(c);\n\t\t\t\t} catch (e) {\n\t\t\t\t\txt(e);\n\t\t\t\t}\n\t\t\t})();\n\t\t} catch (t) {\n\t\t\txt(t);\n\t\t}\n\t}, Ht = () => performance.now(), It = (e, t) => Math.ceil(e / t) * t, Vt = (e) => {\n\t\tvar t = (e - d.buffer.byteLength + 65535) / 65536 | 0;\n\t\ttry {\n\t\t\treturn d.grow(t), F(), 1;\n\t\t} catch {}\n\t}, Bt = {}, Mt = () => {\n\t\tif (!Mt.strings) {\n\t\t\tvar e = {\n\t\t\t\tUSER: "web_user",\n\t\t\t\tLOGNAME: "web_user",\n\t\t\t\tPATH: "/",\n\t\t\t\tPWD: "/",\n\t\t\t\tHOME: "/home/web_user",\n\t\t\t\tLANG: ("object" == typeof navigator && navigator.language || "C").replace("-", "_") + ".UTF-8",\n\t\t\t\t_: a || "./this.program"\n\t\t\t};\n\t\t\tfor (var t in Bt) void 0 === Bt[t] ? delete e[t] : e[t] = Bt[t];\n\t\t\tvar r = [];\n\t\t\tfor (var t in e) r.push(`${t}=${e[t]}`);\n\t\t\tMt.strings = r;\n\t\t}\n\t\treturn Mt.strings;\n\t}, qt = [\n\t\tnull,\n\t\t[],\n\t\t[]\n\t], Lt = (e, t) => {\n\t\tvar r = qt[e];\n\t\t0 === t || 10 === t ? ((1 === e ? P : C)(vt(r)), r.length = 0) : r.push(t);\n\t}, zt = (e) => n["_" + e], Nt = (e) => Ye(e), Jt = (e, t, r, n, a) => {\n\t\tvar i = {\n\t\t\tstring: (e) => {\n\t\t\t\tvar t = 0;\n\t\t\t\treturn null != e && 0 !== e && (t = ((e) => {\n\t\t\t\t\tvar t = dt(e) + 1, r = Nt(t);\n\t\t\t\t\treturn pt(e, r, t), r;\n\t\t\t\t})(e)), t;\n\t\t\t},\n\t\t\tarray: (e) => {\n\t\t\t\tvar t = Nt(e.length);\n\t\t\t\treturn ((e, t) => {\n\t\t\t\t\tf.set(e, t);\n\t\t\t\t})(e, t), t;\n\t\t\t}\n\t\t};\n\t\tvar o = zt(e), s = [], u = 0;\n\t\tif (n) for (var c = 0; c < n.length; c++) {\n\t\t\tvar l = i[r[c]];\n\t\t\tl ? (0 === u && (u = B()), s[c] = l(n[c])) : s[c] = n[c];\n\t\t}\n\t\tvar p, d = o(...s);\n\t\treturn p = d, 0 !== u && V(u), d = function(e) {\n\t\t\treturn "string" === t ? mt(e) : "boolean" === t ? !!e : e;\n\t\t}(p), d;\n\t};\n\tif ((() => {\n\t\tlet e = ce.prototype;\n\t\tObject.assign(e, {\n\t\t\tisAliasOf(e) {\n\t\t\t\tif (!(this instanceof ce && e instanceof ce)) return !1;\n\t\t\t\tvar t = this.$$.ptrType.registeredClass, r = this.$$.ptr;\n\t\t\t\te.$$ = e.$$;\n\t\t\t\tfor (var n = e.$$.ptrType.registeredClass, a = e.$$.ptr; t.baseClass;) r = t.upcast(r), t = t.baseClass;\n\t\t\t\tfor (; n.baseClass;) a = n.upcast(a), n = n.baseClass;\n\t\t\t\treturn t === n && r === a;\n\t\t\t},\n\t\t\tclone() {\n\t\t\t\tif (this.$$.ptr || ne(this), this.$$.preservePointerOnDelete) return this.$$.count.value += 1, this;\n\t\t\t\tvar e = se(Object.create(Object.getPrototypeOf(this), { $$: { value: re(this.$$) } }));\n\t\t\t\treturn e.$$.count.value += 1, e.$$.deleteScheduled = !1, e;\n\t\t\t},\n\t\t\tdelete() {\n\t\t\t\tthis.$$.ptr || ne(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && Q("Object already scheduled for deletion"), ie(this), oe(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0);\n\t\t\t},\n\t\t\tisDeleted() {\n\t\t\t\treturn !this.$$.ptr;\n\t\t\t},\n\t\t\tdeleteLater() {\n\t\t\t\treturn this.$$.ptr || ne(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && Q("Object already scheduled for deletion"), ue.push(this), ue.length, this.$$.deleteScheduled = !0, this;\n\t\t\t}\n\t\t});\n\t\tconst t = Symbol.dispose;\n\t\tt && (e[t] = e.delete);\n\t})(), Object.assign(Fe.prototype, {\n\t\tgetPointee(e) {\n\t\t\treturn this.rawGetPointee && (e = this.rawGetPointee(e)), e;\n\t\t},\n\t\tdestructor(e) {\n\t\t\tthis.rawDestructor?.(e);\n\t\t},\n\t\treadValueFromPointer: we,\n\t\tfromWireType: Se\n\t}), n.noExitRuntime && (I = n.noExitRuntime), n.print && (P = n.print), n.printErr && (C = n.printErr), n.wasmBinary && (u = n.wasmBinary), n.arguments && n.arguments, n.thisProgram && (a = n.thisProgram), n.preInit) for ("function" == typeof n.preInit && (n.preInit = [n.preInit]); n.preInit.length > 0;) n.preInit.shift()();\n\tn.ENV = Bt, n.ccall = Jt, n.cwrap = (e, t, r, n) => {\n\t\tvar a = !r || r.every((e) => "number" === e || "boolean" === e);\n\t\treturn "string" !== t && a && !n ? zt(e) : (...n) => Jt(e, t, r, n);\n\t};\n\tvar Yt, Gt = {\n\t\t__cxa_begin_catch: (e) => {\n\t\t\tvar t = new z(e);\n\t\t\treturn t.get_caught() || (t.set_caught(!0), q--), t.set_rethrown(!1), M.push(t), Ze(e), Qe(e);\n\t\t},\n\t\t__cxa_end_catch: () => {\n\t\t\tze(0, 0);\n\t\t\tvar e = M.pop();\n\t\t\tXe(e.excPtr), L = 0;\n\t\t},\n\t\t__cxa_find_matching_catch_2: () => J([]),\n\t\t__cxa_find_matching_catch_3: (e) => J([e]),\n\t\t__cxa_find_matching_catch_4: (e, t) => J([e, t]),\n\t\t__cxa_rethrow: () => {\n\t\t\tvar e = M.pop();\n\t\t\te || A("no exception to throw");\n\t\t\tvar t = e.excPtr;\n\t\t\tthrow e.get_rethrown() || (M.push(e), e.set_rethrown(!0), e.set_caught(!1), q++), L = t;\n\t\t},\n\t\t__cxa_throw: (e, t, r) => {\n\t\t\tthrow new z(e).init(t, r), q++, L = e;\n\t\t},\n\t\t__cxa_uncaught_exceptions: () => q,\n\t\t__resumeException: (e) => {\n\t\t\tthrow L || (L = e), L;\n\t\t},\n\t\t_abort_js: () => A(""),\n\t\t_embind_register_bigint: (e, t, r, n, a) => {\n\t\t\tt = Y(t);\n\t\t\tconst i = 0n === n;\n\t\t\tlet o = (e) => e;\n\t\t\tif (i) {\n\t\t\t\tconst e = 8 * r;\n\t\t\t\to = (t) => BigInt.asUintN(e, t), a = o(a);\n\t\t\t}\n\t\t\tee(e, {\n\t\t\t\tname: t,\n\t\t\t\tfromWireType: o,\n\t\t\t\ttoWireType: (e, t) => ("number" == typeof t && (t = BigInt(t)), t),\n\t\t\t\treadValueFromPointer: te(t, r, !i),\n\t\t\t\tdestructorFunction: null\n\t\t\t});\n\t\t},\n\t\t_embind_register_bool: (e, t, r, n) => {\n\t\t\tee(e, {\n\t\t\t\tname: t = Y(t),\n\t\t\t\tfromWireType: function(e) {\n\t\t\t\t\treturn !!e;\n\t\t\t\t},\n\t\t\t\ttoWireType: function(e, t) {\n\t\t\t\t\treturn t ? r : n;\n\t\t\t\t},\n\t\t\t\treadValueFromPointer: function(e) {\n\t\t\t\t\treturn this.fromWireType(h[e]);\n\t\t\t\t},\n\t\t\t\tdestructorFunction: null\n\t\t\t});\n\t\t},\n\t\t_embind_register_class: (e, t, r, n, a, i, o, s, u, c, l, p, d) => {\n\t\t\tl = Y(l), i = xe(a, i), s &&= xe(o, s), c &&= xe(u, c), d = xe(p, d);\n\t\t\tvar f = ((e) => {\n\t\t\t\tvar t = (e = e.replace(/[^a-zA-Z0-9_]/g, "$")).charCodeAt(0);\n\t\t\t\treturn t >= 48 && t <= 57 ? `_${e}` : e;\n\t\t\t})(l);\n\t\t\tfe(f, function() {\n\t\t\t\tUe(`Cannot construct ${l} due to unbound types`, [n]);\n\t\t\t}), je([\n\t\t\t\te,\n\t\t\t\tt,\n\t\t\t\tr\n\t\t\t], n ? [n] : [], (t) => {\n\t\t\t\tvar r, a;\n\t\t\t\tt = t[0], n ? a = (r = t.registeredClass).instancePrototype : a = ce.prototype;\n\t\t\t\tvar o = le(l, function(...e) {\n\t\t\t\t\tif (Object.getPrototypeOf(this) !== u) throw new K(`Use \'new\' to construct ${l}`);\n\t\t\t\t\tif (void 0 === p.constructor_body) throw new K(`${l} has no accessible constructor`);\n\t\t\t\t\tvar t = p.constructor_body[e.length];\n\t\t\t\t\tif (void 0 === t) throw new K(`Tried to invoke ctor of ${l} with invalid number of parameters (${e.length}) - expected (${Object.keys(p.constructor_body).toString()}) parameters instead!`);\n\t\t\t\t\treturn t.apply(this, e);\n\t\t\t\t}), u = Object.create(a, { constructor: { value: o } });\n\t\t\t\to.prototype = u;\n\t\t\t\tvar p = new he(l, o, u, d, r, i, s, c);\n\t\t\t\tp.baseClass && (p.baseClass.__derivedClasses ??= [], p.baseClass.__derivedClasses.push(p));\n\t\t\t\tvar h = new Fe(l, p, !0, !1, !1), v = new Fe(l + "*", p, !1, !1, !1), m = new Fe(l + " const*", p, !1, !0, !1);\n\t\t\t\treturn pe[e] = {\n\t\t\t\t\tpointerType: v,\n\t\t\t\t\tconstPointerType: m\n\t\t\t\t}, De(f, o), [\n\t\t\t\t\th,\n\t\t\t\t\tv,\n\t\t\t\t\tm\n\t\t\t\t];\n\t\t\t});\n\t\t},\n\t\t_embind_register_class_class_function: (e, t, r, n, a, i, o, s, u) => {\n\t\t\tvar c = et(r, n);\n\t\t\tt = Y(t), t = tt(t), i = xe(a, i, s), je([], [e], (e) => {\n\t\t\t\tvar n = `${(e = e[0]).name}.${t}`;\n\t\t\t\tfunction a() {\n\t\t\t\t\tUe(`Cannot call ${n} due to unbound types`, c);\n\t\t\t\t}\n\t\t\t\tt.startsWith("@@") && (t = Symbol[t.substring(2)]);\n\t\t\t\tvar u = e.registeredClass.constructor;\n\t\t\t\treturn void 0 === u[t] ? (a.argCount = r - 1, u[t] = a) : (de(u, t, n), u[t].overloadTable[r - 1] = a), je([], c, (a) => {\n\t\t\t\t\tvar c = Ve(n, [a[0], null].concat(a.slice(1)), null, i, o, s);\n\t\t\t\t\tif (void 0 === u[t].overloadTable ? (c.argCount = r - 1, u[t] = c) : u[t].overloadTable[r - 1] = c, e.registeredClass.__derivedClasses) for (const r of e.registeredClass.__derivedClasses) r.constructor.hasOwnProperty(t) || (r.constructor[t] = c);\n\t\t\t\t\treturn [];\n\t\t\t\t}), [];\n\t\t\t});\n\t\t},\n\t\t_embind_register_class_constructor: (e, t, r, n, a, i) => {\n\t\t\tvar o = et(t, r);\n\t\t\ta = xe(n, a), je([], [e], (e) => {\n\t\t\t\tvar r = `constructor ${(e = e[0]).name}`;\n\t\t\t\tif (void 0 === e.registeredClass.constructor_body && (e.registeredClass.constructor_body = []), void 0 !== e.registeredClass.constructor_body[t - 1]) throw new K(`Cannot register multiple constructors with identical number of parameters (${t - 1}) for class \'${e.name}\'! Overload resolution is currently only performed using the parameter count, not actual type info!`);\n\t\t\t\treturn e.registeredClass.constructor_body[t - 1] = () => {\n\t\t\t\t\tUe(`Cannot construct ${e.name} due to unbound types`, o);\n\t\t\t\t}, je([], o, (n) => (n.splice(1, 0, null), e.registeredClass.constructor_body[t - 1] = Ve(r, n, null, a, i), [])), [];\n\t\t\t});\n\t\t},\n\t\t_embind_register_class_function: (e, t, r, n, a, i, o, s, u, c) => {\n\t\t\tvar l = et(r, n);\n\t\t\tt = Y(t), t = tt(t), i = xe(a, i, u), je([], [e], (e) => {\n\t\t\t\tvar n = `${(e = e[0]).name}.${t}`;\n\t\t\t\tfunction a() {\n\t\t\t\t\tUe(`Cannot call ${n} due to unbound types`, l);\n\t\t\t\t}\n\t\t\t\tt.startsWith("@@") && (t = Symbol[t.substring(2)]), s && e.registeredClass.pureVirtualFunctions.push(t);\n\t\t\t\tvar c = e.registeredClass.instancePrototype, p = c[t];\n\t\t\t\treturn void 0 === p || void 0 === p.overloadTable && p.className !== e.name && p.argCount === r - 2 ? (a.argCount = r - 2, a.className = e.name, c[t] = a) : (de(c, t, n), c[t].overloadTable[r - 2] = a), je([], l, (a) => {\n\t\t\t\t\tvar s = Ve(n, a, e, i, o, u);\n\t\t\t\t\treturn void 0 === c[t].overloadTable ? (s.argCount = r - 2, c[t] = s) : c[t].overloadTable[r - 2] = s, [];\n\t\t\t\t}), [];\n\t\t\t});\n\t\t},\n\t\t_embind_register_class_property: (e, t, r, n, a, i, o, s, u, c) => {\n\t\t\tt = Y(t), a = xe(n, a), je([], [e], (e) => {\n\t\t\t\tvar n = `${(e = e[0]).name}.${t}`, l = {\n\t\t\t\t\tget() {\n\t\t\t\t\t\tUe(`Cannot access ${n} due to unbound types`, [r, o]);\n\t\t\t\t\t},\n\t\t\t\t\tenumerable: !0,\n\t\t\t\t\tconfigurable: !0\n\t\t\t\t};\n\t\t\t\treturn l.set = u ? () => Ue(`Cannot access ${n} due to unbound types`, [r, o]) : (e) => Q(n + " is a read-only property"), Object.defineProperty(e.registeredClass.instancePrototype, t, l), je([], u ? [r, o] : [r], (r) => {\n\t\t\t\t\tvar o = r[0], l = {\n\t\t\t\t\t\tget() {\n\t\t\t\t\t\t\tvar t = rt(this, e, n + " getter");\n\t\t\t\t\t\t\treturn o.fromWireType(a(i, t));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tenumerable: !0\n\t\t\t\t\t};\n\t\t\t\t\tif (u) {\n\t\t\t\t\t\tu = xe(s, u);\n\t\t\t\t\t\tvar p = r[1];\n\t\t\t\t\t\tl.set = function(t) {\n\t\t\t\t\t\t\tvar r = rt(this, e, n + " setter"), a = [];\n\t\t\t\t\t\t\tu(c, r, p.toWireType(a, t)), He(a);\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn Object.defineProperty(e.registeredClass.instancePrototype, t, l), [];\n\t\t\t\t}), [];\n\t\t\t});\n\t\t},\n\t\t_embind_register_emval: (e) => ee(e, st),\n\t\t_embind_register_enum: (e, t, r, n) => {\n\t\t\tfunction a() {}\n\t\t\tt = Y(t), a.values = {}, ee(e, {\n\t\t\t\tname: t,\n\t\t\t\tconstructor: a,\n\t\t\t\tfromWireType: function(e) {\n\t\t\t\t\treturn this.constructor.values[e];\n\t\t\t\t},\n\t\t\t\ttoWireType: (e, t) => t.value,\n\t\t\t\treadValueFromPointer: ut(t, r, n),\n\t\t\t\tdestructorFunction: null\n\t\t\t}), fe(t, a);\n\t\t},\n\t\t_embind_register_enum_value: (e, t, r) => {\n\t\t\tvar n = ct(e, "enum");\n\t\t\tt = Y(t);\n\t\t\tvar a = n.constructor, i = Object.create(n.constructor.prototype, {\n\t\t\t\tvalue: { value: r },\n\t\t\t\tconstructor: { value: le(`${n.name}_${t}`, function() {}) }\n\t\t\t});\n\t\t\ta.values[r] = i, a[t] = i;\n\t\t},\n\t\t_embind_register_float: (e, t, r) => {\n\t\t\tee(e, {\n\t\t\t\tname: t = Y(t),\n\t\t\t\tfromWireType: (e) => e,\n\t\t\t\ttoWireType: (e, t) => t,\n\t\t\t\treadValueFromPointer: lt(t, r),\n\t\t\t\tdestructorFunction: null\n\t\t\t});\n\t\t},\n\t\t_embind_register_function: (e, t, r, n, a, i, o, s) => {\n\t\t\tvar u = et(t, r);\n\t\t\te = Y(e), e = tt(e), a = xe(n, a, o), fe(e, function() {\n\t\t\t\tUe(`Cannot call ${e} due to unbound types`, u);\n\t\t\t}, t - 1), je([], u, (r) => {\n\t\t\t\tvar n = [r[0], null].concat(r.slice(1));\n\t\t\t\treturn De(e, Ve(e, n, null, a, i, o), t - 1), [];\n\t\t\t});\n\t\t},\n\t\t_embind_register_integer: (e, t, r, n, a) => {\n\t\t\tt = Y(t);\n\t\t\tlet i = (e) => e;\n\t\t\tif (0 === n) {\n\t\t\t\tvar o = 32 - 8 * r;\n\t\t\t\ti = (e) => e << o >>> o, a = i(a);\n\t\t\t}\n\t\t\tee(e, {\n\t\t\t\tname: t,\n\t\t\t\tfromWireType: i,\n\t\t\t\ttoWireType: (e, t) => t,\n\t\t\t\treadValueFromPointer: te(t, r, 0 !== n),\n\t\t\t\tdestructorFunction: null\n\t\t\t});\n\t\t},\n\t\t_embind_register_memory_view: (e, t, r) => {\n\t\t\tvar n = [\n\t\t\t\tInt8Array,\n\t\t\t\tUint8Array,\n\t\t\t\tInt16Array,\n\t\t\t\tUint16Array,\n\t\t\t\tInt32Array,\n\t\t\t\tUint32Array,\n\t\t\t\tFloat32Array,\n\t\t\t\tFloat64Array,\n\t\t\t\tBigInt64Array,\n\t\t\t\tBigUint64Array\n\t\t\t][t];\n\t\t\tfunction a(e) {\n\t\t\t\tvar t = g[e >> 2], r = g[e + 4 >> 2];\n\t\t\t\treturn new n(f.buffer, r, t);\n\t\t\t}\n\t\t\tee(e, {\n\t\t\t\tname: r = Y(r),\n\t\t\t\tfromWireType: a,\n\t\t\t\treadValueFromPointer: a\n\t\t\t}, { ignoreDuplicateRegistrations: !0 });\n\t\t},\n\t\t_embind_register_std_string: (e, t) => {\n\t\t\tt = Y(t);\n\t\t\tee(e, {\n\t\t\t\tname: t,\n\t\t\t\tfromWireType(e) {\n\t\t\t\t\tvar t, r = g[e >> 2];\n\t\t\t\t\treturn t = mt(e + 4, r, !0), qe(e), t;\n\t\t\t\t},\n\t\t\t\ttoWireType(e, t) {\n\t\t\t\t\tt instanceof ArrayBuffer && (t = new Uint8Array(t));\n\t\t\t\t\tvar r, n = "string" == typeof t;\n\t\t\t\t\tn || ArrayBuffer.isView(t) && 1 == t.BYTES_PER_ELEMENT || Q("Cannot pass non-string to std::string"), r = n ? dt(t) : t.length;\n\t\t\t\t\tvar a = Me(4 + r + 1), i = a + 4;\n\t\t\t\t\t(g[a >> 2] = r, n) ? pt(t, i, r + 1) : h.set(t, i);\n\t\t\t\t\treturn null !== e && e.push(qe, a), a;\n\t\t\t\t},\n\t\t\t\treadValueFromPointer: we,\n\t\t\t\tdestructorFunction(e) {\n\t\t\t\t\tqe(e);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\t_embind_register_std_wstring: (e, t, r) => {\n\t\t\tvar n, a, i;\n\t\t\tr = Y(r), 2 === t ? (n = gt, a = _t, i = wt) : (n = $t, a = bt, i = Tt), ee(e, {\n\t\t\t\tname: r,\n\t\t\t\tfromWireType: (e) => {\n\t\t\t\t\tvar r = g[e >> 2], a = n(e + 4, r * t, !0);\n\t\t\t\t\treturn qe(e), a;\n\t\t\t\t},\n\t\t\t\ttoWireType: (e, n) => {\n\t\t\t\t\t"string" != typeof n && Q(`Cannot pass non-string to C++ string type ${r}`);\n\t\t\t\t\tvar o = i(n), s = Me(4 + o + t);\n\t\t\t\t\treturn g[s >> 2] = o / t, a(n, s + 4, o + t), null !== e && e.push(qe, s), s;\n\t\t\t\t},\n\t\t\t\treadValueFromPointer: we,\n\t\t\t\tdestructorFunction(e) {\n\t\t\t\t\tqe(e);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\t_embind_register_void: (e, t) => {\n\t\t\tee(e, {\n\t\t\t\tisVoid: !0,\n\t\t\t\tname: t = Y(t),\n\t\t\t\tfromWireType: () => {},\n\t\t\t\ttoWireType: (e, t) => {}\n\t\t\t});\n\t\t},\n\t\t_emscripten_runtime_keepalive_clear: () => {\n\t\t\tI = !1, Pt = 0;\n\t\t},\n\t\t_emval_create_invoker: (e, t, r) => {\n\t\t\tvar [n, ...a] = ((e, t) => {\n\t\t\t\tfor (var r = new Array(e), n = 0; n < e; ++n) r[n] = ct(g[t + 4 * n >> 2], `parameter ${n}`);\n\t\t\t\treturn r;\n\t\t\t})(e, t), i = n.toWireType.bind(n), o = a.map((e) => e.readValueFromPointer.bind(e));\n\t\t\te--;\n\t\t\tvar s, u = { toValue: ot.toValue }, c = o.map((e, t) => {\n\t\t\t\tvar r = `argFromPtr${t}`;\n\t\t\t\treturn u[r] = e, `${r}(args${t ? "+" + 8 * t : ""})`;\n\t\t\t});\n\t\t\tswitch (r) {\n\t\t\t\tcase 0:\n\t\t\t\t\ts = "toValue(handle)";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\ts = "new (toValue(handle))";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\ts = "";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1: u.getStringOrSymbol = Ft, s = "toValue(handle)[getStringOrSymbol(methodName)]";\n\t\t\t}\n\t\t\ts += `(${c})`, n.isVoid || (u.toReturnWire = i, u.emval_returnValue = kt, s = `return emval_returnValue(toReturnWire, destructorsRef, ${s})`), s = `return function (handle, methodName, destructorsRef, args) {\\n ${s}\\n }`;\n\t\t\tvar l = new Function(Object.keys(u), s)(...Object.values(u));\n\t\t\treturn ((e) => {\n\t\t\t\tvar t = Ct.length;\n\t\t\t\treturn Ct.push(e), t;\n\t\t\t})(le(`methodCaller<(${a.map((e) => e.name)}) => ${n.name}>`, l));\n\t\t},\n\t\t_emval_decref: it,\n\t\t_emval_invoke: (e, t, r, n, a) => Ct[e](t, r, n, a),\n\t\t_emval_new_object: () => ot.toHandle({}),\n\t\t_emval_run_destructors: (e) => {\n\t\t\tHe(ot.toValue(e)), it(e);\n\t\t},\n\t\t_emval_set_property: (e, t, r) => {\n\t\t\te = ot.toValue(e), t = ot.toValue(t), r = ot.toValue(r), e[t] = r;\n\t\t},\n\t\t_gmtime_js: function(e, t) {\n\t\t\te = At(e);\n\t\t\tvar r = /* @__PURE__ */ new Date(1e3 * e);\n\t\t\ty[t >> 2] = r.getUTCSeconds(), y[t + 4 >> 2] = r.getUTCMinutes(), y[t + 8 >> 2] = r.getUTCHours(), y[t + 12 >> 2] = r.getUTCDate(), y[t + 16 >> 2] = r.getUTCMonth(), y[t + 20 >> 2] = r.getUTCFullYear() - 1900, y[t + 24 >> 2] = r.getUTCDay();\n\t\t\tvar n = Date.UTC(r.getUTCFullYear(), 0, 1, 0, 0, 0, 0), a = (r.getTime() - n) / 864e5 | 0;\n\t\t\ty[t + 28 >> 2] = a;\n\t\t},\n\t\t_localtime_js: function(e, t) {\n\t\t\te = At(e);\n\t\t\tvar r = /* @__PURE__ */ new Date(1e3 * e);\n\t\t\ty[t >> 2] = r.getSeconds(), y[t + 4 >> 2] = r.getMinutes(), y[t + 8 >> 2] = r.getHours(), y[t + 12 >> 2] = r.getDate(), y[t + 16 >> 2] = r.getMonth(), y[t + 20 >> 2] = r.getFullYear() - 1900, y[t + 24 >> 2] = r.getDay();\n\t\t\tvar n = 0 | ((e) => (((e) => e % 4 == 0 && (e % 100 != 0 || e % 400 == 0))(e.getFullYear()) ? Dt : Wt)[e.getMonth()] + e.getDate() - 1)(r);\n\t\t\ty[t + 28 >> 2] = n, y[t + 36 >> 2] = -60 * r.getTimezoneOffset();\n\t\t\tvar a = new Date(r.getFullYear(), 0, 1), i = new Date(r.getFullYear(), 6, 1).getTimezoneOffset(), o = a.getTimezoneOffset(), s = 0 | (i != o && r.getTimezoneOffset() == Math.min(o, i));\n\t\t\ty[t + 32 >> 2] = s;\n\t\t},\n\t\t_setitimer_js: (e, t) => (Et[e] && (clearTimeout(Et[e].id), delete Et[e]), t ? (Et[e] = {\n\t\t\tid: setTimeout(() => {\n\t\t\t\tdelete Et[e], jt(() => Le(e, Ht()));\n\t\t\t}, t),\n\t\t\ttimeout_ms: t\n\t\t}, 0) : 0),\n\t\t_tzset_js: (e, t, r, n) => {\n\t\t\tvar a = /* @__PURE__ */ (/* @__PURE__ */ new Date()).getFullYear(), i = new Date(a, 0, 1), o = new Date(a, 6, 1), s = i.getTimezoneOffset(), u = o.getTimezoneOffset(), c = Math.max(s, u);\n\t\t\tg[e >> 2] = 60 * c, y[t >> 2] = +(s != u);\n\t\t\tvar l = (e) => {\n\t\t\t\tvar t = e >= 0 ? "-" : "+", r = Math.abs(e);\n\t\t\t\treturn `UTC${t}${String(Math.floor(r / 60)).padStart(2, "0")}${String(r % 60).padStart(2, "0")}`;\n\t\t\t}, p = l(s), d = l(u);\n\t\t\tu < s ? (pt(p, r, 17), pt(d, n, 17)) : (pt(p, n, 17), pt(d, r, 17));\n\t\t},\n\t\tclock_time_get: function(e, t, r) {\n\t\t\tif (t = At(t), !((e) => e >= 0 && e <= 3)(e)) return 28;\n\t\t\tvar n = 0 === e ? Date.now() : Ht();\n\t\t\tvar a = Math.round(1e3 * n * 1e3);\n\t\t\treturn $[r >> 3] = BigInt(a), 0;\n\t\t},\n\t\temscripten_get_heap_max: () => 2147483648,\n\t\temscripten_resize_heap: (e) => {\n\t\t\tvar t = h.length, r = 2147483648;\n\t\t\tif ((e >>>= 0) > r) return !1;\n\t\t\tfor (var n = 1; n <= 4; n *= 2) {\n\t\t\t\tvar a = t * (1 + .2 / n);\n\t\t\t\tif (a = Math.min(a, e + 100663296), Vt(Math.min(r, It(Math.max(e, a), 65536)))) return !0;\n\t\t\t}\n\t\t\treturn !1;\n\t\t},\n\t\tenviron_get: (e, t) => {\n\t\t\tvar r = 0, n = 0;\n\t\t\tfor (var a of Mt()) {\n\t\t\t\tvar i = t + r;\n\t\t\t\tg[e + n >> 2] = i, r += pt(a, i, 1 / 0) + 1, n += 4;\n\t\t\t}\n\t\t\treturn 0;\n\t\t},\n\t\tenviron_sizes_get: (e, t) => {\n\t\t\tvar r = Mt();\n\t\t\tg[e >> 2] = r.length;\n\t\t\tvar n = 0;\n\t\t\tfor (var a of r) n += dt(a) + 1;\n\t\t\treturn g[t >> 2] = n, 0;\n\t\t},\n\t\tfd_close: (e) => 52,\n\t\tfd_fdstat_get: (e, t) => {\n\t\t\tvar r = 0;\n\t\t\treturn 0 == e ? r = 2 : (1 == e || 2 == e) && (r = 64), f[t] = 2, v[t + 2 >> 1] = 1, $[t + 8 >> 3] = BigInt(r), $[t + 16 >> 3] = BigInt(0), 0;\n\t\t},\n\t\tfd_seek: function(e, t, r, n) {\n\t\t\treturn t = At(t), 70;\n\t\t},\n\t\tfd_write: (e, t, r, n) => {\n\t\t\tfor (var a = 0, i = 0; i < r; i++) {\n\t\t\t\tvar o = g[t >> 2], s = g[t + 4 >> 2];\n\t\t\t\tt += 8;\n\t\t\t\tfor (var u = 0; u < s; u++) Lt(e, h[o + u]);\n\t\t\t\ta += s;\n\t\t\t}\n\t\t\treturn g[n >> 2] = a, 0;\n\t\t},\n\t\tinvoke_diii: function(e, t, r, n) {\n\t\t\tvar a = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n);\n\t\t\t} catch (i) {\n\t\t\t\tif (V(a), i !== i + 0) throw i;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_fi: function(e, t) {\n\t\t\tvar r = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t);\n\t\t\t} catch (n) {\n\t\t\t\tif (V(r), n !== n + 0) throw n;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_fiii: function(e, t, r, n) {\n\t\t\tvar a = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n);\n\t\t\t} catch (i) {\n\t\t\t\tif (V(a), i !== i + 0) throw i;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_i: function(e) {\n\t\t\tvar t = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)();\n\t\t\t} catch (r) {\n\t\t\t\tif (V(t), r !== r + 0) throw r;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_ii: function(e, t) {\n\t\t\tvar r = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t);\n\t\t\t} catch (n) {\n\t\t\t\tif (V(r), n !== n + 0) throw n;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iii: function(e, t, r) {\n\t\t\tvar n = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r);\n\t\t\t} catch (a) {\n\t\t\t\tif (V(n), a !== a + 0) throw a;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiii: function(e, t, r, n) {\n\t\t\tvar a = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n);\n\t\t\t} catch (i) {\n\t\t\t\tif (V(a), i !== i + 0) throw i;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiid: function(e, t, r, n, a) {\n\t\t\tvar i = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a);\n\t\t\t} catch (o) {\n\t\t\t\tif (V(i), o !== o + 0) throw o;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiii: function(e, t, r, n, a) {\n\t\t\tvar i = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a);\n\t\t\t} catch (o) {\n\t\t\t\tif (V(i), o !== o + 0) throw o;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiid: function(e, t, r, n, a, i) {\n\t\t\tvar o = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i);\n\t\t\t} catch (s) {\n\t\t\t\tif (V(o), s !== s + 0) throw s;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiii: function(e, t, r, n, a, i) {\n\t\t\tvar o = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i);\n\t\t\t} catch (s) {\n\t\t\t\tif (V(o), s !== s + 0) throw s;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiiii: function(e, t, r, n, a, i, o) {\n\t\t\tvar s = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i, o);\n\t\t\t} catch (u) {\n\t\t\t\tif (V(s), u !== u + 0) throw u;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiiiii: function(e, t, r, n, a, i, o, s) {\n\t\t\tvar u = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i, o, s);\n\t\t\t} catch (c) {\n\t\t\t\tif (V(u), c !== c + 0) throw c;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiiiiiii: function(e, t, r, n, a, i, o, s, u, c) {\n\t\t\tvar l = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i, o, s, u, c);\n\t\t\t} catch (p) {\n\t\t\t\tif (V(l), p !== p + 0) throw p;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiiiiiiii: function(e, t, r, n, a, i, o, s, u, c, l) {\n\t\t\tvar p = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i, o, s, u, c, l);\n\t\t\t} catch (d) {\n\t\t\t\tif (V(p), d !== d + 0) throw d;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiiiiiiiii: function(e, t, r, n, a, i, o, s, u, c, l, p) {\n\t\t\tvar d = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i, o, s, u, c, l, p);\n\t\t\t} catch (f) {\n\t\t\t\tif (V(d), f !== f + 0) throw f;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiiijj: function(e, t, r, n, a, i, o) {\n\t\t\tvar s = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i, o);\n\t\t\t} catch (u) {\n\t\t\t\tif (V(s), u !== u + 0) throw u;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiiijj: function(e, t, r, n, a, i) {\n\t\t\tvar o = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a, i);\n\t\t\t} catch (s) {\n\t\t\t\tif (V(o), s !== s + 0) throw s;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_iiij: function(e, t, r, n) {\n\t\t\tvar a = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n);\n\t\t\t} catch (i) {\n\t\t\t\tif (V(a), i !== i + 0) throw i;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_j: function(e) {\n\t\t\tvar t = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)();\n\t\t\t} catch (r) {\n\t\t\t\tif (V(t), r !== r + 0) throw r;\n\t\t\t\treturn ze(1, 0), 0n;\n\t\t\t}\n\t\t},\n\t\tinvoke_jiiii: function(e, t, r, n, a) {\n\t\t\tvar i = B();\n\t\t\ttry {\n\t\t\t\treturn Ee(e)(t, r, n, a);\n\t\t\t} catch (o) {\n\t\t\t\tif (V(i), o !== o + 0) throw o;\n\t\t\t\treturn ze(1, 0), 0n;\n\t\t\t}\n\t\t},\n\t\tinvoke_v: function(e) {\n\t\t\tvar t = B();\n\t\t\ttry {\n\t\t\t\tEe(e)();\n\t\t\t} catch (r) {\n\t\t\t\tif (V(t), r !== r + 0) throw r;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_vi: function(e, t) {\n\t\t\tvar r = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t);\n\t\t\t} catch (n) {\n\t\t\t\tif (V(r), n !== n + 0) throw n;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_vii: function(e, t, r) {\n\t\t\tvar n = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r);\n\t\t\t} catch (a) {\n\t\t\t\tif (V(n), a !== a + 0) throw a;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viii: function(e, t, r, n) {\n\t\t\tvar a = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n);\n\t\t\t} catch (i) {\n\t\t\t\tif (V(a), i !== i + 0) throw i;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiii: function(e, t, r, n, a) {\n\t\t\tvar i = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a);\n\t\t\t} catch (o) {\n\t\t\t\tif (V(i), o !== o + 0) throw o;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiiii: function(e, t, r, n, a, i) {\n\t\t\tvar o = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a, i);\n\t\t\t} catch (s) {\n\t\t\t\tif (V(o), s !== s + 0) throw s;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiiiii: function(e, t, r, n, a, i, o) {\n\t\t\tvar s = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a, i, o);\n\t\t\t} catch (u) {\n\t\t\t\tif (V(s), u !== u + 0) throw u;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiiiiii: function(e, t, r, n, a, i, o, s) {\n\t\t\tvar u = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a, i, o, s);\n\t\t\t} catch (c) {\n\t\t\t\tif (V(u), c !== c + 0) throw c;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiiiiiii: function(e, t, r, n, a, i, o, s, u) {\n\t\t\tvar c = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a, i, o, s, u);\n\t\t\t} catch (l) {\n\t\t\t\tif (V(c), l !== l + 0) throw l;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiiiiiiiii: function(e, t, r, n, a, i, o, s, u, c, l) {\n\t\t\tvar p = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a, i, o, s, u, c, l);\n\t\t\t} catch (d) {\n\t\t\t\tif (V(p), d !== d + 0) throw d;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiiiiiiiiiiiiii: function(e, t, r, n, a, i, o, s, u, c, l, p, d, f, h, v) {\n\t\t\tvar m = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a, i, o, s, u, c, l, p, d, f, h, v);\n\t\t\t} catch (y) {\n\t\t\t\tif (V(m), y !== y + 0) throw y;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viiji: function(e, t, r, n, a) {\n\t\t\tvar i = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a);\n\t\t\t} catch (o) {\n\t\t\t\tif (V(i), o !== o + 0) throw o;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tinvoke_viijii: function(e, t, r, n, a, i) {\n\t\t\tvar o = B();\n\t\t\ttry {\n\t\t\t\tEe(e)(t, r, n, a, i);\n\t\t\t} catch (s) {\n\t\t\t\tif (V(o), s !== s + 0) throw s;\n\t\t\t\tze(1, 0);\n\t\t\t}\n\t\t},\n\t\tllvm_eh_typeid_for: (e) => e,\n\t\tproc_exit: Rt\n\t};\n\treturn Yt = await async function() {\n\t\tfunction e(e, t) {\n\t\t\treturn Yt = e.exports, d = Yt.memory, F(), Ae = Yt.__indirect_function_table, function(e) {\n\t\t\t\tBe = e.__getTypeName, n._malloc = Me = e.malloc, n._parseDropFile = e.parseDropFile, n._getAttributeFromDropFile = e.getAttributeFromDropFile, n._takeAttributeFromDropFile = e.takeAttributeFromDropFile, n._flattenDropFile = e.flattenDropFile, n._destroyDropFileHandle = e.destroyDropFileHandle, e.__cxa_free_exception, n._free = qe = e.free, Le = e._emscripten_timeout, ze = e.setThrew, Ne = e._emscripten_tempret_set, Je = e._emscripten_stack_restore, Ye = e._emscripten_stack_alloc, Ge = e.emscripten_stack_get_current, Xe = e.__cxa_decrement_exception_refcount, Ze = e.__cxa_increment_exception_refcount, Ke = e.__cxa_can_catch, Qe = e.__cxa_get_exception_ptr;\n\t\t\t}(Yt), Yt;\n\t\t}\n\t\tvar t = {\n\t\t\tenv: Gt,\n\t\t\twasi_snapshot_preview1: Gt\n\t\t};\n\t\treturn n.instantiateWasm ? new Promise((r, a) => {\n\t\t\tn.instantiateWasm(t, (t, n) => {\n\t\t\t\tr(e(t));\n\t\t\t});\n\t\t}) : (T ??= D(), e((await E(u, T, t)).instance));\n\t}(), function() {\n\t\tfunction e() {\n\t\t\tn.calledRun = !0, !k && (S = !0, Yt.__wasm_call_ctors(), l?.(n), n.onRuntimeInitialized?.(), function() {\n\t\t\t\tif (n.postRun) for ("function" == typeof n.postRun && (n.postRun = [n.postRun]); n.postRun.length;) U(n.postRun.shift());\n\t\t\t\tO(R);\n\t\t\t}());\n\t\t}\n\t\t(function() {\n\t\t\tif (n.preRun) for ("function" == typeof n.preRun && (n.preRun = [n.preRun]); n.preRun.length;) H(n.preRun.shift());\n\t\t\tO(j);\n\t\t})(), n.setStatus ? (n.setStatus("Running..."), setTimeout(() => {\n\t\t\tsetTimeout(() => n.setStatus(""), 1), e();\n\t\t}, 1)) : e();\n\t}(), S ? n : new Promise((e, t) => {\n\t\tl = e, p = t;\n\t});\n}({ wasmBinary: r }), a = /* @__PURE__ */ new Map(), i = {\n\tget AttributeInfo() {\n\t\treturn n.AttributeInfo;\n\t},\n\tget AquaStatus() {\n\t\treturn n.AquaStatus;\n\t},\n\tget heapU8() {\n\t\treturn n.HEAPU8;\n\t},\n\tget heapU32() {\n\t\treturn n.HEAPU32;\n\t},\n\tget SceneRequestDescriptor() {\n\t\treturn n.SceneRequestDescriptor;\n\t},\n\tget WorkerDataType() {\n\t\treturn n.WorkerDataType;\n\t},\n\tdataPtrView: (e) => n.dataPtrView(e),\n\tfree: (...e) => n.ccall("free", "number", ["number"], e),\n\tmalloc: (...e) => n.ccall("malloc", "number", ["number"], e),\n\tparseDropFile: (e, t) => n.parseDropFile(e, t),\n\tgetAttributeFromDropFile: (e, t, r) => n.getAttributeFromDropFile(e, t, r),\n\ttakeAttributeFromDropFile: (e, t, r) => n.takeAttributeFromDropFile(e, t, r),\n\tflattenDropFile: (e, t, r) => n.flattenDropFile(e, t, r),\n\tdestroyDropFileHandle: (e) => n.destroyDropFileHandle(e)\n};\nvar o = {\n\tasync cancel(e, t) {\n\t\tconst r = `${t}-${e}`, n = a.get(r);\n\t\treturn n && (n.abort(), a.delete(r)), [{ cancelled: !!n }];\n\t},\n\theapSnapshot: async (e) => "function" != typeof n.TakeHeapSnapshot ? [{ snapshotJson: null }] : [{ snapshotJson: n.TakeHeapSnapshot(e) }],\n\theapTrackingControl: async (e) => "function" != typeof n.SetHeapTrackingEnabled ? [{ success: !1 }] : (n.SetHeapTrackingEnabled(e), [{ success: !0 }]),\n\theapTrackingReset: async () => "function" != typeof n.ResetHeapTracking ? [{ success: !1 }] : (n.ResetHeapTracking(), [{ success: !0 }]),\n\tasync decode(r, o, s, u, c, l) {\n\t\tconst p = `${o}-${r}`, d = new AbortController();\n\t\ta.set(p, d);\n\t\ttry {\n\t\t\tconst { free: a, malloc: p, parseDropFile: h, getAttributeFromDropFile: v, takeAttributeFromDropFile: m, flattenDropFile: y, destroyDropFileHandle: g } = i, _ = s.byteLength, w = p(_);\n\t\t\ti.heapU8.set(new Uint8Array(s), w);\n\t\t\tconst $ = n.SceneRequestDescriptor.deserializeFromBinary(w, _);\n\t\t\ta(w);\n\t\t\tlet b = $.getUrl();\n\t\t\tif (l) {\n\t\t\t\tconst e = new URL(b);\n\t\t\t\te.searchParams.delete("jwt"), b = e.toString();\n\t\t\t}\n\t\t\tconst T = $.getBody() || null, P = T ? "POST" : "GET", C = $.getHeaders();\n\t\t\t$.delete();\n\t\t\tconst k = performance.now(), S = await fetch(b, {\n\t\t\t\tmethod: P,\n\t\t\t\theaders: C,\n\t\t\t\tbody: T,\n\t\t\t\tsignal: d.signal\n\t\t\t}), F = JSON.stringify({ "x-cache": S.headers.get("x-cache") ?? "" });\n\t\t\tif (!S.ok) {\n\t\t\t\tconst e = performance.now() - k;\n\t\t\t\treturn [{\n\t\t\t\t\trequestIdLow: r,\n\t\t\t\t\trequestIdHigh: o,\n\t\t\t\t\tresultBuffer: /* @__PURE__ */ new ArrayBuffer(0),\n\t\t\t\t\tsuccess: !1,\n\t\t\t\t\tparsed: !1,\n\t\t\t\t\terror: `HTTP error! status: ${S.status}`,\n\t\t\t\t\tdataType: n.WorkerDataType.Raw.value,\n\t\t\t\t\tcontextPtr: u,\n\t\t\t\t\tattributes: [],\n\t\t\t\t\tduration: e,\n\t\t\t\t\tttfb: e,\n\t\t\t\t\thttpStatus: S.status,\n\t\t\t\t\tresponseHeadersJson: F\n\t\t\t\t}, { transfer: [] }];\n\t\t\t}\n\t\t\tconst A = performance.now() - k, D = await S.arrayBuffer(), W = performance.now() - k, E = [];\n\t\t\tif (!b.split(/[?#]/, 1)[0].endsWith(".drop")) return [{\n\t\t\t\trequestIdLow: r,\n\t\t\t\trequestIdHigh: o,\n\t\t\t\tresultBuffer: D,\n\t\t\t\tsuccess: !0,\n\t\t\t\tparsed: !1,\n\t\t\t\terror: void 0,\n\t\t\t\tdataType: n.WorkerDataType.Raw.value,\n\t\t\t\tcontextPtr: u,\n\t\t\t\tattributes: E,\n\t\t\t\tduration: W,\n\t\t\t\tttfb: A,\n\t\t\t\thttpStatus: S.status,\n\t\t\t\tresponseHeadersJson: F\n\t\t\t}, { transfer: [D] }];\n\t\t\tconst x = D.byteLength, O = p(x);\n\t\t\ti.heapU8.set(new Uint8Array(D), O);\n\t\t\tconst R = p(4), U = p(4);\n\t\t\ti.heapU32[R / 4] = 0, i.heapU32[U / 4] = 0;\n\t\t\tlet j = 0, H = 0;\n\t\t\tconst I = new i.AttributeInfo();\n\t\t\ttry {\n\t\t\t\tif (j = h(O, x), 0 === j) throw new Error("parseDropFile failed");\n\t\t\t\tlet a = c;\n\t\t\t\tfor (const [r, n] of Object.entries(e)) {\n\t\t\t\t\tif (n.discard) m(j, r, a);\n\t\t\t\t\telse if (v(j, r, I) === i.AquaStatus.Success) {\n\t\t\t\t\t\tconst e = t(r, a, i.dataPtrView(I));\n\t\t\t\t\t\tm(j, r, a) === i.AquaStatus.Success && E.push(e);\n\t\t\t\t\t}\n\t\t\t\t\ta++;\n\t\t\t\t}\n\t\t\t\tif (y(j, R, U) !== i.AquaStatus.Success) throw new Error("flattenDropFile failed");\n\t\t\t\tH = i.heapU32[R / 4];\n\t\t\t\tconst s = i.heapU32[U / 4];\n\t\t\t\tif (0 === H) throw new Error("flattenDropFile gave nullptr");\n\t\t\t\tconst l = i.heapU8.buffer.slice(H, H + s), p = E.map((e) => e.paddedData.buffer);\n\t\t\t\treturn [{\n\t\t\t\t\trequestIdLow: r,\n\t\t\t\t\trequestIdHigh: o,\n\t\t\t\t\tresultBuffer: l,\n\t\t\t\t\tsuccess: !0,\n\t\t\t\t\tparsed: !0,\n\t\t\t\t\terror: void 0,\n\t\t\t\t\tdataType: n.WorkerDataType.Drop.value,\n\t\t\t\t\tcontextPtr: u,\n\t\t\t\t\tattributes: E,\n\t\t\t\t\tduration: W,\n\t\t\t\t\tttfb: A,\n\t\t\t\t\thttpStatus: S.status,\n\t\t\t\t\tresponseHeadersJson: F\n\t\t\t\t}, { transfer: [l, ...p] }];\n\t\t\t} catch (f) {\n\t\t\t\tconsole.error("Exception when parsing dropfile", f);\n\t\t\t\tconst e = f instanceof Error ? f.stack ?? f.message : String(f), t = (/* @__PURE__ */ new Uint8Array()).buffer;\n\t\t\t\treturn [{\n\t\t\t\t\trequestIdLow: r,\n\t\t\t\t\trequestIdHigh: o,\n\t\t\t\t\tresultBuffer: t,\n\t\t\t\t\tsuccess: !1,\n\t\t\t\t\tparsed: !1,\n\t\t\t\t\terror: e,\n\t\t\t\t\tdataType: n.WorkerDataType.Drop.value,\n\t\t\t\t\tcontextPtr: u,\n\t\t\t\t\tattributes: void 0,\n\t\t\t\t\tduration: W,\n\t\t\t\t\tttfb: A,\n\t\t\t\t\thttpStatus: S.status,\n\t\t\t\t\tresponseHeadersJson: F\n\t\t\t\t}, { transfer: [t] }];\n\t\t\t} finally {\n\t\t\t\tg(j), a(O), a(R), a(U), 0 !== H && a(H), I.delete();\n\t\t\t}\n\t\t} catch (f) {\n\t\t\tconst e = f instanceof Error ? f.message : String(f), t = f instanceof Error && "AbortError" === f.name;\n\t\t\treturn [{\n\t\t\t\trequestIdLow: r,\n\t\t\t\trequestIdHigh: o,\n\t\t\t\tresultBuffer: /* @__PURE__ */ new ArrayBuffer(0),\n\t\t\t\tsuccess: !1,\n\t\t\t\tparsed: !1,\n\t\t\t\terror: t ? "Cancelled" : e,\n\t\t\t\tdataType: n.WorkerDataType.Raw.value,\n\t\t\t\tcontextPtr: u,\n\t\t\t\tattributes: [],\n\t\t\t\tduration: 0,\n\t\t\t\tttfb: 0,\n\t\t\t\thttpStatus: 0,\n\t\t\t\tresponseHeadersJson: "{}"\n\t\t\t}, { transfer: [] }];\n\t\t} finally {\n\t\t\ta.delete(p);\n\t\t}\n\t}\n};\nself.postMessage("ready"), self.addEventListener("message", async ({ data: e }) => {\n\tif ("ready" === e) return;\n\tconst { id: t, action: r, args: n } = e, [a, ...i] = await Reflect.apply(o[r], void 0, [...n, t]);\n\tself.postMessage({\n\t\tid: t,\n\t\tresult: a\n\t}, ...i);\n});\n',c="undefined"!=typeof self&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",o],{type:"text/javascript;charset=utf-8"});function u(t){let e;try{if(e=c&&(self.URL||self.webkitURL).createObjectURL(c),!e)throw"";const r=new Worker(e,{type:"module",name:t?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),r}catch(r){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(o),{type:"module",name:t?.name})}}var l=(t=>t.includes("/.vite/")?t.replace(/\.vite\/[^?#]*/,()=>"@miris-inc/core/dist/aqua-parser.wasm"):t)(new URL("aqua-parser.wasm",import.meta.url).href),d=(t=>{let e;return async()=>{e??=fetch(t).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status} fetching ${t}`);return e.arrayBuffer()});try{return(await e).slice(0)}catch(r){throw e=void 0,r}}})(l),h=class extends s{static name="decoder";static Worker=u;constructor(t){super(t),this.#m()}async#m(){try{const t=await d();this._postToWorker({type:"wasm-init",wasmBinary:t},[t])}catch(t){console.error("Failed to load aqua-parser.wasm for decoder worker",t),this._postToWorker({type:"wasm-init"})}}get AttributeInfo(){return this.module.AttributeInfo}async heapSnapshot(t){return this._execute("heapSnapshot",t)}async heapTrackingControl(t){return this._execute("heapTrackingControl",t)}async heapTrackingReset(){return this._execute("heapTrackingReset")}async cancel(t,e){await this.ready,this._execute("cancel",t,e).catch(()=>{})}async decode(...t){const{requestIdLow:e,requestIdHigh:r,resultBuffer:i,success:a,dataType:s,contextPtr:o,attributes:c,duration:u,ttfb:l,httpStatus:d,responseHeadersJson:h}=await this._execute("decode",...t);if(void 0!==c)for(const{paddedData:v,originalSizeInUints:g,id:y}of c)n.addWithId({paddedData:v,originalSizeInUints:g},y);const{engine:f}=this,p=i.byteLength,m=f.malloc(p);f.heapU8.set(new Uint8Array(i),m),f.onWorkerResult(e,r,m,p,d,u,l,a,s,"",h,o)}},f=class t{static AquaStatus={Success:0,Failure:1};static SceneObjectType={ModelRoot:0,SceneObject:1,StreamObject:2,GaussianSplats:3,PointsObject:4,Camera:5,LodOctree:6,VariantSetCollection:7,VariantSet:8,VariantSetOption:9};static Feature={DrMap:0,ReflMesh:1,GlassMesh:2};static FeatureState={NotLoaded:0,Pending:1,Loaded:2,Failed:3};#v;get module(){if(!this.#v)throw new Error("Engine has not yet been initialized. Did you forget to `await engine.ready()?`");return this.#v}#g=/* @__PURE__ */new Set;#y=/* @__PURE__ */new Map;#_=new URL(location.href).searchParams.has("nojwt");constructor(t={}){Object.defineProperty(this,"pending",{value:!0,configurable:!0,enumerable:!0}),Object.defineProperty(this,"ready",{enumerable:!0,value:this.#w(t)})}async#w(e){return this.#v=await a({createDeserializeWorker:this.createDeserializeWorker.bind(this),submitToWorker:this.submitToWorker.bind(this),cancelRequest:this.cancelRequest.bind(this),terminateWorker:this.terminateWorker.bind(this),workerUrl:"aqua-parser",...e,preRun:[e=>Object.assign(e.ENV,t.#b())]}),Object.defineProperty(this,"pending",{value:!1,configurable:!1}),this}get AttributeInfo(){return this.module.AttributeInfo}get Handedness(){return this.module.Handedness}get heapF32(){return this.module.HEAPF32}get heapU8(){return this.module.HEAPU8}get MatrixOrder(){return this.module.MatrixOrder}get SceneChangeIds(){return this.module.SceneChangeIds}get SceneMetadata(){return this.module.SceneMetadata}get RuntimeSettings(){return this.module.RuntimeSettings}get SpatialFormat(){return this.module.SpatialFormat}get StringVector(){return this.module.StringVector}get UpAxis(){return this.module.UpAxis}activatedObjectIdsView(...t){return this.module.activatedObjectIdsView(...t)}addStreamById(...t){return this.module.ccall("AddStreamById","number",["number","string","string","number"],t)}allocateSceneChangesArrays(...t){return this.module.AllocateSceneChangesArrays(...t)}createContext(...t){return this.module.ccall("CreateAquaContext","number",[],t)}destroyContext(...t){return this.module.ccall("DestroyAquaContext","number",["number"],t)}createClient(t,...e){return t?this.module.ccall("CreateClientForContext","number",["number"],[t,...e]):this.module.ccall("CreateClient","number",[],e)}createdObjectIdsView(...t){return this.module.createdObjectIdsView(...t)}deletedObjectIdsView(...t){return this.module.deletedObjectIdsView(...t)}dataPtrView(...t){return this.module.dataPtrView(...t)}deactivatedObjectIdsView(...t){return this.module.deactivatedObjectIdsView(...t)}remaskedObjectIdsView(...t){return this.module.remaskedObjectIdsView(...t)}getDrawnOctantMask(...t){return this.module.GetDrawnOctantMask(...t)}destroyClient(...t){return this.module.ccall("DestroyClient","number",["number"],t)}free(...t){return this.module.ccall("free","number",["number"],t)}getAssetsAsync(...t){return this.module.GetAssetsAsync(...t)}getAttribute(...t){return this.module.ccall("GetAttribute","number",["number","number","string","number"],t)}getDefaultCameraId(...t){return this.module.ccall("GetDefaultCameraId","number",["number"],t)}getViewingVolumeId(...t){return this.module.ccall("GetViewingVolumeId","number",["number"],t)}getLocalBoundingBox(...t){return this.module.ccall("GetLocalBoundingBox","number",["number","number","number"],t)}getWorldBoundingBox(...t){return this.module.ccall("GetWorldBoundingBox","number",["number","number","number"],t)}getLodIndex(...t){return this.module.ccall("GetLodIndex","number",["number","number"],t)}getSceneChanges(...t){return this.module.GetSceneChanges(...t)}getSceneChangesCounts(...t){return this.module.GetSceneChangesCounts(...t)}getSceneMetadata(...t){return this.module.GetSceneMetadata(...t).value}getSceneObjectParent(...t){return this.module.ccall("GetSceneObjectParent","number",["number","number"],t)}getSceneObjectType(...t){return this.module.ccall("GetSceneObjectType","number",["number","number"],t)}getLocalTransform(...t){return this.module.ccall("MirisGetLocalTransform","number",["number","number","number"],t)}getWorldTransform(...t){return this.module.ccall("MirisGetWorldTransform","number",["number","number","number"],t)}hasAttribute(...t){return this.module.ccall("HasAttribute","boolean",["number","number","string"],t)}isSceneObjectAncestorOf(...t){return this.module.ccall("IsSceneObjectAncestorOf","boolean",["number","number","number"],t)}lockScene(...t){return this.module.ccall("LockScene","number",["number"],t)}malloc(...t){return this.module.ccall("malloc","number",["number"],t)}modifiedObjectIdsView(...t){return this.module.modifiedObjectIdsView(...t)}onWorkerResult(...t){const e=`${t[1]}-${t[0]}`;return this.#y.delete(e),this.module.ccall("onWorkerResult",null,["number","number","number","number","number","number","number","number","number","string","string","number"],t)}removeStream(...t){return this.module.ccall("RemoveStream","boolean",["pointer","number"],t)}setAssetViewerKey(...t){return this.module.ccall("SetAssetViewerKey","number",["number","string"],t)}setClientSpatialFormat(...t){return this.module.SetClientSpatialFormat(...t).value}setRuntimeSettings(...t){return this.module.SetRuntimeSettings(...t).value}setMainCameraTransform(...t){return this.module.ccall("SetMainCameraTransform","number",["number","number"],t)}setMainCameraViewFrustum(...t){return this.module.ccall("SetMainCameraViewFrustum","number",["number","number","number","number","number"],t)}setMaxCacheSize(...t){return this.module.setMaxCacheSize(...t)}setSceneObjectTransform(...t){return this.module.ccall("SetSceneObjectTransform","number",["number","number","number"],t)}hasFeature(...t){return this.module.HasFeature(...t)}getFeatureVersion(...t){return this.module.GetFeatureVersion(...t)}getFeatureState(...t){return this.module.GetFeatureState(...t)}getName(...t){return this.module.GetName(...t)}setVariantSelection(...t){return this.module.ccall("SetVariantSelection","number",["number","number"],t)}takeAttribute(...t){return this.module.ccall("TakeAttribute","number",["number","number","string","bigint"],t)}takeEvictedClientSideAttributeIds(...t){return this.module.TakeEvictedClientSideAttributeIds(...t)}getActiveClientSideIdsCheckSum(){return this.module.GetActiveClientSideIdsCheckSum()}unlockScene(...t){return this.module.ccall("UnlockScene","number",["number"],t)}updateSceneExecution(...t){return this.module.ccall("UpdateSceneExecution","number",["number"],t)}recordFrameTime(...t){return this.module.ccall("RecordFrameTime","number",["number","number"],t)}takeRenderRequired(...t){return this.module.TakeRenderRequired(...t)}createDeserializeWorker(t,e,r){for(let n=1;n<r;n+=1)this.#g.add(new h({engine:this}));return!0}cancelRequest(t,e){const r=`${e}-${t}`,n=this.#y.get(r);return n&&(n.cancel(t,e),this.#y.delete(r)),!0}submitToWorker(t,e,r,i){const a=[...this.#g.values()].reduce((t,e)=>t?e.pendingRequests<t.pendingRequests?e:t:e),s=`${e}-${t}`;this.#y.set(s,a);const o=n.getConsecutiveIds(Object.keys(p).length);return a.ready.then(()=>a.decode(t,e,r,i,o,this.#_)),!0}terminateWorker(){for(const t of this.#g)t.terminate();this.#g.clear()}async requestWorkerHeapSnapshots(t){const e=[...this.#g];return(await Promise.allSettled(e.map(e=>e.ready.then(()=>{let r;const n=new Promise(t=>{r=setTimeout(()=>t(null),5e3)});return Promise.race([e.heapSnapshot(t).then(t=>t.snapshotJson),n]).finally(()=>clearTimeout(r))})))).map(t=>"fulfilled"===t.status?t.value:null)}async setWorkerHeapTrackingEnabled(t){await Promise.allSettled([...this.#g].map(e=>e.ready.then(()=>e.heapTrackingControl(t))))}async resetWorkerHeapTracking(){await Promise.allSettled([...this.#g].map(t=>t.ready.then(()=>t.heapTrackingReset())))}static#b(){return{AQUA_USE_SINGLETON_NETWORK_TRANSPORT:"true",AQUA_SERVER_BASE_URL:"https://app.miris.com/viewer/v1"}}},p={sparkPackedSplat:{elementsPerSplat:4,discard:!1},extendedPackedSplatLow:{elementsPerSplat:4,discard:!1},extendedPackedSplatHigh:{elementsPerSplat:4,discard:!1},packedSh1:{elementsPerSplat:2,discard:!1},packedSh2:{elementsPerSplat:4,discard:!1},packedSh3:{elementsPerSplat:4,discard:!1},sh1Extended:{elementsPerSplat:4,discard:!1},sh2Extended:{elementsPerSplat:4,discard:!1},sh3Extended_0:{elementsPerSplat:4,discard:!1},sh3Extended_1:{elementsPerSplat:4,discard:!1},sharkEllipsoids:{elementsPerSplat:12,discard:!1},sharkSphericalHarmonics:{elementsPerSplat:16,discard:!1}};function m(t,e,r){const n=p[t];if(void 0===n)throw new Error("attribute name"+t+" is unknown");const i=r.length,a=(s=i,o=2048*n.elementsPerSplat,Math.ceil(s/o)*o);var s,o;const c=new Uint32Array(a);return c.set(r),{paddedData:c,originalSizeInUints:i,id:e}}var v=class{static SPARK_PACKED_SPLAT="sparkPackedSplat";static SPARK_EXTENDED_SPLAT_LOW="extendedPackedSplatLow";static SPARK_EXTENDED_SPLAT_HIGH="extendedPackedSplatHigh";static SPARK_PACKED_SH1="packedSh1";static SPARK_PACKED_SH2="packedSh2";static SPARK_PACKED_SH3="packedSh3";static SPARK_EXTENDED_SH1="sh1Extended";static SPARK_EXTENDED_SH2="sh2Extended";static SPARK_EXTENDED_SH3_A="sh3Extended_0";static SPARK_EXTENDED_SH3_B="sh3Extended_1";static UNUSED="unused";static SHARK_ELLIPSOIDS="sharkEllipsoids";static SHARK_SPHERICAL_HARMONICS="sharkSphericalHarmonics";static OCTANT_OFFSETS="childOctantOffsets"};function g(t,e,r,n){const i=t.malloc(4*r);n(e,i);const a=t.heapF32.subarray(i>>2,(i>>2)+r).slice();return t.free(i),a}var y=class{#S=/* @__PURE__ */new Map;#k=/* @__PURE__ */new Map;forKey(t){return this.#S.get(t)}forId(t){return this.#k.get(t)}setKey(t,e){this.#S.set(t,e)}setId(t,e){return this.#k.set(t,e)}delete(t){this.#S.delete(t.key),this.#k.delete(t.id)}deleteKey(t){this.#S.delete(t)}deleteId(t){this.#k.delete(t)}},_=class{#E;#C;#$=null;#T=null;#P=null;#A=null;#F=0;#x=255;#D=null;#I=!1;get key(){return this.#C??null}set key(t){this.store.deleteKey(this.key),(t||0===t)&&this.store.setKey(t,this),this.#C=t}set bounds(t){this.#$=t}get bounds(){return console.warn("`bounds` is deprecated, use `localBounds` instead"),this.#$}set localBounds(t){this.#T=t}get localBounds(){return this.#T}set lodIndex(t){this.#A=t}get lodIndex(){return this.#A}set paddingSplatsCount(t){this.#F=t}get paddingSplatsCount(){return this.#F}set transform(t){this.#P=t}get transform(){return this.#P}get _drawnOctantMask(){return this.#x}set _drawnOctantMask(t){this.#x=t}get _octantOffsets(){return this.#D}get _hasOctantOffsets(){return null!==this.#D}_readOctantOffsets(t){if(this.#I)return;this.#I=!0;const e=function(t,e,r,n){if(!e.hasAttribute(r,n))return null;const i=new t.AttributeInfo;try{const{ptr:a}=i.$$;if(e.getAttribute(r,n,a)!==f.AquaStatus.Success)return null;const s=t.dataPtrView(i);return 0===s.length?null:s.slice()}finally{i.delete()}}(t,this.#E,this.id,v.OCTANT_OFFSETS);e&&7===e.length&&(this.#D=e)}hasAttribute(t){return this.#E.hasAttribute(this.id,t)}getDataFromAttribute(t,e,r){return function(t,e,r,i,a){if(!e.hasAttribute(r,i))return null;const{ptr:s}=a.$$,o=e.getAttribute(r,i,s);if(o!==f.AquaStatus.Success)return console.warn(`GetAttribute failed for object id ${r} and attribute name ${i}: status ${o}`),null;let c,u;if(0n!=a.clientSideId)({paddedData:c,originalSizeInUints:u}=n.get(Number(a.clientSideId)));else{const s=m(i,0,t.dataPtrView(a));c=s.paddedData,u=s.originalSizeInUints,console.log(`retrieved a attribute ${i} with size ${s.originalSizeInUints} for chunk ${r}`);const o=n.add({paddedData:s.paddedData,originalSizeInUints:s.originalSizeInUints}),l=e.takeAttribute(r,i,BigInt(o));if(l!==f.AquaStatus.Success)return n.remove(o),console.warn(`Failed to take attribute ${i} for scene object ${r}: status ${l}`),null}return{paddedData:c,originalSizeInUints:u}}(t,this.#E,this.id,e,r)}dispose(){const t=this.#C;t?.dispose?.(),this.store.delete(this),this.#C=null,t?.dispose?.(),this.#$=null,this.#T=null,this.#P=null,this.modelRoot?.lods?.delete(this)}constructor({id:t,modelRoot:e,lodStore:r,client:n}){Object.defineProperties(this,{id:{value:t},modelRoot:{value:e},store:{value:r}}),this.#E=n,r.setId(t,this),e.add(this)}},w=class{constructor({type:t,lod:e}){Object.defineProperties(this,{type:{value:t},lod:{value:e}})}},b=class t{static#S=/* @__PURE__ */new Map;static#k=/* @__PURE__ */new Map;static forKey(t){return this.#S.get(t)}static forId(t){return this.#k.get(t)}#C;get key(){return this.#C??null}set key(e){t.#S.delete(this.key),(e||0===e)&&t.#S.set(e,this),this.#C=e}#O=/* @__PURE__ */new Set;get lods(){return this.#O}#P;set transform(t){this.#P=t}get transform(){return this.#P}constructor({id:e,stream:r}){Object.defineProperties(this,{id:{value:e},stream:{value:r}}),t.#k.set(e,this),r.add(this)}add(t){this.#O.add(t)}dispose(){const e=[...this.#O];this.#O.clear();for(const t of e)t.dispose();t.#S.delete(this.key),t.#k.delete(this.id),this.#C=null}},S=class t extends EventTarget{static _idMap=/* @__PURE__ */new Map;static _keyMap=/* @__PURE__ */new Map;static forId(t){if(t)return this._idMap.get(t)}static forKey(t){return this._keyMap.get(t)}#C;#j=!1;#R={};_addVariantCollection(t){this.#R[t]||(this.#R[t]={id:t,children:[]})}_findAndAddToVariantSet(t,e){const r=n=>{if(!n)return!1;if(n.id===t)return n.children?n.children.push(e):"option"===e.type?(n.options||(n.options=[]),n.options.push(e)):(n.nestedSets||(n.nestedSets=[]),n.nestedSets.push(e)),!0;if(Array.isArray(n.children))for(const t of n.children)if(r(t))return!0;if(Array.isArray(n.nestedSets))for(const t of n.nestedSets)if(r(t))return!0;if(Array.isArray(n.options))for(const t of n.options)if(r(t))return!0;return!1};for(const n of Object.values(this.#R))if(r(n))return}_addVariant(t,e){this._findAndAddToVariantSet(t,e)}_exportVariantHierarchies(){return Object.entries(this.#R).map(([t,e])=>({hierarchyId:Number(t),hierarchy:e}))}_setVariantSelection(t){this.client.setVariantSelection(t)}get key(){return this.#C??null}set key(e){t._keyMap.delete(this.key),(e||0===e)&&t._keyMap.set(e,this),this.#C=e}#M=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];get matrix(){return this.#M}set matrix(t){this.#M=t;const{engine:e,client:r}=this,n=e.malloc(4*this.#M.length);e.heapF32.set(Float32Array.from(this.#M),n/4),r.setSceneObjectTransform(this.id,n),e.free(n)}#W=1;get opacity(){return this.#W}set opacity(t){this.#W=Math.min(1,Math.max(0,t))}get boundingBox(){const{engine:t,client:e}=this,r=t.malloc(24);e.getWorldBoundingBox(this.id,r);const[n,i,a,s,o,c]=Float32Array.from(t.heapF32.subarray(r/4,r/4+6));if(void 0===n||void 0===i||void 0===a||void 0===s||void 0===o||void 0===c)return;const u={min:{x:n-s/2,y:i-o/2,z:a-c/2},max:{x:n+s/2,y:i+o/2,z:a+c/2},size:{x:s,y:o,z:c},center:{x:n,y:i,z:a}};return Object.freeze(u),u}#B=/* @__PURE__ */new Set;get modelRoots(){return new Set(this.#B)}get chunks(){return this.modelRoots}constructor(e){super();const{scene:r,uuid:n}=e;Object.defineProperties(this,{uuid:{value:n,enumerable:!0},scene:{value:r,enumerable:!0},client:{value:r.client,enumerable:!0},miris:{value:r.miris,enumerable:!0},engine:{value:r.miris.engine,enumerable:!0}}),this._initStream(e),t._idMap.set(this.id,this),r.add(this)}_initStream({uuid:t}){const e=this.client.addStreamById(t,t,!1);Object.defineProperty(this,"id",{value:e})}async _onStreamLoaded(){this.#j||(this.dispatchEvent(new Event("streamloaded")),this.scene._onSceneLoaded(),this.#j=!0)}_onRootLoaded(){this.dispatchEvent(new Event("rootloaded"))}add(t){this.#B.add(t)}end(){console.log("ending the stream"),this.client.removeStream(this.id);for(const t of this.#B)t.dispose();this.#B.clear(),t._idMap.delete(this.id),t._keyMap.delete(this.key),this.scene.streams.has(this)&&this.scene.delete(this)}},k=[30,60,72,90,120,144,165,240];var E=class{static tryUseShark="undefined"!=typeof window&&"1"===new URLSearchParams(window.location.search).get("shark");static _instance;static async instance(){const t=this._instance??=new this;return await t.ready,t}#U;get sharedContext(){return this.#U}#V;get viewerKey(){return this.#V}set viewerKey(t){this.#V=t}#L=/* @__PURE__ */new Set;get scenes(){return new Set(this.#L)}#N=[];#z=null;#H=/* @__PURE__ */new Set;#G=/* @__PURE__ */new Map;#q=!0;get useSphericalHarmonics(){return this.#q}set useSphericalHarmonics(t){this.#q=t}constructor(){this.constructor.prototype._instance||(this.constructor.prototype._instance=this),Object.defineProperties(this,{pending:{value:!0,configurable:!0,enumerable:!0},engine:{value:new f,enumerable:!0}}),Object.defineProperty(this,"ready",{enumerable:!0,value:this.#K()}),console.assert?.(!1===this._xrModeActive),this.#Y()}async#K(){const{engine:t}=this;await t.ready,this.#U=this.engine.createContext();const e=1048576,r=new URLSearchParams(window.location.search).get("aquaMaxCacheSize");let n=0;if(r){const t=parseInt(r,10);!isNaN(t)&&t>0&&(n=t)}return n>0?this.engine.setMaxCacheSize(n*e):navigator.userAgent.includes("iPhone")?this.engine.setMaxCacheSize(128*e):navigator.userAgent.includes("Android")&&this.engine.setMaxCacheSize(256*e),this.#Q(),Object.defineProperty(this,"pending",{value:!1,configurable:!1}),this}dispose(){this.#U&&(this.engine.destroyContext(this.#U)!==f.AquaStatus.Success&&console.error(`Failed to destroy aqua context with handle '${this.#U}'`),this.#U=0)}updateParentedTransform(t,e){}#X=function(){let t=[],e=null,r=0;return screen.addEventListener?.("change",()=>{t=[],r=0,e=null}),{update(n){if(!r){if(null!==e&&(t.push(n-e),t.length>60&&t.shift(),!r&&60===t.length)){const e=1e3/(t.reduce((t,e)=>t+e,0)/t.length);r=k.reduce((t,r)=>Math.abs(r-e)<Math.abs(t-e)?r:t)}e=n}},get nativeHz(){return r}}}();#Z=this.#Q.bind(this);#J=!1;#tt=null;#et=-1;#rt=72;#nt=null;_xrModeActive=!1;_xrSession=null;_requestAnimationFrame=null;signalResumeFromIdle(){}#it(){const t=new this.engine.RuntimeSettings;t.targetFramesPerSecond=this.#rt,t.xrModeActive=this._xrModeActive,null!==this.#nt?t.splatCountBudget=this.#nt:this._xrModeActive&&(t.splatCountBudget=2e5);for(const e of this.#L)e.client.setRuntimeSettings(t);t.delete()}static _XR_TARGET_FRAME_RATE=43;#Y(){this._requestAnimationFrame=this._xrModeActive?this._xrSession.requestAnimationFrame.bind(this._xrSession):window.requestAnimationFrame.bind(window)}_setTargetFrameRate(t){this.#rt=t,this.#X=null,this.#it()}_setXRModeActive(t,e,r){this._xrModeActive=t,this._xrSession=r??null,void 0!==e&&(this.#rt=e),this.#it(),this.#Y()}_setSplatCountBudgetOverride(t){this.#nt=t,this.#it()}#Q(t=0){this.#J||(this._update(t),this._xrModeActive||requestAnimationFrame(this.#Z))}_update(t=0){if(0!==t&&t===this.#et)return;if(this.#et=t,this.#X&&(this.#X.update(performance.now()),this.#X.nativeHz>0)){const t=this.#X.nativeHz;this.#rt=t<=40?t:40,this.#it(),this.#X=null}const e=performance.now(),r=null===this.#tt?null:e-this.#tt;this.#tt=e;const i=null!==r&&r<=1e3?r:null;for(const a of this.#L){const{client:t}=a;null!==i&&t.recordFrameTime(i),t.updateSceneExecution();const e=t.takeEvictedClientSideAttributeIds();try{const t=e.size();if(t>0){const r=[];for(let n=0;n<t;n++)r.push(Number(e.get(n)));n.remove(r)}}finally{e.delete()}const r=this.engine.getActiveClientSideIdsCheckSum();if(n.validateCheckSum(r),!t.lockScene())return;try{this.#at(a)}finally{t.unlockScene()}}this.#N.length&&(this.applyChanges(this.#N),this.#N.length=0)}getLocalTransform(t,e){if(Number.isInteger(e)&&e>=0)return g(this.engine,e,16,t.getLocalTransform.bind(t))}getWorldTransform(t,e){if(Number.isInteger(e)&&e>=0)return g(this.engine,e,16,t.getWorldTransform.bind(t))}#st(){return!!this.#z&&(this.#z.createdObjectsCount>0||(this.#z.activatedObjectsCount>0||(this.#z.deactivatedObjectsCount>0||(this.#z.modifiedObjectsCount>0||(this.#z.deletedObjectsCount>0||this.#z.remaskedObjectsCount>0)))))}#at(t){const{engine:e}=this,{client:r,camera:n,lods:i}=t;if(n&&n.update(),null===this.#z&&(this.#z=new e.SceneChangeIds),r.getSceneChangesCounts(this.#z),!this.#st())return;e.allocateSceneChangesArrays(this.#z),r.getSceneChanges(this.#z);const a=/* @__PURE__ */new Set;for(const o of e.createdObjectIdsView(this.#z)){const e=r.getSceneObjectType(o);if(e!==f.SceneObjectType.StreamObject){if(e===f.SceneObjectType.ModelRoot){const e=t.getStreamForDescendentId(o);if(!e)continue;const n=new b({id:o,stream:e}),i=this.getLocalTransform(r,o);if(!i)continue;const a=r.getSceneObjectParent(o),s=this.getLocalTransform(r,a);if(!s)continue;const c=this.updateParentedTransform(i,s);if(!c)continue;n.transform=c}else if(e==f.SceneObjectType.GaussianSplats){const e=t.getModelRootForDescendentId(o);if(!e)continue;const n=new _({id:o,modelRoot:e,lodStore:i,client:r});n.transform=this.getLocalTransform(r,o),a.add(o);const s=new w({type:"created",lod:n});this.#N.push(s)}else if(e==f.SceneObjectType.VariantSetCollection)t.getStreamForDescendentId(o)?._addVariantCollection(o);else if(e==f.SceneObjectType.VariantSet){const e=t.getStreamForDescendentId(o),n=r.getName(o),i=r.getSceneObjectParent(o);e?._addVariant(i,{id:o,name:n,options:[],nestedSets:[]})}else if(e==f.SceneObjectType.VariantSetOption){const e=t.getStreamForDescendentId(o),n=r.getName(o),i=r.getSceneObjectParent(o);e?._addVariant(i,{id:o,name:n,type:"option"})}}else S.forId(o)}for(const o of e.deletedObjectIdsView(this.#z)){const t=i.forId(o);if(!t)continue;const e=new w({type:"deleted",lod:t});this.#N.push(e)}for(const o of e.modifiedObjectIdsView(this.#z)){const e=r.getSceneObjectType(o);if(e===f.SceneObjectType.LodOctree)t._onFeatureData(o);else if(e===f.SceneObjectType.GaussianSplats){const t=r.getLodIndex(o),e=i.forId(o);if(!e){console.warn(`Received modified event for LOD ${o} which does not exist.`);continue}const n=g(this.engine,e.id,6,r.getWorldBoundingBox.bind(r)),a=g(this.engine,e.id,6,r.getLocalBoundingBox.bind(r));e.bounds=n,e.localBounds=a,e.lodIndex=t;const s=new w({type:"modified",lod:e});if(this.#N.push(s),this.#H.delete(o)){this.#N.push(new w({type:"activated",lod:e}));for(const[,t]of this.#G)this.#N.push(new w({type:"deactivated",lod:t}));this.#G.clear()}}}if(this.#N.some(t=>"created"===t.type))try{const t=new e.SceneMetadata;r.getSceneMetadata(t),this.onColorSpaceDetected("linear"===t.inputColorSpace),t.delete()}catch(s){console.warn("Failed to read scene metadata:",s)}for(const o of e.activatedObjectIdsView(this.#z))if(r.getSceneObjectType(o)==f.SceneObjectType.GaussianSplats){const t=i.forId(o);if(t){const e=new w({type:"activated",lod:t});this.#N.push(e)}}for(const o of e.deactivatedObjectIdsView(this.#z))if(r.getSceneObjectType(o)==f.SceneObjectType.GaussianSplats&&(this.#H.delete(o),!a.has(o))){const t=i.forId(o);if(t){const e=new w({type:"deactivated",lod:t});this.#N.push(e)}}for(const o of e.remaskedObjectIdsView(this.#z))if(r.getSceneObjectType(o)==f.SceneObjectType.GaussianSplats){const t=i.forId(o);t&&(t._drawnOctantMask=r.getDrawnOctantMask(o),this.#N.push(new w({type:"remasked",lod:t})))}}update(){this.#J=!0,this._update();let t=!1;for(const e of this.#L)e.client.takeRenderRequired()&&(t=!0);return t||this._computeAdditionalRenderNeeded()}applyChanges(t){}_computeAdditionalRenderNeeded(){return!1}onColorSpaceDetected(t){}add(t){this.#L.add(t)}delete(t){this.#L.delete(t),t.miris&&t.close(),0===this.#L.size&&null!==this.#z&&(this.#z.delete(),this.#z=null)}},C=class{update(){const{engine:t}=this,{client:e}=this.scene,r=t.malloc(4*this.#M.length);t.heapF32.set(Float32Array.from(this.#M),r/4),e.setMainCameraTransform(r),t.free(r),e.setMainCameraViewFrustum(this.#ot,this.#ct,this.#ut,this.#lt)}#ot;get aspect(){return this.#ot}set aspect(t){this.#ot=t}#ct;get fov(){return this.#ct}set fov(t){this.#ct=t}#ut;get near(){return this.#ut}set near(t){this.#ut=t}#lt;get far(){return this.#lt}set far(t){this.#lt=t}#M;get matrix(){return this.#M}set matrix(t){this.#M=t}constructor({aspect:t,fov:e,near:r,far:n,matrix:i,scene:a}){this.#ot=t,this.#ct=e,this.#ut=r,this.#lt=n,this.#M=i,Object.defineProperties(this,{scene:{value:a},miris:{value:a.miris},engine:{value:a.miris.engine}})}},$=class{#V=null;get viewerKey(){return this.#V}set viewerKey(t){t&&this.setAssetViewerKey(t),this.#V=t}constructor({engine:t,context:e}){Object.defineProperties(this,{engine:{value:t,enumerable:!0},handle:{value:t.createClient(e),enumerable:!0}})}dispose(){this.engine.destroyClient(this.handle)!==f.AquaStatus.Success&&console.error(`Failed to destroy client with handle '${this.handle}'`)}addStreamById(...t){return this.engine.addStreamById(this.handle,...t)}destroyClient(...t){return this.engine.destroyClient(this.handle,...t)}getAssetsAsync(...t){return this.engine.getAssetsAsync(this.handle,...t)}getAttribute(...t){return this.engine.getAttribute(this.handle,...t)}getDefaultCameraId(...t){return this.engine.getDefaultCameraId(this.handle,...t)}getViewingVolumeId(...t){return this.engine.getViewingVolumeId(this.handle,...t)}getLocalBoundingBox(...t){return this.engine.getLocalBoundingBox(this.handle,...t)}getWorldBoundingBox(...t){return this.engine.getWorldBoundingBox(this.handle,...t)}getLodIndex(...t){return this.engine.getLodIndex(this.handle,...t)}getSceneChanges(...t){return this.engine.getSceneChanges(this.handle,...t)}getSceneChangesCounts(...t){return this.engine.getSceneChangesCounts(this.handle,...t)}getSceneMetadata(...t){return this.engine.getSceneMetadata(this.handle,...t)}getSceneObjectParent(...t){return this.engine.getSceneObjectParent(this.handle,...t)}getSceneObjectType(...t){return this.engine.getSceneObjectType(this.handle,...t)}getDrawnOctantMask(...t){return this.engine.getDrawnOctantMask(this.handle,...t)}getLocalTransform(...t){return this.engine.getLocalTransform(this.handle,...t)}getWorldTransform(...t){return this.engine.getWorldTransform(this.handle,...t)}hasAttribute(...t){return this.engine.hasAttribute(this.handle,...t)}isSceneObjectAncestorOf(...t){return this.engine.isSceneObjectAncestorOf(this.handle,...t)}lockScene(...t){return this.engine.lockScene(this.handle,...t)}removeStream(...t){return this.engine.removeStream(this.handle,...t)}setAssetViewerKey(...t){return this.engine.setAssetViewerKey(this.handle,...t)}setClientSpatialFormat(...t){return this.engine.setClientSpatialFormat(this.handle,...t)}setRuntimeSettings(...t){return this.engine.setRuntimeSettings(this.handle,...t)}setMainCameraTransform(...t){return this.engine.setMainCameraTransform(this.handle,...t)}setMainCameraViewFrustum(...t){return this.engine.setMainCameraViewFrustum(this.handle,...t)}setSceneObjectTransform(...t){return this.engine.setSceneObjectTransform(this.handle,...t)}hasFeature(...t){return this.engine.hasFeature(this.handle,...t)}getFeatureVersion(...t){return this.engine.getFeatureVersion(this.handle,...t)}getFeatureState(...t){return this.engine.getFeatureState(this.handle,...t)}getName(...t){return this.engine.getName(this.handle,...t)}setVariantSelection(...t){return this.engine.setVariantSelection(this.handle,...t)}takeAttribute(...t){return this.engine.takeAttribute(this.handle,...t)}takeEvictedClientSideAttributeIds(...t){return this.engine.takeEvictedClientSideAttributeIds(this.handle,...t)}takeRenderRequired(...t){return this.engine.takeRenderRequired(this.handle,...t)}unlockScene(...t){return this.engine.unlockScene(this.handle,...t)}updateSceneExecution(...t){return this.engine.updateSceneExecution(this.handle,...t)}recordFrameTime(...t){return this.engine.recordFrameTime(this.handle,...t)}},T=class t extends EventTarget{static#k=/* @__PURE__ */new Map;static#S=/* @__PURE__ */new Map;#dt=null;get camera(){return this.#dt}set camera(t){this.#dt=t}#ht=null;static forId(e){return t.#k.get(e)}static forKey(e){return t.#S.get(e)}#C;get key(){return this.#C??null}set key(e){t.#S.delete(this.key),(e||0===e)&&t.#S.set(e,this),this.#C=e}#ft=/* @__PURE__ */new Set;#pt=/* @__PURE__ */new Map;get viewerKey(){return this.client.viewerKey}set viewerKey(t){t&&(this.client.viewerKey=t)}get streams(){return new Set(this.#ft)}#O=new y;get lods(){return this.#O}constructor({miris:e,viewerKey:r}){super(),Object.defineProperties(this,{miris:{value:e,enumerable:!0},engine:{value:e.engine,enumerable:!0},client:{value:new $({engine:e.engine,context:e.sharedContext})}}),r&&(this.viewerKey=r);const n=new this.engine.SpatialFormat;n.metersPerUnit=1,n.upAxis=this.engine.UpAxis.Y,n.matrixOrder=this.engine.MatrixOrder.ColumnMajor,n.handedness=this.engine.Handedness.Right,this.client.setClientSpatialFormat(n),n.delete(),t.#k.set(this.id,this),e.add(this)}dispose(){this.close(),this.client.dispose()}#mt(){const t=this.client.getDefaultCameraId();this.#ht=t>=0?t:null}_getViewingVolumeObb(){const t=this.client.getViewingVolumeId();if(t<0)return null;const e=this.miris.getWorldTransform(this.client,t);if(!e)return null;const{engine:r,client:n}=this,i=r.malloc(24);try{n.getLocalBoundingBox(t,i);const a=Float32Array.from(r.heapF32.subarray(i/4,i/4+6));if(a.length<6||!a.every(t=>Number.isFinite(t)))return null;const[s=0,o=0,c=0,u=0,l=0,d=0]=a;return{min:[s-u/2,o-l/2,c-d/2],max:[s+u/2,o+l/2,c+d/2],matrix:e}}finally{r.free(i)}}async fetchAssets(t){if(!this.viewerKey)throw new Error("Could not fetch assets because there is no viewer key");const e=new this.engine.StringVector;let r=[];"string"==typeof t?r=t.split(","):t?.[Symbol.iterator]&&(r=[...t]);for(const s of r)e.push_back(s);const n=await this.client.getAssetsAsync(e),i=[],a=new TextDecoder;for(const{name:s,tags:o,thumbnailUrl:c,uuid:u}of n){const t={name:s,thumbnailUrl:c,uuid:u,tags:[]},e=o.size();for(let r=0;r<e;r+=1){let e=o.get(r);e&&("string"!=typeof e&&(e=a.decode(e)),t.tags.push(e))}i.push(t)}return e.delete(),i}getDefaultCameraTransform(){return null===this.#ht?null:this.miris.getWorldTransform(this.client,this.#ht)}add(t){this.#ft.add(t),this.#pt.set(t.id,t)}getStreamForId(t){return this.#pt.get(t)}getStreamForDescendentId(t){for(const[e,r]of this.#pt)if(this.client.isSceneObjectAncestorOf(e,t))return r;return null}getModelRootForDescendentId(t){for(const[,e]of this.#pt)for(const r of e.modelRoots)if(this.client.isSceneObjectAncestorOf(r.id,t))return r;return null}async _getFeatureMesh(t,e,r){if(!this.client.hasFeature(t,e))return null;if(this.client.getFeatureState(t,e)!==f.FeatureState.Loaded)return null;const i=this.client.getFeatureVersion(t,e);if(1===i){const e=`${r}_v${i}`,a=new this.engine.AttributeInfo;try{if(this.client.getAttribute(t,e,a.$$.ptr)!==f.AquaStatus.Success)return null;if(0n!==a.clientSideId)return n.get(Number(a.clientSideId));const r=this.engine.dataPtrView(a),i=new Uint8Array(r.buffer).subarray(r.byteOffset,r.byteOffset+r.byteLength).slice().buffer,s=n.add(i),o=this.client.takeAttribute(t,e,BigInt(s));return o!==f.AquaStatus.Success?(n.remove(s),console.warn(`Failed to take attribute ${e} for scene object ${t}: status ${o}`),null):i}finally{a.delete()}}return console.warn(`getFeatureMesh: unsupported version ${i} for feature ${e}`),null}async _getDrMap(t){if(!this.client.hasFeature(t,f.Feature.DrMap))return null;if(this.client.getFeatureState(t,f.Feature.DrMap)!==f.FeatureState.Loaded)return null;const e=this.client.getFeatureVersion(t,f.Feature.DrMap);if(1===e||2===e){const r=`drMap_v${e}`,i=new this.engine.AttributeInfo;try{if(this.client.getAttribute(t,r,i.$$.ptr)!==f.AquaStatus.Success)return null;if(0n!==i.clientSideId){const t=n.get(Number(i.clientSideId));return void 0!==t?{bytes:t,version:e}:null}const a=this.engine.dataPtrView(i),s=new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.byteLength).slice(),o=n.add(s);console.log(`_getDrMap is calling takeAttribute for ${r} with id ${o}`);const c=this.client.takeAttribute(t,r,BigInt(o));if(c!==f.AquaStatus.Success){if(n.remove(o),this.client.getAttribute(t,r,i.$$.ptr)===f.AquaStatus.Success&&0n!==i.clientSideId){const t=n.get(Number(i.clientSideId));return void 0!==t?{bytes:t,version:e}:null}return console.warn(`getDrMap: failed to take attribute ${r} for scene object ${t}: status ${c}`),null}return{bytes:s,version:e}}finally{i.delete()}}return console.warn(`getDrMap: unsupported DR map version ${e}`),null}async _onFeatureData(t){const e=await this._getDrMap(t);null!==e&&this.dispatchEvent(new CustomEvent("drmaploaded",{detail:{bytes:e.bytes,version:e.version,sceneObjectId:t}}));const r=await this._getFeatureMesh(t,f.Feature.ReflMesh,"reflMesh");null!==r&&this.dispatchEvent(new CustomEvent("reflmeshloaded",{detail:{buffer:r,sceneObjectId:t}}));const n=await this._getFeatureMesh(t,f.Feature.GlassMesh,"glassMesh");null!==n&&this.dispatchEvent(new CustomEvent("glassmeshloaded",{detail:{buffer:n,sceneObjectId:t}}))}_onSceneLoaded(){this.#mt(),this.dispatchEvent(new Event("sceneloaded"))}delete(t){this.#ft.delete(t),this.#pt.delete(t.id),S.forId(t.id)&&t.end()}close(){for(const t of this.streams)t.end();t.#k.delete(this.id),t.#S.delete(this.key),this.miris.scenes.has(this)&&this.miris.delete(this)}};export{v as AttributeNames,C as Camera,_ as Lod,y as LodStore,E as Miris,b as ModelRoot,T as Scene,S as Stream,p as sparkAttributeList};
|