Files
penracourses/static/dv3d/assets/decodeImageFrameWorker-DhtpjVX0.js
T
2026-06-17 22:43:38 +01:00

101 lines
150 KiB
JavaScript

function yi(c,y){const{rows:_,columns:R,data:$}=c,{rows:r,columns:L,data:U}=y,W=[],N=[],M=[];for(let z=0;z<L;z++){const H=z*(R-1)/(L-1);W[z]=Math.floor(H),N[z]=Math.min(W[z]+1,R-1),M[z]=H-W[z]}for(let z=0;z<r;z++){const H=z*(_-1)/(r-1),X=Math.floor(H)*R,q=Math.min(X+R,(_-1)*R),ee=H-Math.floor(H),fe=1-ee,$e=z*L;for(let pe=0;pe<L;pe++){const we=$[X+W[pe]],ye=$[X+N[pe]],se=$[q+W[pe]],_e=$[q+N[pe]],Re=1-M[pe];U[$e+pe]=(we*Re+ye*M[pe])*fe+(se*Re+_e*M[pe])*ee}}return U}function _i(c,y){const{rows:_,columns:R,pixelData:$,samplesPerPixel:r=1}=c,{rows:L,columns:U,pixelData:W}=y,N=[];for(let M=0;M<U;M++){const z=M*(R-1)/(U-1);N[M]=Math.floor(z)*r}for(let M=0;M<L;M++){const z=M*(_-1)/(L-1),H=Math.floor(z)*R*r,X=M*U;for(let q=0;q<U;q++)for(let ee=0;ee<r;ee++)W[X+q+ee]=$[H+N[q]+ee]}return W}/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/const ii=Symbol("Comlink.proxy"),mi=Symbol("Comlink.endpoint"),bi=Symbol("Comlink.releaseProxy"),qn=Symbol("Comlink.finalizer"),Mn=Symbol("Comlink.thrown"),oi=c=>typeof c=="object"&&c!==null||typeof c=="function",wi={canHandle:c=>oi(c)&&c[ii],serialize(c){const{port1:y,port2:_}=new MessageChannel;return Xn(c,y),[_,[_]]},deserialize(c){return c.start(),Ai(c)}},Pi={canHandle:c=>oi(c)&&Mn in c,serialize({value:c}){let y;return c instanceof Error?y={isError:!0,value:{message:c.message,name:c.name,stack:c.stack}}:y={isError:!1,value:c},[y,[]]},deserialize(c){throw c.isError?Object.assign(new Error(c.value.message),c.value):c.value}},ai=new Map([["proxy",wi],["throw",Pi]]);function Ti(c,y){for(const _ of c)if(y===_||_==="*"||_ instanceof RegExp&&_.test(y))return!0;return!1}function Xn(c,y=globalThis,_=["*"]){y.addEventListener("message",function R($){if(!$||!$.data)return;if(!Ti(_,$.origin)){console.warn(`Invalid origin '${$.origin}' for comlink proxy`);return}const{id:r,type:L,path:U}=Object.assign({path:[]},$.data),W=($.data.argumentList||[]).map(Fn);let N;try{const M=U.slice(0,-1).reduce((H,X)=>H[X],c),z=U.reduce((H,X)=>H[X],c);switch(L){case"GET":N=z;break;case"SET":M[U.slice(-1)[0]]=Fn($.data.value),N=!0;break;case"APPLY":N=z.apply(M,W);break;case"CONSTRUCT":{const H=new z(...W);N=Fi(H)}break;case"ENDPOINT":{const{port1:H,port2:X}=new MessageChannel;Xn(c,X),N=Si(H,[H])}break;case"RELEASE":N=void 0;break;default:return}}catch(M){N={value:M,[Mn]:0}}Promise.resolve(N).catch(M=>({value:M,[Mn]:0})).then(M=>{const[z,H]=Nn(M);y.postMessage(Object.assign(Object.assign({},z),{id:r}),H),L==="RELEASE"&&(y.removeEventListener("message",R),si(y),qn in c&&typeof c[qn]=="function"&&c[qn]())}).catch(M=>{const[z,H]=Nn({value:new TypeError("Unserializable return value"),[Mn]:0});y.postMessage(Object.assign(Object.assign({},z),{id:r}),H)})}),y.start&&y.start()}function Ci(c){return c.constructor.name==="MessagePort"}function si(c){Ci(c)&&c.close()}function Ai(c,y){const _=new Map;return c.addEventListener("message",function($){const{data:r}=$;if(!r||!r.id)return;const L=_.get(r.id);if(L)try{L(r)}finally{_.delete(r.id)}}),Gn(c,_,[],y)}function Hn(c){if(c)throw new Error("Proxy has been released and is not useable")}function ui(c){return kn(c,new Map,{type:"RELEASE"}).then(()=>{si(c)})}const Vn=new WeakMap,Bn="FinalizationRegistry"in globalThis&&new FinalizationRegistry(c=>{const y=(Vn.get(c)||0)-1;Vn.set(c,y),y===0&&ui(c)});function $i(c,y){const _=(Vn.get(y)||0)+1;Vn.set(y,_),Bn&&Bn.register(c,y,c)}function Ri(c){Bn&&Bn.unregister(c)}function Gn(c,y,_=[],R=function(){}){let $=!1;const r=new Proxy(R,{get(L,U){if(Hn($),U===bi)return()=>{Ri(r),ui(c),y.clear(),$=!0};if(U==="then"){if(_.length===0)return{then:()=>r};const W=kn(c,y,{type:"GET",path:_.map(N=>N.toString())}).then(Fn);return W.then.bind(W)}return Gn(c,y,[..._,U])},set(L,U,W){Hn($);const[N,M]=Nn(W);return kn(c,y,{type:"SET",path:[..._,U].map(z=>z.toString()),value:N},M).then(Fn)},apply(L,U,W){Hn($);const N=_[_.length-1];if(N===mi)return kn(c,y,{type:"ENDPOINT"}).then(Fn);if(N==="bind")return Gn(c,y,_.slice(0,-1));const[M,z]=Qn(W);return kn(c,y,{type:"APPLY",path:_.map(H=>H.toString()),argumentList:M},z).then(Fn)},construct(L,U){Hn($);const[W,N]=Qn(U);return kn(c,y,{type:"CONSTRUCT",path:_.map(M=>M.toString()),argumentList:W},N).then(Fn)}});return $i(r,c),r}function Ei(c){return Array.prototype.concat.apply([],c)}function Qn(c){const y=c.map(Nn);return[y.map(_=>_[0]),Ei(y.map(_=>_[1]))]}const fi=new WeakMap;function Si(c,y){return fi.set(c,y),c}function Fi(c){return Object.assign(c,{[ii]:!0})}function Nn(c){for(const[y,_]of ai)if(_.canHandle(c)){const[R,$]=_.serialize(c);return[{type:"HANDLER",name:y,value:R},$]}return[{type:"RAW",value:c},fi.get(c)||[]]}function Fn(c){switch(c.type){case"HANDLER":return ai.get(c.name).deserialize(c.value);case"RAW":return c.value}}function kn(c,y,_,R){return new Promise($=>{const r=ki();y.set(r,$),c.start&&c.start(),c.postMessage(Object.assign({id:r},_),R)})}function ki(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}async function Zn(c,y){let _=y.buffer,R=y.byteOffset;const $=y.length;if(c.bitsAllocated===16)R%2&&(_=_.slice(R),R=0),c.pixelRepresentation===0?c.pixelData=new Uint16Array(_,R,$/2):c.pixelData=new Int16Array(_,R,$/2);else if(c.bitsAllocated===8||c.bitsAllocated===1)c.pixelData=y;else if(c.bitsAllocated===32){if(R%2&&(_=_.slice(R),R=0),c.floatPixelData||c.doubleFloatPixelData)throw new Error("Float pixel data is not supported for parsing into ImageFrame");c.pixelRepresentation===0?c.pixelData=new Uint32Array(_,R,$/4):c.pixelRepresentation===1?c.pixelData=new Int32Array(_,R,$/4):c.pixelData=new Float32Array(_,R,$/4)}return c}function Di(c){return(c&255)<<8|c>>8&255}async function xi(c,y){if(c.bitsAllocated===16){let _=y.buffer,R=y.byteOffset;const $=y.length;R%2&&(_=_.slice(R),R=0),c.pixelRepresentation===0?c.pixelData=new Uint16Array(_,R,$/2):c.pixelData=new Int16Array(_,R,$/2);for(let r=0;r<c.pixelData.length;r++)c.pixelData[r]=Di(c.pixelData[r])}else c.bitsAllocated===8&&(c.pixelData=y);return c}async function Oi(c,y){if(c.bitsAllocated===8)return c.planarConfiguration?Ii(c,y):Ui(c,y);if(c.bitsAllocated===16)return ji(c,y);throw new Error("unsupported pixel format for RLE")}function Ui(c,y){const _=y,R=c.rows*c.columns,$=new ArrayBuffer(R*c.samplesPerPixel),r=new DataView(_.buffer,_.byteOffset),L=new Int8Array(_.buffer,_.byteOffset),U=new Int8Array($);let W=0;const N=r.getInt32(0,!0);for(let M=0;M<N;++M){W=M;let z=r.getInt32((M+1)*4,!0),H=r.getInt32((M+2)*4,!0);H===0&&(H=_.length);const X=R*N;for(;z<H;){const q=L[z++];if(q>=0&&q<=127)for(let ee=0;ee<q+1&&W<X;++ee)U[W]=L[z++],W+=c.samplesPerPixel;else if(q<=-1&&q>=-127){const ee=L[z++];for(let fe=0;fe<-q+1&&W<X;++fe)U[W]=ee,W+=c.samplesPerPixel}}}return c.pixelData=new Uint8Array($),c}function Ii(c,y){const _=y,R=c.rows*c.columns,$=new ArrayBuffer(R*c.samplesPerPixel),r=new DataView(_.buffer,_.byteOffset),L=new Int8Array(_.buffer,_.byteOffset),U=new Int8Array($);let W=0;const N=r.getInt32(0,!0);for(let M=0;M<N;++M){W=M*R;let z=r.getInt32((M+1)*4,!0),H=r.getInt32((M+2)*4,!0);H===0&&(H=_.length);const X=R*N;for(;z<H;){const q=L[z++];if(q>=0&&q<=127)for(let ee=0;ee<q+1&&W<X;++ee)U[W]=L[z++],W++;else if(q<=-1&&q>=-127){const ee=L[z++];for(let fe=0;fe<-q+1&&W<X;++fe)U[W]=ee,W++}}}return c.pixelData=new Uint8Array($),c}function ji(c,y){const _=y,R=c.rows*c.columns,$=new ArrayBuffer(R*c.samplesPerPixel*2),r=new DataView(_.buffer,_.byteOffset),L=new Int8Array(_.buffer,_.byteOffset),U=new Int8Array($),W=r.getInt32(0,!0);for(let N=0;N<W;++N){let M=0;const z=N===0?1:0;let H=r.getInt32((N+1)*4,!0),X=r.getInt32((N+2)*4,!0);for(X===0&&(X=_.length);H<X;){const q=L[H++];if(q>=0&&q<=127)for(let ee=0;ee<q+1&&M<R;++ee)U[M*2+z]=L[H++],M++;else if(q<=-1&&q>=-127){const ee=L[H++];for(let fe=0;fe<-q+1&&M<R;++fe)U[M*2+z]=ee,M++}}}return c.pixelRepresentation===0?c.pixelData=new Uint16Array($):c.pixelData=new Int16Array($),c}function zn(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}function Wi(c){if(c.__esModule)return c;var y=c.default;if(typeof y=="function"){var _=function R(){return this instanceof R?Reflect.construct(y,arguments,this.constructor):y.apply(this,arguments)};_.prototype=y.prototype}else _={};return Object.defineProperty(_,"__esModule",{value:!0}),Object.keys(c).forEach(function(R){var $=Object.getOwnPropertyDescriptor(c,R);Object.defineProperty(_,R,$.get?$:{enumerable:!0,get:function(){return c[R]}})}),_}var ci={exports:{}},Hi={},Mi=Object.freeze({__proto__:null,default:Hi}),rn=Wi(Mi);(function(c,y){var _=(()=>{var R=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(R=R||__filename),function($){$=$||{};var r=typeof $<"u"?$:{},L,U;r.ready=new Promise(function(e,t){L=e,U=t});var W=Object.assign({},r),N="./this.program",M=(e,t)=>{throw t},z=typeof window=="object",H=typeof importScripts=="function",X=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",q="";function ee(e){return r.locateFile?r.locateFile(e,q):q+e}var fe,$e,pe;if(X){var we=rn,ye=rn;H?q=ye.dirname(q)+"/":q=__dirname+"/",fe=(e,t)=>(e=Ce(e)?new URL(e):ye.normalize(e),we.readFileSync(e,t?void 0:"utf8")),pe=e=>{var t=fe(e,!0);return t.buffer||(t=new Uint8Array(t)),t},$e=(e,t,o)=>{e=Ce(e)?new URL(e):ye.normalize(e),we.readFile(e,function(l,p){l?o(l):t(p.buffer)})},process.argv.length>1&&(N=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof ar))throw e}),process.on("unhandledRejection",function(e){throw e}),M=(e,t)=>{throw process.exitCode=e,t},r.inspect=function(){return"[Emscripten Module object]"}}else(z||H)&&(H?q=self.location.href:typeof document<"u"&&document.currentScript&&(q=document.currentScript.src),R&&(q=R),q.indexOf("blob:")!==0?q=q.substr(0,q.replace(/[?#].*/,"").lastIndexOf("/")+1):q="",fe=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},H&&(pe=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),$e=(e,t,o)=>{var l=new XMLHttpRequest;l.open("GET",e,!0),l.responseType="arraybuffer",l.onload=()=>{if(l.status==200||l.status==0&&l.response){t(l.response);return}o()},l.onerror=o,l.send(null)});var se=r.print||console.log.bind(console),_e=r.printErr||console.warn.bind(console);Object.assign(r,W),W=null,r.arguments&&r.arguments,r.thisProgram&&(N=r.thisProgram),r.quit&&(M=r.quit);var Re;r.wasmBinary&&(Re=r.wasmBinary),r.noExitRuntime,typeof WebAssembly!="object"&&at("no native wasm support detected");var it,Vt=!1;function xt(e,t){e||at(t)}var Tt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function nr(e,t,o){for(var l=t+o,p=t;e[p]&&!(p>=l);)++p;if(p-t>16&&e.buffer&&Tt)return Tt.decode(e.subarray(t,p));for(var h="";t<p;){var g=e[t++];if(!(g&128)){h+=String.fromCharCode(g);continue}var m=e[t++]&63;if((g&224)==192){h+=String.fromCharCode((g&31)<<6|m);continue}var P=e[t++]&63;if((g&240)==224?g=(g&15)<<12|m<<6|P:g=(g&7)<<18|m<<12|P<<6|e[t++]&63,g<65536)h+=String.fromCharCode(g);else{var S=g-65536;h+=String.fromCharCode(55296|S>>10,56320|S&1023)}}return h}function vr(e,t){return e?nr(ue,e,t):""}function ir(e,t,o,l){if(!(l>0))return 0;for(var p=o,h=o+l-1,g=0;g<e.length;++g){var m=e.charCodeAt(g);if(m>=55296&&m<=57343){var P=e.charCodeAt(++g);m=65536+((m&1023)<<10)|P&1023}if(m<=127){if(o>=h)break;t[o++]=m}else if(m<=2047){if(o+1>=h)break;t[o++]=192|m>>6,t[o++]=128|m&63}else if(m<=65535){if(o+2>=h)break;t[o++]=224|m>>12,t[o++]=128|m>>6&63,t[o++]=128|m&63}else{if(o+3>=h)break;t[o++]=240|m>>18,t[o++]=128|m>>12&63,t[o++]=128|m>>6&63,t[o++]=128|m&63}}return t[o]=0,o-p}function Ge(e,t,o){return ir(e,ue,t,o)}function me(e){for(var t=0,o=0;o<e.length;++o){var l=e.charCodeAt(o);l<=127?t++:l<=2047?t+=2:l>=55296&&l<=57343?(t+=4,++o):t+=3}return t}var le,ce,ue,ne,oe,ie,he,Bt,Nt;function zt(e){le=e,r.HEAP8=ce=new Int8Array(e),r.HEAP16=ne=new Int16Array(e),r.HEAP32=ie=new Int32Array(e),r.HEAPU8=ue=new Uint8Array(e),r.HEAPU16=oe=new Uint16Array(e),r.HEAPU32=he=new Uint32Array(e),r.HEAPF32=Bt=new Float32Array(e),r.HEAPF64=Nt=new Float64Array(e)}r.INITIAL_MEMORY;var qt,or=[],hr=[],kr=[];function nn(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Ct(r.preRun.shift());At(or)}function on(){At(hr)}function an(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Xe(r.postRun.shift());At(kr)}function Ct(e){or.unshift(e)}function Je(e){hr.unshift(e)}function Xe(e){kr.unshift(e)}var Ye=0,ot=null;function Ot(e){Ye++,r.monitorRunDependencies&&r.monitorRunDependencies(Ye)}function Ut(e){if(Ye--,r.monitorRunDependencies&&r.monitorRunDependencies(Ye),Ye==0&&ot){var t=ot;ot=null,t()}}function at(e){r.onAbort&&r.onAbort(e),e="Aborted("+e+")",_e(e),Vt=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw U(t),t}var Te="data:application/octet-stream;base64,";function Pe(e){return e.startsWith(Te)}function Ce(e){return e.startsWith("file://")}var Fe;Fe="libjpegturbowasm_decode.wasm",Pe(Fe)||(Fe=ee(Fe));function Dr(e){try{if(e==Fe&&Re)return new Uint8Array(Re);if(pe)return pe(e);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}function gr(){if(!Re&&(z||H)){if(typeof fetch=="function"&&!Ce(Fe))return fetch(Fe,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+Fe+"'";return e.arrayBuffer()}).catch(function(){return Dr(Fe)});if($e)return new Promise(function(e,t){$e(Fe,function(o){e(new Uint8Array(o))},t)})}return Promise.resolve().then(function(){return Dr(Fe)})}function yr(){var e={a:A};function t(g,m){var P=g.exports;r.asm=P,it=r.asm.K,zt(it.buffer),qt=r.asm.M,Je(r.asm.L),Ut()}Ot();function o(g){t(g.instance)}function l(g){return gr().then(function(m){return WebAssembly.instantiate(m,e)}).then(function(m){return m}).then(g,function(m){_e("failed to asynchronously prepare wasm: "+m),at(m)})}function p(){return!Re&&typeof WebAssembly.instantiateStreaming=="function"&&!Pe(Fe)&&!Ce(Fe)&&!X&&typeof fetch=="function"?fetch(Fe,{credentials:"same-origin"}).then(function(g){var m=WebAssembly.instantiateStreaming(g,e);return m.then(o,function(P){return _e("wasm streaming compile failed: "+P),_e("falling back to ArrayBuffer instantiation"),l(o)})}):l(o)}if(r.instantiateWasm)try{var h=r.instantiateWasm(e,t);return h}catch(g){_e("Module.instantiateWasm callback failed with error: "+g),U(g)}return p().catch(U),{}}function ar(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function At(e){for(;e.length>0;)e.shift()(r)}function xr(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(t){he[this.ptr+4>>2]=t},this.get_type=function(){return he[this.ptr+4>>2]},this.set_destructor=function(t){he[this.ptr+8>>2]=t},this.get_destructor=function(){return he[this.ptr+8>>2]},this.set_refcount=function(t){ie[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,ce[this.ptr+12>>0]=t},this.get_caught=function(){return ce[this.ptr+12>>0]!=0},this.set_rethrown=function(t){t=t?1:0,ce[this.ptr+13>>0]=t},this.get_rethrown=function(){return ce[this.ptr+13>>0]!=0},this.init=function(t,o){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(o),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=ie[this.ptr>>2];ie[this.ptr>>2]=t+1},this.release_ref=function(){var t=ie[this.ptr>>2];return ie[this.ptr>>2]=t-1,t===1},this.set_adjusted_ptr=function(t){he[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return he[this.ptr+16>>2]},this.get_exception_ptr=function(){var t=d(this.get_type());if(t)return he[this.excPtr>>2];var o=this.get_adjusted_ptr();return o!==0?o:this.excPtr}}function _t(e,t,o){var l=new xr(e);throw l.init(t,o),e}var ke={};function De(e){for(;e.length;){var t=e.pop(),o=e.pop();o(t)}}function ge(e){return this.fromWireType(ie[e>>2])}var Ne={},tt={},st={},_r=48,Gt=57;function It(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=_r&&t<=Gt?"_"+e:e}function mt(e,t){return e=It(e),new Function("body","return function "+e+`() {
"use strict"; return body.apply(this, arguments);
};
`)(t)}function He(e,t){var o=mt(t,function(l){this.name=t,this.message=l;var p=new Error(l).stack;p!==void 0&&(this.stack=this.toString()+`
`+p.replace(/^Error(:[^\n]*)?\n/,""))});return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},o}var jt=void 0;function Me(e){throw new jt(e)}function Le(e,t,o){e.forEach(function(m){st[m]=t});function l(m){var P=o(m);P.length!==e.length&&Me("Mismatched type converter count");for(var S=0;S<e.length;++S)ze(e[S],P[S])}var p=new Array(t.length),h=[],g=0;t.forEach((m,P)=>{tt.hasOwnProperty(m)?p[P]=tt[m]:(h.push(m),Ne.hasOwnProperty(m)||(Ne[m]=[]),Ne[m].push(()=>{p[P]=tt[m],++g,g===h.length&&l(p)}))}),h.length===0&&l(p)}function $t(e){var t=ke[e];delete ke[e];var o=t.rawConstructor,l=t.rawDestructor,p=t.fields,h=p.map(g=>g.getterReturnType).concat(p.map(g=>g.setterArgumentType));Le([e],h,g=>{var m={};return p.forEach((P,S)=>{var I=P.fieldName,B=g[S],V=P.getter,te=P.getterContext,Z=g[S+p.length],ve=P.setter,Oe=P.setterContext;m[I]={read:We=>B.fromWireType(V(te,We)),write:(We,Sn)=>{var Lt=[];ve(Oe,We,Z.toWireType(Lt,Sn)),De(Lt)}}}),[{name:t.name,fromWireType:function(P){var S={};for(var I in m)S[I]=m[I].read(P);return l(P),S},toWireType:function(P,S){for(var I in m)if(!(I in S))throw new TypeError('Missing field: "'+I+'"');var B=o();for(I in m)m[I].write(B,S[I]);return P!==null&&P.push(l,B),B},argPackAdvance:8,readValueFromPointer:ge,destructorFunction:l}]})}function Rt(e,t,o,l,p){}function Ae(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function Et(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Y=e}var Y=void 0;function de(e){for(var t="",o=e;ue[o];)t+=Y[ue[o++]];return t}var re=void 0;function Q(e){throw new re(e)}function ze(e,t,o={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var l=t.name;if(e||Q('type "'+l+'" must have a positive integer typeid pointer'),tt.hasOwnProperty(e)){if(o.ignoreDuplicateRegistrations)return;Q("Cannot register type '"+l+"' twice")}if(tt[e]=t,delete st[e],Ne.hasOwnProperty(e)){var p=Ne[e];delete Ne[e],p.forEach(h=>h())}}function ut(e,t,o,l,p){var h=Ae(o);t=de(t),ze(e,{name:t,fromWireType:function(g){return!!g},toWireType:function(g,m){return m?l:p},argPackAdvance:8,readValueFromPointer:function(g){var m;if(o===1)m=ce;else if(o===2)m=ne;else if(o===4)m=ie;else throw new TypeError("Unknown boolean type size: "+t);return this.fromWireType(m[g>>h])},destructorFunction:null})}function mr(e){if(!(this instanceof vt)||!(e instanceof vt))return!1;for(var t=this.$$.ptrType.registeredClass,o=this.$$.ptr,l=e.$$.ptrType.registeredClass,p=e.$$.ptr;t.baseClass;)o=t.upcast(o),t=t.baseClass;for(;l.baseClass;)p=l.upcast(p),l=l.baseClass;return t===l&&o===p}function sr(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function St(e){function t(o){return o.$$.ptrType.registeredClass.name}Q(t(e)+" instance already deleted")}var Jt=!1;function ur(e){}function Ee(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function bt(e){e.count.value-=1;var t=e.count.value===0;t&&Ee(e)}function ae(e,t,o){if(t===o)return e;if(o.baseClass===void 0)return null;var l=ae(e,t,o.baseClass);return l===null?null:o.downcast(l)}var Ue={};function br(){return Object.keys(lt).length}function ft(){var e=[];for(var t in lt)lt.hasOwnProperty(t)&&e.push(lt[t]);return e}var Ft=[];function ct(){for(;Ft.length;){var e=Ft.pop();e.$$.deleteScheduled=!1,e.delete()}}var Ke=void 0;function Or(e){Ke=e,Ft.length&&Ke&&Ke(ct)}function Xt(){r.getInheritedInstanceCount=br,r.getLiveInheritedInstances=ft,r.flushPendingDeletes=ct,r.setDelayFunction=Or}var lt={};function Ur(e,t){for(t===void 0&&Q("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function dt(e,t){return t=Ur(e,t),lt[t]}function fr(e,t){(!t.ptrType||!t.ptr)&&Me("makeClassHandle requires ptr and ptrType");var o=!!t.smartPtrType,l=!!t.smartPtr;return o!==l&&Me("Both smartPtrType and smartPtr must be specified"),t.count={value:1},pt(Object.create(e,{$$:{value:t}}))}function Yt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var o=dt(this.registeredClass,t);if(o!==void 0){if(o.$$.count.value===0)return o.$$.ptr=t,o.$$.smartPtr=e,o.clone();var l=o.clone();return this.destructor(e),l}function p(){return this.isSmartPointer?fr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):fr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var h=this.registeredClass.getActualType(t),g=Ue[h];if(!g)return p.call(this);var m;this.isConst?m=g.constPointerType:m=g.pointerType;var P=ae(t,this.registeredClass,m.registeredClass);return P===null?p.call(this):this.isSmartPointer?fr(m.registeredClass.instancePrototype,{ptrType:m,ptr:P,smartPtrType:this,smartPtr:e}):fr(m.registeredClass.instancePrototype,{ptrType:m,ptr:P})}function pt(e){return typeof FinalizationRegistry>"u"?(pt=t=>t,e):(Jt=new FinalizationRegistry(t=>{bt(t.$$)}),pt=t=>{var o=t.$$,l=!!o.smartPtr;if(l){var p={$$:o};Jt.register(t,p,t)}return t},ur=t=>Jt.unregister(t),pt(e))}function wr(){if(this.$$.ptr||St(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=pt(Object.create(Object.getPrototypeOf(this),{$$:{value:sr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Kt(){this.$$.ptr||St(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),ur(this),bt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function wt(){return!this.$$.ptr}function Ir(){return this.$$.ptr||St(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Q("Object already scheduled for deletion"),Ft.push(this),Ft.length===1&&Ke&&Ke(ct),this.$$.deleteScheduled=!0,this}function Ve(){vt.prototype.isAliasOf=mr,vt.prototype.clone=wr,vt.prototype.delete=Kt,vt.prototype.isDeleted=wt,vt.prototype.deleteLater=Ir}function vt(){}function cr(e,t,o){if(e[t].overloadTable===void 0){var l=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Q("Function '"+o+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[l.argCount]=l}}function lr(e,t,o){r.hasOwnProperty(e)?(Q("Cannot register public name '"+e+"' twice"),cr(r,e,e),r.hasOwnProperty(o)&&Q("Cannot register multiple overloads of a function with the same number of arguments ("+o+")!"),r[e].overloadTable[o]=t):r[e]=t}function Pr(e,t,o,l,p,h,g,m){this.name=e,this.constructor=t,this.instancePrototype=o,this.rawDestructor=l,this.baseClass=p,this.getActualType=h,this.upcast=g,this.downcast=m,this.pureVirtualFunctions=[]}function kt(e,t,o){for(;t!==o;)t.upcast||Q("Expected null or instance of "+o.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function sn(e,t){if(t===null)return this.isReference&&Q("null is not a valid "+this.name),0;t.$$||Q('Cannot pass "'+tr(t)+'" as a '+this.name),t.$$.ptr||Q("Cannot pass deleted object as a pointer of type "+this.name);var o=t.$$.ptrType.registeredClass,l=kt(t.$$.ptr,o,this.registeredClass);return l}function un(e,t){var o;if(t===null)return this.isReference&&Q("null is not a valid "+this.name),this.isSmartPointer?(o=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,o),o):0;t.$$||Q('Cannot pass "'+tr(t)+'" as a '+this.name),t.$$.ptr||Q("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&Q("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var l=t.$$.ptrType.registeredClass;if(o=kt(t.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&Q("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?o=t.$$.smartPtr:Q("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:o=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)o=t.$$.smartPtr;else{var p=t.clone();o=this.rawShare(o,Pt.toHandle(function(){p.delete()})),e!==null&&e.push(this.rawDestructor,o)}break;default:Q("Unsupporting sharing policy")}return o}function fn(e,t){if(t===null)return this.isReference&&Q("null is not a valid "+this.name),0;t.$$||Q('Cannot pass "'+tr(t)+'" as a '+this.name),t.$$.ptr||Q("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&Q("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var o=t.$$.ptrType.registeredClass,l=kt(t.$$.ptr,o,this.registeredClass);return l}function cn(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function ht(e){this.rawDestructor&&this.rawDestructor(e)}function gt(e){e!==null&&e.delete()}function rt(){Be.prototype.getPointee=cn,Be.prototype.destructor=ht,Be.prototype.argPackAdvance=8,Be.prototype.readValueFromPointer=ge,Be.prototype.deleteObject=gt,Be.prototype.fromWireType=Yt}function Be(e,t,o,l,p,h,g,m,P,S,I){this.name=e,this.registeredClass=t,this.isReference=o,this.isConst=l,this.isSmartPointer=p,this.pointeeType=h,this.sharingPolicy=g,this.rawGetPointee=m,this.rawConstructor=P,this.rawShare=S,this.rawDestructor=I,!p&&t.baseClass===void 0?l?(this.toWireType=sn,this.destructorFunction=null):(this.toWireType=fn,this.destructorFunction=null):this.toWireType=un}function jr(e,t,o){r.hasOwnProperty(e)||Me("Replacing nonexistant public symbol"),r[e].overloadTable!==void 0&&o!==void 0||(r[e]=t,r[e].argCount=o)}function Wt(e,t,o){var l=r["dynCall_"+e];return o&&o.length?l.apply(null,[t].concat(o)):l.call(null,t)}var Qt=[];function Se(e){var t=Qt[e];return t||(e>=Qt.length&&(Qt.length=e+1),Qt[e]=t=qt.get(e)),t}function Wr(e,t,o){if(e.includes("j"))return Wt(e,t,o);var l=Se(t).apply(null,o);return l}function Qe(e,t){var o=[];return function(){return o.length=0,Object.assign(o,arguments),Wr(e,t,o)}}function Ie(e,t){e=de(e);function o(){return e.includes("j")?Qe(e,t):Se(t)}var l=o();return typeof l!="function"&&Q("unknown function pointer with signature "+e+": "+t),l}var Tr=void 0;function Ht(e){var t=G(e),o=de(t);return j(t),o}function Ze(e,t){var o=[],l={};function p(h){if(!l[h]&&!tt[h]){if(st[h]){st[h].forEach(p);return}o.push(h),l[h]=!0}}throw t.forEach(p),new Tr(e+": "+o.map(Ht).join([", "]))}function Zt(e,t,o,l,p,h,g,m,P,S,I,B,V){I=de(I),h=Ie(p,h),m&&(m=Ie(g,m)),S&&(S=Ie(P,S)),V=Ie(B,V);var te=It(I);lr(te,function(){Ze("Cannot construct "+I+" due to unbound types",[l])}),Le([e,t,o],l?[l]:[],function(Z){Z=Z[0];var ve,Oe;l?(ve=Z.registeredClass,Oe=ve.instancePrototype):Oe=vt.prototype;var We=mt(te,function(){if(Object.getPrototypeOf(this)!==Sn)throw new re("Use 'new' to construct "+I);if(Lt.constructor_body===void 0)throw new re(I+" has no accessible constructor");var Kn=Lt.constructor_body[arguments.length];if(Kn===void 0)throw new re("Tried to invoke ctor of "+I+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Lt.constructor_body).toString()+") parameters instead!");return Kn.apply(this,arguments)}),Sn=Object.create(Oe,{constructor:{value:We}});We.prototype=Sn;var Lt=new Pr(I,We,Sn,V,ve,h,m,S),Wn=new Be(I,Lt,!0,!1,!1),xn=new Be(I+"*",Lt,!1,!1,!1),Yn=new Be(I+" const*",Lt,!1,!0,!1);return Ue[e]={pointerType:xn,constPointerType:Yn},jr(te,We),[Wn,xn,Yn]})}function Hr(e,t){for(var o=[],l=0;l<e;l++)o.push(he[t+l*4>>2]);return o}function Mr(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var o=mt(e.name||"unknownFunctionName",function(){});o.prototype=e.prototype;var l=new o,p=e.apply(l,t);return p instanceof Object?p:l}function dr(e,t,o,l,p){var h=t.length;h<2&&Q("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var g=t[1]!==null&&o!==null,m=!1,P=1;P<t.length;++P)if(t[P]!==null&&t[P].destructorFunction===void 0){m=!0;break}for(var S=t[0].name!=="void",I="",B="",P=0;P<h-2;++P)I+=(P!==0?", ":"")+"arg"+P,B+=(P!==0?", ":"")+"arg"+P+"Wired";var V="return function "+It(e)+"("+I+`) {
if (arguments.length !== `+(h-2)+`) {
throwBindingError('function `+e+" called with ' + arguments.length + ' arguments, expected "+(h-2)+` args!');
}
`;m&&(V+=`var destructors = [];
`);var te=m?"destructors":"null",Z=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],ve=[Q,l,p,De,t[0],t[1]];g&&(V+="var thisWired = classParam.toWireType("+te+`, this);
`);for(var P=0;P<h-2;++P)V+="var arg"+P+"Wired = argType"+P+".toWireType("+te+", arg"+P+"); // "+t[P+2].name+`
`,Z.push("argType"+P),ve.push(t[P+2]);if(g&&(B="thisWired"+(B.length>0?", ":"")+B),V+=(S?"var rv = ":"")+"invoker(fn"+(B.length>0?", ":"")+B+`);
`,m)V+=`runDestructors(destructors);
`;else for(var P=g?1:2;P<t.length;++P){var Oe=P===1?"thisWired":"arg"+(P-2)+"Wired";t[P].destructorFunction!==null&&(V+=Oe+"_dtor("+Oe+"); // "+t[P].name+`
`,Z.push(Oe+"_dtor"),ve.push(t[P].destructorFunction))}S&&(V+=`var ret = retType.fromWireType(rv);
return ret;
`),V+=`}
`,Z.push(V);var We=Mr(Function,Z).apply(null,ve);return We}function be(e,t,o,l,p,h){xt(t>0);var g=Hr(t,o);p=Ie(l,p),Le([],[e],function(m){m=m[0];var P="constructor "+m.name;if(m.registeredClass.constructor_body===void 0&&(m.registeredClass.constructor_body=[]),m.registeredClass.constructor_body[t-1]!==void 0)throw new re("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+m.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return m.registeredClass.constructor_body[t-1]=()=>{Ze("Cannot construct "+m.name+" due to unbound types",g)},Le([],g,function(S){return S.splice(1,0,null),m.registeredClass.constructor_body[t-1]=dr(P,S,null,p,h),[]}),[]})}function er(e,t,o,l,p,h,g,m){var P=Hr(o,l);t=de(t),h=Ie(p,h),Le([],[e],function(S){S=S[0];var I=S.name+"."+t;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),m&&S.registeredClass.pureVirtualFunctions.push(t);function B(){Ze("Cannot call "+I+" due to unbound types",P)}var V=S.registeredClass.instancePrototype,te=V[t];return te===void 0||te.overloadTable===void 0&&te.className!==S.name&&te.argCount===o-2?(B.argCount=o-2,B.className=S.name,V[t]=B):(cr(V,t,I),V[t].overloadTable[o-2]=B),Le([],P,function(Z){var ve=dr(I,Z,S,h,g);return V[t].overloadTable===void 0?(ve.argCount=o-2,V[t]=ve):V[t].overloadTable[o-2]=ve,[]}),[]})}var je=[],xe=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Lr(e){e>4&&--xe[e].refcount===0&&(xe[e]=void 0,je.push(e))}function nt(){for(var e=0,t=5;t<xe.length;++t)xe[t]!==void 0&&++e;return e}function ln(){for(var e=5;e<xe.length;++e)if(xe[e]!==void 0)return xe[e];return null}function qe(){r.count_emval_handles=nt,r.get_first_emval=ln}var Pt={toValue:e=>(e||Q("Cannot use deleted val. handle = "+e),xe[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var t=je.length?je.pop():xe.length;return xe[t]={refcount:1,value:e},t}}}};function Cr(e,t){t=de(t),ze(e,{name:t,fromWireType:function(o){var l=Pt.toValue(o);return Lr(o),l},toWireType:function(o,l){return Pt.toHandle(l)},argPackAdvance:8,readValueFromPointer:ge,destructorFunction:null})}function tr(e){if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e}function et(e,t){switch(t){case 2:return function(o){return this.fromWireType(Bt[o>>2])};case 3:return function(o){return this.fromWireType(Nt[o>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Vr(e,t,o){var l=Ae(o);t=de(t),ze(e,{name:t,fromWireType:function(p){return p},toWireType:function(p,h){return h},argPackAdvance:8,readValueFromPointer:et(t,l),destructorFunction:null})}function dn(e,t,o){switch(t){case 0:return o?function(p){return ce[p]}:function(p){return ue[p]};case 1:return o?function(p){return ne[p>>1]}:function(p){return oe[p>>1]};case 2:return o?function(p){return ie[p>>2]}:function(p){return he[p>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function pn(e,t,o,l,p){t=de(t);var h=Ae(o),g=B=>B;if(l===0){var m=32-8*o;g=B=>B<<m>>>m}var P=t.includes("unsigned"),S=(B,V)=>{},I;P?I=function(B,V){return S(V,this.name),V>>>0}:I=function(B,V){return S(V,this.name),V},ze(e,{name:t,fromWireType:g,toWireType:I,argPackAdvance:8,readValueFromPointer:dn(t,h,l!==0),destructorFunction:null})}function Br(e,t,o){var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],p=l[t];function h(g){g=g>>2;var m=he,P=m[g],S=m[g+1];return new p(le,S,P)}o=de(o),ze(e,{name:o,fromWireType:h,argPackAdvance:8,readValueFromPointer:h},{ignoreDuplicateRegistrations:!0})}function rr(e,t){t=de(t);var o=t==="std::string";ze(e,{name:t,fromWireType:function(l){var p=he[l>>2],h=l+4,g;if(o)for(var m=h,P=0;P<=p;++P){var S=h+P;if(P==p||ue[S]==0){var I=S-m,B=vr(m,I);g===void 0?g=B:(g+="\0",g+=B),m=S+1}}else{for(var V=new Array(p),P=0;P<p;++P)V[P]=String.fromCharCode(ue[h+P]);g=V.join("")}return j(l),g},toWireType:function(l,p){p instanceof ArrayBuffer&&(p=new Uint8Array(p));var h,g=typeof p=="string";g||p instanceof Uint8Array||p instanceof Uint8ClampedArray||p instanceof Int8Array||Q("Cannot pass non-string to std::string"),o&&g?h=me(p):h=p.length;var m=x(4+h+1),P=m+4;if(he[m>>2]=h,o&&g)Ge(p,P,h+1);else if(g)for(var S=0;S<h;++S){var I=p.charCodeAt(S);I>255&&(j(P),Q("String has UTF-16 code units that do not fit in 8 bits")),ue[P+S]=I}else for(var S=0;S<h;++S)ue[P+S]=p[S];return l!==null&&l.push(j,m),m},argPackAdvance:8,readValueFromPointer:ge,destructorFunction:function(l){j(l)}})}var Nr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Ar(e,t){for(var o=e,l=o>>1,p=l+t/2;!(l>=p)&&oe[l];)++l;if(o=l<<1,o-e>32&&Nr)return Nr.decode(ue.subarray(e,o));for(var h="",g=0;!(g>=t/2);++g){var m=ne[e+g*2>>1];if(m==0)break;h+=String.fromCharCode(m)}return h}function vn(e,t,o){if(o===void 0&&(o=2147483647),o<2)return 0;o-=2;for(var l=t,p=o<e.length*2?o/2:e.length,h=0;h<p;++h){var g=e.charCodeAt(h);ne[t>>1]=g,t+=2}return ne[t>>1]=0,t-l}function hn(e){return e.length*2}function gn(e,t){for(var o=0,l="";!(o>=t/4);){var p=ie[e+o*4>>2];if(p==0)break;if(++o,p>=65536){var h=p-65536;l+=String.fromCharCode(55296|h>>10,56320|h&1023)}else l+=String.fromCharCode(p)}return l}function yn(e,t,o){if(o===void 0&&(o=2147483647),o<4)return 0;for(var l=t,p=l+o-4,h=0;h<e.length;++h){var g=e.charCodeAt(h);if(g>=55296&&g<=57343){var m=e.charCodeAt(++h);g=65536+((g&1023)<<10)|m&1023}if(ie[t>>2]=g,t+=4,t+4>p)break}return ie[t>>2]=0,t-l}function _n(e){for(var t=0,o=0;o<e.length;++o){var l=e.charCodeAt(o);l>=55296&&l<=57343&&++o,t+=4}return t}function mn(e,t,o){o=de(o);var l,p,h,g,m;t===2?(l=Ar,p=vn,g=hn,h=()=>oe,m=1):t===4&&(l=gn,p=yn,g=_n,h=()=>he,m=2),ze(e,{name:o,fromWireType:function(P){for(var S=he[P>>2],I=h(),B,V=P+4,te=0;te<=S;++te){var Z=P+4+te*t;if(te==S||I[Z>>m]==0){var ve=Z-V,Oe=l(V,ve);B===void 0?B=Oe:(B+="\0",B+=Oe),V=Z+t}}return j(P),B},toWireType:function(P,S){typeof S!="string"&&Q("Cannot pass non-string to C++ string type "+o);var I=g(S),B=x(4+I+t);return he[B>>2]=I>>m,p(S,B+4,I+t),P!==null&&P.push(j,B),B},argPackAdvance:8,readValueFromPointer:ge,destructorFunction:function(P){j(P)}})}function bn(e,t,o,l,p,h){ke[e]={name:de(t),rawConstructor:Ie(o,l),rawDestructor:Ie(p,h),fields:[]}}function zr(e,t,o,l,p,h,g,m,P,S){ke[e].fields.push({fieldName:de(t),getterReturnType:o,getter:Ie(l,p),getterContext:h,setterArgumentType:g,setter:Ie(m,P),setterContext:S})}function wn(e,t){t=de(t),ze(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:function(){},toWireType:function(o,l){}})}function qr(){throw 1/0}var Gr={};function Pn(e){var t=Gr[e];return t===void 0?de(e):t}function $r(){return typeof globalThis=="object"?globalThis:function(){return Function}()("return this")()}function Jr(e){return e===0?Pt.toHandle($r()):(e=Pn(e),Pt.toHandle($r()[e]))}function Xr(e){e>4&&(xe[e].refcount+=1)}function Rr(e,t){var o=tt[e];return o===void 0&&Q(t+" has unknown type "+Ht(e)),o}function Tn(e){for(var t="",o=0;o<e;++o)t+=(o!==0?", ":"")+"arg"+o;for(var l=()=>he,p="return function emval_allocator_"+e+`(constructor, argTypes, args) {
var HEAPU32 = getMemory();
`,o=0;o<e;++o)p+="var argType"+o+" = requireRegisteredType(HEAPU32[((argTypes)>>2)], 'parameter "+o+`');
var arg`+o+" = argType"+o+`.readValueFromPointer(args);
args += argType`+o+`['argPackAdvance'];
argTypes += 4;
`;return p+="var obj = new constructor("+t+`);
return valueToHandle(obj);
}
`,new Function("requireRegisteredType","Module","valueToHandle","getMemory",p)(Rr,r,Pt.toHandle,l)}var Yr={};function Cn(e,t,o,l){e=Pt.toValue(e);var p=Yr[t];return p||(p=Tn(t),Yr[t]=p),p(e,o,l)}function Kr(e,t){e=Rr(e,"_emval_take_value");var o=e.readValueFromPointer(t);return Pt.toHandle(o)}function An(){at("")}function $n(e,t,o){ue.copyWithin(e,t,t+o)}function Rn(){return 2147483648}function En(e){try{return it.grow(e-le.byteLength+65535>>>16),zt(it.buffer),1}catch{}}function Er(e){var t=ue.length;e=e>>>0;var o=Rn();if(e>o)return!1;let l=(P,S)=>P+(S-P%S)%S;for(var p=1;p<=4;p*=2){var h=t*(1+.2/p);h=Math.min(h,e+100663296);var g=Math.min(o,l(Math.max(e,h),65536)),m=En(g);if(m)return!0}return!1}var Sr={};function Dt(){return N||"./this.program"}function Mt(){if(!Mt.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Dt()};for(var o in Sr)Sr[o]===void 0?delete t[o]:t[o]=Sr[o];var l=[];for(var o in t)l.push(o+"="+t[o]);Mt.strings=l}return Mt.strings}function yt(e,t,o){for(var l=0;l<e.length;++l)ce[t++>>0]=e.charCodeAt(l);ce[t>>0]=0}function Qr(e,t){var o=0;return Mt().forEach(function(l,p){var h=t+o;he[e+p*4>>2]=h,yt(l,h),o+=l.length+1}),0}function Zr(e,t){var o=Mt();he[e>>2]=o.length;var l=0;return o.forEach(function(p){l+=p.length+1}),he[t>>2]=l,0}function Fr(e){M(e,new ar(e))}function en(e,t){Fr(e)}var pr=en;function tn(e){return 52}function u(e,t,o,l,p){return 70}var f=[null,[],[]];function v(e,t){var o=f[e];t===0||t===10?((e===1?se:_e)(nr(o,0)),o.length=0):o.push(t)}function w(e,t,o,l){for(var p=0,h=0;h<o;h++){var g=he[t>>2],m=he[t+4>>2];t+=8;for(var P=0;P<m;P++)v(e,ue[g+P]);p+=m}return he[l>>2]=p,0}function C(e){var t=r["_"+e];return t}function F(e,t){ce.set(e,t)}function k(e,t,o,l,p){var h={string:Z=>{var ve=0;if(Z!=null&&Z!==0){var Oe=(Z.length<<2)+1;ve=a(Oe),Ge(Z,ve,Oe)}return ve},array:Z=>{var ve=a(Z.length);return F(Z,ve),ve}};function g(Z){return t==="string"?vr(Z):t==="boolean"?!!Z:Z}var m=C(e),P=[],S=0;if(l)for(var I=0;I<l.length;I++){var B=h[o[I]];B?(S===0&&(S=K()),P[I]=B(l[I])):P[I]=l[I]}var V=m.apply(null,P);function te(Z){return S!==0&&s(S),g(Z)}return V=te(V),V}jt=r.InternalError=He(Error,"InternalError"),Et(),re=r.BindingError=He(Error,"BindingError"),Ve(),Xt(),rt(),Tr=r.UnboundTypeError=He(Error,"UnboundTypeError"),qe();var A={g:_t,A:$t,w:Rt,F:ut,u:Zt,t:be,c:er,E:Cr,m:Vr,b:pn,a:Br,l:rr,h:mn,J:bn,d:zr,G:wn,x:qr,i:Lr,r:Jr,p:Xr,q:Cn,s:Kr,j:An,D:$n,y:Er,z:Qr,B:Zr,I:pr,C:tn,v:u,k:w,o:T,n:E,H:D,f:b,e:O};yr(),r.___wasm_call_ctors=function(){return(r.___wasm_call_ctors=r.asm.L).apply(null,arguments)};var x=r._malloc=function(){return(x=r._malloc=r.asm.N).apply(null,arguments)},j=r._free=function(){return(j=r._free=r.asm.O).apply(null,arguments)},G=r.___getTypeName=function(){return(G=r.___getTypeName=r.asm.P).apply(null,arguments)};r.__embind_initialize_bindings=function(){return(r.__embind_initialize_bindings=r.asm.Q).apply(null,arguments)};var J=r._setThrew=function(){return(J=r._setThrew=r.asm.R).apply(null,arguments)},K=r.stackSave=function(){return(K=r.stackSave=r.asm.S).apply(null,arguments)},s=r.stackRestore=function(){return(s=r.stackRestore=r.asm.T).apply(null,arguments)},a=r.stackAlloc=function(){return(a=r.stackAlloc=r.asm.U).apply(null,arguments)},d=r.___cxa_is_pointer_type=function(){return(d=r.___cxa_is_pointer_type=r.asm.V).apply(null,arguments)};r.dynCall_jiji=function(){return(r.dynCall_jiji=r.asm.W).apply(null,arguments)};function b(e,t){var o=K();try{Se(e)(t)}catch(l){if(s(o),l!==l+0)throw l;J(1,0)}}function T(e,t){var o=K();try{return Se(e)(t)}catch(l){if(s(o),l!==l+0)throw l;J(1,0)}}function O(e,t,o,l){var p=K();try{Se(e)(t,o,l)}catch(h){if(s(p),h!==h+0)throw h;J(1,0)}}function D(e,t,o,l){var p=K();try{return Se(e)(t,o,l)}catch(h){if(s(p),h!==h+0)throw h;J(1,0)}}function E(e,t,o){var l=K();try{return Se(e)(t,o)}catch(p){if(s(l),p!==p+0)throw p;J(1,0)}}r.ccall=k;var n;ot=function e(){n||i(),n||(ot=e)};function i(e){if(Ye>0||(nn(),Ye>0))return;function t(){n||(n=!0,r.calledRun=!0,!Vt&&(on(),L(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),an()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),t()},1)):t()}if(r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return i(),$.ready}})();c.exports=_})(ci);var Li=ci.exports,Vi=zn(Li);const Bi=new URL("/static/dv3d/assets/libjpegturbowasm_decode-daqMmuVl.wasm",import.meta.url),Ln={codec:void 0,decoder:void 0};function Ni(){if(Ln.codec)return Promise.resolve();const c=Vi({locateFile:y=>y.endsWith(".wasm")?Bi.toString():y});return new Promise((y,_)=>{c.then(R=>{Ln.codec=R,Ln.decoder=new R.JPEGDecoder,y()},_)})}async function zi(c,y){await Ni();const _=Ln.decoder;_.getEncodedBuffer(c.length).set(c),_.decode();const $=_.getFrameInfo(),r=_.getDecodedBuffer(),L={columns:$.width,rows:$.height,bitsPerPixel:$.bitsPerSample,signed:y.signed,bytesPerPixel:y.bytesPerPixel,componentsPerPixel:$.componentCount},U=qi($,r),W={frameInfo:$};return{...y,pixelData:U,imageInfo:L,encodeOptions:W,...W,...L}}function qi(c,y){return c.isSigned?new Int8Array(y.buffer,y.byteOffset,y.byteLength):new Uint8Array(y.buffer,y.byteOffset,y.byteLength)}const In={JpegImage:void 0,decodeConfig:{}};function Gi(c){return In.decodeConfig=c,In.JpegImage?Promise.resolve():new Promise((y,_)=>{import("./jpeg-BQEpTZHd.js").then(R=>{In.JpegImage=R.default,y()}).catch(_)})}async function Ji(c,y){if(await Gi(),typeof In.JpegImage>"u")throw new Error("No JPEG Baseline decoder loaded");const _=new In.JpegImage;if(_.parse(y),_.colorTransform=!1,c.bitsAllocated===8)return c.pixelData=_.getData(c.columns,c.rows),c;if(c.bitsAllocated===16)return c.pixelData=_.getData16(c.columns,c.rows),c}const jn={jpeg:void 0,decodeConfig:{}};function Xi(c){return jn.decodeConfig=c,jn.jpeg?Promise.resolve():new Promise((y,_)=>{import("./lossless-BIYWXcdg.js").then(({Decoder:R})=>{const $=new R;jn.jpeg=$,y()},_)})}async function ei(c,y){if(await Xi(),typeof jn.jpeg>"u")throw new Error("No JPEG Lossless decoder loaded");const _=c.bitsAllocated<=8?1:2,R=y.buffer,$=jn.jpeg.decode(R,y.byteOffset,y.length,_);return c.pixelRepresentation===0?c.bitsAllocated===16?(c.pixelData=new Uint16Array($.buffer),c):(c.pixelData=new Uint8Array($.buffer),c):(c.pixelData=new Int16Array($.buffer),c)}var li={exports:{}};(function(c,y){var _=(()=>{var R=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(R=R||__filename),function($){$=$||{};var r=typeof $<"u"?$:{},L,U;r.ready=new Promise(function(u,f){L=u,U=f});var W=Object.assign({},r),N=typeof window=="object",M=typeof importScripts=="function",z=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",H="";function X(u){return r.locateFile?r.locateFile(u,H):H+u}var q,ee,fe;if(z){var $e=rn,pe=rn;M?H=pe.dirname(H)+"/":H=__dirname+"/",q=(u,f)=>(u=at(u)?new URL(u):pe.normalize(u),$e.readFileSync(u,f?void 0:"utf8")),fe=u=>{var f=q(u,!0);return f.buffer||(f=new Uint8Array(f)),f},ee=(u,f,v)=>{u=at(u)?new URL(u):pe.normalize(u),$e.readFile(u,function(w,C){w?v(w):f(C.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(u){if(!(u instanceof Dr))throw u}),process.on("unhandledRejection",function(u){throw u}),r.inspect=function(){return"[Emscripten Module object]"}}else(N||M)&&(M?H=self.location.href:typeof document<"u"&&document.currentScript&&(H=document.currentScript.src),R&&(H=R),H.indexOf("blob:")!==0?H=H.substr(0,H.replace(/[?#].*/,"").lastIndexOf("/")+1):H="",q=u=>{var f=new XMLHttpRequest;return f.open("GET",u,!1),f.send(null),f.responseText},M&&(fe=u=>{var f=new XMLHttpRequest;return f.open("GET",u,!1),f.responseType="arraybuffer",f.send(null),new Uint8Array(f.response)}),ee=(u,f,v)=>{var w=new XMLHttpRequest;w.open("GET",u,!0),w.responseType="arraybuffer",w.onload=()=>{if(w.status==200||w.status==0&&w.response){f(w.response);return}v()},w.onerror=v,w.send(null)});r.print||console.log.bind(console);var we=r.printErr||console.warn.bind(console);Object.assign(r,W),W=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit;var ye;r.wasmBinary&&(ye=r.wasmBinary),r.noExitRuntime,typeof WebAssembly!="object"&&ot("no native wasm support detected");var se,_e=!1;function Re(u,f){u||ot(f)}var it=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Vt(u,f,v){for(var w=f+v,C=f;u[C]&&!(C>=w);)++C;if(C-f>16&&u.buffer&&it)return it.decode(u.subarray(f,C));for(var F="";f<C;){var k=u[f++];if(!(k&128)){F+=String.fromCharCode(k);continue}var A=u[f++]&63;if((k&224)==192){F+=String.fromCharCode((k&31)<<6|A);continue}var x=u[f++]&63;if((k&240)==224?k=(k&15)<<12|A<<6|x:k=(k&7)<<18|A<<12|x<<6|u[f++]&63,k<65536)F+=String.fromCharCode(k);else{var j=k-65536;F+=String.fromCharCode(55296|j>>10,56320|j&1023)}}return F}function xt(u,f){return u?Vt(me,u,f):""}function Tt(u,f,v,w){if(!(w>0))return 0;for(var C=v,F=v+w-1,k=0;k<u.length;++k){var A=u.charCodeAt(k);if(A>=55296&&A<=57343){var x=u.charCodeAt(++k);A=65536+((A&1023)<<10)|x&1023}if(A<=127){if(v>=F)break;f[v++]=A}else if(A<=2047){if(v+1>=F)break;f[v++]=192|A>>6,f[v++]=128|A&63}else if(A<=65535){if(v+2>=F)break;f[v++]=224|A>>12,f[v++]=128|A>>6&63,f[v++]=128|A&63}else{if(v+3>=F)break;f[v++]=240|A>>18,f[v++]=128|A>>12&63,f[v++]=128|A>>6&63,f[v++]=128|A&63}}return f[v]=0,v-C}function nr(u,f,v){return Tt(u,me,f,v)}function vr(u){for(var f=0,v=0;v<u.length;++v){var w=u.charCodeAt(v);w<=127?f++:w<=2047?f+=2:w>=55296&&w<=57343?(f+=4,++v):f+=3}return f}var ir,Ge,me,le,ce,ue,ne,oe,ie;function he(u){ir=u,r.HEAP8=Ge=new Int8Array(u),r.HEAP16=le=new Int16Array(u),r.HEAP32=ue=new Int32Array(u),r.HEAPU8=me=new Uint8Array(u),r.HEAPU16=ce=new Uint16Array(u),r.HEAPU32=ne=new Uint32Array(u),r.HEAPF32=oe=new Float32Array(u),r.HEAPF64=ie=new Float64Array(u)}r.INITIAL_MEMORY;var Bt,Nt=[],zt=[],qt=[];function or(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)nn(r.preRun.shift());gr(Nt)}function hr(){gr(zt)}function kr(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)an(r.postRun.shift());gr(qt)}function nn(u){Nt.unshift(u)}function on(u){zt.unshift(u)}function an(u){qt.unshift(u)}var Ct=0,Je=null;function Xe(u){Ct++,r.monitorRunDependencies&&r.monitorRunDependencies(Ct)}function Ye(u){if(Ct--,r.monitorRunDependencies&&r.monitorRunDependencies(Ct),Ct==0&&Je){var f=Je;Je=null,f()}}function ot(u){r.onAbort&&r.onAbort(u),u="Aborted("+u+")",we(u),_e=!0,u+=". Build with -sASSERTIONS for more info.";var f=new WebAssembly.RuntimeError(u);throw U(f),f}var Ot="data:application/octet-stream;base64,";function Ut(u){return u.startsWith(Ot)}function at(u){return u.startsWith("file://")}var Te;Te="charlswasm_decode.wasm",Ut(Te)||(Te=X(Te));function Pe(u){try{if(u==Te&&ye)return new Uint8Array(ye);if(fe)return fe(u);throw"both async and sync fetching of the wasm failed"}catch(f){ot(f)}}function Ce(){if(!ye&&(N||M)){if(typeof fetch=="function"&&!at(Te))return fetch(Te,{credentials:"same-origin"}).then(function(u){if(!u.ok)throw"failed to load wasm binary file at '"+Te+"'";return u.arrayBuffer()}).catch(function(){return Pe(Te)});if(ee)return new Promise(function(u,f){ee(Te,function(v){u(new Uint8Array(v))},f)})}return Promise.resolve().then(function(){return Pe(Te)})}function Fe(){var u={a:Sr};function f(k,A){var x=k.exports;r.asm=x,se=r.asm.z,he(se.buffer),Bt=r.asm.C,on(r.asm.A),Ye()}Xe();function v(k){f(k.instance)}function w(k){return Ce().then(function(A){return WebAssembly.instantiate(A,u)}).then(function(A){return A}).then(k,function(A){we("failed to asynchronously prepare wasm: "+A),ot(A)})}function C(){return!ye&&typeof WebAssembly.instantiateStreaming=="function"&&!Ut(Te)&&!at(Te)&&!z&&typeof fetch=="function"?fetch(Te,{credentials:"same-origin"}).then(function(k){var A=WebAssembly.instantiateStreaming(k,u);return A.then(v,function(x){return we("wasm streaming compile failed: "+x),we("falling back to ArrayBuffer instantiation"),w(v)})}):w(v)}if(r.instantiateWasm)try{var F=r.instantiateWasm(u,f);return F}catch(k){we("Module.instantiateWasm callback failed with error: "+k),U(k)}return C().catch(U),{}}function Dr(u){this.name="ExitStatus",this.message="Program terminated with exit("+u+")",this.status=u}function gr(u){for(;u.length>0;)u.shift()(r)}function yr(u){this.excPtr=u,this.ptr=u-24,this.set_type=function(f){ne[this.ptr+4>>2]=f},this.get_type=function(){return ne[this.ptr+4>>2]},this.set_destructor=function(f){ne[this.ptr+8>>2]=f},this.get_destructor=function(){return ne[this.ptr+8>>2]},this.set_refcount=function(f){ue[this.ptr>>2]=f},this.set_caught=function(f){f=f?1:0,Ge[this.ptr+12>>0]=f},this.get_caught=function(){return Ge[this.ptr+12>>0]!=0},this.set_rethrown=function(f){f=f?1:0,Ge[this.ptr+13>>0]=f},this.get_rethrown=function(){return Ge[this.ptr+13>>0]!=0},this.init=function(f,v){this.set_adjusted_ptr(0),this.set_type(f),this.set_destructor(v),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var f=ue[this.ptr>>2];ue[this.ptr>>2]=f+1},this.release_ref=function(){var f=ue[this.ptr>>2];return ue[this.ptr>>2]=f-1,f===1},this.set_adjusted_ptr=function(f){ne[this.ptr+16>>2]=f},this.get_adjusted_ptr=function(){return ne[this.ptr+16>>2]},this.get_exception_ptr=function(){var f=en(this.get_type());if(f)return ne[this.excPtr>>2];var v=this.get_adjusted_ptr();return v!==0?v:this.excPtr}}function ar(u,f,v){var w=new yr(u);throw w.init(f,v),u}var At={};function xr(u){for(;u.length;){var f=u.pop(),v=u.pop();v(f)}}function _t(u){return this.fromWireType(ue[u>>2])}var ke={},De={},ge={},Ne=48,tt=57;function st(u){if(u===void 0)return"_unknown";u=u.replace(/[^a-zA-Z0-9_]/g,"$");var f=u.charCodeAt(0);return f>=Ne&&f<=tt?"_"+u:u}function _r(u,f){return u=st(u),new Function("body","return function "+u+`() {
"use strict"; return body.apply(this, arguments);
};
`)(f)}function Gt(u,f){var v=_r(f,function(w){this.name=f,this.message=w;var C=new Error(w).stack;C!==void 0&&(this.stack=this.toString()+`
`+C.replace(/^Error(:[^\n]*)?\n/,""))});return v.prototype=Object.create(u.prototype),v.prototype.constructor=v,v.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},v}var It=void 0;function mt(u){throw new It(u)}function He(u,f,v){u.forEach(function(A){ge[A]=f});function w(A){var x=v(A);x.length!==u.length&&mt("Mismatched type converter count");for(var j=0;j<u.length;++j)de(u[j],x[j])}var C=new Array(f.length),F=[],k=0;f.forEach((A,x)=>{De.hasOwnProperty(A)?C[x]=De[A]:(F.push(A),ke.hasOwnProperty(A)||(ke[A]=[]),ke[A].push(()=>{C[x]=De[A],++k,k===F.length&&w(C)}))}),F.length===0&&w(C)}function jt(u){var f=At[u];delete At[u];var v=f.rawConstructor,w=f.rawDestructor,C=f.fields,F=C.map(k=>k.getterReturnType).concat(C.map(k=>k.setterArgumentType));He([u],F,k=>{var A={};return C.forEach((x,j)=>{var G=x.fieldName,J=k[j],K=x.getter,s=x.getterContext,a=k[j+C.length],d=x.setter,b=x.setterContext;A[G]={read:T=>J.fromWireType(K(s,T)),write:(T,O)=>{var D=[];d(b,T,a.toWireType(D,O)),xr(D)}}}),[{name:f.name,fromWireType:function(x){var j={};for(var G in A)j[G]=A[G].read(x);return w(x),j},toWireType:function(x,j){for(var G in A)if(!(G in j))throw new TypeError('Missing field: "'+G+'"');var J=v();for(G in A)A[G].write(J,j[G]);return x!==null&&x.push(w,J),J},argPackAdvance:8,readValueFromPointer:_t,destructorFunction:w}]})}function Me(u,f,v,w,C){}function Le(u){switch(u){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+u)}}function $t(){for(var u=new Array(256),f=0;f<256;++f)u[f]=String.fromCharCode(f);Rt=u}var Rt=void 0;function Ae(u){for(var f="",v=u;me[v];)f+=Rt[me[v++]];return f}var Et=void 0;function Y(u){throw new Et(u)}function de(u,f,v={}){if(!("argPackAdvance"in f))throw new TypeError("registerType registeredInstance requires argPackAdvance");var w=f.name;if(u||Y('type "'+w+'" must have a positive integer typeid pointer'),De.hasOwnProperty(u)){if(v.ignoreDuplicateRegistrations)return;Y("Cannot register type '"+w+"' twice")}if(De[u]=f,delete ge[u],ke.hasOwnProperty(u)){var C=ke[u];delete ke[u],C.forEach(F=>F())}}function re(u,f,v,w,C){var F=Le(v);f=Ae(f),de(u,{name:f,fromWireType:function(k){return!!k},toWireType:function(k,A){return A?w:C},argPackAdvance:8,readValueFromPointer:function(k){var A;if(v===1)A=Ge;else if(v===2)A=le;else if(v===4)A=ue;else throw new TypeError("Unknown boolean type size: "+f);return this.fromWireType(A[k>>F])},destructorFunction:null})}function Q(u){if(!(this instanceof wt)||!(u instanceof wt))return!1;for(var f=this.$$.ptrType.registeredClass,v=this.$$.ptr,w=u.$$.ptrType.registeredClass,C=u.$$.ptr;f.baseClass;)v=f.upcast(v),f=f.baseClass;for(;w.baseClass;)C=w.upcast(C),w=w.baseClass;return f===w&&v===C}function ze(u){return{count:u.count,deleteScheduled:u.deleteScheduled,preservePointerOnDelete:u.preservePointerOnDelete,ptr:u.ptr,ptrType:u.ptrType,smartPtr:u.smartPtr,smartPtrType:u.smartPtrType}}function ut(u){function f(v){return v.$$.ptrType.registeredClass.name}Y(f(u)+" instance already deleted")}var mr=!1;function sr(u){}function St(u){u.smartPtr?u.smartPtrType.rawDestructor(u.smartPtr):u.ptrType.registeredClass.rawDestructor(u.ptr)}function Jt(u){u.count.value-=1;var f=u.count.value===0;f&&St(u)}function ur(u,f,v){if(f===v)return u;if(v.baseClass===void 0)return null;var w=ur(u,f,v.baseClass);return w===null?null:v.downcast(w)}var Ee={};function bt(){return Object.keys(Ke).length}function ae(){var u=[];for(var f in Ke)Ke.hasOwnProperty(f)&&u.push(Ke[f]);return u}var Ue=[];function br(){for(;Ue.length;){var u=Ue.pop();u.$$.deleteScheduled=!1,u.delete()}}var ft=void 0;function Ft(u){ft=u,Ue.length&&ft&&ft(br)}function ct(){r.getInheritedInstanceCount=bt,r.getLiveInheritedInstances=ae,r.flushPendingDeletes=br,r.setDelayFunction=Ft}var Ke={};function Or(u,f){for(f===void 0&&Y("ptr should not be undefined");u.baseClass;)f=u.upcast(f),u=u.baseClass;return f}function Xt(u,f){return f=Or(u,f),Ke[f]}function lt(u,f){(!f.ptrType||!f.ptr)&&mt("makeClassHandle requires ptr and ptrType");var v=!!f.smartPtrType,w=!!f.smartPtr;return v!==w&&mt("Both smartPtrType and smartPtr must be specified"),f.count={value:1},dt(Object.create(u,{$$:{value:f}}))}function Ur(u){var f=this.getPointee(u);if(!f)return this.destructor(u),null;var v=Xt(this.registeredClass,f);if(v!==void 0){if(v.$$.count.value===0)return v.$$.ptr=f,v.$$.smartPtr=u,v.clone();var w=v.clone();return this.destructor(u),w}function C(){return this.isSmartPointer?lt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:f,smartPtrType:this,smartPtr:u}):lt(this.registeredClass.instancePrototype,{ptrType:this,ptr:u})}var F=this.registeredClass.getActualType(f),k=Ee[F];if(!k)return C.call(this);var A;this.isConst?A=k.constPointerType:A=k.pointerType;var x=ur(f,this.registeredClass,A.registeredClass);return x===null?C.call(this):this.isSmartPointer?lt(A.registeredClass.instancePrototype,{ptrType:A,ptr:x,smartPtrType:this,smartPtr:u}):lt(A.registeredClass.instancePrototype,{ptrType:A,ptr:x})}function dt(u){return typeof FinalizationRegistry>"u"?(dt=f=>f,u):(mr=new FinalizationRegistry(f=>{Jt(f.$$)}),dt=f=>{var v=f.$$,w=!!v.smartPtr;if(w){var C={$$:v};mr.register(f,C,f)}return f},sr=f=>mr.unregister(f),dt(u))}function fr(){if(this.$$.ptr||ut(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var u=dt(Object.create(Object.getPrototypeOf(this),{$$:{value:ze(this.$$)}}));return u.$$.count.value+=1,u.$$.deleteScheduled=!1,u}function Yt(){this.$$.ptr||ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Y("Object already scheduled for deletion"),sr(this),Jt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function pt(){return!this.$$.ptr}function wr(){return this.$$.ptr||ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Y("Object already scheduled for deletion"),Ue.push(this),Ue.length===1&&ft&&ft(br),this.$$.deleteScheduled=!0,this}function Kt(){wt.prototype.isAliasOf=Q,wt.prototype.clone=fr,wt.prototype.delete=Yt,wt.prototype.isDeleted=pt,wt.prototype.deleteLater=wr}function wt(){}function Ir(u,f,v){if(u[f].overloadTable===void 0){var w=u[f];u[f]=function(){return u[f].overloadTable.hasOwnProperty(arguments.length)||Y("Function '"+v+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+u[f].overloadTable+")!"),u[f].overloadTable[arguments.length].apply(this,arguments)},u[f].overloadTable=[],u[f].overloadTable[w.argCount]=w}}function Ve(u,f,v){r.hasOwnProperty(u)?((v===void 0||r[u].overloadTable!==void 0&&r[u].overloadTable[v]!==void 0)&&Y("Cannot register public name '"+u+"' twice"),Ir(r,u,u),r.hasOwnProperty(v)&&Y("Cannot register multiple overloads of a function with the same number of arguments ("+v+")!"),r[u].overloadTable[v]=f):(r[u]=f,v!==void 0&&(r[u].numArguments=v))}function vt(u,f,v,w,C,F,k,A){this.name=u,this.constructor=f,this.instancePrototype=v,this.rawDestructor=w,this.baseClass=C,this.getActualType=F,this.upcast=k,this.downcast=A,this.pureVirtualFunctions=[]}function cr(u,f,v){for(;f!==v;)f.upcast||Y("Expected null or instance of "+v.name+", got an instance of "+f.name),u=f.upcast(u),f=f.baseClass;return u}function lr(u,f){if(f===null)return this.isReference&&Y("null is not a valid "+this.name),0;f.$$||Y('Cannot pass "'+qe(f)+'" as a '+this.name),f.$$.ptr||Y("Cannot pass deleted object as a pointer of type "+this.name);var v=f.$$.ptrType.registeredClass,w=cr(f.$$.ptr,v,this.registeredClass);return w}function Pr(u,f){var v;if(f===null)return this.isReference&&Y("null is not a valid "+this.name),this.isSmartPointer?(v=this.rawConstructor(),u!==null&&u.push(this.rawDestructor,v),v):0;f.$$||Y('Cannot pass "'+qe(f)+'" as a '+this.name),f.$$.ptr||Y("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&f.$$.ptrType.isConst&&Y("Cannot convert argument of type "+(f.$$.smartPtrType?f.$$.smartPtrType.name:f.$$.ptrType.name)+" to parameter type "+this.name);var w=f.$$.ptrType.registeredClass;if(v=cr(f.$$.ptr,w,this.registeredClass),this.isSmartPointer)switch(f.$$.smartPtr===void 0&&Y("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:f.$$.smartPtrType===this?v=f.$$.smartPtr:Y("Cannot convert argument of type "+(f.$$.smartPtrType?f.$$.smartPtrType.name:f.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:v=f.$$.smartPtr;break;case 2:if(f.$$.smartPtrType===this)v=f.$$.smartPtr;else{var C=f.clone();v=this.rawShare(v,nt.toHandle(function(){C.delete()})),u!==null&&u.push(this.rawDestructor,v)}break;default:Y("Unsupporting sharing policy")}return v}function kt(u,f){if(f===null)return this.isReference&&Y("null is not a valid "+this.name),0;f.$$||Y('Cannot pass "'+qe(f)+'" as a '+this.name),f.$$.ptr||Y("Cannot pass deleted object as a pointer of type "+this.name),f.$$.ptrType.isConst&&Y("Cannot convert argument of type "+f.$$.ptrType.name+" to parameter type "+this.name);var v=f.$$.ptrType.registeredClass,w=cr(f.$$.ptr,v,this.registeredClass);return w}function sn(u){return this.rawGetPointee&&(u=this.rawGetPointee(u)),u}function un(u){this.rawDestructor&&this.rawDestructor(u)}function fn(u){u!==null&&u.delete()}function cn(){ht.prototype.getPointee=sn,ht.prototype.destructor=un,ht.prototype.argPackAdvance=8,ht.prototype.readValueFromPointer=_t,ht.prototype.deleteObject=fn,ht.prototype.fromWireType=Ur}function ht(u,f,v,w,C,F,k,A,x,j,G){this.name=u,this.registeredClass=f,this.isReference=v,this.isConst=w,this.isSmartPointer=C,this.pointeeType=F,this.sharingPolicy=k,this.rawGetPointee=A,this.rawConstructor=x,this.rawShare=j,this.rawDestructor=G,!C&&f.baseClass===void 0?w?(this.toWireType=lr,this.destructorFunction=null):(this.toWireType=kt,this.destructorFunction=null):this.toWireType=Pr}function gt(u,f,v){r.hasOwnProperty(u)||mt("Replacing nonexistant public symbol"),r[u].overloadTable!==void 0&&v!==void 0?r[u].overloadTable[v]=f:(r[u]=f,r[u].argCount=v)}function rt(u,f,v){var w=r["dynCall_"+u];return v&&v.length?w.apply(null,[f].concat(v)):w.call(null,f)}var Be=[];function jr(u){var f=Be[u];return f||(u>=Be.length&&(Be.length=u+1),Be[u]=f=Bt.get(u)),f}function Wt(u,f,v){if(u.includes("j"))return rt(u,f,v);var w=jr(f).apply(null,v);return w}function Qt(u,f){var v=[];return function(){return v.length=0,Object.assign(v,arguments),Wt(u,f,v)}}function Se(u,f){u=Ae(u);function v(){return u.includes("j")?Qt(u,f):jr(f)}var w=v();return typeof w!="function"&&Y("unknown function pointer with signature "+u+": "+f),w}var Wr=void 0;function Qe(u){var f=Mt(u),v=Ae(f);return yt(f),v}function Ie(u,f){var v=[],w={};function C(F){if(!w[F]&&!De[F]){if(ge[F]){ge[F].forEach(C);return}v.push(F),w[F]=!0}}throw f.forEach(C),new Wr(u+": "+v.map(Qe).join([", "]))}function Tr(u,f,v,w,C,F,k,A,x,j,G,J,K){G=Ae(G),F=Se(C,F),A&&(A=Se(k,A)),j&&(j=Se(x,j)),K=Se(J,K);var s=st(G);Ve(s,function(){Ie("Cannot construct "+G+" due to unbound types",[w])}),He([u,f,v],w?[w]:[],function(a){a=a[0];var d,b;w?(d=a.registeredClass,b=d.instancePrototype):b=wt.prototype;var T=_r(s,function(){if(Object.getPrototypeOf(this)!==O)throw new Et("Use 'new' to construct "+G);if(D.constructor_body===void 0)throw new Et(G+" has no accessible constructor");var e=D.constructor_body[arguments.length];if(e===void 0)throw new Et("Tried to invoke ctor of "+G+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(D.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)}),O=Object.create(b,{constructor:{value:T}});T.prototype=O;var D=new vt(G,T,O,K,d,F,A,j),E=new ht(G,D,!0,!1,!1),n=new ht(G+"*",D,!1,!1,!1),i=new ht(G+" const*",D,!1,!0,!1);return Ee[u]={pointerType:n,constPointerType:i},gt(s,T),[E,n,i]})}function Ht(u,f){for(var v=[],w=0;w<u;w++)v.push(ne[f+w*4>>2]);return v}function Ze(u,f){if(!(u instanceof Function))throw new TypeError("new_ called with constructor type "+typeof u+" which is not a function");var v=_r(u.name||"unknownFunctionName",function(){});v.prototype=u.prototype;var w=new v,C=u.apply(w,f);return C instanceof Object?C:w}function Zt(u,f,v,w,C){var F=f.length;F<2&&Y("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var k=f[1]!==null&&v!==null,A=!1,x=1;x<f.length;++x)if(f[x]!==null&&f[x].destructorFunction===void 0){A=!0;break}for(var j=f[0].name!=="void",G="",J="",x=0;x<F-2;++x)G+=(x!==0?", ":"")+"arg"+x,J+=(x!==0?", ":"")+"arg"+x+"Wired";var K="return function "+st(u)+"("+G+`) {
if (arguments.length !== `+(F-2)+`) {
throwBindingError('function `+u+" called with ' + arguments.length + ' arguments, expected "+(F-2)+` args!');
}
`;A&&(K+=`var destructors = [];
`);var s=A?"destructors":"null",a=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],d=[Y,w,C,xr,f[0],f[1]];k&&(K+="var thisWired = classParam.toWireType("+s+`, this);
`);for(var x=0;x<F-2;++x)K+="var arg"+x+"Wired = argType"+x+".toWireType("+s+", arg"+x+"); // "+f[x+2].name+`
`,a.push("argType"+x),d.push(f[x+2]);if(k&&(J="thisWired"+(J.length>0?", ":"")+J),K+=(j?"var rv = ":"")+"invoker(fn"+(J.length>0?", ":"")+J+`);
`,A)K+=`runDestructors(destructors);
`;else for(var x=k?1:2;x<f.length;++x){var b=x===1?"thisWired":"arg"+(x-2)+"Wired";f[x].destructorFunction!==null&&(K+=b+"_dtor("+b+"); // "+f[x].name+`
`,a.push(b+"_dtor"),d.push(f[x].destructorFunction))}j&&(K+=`var ret = retType.fromWireType(rv);
return ret;
`),K+=`}
`,a.push(K);var T=Ze(Function,a).apply(null,d);return T}function Hr(u,f,v,w,C,F){Re(f>0);var k=Ht(f,v);C=Se(w,C),He([],[u],function(A){A=A[0];var x="constructor "+A.name;if(A.registeredClass.constructor_body===void 0&&(A.registeredClass.constructor_body=[]),A.registeredClass.constructor_body[f-1]!==void 0)throw new Et("Cannot register multiple constructors with identical number of parameters ("+(f-1)+") for class '"+A.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return A.registeredClass.constructor_body[f-1]=()=>{Ie("Cannot construct "+A.name+" due to unbound types",k)},He([],k,function(j){return j.splice(1,0,null),A.registeredClass.constructor_body[f-1]=Zt(x,j,null,C,F),[]}),[]})}function Mr(u,f,v,w,C,F,k,A){var x=Ht(v,w);f=Ae(f),F=Se(C,F),He([],[u],function(j){j=j[0];var G=j.name+"."+f;f.startsWith("@@")&&(f=Symbol[f.substring(2)]),A&&j.registeredClass.pureVirtualFunctions.push(f);function J(){Ie("Cannot call "+G+" due to unbound types",x)}var K=j.registeredClass.instancePrototype,s=K[f];return s===void 0||s.overloadTable===void 0&&s.className!==j.name&&s.argCount===v-2?(J.argCount=v-2,J.className=j.name,K[f]=J):(Ir(K,f,G),K[f].overloadTable[v-2]=J),He([],x,function(a){var d=Zt(G,a,j,F,k);return K[f].overloadTable===void 0?(d.argCount=v-2,K[f]=d):K[f].overloadTable[v-2]=d,[]}),[]})}var dr=[],be=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function er(u){u>4&&--be[u].refcount===0&&(be[u]=void 0,dr.push(u))}function je(){for(var u=0,f=5;f<be.length;++f)be[f]!==void 0&&++u;return u}function xe(){for(var u=5;u<be.length;++u)if(be[u]!==void 0)return be[u];return null}function Lr(){r.count_emval_handles=je,r.get_first_emval=xe}var nt={toValue:u=>(u||Y("Cannot use deleted val. handle = "+u),be[u].value),toHandle:u=>{switch(u){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var f=dr.length?dr.pop():be.length;return be[f]={refcount:1,value:u},f}}}};function ln(u,f){f=Ae(f),de(u,{name:f,fromWireType:function(v){var w=nt.toValue(v);return er(v),w},toWireType:function(v,w){return nt.toHandle(w)},argPackAdvance:8,readValueFromPointer:_t,destructorFunction:null})}function qe(u){if(u===null)return"null";var f=typeof u;return f==="object"||f==="array"||f==="function"?u.toString():""+u}function Pt(u,f){switch(f){case 2:return function(v){return this.fromWireType(oe[v>>2])};case 3:return function(v){return this.fromWireType(ie[v>>3])};default:throw new TypeError("Unknown float type: "+u)}}function Cr(u,f,v){var w=Le(v);f=Ae(f),de(u,{name:f,fromWireType:function(C){return C},toWireType:function(C,F){return F},argPackAdvance:8,readValueFromPointer:Pt(f,w),destructorFunction:null})}function tr(u,f,v,w,C,F){var k=Ht(f,v);u=Ae(u),C=Se(w,C),Ve(u,function(){Ie("Cannot call "+u+" due to unbound types",k)},f-1),He([],k,function(A){var x=[A[0],null].concat(A.slice(1));return gt(u,Zt(u,x,null,C,F),f-1),[]})}function et(u,f,v){switch(f){case 0:return v?function(C){return Ge[C]}:function(C){return me[C]};case 1:return v?function(C){return le[C>>1]}:function(C){return ce[C>>1]};case 2:return v?function(C){return ue[C>>2]}:function(C){return ne[C>>2]};default:throw new TypeError("Unknown integer type: "+u)}}function Vr(u,f,v,w,C){f=Ae(f);var F=Le(v),k=J=>J;if(w===0){var A=32-8*v;k=J=>J<<A>>>A}var x=f.includes("unsigned"),j=(J,K)=>{},G;x?G=function(J,K){return j(K,this.name),K>>>0}:G=function(J,K){return j(K,this.name),K},de(u,{name:f,fromWireType:k,toWireType:G,argPackAdvance:8,readValueFromPointer:et(f,F,w!==0),destructorFunction:null})}function dn(u,f,v){var w=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],C=w[f];function F(k){k=k>>2;var A=ne,x=A[k],j=A[k+1];return new C(ir,j,x)}v=Ae(v),de(u,{name:v,fromWireType:F,argPackAdvance:8,readValueFromPointer:F},{ignoreDuplicateRegistrations:!0})}function pn(u,f){f=Ae(f);var v=f==="std::string";de(u,{name:f,fromWireType:function(w){var C=ne[w>>2],F=w+4,k;if(v)for(var A=F,x=0;x<=C;++x){var j=F+x;if(x==C||me[j]==0){var G=j-A,J=xt(A,G);k===void 0?k=J:(k+="\0",k+=J),A=j+1}}else{for(var K=new Array(C),x=0;x<C;++x)K[x]=String.fromCharCode(me[F+x]);k=K.join("")}return yt(w),k},toWireType:function(w,C){C instanceof ArrayBuffer&&(C=new Uint8Array(C));var F,k=typeof C=="string";k||C instanceof Uint8Array||C instanceof Uint8ClampedArray||C instanceof Int8Array||Y("Cannot pass non-string to std::string"),v&&k?F=vr(C):F=C.length;var A=Dt(4+F+1),x=A+4;if(ne[A>>2]=F,v&&k)nr(C,x,F+1);else if(k)for(var j=0;j<F;++j){var G=C.charCodeAt(j);G>255&&(yt(x),Y("String has UTF-16 code units that do not fit in 8 bits")),me[x+j]=G}else for(var j=0;j<F;++j)me[x+j]=C[j];return w!==null&&w.push(yt,A),A},argPackAdvance:8,readValueFromPointer:_t,destructorFunction:function(w){yt(w)}})}var Br=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function rr(u,f){for(var v=u,w=v>>1,C=w+f/2;!(w>=C)&&ce[w];)++w;if(v=w<<1,v-u>32&&Br)return Br.decode(me.subarray(u,v));for(var F="",k=0;!(k>=f/2);++k){var A=le[u+k*2>>1];if(A==0)break;F+=String.fromCharCode(A)}return F}function Nr(u,f,v){if(v===void 0&&(v=2147483647),v<2)return 0;v-=2;for(var w=f,C=v<u.length*2?v/2:u.length,F=0;F<C;++F){var k=u.charCodeAt(F);le[f>>1]=k,f+=2}return le[f>>1]=0,f-w}function Ar(u){return u.length*2}function vn(u,f){for(var v=0,w="";!(v>=f/4);){var C=ue[u+v*4>>2];if(C==0)break;if(++v,C>=65536){var F=C-65536;w+=String.fromCharCode(55296|F>>10,56320|F&1023)}else w+=String.fromCharCode(C)}return w}function hn(u,f,v){if(v===void 0&&(v=2147483647),v<4)return 0;for(var w=f,C=w+v-4,F=0;F<u.length;++F){var k=u.charCodeAt(F);if(k>=55296&&k<=57343){var A=u.charCodeAt(++F);k=65536+((k&1023)<<10)|A&1023}if(ue[f>>2]=k,f+=4,f+4>C)break}return ue[f>>2]=0,f-w}function gn(u){for(var f=0,v=0;v<u.length;++v){var w=u.charCodeAt(v);w>=55296&&w<=57343&&++v,f+=4}return f}function yn(u,f,v){v=Ae(v);var w,C,F,k,A;f===2?(w=rr,C=Nr,k=Ar,F=()=>ce,A=1):f===4&&(w=vn,C=hn,k=gn,F=()=>ne,A=2),de(u,{name:v,fromWireType:function(x){for(var j=ne[x>>2],G=F(),J,K=x+4,s=0;s<=j;++s){var a=x+4+s*f;if(s==j||G[a>>A]==0){var d=a-K,b=w(K,d);J===void 0?J=b:(J+="\0",J+=b),K=a+f}}return yt(x),J},toWireType:function(x,j){typeof j!="string"&&Y("Cannot pass non-string to C++ string type "+v);var G=k(j),J=Dt(4+G+f);return ne[J>>2]=G>>A,C(j,J+4,G+f),x!==null&&x.push(yt,J),J},argPackAdvance:8,readValueFromPointer:_t,destructorFunction:function(x){yt(x)}})}function _n(u,f,v,w,C,F){At[u]={name:Ae(f),rawConstructor:Se(v,w),rawDestructor:Se(C,F),fields:[]}}function mn(u,f,v,w,C,F,k,A,x,j){At[u].fields.push({fieldName:Ae(f),getterReturnType:v,getter:Se(w,C),getterContext:F,setterArgumentType:k,setter:Se(A,x),setterContext:j})}function bn(u,f){f=Ae(f),de(u,{isVoid:!0,name:f,argPackAdvance:0,fromWireType:function(){},toWireType:function(v,w){}})}var zr={};function wn(u){var f=zr[u];return f===void 0?Ae(u):f}function qr(){return typeof globalThis=="object"?globalThis:function(){return Function}()("return this")()}function Gr(u){return u===0?nt.toHandle(qr()):(u=wn(u),nt.toHandle(qr()[u]))}function Pn(u){u>4&&(be[u].refcount+=1)}function $r(u,f){var v=De[u];return v===void 0&&Y(f+" has unknown type "+Qe(u)),v}function Jr(u){for(var f="",v=0;v<u;++v)f+=(v!==0?", ":"")+"arg"+v;for(var w=()=>ne,C="return function emval_allocator_"+u+`(constructor, argTypes, args) {
var HEAPU32 = getMemory();
`,v=0;v<u;++v)C+="var argType"+v+" = requireRegisteredType(HEAPU32[((argTypes)>>2)], 'parameter "+v+`');
var arg`+v+" = argType"+v+`.readValueFromPointer(args);
args += argType`+v+`['argPackAdvance'];
argTypes += 4;
`;return C+="var obj = new constructor("+f+`);
return valueToHandle(obj);
}
`,new Function("requireRegisteredType","Module","valueToHandle","getMemory",C)($r,r,nt.toHandle,w)}var Xr={};function Rr(u,f,v,w){u=nt.toValue(u);var C=Xr[f];return C||(C=Jr(f),Xr[f]=C),C(u,v,w)}function Tn(u,f){u=$r(u,"_emval_take_value");var v=u.readValueFromPointer(f);return nt.toHandle(v)}function Yr(){ot("")}function Cn(u,f,v){me.copyWithin(u,f,f+v)}function Kr(){return 2147483648}function An(u){try{return se.grow(u-ir.byteLength+65535>>>16),he(se.buffer),1}catch{}}function $n(u){var f=me.length;u=u>>>0;var v=Kr();if(u>v)return!1;let w=(x,j)=>x+(j-x%j)%j;for(var C=1;C<=4;C*=2){var F=f*(1+.2/C);F=Math.min(F,u+100663296);var k=Math.min(v,w(Math.max(u,F),65536)),A=An(k);if(A)return!0}return!1}function Rn(u){var f=r["_"+u];return f}function En(u,f){Ge.set(u,f)}function Er(u,f,v,w,C){var F={string:a=>{var d=0;if(a!=null&&a!==0){var b=(a.length<<2)+1;d=Fr(b),nr(a,d,b)}return d},array:a=>{var d=Fr(a.length);return En(a,d),d}};function k(a){return f==="string"?xt(a):f==="boolean"?!!a:a}var A=Rn(u),x=[],j=0;if(w)for(var G=0;G<w.length;G++){var J=F[v[G]];J?(j===0&&(j=Qr()),x[G]=J(w[G])):x[G]=w[G]}var K=A.apply(null,x);function s(a){return j!==0&&Zr(j),k(a)}return K=s(K),K}It=r.InternalError=Gt(Error,"InternalError"),$t(),Et=r.BindingError=Gt(Error,"BindingError"),Kt(),ct(),cn(),Wr=r.UnboundTypeError=Gt(Error,"UnboundTypeError"),Lr();var Sr={h:ar,q:jt,r:Me,w:re,p:Tr,o:Hr,c:Mr,v:ln,k:Cr,e:tr,b:Vr,a:dn,j:pn,g:yn,u:_n,d:mn,x:bn,i:er,m:Gr,l:Pn,y:Rr,n:Tn,f:Yr,t:Cn,s:$n};Fe(),r.___wasm_call_ctors=function(){return(r.___wasm_call_ctors=r.asm.A).apply(null,arguments)};var Dt=r._malloc=function(){return(Dt=r._malloc=r.asm.B).apply(null,arguments)},Mt=r.___getTypeName=function(){return(Mt=r.___getTypeName=r.asm.D).apply(null,arguments)};r.__embind_initialize_bindings=function(){return(r.__embind_initialize_bindings=r.asm.E).apply(null,arguments)};var yt=r._free=function(){return(yt=r._free=r.asm.F).apply(null,arguments)},Qr=r.stackSave=function(){return(Qr=r.stackSave=r.asm.G).apply(null,arguments)},Zr=r.stackRestore=function(){return(Zr=r.stackRestore=r.asm.H).apply(null,arguments)},Fr=r.stackAlloc=function(){return(Fr=r.stackAlloc=r.asm.I).apply(null,arguments)},en=r.___cxa_is_pointer_type=function(){return(en=r.___cxa_is_pointer_type=r.asm.J).apply(null,arguments)};r.ccall=Er;var pr;Je=function u(){pr||tn(),pr||(Je=u)};function tn(u){if(Ct>0||(or(),Ct>0))return;function f(){pr||(pr=!0,r.calledRun=!0,!_e&&(hr(),L(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),kr()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),f()},1)):f()}if(r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return tn(),$.ready}})();c.exports=_})(li);var Yi=li.exports,Ki=zn(Yi);const Qi=new URL("/static/dv3d/assets/charlswasm_decode-484ovEoR.wasm",import.meta.url),Dn={codec:void 0,decoder:void 0,decodeConfig:{}};function Zi(c){return typeof c=="number"?Dn.codec.getExceptionMessage(c):c}function eo(c){if(Dn.decodeConfig=c,Dn.codec)return Promise.resolve();const y=Ki({locateFile:_=>_.endsWith(".wasm")?Qi.toString():_});return new Promise((_,R)=>{y.then($=>{Dn.codec=$,Dn.decoder=new $.JpegLSDecoder,_()},R)})}async function ti(c,y){try{await eo();const _=Dn.decoder;_.getEncodedBuffer(c.length).set(c),_.decode();const $=_.getFrameInfo(),r=_.getInterleaveMode(),L=_.getNearLossless(),U=_.getDecodedBuffer(),W={columns:$.width,rows:$.height,bitsPerPixel:$.bitsPerSample,signed:y.signed,bytesPerPixel:y.bytesPerPixel,componentsPerPixel:$.componentCount},N=to($,U,y.signed),M={nearLossless:L,interleaveMode:r,frameInfo:$};return{...y,pixelData:N,imageInfo:W,encodeOptions:M,...M,...W}}catch(_){throw Zi(_)}}function to(c,y,_){return c.bitsPerSample>8?_?new Int16Array(y.buffer,y.byteOffset,y.byteLength/2):new Uint16Array(y.buffer,y.byteOffset,y.byteLength/2):_?new Int8Array(y.buffer,y.byteOffset,y.byteLength):new Uint8Array(y.buffer,y.byteOffset,y.byteLength)}var di={exports:{}};(function(c,y){var _=(()=>{var R=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(R=R||__filename),function($){$=$||{};var r=typeof $<"u"?$:{},L,U;r.ready=new Promise(function(s,a){L=s,U=a});var W=Object.assign({},r),N="./this.program",M=typeof window=="object",z=typeof importScripts=="function",H=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",X="";function q(s){return r.locateFile?r.locateFile(s,X):X+s}var ee,fe,$e;if(H){var pe=rn,we=rn;z?X=we.dirname(X)+"/":X=__dirname+"/",ee=(s,a)=>(s=Pe(s)?new URL(s):we.normalize(s),pe.readFileSync(s,a?void 0:"utf8")),$e=s=>{var a=ee(s,!0);return a.buffer||(a=new Uint8Array(a)),a},fe=(s,a,d)=>{s=Pe(s)?new URL(s):we.normalize(s),pe.readFile(s,function(b,T){b?d(b):a(T.buffer)})},process.argv.length>1&&(N=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(s){if(!(s instanceof yr))throw s}),process.on("unhandledRejection",function(s){throw s}),r.inspect=function(){return"[Emscripten Module object]"}}else(M||z)&&(z?X=self.location.href:typeof document<"u"&&document.currentScript&&(X=document.currentScript.src),R&&(X=R),X.indexOf("blob:")!==0?X=X.substr(0,X.replace(/[?#].*/,"").lastIndexOf("/")+1):X="",ee=s=>{var a=new XMLHttpRequest;return a.open("GET",s,!1),a.send(null),a.responseText},z&&($e=s=>{var a=new XMLHttpRequest;return a.open("GET",s,!1),a.responseType="arraybuffer",a.send(null),new Uint8Array(a.response)}),fe=(s,a,d)=>{var b=new XMLHttpRequest;b.open("GET",s,!0),b.responseType="arraybuffer",b.onload=()=>{if(b.status==200||b.status==0&&b.response){a(b.response);return}d()},b.onerror=d,b.send(null)});var ye=r.print||console.log.bind(console),se=r.printErr||console.warn.bind(console);Object.assign(r,W),W=null,r.arguments&&r.arguments,r.thisProgram&&(N=r.thisProgram),r.quit&&r.quit;var _e;r.wasmBinary&&(_e=r.wasmBinary),r.noExitRuntime,typeof WebAssembly!="object"&&Ut("no native wasm support detected");var Re,it=!1;function Vt(s,a){s||Ut(a)}var xt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Tt(s,a,d){for(var b=a+d,T=a;s[T]&&!(T>=b);)++T;if(T-a>16&&s.buffer&&xt)return xt.decode(s.subarray(a,T));for(var O="";a<T;){var D=s[a++];if(!(D&128)){O+=String.fromCharCode(D);continue}var E=s[a++]&63;if((D&224)==192){O+=String.fromCharCode((D&31)<<6|E);continue}var n=s[a++]&63;if((D&240)==224?D=(D&15)<<12|E<<6|n:D=(D&7)<<18|E<<12|n<<6|s[a++]&63,D<65536)O+=String.fromCharCode(D);else{var i=D-65536;O+=String.fromCharCode(55296|i>>10,56320|i&1023)}}return O}function nr(s,a){return s?Tt(ce,s,a):""}function vr(s,a,d,b){if(!(b>0))return 0;for(var T=d,O=d+b-1,D=0;D<s.length;++D){var E=s.charCodeAt(D);if(E>=55296&&E<=57343){var n=s.charCodeAt(++D);E=65536+((E&1023)<<10)|n&1023}if(E<=127){if(d>=O)break;a[d++]=E}else if(E<=2047){if(d+1>=O)break;a[d++]=192|E>>6,a[d++]=128|E&63}else if(E<=65535){if(d+2>=O)break;a[d++]=224|E>>12,a[d++]=128|E>>6&63,a[d++]=128|E&63}else{if(d+3>=O)break;a[d++]=240|E>>18,a[d++]=128|E>>12&63,a[d++]=128|E>>6&63,a[d++]=128|E&63}}return a[d]=0,d-T}function ir(s,a,d){return vr(s,ce,a,d)}function Ge(s){for(var a=0,d=0;d<s.length;++d){var b=s.charCodeAt(d);b<=127?a++:b<=2047?a+=2:b>=55296&&b<=57343?(a+=4,++d):a+=3}return a}var me,le,ce,ue,ne,oe,ie,he,Bt;function Nt(s){me=s,r.HEAP8=le=new Int8Array(s),r.HEAP16=ue=new Int16Array(s),r.HEAP32=oe=new Int32Array(s),r.HEAPU8=ce=new Uint8Array(s),r.HEAPU16=ne=new Uint16Array(s),r.HEAPU32=ie=new Uint32Array(s),r.HEAPF32=he=new Float32Array(s),r.HEAPF64=Bt=new Float64Array(s)}r.INITIAL_MEMORY;var zt,qt=[],or=[],hr=[];function kr(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)an(r.preRun.shift());ar(qt)}function nn(){ar(or)}function on(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Je(r.postRun.shift());ar(hr)}function an(s){qt.unshift(s)}function Ct(s){or.unshift(s)}function Je(s){hr.unshift(s)}var Xe=0,Ye=null;function ot(s){Xe++,r.monitorRunDependencies&&r.monitorRunDependencies(Xe)}function Ot(s){if(Xe--,r.monitorRunDependencies&&r.monitorRunDependencies(Xe),Xe==0&&Ye){var a=Ye;Ye=null,a()}}function Ut(s){r.onAbort&&r.onAbort(s),s="Aborted("+s+")",se(s),it=!0,s+=". Build with -sASSERTIONS for more info.";var a=new WebAssembly.RuntimeError(s);throw U(a),a}var at="data:application/octet-stream;base64,";function Te(s){return s.startsWith(at)}function Pe(s){return s.startsWith("file://")}var Ce;Ce="openjpegwasm_decode.wasm",Te(Ce)||(Ce=q(Ce));function Fe(s){try{if(s==Ce&&_e)return new Uint8Array(_e);if($e)return $e(s);throw"both async and sync fetching of the wasm failed"}catch(a){Ut(a)}}function Dr(){if(!_e&&(M||z)){if(typeof fetch=="function"&&!Pe(Ce))return fetch(Ce,{credentials:"same-origin"}).then(function(s){if(!s.ok)throw"failed to load wasm binary file at '"+Ce+"'";return s.arrayBuffer()}).catch(function(){return Fe(Ce)});if(fe)return new Promise(function(s,a){fe(Ce,function(d){s(new Uint8Array(d))},a)})}return Promise.resolve().then(function(){return Fe(Ce)})}function gr(){var s={a:w};function a(D,E){var n=D.exports;r.asm=n,Re=r.asm.E,Nt(Re.buffer),zt=r.asm.G,Ct(r.asm.F),Ot()}ot();function d(D){a(D.instance)}function b(D){return Dr().then(function(E){return WebAssembly.instantiate(E,s)}).then(function(E){return E}).then(D,function(E){se("failed to asynchronously prepare wasm: "+E),Ut(E)})}function T(){return!_e&&typeof WebAssembly.instantiateStreaming=="function"&&!Te(Ce)&&!Pe(Ce)&&!H&&typeof fetch=="function"?fetch(Ce,{credentials:"same-origin"}).then(function(D){var E=WebAssembly.instantiateStreaming(D,s);return E.then(d,function(n){return se("wasm streaming compile failed: "+n),se("falling back to ArrayBuffer instantiation"),b(d)})}):b(d)}if(r.instantiateWasm)try{var O=r.instantiateWasm(s,a);return O}catch(D){se("Module.instantiateWasm callback failed with error: "+D),U(D)}return T().catch(U),{}}function yr(s){this.name="ExitStatus",this.message="Program terminated with exit("+s+")",this.status=s}function ar(s){for(;s.length>0;)s.shift()(r)}function At(s){this.excPtr=s,this.ptr=s-24,this.set_type=function(a){ie[this.ptr+4>>2]=a},this.get_type=function(){return ie[this.ptr+4>>2]},this.set_destructor=function(a){ie[this.ptr+8>>2]=a},this.get_destructor=function(){return ie[this.ptr+8>>2]},this.set_refcount=function(a){oe[this.ptr>>2]=a},this.set_caught=function(a){a=a?1:0,le[this.ptr+12>>0]=a},this.get_caught=function(){return le[this.ptr+12>>0]!=0},this.set_rethrown=function(a){a=a?1:0,le[this.ptr+13>>0]=a},this.get_rethrown=function(){return le[this.ptr+13>>0]!=0},this.init=function(a,d){this.set_adjusted_ptr(0),this.set_type(a),this.set_destructor(d),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var a=oe[this.ptr>>2];oe[this.ptr>>2]=a+1},this.release_ref=function(){var a=oe[this.ptr>>2];return oe[this.ptr>>2]=a-1,a===1},this.set_adjusted_ptr=function(a){ie[this.ptr+16>>2]=a},this.get_adjusted_ptr=function(){return ie[this.ptr+16>>2]},this.get_exception_ptr=function(){var a=G(this.get_type());if(a)return ie[this.excPtr>>2];var d=this.get_adjusted_ptr();return d!==0?d:this.excPtr}}function xr(s,a,d){var b=new At(s);throw b.init(a,d),s}var _t={};function ke(s){for(;s.length;){var a=s.pop(),d=s.pop();d(a)}}function De(s){return this.fromWireType(oe[s>>2])}var ge={},Ne={},tt={},st=48,_r=57;function Gt(s){if(s===void 0)return"_unknown";s=s.replace(/[^a-zA-Z0-9_]/g,"$");var a=s.charCodeAt(0);return a>=st&&a<=_r?"_"+s:s}function It(s,a){return s=Gt(s),new Function("body","return function "+s+`() {
"use strict"; return body.apply(this, arguments);
};
`)(a)}function mt(s,a){var d=It(a,function(b){this.name=a,this.message=b;var T=new Error(b).stack;T!==void 0&&(this.stack=this.toString()+`
`+T.replace(/^Error(:[^\n]*)?\n/,""))});return d.prototype=Object.create(s.prototype),d.prototype.constructor=d,d.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},d}var He=void 0;function jt(s){throw new He(s)}function Me(s,a,d){s.forEach(function(E){tt[E]=a});function b(E){var n=d(E);n.length!==s.length&&jt("Mismatched type converter count");for(var i=0;i<s.length;++i)Q(s[i],n[i])}var T=new Array(a.length),O=[],D=0;a.forEach((E,n)=>{Ne.hasOwnProperty(E)?T[n]=Ne[E]:(O.push(E),ge.hasOwnProperty(E)||(ge[E]=[]),ge[E].push(()=>{T[n]=Ne[E],++D,D===O.length&&b(T)}))}),O.length===0&&b(T)}function Le(s){var a=_t[s];delete _t[s];var d=a.rawConstructor,b=a.rawDestructor,T=a.fields,O=T.map(D=>D.getterReturnType).concat(T.map(D=>D.setterArgumentType));Me([s],O,D=>{var E={};return T.forEach((n,i)=>{var e=n.fieldName,t=D[i],o=n.getter,l=n.getterContext,p=D[i+T.length],h=n.setter,g=n.setterContext;E[e]={read:m=>t.fromWireType(o(l,m)),write:(m,P)=>{var S=[];h(g,m,p.toWireType(S,P)),ke(S)}}}),[{name:a.name,fromWireType:function(n){var i={};for(var e in E)i[e]=E[e].read(n);return b(n),i},toWireType:function(n,i){for(var e in E)if(!(e in i))throw new TypeError('Missing field: "'+e+'"');var t=d();for(e in E)E[e].write(t,i[e]);return n!==null&&n.push(b,t),t},argPackAdvance:8,readValueFromPointer:De,destructorFunction:b}]})}function $t(s,a,d,b,T){}function Rt(s){switch(s){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+s)}}function Ae(){for(var s=new Array(256),a=0;a<256;++a)s[a]=String.fromCharCode(a);Et=s}var Et=void 0;function Y(s){for(var a="",d=s;ce[d];)a+=Et[ce[d++]];return a}var de=void 0;function re(s){throw new de(s)}function Q(s,a,d={}){if(!("argPackAdvance"in a))throw new TypeError("registerType registeredInstance requires argPackAdvance");var b=a.name;if(s||re('type "'+b+'" must have a positive integer typeid pointer'),Ne.hasOwnProperty(s)){if(d.ignoreDuplicateRegistrations)return;re("Cannot register type '"+b+"' twice")}if(Ne[s]=a,delete tt[s],ge.hasOwnProperty(s)){var T=ge[s];delete ge[s],T.forEach(O=>O())}}function ze(s,a,d,b,T){var O=Rt(d);a=Y(a),Q(s,{name:a,fromWireType:function(D){return!!D},toWireType:function(D,E){return E?b:T},argPackAdvance:8,readValueFromPointer:function(D){var E;if(d===1)E=le;else if(d===2)E=ue;else if(d===4)E=oe;else throw new TypeError("Unknown boolean type size: "+a);return this.fromWireType(E[D>>O])},destructorFunction:null})}function ut(s){if(!(this instanceof Ve)||!(s instanceof Ve))return!1;for(var a=this.$$.ptrType.registeredClass,d=this.$$.ptr,b=s.$$.ptrType.registeredClass,T=s.$$.ptr;a.baseClass;)d=a.upcast(d),a=a.baseClass;for(;b.baseClass;)T=b.upcast(T),b=b.baseClass;return a===b&&d===T}function mr(s){return{count:s.count,deleteScheduled:s.deleteScheduled,preservePointerOnDelete:s.preservePointerOnDelete,ptr:s.ptr,ptrType:s.ptrType,smartPtr:s.smartPtr,smartPtrType:s.smartPtrType}}function sr(s){function a(d){return d.$$.ptrType.registeredClass.name}re(a(s)+" instance already deleted")}var St=!1;function Jt(s){}function ur(s){s.smartPtr?s.smartPtrType.rawDestructor(s.smartPtr):s.ptrType.registeredClass.rawDestructor(s.ptr)}function Ee(s){s.count.value-=1;var a=s.count.value===0;a&&ur(s)}function bt(s,a,d){if(a===d)return s;if(d.baseClass===void 0)return null;var b=bt(s,a,d.baseClass);return b===null?null:d.downcast(b)}var ae={};function Ue(){return Object.keys(Xt).length}function br(){var s=[];for(var a in Xt)Xt.hasOwnProperty(a)&&s.push(Xt[a]);return s}var ft=[];function Ft(){for(;ft.length;){var s=ft.pop();s.$$.deleteScheduled=!1,s.delete()}}var ct=void 0;function Ke(s){ct=s,ft.length&&ct&&ct(Ft)}function Or(){r.getInheritedInstanceCount=Ue,r.getLiveInheritedInstances=br,r.flushPendingDeletes=Ft,r.setDelayFunction=Ke}var Xt={};function lt(s,a){for(a===void 0&&re("ptr should not be undefined");s.baseClass;)a=s.upcast(a),s=s.baseClass;return a}function Ur(s,a){return a=lt(s,a),Xt[a]}function dt(s,a){(!a.ptrType||!a.ptr)&&jt("makeClassHandle requires ptr and ptrType");var d=!!a.smartPtrType,b=!!a.smartPtr;return d!==b&&jt("Both smartPtrType and smartPtr must be specified"),a.count={value:1},Yt(Object.create(s,{$$:{value:a}}))}function fr(s){var a=this.getPointee(s);if(!a)return this.destructor(s),null;var d=Ur(this.registeredClass,a);if(d!==void 0){if(d.$$.count.value===0)return d.$$.ptr=a,d.$$.smartPtr=s,d.clone();var b=d.clone();return this.destructor(s),b}function T(){return this.isSmartPointer?dt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:a,smartPtrType:this,smartPtr:s}):dt(this.registeredClass.instancePrototype,{ptrType:this,ptr:s})}var O=this.registeredClass.getActualType(a),D=ae[O];if(!D)return T.call(this);var E;this.isConst?E=D.constPointerType:E=D.pointerType;var n=bt(a,this.registeredClass,E.registeredClass);return n===null?T.call(this):this.isSmartPointer?dt(E.registeredClass.instancePrototype,{ptrType:E,ptr:n,smartPtrType:this,smartPtr:s}):dt(E.registeredClass.instancePrototype,{ptrType:E,ptr:n})}function Yt(s){return typeof FinalizationRegistry>"u"?(Yt=a=>a,s):(St=new FinalizationRegistry(a=>{Ee(a.$$)}),Yt=a=>{var d=a.$$,b=!!d.smartPtr;if(b){var T={$$:d};St.register(a,T,a)}return a},Jt=a=>St.unregister(a),Yt(s))}function pt(){if(this.$$.ptr||sr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=Yt(Object.create(Object.getPrototypeOf(this),{$$:{value:mr(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s}function wr(){this.$$.ptr||sr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&re("Object already scheduled for deletion"),Jt(this),Ee(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Kt(){return!this.$$.ptr}function wt(){return this.$$.ptr||sr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&re("Object already scheduled for deletion"),ft.push(this),ft.length===1&&ct&&ct(Ft),this.$$.deleteScheduled=!0,this}function Ir(){Ve.prototype.isAliasOf=ut,Ve.prototype.clone=pt,Ve.prototype.delete=wr,Ve.prototype.isDeleted=Kt,Ve.prototype.deleteLater=wt}function Ve(){}function vt(s,a,d){if(s[a].overloadTable===void 0){var b=s[a];s[a]=function(){return s[a].overloadTable.hasOwnProperty(arguments.length)||re("Function '"+d+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+s[a].overloadTable+")!"),s[a].overloadTable[arguments.length].apply(this,arguments)},s[a].overloadTable=[],s[a].overloadTable[b.argCount]=b}}function cr(s,a,d){r.hasOwnProperty(s)?(re("Cannot register public name '"+s+"' twice"),vt(r,s,s),r.hasOwnProperty(d)&&re("Cannot register multiple overloads of a function with the same number of arguments ("+d+")!"),r[s].overloadTable[d]=a):r[s]=a}function lr(s,a,d,b,T,O,D,E){this.name=s,this.constructor=a,this.instancePrototype=d,this.rawDestructor=b,this.baseClass=T,this.getActualType=O,this.upcast=D,this.downcast=E,this.pureVirtualFunctions=[]}function Pr(s,a,d){for(;a!==d;)a.upcast||re("Expected null or instance of "+d.name+", got an instance of "+a.name),s=a.upcast(s),a=a.baseClass;return s}function kt(s,a){if(a===null)return this.isReference&&re("null is not a valid "+this.name),0;a.$$||re('Cannot pass "'+Cr(a)+'" as a '+this.name),a.$$.ptr||re("Cannot pass deleted object as a pointer of type "+this.name);var d=a.$$.ptrType.registeredClass,b=Pr(a.$$.ptr,d,this.registeredClass);return b}function sn(s,a){var d;if(a===null)return this.isReference&&re("null is not a valid "+this.name),this.isSmartPointer?(d=this.rawConstructor(),s!==null&&s.push(this.rawDestructor,d),d):0;a.$$||re('Cannot pass "'+Cr(a)+'" as a '+this.name),a.$$.ptr||re("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&a.$$.ptrType.isConst&&re("Cannot convert argument of type "+(a.$$.smartPtrType?a.$$.smartPtrType.name:a.$$.ptrType.name)+" to parameter type "+this.name);var b=a.$$.ptrType.registeredClass;if(d=Pr(a.$$.ptr,b,this.registeredClass),this.isSmartPointer)switch(a.$$.smartPtr===void 0&&re("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:a.$$.smartPtrType===this?d=a.$$.smartPtr:re("Cannot convert argument of type "+(a.$$.smartPtrType?a.$$.smartPtrType.name:a.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:d=a.$$.smartPtr;break;case 2:if(a.$$.smartPtrType===this)d=a.$$.smartPtr;else{var T=a.clone();d=this.rawShare(d,qe.toHandle(function(){T.delete()})),s!==null&&s.push(this.rawDestructor,d)}break;default:re("Unsupporting sharing policy")}return d}function un(s,a){if(a===null)return this.isReference&&re("null is not a valid "+this.name),0;a.$$||re('Cannot pass "'+Cr(a)+'" as a '+this.name),a.$$.ptr||re("Cannot pass deleted object as a pointer of type "+this.name),a.$$.ptrType.isConst&&re("Cannot convert argument of type "+a.$$.ptrType.name+" to parameter type "+this.name);var d=a.$$.ptrType.registeredClass,b=Pr(a.$$.ptr,d,this.registeredClass);return b}function fn(s){return this.rawGetPointee&&(s=this.rawGetPointee(s)),s}function cn(s){this.rawDestructor&&this.rawDestructor(s)}function ht(s){s!==null&&s.delete()}function gt(){rt.prototype.getPointee=fn,rt.prototype.destructor=cn,rt.prototype.argPackAdvance=8,rt.prototype.readValueFromPointer=De,rt.prototype.deleteObject=ht,rt.prototype.fromWireType=fr}function rt(s,a,d,b,T,O,D,E,n,i,e){this.name=s,this.registeredClass=a,this.isReference=d,this.isConst=b,this.isSmartPointer=T,this.pointeeType=O,this.sharingPolicy=D,this.rawGetPointee=E,this.rawConstructor=n,this.rawShare=i,this.rawDestructor=e,!T&&a.baseClass===void 0?b?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=un,this.destructorFunction=null):this.toWireType=sn}function Be(s,a,d){r.hasOwnProperty(s)||jt("Replacing nonexistant public symbol"),r[s].overloadTable!==void 0&&d!==void 0||(r[s]=a,r[s].argCount=d)}function jr(s,a,d){var b=r["dynCall_"+s];return d&&d.length?b.apply(null,[a].concat(d)):b.call(null,a)}var Wt=[];function Qt(s){var a=Wt[s];return a||(s>=Wt.length&&(Wt.length=s+1),Wt[s]=a=zt.get(s)),a}function Se(s,a,d){if(s.includes("j"))return jr(s,a,d);var b=Qt(a).apply(null,d);return b}function Wr(s,a){var d=[];return function(){return d.length=0,Object.assign(d,arguments),Se(s,a,d)}}function Qe(s,a){s=Y(s);function d(){return s.includes("j")?Wr(s,a):Qt(a)}var b=d();return typeof b!="function"&&re("unknown function pointer with signature "+s+": "+a),b}var Ie=void 0;function Tr(s){var a=k(s),d=Y(a);return F(a),d}function Ht(s,a){var d=[],b={};function T(O){if(!b[O]&&!Ne[O]){if(tt[O]){tt[O].forEach(T);return}d.push(O),b[O]=!0}}throw a.forEach(T),new Ie(s+": "+d.map(Tr).join([", "]))}function Ze(s,a,d,b,T,O,D,E,n,i,e,t,o){e=Y(e),O=Qe(T,O),E&&(E=Qe(D,E)),i&&(i=Qe(n,i)),o=Qe(t,o);var l=Gt(e);cr(l,function(){Ht("Cannot construct "+e+" due to unbound types",[b])}),Me([s,a,d],b?[b]:[],function(p){p=p[0];var h,g;b?(h=p.registeredClass,g=h.instancePrototype):g=Ve.prototype;var m=It(l,function(){if(Object.getPrototypeOf(this)!==P)throw new de("Use 'new' to construct "+e);if(S.constructor_body===void 0)throw new de(e+" has no accessible constructor");var te=S.constructor_body[arguments.length];if(te===void 0)throw new de("Tried to invoke ctor of "+e+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(S.constructor_body).toString()+") parameters instead!");return te.apply(this,arguments)}),P=Object.create(g,{constructor:{value:m}});m.prototype=P;var S=new lr(e,m,P,o,h,O,E,i),I=new rt(e,S,!0,!1,!1),B=new rt(e+"*",S,!1,!1,!1),V=new rt(e+" const*",S,!1,!0,!1);return ae[s]={pointerType:B,constPointerType:V},Be(l,m),[I,B,V]})}function Zt(s,a){for(var d=[],b=0;b<s;b++)d.push(ie[a+b*4>>2]);return d}function Hr(s,a){if(!(s instanceof Function))throw new TypeError("new_ called with constructor type "+typeof s+" which is not a function");var d=It(s.name||"unknownFunctionName",function(){});d.prototype=s.prototype;var b=new d,T=s.apply(b,a);return T instanceof Object?T:b}function Mr(s,a,d,b,T){var O=a.length;O<2&&re("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var D=a[1]!==null&&d!==null,E=!1,n=1;n<a.length;++n)if(a[n]!==null&&a[n].destructorFunction===void 0){E=!0;break}for(var i=a[0].name!=="void",e="",t="",n=0;n<O-2;++n)e+=(n!==0?", ":"")+"arg"+n,t+=(n!==0?", ":"")+"arg"+n+"Wired";var o="return function "+Gt(s)+"("+e+`) {
if (arguments.length !== `+(O-2)+`) {
throwBindingError('function `+s+" called with ' + arguments.length + ' arguments, expected "+(O-2)+` args!');
}
`;E&&(o+=`var destructors = [];
`);var l=E?"destructors":"null",p=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],h=[re,b,T,ke,a[0],a[1]];D&&(o+="var thisWired = classParam.toWireType("+l+`, this);
`);for(var n=0;n<O-2;++n)o+="var arg"+n+"Wired = argType"+n+".toWireType("+l+", arg"+n+"); // "+a[n+2].name+`
`,p.push("argType"+n),h.push(a[n+2]);if(D&&(t="thisWired"+(t.length>0?", ":"")+t),o+=(i?"var rv = ":"")+"invoker(fn"+(t.length>0?", ":"")+t+`);
`,E)o+=`runDestructors(destructors);
`;else for(var n=D?1:2;n<a.length;++n){var g=n===1?"thisWired":"arg"+(n-2)+"Wired";a[n].destructorFunction!==null&&(o+=g+"_dtor("+g+"); // "+a[n].name+`
`,p.push(g+"_dtor"),h.push(a[n].destructorFunction))}i&&(o+=`var ret = retType.fromWireType(rv);
return ret;
`),o+=`}
`,p.push(o);var m=Hr(Function,p).apply(null,h);return m}function dr(s,a,d,b,T,O){Vt(a>0);var D=Zt(a,d);T=Qe(b,T),Me([],[s],function(E){E=E[0];var n="constructor "+E.name;if(E.registeredClass.constructor_body===void 0&&(E.registeredClass.constructor_body=[]),E.registeredClass.constructor_body[a-1]!==void 0)throw new de("Cannot register multiple constructors with identical number of parameters ("+(a-1)+") for class '"+E.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return E.registeredClass.constructor_body[a-1]=()=>{Ht("Cannot construct "+E.name+" due to unbound types",D)},Me([],D,function(i){return i.splice(1,0,null),E.registeredClass.constructor_body[a-1]=Mr(n,i,null,T,O),[]}),[]})}function be(s,a,d,b,T,O,D,E){var n=Zt(d,b);a=Y(a),O=Qe(T,O),Me([],[s],function(i){i=i[0];var e=i.name+"."+a;a.startsWith("@@")&&(a=Symbol[a.substring(2)]),E&&i.registeredClass.pureVirtualFunctions.push(a);function t(){Ht("Cannot call "+e+" due to unbound types",n)}var o=i.registeredClass.instancePrototype,l=o[a];return l===void 0||l.overloadTable===void 0&&l.className!==i.name&&l.argCount===d-2?(t.argCount=d-2,t.className=i.name,o[a]=t):(vt(o,a,e),o[a].overloadTable[d-2]=t),Me([],n,function(p){var h=Mr(e,p,i,O,D);return o[a].overloadTable===void 0?(h.argCount=d-2,o[a]=h):o[a].overloadTable[d-2]=h,[]}),[]})}var er=[],je=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function xe(s){s>4&&--je[s].refcount===0&&(je[s]=void 0,er.push(s))}function Lr(){for(var s=0,a=5;a<je.length;++a)je[a]!==void 0&&++s;return s}function nt(){for(var s=5;s<je.length;++s)if(je[s]!==void 0)return je[s];return null}function ln(){r.count_emval_handles=Lr,r.get_first_emval=nt}var qe={toValue:s=>(s||re("Cannot use deleted val. handle = "+s),je[s].value),toHandle:s=>{switch(s){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var a=er.length?er.pop():je.length;return je[a]={refcount:1,value:s},a}}}};function Pt(s,a){a=Y(a),Q(s,{name:a,fromWireType:function(d){var b=qe.toValue(d);return xe(d),b},toWireType:function(d,b){return qe.toHandle(b)},argPackAdvance:8,readValueFromPointer:De,destructorFunction:null})}function Cr(s){if(s===null)return"null";var a=typeof s;return a==="object"||a==="array"||a==="function"?s.toString():""+s}function tr(s,a){switch(a){case 2:return function(d){return this.fromWireType(he[d>>2])};case 3:return function(d){return this.fromWireType(Bt[d>>3])};default:throw new TypeError("Unknown float type: "+s)}}function et(s,a,d){var b=Rt(d);a=Y(a),Q(s,{name:a,fromWireType:function(T){return T},toWireType:function(T,O){return O},argPackAdvance:8,readValueFromPointer:tr(a,b),destructorFunction:null})}function Vr(s,a,d){switch(a){case 0:return d?function(T){return le[T]}:function(T){return ce[T]};case 1:return d?function(T){return ue[T>>1]}:function(T){return ne[T>>1]};case 2:return d?function(T){return oe[T>>2]}:function(T){return ie[T>>2]};default:throw new TypeError("Unknown integer type: "+s)}}function dn(s,a,d,b,T){a=Y(a);var O=Rt(d),D=t=>t;if(b===0){var E=32-8*d;D=t=>t<<E>>>E}var n=a.includes("unsigned"),i=(t,o)=>{},e;n?e=function(t,o){return i(o,this.name),o>>>0}:e=function(t,o){return i(o,this.name),o},Q(s,{name:a,fromWireType:D,toWireType:e,argPackAdvance:8,readValueFromPointer:Vr(a,O,b!==0),destructorFunction:null})}function pn(s,a,d){var b=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],T=b[a];function O(D){D=D>>2;var E=ie,n=E[D],i=E[D+1];return new T(me,i,n)}d=Y(d),Q(s,{name:d,fromWireType:O,argPackAdvance:8,readValueFromPointer:O},{ignoreDuplicateRegistrations:!0})}function Br(s,a){a=Y(a);var d=a==="std::string";Q(s,{name:a,fromWireType:function(b){var T=ie[b>>2],O=b+4,D;if(d)for(var E=O,n=0;n<=T;++n){var i=O+n;if(n==T||ce[i]==0){var e=i-E,t=nr(E,e);D===void 0?D=t:(D+="\0",D+=t),E=i+1}}else{for(var o=new Array(T),n=0;n<T;++n)o[n]=String.fromCharCode(ce[O+n]);D=o.join("")}return F(b),D},toWireType:function(b,T){T instanceof ArrayBuffer&&(T=new Uint8Array(T));var O,D=typeof T=="string";D||T instanceof Uint8Array||T instanceof Uint8ClampedArray||T instanceof Int8Array||re("Cannot pass non-string to std::string"),d&&D?O=Ge(T):O=T.length;var E=C(4+O+1),n=E+4;if(ie[E>>2]=O,d&&D)ir(T,n,O+1);else if(D)for(var i=0;i<O;++i){var e=T.charCodeAt(i);e>255&&(F(n),re("String has UTF-16 code units that do not fit in 8 bits")),ce[n+i]=e}else for(var i=0;i<O;++i)ce[n+i]=T[i];return b!==null&&b.push(F,E),E},argPackAdvance:8,readValueFromPointer:De,destructorFunction:function(b){F(b)}})}var rr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Nr(s,a){for(var d=s,b=d>>1,T=b+a/2;!(b>=T)&&ne[b];)++b;if(d=b<<1,d-s>32&&rr)return rr.decode(ce.subarray(s,d));for(var O="",D=0;!(D>=a/2);++D){var E=ue[s+D*2>>1];if(E==0)break;O+=String.fromCharCode(E)}return O}function Ar(s,a,d){if(d===void 0&&(d=2147483647),d<2)return 0;d-=2;for(var b=a,T=d<s.length*2?d/2:s.length,O=0;O<T;++O){var D=s.charCodeAt(O);ue[a>>1]=D,a+=2}return ue[a>>1]=0,a-b}function vn(s){return s.length*2}function hn(s,a){for(var d=0,b="";!(d>=a/4);){var T=oe[s+d*4>>2];if(T==0)break;if(++d,T>=65536){var O=T-65536;b+=String.fromCharCode(55296|O>>10,56320|O&1023)}else b+=String.fromCharCode(T)}return b}function gn(s,a,d){if(d===void 0&&(d=2147483647),d<4)return 0;for(var b=a,T=b+d-4,O=0;O<s.length;++O){var D=s.charCodeAt(O);if(D>=55296&&D<=57343){var E=s.charCodeAt(++O);D=65536+((D&1023)<<10)|E&1023}if(oe[a>>2]=D,a+=4,a+4>T)break}return oe[a>>2]=0,a-b}function yn(s){for(var a=0,d=0;d<s.length;++d){var b=s.charCodeAt(d);b>=55296&&b<=57343&&++d,a+=4}return a}function _n(s,a,d){d=Y(d);var b,T,O,D,E;a===2?(b=Nr,T=Ar,D=vn,O=()=>ne,E=1):a===4&&(b=hn,T=gn,D=yn,O=()=>ie,E=2),Q(s,{name:d,fromWireType:function(n){for(var i=ie[n>>2],e=O(),t,o=n+4,l=0;l<=i;++l){var p=n+4+l*a;if(l==i||e[p>>E]==0){var h=p-o,g=b(o,h);t===void 0?t=g:(t+="\0",t+=g),o=p+a}}return F(n),t},toWireType:function(n,i){typeof i!="string"&&re("Cannot pass non-string to C++ string type "+d);var e=D(i),t=C(4+e+a);return ie[t>>2]=e>>E,T(i,t+4,e+a),n!==null&&n.push(F,t),t},argPackAdvance:8,readValueFromPointer:De,destructorFunction:function(n){F(n)}})}function mn(s,a,d,b,T,O){_t[s]={name:Y(a),rawConstructor:Qe(d,b),rawDestructor:Qe(T,O),fields:[]}}function bn(s,a,d,b,T,O,D,E,n,i){_t[s].fields.push({fieldName:Y(a),getterReturnType:d,getter:Qe(b,T),getterContext:O,setterArgumentType:D,setter:Qe(E,n),setterContext:i})}function zr(s,a){a=Y(a),Q(s,{isVoid:!0,name:a,argPackAdvance:0,fromWireType:function(){},toWireType:function(d,b){}})}var wn={};function qr(s){var a=wn[s];return a===void 0?Y(s):a}function Gr(){return typeof globalThis=="object"?globalThis:function(){return Function}()("return this")()}function Pn(s){return s===0?qe.toHandle(Gr()):(s=qr(s),qe.toHandle(Gr()[s]))}function $r(s){s>4&&(je[s].refcount+=1)}function Jr(s,a){var d=Ne[s];return d===void 0&&re(a+" has unknown type "+Tr(s)),d}function Xr(s){for(var a="",d=0;d<s;++d)a+=(d!==0?", ":"")+"arg"+d;for(var b=()=>ie,T="return function emval_allocator_"+s+`(constructor, argTypes, args) {
var HEAPU32 = getMemory();
`,d=0;d<s;++d)T+="var argType"+d+" = requireRegisteredType(HEAPU32[((argTypes)>>2)], 'parameter "+d+`');
var arg`+d+" = argType"+d+`.readValueFromPointer(args);
args += argType`+d+`['argPackAdvance'];
argTypes += 4;
`;return T+="var obj = new constructor("+a+`);
return valueToHandle(obj);
}
`,new Function("requireRegisteredType","Module","valueToHandle","getMemory",T)(Jr,r,qe.toHandle,b)}var Rr={};function Tn(s,a,d,b){s=qe.toValue(s);var T=Rr[a];return T||(T=Xr(a),Rr[a]=T),T(s,d,b)}function Yr(s,a){s=Jr(s,"_emval_take_value");var d=s.readValueFromPointer(a);return qe.toHandle(d)}function Cn(){Ut("")}function Kr(){return 2147483648}function An(){return Kr()}function $n(s,a,d){ce.copyWithin(s,a,a+d)}function Rn(s){try{return Re.grow(s-me.byteLength+65535>>>16),Nt(Re.buffer),1}catch{}}function En(s){var a=ce.length;s=s>>>0;var d=Kr();if(s>d)return!1;let b=(n,i)=>n+(i-n%i)%i;for(var T=1;T<=4;T*=2){var O=a*(1+.2/T);O=Math.min(O,s+100663296);var D=Math.min(d,b(Math.max(s,O),65536)),E=Rn(D);if(E)return!0}return!1}var Er={};function Sr(){return N||"./this.program"}function Dt(){if(!Dt.strings){var s=(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:s,_:Sr()};for(var d in Er)Er[d]===void 0?delete a[d]:a[d]=Er[d];var b=[];for(var d in a)b.push(d+"="+a[d]);Dt.strings=b}return Dt.strings}function Mt(s,a,d){for(var b=0;b<s.length;++b)le[a++>>0]=s.charCodeAt(b);le[a>>0]=0}function yt(s,a){var d=0;return Dt().forEach(function(b,T){var O=a+d;ie[s+T*4>>2]=O,Mt(b,O),d+=b.length+1}),0}function Qr(s,a){var d=Dt();ie[s>>2]=d.length;var b=0;return d.forEach(function(T){b+=T.length+1}),ie[a>>2]=b,0}function Zr(s){return 52}function Fr(s,a,d,b,T){return 70}var en=[null,[],[]];function pr(s,a){var d=en[s];a===0||a===10?((s===1?ye:se)(Tt(d,0)),d.length=0):d.push(a)}function tn(s,a,d,b){for(var T=0,O=0;O<d;O++){var D=ie[a>>2],E=ie[a+4>>2];a+=8;for(var n=0;n<E;n++)pr(s,ce[D+n]);T+=E}return ie[b>>2]=T,0}function u(s){var a=r["_"+s];return a}function f(s,a){le.set(s,a)}function v(s,a,d,b,T){var O={string:p=>{var h=0;if(p!=null&&p!==0){var g=(p.length<<2)+1;h=j(g),ir(p,h,g)}return h},array:p=>{var h=j(p.length);return f(p,h),h}};function D(p){return a==="string"?nr(p):a==="boolean"?!!p:p}var E=u(s),n=[],i=0;if(b)for(var e=0;e<b.length;e++){var t=O[d[e]];t?(i===0&&(i=A()),n[e]=t(b[e])):n[e]=b[e]}var o=E.apply(null,n);function l(p){return i!==0&&x(i),D(p)}return o=l(o),o}He=r.InternalError=mt(Error,"InternalError"),Ae(),de=r.BindingError=mt(Error,"BindingError"),Ir(),Or(),gt(),Ie=r.UnboundTypeError=mt(Error,"UnboundTypeError"),ln();var w={D:xr,e:Le,t:$t,B:ze,r:Ze,q:dr,b:be,A:Pt,l:et,d:dn,a:pn,k:Br,f:_n,g:mn,c:bn,C:zr,h:xe,o:Pn,m:$r,n:Tn,p:Yr,i:Cn,v:An,z:$n,u:En,w:yt,x:Qr,y:Zr,s:Fr,j:tn};gr(),r.___wasm_call_ctors=function(){return(r.___wasm_call_ctors=r.asm.F).apply(null,arguments)};var C=r._malloc=function(){return(C=r._malloc=r.asm.H).apply(null,arguments)},F=r._free=function(){return(F=r._free=r.asm.I).apply(null,arguments)},k=r.___getTypeName=function(){return(k=r.___getTypeName=r.asm.J).apply(null,arguments)};r.__embind_initialize_bindings=function(){return(r.__embind_initialize_bindings=r.asm.K).apply(null,arguments)};var A=r.stackSave=function(){return(A=r.stackSave=r.asm.L).apply(null,arguments)},x=r.stackRestore=function(){return(x=r.stackRestore=r.asm.M).apply(null,arguments)},j=r.stackAlloc=function(){return(j=r.stackAlloc=r.asm.N).apply(null,arguments)},G=r.___cxa_is_pointer_type=function(){return(G=r.___cxa_is_pointer_type=r.asm.O).apply(null,arguments)};r.dynCall_iji=function(){return(r.dynCall_iji=r.asm.P).apply(null,arguments)},r.dynCall_jji=function(){return(r.dynCall_jji=r.asm.Q).apply(null,arguments)},r.dynCall_iiji=function(){return(r.dynCall_iiji=r.asm.R).apply(null,arguments)},r.dynCall_jiji=function(){return(r.dynCall_jiji=r.asm.S).apply(null,arguments)},r.ccall=v;var J;Ye=function s(){J||K(),J||(Ye=s)};function K(s){if(Xe>0||(kr(),Xe>0))return;function a(){J||(J=!0,r.calledRun=!0,!it&&(nn(),L(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),on()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),a()},1)):a()}if(r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return K(),$.ready}})();c.exports=_})(di);var ro=di.exports,no=zn(ro);const io=new URL("/static/dv3d/assets/openjpegwasm_decode-C4nnCcr6.wasm",import.meta.url),On={codec:void 0,decoder:void 0,decodeConfig:{}};function oo(c){if(On.decodeConfig=c,On.codec)return Promise.resolve();const y=no({locateFile:_=>_.endsWith(".wasm")?io.toString():_});return new Promise((_,R)=>{y.then($=>{On.codec=$,On.decoder=new $.J2KDecoder,_()},R)})}async function ri(c,y){await oo();const _=On.decoder,R=_.getEncodedBuffer(c.length);R.set(c),_.decode();const $=_.getFrameInfo(),r=_.getDecodedBuffer();new Uint8Array(r.length).set(r);const U=`x: ${_.getImageOffset().x}, y: ${_.getImageOffset().y}`,W=_.getNumDecompositions(),N=_.getNumLayers(),M=["unknown","LRCP","RLCP","RPCL","PCRL","CPRL"][_.getProgressionOrder()+1],z=_.getIsReversible(),H=`${_.getBlockDimensions().width} x ${_.getBlockDimensions().height}`,X=`${_.getTileSize().width} x ${_.getTileSize().height}`,q=`${_.getTileOffset().x}, ${_.getTileOffset().y}`,ee=_.getColorSpace(),fe=`${r.length.toLocaleString()} bytes`,$e=`${(r.length/R.length).toFixed(2)}:1`,pe={columns:$.width,rows:$.height,bitsPerPixel:$.bitsPerSample,signed:$.isSigned,bytesPerPixel:y.bytesPerPixel,componentsPerPixel:$.componentCount},we=ao($,r),ye={imageOffset:U,numDecompositions:W,numLayers:N,progessionOrder:M,reversible:z,blockDimensions:H,tileSize:X,tileOffset:q,colorTransform:ee,decodedSize:fe,compressionRatio:$e};return{...y,pixelData:we,imageInfo:pe,encodeOptions:ye,...ye,...pe}}function ao(c,y){return c.bitsPerSample>8?c.isSigned?new Int16Array(y.buffer,y.byteOffset,y.byteLength/2):new Uint16Array(y.buffer,y.byteOffset,y.byteLength/2):c.isSigned?new Int8Array(y.buffer,y.byteOffset,y.byteLength):new Uint8Array(y.buffer,y.byteOffset,y.byteLength)}var pi={exports:{}};(function(c,y){var _=(()=>{var R=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(R=R||__filename),function(r){r=r||{};var r=typeof r<"u"?r:{},L,U;r.ready=new Promise(function(n,i){L=n,U=i});var W=Object.assign({},r),N=typeof window=="object",M=typeof importScripts=="function",z=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",H="";function X(n){return r.locateFile?r.locateFile(n,H):H+n}var q,ee,fe;if(z){var $e=rn,pe=rn;M?H=pe.dirname(H)+"/":H=__dirname+"/",q=(n,i)=>(n=Te(n)?new URL(n):pe.normalize(n),$e.readFileSync(n,i?void 0:"utf8")),fe=n=>{var i=q(n,!0);return i.buffer||(i=new Uint8Array(i)),i},ee=(n,i,e)=>{n=Te(n)?new URL(n):pe.normalize(n),$e.readFile(n,function(t,o){t?e(t):i(o.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(n){if(!(n instanceof gr))throw n}),process.on("unhandledRejection",function(n){throw n}),r.inspect=function(){return"[Emscripten Module object]"}}else(N||M)&&(M?H=self.location.href:typeof document<"u"&&document.currentScript&&(H=document.currentScript.src),R&&(H=R),H.indexOf("blob:")!==0?H=H.substr(0,H.replace(/[?#].*/,"").lastIndexOf("/")+1):H="",q=n=>{var i=new XMLHttpRequest;return i.open("GET",n,!1),i.send(null),i.responseText},M&&(fe=n=>{var i=new XMLHttpRequest;return i.open("GET",n,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),ee=(n,i,e)=>{var t=new XMLHttpRequest;t.open("GET",n,!0),t.responseType="arraybuffer",t.onload=()=>{if(t.status==200||t.status==0&&t.response){i(t.response);return}e()},t.onerror=e,t.send(null)});var we=r.print||console.log.bind(console),ye=r.printErr||console.warn.bind(console);Object.assign(r,W),W=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit;var se;r.wasmBinary&&(se=r.wasmBinary),r.noExitRuntime,typeof WebAssembly!="object"&&Ot("no native wasm support detected");var _e,Re=!1;function it(n,i){n||Ot(i)}var Vt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function xt(n,i,e){for(var t=i+e,o=i;n[o]&&!(o>=t);)++o;if(o-i>16&&n.buffer&&Vt)return Vt.decode(n.subarray(i,o));for(var l="";i<o;){var p=n[i++];if(!(p&128)){l+=String.fromCharCode(p);continue}var h=n[i++]&63;if((p&224)==192){l+=String.fromCharCode((p&31)<<6|h);continue}var g=n[i++]&63;if((p&240)==224?p=(p&15)<<12|h<<6|g:p=(p&7)<<18|h<<12|g<<6|n[i++]&63,p<65536)l+=String.fromCharCode(p);else{var m=p-65536;l+=String.fromCharCode(55296|m>>10,56320|m&1023)}}return l}function Tt(n,i){return n?xt(le,n,i):""}function nr(n,i,e,t){if(!(t>0))return 0;for(var o=e,l=e+t-1,p=0;p<n.length;++p){var h=n.charCodeAt(p);if(h>=55296&&h<=57343){var g=n.charCodeAt(++p);h=65536+((h&1023)<<10)|g&1023}if(h<=127){if(e>=l)break;i[e++]=h}else if(h<=2047){if(e+1>=l)break;i[e++]=192|h>>6,i[e++]=128|h&63}else if(h<=65535){if(e+2>=l)break;i[e++]=224|h>>12,i[e++]=128|h>>6&63,i[e++]=128|h&63}else{if(e+3>=l)break;i[e++]=240|h>>18,i[e++]=128|h>>12&63,i[e++]=128|h>>6&63,i[e++]=128|h&63}}return i[e]=0,e-o}function vr(n,i,e){return nr(n,le,i,e)}function ir(n){for(var i=0,e=0;e<n.length;++e){var t=n.charCodeAt(e);t<=127?i++:t<=2047?i+=2:t>=55296&&t<=57343?(i+=4,++e):i+=3}return i}var Ge,me,le,ce,ue,ne,oe,ie,he;function Bt(n){Ge=n,r.HEAP8=me=new Int8Array(n),r.HEAP16=ce=new Int16Array(n),r.HEAP32=ne=new Int32Array(n),r.HEAPU8=le=new Uint8Array(n),r.HEAPU16=ue=new Uint16Array(n),r.HEAPU32=oe=new Uint32Array(n),r.HEAPF32=ie=new Float32Array(n),r.HEAPF64=he=new Float64Array(n)}r.INITIAL_MEMORY;var Nt,zt=[],qt=[],or=[];function hr(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)on(r.preRun.shift());yr(zt)}function kr(){yr(qt)}function nn(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Ct(r.postRun.shift());yr(or)}function on(n){zt.unshift(n)}function an(n){qt.unshift(n)}function Ct(n){or.unshift(n)}var Je=0,Xe=null;function Ye(n){Je++,r.monitorRunDependencies&&r.monitorRunDependencies(Je)}function ot(n){if(Je--,r.monitorRunDependencies&&r.monitorRunDependencies(Je),Je==0&&Xe){var i=Xe;Xe=null,i()}}function Ot(n){r.onAbort&&r.onAbort(n),n="Aborted("+n+")",ye(n),Re=!0,n+=". Build with -sASSERTIONS for more info.";var i=new WebAssembly.RuntimeError(n);throw U(i),i}var Ut="data:application/octet-stream;base64,";function at(n){return n.startsWith(Ut)}function Te(n){return n.startsWith("file://")}var Pe;Pe="openjphjs.wasm",at(Pe)||(Pe=X(Pe));function Ce(n){try{if(n==Pe&&se)return new Uint8Array(se);if(fe)return fe(n);throw"both async and sync fetching of the wasm failed"}catch(i){Ot(i)}}function Fe(){if(!se&&(N||M)){if(typeof fetch=="function"&&!Te(Pe))return fetch(Pe,{credentials:"same-origin"}).then(function(n){if(!n.ok)throw"failed to load wasm binary file at '"+Pe+"'";return n.arrayBuffer()}).catch(function(){return Ce(Pe)});if(ee)return new Promise(function(n,i){ee(Pe,function(e){n(new Uint8Array(e))},i)})}return Promise.resolve().then(function(){return Ce(Pe)})}function Dr(){var n={env:u,wasi_snapshot_preview1:u};function i(p,h){var g=p.exports;r.asm=g,_e=r.asm.memory,Bt(_e.buffer),Nt=r.asm.__indirect_function_table,an(r.asm.__wasm_call_ctors),ot()}Ye();function e(p){i(p.instance)}function t(p){return Fe().then(function(h){return WebAssembly.instantiate(h,n)}).then(function(h){return h}).then(p,function(h){ye("failed to asynchronously prepare wasm: "+h),Ot(h)})}function o(){return!se&&typeof WebAssembly.instantiateStreaming=="function"&&!at(Pe)&&!Te(Pe)&&!z&&typeof fetch=="function"?fetch(Pe,{credentials:"same-origin"}).then(function(p){var h=WebAssembly.instantiateStreaming(p,n);return h.then(e,function(g){return ye("wasm streaming compile failed: "+g),ye("falling back to ArrayBuffer instantiation"),t(e)})}):t(e)}if(r.instantiateWasm)try{var l=r.instantiateWasm(n,i);return l}catch(p){ye("Module.instantiateWasm callback failed with error: "+p),U(p)}return o().catch(U),{}}function gr(n){this.name="ExitStatus",this.message="Program terminated with exit("+n+")",this.status=n}function yr(n){for(;n.length>0;)n.shift()(r)}function ar(n,i,e,t){Ot("Assertion failed: "+Tt(n)+", at: "+[i?Tt(i):"unknown filename",e,t?Tt(t):"unknown function"])}var At=[];function xr(n){n.add_ref()}function _t(n){var i=new st(n);return i.get_caught()||i.set_caught(!0),i.set_rethrown(!1),At.push(i),xr(i),i.get_exception_ptr()}var ke=0,De=[];function ge(n){var i=De[n];return i||(n>=De.length&&(De.length=n+1),De[n]=i=Nt.get(n)),i}function Ne(n){if(n.release_ref()&&!n.get_rethrown()){var i=n.get_destructor();i&&ge(i)(n.excPtr),w(n.excPtr)}}function tt(){_setThrew(0);var n=At.pop();Ne(n),ke=0}function st(n){this.excPtr=n,this.ptr=n-24,this.set_type=function(i){oe[this.ptr+4>>2]=i},this.get_type=function(){return oe[this.ptr+4>>2]},this.set_destructor=function(i){oe[this.ptr+8>>2]=i},this.get_destructor=function(){return oe[this.ptr+8>>2]},this.set_refcount=function(i){ne[this.ptr>>2]=i},this.set_caught=function(i){i=i?1:0,me[this.ptr+12>>0]=i},this.get_caught=function(){return me[this.ptr+12>>0]!=0},this.set_rethrown=function(i){i=i?1:0,me[this.ptr+13>>0]=i},this.get_rethrown=function(){return me[this.ptr+13>>0]!=0},this.init=function(i,e){this.set_adjusted_ptr(0),this.set_type(i),this.set_destructor(e),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var i=ne[this.ptr>>2];ne[this.ptr>>2]=i+1},this.release_ref=function(){var i=ne[this.ptr>>2];return ne[this.ptr>>2]=i-1,i===1},this.set_adjusted_ptr=function(i){oe[this.ptr+16>>2]=i},this.get_adjusted_ptr=function(){return oe[this.ptr+16>>2]},this.get_exception_ptr=function(){var i=G(this.get_type());if(i)return oe[this.excPtr>>2];var e=this.get_adjusted_ptr();return e!==0?e:this.excPtr}}function _r(n){throw ke||(ke=n),n}function Gt(){var n=ke;if(!n)return F(0),0;var i=new st(n);i.set_adjusted_ptr(n);var e=i.get_type();if(!e)return F(0),n;for(var t=0;t<arguments.length;t++){var o=arguments[t];if(o===0||o===e)break;var l=i.ptr+16;if(j(o,e,l))return F(o),n}return F(e),n}function It(){var n=ke;if(!n)return F(0),0;var i=new st(n);i.set_adjusted_ptr(n);var e=i.get_type();if(!e)return F(0),n;for(var t=0;t<arguments.length;t++){var o=arguments[t];if(o===0||o===e)break;var l=i.ptr+16;if(j(o,e,l))return F(o),n}return F(e),n}function mt(n,i,e){var t=new st(n);throw t.init(i,e),ke=n,n}var He={};function jt(n){for(;n.length;){var i=n.pop(),e=n.pop();e(i)}}function Me(n){return this.fromWireType(ne[n>>2])}var Le={},$t={},Rt={},Ae=48,Et=57;function Y(n){if(n===void 0)return"_unknown";n=n.replace(/[^a-zA-Z0-9_]/g,"$");var i=n.charCodeAt(0);return i>=Ae&&i<=Et?"_"+n:n}function de(n,i){return n=Y(n),new Function("body","return function "+n+`() {
"use strict"; return body.apply(this, arguments);
};
`)(i)}function re(n,i){var e=de(i,function(t){this.name=i,this.message=t;var o=new Error(t).stack;o!==void 0&&(this.stack=this.toString()+`
`+o.replace(/^Error(:[^\n]*)?\n/,""))});return e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},e}var Q=void 0;function ze(n){throw new Q(n)}function ut(n,i,e){n.forEach(function(h){Rt[h]=i});function t(h){var g=e(h);g.length!==n.length&&ze("Mismatched type converter count");for(var m=0;m<n.length;++m)Ue(n[m],g[m])}var o=new Array(i.length),l=[],p=0;i.forEach((h,g)=>{$t.hasOwnProperty(h)?o[g]=$t[h]:(l.push(h),Le.hasOwnProperty(h)||(Le[h]=[]),Le[h].push(()=>{o[g]=$t[h],++p,p===l.length&&t(o)}))}),l.length===0&&t(o)}function mr(n){var i=He[n];delete He[n];var e=i.rawConstructor,t=i.rawDestructor,o=i.fields,l=o.map(p=>p.getterReturnType).concat(o.map(p=>p.setterArgumentType));ut([n],l,p=>{var h={};return o.forEach((g,m)=>{var P=g.fieldName,S=p[m],I=g.getter,B=g.getterContext,V=p[m+o.length],te=g.setter,Z=g.setterContext;h[P]={read:ve=>S.fromWireType(I(B,ve)),write:(ve,Oe)=>{var We=[];te(Z,ve,V.toWireType(We,Oe)),jt(We)}}}),[{name:i.name,fromWireType:function(g){var m={};for(var P in h)m[P]=h[P].read(g);return t(g),m},toWireType:function(g,m){for(var P in h)if(!(P in m))throw new TypeError('Missing field: "'+P+'"');var S=e();for(P in h)h[P].write(S,m[P]);return g!==null&&g.push(t,S),S},argPackAdvance:8,readValueFromPointer:Me,destructorFunction:t}]})}function sr(n,i,e,t,o){}function St(n){switch(n){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+n)}}function Jt(){for(var n=new Array(256),i=0;i<256;++i)n[i]=String.fromCharCode(i);ur=n}var ur=void 0;function Ee(n){for(var i="",e=n;le[e];)i+=ur[le[e++]];return i}var bt=void 0;function ae(n){throw new bt(n)}function Ue(n,i,e={}){if(!("argPackAdvance"in i))throw new TypeError("registerType registeredInstance requires argPackAdvance");var t=i.name;if(n||ae('type "'+t+'" must have a positive integer typeid pointer'),$t.hasOwnProperty(n)){if(e.ignoreDuplicateRegistrations)return;ae("Cannot register type '"+t+"' twice")}if($t[n]=i,delete Rt[n],Le.hasOwnProperty(n)){var o=Le[n];delete Le[n],o.forEach(l=>l())}}function br(n,i,e,t,o){var l=St(e);i=Ee(i),Ue(n,{name:i,fromWireType:function(p){return!!p},toWireType:function(p,h){return h?t:o},argPackAdvance:8,readValueFromPointer:function(p){var h;if(e===1)h=me;else if(e===2)h=ce;else if(e===4)h=ne;else throw new TypeError("Unknown boolean type size: "+i);return this.fromWireType(h[p>>l])},destructorFunction:null})}function ft(n){if(!(this instanceof gt)||!(n instanceof gt))return!1;for(var i=this.$$.ptrType.registeredClass,e=this.$$.ptr,t=n.$$.ptrType.registeredClass,o=n.$$.ptr;i.baseClass;)e=i.upcast(e),i=i.baseClass;for(;t.baseClass;)o=t.upcast(o),t=t.baseClass;return i===t&&e===o}function Ft(n){return{count:n.count,deleteScheduled:n.deleteScheduled,preservePointerOnDelete:n.preservePointerOnDelete,ptr:n.ptr,ptrType:n.ptrType,smartPtr:n.smartPtr,smartPtrType:n.smartPtrType}}function ct(n){function i(e){return e.$$.ptrType.registeredClass.name}ae(i(n)+" instance already deleted")}var Ke=!1;function Or(n){}function Xt(n){n.smartPtr?n.smartPtrType.rawDestructor(n.smartPtr):n.ptrType.registeredClass.rawDestructor(n.ptr)}function lt(n){n.count.value-=1;var i=n.count.value===0;i&&Xt(n)}function Ur(n,i,e){if(i===e)return n;if(e.baseClass===void 0)return null;var t=Ur(n,i,e.baseClass);return t===null?null:e.downcast(t)}var dt={};function fr(){return Object.keys(Ve).length}function Yt(){var n=[];for(var i in Ve)Ve.hasOwnProperty(i)&&n.push(Ve[i]);return n}var pt=[];function wr(){for(;pt.length;){var n=pt.pop();n.$$.deleteScheduled=!1,n.delete()}}var Kt=void 0;function wt(n){Kt=n,pt.length&&Kt&&Kt(wr)}function Ir(){r.getInheritedInstanceCount=fr,r.getLiveInheritedInstances=Yt,r.flushPendingDeletes=wr,r.setDelayFunction=wt}var Ve={};function vt(n,i){for(i===void 0&&ae("ptr should not be undefined");n.baseClass;)i=n.upcast(i),n=n.baseClass;return i}function cr(n,i){return i=vt(n,i),Ve[i]}function lr(n,i){(!i.ptrType||!i.ptr)&&ze("makeClassHandle requires ptr and ptrType");var e=!!i.smartPtrType,t=!!i.smartPtr;return e!==t&&ze("Both smartPtrType and smartPtr must be specified"),i.count={value:1},kt(Object.create(n,{$$:{value:i}}))}function Pr(n){var i=this.getPointee(n);if(!i)return this.destructor(n),null;var e=cr(this.registeredClass,i);if(e!==void 0){if(e.$$.count.value===0)return e.$$.ptr=i,e.$$.smartPtr=n,e.clone();var t=e.clone();return this.destructor(n),t}function o(){return this.isSmartPointer?lr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:i,smartPtrType:this,smartPtr:n}):lr(this.registeredClass.instancePrototype,{ptrType:this,ptr:n})}var l=this.registeredClass.getActualType(i),p=dt[l];if(!p)return o.call(this);var h;this.isConst?h=p.constPointerType:h=p.pointerType;var g=Ur(i,this.registeredClass,h.registeredClass);return g===null?o.call(this):this.isSmartPointer?lr(h.registeredClass.instancePrototype,{ptrType:h,ptr:g,smartPtrType:this,smartPtr:n}):lr(h.registeredClass.instancePrototype,{ptrType:h,ptr:g})}function kt(n){return typeof FinalizationRegistry>"u"?(kt=i=>i,n):(Ke=new FinalizationRegistry(i=>{lt(i.$$)}),kt=i=>{var e=i.$$,t=!!e.smartPtr;if(t){var o={$$:e};Ke.register(i,o,i)}return i},Or=i=>Ke.unregister(i),kt(n))}function sn(){if(this.$$.ptr||ct(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var n=kt(Object.create(Object.getPrototypeOf(this),{$$:{value:Ft(this.$$)}}));return n.$$.count.value+=1,n.$$.deleteScheduled=!1,n}function un(){this.$$.ptr||ct(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ae("Object already scheduled for deletion"),Or(this),lt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function fn(){return!this.$$.ptr}function cn(){return this.$$.ptr||ct(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ae("Object already scheduled for deletion"),pt.push(this),pt.length===1&&Kt&&Kt(wr),this.$$.deleteScheduled=!0,this}function ht(){gt.prototype.isAliasOf=ft,gt.prototype.clone=sn,gt.prototype.delete=un,gt.prototype.isDeleted=fn,gt.prototype.deleteLater=cn}function gt(){}function rt(n,i,e){if(n[i].overloadTable===void 0){var t=n[i];n[i]=function(){return n[i].overloadTable.hasOwnProperty(arguments.length)||ae("Function '"+e+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+n[i].overloadTable+")!"),n[i].overloadTable[arguments.length].apply(this,arguments)},n[i].overloadTable=[],n[i].overloadTable[t.argCount]=t}}function Be(n,i,e){r.hasOwnProperty(n)?((e===void 0||r[n].overloadTable!==void 0&&r[n].overloadTable[e]!==void 0)&&ae("Cannot register public name '"+n+"' twice"),rt(r,n,n),r.hasOwnProperty(e)&&ae("Cannot register multiple overloads of a function with the same number of arguments ("+e+")!"),r[n].overloadTable[e]=i):(r[n]=i,e!==void 0&&(r[n].numArguments=e))}function jr(n,i,e,t,o,l,p,h){this.name=n,this.constructor=i,this.instancePrototype=e,this.rawDestructor=t,this.baseClass=o,this.getActualType=l,this.upcast=p,this.downcast=h,this.pureVirtualFunctions=[]}function Wt(n,i,e){for(;i!==e;)i.upcast||ae("Expected null or instance of "+e.name+", got an instance of "+i.name),n=i.upcast(n),i=i.baseClass;return n}function Qt(n,i){if(i===null)return this.isReference&&ae("null is not a valid "+this.name),0;i.$$||ae('Cannot pass "'+Ar(i)+'" as a '+this.name),i.$$.ptr||ae("Cannot pass deleted object as a pointer of type "+this.name);var e=i.$$.ptrType.registeredClass,t=Wt(i.$$.ptr,e,this.registeredClass);return t}function Se(n,i){var e;if(i===null)return this.isReference&&ae("null is not a valid "+this.name),this.isSmartPointer?(e=this.rawConstructor(),n!==null&&n.push(this.rawDestructor,e),e):0;i.$$||ae('Cannot pass "'+Ar(i)+'" as a '+this.name),i.$$.ptr||ae("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&i.$$.ptrType.isConst&&ae("Cannot convert argument of type "+(i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name)+" to parameter type "+this.name);var t=i.$$.ptrType.registeredClass;if(e=Wt(i.$$.ptr,t,this.registeredClass),this.isSmartPointer)switch(i.$$.smartPtr===void 0&&ae("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:i.$$.smartPtrType===this?e=i.$$.smartPtr:ae("Cannot convert argument of type "+(i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:e=i.$$.smartPtr;break;case 2:if(i.$$.smartPtrType===this)e=i.$$.smartPtr;else{var o=i.clone();e=this.rawShare(e,rr.toHandle(function(){o.delete()})),n!==null&&n.push(this.rawDestructor,e)}break;default:ae("Unsupporting sharing policy")}return e}function Wr(n,i){if(i===null)return this.isReference&&ae("null is not a valid "+this.name),0;i.$$||ae('Cannot pass "'+Ar(i)+'" as a '+this.name),i.$$.ptr||ae("Cannot pass deleted object as a pointer of type "+this.name),i.$$.ptrType.isConst&&ae("Cannot convert argument of type "+i.$$.ptrType.name+" to parameter type "+this.name);var e=i.$$.ptrType.registeredClass,t=Wt(i.$$.ptr,e,this.registeredClass);return t}function Qe(n){return this.rawGetPointee&&(n=this.rawGetPointee(n)),n}function Ie(n){this.rawDestructor&&this.rawDestructor(n)}function Tr(n){n!==null&&n.delete()}function Ht(){Ze.prototype.getPointee=Qe,Ze.prototype.destructor=Ie,Ze.prototype.argPackAdvance=8,Ze.prototype.readValueFromPointer=Me,Ze.prototype.deleteObject=Tr,Ze.prototype.fromWireType=Pr}function Ze(n,i,e,t,o,l,p,h,g,m,P){this.name=n,this.registeredClass=i,this.isReference=e,this.isConst=t,this.isSmartPointer=o,this.pointeeType=l,this.sharingPolicy=p,this.rawGetPointee=h,this.rawConstructor=g,this.rawShare=m,this.rawDestructor=P,!o&&i.baseClass===void 0?t?(this.toWireType=Qt,this.destructorFunction=null):(this.toWireType=Wr,this.destructorFunction=null):this.toWireType=Se}function Zt(n,i,e){r.hasOwnProperty(n)||ze("Replacing nonexistant public symbol"),r[n].overloadTable!==void 0&&e!==void 0?r[n].overloadTable[e]=i:(r[n]=i,r[n].argCount=e)}function Hr(n,i,e){var t=r["dynCall_"+n];return e&&e.length?t.apply(null,[i].concat(e)):t.call(null,i)}function Mr(n,i,e){if(n.includes("j"))return Hr(n,i,e);var t=ge(i).apply(null,e);return t}function dr(n,i){var e=[];return function(){return e.length=0,Object.assign(e,arguments),Mr(n,i,e)}}function be(n,i){n=Ee(n);function e(){return n.includes("j")?dr(n,i):ge(i)}var t=e();return typeof t!="function"&&ae("unknown function pointer with signature "+n+": "+i),t}var er=void 0;function je(n){var i=C(n),e=Ee(i);return v(i),e}function xe(n,i){var e=[],t={};function o(l){if(!t[l]&&!$t[l]){if(Rt[l]){Rt[l].forEach(o);return}e.push(l),t[l]=!0}}throw i.forEach(o),new er(n+": "+e.map(je).join([", "]))}function Lr(n,i,e,t,o,l,p,h,g,m,P,S,I){P=Ee(P),l=be(o,l),h&&(h=be(p,h)),m&&(m=be(g,m)),I=be(S,I);var B=Y(P);Be(B,function(){xe("Cannot construct "+P+" due to unbound types",[t])}),ut([n,i,e],t?[t]:[],function(V){V=V[0];var te,Z;t?(te=V.registeredClass,Z=te.instancePrototype):Z=gt.prototype;var ve=de(B,function(){if(Object.getPrototypeOf(this)!==Oe)throw new bt("Use 'new' to construct "+P);if(We.constructor_body===void 0)throw new bt(P+" has no accessible constructor");var xn=We.constructor_body[arguments.length];if(xn===void 0)throw new bt("Tried to invoke ctor of "+P+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(We.constructor_body).toString()+") parameters instead!");return xn.apply(this,arguments)}),Oe=Object.create(Z,{constructor:{value:ve}});ve.prototype=Oe;var We=new jr(P,ve,Oe,I,te,l,h,m),Sn=new Ze(P,We,!0,!1,!1),Lt=new Ze(P+"*",We,!1,!1,!1),Wn=new Ze(P+" const*",We,!1,!0,!1);return dt[n]={pointerType:Lt,constPointerType:Wn},Zt(B,ve),[Sn,Lt,Wn]})}function nt(n,i){for(var e=[],t=0;t<n;t++)e.push(oe[i+t*4>>2]);return e}function ln(n,i){if(!(n instanceof Function))throw new TypeError("new_ called with constructor type "+typeof n+" which is not a function");var e=de(n.name||"unknownFunctionName",function(){});e.prototype=n.prototype;var t=new e,o=n.apply(t,i);return o instanceof Object?o:t}function qe(n,i,e,t,o){var l=i.length;l<2&&ae("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var p=i[1]!==null&&e!==null,h=!1,g=1;g<i.length;++g)if(i[g]!==null&&i[g].destructorFunction===void 0){h=!0;break}for(var m=i[0].name!=="void",P="",S="",g=0;g<l-2;++g)P+=(g!==0?", ":"")+"arg"+g,S+=(g!==0?", ":"")+"arg"+g+"Wired";var I="return function "+Y(n)+"("+P+`) {
if (arguments.length !== `+(l-2)+`) {
throwBindingError('function `+n+" called with ' + arguments.length + ' arguments, expected "+(l-2)+` args!');
}
`;h&&(I+=`var destructors = [];
`);var B=h?"destructors":"null",V=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],te=[ae,t,o,jt,i[0],i[1]];p&&(I+="var thisWired = classParam.toWireType("+B+`, this);
`);for(var g=0;g<l-2;++g)I+="var arg"+g+"Wired = argType"+g+".toWireType("+B+", arg"+g+"); // "+i[g+2].name+`
`,V.push("argType"+g),te.push(i[g+2]);if(p&&(S="thisWired"+(S.length>0?", ":"")+S),I+=(m?"var rv = ":"")+"invoker(fn"+(S.length>0?", ":"")+S+`);
`,h)I+=`runDestructors(destructors);
`;else for(var g=p?1:2;g<i.length;++g){var Z=g===1?"thisWired":"arg"+(g-2)+"Wired";i[g].destructorFunction!==null&&(I+=Z+"_dtor("+Z+"); // "+i[g].name+`
`,V.push(Z+"_dtor"),te.push(i[g].destructorFunction))}m&&(I+=`var ret = retType.fromWireType(rv);
return ret;
`),I+=`}
`,V.push(I);var ve=ln(Function,V).apply(null,te);return ve}function Pt(n,i,e,t,o,l){it(i>0);var p=nt(i,e);o=be(t,o),ut([],[n],function(h){h=h[0];var g="constructor "+h.name;if(h.registeredClass.constructor_body===void 0&&(h.registeredClass.constructor_body=[]),h.registeredClass.constructor_body[i-1]!==void 0)throw new bt("Cannot register multiple constructors with identical number of parameters ("+(i-1)+") for class '"+h.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return h.registeredClass.constructor_body[i-1]=()=>{xe("Cannot construct "+h.name+" due to unbound types",p)},ut([],p,function(m){return m.splice(1,0,null),h.registeredClass.constructor_body[i-1]=qe(g,m,null,o,l),[]}),[]})}function Cr(n,i,e,t,o,l,p,h){var g=nt(e,t);i=Ee(i),l=be(o,l),ut([],[n],function(m){m=m[0];var P=m.name+"."+i;i.startsWith("@@")&&(i=Symbol[i.substring(2)]),h&&m.registeredClass.pureVirtualFunctions.push(i);function S(){xe("Cannot call "+P+" due to unbound types",g)}var I=m.registeredClass.instancePrototype,B=I[i];return B===void 0||B.overloadTable===void 0&&B.className!==m.name&&B.argCount===e-2?(S.argCount=e-2,S.className=m.name,I[i]=S):(rt(I,i,P),I[i].overloadTable[e-2]=S),ut([],g,function(V){var te=qe(P,V,m,l,p);return I[i].overloadTable===void 0?(te.argCount=e-2,I[i]=te):I[i].overloadTable[e-2]=te,[]}),[]})}var tr=[],et=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Vr(n){n>4&&--et[n].refcount===0&&(et[n]=void 0,tr.push(n))}function dn(){for(var n=0,i=5;i<et.length;++i)et[i]!==void 0&&++n;return n}function pn(){for(var n=5;n<et.length;++n)if(et[n]!==void 0)return et[n];return null}function Br(){r.count_emval_handles=dn,r.get_first_emval=pn}var rr={toValue:n=>(n||ae("Cannot use deleted val. handle = "+n),et[n].value),toHandle:n=>{switch(n){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var i=tr.length?tr.pop():et.length;return et[i]={refcount:1,value:n},i}}}};function Nr(n,i){i=Ee(i),Ue(n,{name:i,fromWireType:function(e){var t=rr.toValue(e);return Vr(e),t},toWireType:function(e,t){return rr.toHandle(t)},argPackAdvance:8,readValueFromPointer:Me,destructorFunction:null})}function Ar(n){if(n===null)return"null";var i=typeof n;return i==="object"||i==="array"||i==="function"?n.toString():""+n}function vn(n,i){switch(i){case 2:return function(e){return this.fromWireType(ie[e>>2])};case 3:return function(e){return this.fromWireType(he[e>>3])};default:throw new TypeError("Unknown float type: "+n)}}function hn(n,i,e){var t=St(e);i=Ee(i),Ue(n,{name:i,fromWireType:function(o){return o},toWireType:function(o,l){return l},argPackAdvance:8,readValueFromPointer:vn(i,t),destructorFunction:null})}function gn(n,i,e,t,o,l){var p=nt(i,e);n=Ee(n),o=be(t,o),Be(n,function(){xe("Cannot call "+n+" due to unbound types",p)},i-1),ut([],p,function(h){var g=[h[0],null].concat(h.slice(1));return Zt(n,qe(n,g,null,o,l),i-1),[]})}function yn(n,i,e){switch(i){case 0:return e?function(o){return me[o]}:function(o){return le[o]};case 1:return e?function(o){return ce[o>>1]}:function(o){return ue[o>>1]};case 2:return e?function(o){return ne[o>>2]}:function(o){return oe[o>>2]};default:throw new TypeError("Unknown integer type: "+n)}}function _n(n,i,e,t,o){i=Ee(i);var l=St(e),p=S=>S;if(t===0){var h=32-8*e;p=S=>S<<h>>>h}var g=i.includes("unsigned"),m=(S,I)=>{},P;g?P=function(S,I){return m(I,this.name),I>>>0}:P=function(S,I){return m(I,this.name),I},Ue(n,{name:i,fromWireType:p,toWireType:P,argPackAdvance:8,readValueFromPointer:yn(i,l,t!==0),destructorFunction:null})}function mn(n,i,e){var t=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=t[i];function l(p){p=p>>2;var h=oe,g=h[p],m=h[p+1];return new o(Ge,m,g)}e=Ee(e),Ue(n,{name:e,fromWireType:l,argPackAdvance:8,readValueFromPointer:l},{ignoreDuplicateRegistrations:!0})}function bn(n,i){i=Ee(i);var e=i==="std::string";Ue(n,{name:i,fromWireType:function(t){var o=oe[t>>2],l=t+4,p;if(e)for(var h=l,g=0;g<=o;++g){var m=l+g;if(g==o||le[m]==0){var P=m-h,S=Tt(h,P);p===void 0?p=S:(p+="\0",p+=S),h=m+1}}else{for(var I=new Array(o),g=0;g<o;++g)I[g]=String.fromCharCode(le[l+g]);p=I.join("")}return v(t),p},toWireType:function(t,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var l,p=typeof o=="string";p||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||ae("Cannot pass non-string to std::string"),e&&p?l=ir(o):l=o.length;var h=f(4+l+1),g=h+4;if(oe[h>>2]=l,e&&p)vr(o,g,l+1);else if(p)for(var m=0;m<l;++m){var P=o.charCodeAt(m);P>255&&(v(g),ae("String has UTF-16 code units that do not fit in 8 bits")),le[g+m]=P}else for(var m=0;m<l;++m)le[g+m]=o[m];return t!==null&&t.push(v,h),h},argPackAdvance:8,readValueFromPointer:Me,destructorFunction:function(t){v(t)}})}var zr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function wn(n,i){for(var e=n,t=e>>1,o=t+i/2;!(t>=o)&&ue[t];)++t;if(e=t<<1,e-n>32&&zr)return zr.decode(le.subarray(n,e));for(var l="",p=0;!(p>=i/2);++p){var h=ce[n+p*2>>1];if(h==0)break;l+=String.fromCharCode(h)}return l}function qr(n,i,e){if(e===void 0&&(e=2147483647),e<2)return 0;e-=2;for(var t=i,o=e<n.length*2?e/2:n.length,l=0;l<o;++l){var p=n.charCodeAt(l);ce[i>>1]=p,i+=2}return ce[i>>1]=0,i-t}function Gr(n){return n.length*2}function Pn(n,i){for(var e=0,t="";!(e>=i/4);){var o=ne[n+e*4>>2];if(o==0)break;if(++e,o>=65536){var l=o-65536;t+=String.fromCharCode(55296|l>>10,56320|l&1023)}else t+=String.fromCharCode(o)}return t}function $r(n,i,e){if(e===void 0&&(e=2147483647),e<4)return 0;for(var t=i,o=t+e-4,l=0;l<n.length;++l){var p=n.charCodeAt(l);if(p>=55296&&p<=57343){var h=n.charCodeAt(++l);p=65536+((p&1023)<<10)|h&1023}if(ne[i>>2]=p,i+=4,i+4>o)break}return ne[i>>2]=0,i-t}function Jr(n){for(var i=0,e=0;e<n.length;++e){var t=n.charCodeAt(e);t>=55296&&t<=57343&&++e,i+=4}return i}function Xr(n,i,e){e=Ee(e);var t,o,l,p,h;i===2?(t=wn,o=qr,p=Gr,l=()=>ue,h=1):i===4&&(t=Pn,o=$r,p=Jr,l=()=>oe,h=2),Ue(n,{name:e,fromWireType:function(g){for(var m=oe[g>>2],P=l(),S,I=g+4,B=0;B<=m;++B){var V=g+4+B*i;if(B==m||P[V>>h]==0){var te=V-I,Z=t(I,te);S===void 0?S=Z:(S+="\0",S+=Z),I=V+i}}return v(g),S},toWireType:function(g,m){typeof m!="string"&&ae("Cannot pass non-string to C++ string type "+e);var P=p(m),S=f(4+P+i);return oe[S>>2]=P>>h,o(m,S+4,P+i),g!==null&&g.push(v,S),S},argPackAdvance:8,readValueFromPointer:Me,destructorFunction:function(g){v(g)}})}function Rr(n,i,e,t,o,l){He[n]={name:Ee(i),rawConstructor:be(e,t),rawDestructor:be(o,l),fields:[]}}function Tn(n,i,e,t,o,l,p,h,g,m){He[n].fields.push({fieldName:Ee(i),getterReturnType:e,getter:be(t,o),getterContext:l,setterArgumentType:p,setter:be(h,g),setterContext:m})}function Yr(n,i){i=Ee(i),Ue(n,{isVoid:!0,name:i,argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})}function Cn(n){n>4&&(et[n].refcount+=1)}function Kr(n,i){var e=$t[n];return e===void 0&&ae(i+" has unknown type "+je(n)),e}function An(n,i){n=Kr(n,"_emval_take_value");var e=n.readValueFromPointer(i);return rr.toHandle(e)}function $n(){Ot("")}function Rn(n,i,e){le.copyWithin(n,i,i+e)}function En(){return 2147483648}function Er(n){try{return _e.grow(n-Ge.byteLength+65535>>>16),Bt(_e.buffer),1}catch{}}function Sr(n){var i=le.length;n=n>>>0;var e=En();if(n>e)return!1;let t=(g,m)=>g+(m-g%m)%m;for(var o=1;o<=4;o*=2){var l=i*(1+.2/o);l=Math.min(l,n+100663296);var p=Math.min(e,t(Math.max(n,l),65536)),h=Er(p);if(h)return!0}return!1}function Dt(n){return 52}function Mt(n,i,e,t,o){return 70}var yt=[null,[],[]];function Qr(n,i){var e=yt[n];i===0||i===10?((n===1?we:ye)(xt(e,0)),e.length=0):e.push(i)}function Zr(n,i,e,t){for(var o=0,l=0;l<e;l++){var p=oe[i>>2],h=oe[i+4>>2];i+=8;for(var g=0;g<h;g++)Qr(n,le[p+g]);o+=h}return oe[t>>2]=o,0}function Fr(n){return n}function en(n){var i=r["_"+n];return i}function pr(n,i){me.set(n,i)}function tn(n,i,e,t,o){var l={string:V=>{var te=0;if(V!=null&&V!==0){var Z=(V.length<<2)+1;te=x(Z),vr(V,te,Z)}return te},array:V=>{var te=x(V.length);return pr(V,te),te}};function p(V){return i==="string"?Tt(V):i==="boolean"?!!V:V}var h=en(n),g=[],m=0;if(t)for(var P=0;P<t.length;P++){var S=l[e[P]];S?(m===0&&(m=k()),g[P]=S(t[P])):g[P]=t[P]}var I=h.apply(null,g);function B(V){return m!==0&&A(m),p(V)}return I=B(I),I}Q=r.InternalError=re(Error,"InternalError"),Jt(),bt=r.BindingError=re(Error,"BindingError"),ht(),Ir(),Ht(),er=r.UnboundTypeError=re(Error,"UnboundTypeError"),Br();var u={__assert_fail:ar,__cxa_begin_catch:_t,__cxa_end_catch:tt,__cxa_find_matching_catch_2:Gt,__cxa_find_matching_catch_3:It,__cxa_throw:mt,__resumeException:_r,_embind_finalize_value_object:mr,_embind_register_bigint:sr,_embind_register_bool:br,_embind_register_class:Lr,_embind_register_class_constructor:Pt,_embind_register_class_function:Cr,_embind_register_emval:Nr,_embind_register_float:hn,_embind_register_function:gn,_embind_register_integer:_n,_embind_register_memory_view:mn,_embind_register_std_string:bn,_embind_register_std_wstring:Xr,_embind_register_value_object:Rr,_embind_register_value_object_field:Tn,_embind_register_void:Yr,_emval_decref:Vr,_emval_incref:Cn,_emval_take_value:An,abort:$n,emscripten_memcpy_big:Rn,emscripten_resize_heap:Sr,fd_close:Dt,fd_seek:Mt,fd_write:Zr,invoke_i:b,invoke_ii:J,invoke_iii:O,invoke_iiii:d,invoke_v:a,invoke_vi:K,invoke_viiii:s,invoke_viiiiii:T,llvm_eh_typeid_for:Fr};Dr(),r.___wasm_call_ctors=function(){return(r.___wasm_call_ctors=r.asm.__wasm_call_ctors).apply(null,arguments)};var f=r._malloc=function(){return(f=r._malloc=r.asm.malloc).apply(null,arguments)},v=r._free=function(){return(v=r._free=r.asm.free).apply(null,arguments)},w=r.___cxa_free_exception=function(){return(w=r.___cxa_free_exception=r.asm.__cxa_free_exception).apply(null,arguments)},C=r.___getTypeName=function(){return(C=r.___getTypeName=r.asm.__getTypeName).apply(null,arguments)};r.__embind_initialize_bindings=function(){return(r.__embind_initialize_bindings=r.asm._embind_initialize_bindings).apply(null,arguments)},r.___errno_location=function(){return(r.___errno_location=r.asm.__errno_location).apply(null,arguments)};var F=r.setTempRet0=function(){return(F=r.setTempRet0=r.asm.setTempRet0).apply(null,arguments)},k=r.stackSave=function(){return(k=r.stackSave=r.asm.stackSave).apply(null,arguments)},A=r.stackRestore=function(){return(A=r.stackRestore=r.asm.stackRestore).apply(null,arguments)},x=r.stackAlloc=function(){return(x=r.stackAlloc=r.asm.stackAlloc).apply(null,arguments)},j=r.___cxa_can_catch=function(){return(j=r.___cxa_can_catch=r.asm.__cxa_can_catch).apply(null,arguments)},G=r.___cxa_is_pointer_type=function(){return(G=r.___cxa_is_pointer_type=r.asm.__cxa_is_pointer_type).apply(null,arguments)};r.dynCall_ji=function(){return(r.dynCall_ji=r.asm.dynCall_ji).apply(null,arguments)},r.dynCall_iiji=function(){return(r.dynCall_iiji=r.asm.dynCall_iiji).apply(null,arguments)},r.dynCall_jiji=function(){return(r.dynCall_jiji=r.asm.dynCall_jiji).apply(null,arguments)};function J(n,i){var e=k();try{return ge(n)(i)}catch(t){if(A(e),t!==t+0)throw t;_setThrew(1,0)}}function K(n,i){var e=k();try{ge(n)(i)}catch(t){if(A(e),t!==t+0)throw t;_setThrew(1,0)}}function s(n,i,e,t,o){var l=k();try{ge(n)(i,e,t,o)}catch(p){if(A(l),p!==p+0)throw p;_setThrew(1,0)}}function a(n){var i=k();try{ge(n)()}catch(e){if(A(i),e!==e+0)throw e;_setThrew(1,0)}}function d(n,i,e,t){var o=k();try{return ge(n)(i,e,t)}catch(l){if(A(o),l!==l+0)throw l;_setThrew(1,0)}}function b(n){var i=k();try{return ge(n)()}catch(e){if(A(i),e!==e+0)throw e;_setThrew(1,0)}}function T(n,i,e,t,o,l,p){var h=k();try{ge(n)(i,e,t,o,l,p)}catch(g){if(A(h),g!==g+0)throw g;_setThrew(1,0)}}function O(n,i,e){var t=k();try{return ge(n)(i,e)}catch(o){if(A(t),o!==o+0)throw o;_setThrew(1,0)}}r.ccall=tn;var D;Xe=function n(){D||E(),D||(Xe=n)};function E(n){if(Je>0||(hr(),Je>0))return;function i(){D||(D=!0,r.calledRun=!0,!Re&&(kr(),L(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),nn()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),i()},1)):i()}if(r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return E(),r.ready}})();c.exports=_})(pi);var so=pi.exports,uo=zn(so);const fo=new URL("/static/dv3d/assets/openjphjs-C-BUUy4a.wasm",import.meta.url),Un={codec:void 0,decoder:void 0,decodeConfig:{}};function co(c,y,_){const R={width:y,height:_};for(;c>0;)R.width=Math.ceil(R.width/2),R.height=Math.ceil(R.height/2),c--;return R}function lo(c){if(Un.decodeConfig=c,Un.codec)return Promise.resolve();const y=uo({locateFile:_=>_.endsWith(".wasm")?fo.toString():_});return new Promise((_,R)=>{y.then($=>{Un.codec=$,Un.decoder=new $.HTJ2KDecoder,_()},R)})}async function po(c,y){await lo();const _=new Un.codec.HTJ2KDecoder,R=_.getEncodedBuffer(c.length);R.set(c);const $=y.decodeLevel||0;_.decodeSubResolution($);const r=_.getFrameInfo();if(y.decodeLevel>0){const{width:Vt,height:xt}=co(y.decodeLevel,r.width,r.height);r.width=Vt,r.height=xt}const L=_.getDecodedBuffer();new Uint8Array(L.length).set(L);const W=`x: ${_.getImageOffset().x}, y: ${_.getImageOffset().y}`,N=_.getNumDecompositions(),M=_.getNumLayers(),z=["unknown","LRCP","RLCP","RPCL","PCRL","CPRL"][_.getProgressionOrder()+1],H=_.getIsReversible(),X=`${_.getBlockDimensions().width} x ${_.getBlockDimensions().height}`,q=`${_.getTileSize().width} x ${_.getTileSize().height}`,ee=`${_.getTileOffset().x}, ${_.getTileOffset().y}`,fe=`${L.length.toLocaleString()} bytes`,$e=`${(L.length/R.length).toFixed(2)}:1`,pe={columns:r.width,rows:r.height,bitsPerPixel:r.bitsPerSample,signed:r.isSigned,bytesPerPixel:y.bytesPerPixel,componentsPerPixel:r.componentCount};let we=vo(r,L);const{buffer:ye,byteOffset:se,byteLength:_e}=we,Re=ye.slice(se,se+_e);we=new we.constructor(Re);const it={imageOffset:W,numDecompositions:N,numLayers:M,progessionOrder:z,reversible:H,blockDimensions:X,tileSize:q,tileOffset:ee,decodedSize:fe,compressionRatio:$e};return{...y,pixelData:we,imageInfo:pe,encodeOptions:it,...it,...pe}}function vo(c,y){return c.bitsPerSample>8?c.isSigned?new Int16Array(y.buffer,y.byteOffset,y.byteLength/2):new Uint16Array(y.buffer,y.byteOffset,y.byteLength/2):c.isSigned?new Int8Array(y.buffer,y.byteOffset,y.byteLength):new Uint8Array(y.buffer,y.byteOffset,y.byteLength)}function ho(c,y){const _=c.length,{rescaleSlope:R,rescaleIntercept:$,suvbw:r,doseGridScaling:L}=y;if(y.modality==="PT"&&typeof r=="number"&&!isNaN(r))for(let U=0;U<_;U++)c[U]=r*(c[U]*R+$);else if(y.modality==="RTDOSE"&&typeof L=="number"&&!isNaN(L))for(let U=0;U<_;U++)c[U]=c[U]*L;else for(let U=0;U<_;U++)c[U]=c[U]*R+$;return!0}function go(c){let y=c[0],_=c[0],R;const $=c.length;for(let r=1;r<$;r++)R=c[r],y=Math.min(y,R),_=Math.max(_,R);return{min:y,max:_}}function vi(c,y){let _;return Number.isInteger(c)&&Number.isInteger(y)&&(c>=0?y<=255?_=Uint8Array:y<=65535?_=Uint16Array:y<=4294967295&&(_=Uint32Array):c>=-128&&y<=127?_=Int8Array:c>=-32768&&y<=32767&&(_=Int16Array)),_||Float32Array}function yo(c,y,_){return vi(c,y)===_}function _o(c){return c==="RGB"||c==="PALETTE COLOR"||c==="YBR_FULL"||c==="YBR_FULL_422"||c==="YBR_PARTIAL_422"||c==="YBR_PARTIAL_420"||c==="YBR_RCT"||c==="YBR_ICT"}const mo={bilinear:yi,replicate:_i},ni={Uint8Array,Uint16Array,Int16Array,Float32Array,Uint32Array};function bo(c,y,_,R){var pe,we,ye;const $=c.pixelRepresentation!==void 0&&c.pixelRepresentation===1,r=$&&c.bitsStored!==void 0?32-c.bitsStored:void 0;if($&&r!==void 0)for(let se=0;se<c.pixelData.length;se++)c.pixelData[se]=c.pixelData[se]<<r>>r;let L=c.pixelData;c.pixelDataLength=c.pixelData.length;const{min:U,max:W}=go(c.pixelData),N=typeof y.allowFloatRendering<"u"?y.allowFloatRendering:!0;let M=_o(c.photometricInterpretation)&&((pe=y.targetBuffer)==null?void 0:pe.offset)===void 0;const H=((we=y.preScale)==null?void 0:we.enabled)&&Object.values(y.preScale.scalingParameters).some(se=>typeof se=="number"&&!Number.isInteger(se)),X=!y.preScale.enabled||!N&&H,q=(ye=y.targetBuffer)==null?void 0:ye.type;if(q&&y.preScale.enabled&&!X){const se=y.preScale.scalingParameters,_e=Jn(U,W,se);M=!yo(_e.min,_e.max,ni[q])}q&&!M?L=Po(y,c,ni,L):y.preScale.enabled&&!X?L=To(y,U,W,c):L=hi(U,W,c);let ee=U,fe=W;if(y.preScale.enabled&&!X){const se=y.preScale.scalingParameters;if(gi(se),wo(se)){ho(L,se),c.preScale={...y.preScale,scaled:!0};const Re=Jn(U,W,se);ee=Re.min,fe=Re.max}}else X&&(c.preScale={enabled:!0,scaled:!1},ee=U,fe=W);c.pixelData=L,c.smallestPixelValue=ee,c.largestPixelValue=fe;const $e=new Date().getTime();return c.decodeTimeInMS=$e-_,c}function wo(c){const{rescaleSlope:y,rescaleIntercept:_,modality:R,doseGridScaling:$,suvbw:r}=c;return typeof y=="number"&&typeof _=="number"||R==="RTDOSE"&&typeof $=="number"||R==="PT"&&typeof r=="number"}function Po(c,y,_,R){const{arrayBuffer:$,type:r,offset:L=0,length:U,rows:W}=c.targetBuffer,N=_[r];if(!N)throw new Error(`target array ${r} is not supported, or doesn't exist.`);W&&W!=y.rows&&Ao(y,c.targetBuffer,N);const M=y.pixelDataLength,z=L,H=U??M-z,X=y.pixelData;if(H!==X.length)throw new Error(`target array for image does not have the same length (${H}) as the decoded image length (${X.length}).`);const q=$?new N($,z,H):new N(H);return q.set(X,0),R=q,R}function To(c,y,_,R){const $=c.preScale.scalingParameters;gi($);const r=Jn(y,_,$);return hi(r.min,r.max,R)}function hi(c,y,_){const R=vi(c,y),$=new R(_.pixelData.length);return $.set(_.pixelData,0),$}function Jn(c,y,_){const{rescaleSlope:R,rescaleIntercept:$,modality:r,doseGridScaling:L,suvbw:U}=_;return r==="PT"&&typeof U=="number"&&!isNaN(U)?{min:U*(c*R+$),max:U*(y*R+$)}:r==="RTDOSE"&&typeof L=="number"&&!isNaN(L)?{min:c*L,max:y*L}:typeof R=="number"&&typeof $=="number"?{min:R*c+$,max:R*y+$}:{min:c,max:y}}function gi(c){if(!c)throw new Error("options.preScale.scalingParameters must be defined if preScale.enabled is true, and scalingParameters cannot be derived from the metadata providers.")}function Co(c,y,_){const{samplesPerPixel:R}=c,{rows:$,columns:r}=y,L=$*r*R,U=new _(L),W=U.byteLength/L;return{pixelData:U,rows:$,columns:r,frameInfo:{...c.frameInfo,rows:$,columns:r},imageInfo:{...c.imageInfo,rows:$,columns:r,bytesPerPixel:W}}}function Ao(c,y,_){const R=Co(c,y,_),{scalingType:$="replicate"}=y;return mo[$](c,R),Object.assign(c,R),c.pixelDataLength=c.pixelData.length,c}async function $o(c,y,_,R,$,r){const L=new Date().getTime();let U=null,W;switch(y){case"1.2.840.10008.1.2":case"1.2.840.10008.1.2.1":U=Zn(c,_);break;case"1.2.840.10008.1.2.2":U=xi(c,_);break;case"1.2.840.10008.1.2.1.99":U=Zn(c,_);break;case"1.2.840.10008.1.2.5":U=Oi(c,_);break;case"1.2.840.10008.1.2.4.50":W={...c},U=zi(_,W);break;case"1.2.840.10008.1.2.4.51":U=Ji(c,_);break;case"1.2.840.10008.1.2.4.57":U=ei(c,_);break;case"1.2.840.10008.1.2.4.70":U=ei(c,_);break;case"1.2.840.10008.1.2.4.80":W={signed:c.pixelRepresentation===1,bytesPerPixel:c.bitsAllocated<=8?1:2,...c},U=ti(_,W);break;case"1.2.840.10008.1.2.4.81":W={signed:c.pixelRepresentation===1,bytesPerPixel:c.bitsAllocated<=8?1:2,...c},U=ti(_,W);break;case"1.2.840.10008.1.2.4.90":W={...c},U=ri(_,W);break;case"1.2.840.10008.1.2.4.91":W={...c},U=ri(_,W);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":W={...c},U=po(_,W);break;default:throw new Error(`no decoder for transfer syntax ${y}`)}if(!U)throw new Error("decodePromise not defined");const N=await U,M=bo(N,$,L);return r==null||r(M),M}const Ro={decodeTask({imageFrame:c,transferSyntax:y,decodeConfig:_,options:R,pixelData:$,callbackFn:r}){return $o(c,y,$,_,R,r)}};Xn(Ro);