@fnndsc/argus 0.7.0 → 0.7.2

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.
Files changed (45) hide show
  1. package/dist/assets/ChRISlogo-color-t-i99soF.svg +164 -0
  2. package/dist/assets/MesloLGS-NF-Bold-DbxbaV6p.ttf +0 -0
  3. package/dist/assets/MesloLGS-NF-Regular-DAUcZJjt.ttf +0 -0
  4. package/dist/assets/Settings-B_WPNkCE.js +4407 -0
  5. package/dist/assets/_commonjsHelpers-CE1G-McA.js +1 -0
  6. package/dist/assets/addVolumesToViewports-kPbPUzG1.js +1 -0
  7. package/dist/assets/antonio-latin-400-normal-CZjzwNAN.woff2 +0 -0
  8. package/dist/assets/antonio-latin-700-normal-DSH-lEDG.woff2 +0 -0
  9. package/dist/assets/arrive-ClURnB_N.wav +0 -0
  10. package/dist/assets/blosc-CrUiACa7.js +17 -0
  11. package/dist/assets/chakra-petch-latin-400-normal-SafcrIr2.woff2 +0 -0
  12. package/dist/assets/chakra-petch-latin-500-normal-BR1ody1F.woff2 +0 -0
  13. package/dist/assets/chakra-petch-latin-600-normal-DVQm9bgb.woff2 +0 -0
  14. package/dist/assets/chakra-petch-latin-700-normal-CnDBPjkL.woff2 +0 -0
  15. package/dist/assets/charlswasm_decode-BrO4esUm.wasm +0 -0
  16. package/dist/assets/chunk-INHXZS53-D3tQiqtZ.js +1 -0
  17. package/dist/assets/computeWorker-D8XJyv-f.js +4095 -0
  18. package/dist/assets/cornerstoneEngine-COmMRWtq.js +2 -0
  19. package/dist/assets/dcmjs.es-DfWkgqfk.js +18 -0
  20. package/dist/assets/decodeImageFrameWorker-BtcTb_T6.js +5 -0
  21. package/dist/assets/index-B1IRr1ii.js +4145 -0
  22. package/dist/assets/index-BEqlmVJ8.js +2456 -0
  23. package/dist/assets/index-BbgujRGq.css +1 -0
  24. package/dist/assets/index-BivV2-EJ.js +9 -0
  25. package/dist/assets/index-CH659Lsh.js +1 -0
  26. package/dist/assets/index-DRvbvdZm.js +320 -0
  27. package/dist/assets/index-Ddoc1eo6.js +1 -0
  28. package/dist/assets/index-WxcTPiRU.js +2 -0
  29. package/dist/assets/index-oaz5IMVa.js +1 -0
  30. package/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  31. package/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  32. package/dist/assets/jpeg-B-x1txLf.js +1 -0
  33. package/dist/assets/libjpegturbowasm_decode-7ZJ2wGuU.wasm +0 -0
  34. package/dist/assets/lossless-CyYqoyFe.js +1 -0
  35. package/dist/assets/lz4-B_Exjfmr.js +15 -0
  36. package/dist/assets/niivueEngine-B2PDgoH7.js +2 -0
  37. package/dist/assets/openjpegwasm_decode-B3gWTHpv.wasm +0 -0
  38. package/dist/assets/openjphjs-B5O5ikHp.wasm +0 -0
  39. package/dist/assets/press-Cr6-1MeH.wav +0 -0
  40. package/dist/assets/refuse-DQOeTs-N.wav +0 -0
  41. package/dist/assets/retreat-CxfXQVOC.wav +0 -0
  42. package/dist/assets/throttle-CjIII7Yf.js +1 -0
  43. package/dist/assets/zstd-u5eweWyS.js +15 -0
  44. package/dist/index.html +626 -0
  45. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ function Da(f,$){const{rows:m,columns:R,data:S}=f,{rows:k,columns:c,data:F}=$,I=[],V=[],N=[];for(let L=0;L<c;L++){const J=L*(R-1)/(c-1);I[L]=Math.floor(J),V[L]=Math.min(I[L]+1,R-1),N[L]=J-I[L]}for(let L=0;L<k;L++){const J=L*(m-1)/(k-1),Z=Math.floor(J)*R,G=Math.min(Z+R,(m-1)*R),Y=J-Math.floor(J),re=1-Y,he=L*c;for(let ee=0;ee<c;ee++){const ye=S[Z+I[ee]],_e=S[Z+V[ee]],we=S[G+I[ee]],Pe=S[G+V[ee]],me=1-N[ee];F[he+ee]=(ye*me+_e*N[ee])*re+(we*me+Pe*N[ee])*Y}}return F}function xa(f,$){const{rows:m,columns:R,pixelData:S,samplesPerPixel:k=1}=f,{rows:c,columns:F,pixelData:I}=$,V=[];for(let N=0;N<F;N++){const L=N*(R-1)/(F-1);V[N]=Math.floor(L)*k}for(let N=0;N<c;N++){const L=N*(m-1)/(c-1),J=Math.floor(L)*R*k,Z=N*F;for(let G=0;G<F;G++)for(let Y=0;Y<k;Y++)I[Z+G+Y]=S[J+V[G]+Y]}return I}const ba=Symbol("Comlink.proxy"),ka=Symbol("Comlink.endpoint"),Oa=Symbol("Comlink.releaseProxy"),Yn=Symbol("Comlink.finalizer"),Bn=Symbol("Comlink.thrown"),$a=f=>typeof f=="object"&&f!==null||typeof f=="function",Fa={canHandle:f=>$a(f)&&f[ba],serialize(f){const{port1:$,port2:m}=new MessageChannel;return aa(f,$),[m,[m]]},deserialize(f){return f.start(),Ma(f)}},ja={canHandle:f=>$a(f)&&Bn in f,serialize({value:f}){let $;return f instanceof Error?$={isError:!0,value:{message:f.message,name:f.name,stack:f.stack}}:$={isError:!1,value:f},[$,[]]},deserialize(f){throw f.isError?Object.assign(new Error(f.value.message),f.value):f.value}},wa=new Map([["proxy",Fa],["throw",ja]]);function Ia(f,$){for(const m of f)if($===m||m==="*"||m instanceof RegExp&&m.test($))return!0;return!1}function aa(f,$=globalThis,m=["*"]){$.addEventListener("message",function R(S){if(!S||!S.data)return;if(!Ia(m,S.origin)){console.warn(`Invalid origin '${S.origin}' for comlink proxy`);return}const{id:k,type:c,path:F}=Object.assign({path:[]},S.data),I=(S.data.argumentList||[]).map(Dn);let V;try{const N=F.slice(0,-1).reduce((J,Z)=>J[Z],f),L=F.reduce((J,Z)=>J[Z],f);switch(c){case"GET":V=L;break;case"SET":N[F.slice(-1)[0]]=Dn(S.data.value),V=!0;break;case"APPLY":V=L.apply(N,I);break;case"CONSTRUCT":{const J=new L(...I);V=Na(J)}break;case"ENDPOINT":{const{port1:J,port2:Z}=new MessageChannel;aa(f,Z),V=La(J,[J])}break;case"RELEASE":V=void 0;break;default:return}}catch(N){V={value:N,[Bn]:0}}Promise.resolve(V).catch(N=>({value:N,[Bn]:0})).then(N=>{const[L,J]=zn(N);$.postMessage(Object.assign(Object.assign({},L),{id:k}),J),c==="RELEASE"&&($.removeEventListener("message",R),Pa($),Yn in f&&typeof f[Yn]=="function"&&f[Yn]())}).catch(N=>{const[L,J]=zn({value:new TypeError("Unserializable return value"),[Bn]:0});$.postMessage(Object.assign(Object.assign({},L),{id:k}),J)})}),$.start&&$.start()}function Ua(f){return f.constructor.name==="MessagePort"}function Pa(f){Ua(f)&&f.close()}function Ma(f,$){const m=new Map;return f.addEventListener("message",function(S){const{data:k}=S;if(!k||!k.id)return;const c=m.get(k.id);if(c)try{c(k)}finally{m.delete(k.id)}}),ta(f,m,[],$)}function Hn(f){if(f)throw new Error("Proxy has been released and is not useable")}function Ta(f){return xn(f,new Map,{type:"RELEASE"}).then(()=>{Pa(f)})}const Ln=new WeakMap,Nn="FinalizationRegistry"in globalThis&&new FinalizationRegistry(f=>{const $=(Ln.get(f)||0)-1;Ln.set(f,$),$===0&&Ta(f)});function Ha(f,$){const m=(Ln.get($)||0)+1;Ln.set($,m),Nn&&Nn.register(f,$,f)}function Ba(f){Nn&&Nn.unregister(f)}function ta(f,$,m=[],R=function(){}){let S=!1;const k=new Proxy(R,{get(c,F){if(Hn(S),F===Oa)return()=>{Ba(k),Ta(f),$.clear(),S=!0};if(F==="then"){if(m.length===0)return{then:()=>k};const I=xn(f,$,{type:"GET",path:m.map(V=>V.toString())}).then(Dn);return I.then.bind(I)}return ta(f,$,[...m,F])},set(c,F,I){Hn(S);const[V,N]=zn(I);return xn(f,$,{type:"SET",path:[...m,F].map(L=>L.toString()),value:V},N).then(Dn)},apply(c,F,I){Hn(S);const V=m[m.length-1];if(V===ka)return xn(f,$,{type:"ENDPOINT"}).then(Dn);if(V==="bind")return ta(f,$,m.slice(0,-1));const[N,L]=ua(I);return xn(f,$,{type:"APPLY",path:m.map(J=>J.toString()),argumentList:N},L).then(Dn)},construct(c,F){Hn(S);const[I,V]=ua(F);return xn(f,$,{type:"CONSTRUCT",path:m.map(N=>N.toString()),argumentList:I},V).then(Dn)}});return Ha(k,f),k}function Va(f){return Array.prototype.concat.apply([],f)}function ua(f){const $=f.map(zn);return[$.map(m=>m[0]),Va($.map(m=>m[1]))]}const Ca=new WeakMap;function La(f,$){return Ca.set(f,$),f}function Na(f){return Object.assign(f,{[ba]:!0})}function zn(f){for(const[$,m]of wa)if(m.canHandle(f)){const[R,S]=m.serialize(f);return[{type:"HANDLER",name:$,value:R},S]}return[{type:"RAW",value:f},Ca.get(f)||[]]}function Dn(f){switch(f.type){case"HANDLER":return wa.get(f.name).deserialize(f.value);case"RAW":return f.value}}function xn(f,$,m,R){return new Promise(S=>{const k=za();$.set(k,S),f.start&&f.start(),f.postMessage(Object.assign({id:k},m),R)})}function za(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}async function la(f,$){let m=$.buffer,R=$.byteOffset;const S=$.length;if(f.bitsAllocated===16)R%2&&(m=m.slice(R),R=0),f.pixelRepresentation===0?f.pixelData=new Uint16Array(m,R,S/2):f.pixelData=new Int16Array(m,R,S/2);else if(f.bitsAllocated===8||f.bitsAllocated===1)f.pixelData=$;else if(f.bitsAllocated===32){if(R%2&&(m=m.slice(R),R=0),f.floatPixelData||f.doubleFloatPixelData)throw new Error("Float pixel data is not supported for parsing into ImageFrame");f.pixelRepresentation===0?f.pixelData=new Uint32Array(m,R,S/4):f.pixelRepresentation===1?f.pixelData=new Int32Array(m,R,S/4):f.pixelData=new Float32Array(m,R,S/4)}return f}function Ga(f){return(f&255)<<8|f>>8&255}async function Ja(f,$){if(f.bitsAllocated===16){let m=$.buffer,R=$.byteOffset;const S=$.length;R%2&&(m=m.slice(R),R=0),f.pixelRepresentation===0?f.pixelData=new Uint16Array(m,R,S/2):f.pixelData=new Int16Array(m,R,S/2);for(let k=0;k<f.pixelData.length;k++)f.pixelData[k]=Ga(f.pixelData[k])}else f.bitsAllocated===8&&(f.pixelData=$);return f}async function qa(f,$){if(f.bitsAllocated===8)return f.planarConfiguration?ca(f,$):Xa(f,$);if(f.bitsAllocated===16)return Ya(f,$);if(f.bitsAllocated===1)return ca(f,$,!0);throw new Error("unsupported pixel format for RLE")}function Aa(f,$=!1){const m=f.rows*f.columns;return $?Math.ceil(m/8):m}function Ka(f,$,m){const R=$.rows*$.columns,S=new Uint8Array(R*$.samplesPerPixel);for(let k=0;k<$.samplesPerPixel;k++){const c=k*m;for(let F=0;F<R;F++){const I=c+Math.floor(F/8),V=F%8;S[k*R+F]=f[I]&1<<V?1:0}}return S}function Xa(f,$,m=!1){const R=$,S=Aa(f,m),k=new ArrayBuffer(S*f.samplesPerPixel),c=new DataView(R.buffer,R.byteOffset),F=new Int8Array(R.buffer,R.byteOffset),I=new Int8Array(k);let V=0;const N=c.getInt32(0,!0);for(let L=0;L<N;++L){V=L;let J=c.getInt32((L+1)*4,!0),Z=c.getInt32((L+2)*4,!0);Z===0&&(Z=R.length);const G=S*N;for(;J<Z;){const Y=F[J++];if(Y>=0&&Y<=127)for(let re=0;re<Y+1&&V<G;++re)I[V]=F[J++],V+=f.samplesPerPixel;else if(Y<=-1&&Y>=-127){const re=F[J++];for(let he=0;he<-Y+1&&V<G;++he)I[V]=re,V+=f.samplesPerPixel}}}return f.pixelData=new Uint8Array(k),f}function ca(f,$,m=!1){const R=$,S=Aa(f,m),k=new ArrayBuffer(S*f.samplesPerPixel),c=new DataView(R.buffer,R.byteOffset),F=new Int8Array(R.buffer,R.byteOffset),I=new Int8Array(k);let V=0;const N=c.getInt32(0,!0);for(let L=0;L<N;++L){V=L*S;let J=c.getInt32((L+1)*4,!0),Z=c.getInt32((L+2)*4,!0);Z===0&&(Z=R.length);const G=S*N;for(;J<Z;){const Y=F[J++];if(Y>=0&&Y<=127)for(let re=0;re<Y+1&&V<G;++re)I[V]=F[J++],V++;else if(Y<=-1&&Y>=-127){const re=F[J++];for(let he=0;he<-Y+1&&V<G;++he)I[V]=re,V++}}}return f.pixelData=new Uint8Array(k),m&&(f.pixelData=Ka(f.pixelData,f,S)),f}function Ya(f,$){const m=$,R=f.rows*f.columns,S=new ArrayBuffer(R*f.samplesPerPixel*2),k=new DataView(m.buffer,m.byteOffset),c=new Int8Array(m.buffer,m.byteOffset),F=new Int8Array(S),I=k.getInt32(0,!0);for(let V=0;V<I;++V){let N=0;const L=V===0?1:0;let J=k.getInt32((V+1)*4,!0),Z=k.getInt32((V+2)*4,!0);for(Z===0&&(Z=m.length);J<Z;){const G=c[J++];if(G>=0&&G<=127)for(let Y=0;Y<G+1&&N<R;++Y)F[N*2+L]=c[J++],N++;else if(G<=-1&&G>=-127){const Y=c[J++];for(let re=0;re<-G+1&&N<R;++re)F[N*2+L]=Y,N++}}}return f.pixelRepresentation===0?f.pixelData=new Uint16Array(S):f.pixelData=new Int16Array(S),f}var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gn(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}function Za(f){if(Object.prototype.hasOwnProperty.call(f,"__esModule"))return f;var $=f.default;if(typeof $=="function"){var m=function R(){var S=!1;try{S=this instanceof R}catch{}return S?Reflect.construct($,arguments,this.constructor):$.apply(this,arguments)};m.prototype=$.prototype}else m={};return Object.defineProperty(m,"__esModule",{value:!0}),Object.keys(f).forEach(function(R){var S=Object.getOwnPropertyDescriptor(f,R);Object.defineProperty(m,R,S.get?S:{enumerable:!0,get:function(){return f[R]}})}),m}var Zn={exports:{}},Qa={},ei=Object.freeze({__proto__:null,default:Qa}),Jn=Za(ei),fa;function ri(){return fa||(fa=1,(function(f,$){var m=(()=>{var R=typeof document<"u"?document.currentScript?.src:void 0;return typeof __filename<"u"&&(R=R||__filename),(function(S={}){var k,c=S,F,I,V=new Promise((e,r)=>{F=e,I=r}),N=typeof window=="object",L=typeof WorkerGlobalScope<"u",J=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Z=Object.assign({},c),G="./this.program",Y=(e,r)=>{throw r},re="";function he(e){return c.locateFile?c.locateFile(e,re):re+e}var ee,ye;if(J){var _e=Jn;re=__dirname+"/",ye=e=>{e=Ar(e)?new URL(e):e;var r=_e.readFileSync(e);return r},ee=async(e,r=!0)=>{e=Ar(e)?new URL(e):e;var l=_e.readFileSync(e,r?void 0:"utf8");return l},!c.thisProgram&&process.argv.length>1&&(G=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),Y=(e,r)=>{throw process.exitCode=e,r}}else(N||L)&&(L?re=self.location.href:typeof document<"u"&&document.currentScript&&(re=document.currentScript.src),R&&(re=R),re.startsWith("blob:")?re="":re=re.substr(0,re.replace(/[?#].*/,"").lastIndexOf("/")+1),L&&(ye=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),ee=async e=>{if(Ar(e))return new Promise((l,d)=>{var y=new XMLHttpRequest;y.open("GET",e,!0),y.responseType="arraybuffer",y.onload=()=>{if(y.status==200||y.status==0&&y.response){l(y.response);return}d(y.status)},y.onerror=d,y.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var we=c.print||console.log.bind(console),Pe=c.printErr||console.error.bind(console);Object.assign(c,Z),Z=null,c.arguments&&c.arguments,c.thisProgram&&(G=c.thisProgram);var me=c.wasmBinary,ve,oe=!1,ae,pe,ue,le,se,ce,xr,kr;function Or(){var e=ve.buffer;c.HEAP8=ae=new Int8Array(e),c.HEAP16=ue=new Int16Array(e),c.HEAPU8=pe=new Uint8Array(e),c.HEAPU16=le=new Uint16Array(e),c.HEAP32=se=new Int32Array(e),c.HEAPU32=ce=new Uint32Array(e),c.HEAPF32=xr=new Float32Array(e),c.HEAPF64=kr=new Float64Array(e)}var Kr=[],ot=[],jt=[];function rn(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)dr(c.preRun.shift());jr(Kr)}function tn(){jr(ot)}function nn(){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)Ne(c.postRun.shift());jr(jt)}function dr(e){Kr.unshift(e)}function Le(e){ot.unshift(e)}function Ne(e){jt.unshift(e)}var ze=0,Tr=null;function ut(e){ze++,c.monitorRunDependencies?.(ze)}function lt(e){if(ze--,c.monitorRunDependencies?.(ze),ze==0&&Tr){var r=Tr;Tr=null,r()}}function Cr(e){c.onAbort?.(e),e="Aborted("+e+")",Pe(e),oe=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw I(r),r}var Fr="data:application/octet-stream;base64,",vr=e=>e.startsWith(Fr),Ar=e=>e.startsWith("file://");function ct(){var e="libjpegturbowasm_decode.wasm";return vr(e)?e:he(e)}var ft;function an(e){if(e==ft&&me)return new Uint8Array(me);if(ye)return ye(e);throw"both async and sync fetching of the wasm failed"}async function sn(e){if(!me)try{var r=await ee(e);return new Uint8Array(r)}catch{}return an(e)}async function on(e,r){try{var l=await sn(e),d=await WebAssembly.instantiate(l,r);return d}catch(y){Pe(`failed to asynchronously prepare wasm: ${y}`),Cr(y)}}async function dt(e,r,l){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!vr(r)&&!Ar(r)&&!J&&typeof fetch=="function")try{var d=fetch(r,{credentials:"same-origin"}),y=await WebAssembly.instantiateStreaming(d,l);return y}catch(P){Pe(`wasm streaming compile failed: ${P}`),Pe("falling back to ArrayBuffer instantiation")}return on(r,l)}function vt(){return{a:j}}async function Ge(){function e(y,P){return U=y.exports,ve=U.L,Or(),xe=U.O,Le(U.M),lt(),U}ut();function r(y){e(y.instance)}var l=vt();if(c.instantiateWasm)try{return c.instantiateWasm(l,e)}catch(y){Pe(`Module.instantiateWasm callback failed with error: ${y}`),I(y)}ft??=ct();try{var d=await dt(me,ft,l);return r(d),d}catch(y){I(y);return}}class nr{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var jr=e=>{for(;e.length>0;)e.shift()(c)};c.noExitRuntime;var pr=e=>a(e),Je=()=>_();class Xr{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){ce[this.ptr+4>>2]=r}get_type(){return ce[this.ptr+4>>2]}set_destructor(r){ce[this.ptr+8>>2]=r}get_destructor(){return ce[this.ptr+8>>2]}set_caught(r){r=r?1:0,ae[this.ptr+12]=r}get_caught(){return ae[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,ae[this.ptr+13]=r}get_rethrown(){return ae[this.ptr+13]!=0}init(r,l){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(l)}set_adjusted_ptr(r){ce[this.ptr+16>>2]=r}get_adjusted_ptr(){return ce[this.ptr+16>>2]}}var Ir=0,ur=(e,r,l)=>{var d=new Xr(e);throw d.init(r,l),Ir=e,Ir},We=()=>Cr(""),De={},Oe=e=>{for(;e.length;){var r=e.pop(),l=e.pop();l(r)}};function Me(e){return this.fromWireType(ce[e>>2])}var Ee={},Se={},hr={},yr,Yr=e=>{throw new yr(e)},gr=(e,r,l)=>{e.forEach(A=>hr[A]=r);function d(A){var D=l(A);D.length!==e.length&&Yr("Mismatched type converter count");for(var M=0;M<e.length;++M)Ce(e[M],D[M])}var y=new Array(r.length),P=[],W=0;r.forEach((A,D)=>{Se.hasOwnProperty(A)?y[D]=Se[A]:(P.push(A),Ee.hasOwnProperty(A)||(Ee[A]=[]),Ee[A].push(()=>{y[D]=Se[A],++W,W===P.length&&d(y)}))}),P.length===0&&d(y)},be=e=>{var r=De[e];delete De[e];var l=r.rawConstructor,d=r.rawDestructor,y=r.fields,P=y.map(W=>W.getterReturnType).concat(y.map(W=>W.setterArgumentType));gr([e],P,W=>{var A={};return y.forEach((D,M)=>{var B=D.fieldName,q=W[M],fe=D.getter,ie=D.getterContext,de=W[M+y.length],Ue=D.setter,st=D.setterContext;A[B]={read:tr=>q.fromWireType(fe(ie,tr)),write:(tr,en)=>{var Pr=[];Ue(st,tr,de.toWireType(Pr,en)),Oe(Pr)}}}),[{name:r.name,fromWireType:D=>{var M={};for(var B in A)M[B]=A[B].read(D);return d(D),M},toWireType:(D,M)=>{for(var B in A)if(!(B in M))throw new TypeError(`Missing field: "${B}"`);var q=l();for(B in A)A[B].write(q,M[B]);return D!==null&&D.push(d,q),q},argPackAdvance:qe,readValueFromPointer:Me,destructorFunction:d}]})},lr=(e,r,l,d,y)=>{},X=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);He=e},He,z=e=>{for(var r="",l=e;pe[l];)r+=He[pe[l++]];return r},Te,Q=e=>{throw new Te(e)};function Be(e,r,l={}){var d=r.name;if(e||Q(`type "${d}" must have a positive integer typeid pointer`),Se.hasOwnProperty(e)){if(l.ignoreDuplicateRegistrations)return;Q(`Cannot register type '${d}' twice`)}if(Se[e]=r,delete hr[e],Ee.hasOwnProperty(e)){var y=Ee[e];delete Ee[e],y.forEach(P=>P())}}function Ce(e,r,l={}){return Be(e,r,l)}var qe=8,Zr=(e,r,l,d)=>{r=z(r),Ce(e,{name:r,fromWireType:function(y){return!!y},toWireType:function(y,P){return P?l:d},argPackAdvance:qe,readValueFromPointer:function(y){return this.fromWireType(pe[y])},destructorFunction:null})},pt=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Rr=e=>{function r(l){return l.$$.ptrType.registeredClass.name}Q(r(e)+" instance already deleted")},Ae=!1,ar=e=>{},te=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ht=e=>{e.count.value-=1;var r=e.count.value===0;r&&te(e)},er=(e,r,l)=>{if(r===l)return e;if(l.baseClass===void 0)return null;var d=er(e,r,l.baseClass);return d===null?null:l.downcast(d)},Fe={},un={},cr=(e,r)=>{for(r===void 0&&Q("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},yt=(e,r)=>(r=cr(e,r),un[r]),je=(e,r)=>{(!r.ptrType||!r.ptr)&&Yr("makeClassHandle requires ptr and ptrType");var l=!!r.smartPtrType,d=!!r.smartPtr;return l!==d&&Yr("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ir(Object.create(e,{$$:{value:r,writable:!0}}))};function Ur(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var l=yt(this.registeredClass,r);if(l!==void 0){if(l.$$.count.value===0)return l.$$.ptr=r,l.$$.smartPtr=e,l.clone();var d=l.clone();return this.destructor(e),d}function y(){return this.isSmartPointer?je(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):je(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var P=this.registeredClass.getActualType(r),W=Fe[P];if(!W)return y.call(this);var A;this.isConst?A=W.constPointerType:A=W.pointerType;var D=er(r,this.registeredClass,A.registeredClass);return D===null?y.call(this):this.isSmartPointer?je(A.registeredClass.instancePrototype,{ptrType:A,ptr:D,smartPtrType:this,smartPtr:e}):je(A.registeredClass.instancePrototype,{ptrType:A,ptr:D})}var ir=e=>typeof FinalizationRegistry>"u"?(ir=r=>r,e):(Ae=new FinalizationRegistry(r=>{ht(r.$$)}),ir=r=>{var l=r.$$,d=!!l.smartPtr;if(d){var y={$$:l};Ae.register(r,y,r)}return r},ar=r=>Ae.unregister(r),ir(e)),Er=()=>{Object.assign(Sr.prototype,{isAliasOf(e){if(!(this instanceof Sr)||!(e instanceof Sr))return!1;var r=this.$$.ptrType.registeredClass,l=this.$$.ptr;e.$$=e.$$;for(var d=e.$$.ptrType.registeredClass,y=e.$$.ptr;r.baseClass;)l=r.upcast(l),r=r.baseClass;for(;d.baseClass;)y=d.upcast(y),d=d.baseClass;return r===d&&l===y},clone(){if(this.$$.ptr||Rr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=ir(Object.create(Object.getPrototypeOf(this),{$$:{value:pt(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),ar(this),ht(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}})};function Sr(){}var Mr=(e,r)=>Object.defineProperty(r,"name",{value:e}),It=(e,r,l)=>{if(e[r].overloadTable===void 0){var d=e[r];e[r]=function(...y){return e[r].overloadTable.hasOwnProperty(y.length)||Q(`Function '${l}' called with an invalid number of arguments (${y.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[y.length].apply(this,y)},e[r].overloadTable=[],e[r].overloadTable[d.argCount]=d}},ln=(e,r,l)=>{c.hasOwnProperty(e)?(Q(`Cannot register public name '${e}' twice`),It(c,e,e),c[e].overloadTable.hasOwnProperty(l)&&Q(`Cannot register multiple overloads of a function with the same number of arguments (${l})!`),c[e].overloadTable[l]=r):(c[e]=r,c[e].argCount=l)},gt=48,Qr=57,_t=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=gt&&r<=Qr?`_${e}`:e};function Hr(e,r,l,d,y,P,W,A){this.name=e,this.constructor=r,this.instancePrototype=l,this.rawDestructor=d,this.baseClass=y,this.getActualType=P,this.upcast=W,this.downcast=A,this.pureVirtualFunctions=[]}var mt=(e,r,l)=>{for(;r!==l;)r.upcast||Q(`Expected null or instance of ${l.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function _r(e,r){if(r===null)return this.isReference&&Q(`null is not a valid ${this.name}`),0;r.$$||Q(`Cannot pass "${Tt(r)}" as a ${this.name}`),r.$$.ptr||Q(`Cannot pass deleted object as a pointer of type ${this.name}`);var l=r.$$.ptrType.registeredClass,d=mt(r.$$.ptr,l,this.registeredClass);return d}function et(e,r){var l;if(r===null)return this.isReference&&Q(`null is not a valid ${this.name}`),this.isSmartPointer?(l=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,l),l):0;(!r||!r.$$)&&Q(`Cannot pass "${Tt(r)}" as a ${this.name}`),r.$$.ptr||Q(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&Q(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var d=r.$$.ptrType.registeredClass;if(l=mt(r.$$.ptr,d,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&Q("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?l=r.$$.smartPtr:Q(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:l=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)l=r.$$.smartPtr;else{var y=r.clone();l=this.rawShare(l,Ze.toHandle(()=>y.delete())),e!==null&&e.push(this.rawDestructor,l)}break;default:Q("Unsupporting sharing policy")}return l}function Br(e,r){if(r===null)return this.isReference&&Q(`null is not a valid ${this.name}`),0;r.$$||Q(`Cannot pass "${Tt(r)}" as a ${this.name}`),r.$$.ptr||Q(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&Q(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var l=r.$$.ptrType.registeredClass,d=mt(r.$$.ptr,l,this.registeredClass);return d}var Vr=()=>{Object.assign(Lr.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:qe,readValueFromPointer:Me,fromWireType:Ur})};function Lr(e,r,l,d,y,P,W,A,D,M,B){this.name=e,this.registeredClass=r,this.isReference=l,this.isConst=d,this.isSmartPointer=y,this.pointeeType=P,this.sharingPolicy=W,this.rawGetPointee=A,this.rawConstructor=D,this.rawShare=M,this.rawDestructor=B,!y&&r.baseClass===void 0?d?(this.toWireType=_r,this.destructorFunction=null):(this.toWireType=Br,this.destructorFunction=null):this.toWireType=et}var Nr=(e,r,l)=>{c.hasOwnProperty(e)||Yr("Replacing nonexistent public symbol"),c[e].overloadTable!==void 0&&l!==void 0||(c[e]=r,c[e].argCount=l)},Ut=(e,r,l)=>{e=e.replace(/p/g,"i");var d=c["dynCall_"+e];return d(r,...l)},zr=[],xe,mr=e=>{var r=zr[e];return r||(e>=zr.length&&(zr.length=e+1),zr[e]=r=xe.get(e)),r},Ke=(e,r,l=[])=>{if(e.includes("j"))return Ut(e,r,l);var d=mr(r)(...l);return d},Mt=(e,r)=>(...l)=>Ke(e,r,l),ke=(e,r)=>{e=z(e);function l(){return e.includes("j")?Mt(e,r):mr(r)}var d=l();return typeof d!="function"&&Q(`unknown function pointer with signature ${e}: ${r}`),d},Gr=(e,r)=>{var l=Mr(r,function(d){this.name=r,this.message=d;var y=new Error(d).stack;y!==void 0&&(this.stack=this.toString()+`
2
+ `+y.replace(/^Error(:[^\n]*)?\n/,""))});return l.prototype=Object.create(e.prototype),l.prototype.constructor=l,l.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},l},br,Ht=e=>{var r=H(e),l=z(r);return ne(r),l},$r=(e,r)=>{var l=[],d={};function y(P){if(!d[P]&&!Se[P]){if(hr[P]){hr[P].forEach(y);return}l.push(P),d[P]=!0}}throw r.forEach(y),new br(`${e}: `+l.map(Ht).join([", "]))},Bt=(e,r,l,d,y,P,W,A,D,M,B,q,fe)=>{B=z(B),P=ke(y,P),A&&=ke(W,A),M&&=ke(D,M),fe=ke(q,fe);var ie=_t(B);ln(ie,function(){$r(`Cannot construct ${B} due to unbound types`,[d])}),gr([e,r,l],d?[d]:[],de=>{de=de[0];var Ue,st;d?(Ue=de.registeredClass,st=Ue.instancePrototype):st=Sr.prototype;var tr=Mr(B,function(...Xn){if(Object.getPrototypeOf(this)!==en)throw new Te("Use 'new' to construct "+B);if(Pr.constructor_body===void 0)throw new Te(B+" has no accessible constructor");var oa=Pr.constructor_body[Xn.length];if(oa===void 0)throw new Te(`Tried to invoke ctor of ${B} with invalid number of parameters (${Xn.length}) - expected (${Object.keys(Pr.constructor_body).toString()}) parameters instead!`);return oa.apply(this,Xn)}),en=Object.create(st,{constructor:{value:tr}});tr.prototype=en;var Pr=new Hr(B,tr,en,fe,Ue,P,A,M);Pr.baseClass&&(Pr.baseClass.__derivedClasses??=[],Pr.baseClass.__derivedClasses.push(Pr));var Wa=new Lr(B,Pr,!0,!1,!1),ia=new Lr(B+"*",Pr,!1,!1,!1),sa=new Lr(B+" const*",Pr,!1,!0,!1);return Fe[e]={pointerType:ia,constPointerType:sa},Nr(ie,tr),[Wa,ia,sa]})},Ie=(e,r)=>{for(var l=[],d=0;d<e;d++)l.push(ce[r+d*4>>2]);return l};function cn(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}var bt={ftf:function(e,r,l,d,y,P,W){return function(){var A=l(d),D=P.fromWireType(A);return D}},ttfnn:function(e,r,l,d,y,P,W,A){return function(D){var M=W.toWireType(null,this),B=A.toWireType(null,D),q=l(d,M,B),fe=P.fromWireType(q);return fe}},ttfn:function(e,r,l,d,y,P,W){return function(){var A=W.toWireType(null,this),D=l(d,A),M=P.fromWireType(D);return M}},tffn:function(e,r,l,d,y,P,W){return function(){var A=W.toWireType(null,this);l(d,A)}}};function Xe(e,r,l,d){const y=[r?"t":"f",l?"t":"f",d?"t":"f"];for(let P=r?1:2;P<e.length;++P){const W=e[P];let A="";W.destructorFunction===void 0?A="u":W.destructorFunction===null?A="n":A="t",y.push(A)}return y.join("")}function rt(e,r,l,d,y,P){var W=r.length;W<2&&Q("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var A=r[1]!==null&&l!==null,D=cn(r),M=r[0].name!=="void",B=[e,Q,d,y,Oe,r[0],r[1]],q=0;q<W-2;++q)B.push(r[q+2]);if(!D)for(var q=A?1:2;q<r.length;++q)r[q].destructorFunction!==null&&B.push(r[q].destructorFunction);var fe=Xe(r,A,M,P),ie=bt[fe](...B);return Mr(e,ie)}var sr=(e,r,l,d,y,P)=>{var W=Ie(r,l);y=ke(d,y),gr([],[e],A=>{A=A[0];var D=`constructor ${A.name}`;if(A.registeredClass.constructor_body===void 0&&(A.registeredClass.constructor_body=[]),A.registeredClass.constructor_body[r-1]!==void 0)throw new Te(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${A.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return A.registeredClass.constructor_body[r-1]=()=>{$r(`Cannot construct ${A.name} due to unbound types`,W)},gr([],W,M=>(M.splice(1,0,null),A.registeredClass.constructor_body[r-1]=rt(D,M,null,y,P),[])),[]})},Wr=e=>{e=e.trim();const r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Ye=(e,r,l,d,y,P,W,A,D,M)=>{var B=Ie(l,d);r=z(r),r=Wr(r),P=ke(y,P),gr([],[e],q=>{q=q[0];var fe=`${q.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),A&&q.registeredClass.pureVirtualFunctions.push(r);function ie(){$r(`Cannot call ${fe} due to unbound types`,B)}var de=q.registeredClass.instancePrototype,Ue=de[r];return Ue===void 0||Ue.overloadTable===void 0&&Ue.className!==q.name&&Ue.argCount===l-2?(ie.argCount=l-2,ie.className=q.name,de[r]=ie):(It(de,r,fe),de[r].overloadTable[l-2]=ie),gr([],B,st=>{var tr=rt(fe,st,q,P,W,D);return de[r].overloadTable===void 0?(tr.argCount=l-2,de[r]=tr):de[r].overloadTable[l-2]=tr,[]}),[]})},Jr=[],$e=[],$t=e=>{e>9&&--$e[e+1]===0&&($e[e]=void 0,Jr.push(e))},or=()=>$e.length/2-5-Jr.length,wt=()=>{$e.push(0,1,void 0,1,null,1,!0,1,!1,1),c.count_emval_handles=or},Ze={toValue:e=>(e||Q("Cannot use deleted val. handle = "+e),$e[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=Jr.pop()||$e.length;return $e[r]=e,$e[r+1]=1,r}}}},Pt={name:"emscripten::val",fromWireType:e=>{var r=Ze.toValue(e);return $t(e),r},toWireType:(e,r)=>Ze.toHandle(r),argPackAdvance:qe,readValueFromPointer:Me,destructorFunction:null},Vt=e=>Ce(e,Pt),Tt=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Ct=(e,r)=>{switch(r){case 4:return function(l){return this.fromWireType(xr[l>>2])};case 8:return function(l){return this.fromWireType(kr[l>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},fr=(e,r,l)=>{r=z(r),Ce(e,{name:r,fromWireType:d=>d,toWireType:(d,y)=>y,argPackAdvance:qe,readValueFromPointer:Ct(r,l),destructorFunction:null})},Lt=(e,r,l)=>{switch(r){case 1:return l?d=>ae[d]:d=>pe[d];case 2:return l?d=>ue[d>>1]:d=>le[d>>1];case 4:return l?d=>se[d>>2]:d=>ce[d>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Nt=(e,r,l,d,y)=>{r=z(r);var P=B=>B;if(d===0){var W=32-8*l;P=B=>B<<W>>>W}var A=r.includes("unsigned"),D=(B,q)=>{},M;A?M=function(B,q){return D(q,this.name),q>>>0}:M=function(B,q){return D(q,this.name),q},Ce(e,{name:r,fromWireType:P,toWireType:M,argPackAdvance:qe,readValueFromPointer:Lt(r,l,d!==0),destructorFunction:null})},At=(e,r,l)=>{var d=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],y=d[r];function P(W){var A=ce[W>>2],D=ce[W+4>>2];return new y(ae.buffer,D,A)}l=z(l),Ce(e,{name:l,fromWireType:P,argPackAdvance:qe,readValueFromPointer:P},{ignoreDuplicateRegistrations:!0})},Dr=(e,r,l,d)=>{if(!(d>0))return 0;for(var y=l,P=l+d-1,W=0;W<e.length;++W){var A=e.charCodeAt(W);if(A>=55296&&A<=57343){var D=e.charCodeAt(++W);A=65536+((A&1023)<<10)|D&1023}if(A<=127){if(l>=P)break;r[l++]=A}else if(A<=2047){if(l+1>=P)break;r[l++]=192|A>>6,r[l++]=128|A&63}else if(A<=65535){if(l+2>=P)break;r[l++]=224|A>>12,r[l++]=128|A>>6&63,r[l++]=128|A&63}else{if(l+3>=P)break;r[l++]=240|A>>18,r[l++]=128|A>>12&63,r[l++]=128|A>>6&63,r[l++]=128|A&63}}return r[l]=0,l-y},Rt=(e,r,l)=>Dr(e,pe,r,l),tt=e=>{for(var r=0,l=0;l<e.length;++l){var d=e.charCodeAt(l);d<=127?r++:d<=2047?r+=2:d>=55296&&d<=57343?(r+=4,++l):r+=3}return r},qr=typeof TextDecoder<"u"?new TextDecoder:void 0,Et=(e,r=0,l=NaN)=>{for(var d=r+l,y=r;e[y]&&!(y>=d);)++y;if(y-r>16&&e.buffer&&qr)return qr.decode(e.subarray(r,y));for(var P="";r<y;){var W=e[r++];if(!(W&128)){P+=String.fromCharCode(W);continue}var A=e[r++]&63;if((W&224)==192){P+=String.fromCharCode((W&31)<<6|A);continue}var D=e[r++]&63;if((W&240)==224?W=(W&15)<<12|A<<6|D:W=(W&7)<<18|A<<12|D<<6|e[r++]&63,W<65536)P+=String.fromCharCode(W);else{var M=W-65536;P+=String.fromCharCode(55296|M>>10,56320|M&1023)}}return P},St=(e,r)=>e?Et(pe,e,r):"",fn=(e,r)=>{r=z(r),Ce(e,{name:r,fromWireType(l){for(var d=ce[l>>2],y=l+4,P,W,A=y,W=0;W<=d;++W){var D=y+W;if(W==d||pe[D]==0){var M=D-A,B=St(A,M);P===void 0?P=B:(P+="\0",P+=B),A=D+1}}return ne(l),P},toWireType(l,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var y,P=typeof d=="string";P||d instanceof Uint8Array||d instanceof Uint8ClampedArray||d instanceof Int8Array||Q("Cannot pass non-string to std::string"),P?y=tt(d):y=d.length;var W=K(4+y+1),A=W+4;if(ce[W>>2]=y,P)Rt(d,A,y+1);else if(P)for(var D=0;D<y;++D){var M=d.charCodeAt(D);M>255&&(ne(A),Q("String has UTF-16 code units that do not fit in 8 bits")),pe[A+D]=M}else for(var D=0;D<y;++D)pe[A+D]=d[D];return l!==null&&l.push(ne,W),W},argPackAdvance:qe,readValueFromPointer:Me,destructorFunction(l){ne(l)}})},zt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,dn=(e,r)=>{for(var l=e,d=l>>1,y=d+r/2;!(d>=y)&&le[d];)++d;if(l=d<<1,l-e>32&&zt)return zt.decode(pe.subarray(e,l));for(var P="",W=0;!(W>=r/2);++W){var A=ue[e+W*2>>1];if(A==0)break;P+=String.fromCharCode(A)}return P},vn=(e,r,l)=>{if(l??=2147483647,l<2)return 0;l-=2;for(var d=r,y=l<e.length*2?l/2:e.length,P=0;P<y;++P){var W=e.charCodeAt(P);ue[r>>1]=W,r+=2}return ue[r>>1]=0,r-d},pn=e=>e.length*2,Gt=(e,r)=>{for(var l=0,d="";!(l>=r/4);){var y=se[e+l*4>>2];if(y==0)break;if(++l,y>=65536){var P=y-65536;d+=String.fromCharCode(55296|P>>10,56320|P&1023)}else d+=String.fromCharCode(y)}return d},Jt=(e,r,l)=>{if(l??=2147483647,l<4)return 0;for(var d=r,y=d+l-4,P=0;P<e.length;++P){var W=e.charCodeAt(P);if(W>=55296&&W<=57343){var A=e.charCodeAt(++P);W=65536+((W&1023)<<10)|A&1023}if(se[r>>2]=W,r+=4,r+4>y)break}return se[r>>2]=0,r-d},hn=e=>{for(var r=0,l=0;l<e.length;++l){var d=e.charCodeAt(l);d>=55296&&d<=57343&&++l,r+=4}return r},qt=(e,r,l)=>{l=z(l);var d,y,P,W;r===2?(d=dn,y=vn,W=pn,P=A=>le[A>>1]):r===4&&(d=Gt,y=Jt,W=hn,P=A=>ce[A>>2]),Ce(e,{name:l,fromWireType:A=>{for(var D=ce[A>>2],M,B=A+4,q=0;q<=D;++q){var fe=A+4+q*r;if(q==D||P(fe)==0){var ie=fe-B,de=d(B,ie);M===void 0?M=de:(M+="\0",M+=de),B=fe+r}}return ne(A),M},toWireType:(A,D)=>{typeof D!="string"&&Q(`Cannot pass non-string to C++ string type ${l}`);var M=W(D),B=K(4+M+r);return ce[B>>2]=M/r,y(D,B+4,M+r),A!==null&&A.push(ne,B),B},argPackAdvance:qe,readValueFromPointer:Me,destructorFunction(A){ne(A)}})},yn=(e,r,l,d,y,P)=>{De[e]={name:z(r),rawConstructor:ke(l,d),rawDestructor:ke(y,P),fields:[]}},Wt=(e,r,l,d,y,P,W,A,D,M)=>{De[e].fields.push({fieldName:z(r),getterReturnType:l,getter:ke(d,y),getterContext:P,setterArgumentType:W,setter:ke(A,D),setterContext:M})},Dt=(e,r)=>{r=z(r),Ce(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(l,d)=>{}})},gn=(e,r,l)=>pe.copyWithin(e,r,r+l),_n=()=>{throw 1/0},nt=[],Kt=(e,r,l,d)=>(e=nt[e],r=Ze.toValue(r),e(null,r,l,d)),mn={},Xt=e=>{var r=mn[e];return r===void 0?z(e):r},xt=()=>{if(typeof globalThis=="object")return globalThis;function e(r){r.$$$embind_global$$$=r;var l=typeof $$$embind_global$$$=="object"&&r.$$$embind_global$$$==r;return l||delete r.$$$embind_global$$$,l}if(typeof $$$embind_global$$$=="object"||(typeof Ft=="object"&&e(Ft)?$$$embind_global$$$=Ft:typeof self=="object"&&e(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},bn=e=>e===0?Ze.toHandle(xt()):(e=Xt(e),Ze.toHandle(xt()[e])),$n=e=>{var r=nt.length;return nt.push(e),r},Yt=(e,r)=>{var l=Se[e];return l===void 0&&Q(`${r} has unknown type ${Ht(e)}`),l},wn=(e,r)=>{for(var l=new Array(e),d=0;d<e;++d)l[d]=Yt(ce[r+d*4>>2],"parameter "+d);return l},Pn=Reflect.construct,Tn=(e,r,l)=>{var d=[],y=e.toWireType(d,l);return d.length&&(ce[r>>2]=Ze.toHandle(d)),y},Zt=(e,r,l)=>{var d=wn(e,r),y=d.shift();e--;var P=new Array(e),W=(D,M,B,q)=>{for(var fe=0,ie=0;ie<e;++ie)P[ie]=d[ie].readValueFromPointer(q+fe),fe+=d[ie].argPackAdvance;var de=l===1?Pn(M,P):M.apply(D,P);return Tn(y,B,de)},A=`methodCaller<(${d.map(D=>D.name).join(", ")}) => ${y.name}>`;return $n(Mr(A,W))},Cn=e=>{var r=Ze.toValue(e);Oe(r),$t(e)},An=(e,r)=>{e=Yt(e,"_emval_take_value");var l=e.readValueFromPointer(r);return Ze.toHandle(l)},Rn=()=>2147483648,En=(e,r)=>Math.ceil(e/r)*r,at=e=>{var r=ve.buffer,l=(e-r.byteLength+65535)/65536|0;try{return ve.grow(l),Or(),1}catch{}},Sn=e=>{var r=pe.length;e>>>=0;var l=Rn();if(e>l)return!1;for(var d=1;d<=4;d*=2){var y=r*(1+.2/d);y=Math.min(y,e+100663296);var P=Math.min(l,En(Math.max(e,y),65536)),W=at(P);if(W)return!0}return!1},wr={},Wn=()=>G||"./this.program",Re=()=>{if(!Re.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Wn()};for(var l in wr)wr[l]===void 0?delete r[l]:r[l]=wr[l];var d=[];for(var l in r)d.push(`${l}=${r[l]}`);Re.strings=d}return Re.strings},Qt=(e,r)=>{for(var l=0;l<e.length;++l)ae[r++]=e.charCodeAt(l);ae[r]=0},kt=(e,r)=>{var l=0;return Re().forEach((d,y)=>{var P=r+l;ce[e+y*4>>2]=P,Qt(d,P),l+=d.length+1}),0},rr=(e,r)=>{var l=Re();ce[e>>2]=l.length;var d=0;return l.forEach(y=>d+=y.length+1),ce[r>>2]=d,0},ge=e=>{Y(e,new nr(e))},Ot=(e,r)=>{ge(e)},it=Ot,Ve=e=>52;function Qe(e,r,l,d,y){return 70}var s=[null,[],[]],o=(e,r)=>{var l=s[e];r===0||r===10?((e===1?we:Pe)(Et(l)),l.length=0):l.push(r)},h=(e,r,l,d)=>{for(var y=0,P=0;P<l;P++){var W=ce[r>>2],A=ce[r+4>>2];r+=8;for(var D=0;D<A;D++)o(e,pe[W+D]);y+=A}return ce[d>>2]=y,0},b=e=>{var r=c["_"+e];return r},C=(e,r)=>{ae.set(e,r)},x=e=>v(e),O=e=>{var r=tt(e)+1,l=x(r);return Rt(e,l,r),l},E=(e,r,l,d,y)=>{var P={string:de=>{var Ue=0;return de!=null&&de!==0&&(Ue=O(de)),Ue},array:de=>{var Ue=x(de.length);return C(de,Ue),Ue}};function W(de){return r==="string"?St(de):r==="boolean"?!!de:de}var A=b(e),D=[],M=0;if(d)for(var B=0;B<d.length;B++){var q=P[l[B]];q?(M===0&&(M=Je()),D[B]=q(d[B])):D[B]=d[B]}var fe=A(...D);function ie(de){return M!==0&&pr(M),W(de)}return fe=ie(fe),fe};yr=c.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},X(),Te=c.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Er(),Vr(),br=c.UnboundTypeError=Gr(Error,"UnboundTypeError"),wt();var j={g:ur,t:We,q:be,s:lr,F:Zr,p:Bt,o:sr,c:Ye,D:Vt,l:fr,b:Nt,a:At,E:fn,h:qt,C:yn,d:Wt,G:Dt,z:gn,u:_n,I:Kt,J:$t,K:bn,m:Zt,H:Cn,n:An,v:Sn,w:kt,x:rr,B:it,y:Ve,r:Qe,i:h,k:t,j:p,A:u,f:T,e:n},U;Ge();var H=e=>(H=U.N)(e),K=e=>(K=U.P)(e),ne=e=>(ne=U.Q)(e),i=(e,r)=>(i=U.R)(e,r),a=e=>(a=U.S)(e),v=e=>(v=U.T)(e),_=()=>(_=U.U)();c.dynCall_jiji=(e,r,l,d,y)=>(c.dynCall_jiji=U.V)(e,r,l,d,y);function T(e,r){var l=Je();try{mr(e)(r)}catch(d){if(pr(l),d!==d+0)throw d;i(1,0)}}function t(e,r){var l=Je();try{return mr(e)(r)}catch(d){if(pr(l),d!==d+0)throw d;i(1,0)}}function n(e,r,l,d){var y=Je();try{mr(e)(r,l,d)}catch(P){if(pr(y),P!==P+0)throw P;i(1,0)}}function u(e,r,l,d){var y=Je();try{return mr(e)(r,l,d)}catch(P){if(pr(y),P!==P+0)throw P;i(1,0)}}function p(e,r,l){var d=Je();try{return mr(e)(r,l)}catch(y){if(pr(d),y!==y+0)throw y;i(1,0)}}c.ccall=E;var g;Tr=function e(){g||w(),g||(Tr=e)};function w(){if(ze>0||(rn(),ze>0))return;function e(){g||(g=!0,c.calledRun=!0,!oe&&(tn(),F(c),c.onRuntimeInitialized?.(),nn()))}c.setStatus?(c.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>c.setStatus(""),1),e()},1)):e()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();return w(),k=V,k})})();f.exports=m,f.exports.default=m})(Zn)),Zn.exports}var ti=ri(),ni=Gn(ti);function ai(f){return(f?.isSigned===!0||f?.isSigned===1)&&f.componentCount===1}function qn(f,$,m){const R=ai({isSigned:m??f?.isSigned,componentCount:f?.componentCount});return f?.bitsPerSample>8?R?new Int16Array($.buffer,$.byteOffset,$.byteLength/2):new Uint16Array($.buffer,$.byteOffset,$.byteLength/2):R?new Int8Array($.buffer,$.byteOffset,$.byteLength):new Uint8Array($.buffer,$.byteOffset,$.byteLength)}let On;function ii(f){On=f||void 0}function Mn(f){f?.wasmBasePath!==void 0&&ii(f.wasmBasePath)}function Kn(f,$){if(!On)return $.toString();const R=`${On.endsWith("/")?On:`${On}/`}${f}`,S=typeof self<"u"?self.location?.href:void 0;if(!S)return R;try{return new URL(R,S).toString()}catch{return R}}const si=new URL(""+new URL("libjpegturbowasm_decode-7ZJ2wGuU.wasm",import.meta.url).href,import.meta.url),Vn={codec:void 0,decoder:void 0};function oi(f){if(Mn(f),Vn.codec)return Promise.resolve();const $=ni({locateFile:m=>m.endsWith(".wasm")?Kn("libjpegturbowasm_decode.wasm",si):m});return new Promise((m,R)=>{$.then(S=>{Vn.codec=S,Vn.decoder=new S.JPEGDecoder,m()},R)})}async function ui(f,$){await oi();const m=Vn.decoder;m.getEncodedBuffer(f.length).set(f),m.decode();const S=m.getFrameInfo(),k=m.getDecodedBuffer(),c={columns:S.width,rows:S.height,bitsPerPixel:S.bitsPerSample,signed:$.signed,bytesPerPixel:$.bytesPerPixel,componentsPerPixel:S.componentCount},F=qn(S,k),I={frameInfo:S};return{...$,pixelData:F,imageInfo:c,encodeOptions:I,...I,...c}}const In={JpegImage:void 0,decodeConfig:{}};function li(f){return In.decodeConfig=f,In.JpegImage?Promise.resolve():new Promise(($,m)=>{import("./jpeg-B-x1txLf.js").then(R=>{In.JpegImage=R.default,$()}).catch(m)})}async function ci(f,$){if(await li(),typeof In.JpegImage>"u")throw new Error("No JPEG Baseline decoder loaded");const m=new In.JpegImage;if(m.parse($),m.colorTransform=!1,f.bitsAllocated===8)return f.pixelData=m.getData(f.columns,f.rows),f;if(f.bitsAllocated===16)return f.pixelData=m.getData16(f.columns,f.rows),f}const Un={DecoderClass:void 0,decodeConfig:{}};function fi(f){return Un.decodeConfig=f,Un.DecoderClass?Promise.resolve():new Promise(($,m)=>{import("./lossless-CyYqoyFe.js").then(({Decoder:R})=>{Un.DecoderClass=R,$()},m)})}async function da(f,$){if(await fi(),typeof Un.DecoderClass>"u")throw new Error("No JPEG Lossless decoder loaded");const m=new Un.DecoderClass,R=f.bitsAllocated<=8?1:2,S=$.buffer,k=m.decode(S,$.byteOffset,$.length,R);return f.planarConfiguration=0,f.pixelRepresentation===0?f.bitsAllocated===16?(f.pixelData=new Uint16Array(k.buffer),f):(f.pixelData=new Uint8Array(k.buffer),f):(f.pixelData=new Int16Array(k.buffer),f)}var Qn={exports:{}},va;function di(){return va||(va=1,(function(f,$){var m=(()=>{var R=typeof document<"u"?document.currentScript?.src:void 0;return typeof __filename<"u"&&(R=R||__filename),(function(S={}){var k,c=S,F,I,V=new Promise((s,o)=>{F=s,I=o}),N=typeof window=="object",L=typeof WorkerGlobalScope<"u",J=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Z=Object.assign({},c),G="";function Y(s){return c.locateFile?c.locateFile(s,G):G+s}var re,he;if(J){var ee=Jn;G=__dirname+"/",he=s=>{s=Cr(s)?new URL(s):s;var o=ee.readFileSync(s);return o},re=async(s,o=!0)=>{s=Cr(s)?new URL(s):s;var h=ee.readFileSync(s,o?void 0:"utf8");return h},!c.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(N||L)&&(L?G=self.location.href:typeof document<"u"&&document.currentScript&&(G=document.currentScript.src),R&&(G=R),G.startsWith("blob:")?G="":G=G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1),L&&(he=s=>{var o=new XMLHttpRequest;return o.open("GET",s,!1),o.responseType="arraybuffer",o.send(null),new Uint8Array(o.response)}),re=async s=>{if(Cr(s))return new Promise((h,b)=>{var C=new XMLHttpRequest;C.open("GET",s,!0),C.responseType="arraybuffer",C.onload=()=>{if(C.status==200||C.status==0&&C.response){h(C.response);return}b(C.status)},C.onerror=b,C.send(null)});var o=await fetch(s,{credentials:"same-origin"});if(o.ok)return o.arrayBuffer();throw new Error(o.status+" : "+o.url)});c.print||console.log.bind(console);var ye=c.printErr||console.error.bind(console);Object.assign(c,Z),Z=null,c.arguments&&c.arguments,c.thisProgram&&c.thisProgram;var _e=c.wasmBinary,we,Pe=!1,me,ve,oe,ae,pe,ue,le,se;function ce(){var s=we.buffer;c.HEAP8=me=new Int8Array(s),c.HEAP16=oe=new Int16Array(s),c.HEAPU8=ve=new Uint8Array(s),c.HEAPU16=ae=new Uint16Array(s),c.HEAP32=pe=new Int32Array(s),c.HEAPU32=ue=new Uint32Array(s),c.HEAPF32=le=new Float32Array(s),c.HEAPF64=se=new Float64Array(s)}var xr=[],kr=[],Or=[];function Kr(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)rn(c.preRun.shift());dt(xr)}function ot(){dt(kr)}function jt(){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)nn(c.postRun.shift());dt(Or)}function rn(s){xr.unshift(s)}function tn(s){kr.unshift(s)}function nn(s){Or.unshift(s)}var dr=0,Le=null;function Ne(s){dr++,c.monitorRunDependencies?.(dr)}function ze(s){if(dr--,c.monitorRunDependencies?.(dr),dr==0&&Le){var o=Le;Le=null,o()}}function Tr(s){c.onAbort?.(s),s="Aborted("+s+")",ye(s),Pe=!0,s+=". Build with -sASSERTIONS for more info.";var o=new WebAssembly.RuntimeError(s);throw I(o),o}var ut="data:application/octet-stream;base64,",lt=s=>s.startsWith(ut),Cr=s=>s.startsWith("file://");function Fr(){var s="charlswasm_decode.wasm";return lt(s)?s:Y(s)}var vr;function Ar(s){if(s==vr&&_e)return new Uint8Array(_e);if(he)return he(s);throw"both async and sync fetching of the wasm failed"}async function ct(s){if(!_e)try{var o=await re(s);return new Uint8Array(o)}catch{}return Ar(s)}async function ft(s,o){try{var h=await ct(s),b=await WebAssembly.instantiate(h,o);return b}catch(C){ye(`failed to asynchronously prepare wasm: ${C}`),Tr(C)}}async function an(s,o,h){if(!s&&typeof WebAssembly.instantiateStreaming=="function"&&!lt(o)&&!Cr(o)&&!J&&typeof fetch=="function")try{var b=fetch(o,{credentials:"same-origin"}),C=await WebAssembly.instantiateStreaming(b,h);return C}catch(x){ye(`wasm streaming compile failed: ${x}`),ye("falling back to ArrayBuffer instantiation")}return ft(o,h)}function sn(){return{a:Wn}}async function on(){function s(C,x){return Re=C.exports,we=Re.A,ce(),Lr=Re.D,tn(Re.B),ze(),Re}Ne();function o(C){s(C.instance)}var h=sn();if(c.instantiateWasm)try{return c.instantiateWasm(h,s)}catch(C){ye(`Module.instantiateWasm callback failed with error: ${C}`),I(C)}vr??=Fr();try{var b=await an(_e,vr,h);return o(b),b}catch(C){I(C);return}}var dt=s=>{for(;s.length>0;)s.shift()(c)};c.noExitRuntime;var vt=s=>ge(s),Ge=()=>it();class nr{constructor(o){this.excPtr=o,this.ptr=o-24}set_type(o){ue[this.ptr+4>>2]=o}get_type(){return ue[this.ptr+4>>2]}set_destructor(o){ue[this.ptr+8>>2]=o}get_destructor(){return ue[this.ptr+8>>2]}set_caught(o){o=o?1:0,me[this.ptr+12]=o}get_caught(){return me[this.ptr+12]!=0}set_rethrown(o){o=o?1:0,me[this.ptr+13]=o}get_rethrown(){return me[this.ptr+13]!=0}init(o,h){this.set_adjusted_ptr(0),this.set_type(o),this.set_destructor(h)}set_adjusted_ptr(o){ue[this.ptr+16>>2]=o}get_adjusted_ptr(){return ue[this.ptr+16>>2]}}var jr=0,pr=(s,o,h)=>{var b=new nr(s);throw b.init(o,h),jr=s,jr},Je=()=>Tr(""),Xr={},Ir=s=>{for(;s.length;){var o=s.pop(),h=s.pop();h(o)}};function ur(s){return this.fromWireType(ue[s>>2])}var We={},De={},Oe={},Me,Ee=s=>{throw new Me(s)},Se=(s,o,h)=>{s.forEach(E=>Oe[E]=o);function b(E){var j=h(E);j.length!==s.length&&Ee("Mismatched type converter count");for(var U=0;U<s.length;++U)z(s[U],j[U])}var C=new Array(o.length),x=[],O=0;o.forEach((E,j)=>{De.hasOwnProperty(E)?C[j]=De[E]:(x.push(E),We.hasOwnProperty(E)||(We[E]=[]),We[E].push(()=>{C[j]=De[E],++O,O===x.length&&b(C)}))}),x.length===0&&b(C)},hr=s=>{var o=Xr[s];delete Xr[s];var h=o.rawConstructor,b=o.rawDestructor,C=o.fields,x=C.map(O=>O.getterReturnType).concat(C.map(O=>O.setterArgumentType));Se([s],x,O=>{var E={};return C.forEach((j,U)=>{var H=j.fieldName,K=O[U],ne=j.getter,i=j.getterContext,a=O[U+C.length],v=j.setter,_=j.setterContext;E[H]={read:T=>K.fromWireType(ne(i,T)),write:(T,t)=>{var n=[];v(_,T,a.toWireType(n,t)),Ir(n)}}}),[{name:o.name,fromWireType:j=>{var U={};for(var H in E)U[H]=E[H].read(j);return b(j),U},toWireType:(j,U)=>{for(var H in E)if(!(H in U))throw new TypeError(`Missing field: "${H}"`);var K=h();for(H in E)E[H].write(K,U[H]);return j!==null&&j.push(b,K),K},argPackAdvance:Te,readValueFromPointer:ur,destructorFunction:b}]})},yr=(s,o,h,b,C)=>{},Yr=()=>{for(var s=new Array(256),o=0;o<256;++o)s[o]=String.fromCharCode(o);gr=s},gr,be=s=>{for(var o="",h=s;ve[h];)o+=gr[ve[h++]];return o},lr,X=s=>{throw new lr(s)};function He(s,o,h={}){var b=o.name;if(s||X(`type "${b}" must have a positive integer typeid pointer`),De.hasOwnProperty(s)){if(h.ignoreDuplicateRegistrations)return;X(`Cannot register type '${b}' twice`)}if(De[s]=o,delete Oe[s],We.hasOwnProperty(s)){var C=We[s];delete We[s],C.forEach(x=>x())}}function z(s,o,h={}){return He(s,o,h)}var Te=8,Q=(s,o,h,b)=>{o=be(o),z(s,{name:o,fromWireType:function(C){return!!C},toWireType:function(C,x){return x?h:b},argPackAdvance:Te,readValueFromPointer:function(C){return this.fromWireType(ve[C])},destructorFunction:null})},Be=s=>({count:s.count,deleteScheduled:s.deleteScheduled,preservePointerOnDelete:s.preservePointerOnDelete,ptr:s.ptr,ptrType:s.ptrType,smartPtr:s.smartPtr,smartPtrType:s.smartPtrType}),Ce=s=>{function o(h){return h.$$.ptrType.registeredClass.name}X(o(s)+" instance already deleted")},qe=!1,Zr=s=>{},pt=s=>{s.smartPtr?s.smartPtrType.rawDestructor(s.smartPtr):s.ptrType.registeredClass.rawDestructor(s.ptr)},Rr=s=>{s.count.value-=1;var o=s.count.value===0;o&&pt(s)},Ae=(s,o,h)=>{if(o===h)return s;if(h.baseClass===void 0)return null;var b=Ae(s,o,h.baseClass);return b===null?null:h.downcast(b)},ar={},te={},ht=(s,o)=>{for(o===void 0&&X("ptr should not be undefined");s.baseClass;)o=s.upcast(o),s=s.baseClass;return o},er=(s,o)=>(o=ht(s,o),te[o]),Fe=(s,o)=>{(!o.ptrType||!o.ptr)&&Ee("makeClassHandle requires ptr and ptrType");var h=!!o.smartPtrType,b=!!o.smartPtr;return h!==b&&Ee("Both smartPtrType and smartPtr must be specified"),o.count={value:1},cr(Object.create(s,{$$:{value:o,writable:!0}}))};function un(s){var o=this.getPointee(s);if(!o)return this.destructor(s),null;var h=er(this.registeredClass,o);if(h!==void 0){if(h.$$.count.value===0)return h.$$.ptr=o,h.$$.smartPtr=s,h.clone();var b=h.clone();return this.destructor(s),b}function C(){return this.isSmartPointer?Fe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:o,smartPtrType:this,smartPtr:s}):Fe(this.registeredClass.instancePrototype,{ptrType:this,ptr:s})}var x=this.registeredClass.getActualType(o),O=ar[x];if(!O)return C.call(this);var E;this.isConst?E=O.constPointerType:E=O.pointerType;var j=Ae(o,this.registeredClass,E.registeredClass);return j===null?C.call(this):this.isSmartPointer?Fe(E.registeredClass.instancePrototype,{ptrType:E,ptr:j,smartPtrType:this,smartPtr:s}):Fe(E.registeredClass.instancePrototype,{ptrType:E,ptr:j})}var cr=s=>typeof FinalizationRegistry>"u"?(cr=o=>o,s):(qe=new FinalizationRegistry(o=>{Rr(o.$$)}),cr=o=>{var h=o.$$,b=!!h.smartPtr;if(b){var C={$$:h};qe.register(o,C,o)}return o},Zr=o=>qe.unregister(o),cr(s)),yt=()=>{Object.assign(je.prototype,{isAliasOf(s){if(!(this instanceof je)||!(s instanceof je))return!1;var o=this.$$.ptrType.registeredClass,h=this.$$.ptr;s.$$=s.$$;for(var b=s.$$.ptrType.registeredClass,C=s.$$.ptr;o.baseClass;)h=o.upcast(h),o=o.baseClass;for(;b.baseClass;)C=b.upcast(C),b=b.baseClass;return o===b&&h===C},clone(){if(this.$$.ptr||Ce(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=cr(Object.create(Object.getPrototypeOf(this),{$$:{value:Be(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||Ce(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),Zr(this),Rr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ce(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}})};function je(){}var Ur=(s,o)=>Object.defineProperty(o,"name",{value:s}),ir=(s,o,h)=>{if(s[o].overloadTable===void 0){var b=s[o];s[o]=function(...C){return s[o].overloadTable.hasOwnProperty(C.length)||X(`Function '${h}' called with an invalid number of arguments (${C.length}) - expects one of (${s[o].overloadTable})!`),s[o].overloadTable[C.length].apply(this,C)},s[o].overloadTable=[],s[o].overloadTable[b.argCount]=b}},Er=(s,o,h)=>{c.hasOwnProperty(s)?((h===void 0||c[s].overloadTable!==void 0&&c[s].overloadTable[h]!==void 0)&&X(`Cannot register public name '${s}' twice`),ir(c,s,s),c[s].overloadTable.hasOwnProperty(h)&&X(`Cannot register multiple overloads of a function with the same number of arguments (${h})!`),c[s].overloadTable[h]=o):(c[s]=o,c[s].argCount=h)},Sr=48,Mr=57,It=s=>{s=s.replace(/[^a-zA-Z0-9_]/g,"$");var o=s.charCodeAt(0);return o>=Sr&&o<=Mr?`_${s}`:s};function ln(s,o,h,b,C,x,O,E){this.name=s,this.constructor=o,this.instancePrototype=h,this.rawDestructor=b,this.baseClass=C,this.getActualType=x,this.upcast=O,this.downcast=E,this.pureVirtualFunctions=[]}var gt=(s,o,h)=>{for(;o!==h;)o.upcast||X(`Expected null or instance of ${h.name}, got an instance of ${o.name}`),s=o.upcast(s),o=o.baseClass;return s};function Qr(s,o){if(o===null)return this.isReference&&X(`null is not a valid ${this.name}`),0;o.$$||X(`Cannot pass "${wt(o)}" as a ${this.name}`),o.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`);var h=o.$$.ptrType.registeredClass,b=gt(o.$$.ptr,h,this.registeredClass);return b}function _t(s,o){var h;if(o===null)return this.isReference&&X(`null is not a valid ${this.name}`),this.isSmartPointer?(h=this.rawConstructor(),s!==null&&s.push(this.rawDestructor,h),h):0;(!o||!o.$$)&&X(`Cannot pass "${wt(o)}" as a ${this.name}`),o.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&o.$$.ptrType.isConst&&X(`Cannot convert argument of type ${o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name} to parameter type ${this.name}`);var b=o.$$.ptrType.registeredClass;if(h=gt(o.$$.ptr,b,this.registeredClass),this.isSmartPointer)switch(o.$$.smartPtr===void 0&&X("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:o.$$.smartPtrType===this?h=o.$$.smartPtr:X(`Cannot convert argument of type ${o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:h=o.$$.smartPtr;break;case 2:if(o.$$.smartPtrType===this)h=o.$$.smartPtr;else{var C=o.clone();h=this.rawShare(h,$e.toHandle(()=>C.delete())),s!==null&&s.push(this.rawDestructor,h)}break;default:X("Unsupporting sharing policy")}return h}function Hr(s,o){if(o===null)return this.isReference&&X(`null is not a valid ${this.name}`),0;o.$$||X(`Cannot pass "${wt(o)}" as a ${this.name}`),o.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),o.$$.ptrType.isConst&&X(`Cannot convert argument of type ${o.$$.ptrType.name} to parameter type ${this.name}`);var h=o.$$.ptrType.registeredClass,b=gt(o.$$.ptr,h,this.registeredClass);return b}var mt=()=>{Object.assign(_r.prototype,{getPointee(s){return this.rawGetPointee&&(s=this.rawGetPointee(s)),s},destructor(s){this.rawDestructor?.(s)},argPackAdvance:Te,readValueFromPointer:ur,fromWireType:un})};function _r(s,o,h,b,C,x,O,E,j,U,H){this.name=s,this.registeredClass=o,this.isReference=h,this.isConst=b,this.isSmartPointer=C,this.pointeeType=x,this.sharingPolicy=O,this.rawGetPointee=E,this.rawConstructor=j,this.rawShare=U,this.rawDestructor=H,!C&&o.baseClass===void 0?b?(this.toWireType=Qr,this.destructorFunction=null):(this.toWireType=Hr,this.destructorFunction=null):this.toWireType=_t}var et=(s,o,h)=>{c.hasOwnProperty(s)||Ee("Replacing nonexistent public symbol"),c[s].overloadTable!==void 0&&h!==void 0?c[s].overloadTable[h]=o:(c[s]=o,c[s].argCount=h)},Br=(s,o,h)=>{s=s.replace(/p/g,"i");var b=c["dynCall_"+s];return b(o,...h)},Vr=[],Lr,Nr=s=>{var o=Vr[s];return o||(s>=Vr.length&&(Vr.length=s+1),Vr[s]=o=Lr.get(s)),o},Ut=(s,o,h=[])=>{if(s.includes("j"))return Br(s,o,h);var b=Nr(o)(...h);return b},zr=(s,o)=>(...h)=>Ut(s,o,h),xe=(s,o)=>{s=be(s);function h(){return s.includes("j")?zr(s,o):Nr(o)}var b=h();return typeof b!="function"&&X(`unknown function pointer with signature ${s}: ${o}`),b},mr=(s,o)=>{var h=Ur(o,function(b){this.name=o,this.message=b;var C=new Error(b).stack;C!==void 0&&(this.stack=this.toString()+`
3
+ `+C.replace(/^Error(:[^\n]*)?\n/,""))});return h.prototype=Object.create(s.prototype),h.prototype.constructor=h,h.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},h},Ke,Mt=s=>{var o=Qt(s),h=be(o);return rr(o),h},ke=(s,o)=>{var h=[],b={};function C(x){if(!b[x]&&!De[x]){if(Oe[x]){Oe[x].forEach(C);return}h.push(x),b[x]=!0}}throw o.forEach(C),new Ke(`${s}: `+h.map(Mt).join([", "]))},Gr=(s,o,h,b,C,x,O,E,j,U,H,K,ne)=>{H=be(H),x=xe(C,x),E&&=xe(O,E),U&&=xe(j,U),ne=xe(K,ne);var i=It(H);Er(i,function(){ke(`Cannot construct ${H} due to unbound types`,[b])}),Se([s,o,h],b?[b]:[],a=>{a=a[0];var v,_;b?(v=a.registeredClass,_=v.instancePrototype):_=je.prototype;var T=Ur(H,function(...w){if(Object.getPrototypeOf(this)!==t)throw new lr("Use 'new' to construct "+H);if(n.constructor_body===void 0)throw new lr(H+" has no accessible constructor");var e=n.constructor_body[w.length];if(e===void 0)throw new lr(`Tried to invoke ctor of ${H} with invalid number of parameters (${w.length}) - expected (${Object.keys(n.constructor_body).toString()}) parameters instead!`);return e.apply(this,w)}),t=Object.create(_,{constructor:{value:T}});T.prototype=t;var n=new ln(H,T,t,ne,v,x,E,U);n.baseClass&&(n.baseClass.__derivedClasses??=[],n.baseClass.__derivedClasses.push(n));var u=new _r(H,n,!0,!1,!1),p=new _r(H+"*",n,!1,!1,!1),g=new _r(H+" const*",n,!1,!0,!1);return ar[s]={pointerType:p,constPointerType:g},et(i,T),[u,p,g]})},br=(s,o)=>{for(var h=[],b=0;b<s;b++)h.push(ue[o+b*4>>2]);return h};function Ht(s){for(var o=1;o<s.length;++o)if(s[o]!==null&&s[o].destructorFunction===void 0)return!0;return!1}var $r={ftf:function(s,o,h,b,C,x,O){return function(){var E=h(b),j=x.fromWireType(E);return j}},ttfnn:function(s,o,h,b,C,x,O,E){return function(j){var U=O.toWireType(null,this),H=E.toWireType(null,j),K=h(b,U,H),ne=x.fromWireType(K);return ne}},ttfn:function(s,o,h,b,C,x,O){return function(){var E=O.toWireType(null,this),j=h(b,E),U=x.fromWireType(j);return U}},tffn:function(s,o,h,b,C,x,O){return function(){var E=O.toWireType(null,this);h(b,E)}},ftfn:function(s,o,h,b,C,x,O,E){return function(j){var U=E.toWireType(null,j),H=h(b,U),K=x.fromWireType(H);return K}}};function Bt(s,o,h,b){const C=[o?"t":"f",h?"t":"f",b?"t":"f"];for(let x=o?1:2;x<s.length;++x){const O=s[x];let E="";O.destructorFunction===void 0?E="u":O.destructorFunction===null?E="n":E="t",C.push(E)}return C.join("")}function Ie(s,o,h,b,C,x){var O=o.length;O<2&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var E=o[1]!==null&&h!==null,j=Ht(o),U=o[0].name!=="void",H=[s,X,b,C,Ir,o[0],o[1]],K=0;K<O-2;++K)H.push(o[K+2]);if(!j)for(var K=E?1:2;K<o.length;++K)o[K].destructorFunction!==null&&H.push(o[K].destructorFunction);var ne=Bt(o,E,U,x),i=$r[ne](...H);return Ur(s,i)}var cn=(s,o,h,b,C,x)=>{var O=br(o,h);C=xe(b,C),Se([],[s],E=>{E=E[0];var j=`constructor ${E.name}`;if(E.registeredClass.constructor_body===void 0&&(E.registeredClass.constructor_body=[]),E.registeredClass.constructor_body[o-1]!==void 0)throw new lr(`Cannot register multiple constructors with identical number of parameters (${o-1}) for class '${E.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return E.registeredClass.constructor_body[o-1]=()=>{ke(`Cannot construct ${E.name} due to unbound types`,O)},Se([],O,U=>(U.splice(1,0,null),E.registeredClass.constructor_body[o-1]=Ie(j,U,null,C,x),[])),[]})},bt=s=>{s=s.trim();const o=s.indexOf("(");return o!==-1?s.substr(0,o):s},Xe=(s,o,h,b,C,x,O,E,j,U)=>{var H=br(h,b);o=be(o),o=bt(o),x=xe(C,x),Se([],[s],K=>{K=K[0];var ne=`${K.name}.${o}`;o.startsWith("@@")&&(o=Symbol[o.substring(2)]),E&&K.registeredClass.pureVirtualFunctions.push(o);function i(){ke(`Cannot call ${ne} due to unbound types`,H)}var a=K.registeredClass.instancePrototype,v=a[o];return v===void 0||v.overloadTable===void 0&&v.className!==K.name&&v.argCount===h-2?(i.argCount=h-2,i.className=K.name,a[o]=i):(ir(a,o,ne),a[o].overloadTable[h-2]=i),Se([],H,_=>{var T=Ie(ne,_,K,x,O,j);return a[o].overloadTable===void 0?(T.argCount=h-2,a[o]=T):a[o].overloadTable[h-2]=T,[]}),[]})},rt=[],sr=[],Wr=s=>{s>9&&--sr[s+1]===0&&(sr[s]=void 0,rt.push(s))},Ye=()=>sr.length/2-5-rt.length,Jr=()=>{sr.push(0,1,void 0,1,null,1,!0,1,!1,1),c.count_emval_handles=Ye},$e={toValue:s=>(s||X("Cannot use deleted val. handle = "+s),sr[s]),toHandle:s=>{switch(s){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const o=rt.pop()||sr.length;return sr[o]=s,sr[o+1]=1,o}}}},$t={name:"emscripten::val",fromWireType:s=>{var o=$e.toValue(s);return Wr(s),o},toWireType:(s,o)=>$e.toHandle(o),argPackAdvance:Te,readValueFromPointer:ur,destructorFunction:null},or=s=>z(s,$t),wt=s=>{if(s===null)return"null";var o=typeof s;return o==="object"||o==="array"||o==="function"?s.toString():""+s},Ze=(s,o)=>{switch(o){case 4:return function(h){return this.fromWireType(le[h>>2])};case 8:return function(h){return this.fromWireType(se[h>>3])};default:throw new TypeError(`invalid float width (${o}): ${s}`)}},Pt=(s,o,h)=>{o=be(o),z(s,{name:o,fromWireType:b=>b,toWireType:(b,C)=>C,argPackAdvance:Te,readValueFromPointer:Ze(o,h),destructorFunction:null})},Vt=(s,o,h,b,C,x,O,E)=>{var j=br(o,h);s=be(s),s=bt(s),C=xe(b,C),Er(s,function(){ke(`Cannot call ${s} due to unbound types`,j)},o-1),Se([],j,U=>{var H=[U[0],null].concat(U.slice(1));return et(s,Ie(s,H,null,C,x,O),o-1),[]})},Tt=(s,o,h)=>{switch(o){case 1:return h?b=>me[b]:b=>ve[b];case 2:return h?b=>oe[b>>1]:b=>ae[b>>1];case 4:return h?b=>pe[b>>2]:b=>ue[b>>2];default:throw new TypeError(`invalid integer width (${o}): ${s}`)}},Ct=(s,o,h,b,C)=>{o=be(o);var x=H=>H;if(b===0){var O=32-8*h;x=H=>H<<O>>>O}var E=o.includes("unsigned"),j=(H,K)=>{},U;E?U=function(H,K){return j(K,this.name),K>>>0}:U=function(H,K){return j(K,this.name),K},z(s,{name:o,fromWireType:x,toWireType:U,argPackAdvance:Te,readValueFromPointer:Tt(o,h,b!==0),destructorFunction:null})},fr=(s,o,h)=>{var b=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],C=b[o];function x(O){var E=ue[O>>2],j=ue[O+4>>2];return new C(me.buffer,j,E)}h=be(h),z(s,{name:h,fromWireType:x,argPackAdvance:Te,readValueFromPointer:x},{ignoreDuplicateRegistrations:!0})},Lt=(s,o,h,b)=>{if(!(b>0))return 0;for(var C=h,x=h+b-1,O=0;O<s.length;++O){var E=s.charCodeAt(O);if(E>=55296&&E<=57343){var j=s.charCodeAt(++O);E=65536+((E&1023)<<10)|j&1023}if(E<=127){if(h>=x)break;o[h++]=E}else if(E<=2047){if(h+1>=x)break;o[h++]=192|E>>6,o[h++]=128|E&63}else if(E<=65535){if(h+2>=x)break;o[h++]=224|E>>12,o[h++]=128|E>>6&63,o[h++]=128|E&63}else{if(h+3>=x)break;o[h++]=240|E>>18,o[h++]=128|E>>12&63,o[h++]=128|E>>6&63,o[h++]=128|E&63}}return o[h]=0,h-C},Nt=(s,o,h)=>Lt(s,ve,o,h),At=s=>{for(var o=0,h=0;h<s.length;++h){var b=s.charCodeAt(h);b<=127?o++:b<=2047?o+=2:b>=55296&&b<=57343?(o+=4,++h):o+=3}return o},Dr=typeof TextDecoder<"u"?new TextDecoder:void 0,Rt=(s,o=0,h=NaN)=>{for(var b=o+h,C=o;s[C]&&!(C>=b);)++C;if(C-o>16&&s.buffer&&Dr)return Dr.decode(s.subarray(o,C));for(var x="";o<C;){var O=s[o++];if(!(O&128)){x+=String.fromCharCode(O);continue}var E=s[o++]&63;if((O&224)==192){x+=String.fromCharCode((O&31)<<6|E);continue}var j=s[o++]&63;if((O&240)==224?O=(O&15)<<12|E<<6|j:O=(O&7)<<18|E<<12|j<<6|s[o++]&63,O<65536)x+=String.fromCharCode(O);else{var U=O-65536;x+=String.fromCharCode(55296|U>>10,56320|U&1023)}}return x},tt=(s,o)=>s?Rt(ve,s,o):"",qr=(s,o)=>{o=be(o),z(s,{name:o,fromWireType(h){for(var b=ue[h>>2],C=h+4,x,O,E=C,O=0;O<=b;++O){var j=C+O;if(O==b||ve[j]==0){var U=j-E,H=tt(E,U);x===void 0?x=H:(x+="\0",x+=H),E=j+1}}return rr(h),x},toWireType(h,b){b instanceof ArrayBuffer&&(b=new Uint8Array(b));var C,x=typeof b=="string";x||b instanceof Uint8Array||b instanceof Uint8ClampedArray||b instanceof Int8Array||X("Cannot pass non-string to std::string"),x?C=At(b):C=b.length;var O=kt(4+C+1),E=O+4;if(ue[O>>2]=C,x)Nt(b,E,C+1);else if(x)for(var j=0;j<C;++j){var U=b.charCodeAt(j);U>255&&(rr(E),X("String has UTF-16 code units that do not fit in 8 bits")),ve[E+j]=U}else for(var j=0;j<C;++j)ve[E+j]=b[j];return h!==null&&h.push(rr,O),O},argPackAdvance:Te,readValueFromPointer:ur,destructorFunction(h){rr(h)}})},Et=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,St=(s,o)=>{for(var h=s,b=h>>1,C=b+o/2;!(b>=C)&&ae[b];)++b;if(h=b<<1,h-s>32&&Et)return Et.decode(ve.subarray(s,h));for(var x="",O=0;!(O>=o/2);++O){var E=oe[s+O*2>>1];if(E==0)break;x+=String.fromCharCode(E)}return x},fn=(s,o,h)=>{if(h??=2147483647,h<2)return 0;h-=2;for(var b=o,C=h<s.length*2?h/2:s.length,x=0;x<C;++x){var O=s.charCodeAt(x);oe[o>>1]=O,o+=2}return oe[o>>1]=0,o-b},zt=s=>s.length*2,dn=(s,o)=>{for(var h=0,b="";!(h>=o/4);){var C=pe[s+h*4>>2];if(C==0)break;if(++h,C>=65536){var x=C-65536;b+=String.fromCharCode(55296|x>>10,56320|x&1023)}else b+=String.fromCharCode(C)}return b},vn=(s,o,h)=>{if(h??=2147483647,h<4)return 0;for(var b=o,C=b+h-4,x=0;x<s.length;++x){var O=s.charCodeAt(x);if(O>=55296&&O<=57343){var E=s.charCodeAt(++x);O=65536+((O&1023)<<10)|E&1023}if(pe[o>>2]=O,o+=4,o+4>C)break}return pe[o>>2]=0,o-b},pn=s=>{for(var o=0,h=0;h<s.length;++h){var b=s.charCodeAt(h);b>=55296&&b<=57343&&++h,o+=4}return o},Gt=(s,o,h)=>{h=be(h);var b,C,x,O;o===2?(b=St,C=fn,O=zt,x=E=>ae[E>>1]):o===4&&(b=dn,C=vn,O=pn,x=E=>ue[E>>2]),z(s,{name:h,fromWireType:E=>{for(var j=ue[E>>2],U,H=E+4,K=0;K<=j;++K){var ne=E+4+K*o;if(K==j||x(ne)==0){var i=ne-H,a=b(H,i);U===void 0?U=a:(U+="\0",U+=a),H=ne+o}}return rr(E),U},toWireType:(E,j)=>{typeof j!="string"&&X(`Cannot pass non-string to C++ string type ${h}`);var U=O(j),H=kt(4+U+o);return ue[H>>2]=U/o,C(j,H+4,U+o),E!==null&&E.push(rr,H),H},argPackAdvance:Te,readValueFromPointer:ur,destructorFunction(E){rr(E)}})},Jt=(s,o,h,b,C,x)=>{Xr[s]={name:be(o),rawConstructor:xe(h,b),rawDestructor:xe(C,x),fields:[]}},hn=(s,o,h,b,C,x,O,E,j,U)=>{Xr[s].fields.push({fieldName:be(o),getterReturnType:h,getter:xe(b,C),getterContext:x,setterArgumentType:O,setter:xe(E,j),setterContext:U})},qt=(s,o)=>{o=be(o),z(s,{isVoid:!0,name:o,argPackAdvance:0,fromWireType:()=>{},toWireType:(h,b)=>{}})},yn=(s,o,h)=>ve.copyWithin(s,o,o+h),Wt=[],Dt=(s,o,h,b)=>(s=Wt[s],o=$e.toValue(o),s(null,o,h,b)),gn={},_n=s=>{var o=gn[s];return o===void 0?be(s):o},nt=()=>{if(typeof globalThis=="object")return globalThis;function s(o){o.$$$embind_global$$$=o;var h=typeof $$$embind_global$$$=="object"&&o.$$$embind_global$$$==o;return h||delete o.$$$embind_global$$$,h}if(typeof $$$embind_global$$$=="object"||(typeof Ft=="object"&&s(Ft)?$$$embind_global$$$=Ft:typeof self=="object"&&s(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},Kt=s=>s===0?$e.toHandle(nt()):(s=_n(s),$e.toHandle(nt()[s])),mn=s=>{var o=Wt.length;return Wt.push(s),o},Xt=(s,o)=>{var h=De[s];return h===void 0&&X(`${o} has unknown type ${Mt(s)}`),h},xt=(s,o)=>{for(var h=new Array(s),b=0;b<s;++b)h[b]=Xt(ue[o+b*4>>2],"parameter "+b);return h},bn=Reflect.construct,$n=(s,o,h)=>{var b=[],C=s.toWireType(b,h);return b.length&&(ue[o>>2]=$e.toHandle(b)),C},Yt=(s,o,h)=>{var b=xt(s,o),C=b.shift();s--;var x=new Array(s),O=(j,U,H,K)=>{for(var ne=0,i=0;i<s;++i)x[i]=b[i].readValueFromPointer(K+ne),ne+=b[i].argPackAdvance;var a=h===1?bn(U,x):U.apply(j,x);return $n(C,H,a)},E=`methodCaller<(${b.map(j=>j.name).join(", ")}) => ${C.name}>`;return mn(Ur(E,O))},wn=s=>{var o=$e.toValue(s);Ir(o),Wr(s)},Pn=(s,o)=>{s=Xt(s,"_emval_take_value");var h=s.readValueFromPointer(o);return $e.toHandle(h)},Tn=()=>2147483648,Zt=(s,o)=>Math.ceil(s/o)*o,Cn=s=>{var o=we.buffer,h=(s-o.byteLength+65535)/65536|0;try{return we.grow(h),ce(),1}catch{}},An=s=>{var o=ve.length;s>>>=0;var h=Tn();if(s>h)return!1;for(var b=1;b<=4;b*=2){var C=o*(1+.2/b);C=Math.min(C,s+100663296);var x=Math.min(h,Zt(Math.max(s,C),65536)),O=Cn(x);if(O)return!0}return!1},Rn=s=>{var o=c["_"+s];return o},En=(s,o)=>{me.set(s,o)},at=s=>Ot(s),Sn=s=>{var o=At(s)+1,h=at(o);return Nt(s,h,o),h},wr=(s,o,h,b,C)=>{var x={string:a=>{var v=0;return a!=null&&a!==0&&(v=Sn(a)),v},array:a=>{var v=at(a.length);return En(a,v),v}};function O(a){return o==="string"?tt(a):o==="boolean"?!!a:a}var E=Rn(s),j=[],U=0;if(b)for(var H=0;H<b.length;H++){var K=x[h[H]];K?(U===0&&(U=Ge()),j[H]=K(b[H])):j[H]=b[H]}var ne=E(...j);function i(a){return U!==0&&vt(U),O(a)}return ne=i(ne),ne};Me=c.InternalError=class extends Error{constructor(o){super(o),this.name="InternalError"}},Yr(),lr=c.BindingError=class extends Error{constructor(o){super(o),this.name="BindingError"}},yt(),mt(),Ke=c.UnboundTypeError=mr(Error,"UnboundTypeError"),Jr();var Wn={g:pr,o:Je,l:hr,n:yr,t:Q,k:Gr,j:cn,c:Xe,r:or,h:Pt,e:Vt,b:Ct,a:fr,s:qr,f:Gt,m:Jt,d:hn,u:qt,q:yn,w:Dt,y:Wr,z:Kt,x:Yt,v:wn,i:Pn,p:An},Re;on();var Qt=s=>(Qt=Re.C)(s),kt=s=>(kt=Re.E)(s),rr=s=>(rr=Re.F)(s),ge=s=>(ge=Re.G)(s),Ot=s=>(Ot=Re.H)(s),it=()=>(it=Re.I)();c.ccall=wr;var Ve;Le=function s(){Ve||Qe(),Ve||(Le=s)};function Qe(){if(dr>0||(Kr(),dr>0))return;function s(){Ve||(Ve=!0,c.calledRun=!0,!Pe&&(ot(),F(c),c.onRuntimeInitialized?.(),jt()))}c.setStatus?(c.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>c.setStatus(""),1),s()},1)):s()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();return Qe(),k=V,k})})();f.exports=m,f.exports.default=m})(Qn)),Qn.exports}var vi=di(),pi=Gn(vi);const hi=new URL(""+new URL("charlswasm_decode-BrO4esUm.wasm",import.meta.url).href,import.meta.url),kn={codec:void 0,decoder:void 0,decodeConfig:{}};function yi(f){return typeof f=="number"?kn.codec.getExceptionMessage(f):f}function gi(f){if(kn.decodeConfig=f,Mn(f),kn.codec)return Promise.resolve();const $=pi({locateFile:m=>m.endsWith(".wasm")?Kn("charlswasm_decode.wasm",hi):m});return new Promise((m,R)=>{$.then(S=>{kn.codec=S,kn.decoder=new S.JpegLSDecoder,m()},R)})}async function pa(f,$){try{await gi();const m=kn.decoder;m.getEncodedBuffer(f.length).set(f),m.decode();const S=m.getFrameInfo(),k=m.getInterleaveMode(),c=m.getNearLossless(),F=m.getDecodedBuffer(),I={columns:S.width,rows:S.height,bitsPerPixel:S.bitsPerSample,signed:$.signed,bytesPerPixel:$.bytesPerPixel,componentsPerPixel:S.componentCount},V=qn(S,F,$.signed),N={nearLossless:c,interleaveMode:k,frameInfo:S};return{...$,pixelData:V,imageInfo:I,encodeOptions:N,...N,...I}}catch(m){throw yi(m)}}var ea={exports:{}},ha;function _i(){return ha||(ha=1,(function(f,$){var m=(()=>{var R=typeof document<"u"?document.currentScript?.src:void 0;return typeof __filename<"u"&&(R=R||__filename),(function(S={}){var k,c=S,F,I,V=new Promise((i,a)=>{F=i,I=a}),N=typeof window=="object",L=typeof WorkerGlobalScope<"u",J=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Z=Object.assign({},c),G="./this.program",Y="";function re(i){return c.locateFile?c.locateFile(i,Y):Y+i}var he,ee;if(J){var ye=Jn;Y=__dirname+"/",ee=i=>{i=vr(i)?new URL(i):i;var a=ye.readFileSync(i);return a},he=async(i,a=!0)=>{i=vr(i)?new URL(i):i;var v=ye.readFileSync(i,a?void 0:"utf8");return v},!c.thisProgram&&process.argv.length>1&&(G=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else(N||L)&&(L?Y=self.location.href:typeof document<"u"&&document.currentScript&&(Y=document.currentScript.src),R&&(Y=R),Y.startsWith("blob:")?Y="":Y=Y.substr(0,Y.replace(/[?#].*/,"").lastIndexOf("/")+1),L&&(ee=i=>{var a=new XMLHttpRequest;return a.open("GET",i,!1),a.responseType="arraybuffer",a.send(null),new Uint8Array(a.response)}),he=async i=>{if(vr(i))return new Promise((v,_)=>{var T=new XMLHttpRequest;T.open("GET",i,!0),T.responseType="arraybuffer",T.onload=()=>{if(T.status==200||T.status==0&&T.response){v(T.response);return}_(T.status)},T.onerror=_,T.send(null)});var a=await fetch(i,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw new Error(a.status+" : "+a.url)});var _e=c.print||console.log.bind(console),we=c.printErr||console.error.bind(console);Object.assign(c,Z),Z=null,c.arguments&&c.arguments,c.thisProgram&&(G=c.thisProgram);var Pe=c.wasmBinary,me,ve=!1,oe,ae,pe,ue,le,se,ce,xr;function kr(){var i=me.buffer;c.HEAP8=oe=new Int8Array(i),c.HEAP16=pe=new Int16Array(i),c.HEAPU8=ae=new Uint8Array(i),c.HEAPU16=ue=new Uint16Array(i),c.HEAP32=le=new Int32Array(i),c.HEAPU32=se=new Uint32Array(i),c.HEAPF32=ce=new Float32Array(i),c.HEAPF64=xr=new Float64Array(i)}var Or=[],Kr=[],ot=[];function jt(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)nn(c.preRun.shift());Ge(Or)}function rn(){Ge(Kr)}function tn(){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)Le(c.postRun.shift());Ge(ot)}function nn(i){Or.unshift(i)}function dr(i){Kr.unshift(i)}function Le(i){ot.unshift(i)}var Ne=0,ze=null;function Tr(i){Ne++,c.monitorRunDependencies?.(Ne)}function ut(i){if(Ne--,c.monitorRunDependencies?.(Ne),Ne==0&&ze){var a=ze;ze=null,a()}}function lt(i){c.onAbort?.(i),i="Aborted("+i+")",we(i),ve=!0,i+=". Build with -sASSERTIONS for more info.";var a=new WebAssembly.RuntimeError(i);throw I(a),a}var Cr="data:application/octet-stream;base64,",Fr=i=>i.startsWith(Cr),vr=i=>i.startsWith("file://");function Ar(){var i="openjpegwasm_decode.wasm";return Fr(i)?i:re(i)}var ct;function ft(i){if(i==ct&&Pe)return new Uint8Array(Pe);if(ee)return ee(i);throw"both async and sync fetching of the wasm failed"}async function an(i){if(!Pe)try{var a=await he(i);return new Uint8Array(a)}catch{}return ft(i)}async function sn(i,a){try{var v=await an(i),_=await WebAssembly.instantiate(v,a);return _}catch(T){we(`failed to asynchronously prepare wasm: ${T}`),lt(T)}}async function on(i,a,v){if(!i&&typeof WebAssembly.instantiateStreaming=="function"&&!Fr(a)&&!vr(a)&&!J&&typeof fetch=="function")try{var _=fetch(a,{credentials:"same-origin"}),T=await WebAssembly.instantiateStreaming(_,v);return T}catch(t){we(`wasm streaming compile failed: ${t}`),we("falling back to ArrayBuffer instantiation")}return sn(a,v)}function dt(){return{a:b}}async function vt(){function i(T,t){return C=T.exports,me=C.F,kr(),Ut=C.I,dr(C.G),ut(),C}Tr();function a(T){i(T.instance)}var v=dt();if(c.instantiateWasm)try{return c.instantiateWasm(v,i)}catch(T){we(`Module.instantiateWasm callback failed with error: ${T}`),I(T)}ct??=Ar();try{var _=await on(Pe,ct,v);return a(_),_}catch(T){I(T);return}}var Ge=i=>{for(;i.length>0;)i.shift()(c)};c.noExitRuntime;var nr=i=>j(i),jr=()=>H();class pr{constructor(a){this.excPtr=a,this.ptr=a-24}set_type(a){se[this.ptr+4>>2]=a}get_type(){return se[this.ptr+4>>2]}set_destructor(a){se[this.ptr+8>>2]=a}get_destructor(){return se[this.ptr+8>>2]}set_caught(a){a=a?1:0,oe[this.ptr+12]=a}get_caught(){return oe[this.ptr+12]!=0}set_rethrown(a){a=a?1:0,oe[this.ptr+13]=a}get_rethrown(){return oe[this.ptr+13]!=0}init(a,v){this.set_adjusted_ptr(0),this.set_type(a),this.set_destructor(v)}set_adjusted_ptr(a){se[this.ptr+16>>2]=a}get_adjusted_ptr(){return se[this.ptr+16>>2]}}var Je=0,Xr=(i,a,v)=>{var _=new pr(i);throw _.init(a,v),Je=i,Je},Ir=()=>lt(""),ur={},We=i=>{for(;i.length;){var a=i.pop(),v=i.pop();v(a)}};function De(i){return this.fromWireType(se[i>>2])}var Oe={},Me={},Ee={},Se,hr=i=>{throw new Se(i)},yr=(i,a,v)=>{i.forEach(u=>Ee[u]=a);function _(u){var p=v(u);p.length!==i.length&&hr("Mismatched type converter count");for(var g=0;g<i.length;++g)Q(i[g],p[g])}var T=new Array(a.length),t=[],n=0;a.forEach((u,p)=>{Me.hasOwnProperty(u)?T[p]=Me[u]:(t.push(u),Oe.hasOwnProperty(u)||(Oe[u]=[]),Oe[u].push(()=>{T[p]=Me[u],++n,n===t.length&&_(T)}))}),t.length===0&&_(T)},Yr=i=>{var a=ur[i];delete ur[i];var v=a.rawConstructor,_=a.rawDestructor,T=a.fields,t=T.map(n=>n.getterReturnType).concat(T.map(n=>n.setterArgumentType));yr([i],t,n=>{var u={};return T.forEach((p,g)=>{var w=p.fieldName,e=n[g],r=p.getter,l=p.getterContext,d=n[g+T.length],y=p.setter,P=p.setterContext;u[w]={read:W=>e.fromWireType(r(l,W)),write:(W,A)=>{var D=[];y(P,W,d.toWireType(D,A)),We(D)}}}),[{name:a.name,fromWireType:p=>{var g={};for(var w in u)g[w]=u[w].read(p);return _(p),g},toWireType:(p,g)=>{for(var w in u)if(!(w in g))throw new TypeError(`Missing field: "${w}"`);var e=v();for(w in u)u[w].write(e,g[w]);return p!==null&&p.push(_,e),e},argPackAdvance:Be,readValueFromPointer:De,destructorFunction:_}]})},gr=(i,a,v,_,T)=>{},be=()=>{for(var i=new Array(256),a=0;a<256;++a)i[a]=String.fromCharCode(a);lr=i},lr,X=i=>{for(var a="",v=i;ae[v];)a+=lr[ae[v++]];return a},He,z=i=>{throw new He(i)};function Te(i,a,v={}){var _=a.name;if(i||z(`type "${_}" must have a positive integer typeid pointer`),Me.hasOwnProperty(i)){if(v.ignoreDuplicateRegistrations)return;z(`Cannot register type '${_}' twice`)}if(Me[i]=a,delete Ee[i],Oe.hasOwnProperty(i)){var T=Oe[i];delete Oe[i],T.forEach(t=>t())}}function Q(i,a,v={}){return Te(i,a,v)}var Be=8,Ce=(i,a,v,_)=>{a=X(a),Q(i,{name:a,fromWireType:function(T){return!!T},toWireType:function(T,t){return t?v:_},argPackAdvance:Be,readValueFromPointer:function(T){return this.fromWireType(ae[T])},destructorFunction:null})},qe=i=>({count:i.count,deleteScheduled:i.deleteScheduled,preservePointerOnDelete:i.preservePointerOnDelete,ptr:i.ptr,ptrType:i.ptrType,smartPtr:i.smartPtr,smartPtrType:i.smartPtrType}),Zr=i=>{function a(v){return v.$$.ptrType.registeredClass.name}z(a(i)+" instance already deleted")},pt=!1,Rr=i=>{},Ae=i=>{i.smartPtr?i.smartPtrType.rawDestructor(i.smartPtr):i.ptrType.registeredClass.rawDestructor(i.ptr)},ar=i=>{i.count.value-=1;var a=i.count.value===0;a&&Ae(i)},te=(i,a,v)=>{if(a===v)return i;if(v.baseClass===void 0)return null;var _=te(i,a,v.baseClass);return _===null?null:v.downcast(_)},ht={},er={},Fe=(i,a)=>{for(a===void 0&&z("ptr should not be undefined");i.baseClass;)a=i.upcast(a),i=i.baseClass;return a},un=(i,a)=>(a=Fe(i,a),er[a]),cr=(i,a)=>{(!a.ptrType||!a.ptr)&&hr("makeClassHandle requires ptr and ptrType");var v=!!a.smartPtrType,_=!!a.smartPtr;return v!==_&&hr("Both smartPtrType and smartPtr must be specified"),a.count={value:1},je(Object.create(i,{$$:{value:a,writable:!0}}))};function yt(i){var a=this.getPointee(i);if(!a)return this.destructor(i),null;var v=un(this.registeredClass,a);if(v!==void 0){if(v.$$.count.value===0)return v.$$.ptr=a,v.$$.smartPtr=i,v.clone();var _=v.clone();return this.destructor(i),_}function T(){return this.isSmartPointer?cr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:a,smartPtrType:this,smartPtr:i}):cr(this.registeredClass.instancePrototype,{ptrType:this,ptr:i})}var t=this.registeredClass.getActualType(a),n=ht[t];if(!n)return T.call(this);var u;this.isConst?u=n.constPointerType:u=n.pointerType;var p=te(a,this.registeredClass,u.registeredClass);return p===null?T.call(this):this.isSmartPointer?cr(u.registeredClass.instancePrototype,{ptrType:u,ptr:p,smartPtrType:this,smartPtr:i}):cr(u.registeredClass.instancePrototype,{ptrType:u,ptr:p})}var je=i=>typeof FinalizationRegistry>"u"?(je=a=>a,i):(pt=new FinalizationRegistry(a=>{ar(a.$$)}),je=a=>{var v=a.$$,_=!!v.smartPtr;if(_){var T={$$:v};pt.register(a,T,a)}return a},Rr=a=>pt.unregister(a),je(i)),Ur=()=>{Object.assign(ir.prototype,{isAliasOf(i){if(!(this instanceof ir)||!(i instanceof ir))return!1;var a=this.$$.ptrType.registeredClass,v=this.$$.ptr;i.$$=i.$$;for(var _=i.$$.ptrType.registeredClass,T=i.$$.ptr;a.baseClass;)v=a.upcast(v),a=a.baseClass;for(;_.baseClass;)T=_.upcast(T),_=_.baseClass;return a===_&&v===T},clone(){if(this.$$.ptr||Zr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var i=je(Object.create(Object.getPrototypeOf(this),{$$:{value:qe(this.$$)}}));return i.$$.count.value+=1,i.$$.deleteScheduled=!1,i},delete(){this.$$.ptr||Zr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&z("Object already scheduled for deletion"),Rr(this),ar(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Zr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&z("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}})};function ir(){}var Er=(i,a)=>Object.defineProperty(a,"name",{value:i}),Sr=(i,a,v)=>{if(i[a].overloadTable===void 0){var _=i[a];i[a]=function(...T){return i[a].overloadTable.hasOwnProperty(T.length)||z(`Function '${v}' called with an invalid number of arguments (${T.length}) - expects one of (${i[a].overloadTable})!`),i[a].overloadTable[T.length].apply(this,T)},i[a].overloadTable=[],i[a].overloadTable[_.argCount]=_}},Mr=(i,a,v)=>{c.hasOwnProperty(i)?(z(`Cannot register public name '${i}' twice`),Sr(c,i,i),c[i].overloadTable.hasOwnProperty(v)&&z(`Cannot register multiple overloads of a function with the same number of arguments (${v})!`),c[i].overloadTable[v]=a):(c[i]=a,c[i].argCount=v)},It=48,ln=57,gt=i=>{i=i.replace(/[^a-zA-Z0-9_]/g,"$");var a=i.charCodeAt(0);return a>=It&&a<=ln?`_${i}`:i};function Qr(i,a,v,_,T,t,n,u){this.name=i,this.constructor=a,this.instancePrototype=v,this.rawDestructor=_,this.baseClass=T,this.getActualType=t,this.upcast=n,this.downcast=u,this.pureVirtualFunctions=[]}var _t=(i,a,v)=>{for(;a!==v;)a.upcast||z(`Expected null or instance of ${v.name}, got an instance of ${a.name}`),i=a.upcast(i),a=a.baseClass;return i};function Hr(i,a){if(a===null)return this.isReference&&z(`null is not a valid ${this.name}`),0;a.$$||z(`Cannot pass "${Pt(a)}" as a ${this.name}`),a.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`);var v=a.$$.ptrType.registeredClass,_=_t(a.$$.ptr,v,this.registeredClass);return _}function mt(i,a){var v;if(a===null)return this.isReference&&z(`null is not a valid ${this.name}`),this.isSmartPointer?(v=this.rawConstructor(),i!==null&&i.push(this.rawDestructor,v),v):0;(!a||!a.$$)&&z(`Cannot pass "${Pt(a)}" as a ${this.name}`),a.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&a.$$.ptrType.isConst&&z(`Cannot convert argument of type ${a.$$.smartPtrType?a.$$.smartPtrType.name:a.$$.ptrType.name} to parameter type ${this.name}`);var _=a.$$.ptrType.registeredClass;if(v=_t(a.$$.ptr,_,this.registeredClass),this.isSmartPointer)switch(a.$$.smartPtr===void 0&&z("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:a.$$.smartPtrType===this?v=a.$$.smartPtr:z(`Cannot convert argument of type ${a.$$.smartPtrType?a.$$.smartPtrType.name:a.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:v=a.$$.smartPtr;break;case 2:if(a.$$.smartPtrType===this)v=a.$$.smartPtr;else{var T=a.clone();v=this.rawShare(v,or.toHandle(()=>T.delete())),i!==null&&i.push(this.rawDestructor,v)}break;default:z("Unsupporting sharing policy")}return v}function _r(i,a){if(a===null)return this.isReference&&z(`null is not a valid ${this.name}`),0;a.$$||z(`Cannot pass "${Pt(a)}" as a ${this.name}`),a.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`),a.$$.ptrType.isConst&&z(`Cannot convert argument of type ${a.$$.ptrType.name} to parameter type ${this.name}`);var v=a.$$.ptrType.registeredClass,_=_t(a.$$.ptr,v,this.registeredClass);return _}var et=()=>{Object.assign(Br.prototype,{getPointee(i){return this.rawGetPointee&&(i=this.rawGetPointee(i)),i},destructor(i){this.rawDestructor?.(i)},argPackAdvance:Be,readValueFromPointer:De,fromWireType:yt})};function Br(i,a,v,_,T,t,n,u,p,g,w){this.name=i,this.registeredClass=a,this.isReference=v,this.isConst=_,this.isSmartPointer=T,this.pointeeType=t,this.sharingPolicy=n,this.rawGetPointee=u,this.rawConstructor=p,this.rawShare=g,this.rawDestructor=w,!T&&a.baseClass===void 0?_?(this.toWireType=Hr,this.destructorFunction=null):(this.toWireType=_r,this.destructorFunction=null):this.toWireType=mt}var Vr=(i,a,v)=>{c.hasOwnProperty(i)||hr("Replacing nonexistent public symbol"),c[i].overloadTable!==void 0&&v!==void 0||(c[i]=a,c[i].argCount=v)},Lr=(i,a,v)=>{i=i.replace(/p/g,"i");var _=c["dynCall_"+i];return _(a,...v)},Nr=[],Ut,zr=i=>{var a=Nr[i];return a||(i>=Nr.length&&(Nr.length=i+1),Nr[i]=a=Ut.get(i)),a},xe=(i,a,v=[])=>{if(i.includes("j"))return Lr(i,a,v);var _=zr(a)(...v);return _},mr=(i,a)=>(...v)=>xe(i,a,v),Ke=(i,a)=>{i=X(i);function v(){return i.includes("j")?mr(i,a):zr(a)}var _=v();return typeof _!="function"&&z(`unknown function pointer with signature ${i}: ${a}`),_},Mt=(i,a)=>{var v=Er(a,function(_){this.name=a,this.message=_;var T=new Error(_).stack;T!==void 0&&(this.stack=this.toString()+`
4
+ `+T.replace(/^Error(:[^\n]*)?\n/,""))});return v.prototype=Object.create(i.prototype),v.prototype.constructor=v,v.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},v},ke,Gr=i=>{var a=x(i),v=X(a);return E(a),v},br=(i,a)=>{var v=[],_={};function T(t){if(!_[t]&&!Me[t]){if(Ee[t]){Ee[t].forEach(T);return}v.push(t),_[t]=!0}}throw a.forEach(T),new ke(`${i}: `+v.map(Gr).join([", "]))},Ht=(i,a,v,_,T,t,n,u,p,g,w,e,r)=>{w=X(w),t=Ke(T,t),u&&=Ke(n,u),g&&=Ke(p,g),r=Ke(e,r);var l=gt(w);Mr(l,function(){br(`Cannot construct ${w} due to unbound types`,[_])}),yr([i,a,v],_?[_]:[],d=>{d=d[0];var y,P;_?(y=d.registeredClass,P=y.instancePrototype):P=ir.prototype;var W=Er(w,function(...fe){if(Object.getPrototypeOf(this)!==A)throw new He("Use 'new' to construct "+w);if(D.constructor_body===void 0)throw new He(w+" has no accessible constructor");var ie=D.constructor_body[fe.length];if(ie===void 0)throw new He(`Tried to invoke ctor of ${w} with invalid number of parameters (${fe.length}) - expected (${Object.keys(D.constructor_body).toString()}) parameters instead!`);return ie.apply(this,fe)}),A=Object.create(P,{constructor:{value:W}});W.prototype=A;var D=new Qr(w,W,A,r,y,t,u,g);D.baseClass&&(D.baseClass.__derivedClasses??=[],D.baseClass.__derivedClasses.push(D));var M=new Br(w,D,!0,!1,!1),B=new Br(w+"*",D,!1,!1,!1),q=new Br(w+" const*",D,!1,!0,!1);return ht[i]={pointerType:B,constPointerType:q},Vr(l,W),[M,B,q]})},$r=(i,a)=>{for(var v=[],_=0;_<i;_++)v.push(se[a+_*4>>2]);return v};function Bt(i){for(var a=1;a<i.length;++a)if(i[a]!==null&&i[a].destructorFunction===void 0)return!0;return!1}var Ie={ftf:function(i,a,v,_,T,t,n){return function(){var u=v(_),p=t.fromWireType(u);return p}},ttfnn:function(i,a,v,_,T,t,n,u){return function(p){var g=n.toWireType(null,this),w=u.toWireType(null,p),e=v(_,g,w),r=t.fromWireType(e);return r}},ttfn:function(i,a,v,_,T,t,n){return function(){var u=n.toWireType(null,this),p=v(_,u),g=t.fromWireType(p);return g}},tffn:function(i,a,v,_,T,t,n){return function(){var u=n.toWireType(null,this);v(_,u)}},tffnnn:function(i,a,v,_,T,t,n,u,p){return function(g,w){var e=n.toWireType(null,this),r=u.toWireType(null,g),l=p.toWireType(null,w);v(_,e,r,l)}}};function cn(i,a,v,_){const T=[a?"t":"f",v?"t":"f",_?"t":"f"];for(let t=a?1:2;t<i.length;++t){const n=i[t];let u="";n.destructorFunction===void 0?u="u":n.destructorFunction===null?u="n":u="t",T.push(u)}return T.join("")}function bt(i,a,v,_,T,t){var n=a.length;n<2&&z("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=a[1]!==null&&v!==null,p=Bt(a),g=a[0].name!=="void",w=[i,z,_,T,We,a[0],a[1]],e=0;e<n-2;++e)w.push(a[e+2]);if(!p)for(var e=u?1:2;e<a.length;++e)a[e].destructorFunction!==null&&w.push(a[e].destructorFunction);var r=cn(a,u,g,t),l=Ie[r](...w);return Er(i,l)}var Xe=(i,a,v,_,T,t)=>{var n=$r(a,v);T=Ke(_,T),yr([],[i],u=>{u=u[0];var p=`constructor ${u.name}`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[a-1]!==void 0)throw new He(`Cannot register multiple constructors with identical number of parameters (${a-1}) for class '${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return u.registeredClass.constructor_body[a-1]=()=>{br(`Cannot construct ${u.name} due to unbound types`,n)},yr([],n,g=>(g.splice(1,0,null),u.registeredClass.constructor_body[a-1]=bt(p,g,null,T,t),[])),[]})},rt=i=>{i=i.trim();const a=i.indexOf("(");return a!==-1?i.substr(0,a):i},sr=(i,a,v,_,T,t,n,u,p,g)=>{var w=$r(v,_);a=X(a),a=rt(a),t=Ke(T,t),yr([],[i],e=>{e=e[0];var r=`${e.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]),u&&e.registeredClass.pureVirtualFunctions.push(a);function l(){br(`Cannot call ${r} due to unbound types`,w)}var d=e.registeredClass.instancePrototype,y=d[a];return y===void 0||y.overloadTable===void 0&&y.className!==e.name&&y.argCount===v-2?(l.argCount=v-2,l.className=e.name,d[a]=l):(Sr(d,a,r),d[a].overloadTable[v-2]=l),yr([],w,P=>{var W=bt(r,P,e,t,n,p);return d[a].overloadTable===void 0?(W.argCount=v-2,d[a]=W):d[a].overloadTable[v-2]=W,[]}),[]})},Wr=[],Ye=[],Jr=i=>{i>9&&--Ye[i+1]===0&&(Ye[i]=void 0,Wr.push(i))},$e=()=>Ye.length/2-5-Wr.length,$t=()=>{Ye.push(0,1,void 0,1,null,1,!0,1,!1,1),c.count_emval_handles=$e},or={toValue:i=>(i||z("Cannot use deleted val. handle = "+i),Ye[i]),toHandle:i=>{switch(i){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const a=Wr.pop()||Ye.length;return Ye[a]=i,Ye[a+1]=1,a}}}},wt={name:"emscripten::val",fromWireType:i=>{var a=or.toValue(i);return Jr(i),a},toWireType:(i,a)=>or.toHandle(a),argPackAdvance:Be,readValueFromPointer:De,destructorFunction:null},Ze=i=>Q(i,wt),Pt=i=>{if(i===null)return"null";var a=typeof i;return a==="object"||a==="array"||a==="function"?i.toString():""+i},Vt=(i,a)=>{switch(a){case 4:return function(v){return this.fromWireType(ce[v>>2])};case 8:return function(v){return this.fromWireType(xr[v>>3])};default:throw new TypeError(`invalid float width (${a}): ${i}`)}},Tt=(i,a,v)=>{a=X(a),Q(i,{name:a,fromWireType:_=>_,toWireType:(_,T)=>T,argPackAdvance:Be,readValueFromPointer:Vt(a,v),destructorFunction:null})},Ct=(i,a,v)=>{switch(a){case 1:return v?_=>oe[_]:_=>ae[_];case 2:return v?_=>pe[_>>1]:_=>ue[_>>1];case 4:return v?_=>le[_>>2]:_=>se[_>>2];default:throw new TypeError(`invalid integer width (${a}): ${i}`)}},fr=(i,a,v,_,T)=>{a=X(a);var t=w=>w;if(_===0){var n=32-8*v;t=w=>w<<n>>>n}var u=a.includes("unsigned"),p=(w,e)=>{},g;u?g=function(w,e){return p(e,this.name),e>>>0}:g=function(w,e){return p(e,this.name),e},Q(i,{name:a,fromWireType:t,toWireType:g,argPackAdvance:Be,readValueFromPointer:Ct(a,v,_!==0),destructorFunction:null})},Lt=(i,a,v)=>{var _=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],T=_[a];function t(n){var u=se[n>>2],p=se[n+4>>2];return new T(oe.buffer,p,u)}v=X(v),Q(i,{name:v,fromWireType:t,argPackAdvance:Be,readValueFromPointer:t},{ignoreDuplicateRegistrations:!0})},Nt=(i,a,v,_)=>{if(!(_>0))return 0;for(var T=v,t=v+_-1,n=0;n<i.length;++n){var u=i.charCodeAt(n);if(u>=55296&&u<=57343){var p=i.charCodeAt(++n);u=65536+((u&1023)<<10)|p&1023}if(u<=127){if(v>=t)break;a[v++]=u}else if(u<=2047){if(v+1>=t)break;a[v++]=192|u>>6,a[v++]=128|u&63}else if(u<=65535){if(v+2>=t)break;a[v++]=224|u>>12,a[v++]=128|u>>6&63,a[v++]=128|u&63}else{if(v+3>=t)break;a[v++]=240|u>>18,a[v++]=128|u>>12&63,a[v++]=128|u>>6&63,a[v++]=128|u&63}}return a[v]=0,v-T},At=(i,a,v)=>Nt(i,ae,a,v),Dr=i=>{for(var a=0,v=0;v<i.length;++v){var _=i.charCodeAt(v);_<=127?a++:_<=2047?a+=2:_>=55296&&_<=57343?(a+=4,++v):a+=3}return a},Rt=typeof TextDecoder<"u"?new TextDecoder:void 0,tt=(i,a=0,v=NaN)=>{for(var _=a+v,T=a;i[T]&&!(T>=_);)++T;if(T-a>16&&i.buffer&&Rt)return Rt.decode(i.subarray(a,T));for(var t="";a<T;){var n=i[a++];if(!(n&128)){t+=String.fromCharCode(n);continue}var u=i[a++]&63;if((n&224)==192){t+=String.fromCharCode((n&31)<<6|u);continue}var p=i[a++]&63;if((n&240)==224?n=(n&15)<<12|u<<6|p:n=(n&7)<<18|u<<12|p<<6|i[a++]&63,n<65536)t+=String.fromCharCode(n);else{var g=n-65536;t+=String.fromCharCode(55296|g>>10,56320|g&1023)}}return t},qr=(i,a)=>i?tt(ae,i,a):"",Et=(i,a)=>{a=X(a),Q(i,{name:a,fromWireType(v){for(var _=se[v>>2],T=v+4,t,n,u=T,n=0;n<=_;++n){var p=T+n;if(n==_||ae[p]==0){var g=p-u,w=qr(u,g);t===void 0?t=w:(t+="\0",t+=w),u=p+1}}return E(v),t},toWireType(v,_){_ instanceof ArrayBuffer&&(_=new Uint8Array(_));var T,t=typeof _=="string";t||_ instanceof Uint8Array||_ instanceof Uint8ClampedArray||_ instanceof Int8Array||z("Cannot pass non-string to std::string"),t?T=Dr(_):T=_.length;var n=O(4+T+1),u=n+4;if(se[n>>2]=T,t)At(_,u,T+1);else if(t)for(var p=0;p<T;++p){var g=_.charCodeAt(p);g>255&&(E(u),z("String has UTF-16 code units that do not fit in 8 bits")),ae[u+p]=g}else for(var p=0;p<T;++p)ae[u+p]=_[p];return v!==null&&v.push(E,n),n},argPackAdvance:Be,readValueFromPointer:De,destructorFunction(v){E(v)}})},St=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,fn=(i,a)=>{for(var v=i,_=v>>1,T=_+a/2;!(_>=T)&&ue[_];)++_;if(v=_<<1,v-i>32&&St)return St.decode(ae.subarray(i,v));for(var t="",n=0;!(n>=a/2);++n){var u=pe[i+n*2>>1];if(u==0)break;t+=String.fromCharCode(u)}return t},zt=(i,a,v)=>{if(v??=2147483647,v<2)return 0;v-=2;for(var _=a,T=v<i.length*2?v/2:i.length,t=0;t<T;++t){var n=i.charCodeAt(t);pe[a>>1]=n,a+=2}return pe[a>>1]=0,a-_},dn=i=>i.length*2,vn=(i,a)=>{for(var v=0,_="";!(v>=a/4);){var T=le[i+v*4>>2];if(T==0)break;if(++v,T>=65536){var t=T-65536;_+=String.fromCharCode(55296|t>>10,56320|t&1023)}else _+=String.fromCharCode(T)}return _},pn=(i,a,v)=>{if(v??=2147483647,v<4)return 0;for(var _=a,T=_+v-4,t=0;t<i.length;++t){var n=i.charCodeAt(t);if(n>=55296&&n<=57343){var u=i.charCodeAt(++t);n=65536+((n&1023)<<10)|u&1023}if(le[a>>2]=n,a+=4,a+4>T)break}return le[a>>2]=0,a-_},Gt=i=>{for(var a=0,v=0;v<i.length;++v){var _=i.charCodeAt(v);_>=55296&&_<=57343&&++v,a+=4}return a},Jt=(i,a,v)=>{v=X(v);var _,T,t,n;a===2?(_=fn,T=zt,n=dn,t=u=>ue[u>>1]):a===4&&(_=vn,T=pn,n=Gt,t=u=>se[u>>2]),Q(i,{name:v,fromWireType:u=>{for(var p=se[u>>2],g,w=u+4,e=0;e<=p;++e){var r=u+4+e*a;if(e==p||t(r)==0){var l=r-w,d=_(w,l);g===void 0?g=d:(g+="\0",g+=d),w=r+a}}return E(u),g},toWireType:(u,p)=>{typeof p!="string"&&z(`Cannot pass non-string to C++ string type ${v}`);var g=n(p),w=O(4+g+a);return se[w>>2]=g/a,T(p,w+4,g+a),u!==null&&u.push(E,w),w},argPackAdvance:Be,readValueFromPointer:De,destructorFunction(u){E(u)}})},hn=(i,a,v,_,T,t)=>{ur[i]={name:X(a),rawConstructor:Ke(v,_),rawDestructor:Ke(T,t),fields:[]}},qt=(i,a,v,_,T,t,n,u,p,g)=>{ur[i].fields.push({fieldName:X(a),getterReturnType:v,getter:Ke(_,T),getterContext:t,setterArgumentType:n,setter:Ke(u,p),setterContext:g})},yn=(i,a)=>{a=X(a),Q(i,{isVoid:!0,name:a,argPackAdvance:0,fromWireType:()=>{},toWireType:(v,_)=>{}})},Wt=(i,a,v)=>ae.copyWithin(i,a,a+v),Dt=[],gn=(i,a,v,_)=>(i=Dt[i],a=or.toValue(a),i(null,a,v,_)),_n={},nt=i=>{var a=_n[i];return a===void 0?X(i):a},Kt=()=>{if(typeof globalThis=="object")return globalThis;function i(a){a.$$$embind_global$$$=a;var v=typeof $$$embind_global$$$=="object"&&a.$$$embind_global$$$==a;return v||delete a.$$$embind_global$$$,v}if(typeof $$$embind_global$$$=="object"||(typeof Ft=="object"&&i(Ft)?$$$embind_global$$$=Ft:typeof self=="object"&&i(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},mn=i=>i===0?or.toHandle(Kt()):(i=nt(i),or.toHandle(Kt()[i])),Xt=i=>{var a=Dt.length;return Dt.push(i),a},xt=(i,a)=>{var v=Me[i];return v===void 0&&z(`${a} has unknown type ${Gr(i)}`),v},bn=(i,a)=>{for(var v=new Array(i),_=0;_<i;++_)v[_]=xt(se[a+_*4>>2],"parameter "+_);return v},$n=Reflect.construct,Yt=(i,a,v)=>{var _=[],T=i.toWireType(_,v);return _.length&&(se[a>>2]=or.toHandle(_)),T},wn=(i,a,v)=>{var _=bn(i,a),T=_.shift();i--;var t=new Array(i),n=(p,g,w,e)=>{for(var r=0,l=0;l<i;++l)t[l]=_[l].readValueFromPointer(e+r),r+=_[l].argPackAdvance;var d=v===1?$n(g,t):g.apply(p,t);return Yt(T,w,d)},u=`methodCaller<(${_.map(p=>p.name).join(", ")}) => ${T.name}>`;return Xt(Er(u,n))},Pn=i=>{var a=or.toValue(i);We(a),Jr(i)},Tn=(i,a)=>{i=xt(i,"_emval_take_value");var v=i.readValueFromPointer(a);return or.toHandle(v)},Zt=()=>2147483648,Cn=()=>Zt(),An=(i,a)=>Math.ceil(i/a)*a,Rn=i=>{var a=me.buffer,v=(i-a.byteLength+65535)/65536|0;try{return me.grow(v),kr(),1}catch{}},En=i=>{var a=ae.length;i>>>=0;var v=Zt();if(i>v)return!1;for(var _=1;_<=4;_*=2){var T=a*(1+.2/_);T=Math.min(T,i+100663296);var t=Math.min(v,An(Math.max(i,T),65536)),n=Rn(t);if(n)return!0}return!1},at={},Sn=()=>G||"./this.program",wr=()=>{if(!wr.strings){var i=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:i,_:Sn()};for(var v in at)at[v]===void 0?delete a[v]:a[v]=at[v];var _=[];for(var v in a)_.push(`${v}=${a[v]}`);wr.strings=_}return wr.strings},Wn=(i,a)=>{for(var v=0;v<i.length;++v)oe[a++]=i.charCodeAt(v);oe[a]=0},Re=(i,a)=>{var v=0;return wr().forEach((_,T)=>{var t=a+v;se[i+T*4>>2]=t,Wn(_,t),v+=_.length+1}),0},Qt=(i,a)=>{var v=wr();se[i>>2]=v.length;var _=0;return v.forEach(T=>_+=T.length+1),se[a>>2]=_,0},kt=i=>52;function rr(i,a,v,_,T){return 70}var ge=[null,[],[]],Ot=(i,a)=>{var v=ge[i];a===0||a===10?((i===1?_e:we)(tt(v)),v.length=0):v.push(a)},it=(i,a,v,_)=>{for(var T=0,t=0;t<v;t++){var n=se[a>>2],u=se[a+4>>2];a+=8;for(var p=0;p<u;p++)Ot(i,ae[n+p]);T+=u}return se[_>>2]=T,0},Ve=i=>{var a=c["_"+i];return a},Qe=(i,a)=>{oe.set(i,a)},s=i=>U(i),o=i=>{var a=Dr(i)+1,v=s(a);return At(i,v,a),v},h=(i,a,v,_,T)=>{var t={string:d=>{var y=0;return d!=null&&d!==0&&(y=o(d)),y},array:d=>{var y=s(d.length);return Qe(d,y),y}};function n(d){return a==="string"?qr(d):a==="boolean"?!!d:d}var u=Ve(i),p=[],g=0;if(_)for(var w=0;w<_.length;w++){var e=t[v[w]];e?(g===0&&(g=jr()),p[w]=e(_[w])):p[w]=_[w]}var r=u(...p);function l(d){return g!==0&&nr(g),n(d)}return r=l(r),r};Se=c.InternalError=class extends Error{constructor(a){super(a),this.name="InternalError"}},be(),He=c.BindingError=class extends Error{constructor(a){super(a),this.name="BindingError"}},Ur(),et(),ke=c.UnboundTypeError=Mt(Error,"UnboundTypeError"),$t();var b={A:Xr,p:Ir,e:Yr,o:gr,y:Ce,m:Ht,l:Xe,b:sr,w:Ze,i:Tt,d:fr,a:Lt,x:Et,g:Jt,f:hn,c:qt,z:yn,v:Wt,C:gn,D:Jr,E:mn,j:wn,B:Pn,k:Tn,r:Cn,q:En,s:Re,t:Qt,u:kt,n:rr,h:it},C;vt();var x=i=>(x=C.H)(i),O=i=>(O=C.J)(i),E=i=>(E=C.K)(i),j=i=>(j=C.L)(i),U=i=>(U=C.M)(i),H=()=>(H=C.N)();c.dynCall_iji=(i,a,v,_)=>(c.dynCall_iji=C.O)(i,a,v,_),c.dynCall_jji=(i,a,v,_)=>(c.dynCall_jji=C.P)(i,a,v,_),c.dynCall_iiji=(i,a,v,_,T)=>(c.dynCall_iiji=C.Q)(i,a,v,_,T),c.dynCall_jiji=(i,a,v,_,T)=>(c.dynCall_jiji=C.R)(i,a,v,_,T),c.ccall=h;var K;ze=function i(){K||ne(),K||(ze=i)};function ne(){if(Ne>0||(jt(),Ne>0))return;function i(){K||(K=!0,c.calledRun=!0,!ve&&(rn(),F(c),c.onRuntimeInitialized?.(),tn()))}c.setStatus?(c.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>c.setStatus(""),1),i()},1)):i()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();return ne(),k=V,k})})();f.exports=m,f.exports.default=m})(ea)),ea.exports}var mi=_i(),bi=Gn(mi);const $i=new URL(""+new URL("openjpegwasm_decode-B3gWTHpv.wasm",import.meta.url).href,import.meta.url),Fn={codec:void 0,decoder:void 0,decodeConfig:{}};function wi(f){if(Fn.decodeConfig=f,Mn(f),Fn.codec)return Promise.resolve();const $=bi({locateFile:m=>m.endsWith(".wasm")?Kn("openjpegwasm_decode.wasm",$i):m});return new Promise((m,R)=>{$.then(S=>{Fn.codec=S,Fn.decoder=new S.J2KDecoder,m()},R)})}async function ya(f,$){await wi();const m=Fn.decoder,R=m.getEncodedBuffer(f.length);R.set(f),m.decode();const S=m.getFrameInfo(),k=m.getDecodedBuffer();new Uint8Array(k.length).set(k);const F=`x: ${m.getImageOffset().x}, y: ${m.getImageOffset().y}`,I=m.getNumDecompositions(),V=m.getNumLayers(),N=["unknown","LRCP","RLCP","RPCL","PCRL","CPRL"][m.getProgressionOrder()+1],L=m.getIsReversible(),J=`${m.getBlockDimensions().width} x ${m.getBlockDimensions().height}`,Z=`${m.getTileSize().width} x ${m.getTileSize().height}`,G=`${m.getTileOffset().x}, ${m.getTileOffset().y}`,Y=m.getColorSpace(),re=`${k.length.toLocaleString()} bytes`,he=`${(k.length/R.length).toFixed(2)}:1`,ee={columns:S.width,rows:S.height,bitsPerPixel:S.bitsPerSample,signed:S.isSigned,bytesPerPixel:$.bytesPerPixel,componentsPerPixel:S.componentCount},ye=qn(S,k),_e={imageOffset:F,numDecompositions:I,numLayers:V,progessionOrder:N,reversible:L,blockDimensions:J,tileSize:Z,tileOffset:G,colorTransform:Y,decodedSize:re,compressionRatio:he};return{...$,pixelData:ye,imageInfo:ee,encodeOptions:_e,..._e,...ee}}var ra={exports:{}},ga;function Pi(){return ga||(ga=1,(function(f,$){var m=(()=>{var R=typeof document<"u"?document.currentScript?.src:void 0;return typeof __filename<"u"&&(R=R||__filename),(function(S={}){var k,c=S,F,I,V=new Promise((t,n)=>{F=t,I=n}),N=typeof window=="object",L=typeof WorkerGlobalScope<"u",J=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Z=Object.assign({},c),G="";function Y(t){return c.locateFile?c.locateFile(t,G):G+t}var re,he;if(J){var ee=Jn;G=__dirname+"/",he=t=>{t=Fr(t)?new URL(t):t;var n=ee.readFileSync(t);return n},re=async(t,n=!0)=>{t=Fr(t)?new URL(t):t;var u=ee.readFileSync(t,n?void 0:"utf8");return u},!c.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(N||L)&&(L?G=self.location.href:typeof document<"u"&&document.currentScript&&(G=document.currentScript.src),R&&(G=R),G.startsWith("blob:")?G="":G=G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1),L&&(he=t=>{var n=new XMLHttpRequest;return n.open("GET",t,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),re=async t=>{if(Fr(t))return new Promise((u,p)=>{var g=new XMLHttpRequest;g.open("GET",t,!0),g.responseType="arraybuffer",g.onload=()=>{if(g.status==200||g.status==0&&g.response){u(g.response);return}p(g.status)},g.onerror=p,g.send(null)});var n=await fetch(t,{credentials:"same-origin"});if(n.ok)return n.arrayBuffer();throw new Error(n.status+" : "+n.url)});var ye=c.print||console.log.bind(console),_e=c.printErr||console.error.bind(console);Object.assign(c,Z),Z=null,c.arguments&&c.arguments,c.thisProgram&&c.thisProgram;var we=c.wasmBinary,Pe,me=!1,ve,oe,ae,pe,ue,le,se,ce;function xr(){var t=Pe.buffer;c.HEAP8=ve=new Int8Array(t),c.HEAP16=ae=new Int16Array(t),c.HEAPU8=oe=new Uint8Array(t),c.HEAPU16=pe=new Uint16Array(t),c.HEAP32=ue=new Int32Array(t),c.HEAPU32=le=new Uint32Array(t),c.HEAPF32=se=new Float32Array(t),c.HEAPF64=ce=new Float64Array(t)}var kr=[],Or=[],Kr=[];function ot(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)tn(c.preRun.shift());vt(kr)}function jt(){vt(Or)}function rn(){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)dr(c.postRun.shift());vt(Kr)}function tn(t){kr.unshift(t)}function nn(t){Or.unshift(t)}function dr(t){Kr.unshift(t)}var Le=0,Ne=null;function ze(t){Le++,c.monitorRunDependencies?.(Le)}function Tr(t){if(Le--,c.monitorRunDependencies?.(Le),Le==0&&Ne){var n=Ne;Ne=null,n()}}function ut(t){c.onAbort?.(t),t="Aborted("+t+")",_e(t),me=!0,t+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(t);throw I(n),n}var lt="data:application/octet-stream;base64,",Cr=t=>t.startsWith(lt),Fr=t=>t.startsWith("file://");function vr(){var t="openjphjs.wasm";return Cr(t)?t:Y(t)}var Ar;function ct(t){if(t==Ar&&we)return new Uint8Array(we);if(he)return he(t);throw"both async and sync fetching of the wasm failed"}async function ft(t){if(!we)try{var n=await re(t);return new Uint8Array(n)}catch{}return ct(t)}async function an(t,n){try{var u=await ft(t),p=await WebAssembly.instantiate(u,n);return p}catch(g){_e(`failed to asynchronously prepare wasm: ${g}`),ut(g)}}async function sn(t,n,u){if(!t&&typeof WebAssembly.instantiateStreaming=="function"&&!Cr(n)&&!Fr(n)&&!J&&typeof fetch=="function")try{var p=fetch(n,{credentials:"same-origin"}),g=await WebAssembly.instantiateStreaming(p,u);return g}catch(w){_e(`wasm streaming compile failed: ${w}`),_e("falling back to ArrayBuffer instantiation")}return an(n,u)}function on(){return{env:rr,wasi_snapshot_preview1:rr}}async function dt(){function t(g,w){return ge=g.exports,Pe=ge.memory,xr(),Bt=ge.__indirect_function_table,nn(ge.__wasm_call_ctors),Tr(),ge}ze();function n(g){t(g.instance)}var u=on();if(c.instantiateWasm)try{return c.instantiateWasm(u,t)}catch(g){_e(`Module.instantiateWasm callback failed with error: ${g}`),I(g)}Ar??=vr();try{var p=await sn(we,Ar,u);return n(p),p}catch(g){I(g);return}}var vt=t=>{for(;t.length>0;)t.shift()(c)};c.noExitRuntime;var Ge=t=>o(t),nr=()=>b(),jr=typeof TextDecoder<"u"?new TextDecoder:void 0,pr=(t,n=0,u=NaN)=>{for(var p=n+u,g=n;t[g]&&!(g>=p);)++g;if(g-n>16&&t.buffer&&jr)return jr.decode(t.subarray(n,g));for(var w="";n<g;){var e=t[n++];if(!(e&128)){w+=String.fromCharCode(e);continue}var r=t[n++]&63;if((e&224)==192){w+=String.fromCharCode((e&31)<<6|r);continue}var l=t[n++]&63;if((e&240)==224?e=(e&15)<<12|r<<6|l:e=(e&7)<<18|r<<12|l<<6|t[n++]&63,e<65536)w+=String.fromCharCode(e);else{var d=e-65536;w+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return w},Je=(t,n)=>t?pr(oe,t,n):"",Xr=(t,n,u,p)=>ut(`Assertion failed: ${Je(t)}, at: `+[n?Je(n):"unknown filename",u,p?Je(p):"unknown function"]),Ir=[],ur=t=>{var n=new Oe(t);return n.get_caught()||n.set_caught(!0),n.set_rethrown(!1),Ir.push(n),C(t),E(t)},We=0,De=()=>{Qe(0,0);var t=Ir.pop();x(t.excPtr),We=0};class Oe{constructor(n){this.excPtr=n,this.ptr=n-24}set_type(n){le[this.ptr+4>>2]=n}get_type(){return le[this.ptr+4>>2]}set_destructor(n){le[this.ptr+8>>2]=n}get_destructor(){return le[this.ptr+8>>2]}set_caught(n){n=n?1:0,ve[this.ptr+12]=n}get_caught(){return ve[this.ptr+12]!=0}set_rethrown(n){n=n?1:0,ve[this.ptr+13]=n}get_rethrown(){return ve[this.ptr+13]!=0}init(n,u){this.set_adjusted_ptr(0),this.set_type(n),this.set_destructor(u)}set_adjusted_ptr(n){le[this.ptr+16>>2]=n}get_adjusted_ptr(){return le[this.ptr+16>>2]}}var Me=t=>{throw We||(We=t),We},Ee=t=>s(t),Se=t=>{var n=We;if(!n)return Ee(0),0;var u=new Oe(n);u.set_adjusted_ptr(n);var p=u.get_type();if(!p)return Ee(0),n;for(var g of t){if(g===0||g===p)break;var w=u.ptr+16;if(O(g,p,w))return Ee(g),n}return Ee(p),n},hr=()=>Se([]),yr=t=>Se([t]),Yr=(t,n,u)=>{var p=new Oe(t);throw p.init(n,u),We=t,We},gr=()=>ut(""),be={},lr=t=>{for(;t.length;){var n=t.pop(),u=t.pop();u(n)}};function X(t){return this.fromWireType(le[t>>2])}var He={},z={},Te={},Q,Be=t=>{throw new Q(t)},Ce=(t,n,u)=>{t.forEach(r=>Te[r]=n);function p(r){var l=u(r);l.length!==t.length&&Be("Mismatched type converter count");for(var d=0;d<t.length;++d)er(t[d],l[d])}var g=new Array(n.length),w=[],e=0;n.forEach((r,l)=>{z.hasOwnProperty(r)?g[l]=z[r]:(w.push(r),He.hasOwnProperty(r)||(He[r]=[]),He[r].push(()=>{g[l]=z[r],++e,e===w.length&&p(g)}))}),w.length===0&&p(g)},qe=t=>{var n=be[t];delete be[t];var u=n.rawConstructor,p=n.rawDestructor,g=n.fields,w=g.map(e=>e.getterReturnType).concat(g.map(e=>e.setterArgumentType));Ce([t],w,e=>{var r={};return g.forEach((l,d)=>{var y=l.fieldName,P=e[d],W=l.getter,A=l.getterContext,D=e[d+g.length],M=l.setter,B=l.setterContext;r[y]={read:q=>P.fromWireType(W(A,q)),write:(q,fe)=>{var ie=[];M(B,q,D.toWireType(ie,fe)),lr(ie)}}}),[{name:n.name,fromWireType:l=>{var d={};for(var y in r)d[y]=r[y].read(l);return p(l),d},toWireType:(l,d)=>{for(var y in r)if(!(y in d))throw new TypeError(`Missing field: "${y}"`);var P=u();for(y in r)r[y].write(P,d[y]);return l!==null&&l.push(p,P),P},argPackAdvance:Fe,readValueFromPointer:X,destructorFunction:p}]})},Zr=(t,n,u,p,g)=>{},pt=()=>{for(var t=new Array(256),n=0;n<256;++n)t[n]=String.fromCharCode(n);Rr=t},Rr,Ae=t=>{for(var n="",u=t;oe[u];)n+=Rr[oe[u++]];return n},ar,te=t=>{throw new ar(t)};function ht(t,n,u={}){var p=n.name;if(t||te(`type "${p}" must have a positive integer typeid pointer`),z.hasOwnProperty(t)){if(u.ignoreDuplicateRegistrations)return;te(`Cannot register type '${p}' twice`)}if(z[t]=n,delete Te[t],He.hasOwnProperty(t)){var g=He[t];delete He[t],g.forEach(w=>w())}}function er(t,n,u={}){return ht(t,n,u)}var Fe=8,un=(t,n,u,p)=>{n=Ae(n),er(t,{name:n,fromWireType:function(g){return!!g},toWireType:function(g,w){return w?u:p},argPackAdvance:Fe,readValueFromPointer:function(g){return this.fromWireType(oe[g])},destructorFunction:null})},cr=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),yt=t=>{function n(u){return u.$$.ptrType.registeredClass.name}te(n(t)+" instance already deleted")},je=!1,Ur=t=>{},ir=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Er=t=>{t.count.value-=1;var n=t.count.value===0;n&&ir(t)},Sr=(t,n,u)=>{if(n===u)return t;if(u.baseClass===void 0)return null;var p=Sr(t,n,u.baseClass);return p===null?null:u.downcast(p)},Mr={},It={},ln=(t,n)=>{for(n===void 0&&te("ptr should not be undefined");t.baseClass;)n=t.upcast(n),t=t.baseClass;return n},gt=(t,n)=>(n=ln(t,n),It[n]),Qr=(t,n)=>{(!n.ptrType||!n.ptr)&&Be("makeClassHandle requires ptr and ptrType");var u=!!n.smartPtrType,p=!!n.smartPtr;return u!==p&&Be("Both smartPtrType and smartPtr must be specified"),n.count={value:1},Hr(Object.create(t,{$$:{value:n,writable:!0}}))};function _t(t){var n=this.getPointee(t);if(!n)return this.destructor(t),null;var u=gt(this.registeredClass,n);if(u!==void 0){if(u.$$.count.value===0)return u.$$.ptr=n,u.$$.smartPtr=t,u.clone();var p=u.clone();return this.destructor(t),p}function g(){return this.isSmartPointer?Qr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:n,smartPtrType:this,smartPtr:t}):Qr(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var w=this.registeredClass.getActualType(n),e=Mr[w];if(!e)return g.call(this);var r;this.isConst?r=e.constPointerType:r=e.pointerType;var l=Sr(n,this.registeredClass,r.registeredClass);return l===null?g.call(this):this.isSmartPointer?Qr(r.registeredClass.instancePrototype,{ptrType:r,ptr:l,smartPtrType:this,smartPtr:t}):Qr(r.registeredClass.instancePrototype,{ptrType:r,ptr:l})}var Hr=t=>typeof FinalizationRegistry>"u"?(Hr=n=>n,t):(je=new FinalizationRegistry(n=>{Er(n.$$)}),Hr=n=>{var u=n.$$,p=!!u.smartPtr;if(p){var g={$$:u};je.register(n,g,n)}return n},Ur=n=>je.unregister(n),Hr(t)),mt=()=>{Object.assign(_r.prototype,{isAliasOf(t){if(!(this instanceof _r)||!(t instanceof _r))return!1;var n=this.$$.ptrType.registeredClass,u=this.$$.ptr;t.$$=t.$$;for(var p=t.$$.ptrType.registeredClass,g=t.$$.ptr;n.baseClass;)u=n.upcast(u),n=n.baseClass;for(;p.baseClass;)g=p.upcast(g),p=p.baseClass;return n===p&&u===g},clone(){if(this.$$.ptr||yt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=Hr(Object.create(Object.getPrototypeOf(this),{$$:{value:cr(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||yt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&te("Object already scheduled for deletion"),Ur(this),Er(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||yt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&te("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}})};function _r(){}var et=(t,n)=>Object.defineProperty(n,"name",{value:t}),Br=(t,n,u)=>{if(t[n].overloadTable===void 0){var p=t[n];t[n]=function(...g){return t[n].overloadTable.hasOwnProperty(g.length)||te(`Function '${u}' called with an invalid number of arguments (${g.length}) - expects one of (${t[n].overloadTable})!`),t[n].overloadTable[g.length].apply(this,g)},t[n].overloadTable=[],t[n].overloadTable[p.argCount]=p}},Vr=(t,n,u)=>{c.hasOwnProperty(t)?((u===void 0||c[t].overloadTable!==void 0&&c[t].overloadTable[u]!==void 0)&&te(`Cannot register public name '${t}' twice`),Br(c,t,t),c[t].overloadTable.hasOwnProperty(u)&&te(`Cannot register multiple overloads of a function with the same number of arguments (${u})!`),c[t].overloadTable[u]=n):(c[t]=n,c[t].argCount=u)},Lr=48,Nr=57,Ut=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var n=t.charCodeAt(0);return n>=Lr&&n<=Nr?`_${t}`:t};function zr(t,n,u,p,g,w,e,r){this.name=t,this.constructor=n,this.instancePrototype=u,this.rawDestructor=p,this.baseClass=g,this.getActualType=w,this.upcast=e,this.downcast=r,this.pureVirtualFunctions=[]}var xe=(t,n,u)=>{for(;n!==u;)n.upcast||te(`Expected null or instance of ${u.name}, got an instance of ${n.name}`),t=n.upcast(t),n=n.baseClass;return t};function mr(t,n){if(n===null)return this.isReference&&te(`null is not a valid ${this.name}`),0;n.$$||te(`Cannot pass "${qr(n)}" as a ${this.name}`),n.$$.ptr||te(`Cannot pass deleted object as a pointer of type ${this.name}`);var u=n.$$.ptrType.registeredClass,p=xe(n.$$.ptr,u,this.registeredClass);return p}function Ke(t,n){var u;if(n===null)return this.isReference&&te(`null is not a valid ${this.name}`),this.isSmartPointer?(u=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,u),u):0;(!n||!n.$$)&&te(`Cannot pass "${qr(n)}" as a ${this.name}`),n.$$.ptr||te(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&n.$$.ptrType.isConst&&te(`Cannot convert argument of type ${n.$$.smartPtrType?n.$$.smartPtrType.name:n.$$.ptrType.name} to parameter type ${this.name}`);var p=n.$$.ptrType.registeredClass;if(u=xe(n.$$.ptr,p,this.registeredClass),this.isSmartPointer)switch(n.$$.smartPtr===void 0&&te("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:n.$$.smartPtrType===this?u=n.$$.smartPtr:te(`Cannot convert argument of type ${n.$$.smartPtrType?n.$$.smartPtrType.name:n.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:u=n.$$.smartPtr;break;case 2:if(n.$$.smartPtrType===this)u=n.$$.smartPtr;else{var g=n.clone();u=this.rawShare(u,Dr.toHandle(()=>g.delete())),t!==null&&t.push(this.rawDestructor,u)}break;default:te("Unsupporting sharing policy")}return u}function Mt(t,n){if(n===null)return this.isReference&&te(`null is not a valid ${this.name}`),0;n.$$||te(`Cannot pass "${qr(n)}" as a ${this.name}`),n.$$.ptr||te(`Cannot pass deleted object as a pointer of type ${this.name}`),n.$$.ptrType.isConst&&te(`Cannot convert argument of type ${n.$$.ptrType.name} to parameter type ${this.name}`);var u=n.$$.ptrType.registeredClass,p=xe(n.$$.ptr,u,this.registeredClass);return p}var ke=()=>{Object.assign(Gr.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},argPackAdvance:Fe,readValueFromPointer:X,fromWireType:_t})};function Gr(t,n,u,p,g,w,e,r,l,d,y){this.name=t,this.registeredClass=n,this.isReference=u,this.isConst=p,this.isSmartPointer=g,this.pointeeType=w,this.sharingPolicy=e,this.rawGetPointee=r,this.rawConstructor=l,this.rawShare=d,this.rawDestructor=y,!g&&n.baseClass===void 0?p?(this.toWireType=mr,this.destructorFunction=null):(this.toWireType=Mt,this.destructorFunction=null):this.toWireType=Ke}var br=(t,n,u)=>{c.hasOwnProperty(t)||Be("Replacing nonexistent public symbol"),c[t].overloadTable!==void 0&&u!==void 0?c[t].overloadTable[u]=n:(c[t]=n,c[t].argCount=u)},Ht=(t,n,u)=>{t=t.replace(/p/g,"i");var p=c["dynCall_"+t];return p(n,...u)},$r=[],Bt,Ie=t=>{var n=$r[t];return n||(t>=$r.length&&($r.length=t+1),$r[t]=n=Bt.get(t)),n},cn=(t,n,u=[])=>{if(t.includes("j"))return Ht(t,n,u);var p=Ie(n)(...u);return p},bt=(t,n)=>(...u)=>cn(t,n,u),Xe=(t,n)=>{t=Ae(t);function u(){return t.includes("j")?bt(t,n):Ie(n)}var p=u();return typeof p!="function"&&te(`unknown function pointer with signature ${t}: ${n}`),p},rt=(t,n)=>{var u=et(n,function(p){this.name=n,this.message=p;var g=new Error(p).stack;g!==void 0&&(this.stack=this.toString()+`
5
+ `+g.replace(/^Error(:[^\n]*)?\n/,""))});return u.prototype=Object.create(t.prototype),u.prototype.constructor=u,u.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},u},sr,Wr=t=>{var n=Ot(t),u=Ae(n);return Ve(n),u},Ye=(t,n)=>{var u=[],p={};function g(w){if(!p[w]&&!z[w]){if(Te[w]){Te[w].forEach(g);return}u.push(w),p[w]=!0}}throw n.forEach(g),new sr(`${t}: `+u.map(Wr).join([", "]))},Jr=(t,n,u,p,g,w,e,r,l,d,y,P,W)=>{y=Ae(y),w=Xe(g,w),r&&=Xe(e,r),d&&=Xe(l,d),W=Xe(P,W);var A=Ut(y);Vr(A,function(){Ye(`Cannot construct ${y} due to unbound types`,[p])}),Ce([t,n,u],p?[p]:[],D=>{D=D[0];var M,B;p?(M=D.registeredClass,B=M.instancePrototype):B=_r.prototype;var q=et(y,function(...tr){if(Object.getPrototypeOf(this)!==fe)throw new ar("Use 'new' to construct "+y);if(ie.constructor_body===void 0)throw new ar(y+" has no accessible constructor");var en=ie.constructor_body[tr.length];if(en===void 0)throw new ar(`Tried to invoke ctor of ${y} with invalid number of parameters (${tr.length}) - expected (${Object.keys(ie.constructor_body).toString()}) parameters instead!`);return en.apply(this,tr)}),fe=Object.create(B,{constructor:{value:q}});q.prototype=fe;var ie=new zr(y,q,fe,W,M,w,r,d);ie.baseClass&&(ie.baseClass.__derivedClasses??=[],ie.baseClass.__derivedClasses.push(ie));var de=new Gr(y,ie,!0,!1,!1),Ue=new Gr(y+"*",ie,!1,!1,!1),st=new Gr(y+" const*",ie,!1,!0,!1);return Mr[t]={pointerType:Ue,constPointerType:st},br(A,q),[de,Ue,st]})},$e=(t,n)=>{for(var u=[],p=0;p<t;p++)u.push(le[n+p*4>>2]);return u};function $t(t){for(var n=1;n<t.length;++n)if(t[n]!==null&&t[n].destructorFunction===void 0)return!0;return!1}var or={ftf:function(t,n,u,p,g,w,e){return function(){var r=u(p),l=w.fromWireType(r);return l}},ttfnn:function(t,n,u,p,g,w,e,r){return function(l){var d=e.toWireType(null,this),y=r.toWireType(null,l),P=u(p,d,y),W=w.fromWireType(P);return W}},ttfn:function(t,n,u,p,g,w,e){return function(){var r=e.toWireType(null,this),l=u(p,r),d=w.fromWireType(l);return d}},tffn:function(t,n,u,p,g,w,e){return function(){var r=e.toWireType(null,this);u(p,r)}},tffnn:function(t,n,u,p,g,w,e,r){return function(l){var d=e.toWireType(null,this),y=r.toWireType(null,l);u(p,d,y)}},ttfnt:function(t,n,u,p,g,w,e,r,l){return function(d){var y=e.toWireType(null,this),P=r.toWireType(null,d),W=u(p,y,P);l(P);var A=w.fromWireType(W);return A}},tffnnn:function(t,n,u,p,g,w,e,r,l){return function(d,y){var P=e.toWireType(null,this),W=r.toWireType(null,d),A=l.toWireType(null,y);u(p,P,W,A)}},tffnnt:function(t,n,u,p,g,w,e,r,l,d){return function(y,P){var W=e.toWireType(null,this),A=r.toWireType(null,y),D=l.toWireType(null,P);u(p,W,A,D),d(D)}},tffnt:function(t,n,u,p,g,w,e,r,l){return function(d){var y=e.toWireType(null,this),P=r.toWireType(null,d);u(p,y,P),l(P)}}};function wt(t,n,u,p){const g=[n?"t":"f",u?"t":"f",p?"t":"f"];for(let w=n?1:2;w<t.length;++w){const e=t[w];let r="";e.destructorFunction===void 0?r="u":e.destructorFunction===null?r="n":r="t",g.push(r)}return g.join("")}function Ze(t,n,u,p,g,w){var e=n.length;e<2&&te("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=n[1]!==null&&u!==null,l=$t(n),d=n[0].name!=="void",y=[t,te,p,g,lr,n[0],n[1]],P=0;P<e-2;++P)y.push(n[P+2]);if(!l)for(var P=r?1:2;P<n.length;++P)n[P].destructorFunction!==null&&y.push(n[P].destructorFunction);var W=wt(n,r,d,w),A=or[W](...y);return et(t,A)}var Pt=(t,n,u,p,g,w)=>{var e=$e(n,u);g=Xe(p,g),Ce([],[t],r=>{r=r[0];var l=`constructor ${r.name}`;if(r.registeredClass.constructor_body===void 0&&(r.registeredClass.constructor_body=[]),r.registeredClass.constructor_body[n-1]!==void 0)throw new ar(`Cannot register multiple constructors with identical number of parameters (${n-1}) for class '${r.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return r.registeredClass.constructor_body[n-1]=()=>{Ye(`Cannot construct ${r.name} due to unbound types`,e)},Ce([],e,d=>(d.splice(1,0,null),r.registeredClass.constructor_body[n-1]=Ze(l,d,null,g,w),[])),[]})},Vt=t=>{t=t.trim();const n=t.indexOf("(");return n!==-1?t.substr(0,n):t},Tt=(t,n,u,p,g,w,e,r,l,d)=>{var y=$e(u,p);n=Ae(n),n=Vt(n),w=Xe(g,w),Ce([],[t],P=>{P=P[0];var W=`${P.name}.${n}`;n.startsWith("@@")&&(n=Symbol[n.substring(2)]),r&&P.registeredClass.pureVirtualFunctions.push(n);function A(){Ye(`Cannot call ${W} due to unbound types`,y)}var D=P.registeredClass.instancePrototype,M=D[n];return M===void 0||M.overloadTable===void 0&&M.className!==P.name&&M.argCount===u-2?(A.argCount=u-2,A.className=P.name,D[n]=A):(Br(D,n,W),D[n].overloadTable[u-2]=A),Ce([],y,B=>{var q=Ze(W,B,P,w,e,l);return D[n].overloadTable===void 0?(q.argCount=u-2,D[n]=q):D[n].overloadTable[u-2]=q,[]}),[]})},Ct=[],fr=[],Lt=t=>{t>9&&--fr[t+1]===0&&(fr[t]=void 0,Ct.push(t))},Nt=()=>fr.length/2-5-Ct.length,At=()=>{fr.push(0,1,void 0,1,null,1,!0,1,!1,1),c.count_emval_handles=Nt},Dr={toValue:t=>(t||te("Cannot use deleted val. handle = "+t),fr[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const n=Ct.pop()||fr.length;return fr[n]=t,fr[n+1]=1,n}}}},Rt={name:"emscripten::val",fromWireType:t=>{var n=Dr.toValue(t);return Lt(t),n},toWireType:(t,n)=>Dr.toHandle(n),argPackAdvance:Fe,readValueFromPointer:X,destructorFunction:null},tt=t=>er(t,Rt),qr=t=>{if(t===null)return"null";var n=typeof t;return n==="object"||n==="array"||n==="function"?t.toString():""+t},Et=(t,n)=>{switch(n){case 4:return function(u){return this.fromWireType(se[u>>2])};case 8:return function(u){return this.fromWireType(ce[u>>3])};default:throw new TypeError(`invalid float width (${n}): ${t}`)}},St=(t,n,u)=>{n=Ae(n),er(t,{name:n,fromWireType:p=>p,toWireType:(p,g)=>g,argPackAdvance:Fe,readValueFromPointer:Et(n,u),destructorFunction:null})},fn=(t,n,u,p,g,w,e,r)=>{var l=$e(n,u);t=Ae(t),t=Vt(t),g=Xe(p,g),Vr(t,function(){Ye(`Cannot call ${t} due to unbound types`,l)},n-1),Ce([],l,d=>{var y=[d[0],null].concat(d.slice(1));return br(t,Ze(t,y,null,g,w,e),n-1),[]})},zt=(t,n,u)=>{switch(n){case 1:return u?p=>ve[p]:p=>oe[p];case 2:return u?p=>ae[p>>1]:p=>pe[p>>1];case 4:return u?p=>ue[p>>2]:p=>le[p>>2];default:throw new TypeError(`invalid integer width (${n}): ${t}`)}},dn=(t,n,u,p,g)=>{n=Ae(n);var w=y=>y;if(p===0){var e=32-8*u;w=y=>y<<e>>>e}var r=n.includes("unsigned"),l=(y,P)=>{},d;r?d=function(y,P){return l(P,this.name),P>>>0}:d=function(y,P){return l(P,this.name),P},er(t,{name:n,fromWireType:w,toWireType:d,argPackAdvance:Fe,readValueFromPointer:zt(n,u,p!==0),destructorFunction:null})},vn=(t,n,u)=>{var p=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],g=p[n];function w(e){var r=le[e>>2],l=le[e+4>>2];return new g(ve.buffer,l,r)}u=Ae(u),er(t,{name:u,fromWireType:w,argPackAdvance:Fe,readValueFromPointer:w},{ignoreDuplicateRegistrations:!0})},pn=(t,n,u,p)=>{if(!(p>0))return 0;for(var g=u,w=u+p-1,e=0;e<t.length;++e){var r=t.charCodeAt(e);if(r>=55296&&r<=57343){var l=t.charCodeAt(++e);r=65536+((r&1023)<<10)|l&1023}if(r<=127){if(u>=w)break;n[u++]=r}else if(r<=2047){if(u+1>=w)break;n[u++]=192|r>>6,n[u++]=128|r&63}else if(r<=65535){if(u+2>=w)break;n[u++]=224|r>>12,n[u++]=128|r>>6&63,n[u++]=128|r&63}else{if(u+3>=w)break;n[u++]=240|r>>18,n[u++]=128|r>>12&63,n[u++]=128|r>>6&63,n[u++]=128|r&63}}return n[u]=0,u-g},Gt=(t,n,u)=>pn(t,oe,n,u),Jt=t=>{for(var n=0,u=0;u<t.length;++u){var p=t.charCodeAt(u);p<=127?n++:p<=2047?n+=2:p>=55296&&p<=57343?(n+=4,++u):n+=3}return n},hn=(t,n)=>{n=Ae(n),er(t,{name:n,fromWireType(u){for(var p=le[u>>2],g=u+4,w,e,r=g,e=0;e<=p;++e){var l=g+e;if(e==p||oe[l]==0){var d=l-r,y=Je(r,d);w===void 0?w=y:(w+="\0",w+=y),r=l+1}}return Ve(u),w},toWireType(u,p){p instanceof ArrayBuffer&&(p=new Uint8Array(p));var g,w=typeof p=="string";w||p instanceof Uint8Array||p instanceof Uint8ClampedArray||p instanceof Int8Array||te("Cannot pass non-string to std::string"),w?g=Jt(p):g=p.length;var e=it(4+g+1),r=e+4;if(le[e>>2]=g,w)Gt(p,r,g+1);else if(w)for(var l=0;l<g;++l){var d=p.charCodeAt(l);d>255&&(Ve(r),te("String has UTF-16 code units that do not fit in 8 bits")),oe[r+l]=d}else for(var l=0;l<g;++l)oe[r+l]=p[l];return u!==null&&u.push(Ve,e),e},argPackAdvance:Fe,readValueFromPointer:X,destructorFunction(u){Ve(u)}})},qt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,yn=(t,n)=>{for(var u=t,p=u>>1,g=p+n/2;!(p>=g)&&pe[p];)++p;if(u=p<<1,u-t>32&&qt)return qt.decode(oe.subarray(t,u));for(var w="",e=0;!(e>=n/2);++e){var r=ae[t+e*2>>1];if(r==0)break;w+=String.fromCharCode(r)}return w},Wt=(t,n,u)=>{if(u??=2147483647,u<2)return 0;u-=2;for(var p=n,g=u<t.length*2?u/2:t.length,w=0;w<g;++w){var e=t.charCodeAt(w);ae[n>>1]=e,n+=2}return ae[n>>1]=0,n-p},Dt=t=>t.length*2,gn=(t,n)=>{for(var u=0,p="";!(u>=n/4);){var g=ue[t+u*4>>2];if(g==0)break;if(++u,g>=65536){var w=g-65536;p+=String.fromCharCode(55296|w>>10,56320|w&1023)}else p+=String.fromCharCode(g)}return p},_n=(t,n,u)=>{if(u??=2147483647,u<4)return 0;for(var p=n,g=p+u-4,w=0;w<t.length;++w){var e=t.charCodeAt(w);if(e>=55296&&e<=57343){var r=t.charCodeAt(++w);e=65536+((e&1023)<<10)|r&1023}if(ue[n>>2]=e,n+=4,n+4>g)break}return ue[n>>2]=0,n-p},nt=t=>{for(var n=0,u=0;u<t.length;++u){var p=t.charCodeAt(u);p>=55296&&p<=57343&&++u,n+=4}return n},Kt=(t,n,u)=>{u=Ae(u);var p,g,w,e;n===2?(p=yn,g=Wt,e=Dt,w=r=>pe[r>>1]):n===4&&(p=gn,g=_n,e=nt,w=r=>le[r>>2]),er(t,{name:u,fromWireType:r=>{for(var l=le[r>>2],d,y=r+4,P=0;P<=l;++P){var W=r+4+P*n;if(P==l||w(W)==0){var A=W-y,D=p(y,A);d===void 0?d=D:(d+="\0",d+=D),y=W+n}}return Ve(r),d},toWireType:(r,l)=>{typeof l!="string"&&te(`Cannot pass non-string to C++ string type ${u}`);var d=e(l),y=it(4+d+n);return le[y>>2]=d/n,g(l,y+4,d+n),r!==null&&r.push(Ve,y),y},argPackAdvance:Fe,readValueFromPointer:X,destructorFunction(r){Ve(r)}})},mn=(t,n,u,p,g,w)=>{be[t]={name:Ae(n),rawConstructor:Xe(u,p),rawDestructor:Xe(g,w),fields:[]}},Xt=(t,n,u,p,g,w,e,r,l,d)=>{be[t].fields.push({fieldName:Ae(n),getterReturnType:u,getter:Xe(p,g),getterContext:w,setterArgumentType:e,setter:Xe(r,l),setterContext:d})},xt=(t,n)=>{n=Ae(n),er(t,{isVoid:!0,name:n,argPackAdvance:0,fromWireType:()=>{},toWireType:(u,p)=>{}})},bn=(t,n,u)=>oe.copyWithin(t,n,n+u),$n=(t,n)=>{var u=z[t];return u===void 0&&te(`${n} has unknown type ${Wr(t)}`),u},Yt=(t,n)=>{t=$n(t,"_emval_take_value");var u=t.readValueFromPointer(n);return Dr.toHandle(u)},wn=()=>2147483648,Pn=(t,n)=>Math.ceil(t/n)*n,Tn=t=>{var n=Pe.buffer,u=(t-n.byteLength+65535)/65536|0;try{return Pe.grow(u),xr(),1}catch{}},Zt=t=>{var n=oe.length;t>>>=0;var u=wn();if(t>u)return!1;for(var p=1;p<=4;p*=2){var g=n*(1+.2/p);g=Math.min(g,t+100663296);var w=Math.min(u,Pn(Math.max(t,g),65536)),e=Tn(w);if(e)return!0}return!1},Cn=t=>52;function An(t,n,u,p,g){return 70}var Rn=[null,[],[]],En=(t,n)=>{var u=Rn[t];n===0||n===10?((t===1?ye:_e)(pr(u)),u.length=0):u.push(n)},at=(t,n,u,p)=>{for(var g=0,w=0;w<u;w++){var e=le[n>>2],r=le[n+4>>2];n+=8;for(var l=0;l<r;l++)En(t,oe[e+l]);g+=r}return le[p>>2]=g,0},Sn=t=>t,wr=t=>{var n=c["_"+t];return n},Wn=(t,n)=>{ve.set(t,n)},Re=t=>h(t),Qt=t=>{var n=Jt(t)+1,u=Re(n);return Gt(t,u,n),u},kt=(t,n,u,p,g)=>{var w={string:D=>{var M=0;return D!=null&&D!==0&&(M=Qt(D)),M},array:D=>{var M=Re(D.length);return Wn(D,M),M}};function e(D){return n==="string"?Je(D):n==="boolean"?!!D:D}var r=wr(t),l=[],d=0;if(p)for(var y=0;y<p.length;y++){var P=w[u[y]];P?(d===0&&(d=nr()),l[y]=P(p[y])):l[y]=p[y]}var W=r(...l);function A(D){return d!==0&&Ge(d),e(D)}return W=A(W),W};Q=c.InternalError=class extends Error{constructor(n){super(n),this.name="InternalError"}},pt(),ar=c.BindingError=class extends Error{constructor(n){super(n),this.name="BindingError"}},mt(),ke(),sr=c.UnboundTypeError=rt(Error,"UnboundTypeError"),At();var rr={__assert_fail:Xr,__cxa_begin_catch:ur,__cxa_end_catch:De,__cxa_find_matching_catch_2:hr,__cxa_find_matching_catch_3:yr,__cxa_throw:Yr,__resumeException:Me,_abort_js:gr,_embind_finalize_value_object:qe,_embind_register_bigint:Zr,_embind_register_bool:un,_embind_register_class:Jr,_embind_register_class_constructor:Pt,_embind_register_class_function:Tt,_embind_register_emval:tt,_embind_register_float:St,_embind_register_function:fn,_embind_register_integer:dn,_embind_register_memory_view:vn,_embind_register_std_string:hn,_embind_register_std_wstring:Kt,_embind_register_value_object:mn,_embind_register_value_object_field:Xt,_embind_register_void:xt,_emscripten_memcpy_js:bn,_emval_decref:Lt,_emval_take_value:Yt,emscripten_resize_heap:Zt,fd_close:Cn,fd_seek:An,fd_write:at,invoke_i:i,invoke_ii:j,invoke_iii:v,invoke_iiii:ne,invoke_v:K,invoke_vi:U,invoke_viiii:H,invoke_viiiiii:a,llvm_eh_typeid_for:Sn},ge;dt();var Ot=t=>(Ot=ge.__getTypeName)(t),it=t=>(it=ge.malloc)(t),Ve=t=>(Ve=ge.free)(t),Qe=(t,n)=>(Qe=ge.setThrew)(t,n),s=t=>(s=ge._emscripten_tempret_set)(t),o=t=>(o=ge._emscripten_stack_restore)(t),h=t=>(h=ge._emscripten_stack_alloc)(t),b=()=>(b=ge.emscripten_stack_get_current)(),C=t=>(C=ge.__cxa_increment_exception_refcount)(t),x=t=>(x=ge.__cxa_decrement_exception_refcount)(t),O=(t,n,u)=>(O=ge.__cxa_can_catch)(t,n,u),E=t=>(E=ge.__cxa_get_exception_ptr)(t);c.dynCall_ji=(t,n)=>(c.dynCall_ji=ge.dynCall_ji)(t,n),c.dynCall_iiji=(t,n,u,p,g)=>(c.dynCall_iiji=ge.dynCall_iiji)(t,n,u,p,g),c.dynCall_jiji=(t,n,u,p,g)=>(c.dynCall_jiji=ge.dynCall_jiji)(t,n,u,p,g);function j(t,n){var u=nr();try{return Ie(t)(n)}catch(p){if(Ge(u),p!==p+0)throw p;Qe(1,0)}}function U(t,n){var u=nr();try{Ie(t)(n)}catch(p){if(Ge(u),p!==p+0)throw p;Qe(1,0)}}function H(t,n,u,p,g){var w=nr();try{Ie(t)(n,u,p,g)}catch(e){if(Ge(w),e!==e+0)throw e;Qe(1,0)}}function K(t){var n=nr();try{Ie(t)()}catch(u){if(Ge(n),u!==u+0)throw u;Qe(1,0)}}function ne(t,n,u,p){var g=nr();try{return Ie(t)(n,u,p)}catch(w){if(Ge(g),w!==w+0)throw w;Qe(1,0)}}function i(t){var n=nr();try{return Ie(t)()}catch(u){if(Ge(n),u!==u+0)throw u;Qe(1,0)}}function a(t,n,u,p,g,w,e){var r=nr();try{Ie(t)(n,u,p,g,w,e)}catch(l){if(Ge(r),l!==l+0)throw l;Qe(1,0)}}function v(t,n,u){var p=nr();try{return Ie(t)(n,u)}catch(g){if(Ge(p),g!==g+0)throw g;Qe(1,0)}}c.ccall=kt;var _;Ne=function t(){_||T(),_||(Ne=t)};function T(){if(Le>0||(ot(),Le>0))return;function t(){_||(_=!0,c.calledRun=!0,!me&&(jt(),F(c),c.onRuntimeInitialized?.(),rn()))}c.setStatus?(c.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>c.setStatus(""),1),t()},1)):t()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();return T(),k=V,k})})();f.exports=m,f.exports.default=m})(ra)),ra.exports}var Ti=Pi(),Ci=Gn(Ti);const Ai=new URL(""+new URL("openjphjs-B5O5ikHp.wasm",import.meta.url).href,import.meta.url),jn={codec:void 0,decoder:void 0,decodeConfig:{}};function Ri(f,$,m){const R={width:$,height:m};for(;f>0;)R.width=Math.ceil(R.width/2),R.height=Math.ceil(R.height/2),f--;return R}function Ei(f){if(jn.decodeConfig=f,Mn(f),jn.codec)return Promise.resolve();const $=Ci({locateFile:m=>m.endsWith(".wasm")?Kn("openjphjs.wasm",Ai):m});return new Promise((m,R)=>{$.then(S=>{jn.codec=S,jn.decoder=new S.HTJ2KDecoder,m()},R)})}async function Si(f,$){await Ei();const m=new jn.codec.HTJ2KDecoder,R=m.getEncodedBuffer(f.length);R.set(f);const S=$.decodeLevel||0;m.decodeSubResolution(S);const k=m.getFrameInfo();if($.decodeLevel>0){const{width:oe,height:ae}=Ri($.decodeLevel,k.width,k.height);k.width=oe,k.height=ae}const c=m.getDecodedBuffer();new Uint8Array(c.length).set(c);const I=`x: ${m.getImageOffset().x}, y: ${m.getImageOffset().y}`,V=m.getNumDecompositions(),N=m.getNumLayers(),L=["unknown","LRCP","RLCP","RPCL","PCRL","CPRL"][m.getProgressionOrder()+1],J=m.getIsReversible(),Z=`${m.getBlockDimensions().width} x ${m.getBlockDimensions().height}`,G=`${m.getTileSize().width} x ${m.getTileSize().height}`,Y=`${m.getTileOffset().x}, ${m.getTileOffset().y}`,re=`${c.length.toLocaleString()} bytes`,he=`${(c.length/R.length).toFixed(2)}:1`,ee={columns:k.width,rows:k.height,bitsPerPixel:k.bitsPerSample,signed:k.isSigned,bytesPerPixel:$.bytesPerPixel,componentsPerPixel:k.componentCount};let ye=qn(k,c);const{buffer:_e,byteOffset:we,byteLength:Pe}=ye,me=_e.slice(we,we+Pe);ye=new ye.constructor(me);const ve={imageOffset:I,numDecompositions:V,numLayers:N,progessionOrder:L,reversible:J,blockDimensions:Z,tileSize:G,tileOffset:Y,decodedSize:re,compressionRatio:he};return{...$,pixelData:ye,imageInfo:ee,encodeOptions:ve,...ve,...ee}}function Wi(f,$){const m=f.length,{rescaleSlope:R,rescaleIntercept:S,suvbw:k,doseGridScaling:c}=$;if($.modality==="PT"&&typeof k=="number"&&!isNaN(k))for(let F=0;F<m;F++)f[F]=k*(f[F]*R+S);else if($.modality==="RTDOSE"&&typeof c=="number"&&!isNaN(c))for(let F=0;F<m;F++)f[F]=f[F]*c;else for(let F=0;F<m;F++)f[F]=f[F]*R+S;return!0}function Di(f){let $=f[0],m=f[0],R;const S=f.length;for(let k=1;k<S;k++)R=f[k],$=Math.min($,R),m=Math.max(m,R);return{min:$,max:m}}function Ra(f,$){let m;return Number.isInteger(f)&&Number.isInteger($)&&(f>=0?$<=255?m=Uint8Array:$<=65535?m=Uint16Array:$<=4294967295&&(m=Uint32Array):f>=-128&&$<=127?m=Int8Array:f>=-32768&&$<=32767&&(m=Int16Array)),m||Float32Array}function xi(f,$,m){return Ra(f,$)===m}function ki(f){return f==="RGB"||f==="PALETTE COLOR"||f==="YBR_FULL"||f==="YBR_FULL_422"||f==="YBR_PARTIAL_422"||f==="YBR_PARTIAL_420"||f==="YBR_RCT"||f==="YBR_ICT"}const Oi={bilinear:Da,replicate:xa},_a={Uint8Array,Uint16Array,Int16Array,Float32Array,Uint32Array};function Fi(f,$,m,R){const S=f.pixelRepresentation!==void 0&&f.pixelRepresentation===1,k=S&&f.bitsStored!==void 0?32-f.bitsStored:void 0;if(S&&k!==void 0)for(let ee=0;ee<f.pixelData.length;ee++)f.pixelData[ee]=f.pixelData[ee]<<k>>k;let c=f.pixelData;f.pixelDataLength=f.pixelData.length;const{min:F,max:I}=Di(f.pixelData),V=typeof $.allowFloatRendering<"u"?$.allowFloatRendering:!0;let N=ki(f.photometricInterpretation)&&$.targetBuffer?.offset===void 0;const J=$.preScale?.enabled&&Object.values($.preScale.scalingParameters).some(ee=>typeof ee=="number"&&!Number.isInteger(ee)),Z=!$.preScale.enabled||!V&&J,G=$.targetBuffer?.type;if(G&&$.preScale.enabled&&!Z){const ee=$.preScale.scalingParameters,ye=na(F,I,ee);N=!xi(ye.min,ye.max,_a[G])}G&&!N?c=Ii($,f,_a,c):$.preScale.enabled&&!Z?c=Ui($,F,I,f):c=Ea(F,I,f);let Y=F,re=I;if($.preScale.enabled&&!Z){const ee=$.preScale.scalingParameters;if(Sa(ee),ji(ee)){Wi(c,ee),f.preScale={...$.preScale,scaled:!0};const _e=na(F,I,ee);Y=_e.min,re=_e.max}}else Z&&(Y=F,re=I);f.pixelData=c,f.smallestPixelValue=Y,f.largestPixelValue=re;const he=new Date().getTime();return f.decodeTimeInMS=he-m,f}function ji(f){const{rescaleSlope:$,rescaleIntercept:m,modality:R,doseGridScaling:S,suvbw:k}=f;return typeof $=="number"&&typeof m=="number"||R==="RTDOSE"&&typeof S=="number"||R==="PT"&&typeof k=="number"}function Ii(f,$,m,R){const{arrayBuffer:S,type:k,offset:c=0,length:F,rows:I}=f.targetBuffer,V=m[k];if(!V)throw new Error(`target array ${k} is not supported, or doesn't exist.`);I&&I!=$.rows&&Hi($,f.targetBuffer,V);const N=$.pixelDataLength,L=c,J=F??N-L,Z=$.pixelData;if(J!==Z.length)throw new Error(`target array for image does not have the same length (${J}) as the decoded image length (${Z.length}).`);const G=S?new V(S,L,J):new V(J);return G.set(Z,0),R=G,R}function Ui(f,$,m,R){const S=f.preScale.scalingParameters;Sa(S);const k=na($,m,S);return Ea(k.min,k.max,R)}function Ea(f,$,m){const R=Ra(f,$),S=new R(m.pixelData.length);return S.set(m.pixelData,0),S}function na(f,$,m){const{rescaleSlope:R,rescaleIntercept:S,modality:k,doseGridScaling:c,suvbw:F}=m;return k==="PT"&&typeof F=="number"&&!isNaN(F)?{min:F*(f*R+S),max:F*($*R+S)}:k==="RTDOSE"&&typeof c=="number"&&!isNaN(c)?{min:f*c,max:$*c}:typeof R=="number"&&typeof S=="number"?{min:R*f+S,max:R*$+S}:{min:f,max:$}}function Sa(f){if(!f)throw new Error("options.preScale.scalingParameters must be defined if preScale.enabled is true, and scalingParameters cannot be derived from the metadata providers.")}function Mi(f,$,m){const{samplesPerPixel:R}=f,{rows:S,columns:k}=$,c=S*k*R,F=new m(c),I=F.byteLength/c;return{pixelData:F,rows:S,columns:k,frameInfo:{...f.frameInfo,rows:S,columns:k},imageInfo:{...f.imageInfo,rows:S,columns:k,bytesPerPixel:I}}}function Hi(f,$,m){const R=Mi(f,$,m),{scalingType:S="replicate"}=$;return Oi[S](f,R),Object.assign(f,R),f.pixelDataLength=f.pixelData.length,f}async function Bi(f,$,m,R,S,k){const c=new Date().getTime();Mn(R);let F=null,I;switch($){case"1.2.840.10008.1.2":case"1.2.840.10008.1.2.1":F=la(f,m);break;case"1.2.840.10008.1.2.2":F=Ja(f,m);break;case"1.2.840.10008.1.2.1.99":F=la(f,m);break;case"1.2.840.10008.1.2.5":F=qa(f,m);break;case"1.2.840.10008.1.2.4.50":I={...f},F=ui(m,I);break;case"1.2.840.10008.1.2.4.51":F=ci(f,m);break;case"1.2.840.10008.1.2.4.57":F=da(f,m);break;case"1.2.840.10008.1.2.4.70":F=da(f,m);break;case"1.2.840.10008.1.2.4.80":I={signed:f.pixelRepresentation===1,bytesPerPixel:f.bitsAllocated<=8?1:2,...f},F=pa(m,I);break;case"1.2.840.10008.1.2.4.81":I={signed:f.pixelRepresentation===1,bytesPerPixel:f.bitsAllocated<=8?1:2,...f},F=pa(m,I);break;case"1.2.840.10008.1.2.4.90":I={...f},F=ya(m,I);break;case"1.2.840.10008.1.2.4.91":I={...f},F=ya(m,I);break;case"3.2.840.10008.1.2.4.96":case"1.2.840.10008.1.2.4.201":case"1.2.840.10008.1.2.4.202":case"1.2.840.10008.1.2.4.203":I={...f},F=Si(m,I);break;default:throw new Error(`no decoder for transfer syntax ${$}`)}if(!F)throw new Error("decodePromise not defined");const V=await F,N=Fi(V,S,c);return k?.(N),N}const Vi={decodeTask({imageFrame:f,transferSyntax:$,decodeConfig:m,options:R,pixelData:S,callbackFn:k}){return Bi(f,$,S,m,R,k)}},ma=typeof self<"u"&&typeof self.addEventListener=="function"&&typeof self.postMessage=="function"&&typeof self.document>"u"?self:void 0;ma&&aa(Vi,ma);