UNPKG

lazts

Version:

TypeScript package for loading LAS/LAZ, primary developed for for WebGL applications, intended for lazy people who just want to load their point clouds and don't care about the details.

22 lines 61.6 kB
(function(Y,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(Y=typeof globalThis<"u"?globalThis:Y||self,H(Y.lazts={}))})(this,function(Y){"use strict";var Zn=Object.defineProperty;var Qn=(Y,H,ee)=>H in Y?Zn(Y,H,{enumerable:!0,configurable:!0,writable:!0,value:ee}):Y[H]=ee;var E=(Y,H,ee)=>(Qn(Y,typeof H!="symbol"?H+"":H,ee),ee);function H(p,f){const{attributes:h}=p,{position:d,intensity:b,classification:i}=h;console.log(`File size: ${f/1024/1024} MB, Memory used ${Math.round((d.value.length*4+b.value.length*4+i.value.length)/1024/1024)} MB`)}const ee={0:p=>({position:[p.getInt32(0,!0),p.getInt32(4,!0),p.getInt32(8,!0)],intensity:p.getUint16(12,!0),classification:p.getUint8(15)}),1:p=>({position:[p.getInt32(0,!0),p.getInt32(4,!0),p.getInt32(8,!0)],intensity:p.getUint16(12,!0),classification:p.getUint8(15)}),2:p=>({position:[p.getInt32(0,!0),p.getInt32(4,!0),p.getInt32(8,!0)],intensity:p.getUint16(12,!0),classification:p.getUint8(15),color:[p.getUint16(20,!0),p.getUint16(22,!0),p.getUint16(24,!0)]}),3:p=>({position:[p.getInt32(0,!0),p.getInt32(4,!0),p.getInt32(8,!0)],intensity:p.getUint16(12,!0),classification:p.getUint8(15),color:[p.getUint16(28,!0),p.getUint16(30,!0),p.getUint16(32,!0)]})};function te(p,f={},h,d){d=d===void 0||d===0?1:d;const b=p.slice(h,h+f.BYTES_PER_ELEMENT*d),i=new f(b);if(d===1)return i[0];const P=[];for(let A=0;A<d;A++)P.push(i[A]);return P}function lt(p){let f=131;const h={pointsOffset:te(p,Uint32Array,32*3),pointsFormatId:te(p,Uint8Array,32*3+8),pointsStructSize:te(p,Uint16Array,32*3+8+1),pointsCount:te(p,Uint32Array,32*3+11),scale:te(p,Float64Array,f,3)};f+=24,h.offset=te(p,Float64Array,f,3),f+=24;const d=te(p,Float64Array,f,6);return f+=48,h.maxs=[d[0],d[2],d[4]],h.mins=[d[1],d[3],d[5]],h}class jt{constructor(f,h,d){E(this,"arrayb");E(this,"decoder");E(this,"pointsCount");E(this,"pointSize");E(this,"scale");E(this,"offset");E(this,"mins");E(this,"maxs");this.arrayb=f,this.decoder=ee[d.pointsFormatId],this.pointsCount=h,this.pointSize=d.pointsStructSize,this.scale=d.scale,this.offset=d.offset,this.mins=d.mins,this.maxs=d.maxs}getPoint(f){if(f<0||f>=this.pointsCount)throw new Error("Point index out of range");const h=new DataView(this.arrayb,f*this.pointSize,this.pointSize);return this.decoder(h)}}class zt{constructor(f){E(this,"arraybuffer");E(this,"readOffset",0);E(this,"header",{pointsOffset:0,pointsFormatId:0,pointsStructSize:0,pointsCount:0,scale:[0,0,0],offset:[0,0,0],maxs:[0],mins:[0],totalToRead:0,totalRead:0,versionAsString:"",isCompressed:!0});this.arraybuffer=f}async open(){return!0}getHeader(){return this.header=lt(this.arraybuffer),this.header}readData(f,h){const{header:d,arraybuffer:b}=this;if(!d)throw new Error("Cannot start reading data till a header request is issued");let{readOffset:i}=this,P;if(h<=1){f=Math.min(f,d.pointsCount-i),P=d.pointsOffset+i*d.pointsStructSize;const $=P+f*d.pointsStructSize;return i+=f,this.readOffset=i,{buffer:b.slice(P,$),count:f,hasMoreData:i<d.pointsCount}}const A=Math.min(f*h,d.pointsCount-i),M=Math.ceil(A/h);let D=0;const I=new Uint8Array(M*d.pointsStructSize);for(let $=0;$<A;$++){if($%h===0){P=d.pointsOffset+i*d.pointsStructSize;const ce=new Uint8Array(b,P,d.pointsStructSize);I.set(ce,D*d.pointsStructSize),D++}i++}return this.readOffset=i,{buffer:I.buffer,count:D,hasMoreData:i<d.pointsCount}}close(){return this.arraybuffer=null,!0}}var ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ie={},ct={exports:{}};(function(p,f){var h=(()=>{var d=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(b){b=b||{};var i=typeof b<"u"?b:{},P,A;i.ready=new Promise(function(e,t){P=e,A=t}),["_main","___getTypeName","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(i.ready,e)||Object.defineProperty(i.ready,e,{get:()=>W("You are getting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>W("You are setting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})});var M=Object.assign({},i),D="./this.program",I=!0,$=!1,ce=!1,xe=!1;if(i.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var G="";function Qt(e){return i.locateFile?i.locateFile(e,G):G+e}var er;if(typeof document<"u"&&document.currentScript&&(G=document.currentScript.src),d&&(G=d),G.indexOf("blob:")!==0?G=G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1):G="",!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var tr=i.print||console.log.bind(console),U=i.printErr||console.warn.bind(console);Object.assign(i,M),M=null,Bn(),i.arguments&&i.arguments,J("arguments","arguments_"),i.thisProgram&&(D=i.thisProgram),J("thisProgram","thisProgram"),i.quit&&i.quit,J("quit","quit_"),m(typeof i.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),m(typeof i.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),m(typeof i.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),m(typeof i.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),m(typeof i.read>"u","Module.read option was removed (modify read_ in JS)"),m(typeof i.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),m(typeof i.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),m(typeof i.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),m(typeof i.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),J("read","read_"),J("readAsync","readAsync"),J("readBinary","readBinary"),J("setWindowTitle","setWindowTitle"),m(!$,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),m(!ce,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),m(!xe,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");function J(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){W("Module."+e+" has been replaced with plain "+t+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}function rr(e){Object.getOwnPropertyDescriptor(i,e)&&W("`Module."+e+"` was supplied but `"+e+"` not included in INCOMING_MODULE_JS_API")}function dt(e){return e==="FS_createPath"||e==="FS_createDataFile"||e==="FS_createPreloadedFile"||e==="FS_unlink"||e==="addRunDependency"||e==="FS_createLazyFile"||e==="FS_createDevice"||e==="removeRunDependency"}function nr(e){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,e)&&Object.defineProperty(globalThis,e,{configurable:!0,get:function(){var t="`"+e+"` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line";dt(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),le(t)}})}function ir(e){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){var t="'"+e+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";dt(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),W(t)}})}var ye;i.wasmBinary&&(ye=i.wasmBinary),J("wasmBinary","wasmBinary"),i.noExitRuntime,J("noExitRuntime","noExitRuntime"),typeof WebAssembly!="object"&&W("no native wasm support detected");var _e,Fe=!1;function m(e,t){e||W("Assertion failed"+(t?": "+t:""))}var pt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function gt(e,t,r){for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.buffer&&pt)return pt.decode(e.subarray(t,a));for(var s="";t<a;){var u=e[t++];if(!(u&128)){s+=String.fromCharCode(u);continue}var o=e[t++]&63;if((u&224)==192){s+=String.fromCharCode((u&31)<<6|o);continue}var l=e[t++]&63;if((u&240)==224?u=(u&15)<<12|o<<6|l:((u&248)!=240&&le("Invalid UTF-8 leading byte 0x"+u.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),u=(u&7)<<18|o<<12|l<<6|e[t++]&63),u<65536)s+=String.fromCharCode(u);else{var g=u-65536;s+=String.fromCharCode(55296|g>>10,56320|g&1023)}}return s}function He(e,t){return e?gt(N,e,t):""}function ht(e,t,r,n){if(!(n>0))return 0;for(var a=r,s=r+n-1,u=0;u<e.length;++u){var o=e.charCodeAt(u);if(o>=55296&&o<=57343){var l=e.charCodeAt(++u);o=65536+((o&1023)<<10)|l&1023}if(o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|o&63}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|o&63}else{if(r+3>=s)break;o>1114111&&le("Invalid Unicode code point 0x"+o.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|o&63}}return t[r]=0,r-a}function ar(e,t,r){return m(typeof r=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),ht(e,N,t,r)}function mt(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}var Ae,K,N,fe,Ie,C,S,yt,_t;function vt(e){Ae=e,i.HEAP8=K=new Int8Array(e),i.HEAP16=fe=new Int16Array(e),i.HEAP32=C=new Int32Array(e),i.HEAPU8=N=new Uint8Array(e),i.HEAPU16=Ie=new Uint16Array(e),i.HEAPU32=S=new Uint32Array(e),i.HEAPF32=yt=new Float32Array(e),i.HEAPF64=_t=new Float64Array(e)}var je=65536;i.TOTAL_STACK&&m(je===i.TOTAL_STACK,"the stack size can no longer be determined at runtime");var ze=i.INITIAL_MEMORY||262144;J("INITIAL_MEMORY","INITIAL_MEMORY"),m(ze>=je,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+ze+"! (TOTAL_STACK="+je+")"),m(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),m(!i.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),m(ze==262144,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var Me;function or(){var e=st();m((e&3)==0),S[e>>2]=34821223,S[e+4>>2]=2310721022,S[0]=1668509029}function Ye(){if(!Fe){var e=st(),t=S[e>>2],r=S[e+4>>2];(t!=34821223||r!=2310721022)&&W("Stack overflow! Stack cookie has been overwritten at 0x"+e.toString(16)+", expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+r.toString(16)+" 0x"+t.toString(16)),S[0]!==1668509029&&W("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,t[0]!==115||t[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var bt=[],wt=[],Tt=[],Ve=!1;function sr(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)cr(i.preRun.shift());Be(bt)}function lr(){m(!Ve),Ve=!0,Ye(),Be(wt)}function ur(){if(Ye(),i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)dr(i.postRun.shift());Be(Tt)}function cr(e){bt.unshift(e)}function fr(e){wt.unshift(e)}function dr(e){Tt.unshift(e)}m(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),m(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),m(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),m(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var oe=0,se=null,ve=null,be={};function pr(e){oe++,i.monitorRunDependencies&&i.monitorRunDependencies(oe),e?(m(!be[e]),be[e]=1,se===null&&typeof setInterval<"u"&&(se=setInterval(function(){if(Fe){clearInterval(se),se=null;return}var t=!1;for(var r in be)t||(t=!0,U("still waiting on run dependencies:")),U("dependency: "+r);t&&U("(end of list)")},1e4))):U("warning: run dependency added without ID")}function gr(e){if(oe--,i.monitorRunDependencies&&i.monitorRunDependencies(oe),e?(m(be[e]),delete be[e]):U("warning: run dependency removed without ID"),oe==0&&(se!==null&&(clearInterval(se),se=null),ve)){var t=ve;ve=null,t()}}function W(e){i.onAbort&&i.onAbort(e),e="Aborted("+e+")",U(e),Fe=!0;var t=new WebAssembly.RuntimeError(e);throw A(t),t}var V={error:function(){W("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM")},init:function(){V.error()},createDataFile:function(){V.error()},createPreloadedFile:function(){V.error()},createLazyFile:function(){V.error()},open:function(){V.error()},mkdev:function(){V.error()},registerDevice:function(){V.error()},analyzePath:function(){V.error()},loadFilesFromDB:function(){V.error()},ErrnoError:function(){V.error()}};i.FS_createDataFile=V.createDataFile,i.FS_createPreloadedFile=V.createPreloadedFile;var hr="data:application/octet-stream;base64,";function St(e){return e.startsWith(hr)}function mr(e){return e.startsWith("file://")}function O(e,t){return function(){var r=e,n=t;return t||(n=i.asm),m(Ve,"native function `"+r+"` called before runtime initialization"),n[e]||m(n[e],"exported native function `"+r+"` not found"),n[e].apply(null,arguments)}}var j;j="laz-perf.wasm",St(j)||(j=Qt(j));function Ct(e){try{if(e==j&&ye)return new Uint8Array(ye);throw"both async and sync fetching of the wasm failed"}catch(t){W(t)}}function yr(){return!ye&&I&&typeof fetch=="function"?fetch(j,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+j+"'";return e.arrayBuffer()}).catch(function(){return Ct(j)}):Promise.resolve().then(function(){return Ct(j)})}function _r(){var e={env:Wt,wasi_snapshot_preview1:Wt};function t(o,l){var g=o.exports;i.asm=g,_e=i.asm.memory,m(_e,"memory not found in wasm exports"),vt(_e.buffer),Me=i.asm.__indirect_function_table,m(Me,"table not found in wasm exports"),fr(i.asm.__wasm_call_ctors),gr("wasm-instantiate")}pr("wasm-instantiate");var r=i;function n(o){m(i===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(o.instance)}function a(o){return yr().then(function(l){return WebAssembly.instantiate(l,e)}).then(function(l){return l}).then(o,function(l){U("failed to asynchronously prepare wasm: "+l),mr(j)&&U("warning: Loading from a file URI ("+j+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),W(l)})}function s(){return!ye&&typeof WebAssembly.instantiateStreaming=="function"&&!St(j)&&typeof fetch=="function"?fetch(j,{credentials:"same-origin"}).then(function(o){var l=WebAssembly.instantiateStreaming(o,e);return l.then(n,function(g){return U("wasm streaming compile failed: "+g),U("falling back to ArrayBuffer instantiation"),a(n)})}):a(n)}if(i.instantiateWasm)try{var u=i.instantiateWasm(e,t);return u}catch(o){return U("Module.instantiateWasm callback failed with error: "+o),!1}return s().catch(A),{}}function Be(e){for(;e.length>0;)e.shift()(i)}function le(e){le.shown||(le.shown={}),le.shown[e]||(le.shown[e]=1,U(e))}function vr(e,t){m(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),K.set(e,t)}function br(e){return ot(e+24)+24}function wr(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(t){S[this.ptr+4>>2]=t},this.get_type=function(){return S[this.ptr+4>>2]},this.set_destructor=function(t){S[this.ptr+8>>2]=t},this.get_destructor=function(){return S[this.ptr+8>>2]},this.set_refcount=function(t){C[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,K[this.ptr+12>>0]=t},this.get_caught=function(){return K[this.ptr+12>>0]!=0},this.set_rethrown=function(t){t=t?1:0,K[this.ptr+13>>0]=t},this.get_rethrown=function(){return K[this.ptr+13>>0]!=0},this.init=function(t,r){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=C[this.ptr>>2];C[this.ptr>>2]=t+1},this.release_ref=function(){var t=C[this.ptr>>2];return C[this.ptr>>2]=t-1,m(t>0),t===1},this.set_adjusted_ptr=function(t){S[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return S[this.ptr+16>>2]},this.get_exception_ptr=function(){var t=Jn(this.get_type());if(t)return S[this.excPtr>>2];var r=this.get_adjusted_ptr();return r!==0?r:this.excPtr}}function Tr(e,t,r){var n=new wr(e);throw n.init(t,r),e+" - Exception catching is disabled, this exception cannot be caught. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch."}function Sr(e,t,r,n,a){}function Ge(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function Cr(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Et=e}var Et=void 0;function B(e){for(var t="",r=e;N[r];)t+=Et[N[r++]];return t}var de={},pe={},Oe={},Er=48,Pr=57;function Je(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=Er&&t<=Pr?"_"+e:e}function Ke(e,t){return e=Je(e),new Function("body","return function "+e+`() { "use strict"; return body.apply(this, arguments); }; `)(t)}function qe(e,t){var r=Ke(t,function(n){this.name=t,this.message=n;var a=new Error(n).stack;a!==void 0&&(this.stack=this.toString()+` `+a.replace(/^Error(:[^\n]*)?\n/,""))});return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},r}var ge=void 0;function T(e){throw new ge(e)}var Pt=void 0;function Re(e){throw new Pt(e)}function we(e,t,r){e.forEach(function(o){Oe[o]=t});function n(o){var l=r(o);l.length!==e.length&&Re("Mismatched type converter count");for(var g=0;g<e.length;++g)Z(e[g],l[g])}var a=new Array(t.length),s=[],u=0;t.forEach((o,l)=>{pe.hasOwnProperty(o)?a[l]=pe[o]:(s.push(o),de.hasOwnProperty(o)||(de[o]=[]),de[o].push(()=>{a[l]=pe[o],++u,u===s.length&&n(a)}))}),s.length===0&&n(a)}function Z(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(e||T('type "'+n+'" must have a positive integer typeid pointer'),pe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;T("Cannot register type '"+n+"' twice")}if(pe[e]=t,delete Oe[e],de.hasOwnProperty(e)){var a=de[e];delete de[e],a.forEach(s=>s())}}function Fr(e,t,r,n,a){var s=Ge(r);t=B(t),Z(e,{name:t,fromWireType:function(u){return!!u},toWireType:function(u,o){return o?n:a},argPackAdvance:8,readValueFromPointer:function(u){var o;if(r===1)o=K;else if(r===2)o=fe;else if(r===4)o=C;else throw new TypeError("Unknown boolean type size: "+t);return this.fromWireType(o[u>>s])},destructorFunction:null})}function Ar(e){if(!(this instanceof re)||!(e instanceof re))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,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}function Ir(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function Xe(e){function t(r){return r.$$.ptrType.registeredClass.name}T(t(e)+" instance already deleted")}var Ze=!1;function Ft(e){}function Mr(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function At(e){e.count.value-=1;var t=e.count.value===0;t&&Mr(e)}function It(e,t,r){if(t===r)return e;if(r.baseClass===void 0)return null;var n=It(e,t,r.baseClass);return n===null?null:r.downcast(n)}var Mt={};function Or(){return Object.keys(Ce).length}function Rr(){var e=[];for(var t in Ce)Ce.hasOwnProperty(t)&&e.push(Ce[t]);return e}var Te=[];function Qe(){for(;Te.length;){var e=Te.pop();e.$$.deleteScheduled=!1,e.delete()}}var Se=void 0;function kr(e){Se=e,Te.length&&Se&&Se(Qe)}function Dr(){i.getInheritedInstanceCount=Or,i.getLiveInheritedInstances=Rr,i.flushPendingDeletes=Qe,i.setDelayFunction=kr}var Ce={};function Ur(e,t){for(t===void 0&&T("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function Lr(e,t){return t=Ur(e,t),Ce[t]}function ke(e,t){(!t.ptrType||!t.ptr)&&Re("makeClassHandle requires ptr and ptrType");var r=!!t.smartPtrType,n=!!t.smartPtr;return r!==n&&Re("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ee(Object.create(e,{$$:{value:t}}))}function Ot(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Lr(this.registeredClass,t);if(r!==void 0){if(r.$$.count.value===0)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?ke(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ke(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s=this.registeredClass.getActualType(t),u=Mt[s];if(!u)return a.call(this);var o;this.isConst?o=u.constPointerType:o=u.pointerType;var l=It(t,this.registeredClass,o.registeredClass);return l===null?a.call(this):this.isSmartPointer?ke(o.registeredClass.instancePrototype,{ptrType:o,ptr:l,smartPtrType:this,smartPtr:e}):ke(o.registeredClass.instancePrototype,{ptrType:o,ptr:l})}function Ee(e){return typeof FinalizationRegistry>"u"?(Ee=t=>t,e):(Ze=new FinalizationRegistry(t=>{console.warn(t.leakWarning.stack.replace(/^Error: /,"")),At(t.$$)}),Ee=t=>{var r=t.$$,n=!!r.smartPtr;if(n){var a={$$:r},s=r.ptrType.registeredClass;a.leakWarning=new Error("Embind found a leaked C++ instance "+s.name+" <0x"+r.ptr.toString(16)+`>. We'll free it automatically in this case, but this functionality is not reliable across various environments. Make sure to invoke .delete() manually once you're done with the instance instead. Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(a.leakWarning,Ot),Ze.register(t,a,t)}return t},Ft=t=>Ze.unregister(t),Ee(e))}function $r(){if(this.$$.ptr||Xe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ee(Object.create(Object.getPrototypeOf(this),{$$:{value:Ir(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Nr(){this.$$.ptr||Xe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&T("Object already scheduled for deletion"),Ft(this),At(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Wr(){return!this.$$.ptr}function xr(){return this.$$.ptr||Xe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&T("Object already scheduled for deletion"),Te.push(this),Te.length===1&&Se&&Se(Qe),this.$$.deleteScheduled=!0,this}function Hr(){re.prototype.isAliasOf=Ar,re.prototype.clone=$r,re.prototype.delete=Nr,re.prototype.isDeleted=Wr,re.prototype.deleteLater=xr}function re(){}function Rt(e,t,r){if(e[t].overloadTable===void 0){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||T("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}}function jr(e,t,r){i.hasOwnProperty(e)?((r===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[r]!==void 0)&&T("Cannot register public name '"+e+"' twice"),Rt(i,e,e),i.hasOwnProperty(r)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),i[e].overloadTable[r]=t):(i[e]=t,r!==void 0&&(i[e].numArguments=r))}function zr(e,t,r,n,a,s,u,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=s,this.upcast=u,this.downcast=o,this.pureVirtualFunctions=[]}function et(e,t,r){for(;t!==r;)t.upcast||T("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Yr(e,t){if(t===null)return this.isReference&&T("null is not a valid "+this.name),0;t.$$||T('Cannot pass "'+me(t)+'" as a '+this.name),t.$$.ptr||T("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass,n=et(t.$$.ptr,r,this.registeredClass);return n}function Vr(e,t){var r;if(t===null)return this.isReference&&T("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,r),r):0;t.$$||T('Cannot pass "'+me(t)+'" as a '+this.name),t.$$.ptr||T("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&T("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=et(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&T("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:T("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(function(){a.delete()})),e!==null&&e.push(this.rawDestructor,r)}break;default:T("Unsupporting sharing policy")}return r}function Br(e,t){if(t===null)return this.isReference&&T("null is not a valid "+this.name),0;t.$$||T('Cannot pass "'+me(t)+'" as a '+this.name),t.$$.ptr||T("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&T("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass,n=et(t.$$.ptr,r,this.registeredClass);return n}function De(e){return this.fromWireType(C[e>>2])}function Gr(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Jr(e){this.rawDestructor&&this.rawDestructor(e)}function Kr(e){e!==null&&e.delete()}function qr(){Q.prototype.getPointee=Gr,Q.prototype.destructor=Jr,Q.prototype.argPackAdvance=8,Q.prototype.readValueFromPointer=De,Q.prototype.deleteObject=Kr,Q.prototype.fromWireType=Ot}function Q(e,t,r,n,a,s,u,o,l,g,w){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=s,this.sharingPolicy=u,this.rawGetPointee=o,this.rawConstructor=l,this.rawShare=g,this.rawDestructor=w,!a&&t.baseClass===void 0?n?(this.toWireType=Yr,this.destructorFunction=null):(this.toWireType=Br,this.destructorFunction=null):this.toWireType=Vr}function Xr(e,t,r){i.hasOwnProperty(e)||Re("Replacing nonexistant public symbol"),i[e].overloadTable!==void 0&&r!==void 0?i[e].overloadTable[r]=t:(i[e]=t,i[e].argCount=r)}function Zr(e,t,r){m("dynCall_"+e in i,"bad function pointer type - no table for sig '"+e+"'"),r&&r.length?m(r.length===e.substring(1).replace(/j/g,"--").length):m(e.length==1);var n=i["dynCall_"+e];return r&&r.length?n.apply(null,[t].concat(r)):n.call(null,t)}var Ue=[];function tt(e){var t=Ue[e];return t||(e>=Ue.length&&(Ue.length=e+1),Ue[e]=t=Me.get(e)),m(Me.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t}function Qr(e,t,r){if(e.includes("j"))return Zr(e,t,r);m(tt(t),"missing table entry in dynCall: "+t);var n=tt(t).apply(null,r);return n}function en(e,t){m(e.includes("j")||e.includes("p"),"getDynCaller should only be called with i64 sigs");var r=[];return function(){return r.length=0,Object.assign(r,arguments),Qr(e,t,r)}}function he(e,t){e=B(e);function r(){return e.includes("j")?en(e,t):tt(t)}var n=r();return typeof n!="function"&&T("unknown function pointer with signature "+e+": "+t),n}var kt=void 0;function tn(e){var t=Gn(e),r=B(t);return ne(t),r}function rt(e,t){var r=[],n={};function a(s){if(!n[s]&&!pe[s]){if(Oe[s]){Oe[s].forEach(a);return}r.push(s),n[s]=!0}}throw t.forEach(a),new kt(e+": "+r.map(tn).join([", "]))}function rn(e,t,r,n,a,s,u,o,l,g,w,v,_){w=B(w),s=he(a,s),o&&(o=he(u,o)),g&&(g=he(l,g)),_=he(v,_);var F=Je(w);jr(F,function(){rt("Cannot construct "+w+" due to unbound types",[n])}),we([e,t,r],n?[n]:[],function(R){R=R[0];var L,z;n?(L=R.registeredClass,z=L.instancePrototype):z=re.prototype;var X=Ke(F,function(){if(Object.getPrototypeOf(this)!==c)throw new ge("Use 'new' to construct "+w);if(y.constructor_body===void 0)throw new ge(w+" has no accessible constructor");var Ne=y.constructor_body[arguments.length];if(Ne===void 0)throw new ge("Tried to invoke ctor of "+w+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(y.constructor_body).toString()+") parameters instead!");return Ne.apply(this,arguments)}),c=Object.create(z,{constructor:{value:X}});X.prototype=c;var y=new zr(w,X,c,_,L,s,o,g),x=new Q(w,y,!0,!1,!1),k=new Q(w+"*",y,!1,!1,!1),ue=new Q(w+" const*",y,!1,!0,!1);return Mt[e]={pointerType:k,constPointerType:ue},Xr(F,X),[x,k,ue]})}function Dt(e,t){for(var r=[],n=0;n<e;n++)r.push(S[t+n*4>>2]);return r}function nn(e){for(;e.length;){var t=e.pop(),r=e.pop();r(t)}}function an(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=Ke(e.name||"unknownFunctionName",function(){});r.prototype=e.prototype;var n=new r,a=e.apply(n,t);return a instanceof Object?a:n}function Ut(e,t,r,n,a){var s=t.length;s<2&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=t[1]!==null&&r!==null,o=!1,l=1;l<t.length;++l)if(t[l]!==null&&t[l].destructorFunction===void 0){o=!0;break}for(var g=t[0].name!=="void",w="",v="",l=0;l<s-2;++l)w+=(l!==0?", ":"")+"arg"+l,v+=(l!==0?", ":"")+"arg"+l+"Wired";var _="return function "+Je(e)+"("+w+`) { if (arguments.length !== `+(s-2)+`) { throwBindingError('function `+e+" called with ' + arguments.length + ' arguments, expected "+(s-2)+` args!'); } `;o&&(_+=`var destructors = []; `);var F=o?"destructors":"null",R=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],L=[T,n,a,nn,t[0],t[1]];u&&(_+="var thisWired = classParam.toWireType("+F+`, this); `);for(var l=0;l<s-2;++l)_+="var arg"+l+"Wired = argType"+l+".toWireType("+F+", arg"+l+"); // "+t[l+2].name+` `,R.push("argType"+l),L.push(t[l+2]);if(u&&(v="thisWired"+(v.length>0?", ":"")+v),_+=(g?"var rv = ":"")+"invoker(fn"+(v.length>0?", ":"")+v+`); `,o)_+=`runDestructors(destructors); `;else for(var l=u?1:2;l<t.length;++l){var z=l===1?"thisWired":"arg"+(l-2)+"Wired";t[l].destructorFunction!==null&&(_+=z+"_dtor("+z+"); // "+t[l].name+` `,R.push(z+"_dtor"),L.push(t[l].destructorFunction))}g&&(_+=`var ret = retType.fromWireType(rv); return ret; `),_+=`} `,R.push(_);var X=an(Function,R).apply(null,L);return X}function on(e,t,r,n,a,s){m(t>0);var u=Dt(t,r);a=he(n,a),we([],[e],function(o){o=o[0];var l="constructor "+o.name;if(o.registeredClass.constructor_body===void 0&&(o.registeredClass.constructor_body=[]),o.registeredClass.constructor_body[t-1]!==void 0)throw new ge("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+o.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return o.registeredClass.constructor_body[t-1]=()=>{rt("Cannot construct "+o.name+" due to unbound types",u)},we([],u,function(g){return g.splice(1,0,null),o.registeredClass.constructor_body[t-1]=Ut(l,g,null,a,s),[]}),[]})}function sn(e,t,r,n,a,s,u,o){var l=Dt(r,n);t=B(t),s=he(a,s),we([],[e],function(g){g=g[0];var w=g.name+"."+t;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&g.registeredClass.pureVirtualFunctions.push(t);function v(){rt("Cannot call "+w+" due to unbound types",l)}var _=g.registeredClass.instancePrototype,F=_[t];return F===void 0||F.overloadTable===void 0&&F.className!==g.name&&F.argCount===r-2?(v.argCount=r-2,v.className=g.name,_[t]=v):(Rt(_,t,w),_[t].overloadTable[r-2]=v),we([],l,function(R){var L=Ut(w,R,g,s,u);return _[t].overloadTable===void 0?(L.argCount=r-2,_[t]=L):_[t].overloadTable[r-2]=L,[]}),[]})}var nt=[],q=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function ln(e){e>4&&--q[e].refcount===0&&(q[e]=void 0,nt.push(e))}function un(){for(var e=0,t=5;t<q.length;++t)q[t]!==void 0&&++e;return e}function cn(){for(var e=5;e<q.length;++e)if(q[e]!==void 0)return q[e];return null}function fn(){i.count_emval_handles=un,i.get_first_emval=cn}var it={toValue:e=>(e||T("Cannot use deleted val. handle = "+e),q[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var t=nt.length?nt.pop():q.length;return q[t]={refcount:1,value:e},t}}}};function dn(e,t){t=B(t),Z(e,{name:t,fromWireType:function(r){var n=it.toValue(r);return ln(r),n},toWireType:function(r,n){return it.toHandle(n)},argPackAdvance:8,readValueFromPointer:De,destructorFunction:null})}function me(e){if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e}function pn(e,t){switch(t){case 2:return function(r){return this.fromWireType(yt[r>>2])};case 3:return function(r){return this.fromWireType(_t[r>>3])};default:throw new TypeError("Unknown float type: "+e)}}function gn(e,t,r){var n=Ge(r);t=B(t),Z(e,{name:t,fromWireType:function(a){return a},toWireType:function(a,s){if(typeof s!="number"&&typeof s!="boolean")throw new TypeError('Cannot convert "'+me(s)+'" to '+this.name);return s},argPackAdvance:8,readValueFromPointer:pn(t,n),destructorFunction:null})}function hn(e,t,r){switch(t){case 0:return r?function(a){return K[a]}:function(a){return N[a]};case 1:return r?function(a){return fe[a>>1]}:function(a){return Ie[a>>1]};case 2:return r?function(a){return C[a>>2]}:function(a){return S[a>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function mn(e,t,r,n,a){t=B(t),a===-1&&(a=4294967295);var s=Ge(r),u=v=>v;if(n===0){var o=32-8*r;u=v=>v<<o>>>o}var l=t.includes("unsigned"),g=(v,_)=>{if(typeof v!="number"&&typeof v!="boolean")throw new TypeError('Cannot convert "'+me(v)+'" to '+_);if(v<n||v>a)throw new TypeError('Passing a number "'+me(v)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+a+"]!")},w;l?w=function(v,_){return g(_,this.name),_>>>0}:w=function(v,_){return g(_,this.name),_},Z(e,{name:t,fromWireType:u,toWireType:w,argPackAdvance:8,readValueFromPointer:hn(t,s,n!==0),destructorFunction:null})}function yn(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[t];function s(u){u=u>>2;var o=S,l=o[u],g=o[u+1];return new a(Ae,g,l)}r=B(r),Z(e,{name:r,fromWireType:s,argPackAdvance:8,readValueFromPointer:s},{ignoreDuplicateRegistrations:!0})}function _n(e,t){t=B(t);var r=t==="std::string";Z(e,{name:t,fromWireType:function(n){var a=S[n>>2],s=n+4,u;if(r)for(var o=s,l=0;l<=a;++l){var g=s+l;if(l==a||N[g]==0){var w=g-o,v=He(o,w);u===void 0?u=v:(u+=String.fromCharCode(0),u+=v),o=g+1}}else{for(var _=new Array(a),l=0;l<a;++l)_[l]=String.fromCharCode(N[s+l]);u=_.join("")}return ne(n),u},toWireType:function(n,a){a instanceof ArrayBuffer&&(a=new Uint8Array(a));var s,u=typeof a=="string";u||a instanceof Uint8Array||a instanceof Uint8ClampedArray||a instanceof Int8Array||T("Cannot pass non-string to std::string"),r&&u?s=mt(a):s=a.length;var o=ot(4+s+1),l=o+4;if(S[o>>2]=s,r&&u)ar(a,l,s+1);else if(u)for(var g=0;g<s;++g){var w=a.charCodeAt(g);w>255&&(ne(l),T("String has UTF-16 code units that do not fit in 8 bits")),N[l+g]=w}else for(var g=0;g<s;++g)N[l+g]=a[g];return n!==null&&n.push(ne,o),o},argPackAdvance:8,readValueFromPointer:De,destructorFunction:function(n){ne(n)}})}var Lt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function vn(e,t){m(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var r=e,n=r>>1,a=n+t/2;!(n>=a)&&Ie[n];)++n;if(r=n<<1,r-e>32&&Lt)return Lt.decode(N.subarray(e,r));for(var s="",u=0;!(u>=t/2);++u){var o=fe[e+u*2>>1];if(o==0)break;s+=String.fromCharCode(o)}return s}function bn(e,t,r){if(m(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),m(typeof r=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<2)return 0;r-=2;for(var n=t,a=r<e.length*2?r/2:e.length,s=0;s<a;++s){var u=e.charCodeAt(s);fe[t>>1]=u,t+=2}return fe[t>>1]=0,t-n}function wn(e){return e.length*2}function Tn(e,t){m(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var r=0,n="";!(r>=t/4);){var a=C[e+r*4>>2];if(a==0)break;if(++r,a>=65536){var s=a-65536;n+=String.fromCharCode(55296|s>>10,56320|s&1023)}else n+=String.fromCharCode(a)}return n}function Sn(e,t,r){if(m(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),m(typeof r=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<4)return 0;for(var n=t,a=n+r-4,s=0;s<e.length;++s){var u=e.charCodeAt(s);if(u>=55296&&u<=57343){var o=e.charCodeAt(++s);u=65536+((u&1023)<<10)|o&1023}if(C[t>>2]=u,t+=4,t+4>a)break}return C[t>>2]=0,t-n}function Cn(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function En(e,t,r){r=B(r);var n,a,s,u,o;t===2?(n=vn,a=bn,u=wn,s=()=>Ie,o=1):t===4&&(n=Tn,a=Sn,u=Cn,s=()=>S,o=2),Z(e,{name:r,fromWireType:function(l){for(var g=S[l>>2],w=s(),v,_=l+4,F=0;F<=g;++F){var R=l+4+F*t;if(F==g||w[R>>o]==0){var L=R-_,z=n(_,L);v===void 0?v=z:(v+=String.fromCharCode(0),v+=z),_=R+t}}return ne(l),v},toWireType:function(l,g){typeof g!="string"&&T("Cannot pass non-string to C++ string type "+r);var w=u(g),v=ot(4+w+t);return S[v>>2]=w>>o,a(g,v+4,w+t),l!==null&&l.push(ne,v),v},argPackAdvance:8,readValueFromPointer:De,destructorFunction:function(l){ne(l)}})}function Pn(e,t){t=B(t),Z(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:function(){},toWireType:function(r,n){}})}function Fn(){W("native code called abort()")}function An(e,t,r){N.copyWithin(e,t,t+r)}function In(){return 2147483648}function Mn(e){try{return _e.grow(e-Ae.byteLength+65535>>>16),vt(_e.buffer),1}catch(t){U("emscripten_realloc_buffer: Attempted to grow heap from "+Ae.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}function On(e){var t=N.length;e=e>>>0,m(e>t);var r=In();if(e>r)return U("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is "+r+" bytes!"),!1;let n=(l,g)=>l+(g-l%g)%g;for(var a=1;a<=4;a*=2){var s=t*(1+.2/a);s=Math.min(s,e+100663296);var u=Math.min(r,n(Math.max(e,s),65536)),o=Mn(u);if(o)return!0}return U("Failed to grow the heap from "+t+" bytes to "+u+" bytes, not enough memory!"),!1}var at={};function Rn(){return D||"./this.program"}function Pe(){if(!Pe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Rn()};for(var r in at)at[r]===void 0?delete t[r]:t[r]=at[r];var n=[];for(var r in t)n.push(r+"="+t[r]);Pe.strings=n}return Pe.strings}function kn(e,t,r){for(var n=0;n<e.length;++n)m(e.charCodeAt(n)===(e.charCodeAt(n)&255)),K[t++>>0]=e.charCodeAt(n);r||(K[t>>0]=0)}function Dn(e,t){var r=0;return Pe().forEach(function(n,a){var s=t+r;S[e+a*4>>2]=s,kn(n,s),r+=n.length+1}),0}function Un(e,t){var r=Pe();S[e>>2]=r.length;var n=0;return r.forEach(function(a){n+=a.length+1}),S[t>>2]=n,0}function Ln(e){W("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")}function $n(e,t,r,n,a){return 70}var Nn=[null,[],[]];function Wn(e,t){var r=Nn[e];m(r),t===0||t===10?((e===1?tr:U)(gt(r,0)),r.length=0):r.push(t)}function xn(e,t,r,n){for(var a=0,s=0;s<r;s++){var u=S[t>>2],o=S[t+4>>2];t+=8;for(var l=0;l<o;l++)Wn(e,N[u+l]);a+=o}return S[n>>2]=a,0}function Le(e){return e%4===0&&(e%100!==0||e%400===0)}function Hn(e,t){for(var r=0,n=0;n<=t;r+=e[n++]);return r}var $t=[31,29,31,30,31,30,31,31,30,31,30,31],Nt=[31,28,31,30,31,30,31,31,30,31,30,31];function jn(e,t){for(var r=new Date(e.getTime());t>0;){var n=Le(r.getFullYear()),a=r.getMonth(),s=(n?$t:Nt)[a];if(t>s-r.getDate())t-=s-r.getDate()+1,r.setDate(1),a<11?r.setMonth(a+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1));else return r.setDate(r.getDate()+t),r}return r}function zn(e,t,r){var n=r>0?r:mt(e)+1,a=new Array(n),s=ht(e,a,0,a.length);return t&&(a.length=s),a}function Yn(e,t,r,n){var a=C[n+40>>2],s={tm_sec:C[n>>2],tm_min:C[n+4>>2],tm_hour:C[n+8>>2],tm_mday:C[n+12>>2],tm_mon:C[n+16>>2],tm_year:C[n+20>>2],tm_wday:C[n+24>>2],tm_yday:C[n+28>>2],tm_isdst:C[n+32>>2],tm_gmtoff:C[n+36>>2],tm_zone:a?He(a):""},u=He(r),o={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var l in o)u=u.replace(new RegExp(l,"g"),o[l]);var g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],w=["January","February","March","April","May","June","July","August","September","October","November","December"];function v(c,y,x){for(var k=typeof c=="number"?c.toString():c||"";k.length<y;)k=x[0]+k;return k}function _(c,y){return v(c,y,"0")}function F(c,y){function x(ue){return ue<0?-1:ue>0?1:0}var k;return(k=x(c.getFullYear()-y.getFullYear()))===0&&(k=x(c.getMonth()-y.getMonth()))===0&&(k=x(c.getDate()-y.getDate())),k}function R(c){switch(c.getDay()){case 0:return new Date(c.getFullYear()-1,11,29);case 1:return c;case 2:return new Date(c.getFullYear(),0,3);case 3:return new Date(c.getFullYear(),0,2);case 4:return new Date(c.getFullYear(),0,1);case 5:return new Date(c.getFullYear()-1,11,31);case 6:return new Date(c.getFullYear()-1,11,30)}}function L(c){var y=jn(new Date(c.tm_year+1900,0,1),c.tm_yday),x=new Date(y.getFullYear(),0,4),k=new Date(y.getFullYear()+1,0,4),ue=R(x),Ne=R(k);return F(ue,y)<=0?F(Ne,y)<=0?y.getFullYear()+1:y.getFullYear():y.getFullYear()-1}var z={"%a":function(c){return g[c.tm_wday].substring(0,3)},"%A":function(c){return g[c.tm_wday]},"%b":function(c){return w[c.tm_mon].substring(0,3)},"%B":function(c){return w[c.tm_mon]},"%C":function(c){var y=c.tm_year+1900;return _(y/100|0,2)},"%d":function(c){return _(c.tm_mday,2)},"%e":function(c){return v(c.tm_mday,2," ")},"%g":function(c){return L(c).toString().substring(2)},"%G":function(c){return L(c)},"%H":function(c){return _(c.tm_hour,2)},"%I":function(c){var y=c.tm_hour;return y==0?y=12:y>12&&(y-=12),_(y,2)},"%j":function(c){return _(c.tm_mday+Hn(Le(c.tm_year+1900)?$t:Nt,c.tm_mon-1),3)},"%m":function(c){return _(c.tm_mon+1,2)},"%M":function(c){return _(c.tm_min,2)},"%n":function(){return` `},"%p":function(c){return c.tm_hour>=0&&c.tm_hour<12?"AM":"PM"},"%S":function(c){return _(c.tm_sec,2)},"%t":function(){return" "},"%u":function(c){return c.tm_wday||7},"%U":function(c){var y=c.tm_yday+7-c.tm_wday;return _(Math.floor(y/7),2)},"%V":function(c){var y=Math.floor((c.tm_yday+7-(c.tm_wday+6)%7)/7);if((c.tm_wday+371-c.tm_yday-2)%7<=2&&y++,y){if(y==53){var k=(c.tm_wday+371-c.tm_yday)%7;k!=4&&(k!=3||!Le(c.tm_year))&&(y=1)}}else{y=52;var x=(c.tm_wday+7-c.tm_yday-1)%7;(x==4||x==5&&Le(c.tm_year%400-1))&&y++}return _(y,2)},"%w":function(c){return c.tm_wday},"%W":function(c){var y=c.tm_yday+7-(c.tm_wday+6)%7;return _(Math.floor(y/7),2)},"%y":function(c){return(c.tm_year+1900).toString().substring(2)},"%Y":function(c){return c.tm_year+1900},"%z":function(c){var y=c.tm_gmtoff,x=y>=0;return y=Math.abs(y)/60,y=y/60*100+y%60,(x?"+":"-")+("0000"+y).slice(-4)},"%Z":function(c){return c.tm_zone},"%%":function(){return"%"}};u=u.replace(/%%/g,"\0\0");for(var l in z)u.includes(l)&&(u=u.replace(new RegExp(l,"g"),z[l](s)));u=u.replace(/\0\0/g,"%");var X=zn(u,!1);return X.length>t?0:(vr(X,e),X.length-1)}function Vn(e,t,r,n){return Yn(e,t,r,n)}Cr(),ge=i.BindingError=qe(Error,"BindingError"),Pt=i.InternalError=qe(Error,"InternalError"),Hr(),Dr(),qr(),kt=i.UnboundTypeError=qe(Error,"UnboundTypeError"),fn();function Bn(){rr("fetchSettings")}var Wt={__cxa_allocate_exception:br,__cxa_throw:Tr,_embind_register_bigint:Sr,_embind_register_bool:Fr,_embind_register_class:rn,_embind_register_class_constructor:on,_embind_register_class_function:sn,_embind_register_emval:dn,_embind_register_float:gn,_embind_register_integer:mn,_embind_register_memory_view:yn,_embind_register_std_string:_n,_embind_register_std_wstring:En,_embind_register_void:Pn,abort:Fn,emscripten_memcpy_big:An,emscripten_resize_heap:On,environ_get:Dn,environ_sizes_get:Un,fd_close:Ln,fd_seek:$n,fd_write:xn,strftime_l:Vn};_r(),i.___wasm_call_ctors=O("__wasm_call_ctors");var ot=i._malloc=O("malloc"),ne=i._free=O("free"),Gn=i.___getTypeName=O("__getTypeName");i.__embind_initialize_bindings=O("_embind_initialize_bindings"),i.___errno_location=O("__errno_location"),i._fflush=O("fflush");var xt=i._emscripten_stack_init=function(){return(xt=i._emscripten_stack_init=i.asm.emscripten_stack_init).apply(null,arguments)};i._emscripten_stack_get_free=function(){return(i._emscripten_stack_get_free=i.asm.emscripten_stack_get_free).apply(null,arguments)},i._emscripten_stack_get_base=function(){return(i._emscripten_stack_get_base=i.asm.emscripten_stack_get_base).apply(null,arguments)};var st=i._emscripten_stack_get_end=function(){return(st=i._emscripten_stack_get_end=i.asm.emscripten_stack_get_end).apply(null,arguments)};i.stackSave=O("stackSave"),i.stackRestore=O("stackRestore"),i.stackAlloc=O("stackAlloc");var Jn=i.___cxa_is_pointer_type=O("__cxa_is_pointer_type");i.dynCall_viijii=O("dynCall_viijii"),i.dynCall_ji=O("dynCall_ji"),i.dynCall_jiji=O("dynCall_jiji"),i.dynCall_iiiiij=O("dynCall_iiiiij"),i.dynCall_iiiiijj=O("dynCall_iiiiijj"),i.dynCall_iiiiiijj=O("dynCall_iiiiiijj");var Kn=["run","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","FS_createFolder","FS_createPath","FS_createDataFile","FS_createPreloadedFile","FS_createLazyFile","FS_createLink","FS_createDevice","FS_unlink","getLEB","getFunctionTables","alignFunctionTables","registerFunctions","prettyPrint","getCompilerSetting","print","printErr","callMain","abort","keepRuntimeAlive","wasmMemory","stackAlloc","stackSave","stackRestore","getTempRet0","setTempRet0","writeStackCookie","checkStackCookie","ptrToString","zeroMemory","stringToNewUTF8","exitJS","getHeapMax","emscripten_realloc_buffer","ENV","ERRNO_CODES","ERRNO_MESSAGES","setErrNo","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","DNS","getHostByName","Protocols","Sockets","getRandomDevice","warnOnce","traverseStack","UNWIND_CACHE","convertPCtoSourceLocation","readAsmConstArgsArray","readAsmConstArgs","mainThreadEM_ASM","jstoi_q","jstoi_s","getExecutableName","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","safeSetTimeout","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getCFunc","ccall","cwrap","uleb128Encode","sigToWasmTypes","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","setValue","getValue","PATH","PATH_FS","intArrayFromString","intArrayToString","AsciiToString","stringToAscii","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","allocateUTF8","allocateUTF8OnStack","writeStringToMemory","writeArrayToMemory","writeAsciiToMemory","SYSCALLS","getSocketFromFD","getSocketAddress","JSEvents","registerKeyEventCallback","specialHTMLTargets","maybeCStringToJsString","findEventTarget","findCanvasEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFull