async function ortWasmThreaded(moduleArg={}){var moduleRtn;var g=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope,k=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type,m=ba&&self.name?.startsWith("em-pthread");if(k){const {createRequire:a}=await import("module");var require=a(import.meta.url),ca=require("worker_threads");global.Worker=ca.Worker;m=(ba=!ca.S)&&"em-pthread"==ca.workerData}g.mountExternalData=(a,b)=>{a.startsWith("./")&&(a=a.substring(2));(g.o||(g.o=new Map)).set(a,b)};
g.unmountExternalData=()=>{delete g.o};var SharedArrayBuffer=globalThis.SharedArrayBuffer??(new WebAssembly.Memory({initial:0,maximum:0,shared:!0})).buffer.constructor,da="./this.program",ea=(a,b)=>{throw b;},fa=import.meta.url,ha="",ia,ja;
if(k){var fs=require("fs");fa.startsWith("file:")&&(ha=require("path").dirname(require("url").fileURLToPath(fa))+"/");ja=a=>{a=ka(a)?new URL(a):a;return fs.readFileSync(a)};ia=async a=>{a=ka(a)?new URL(a):a;return fs.readFileSync(a,void 0)};1<process.argv.length&&(da=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);ea=(a,b)=>{process.exitCode=a;throw b;}}else if(aa||ba){try{ha=(new URL(".",fa)).href}catch{}k||(ba&&(ja=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";
b.send(null);return new Uint8Array(b.response)}),ia=async a=>{if(ka(a))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?c(e.response):d(e.status)};e.onerror=d;e.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+" : "+b.url);})}var la=console.log.bind(console),ma=console.error.bind(console);
if(k){var na=require("util"),oa=a=>"object"==typeof a?na.inspect(a):a;la=(...a)=>fs.writeSync(1,a.map(oa).join(" ")+"\n");ma=(...a)=>fs.writeSync(2,a.map(oa).join(" ")+"\n")}var pa=la,p=ma,qa,ra,sa=!1,ta,ka=a=>a.startsWith("file://");function q(){t.buffer!=w.buffer&&ua()}var va,wa;
if(k&&m){var xa=ca.parentPort;xa.on("message",a=>global.onmessage?.({data:a}));Object.assign(globalThis,{self:global,postMessage:a=>xa.postMessage(a)});process.on("uncaughtException",a=>{postMessage({i:"uncaughtException",error:a});process.exit(1)})}var ya;
if(m){var za=!1;self.onunhandledrejection=b=>{throw b.reason||b;};async function a(b){try{var c=b.data,d=c.i;if("load"===d){let e=[];self.onmessage=f=>e.push(f);ya=()=>{postMessage({i:"loaded"});for(let f of e)a(f);self.onmessage=a};for(const f of c.H)if(!g[f]||g[f].proxy)g[f]=(...h)=>{postMessage({i:"callHandler",G:f,args:h})},"print"==f&&(pa=g[f]),"printErr"==f&&(p=g[f]);t=c.N;ua();ra=c.O;Aa();Ba()}else if("run"===d){Ca(c.h);Da(c.h,0,0,1,0,0);Ea();Fa(c.h);za||(Ga(),za=!0);try{await Ha(c.L,c.u)}catch(e){if("unwind"!=
e)throw e;}}else"setimmediate"!==c.target&&("checkMailbox"===d?za&&Ia():d&&(p(`worker: received unknown command ${d}`),p(c)))}catch(e){throw Ja(),e;}}self.onmessage=a}var w,x,Ka,La,z,A,Ma,C,E,Na,Oa=!1;function ua(){var a=t.buffer;g.HEAP8=w=new Int8Array(a);Ka=new Int16Array(a);g.HEAPU8=x=new Uint8Array(a);La=new Uint16Array(a);g.HEAP32=z=new Int32Array(a);g.HEAPU32=A=new Uint32Array(a);Ma=new Float32Array(a);C=new Float64Array(a);E=new BigInt64Array(a);Na=new BigUint64Array(a)}
function Pa(){Oa=!0;m?ya():F.__wasm_call_ctors()}function Qa(a){a="Aborted("+a+")";p(a);sa=!0;a+=". Build with -sASSERTIONS for more info.";Oa&&Ra();a=new WebAssembly.RuntimeError(a);wa?.(a);throw a;}var Sa;async function Ta(a){if(!qa)try{var b=await ia(a);return new Uint8Array(b)}catch{}if(a==Sa&&qa)a=new Uint8Array(qa);else if(ja)a=ja(a);else throw"both async and sync fetching of the wasm failed";return a}
async function Ua(a,b){try{var c=await Ta(a);return await WebAssembly.instantiate(c,b)}catch(d){p(`failed to asynchronously prepare wasm: ${d}`),Qa(d)}}async function Va(a){var b=Sa;if(!qa&&!ka(b)&&!k)try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){p(`wasm streaming compile failed: ${d}`),p("falling back to ArrayBuffer instantiation")}return Ua(b,a)}
function Wa(){Xa={__pthread_create_js:Ya,__syscall_fcntl64:Za,__syscall_fstat64:$a,__syscall_getcwd:ab,__syscall_getdents64:bb,__syscall_ioctl:cb,__syscall_lstat64:db,__syscall_mkdirat:eb,__syscall_newfstatat:fb,__syscall_openat:gb,__syscall_readlinkat:hb,__syscall_rmdir:ib,__syscall_stat64:jb,__syscall_unlinkat:kb,_abort_js:lb,_embind_register_bigint:nb,_embind_register_bool:ob,_embind_register_emval:pb,_embind_register_float:qb,_embind_register_integer:rb,_embind_register_memory_view:sb,_embind_register_std_string:tb,
_embind_register_std_wstring:ub,_embind_register_void:vb,_emscripten_init_main_thread_js:wb,_emscripten_notify_mailbox_postmessage:xb,_emscripten_receive_on_main_thread_js:yb,_emscripten_runtime_keepalive_clear:zb,_emscripten_thread_cleanup:Ab,_emscripten_thread_mailbox_await:Fa,_emscripten_thread_set_strongref:Bb,_emval_await:Cb,_emval_create_invoker:Db,_emval_decref:Eb,_emval_equals:Fb,_emval_get_global:Gb,_emval_get_module_property:Hb,_emval_get_property:Ib,_emval_incref:Jb,_emval_invoke:Kb,_emval_invoke_i64:Lb,
_emval_new_array:Mb,_emval_new_array_from_memory_view:Nb,_emval_new_cstring:Ob,_emval_new_object:Pb,_emval_run_destructors:Qb,_emval_set_property:Rb,_gmtime_js:Sb,_localtime_js:Tb,_mktime_js:Ub,_mmap_js:Vb,_munmap_js:Wb,_setitimer_js:Xb,_tzset_js:Yb,clock_time_get:Zb,emscripten_asm_const_int:$b,emscripten_asm_const_ptr:ac,emscripten_check_blocking_allowed:bc,emscripten_date_now:cc,emscripten_errn:dc,emscripten_exit_with_live_runtime:ec,emscripten_get_heap_max:fc,emscripten_get_now:gc,emscripten_has_asyncify:hc,
emscripten_num_logical_cores:ic,emscripten_resize_heap:jc,emwgpuAdapterRequestDevice:kc,emwgpuBufferDestroy:lc,emwgpuBufferGetConstMappedRange:mc,emwgpuBufferGetMappedRange:nc,emwgpuBufferMapAsync:oc,emwgpuBufferUnmap:pc,emwgpuDelete:qc,emwgpuDeviceCreateBuffer:rc,emwgpuDeviceCreateComputePipelineAsync:sc,emwgpuDeviceCreateShaderModule:tc,emwgpuDeviceDestroy:uc,emwgpuDevicePopErrorScope:vc,emwgpuInstanceRequestAdapter:wc,emwgpuWaitAny:xc,environ_get:yc,environ_sizes_get:zc,exit:Ac,fd_close:Bc,fd_read:Cc,
fd_seek:Dc,fd_write:Ec,memory:t,proc_exit:Fc,wgpuAdapterGetLimits:Gc,wgpuAdapterHasFeature:Hc,wgpuBufferGetSize:Ic,wgpuBufferGetUsage:Jc,wgpuCommandEncoderBeginComputePass:Kc,wgpuCommandEncoderClearBuffer:Lc,wgpuCommandEncoderCopyBufferToBuffer:Mc,wgpuCommandEncoderFinish:Nc,wgpuCommandEncoderResolveQuerySet:Oc,wgpuComputePassEncoderDispatchWorkgroups:Pc,wgpuComputePassEncoderDispatchWorkgroupsIndirect:Qc,wgpuComputePassEncoderEnd:Rc,wgpuComputePassEncoderSetBindGroup:Sc,wgpuComputePassEncoderSetPipeline:Tc,
wgpuComputePassEncoderWriteTimestamp:Uc,wgpuComputePipelineGetBindGroupLayout:Vc,wgpuDeviceCreateBindGroup:Wc,wgpuDeviceCreateCommandEncoder:Xc,wgpuDeviceCreateQuerySet:Yc,wgpuDeviceGetAdapterInfo:Zc,wgpuDeviceGetFeatures:$c,wgpuDeviceGetLimits:ad,wgpuDevicePushErrorScope:bd,wgpuQueueSubmit:cd,wgpuQueueWriteBuffer:dd};if(!Xa.F){Xa.F=!0;var a=Xa,b=/^(invoke_.*|__asyncjs__.*)$/;for(let [c,d]of Object.entries(a))"function"==typeof d&&(d.v||b.test(c))&&(a[c]=d=new WebAssembly.Suspending(d))}return{env:Xa,
wasi_snapshot_preview1:Xa}}
async function Aa(){function a(d,e){d=F=d.exports;var f=/^(OrtAppendExecutionProvider|OrtCreateSession|OrtRun|OrtRunWithBinding|OrtBindInput|main|__main_argc_argv)$/;ed=new Set;var h={};for(let [l,n]of Object.entries(d))"function"==typeof n?(f.test(l)&&(ed.add(n),n=WebAssembly.promising(n)),h[l]=fd(n)):h[l]=n;F=h;F=gd();hd.push(F._emscripten_tls_init);d=F;jd=d.__getTypeName;Ga=d._embind_initialize_bindings;g._OrtInit=d.OrtInit;g._OrtGetLastError=d.OrtGetLastError;g._OrtCreateSessionOptions=d.OrtCreateSessionOptions;
g._OrtAppendExecutionProvider=d.OrtAppendExecutionProvider;g._OrtAddFreeDimensionOverride=d.OrtAddFreeDimensionOverride;g._OrtAddSessionConfigEntry=d.OrtAddSessionConfigEntry;g._OrtReleaseSessionOptions=d.OrtReleaseSessionOptions;g._OrtCreateSession=d.OrtCreateSession;g._OrtReleaseSession=d.OrtReleaseSession;g._OrtGetInputOutputCount=d.OrtGetInputOutputCount;g._OrtGetInputOutputMetadata=d.OrtGetInputOutputMetadata;g._OrtFree=d.OrtFree;g._OrtCreateTensor=d.OrtCreateTensor;g._OrtGetTensorData=d.OrtGetTensorData;
g._OrtReleaseTensor=d.OrtReleaseTensor;g._OrtCreateRunOptions=d.OrtCreateRunOptions;g._OrtAddRunConfigEntry=d.OrtAddRunConfigEntry;g._OrtReleaseRunOptions=d.OrtReleaseRunOptions;g._OrtCreateBinding=d.OrtCreateBinding;g._OrtBindInput=d.OrtBindInput;g._OrtBindOutput=d.OrtBindOutput;g._OrtClearBoundOutputs=d.OrtClearBoundOutputs;g._OrtReleaseBinding=d.OrtReleaseBinding;g._OrtRunWithBinding=d.OrtRunWithBinding;g._OrtRun=d.OrtRun;g._OrtEndProfiling=d.OrtEndProfiling;kd=g._OrtGetWebGpuDevice=d.OrtGetWebGpuDevice;
ld=d.pthread_self;G=g._free=d.free;md=g._malloc=d.malloc;nd=g._wgpuBufferRelease=d.wgpuBufferRelease;od=g._wgpuCreateInstance=d.wgpuCreateInstance;pd=d.emwgpuCreateBindGroup;qd=d.emwgpuCreateBindGroupLayout;rd=d.emwgpuCreateCommandBuffer;sd=d.emwgpuCreateCommandEncoder;td=d.emwgpuCreateComputePassEncoder;ud=d.emwgpuCreateQuerySet;vd=d.emwgpuCreateBuffer;wd=d.emwgpuCreateDevice;xd=d.emwgpuCreateQueue;yd=d.emwgpuOnCreateComputePipelineCompleted;zd=d.emwgpuOnDeviceLostCompleted;Ad=d.emwgpuOnMapAsyncCompleted;
Bd=d.emwgpuOnPopErrorScopeCompleted;Cd=d.emwgpuOnRequestAdapterCompleted;Dd=d.emwgpuOnRequestDeviceCompleted;Ed=d.emwgpuOnUncapturedError;Da=d._emscripten_thread_init;Ja=d._emscripten_thread_crashed;Fd=d._emscripten_run_js_on_main_thread;Gd=d._emscripten_thread_free_data;Hd=d._emscripten_thread_exit;Id=d._emscripten_timeout;Jd=d._emscripten_check_mailbox;Kd=d.memalign;Ra=d.__trap;Ld=d.emscripten_stack_set_limits;H=d._emscripten_stack_restore;Md=d._emscripten_stack_alloc;I=d.emscripten_stack_get_current;
Nd=d.__indirect_function_table;ra=e;return F}var b=Wa();if(g.instantiateWasm)return new Promise(d=>{g.instantiateWasm(b,(e,f)=>{d(a(e,f))})});if(m){var c=new WebAssembly.Instance(ra,Wa());return a(c,ra)}Sa??=g.locateFile?g.locateFile?g.locateFile("ort-wasm-simd-threaded.jspi.wasm",ha):ha+"ort-wasm-simd-threaded.jspi.wasm":(new URL("ort-wasm-simd-threaded.jspi.wasm",import.meta.url)).href;return function(d){return a(d.instance,d.module)}(await Va(b))}
class Od{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`;this.status=a}}
var Pd=a=>{a.terminate();a.onmessage=()=>{}},Rd=()=>{for(var a=Qd;0<a.length;)a.shift()(g)},Qd=[],Sd=0,Td=null,Xd=a=>{0==J.length&&(Ud(),Vd(J[0]));var b=J.pop();if(!b)return 6;Wd.push(b);K[a.h]=b;b.h=a.h;var c={i:"run",L:a.K,u:a.u,h:a.h};k&&b.unref();b.postMessage(c,a.A);return 0},L=0,M=(a,b,...c)=>{var d=16*c.length,e=I(),f=Md(d),h=f>>>3,l;for(l of c)"bigint"==typeof l?((q(),E)[h++>>>0]=1n,(q(),E)[h++>>>0]=l):((q(),E)[h++>>>0]=0n,(q(),C)[h++>>>0]=l);a=Fd(a,0,d,f,b);H(e);return a};
function Fc(a){if(m)return M(0,1,a);ta=a;if(!(0<L)){for(var b of Wd)Pd(b);for(b of J)Pd(b);J=[];Wd=[];K={};sa=!0}ea(a,new Od(a))}function Yd(a){if(m)return M(1,0,a);Ac(a)}var Ac=a=>{ta=a;if(m)throw Yd(a),"unwind";Fc(a)},J=[],Wd=[],hd=[],K={};function Zd(){for(var a=g.numThreads-1;a--;)Ud();Qd.push(async()=>{var b=$d();Sd++;await b;Sd--;0==Sd&&Td&&(b=Td,Td=null,b())})}var ae=a=>{var b=a.h;delete K[b];J.push(a);Wd.splice(Wd.indexOf(a),1);a.h=0;Gd(b)};function Ea(){hd.forEach(a=>a())}
var Vd=a=>new Promise(b=>{a.onmessage=f=>{var h=f.data;f=h.i;if(h.s&&h.s!=ld()){var l=K[h.s];l?l.postMessage(h,h.A):p(`Internal error! Worker sent a message "${f}" to target pthread ${h.s}, but that thread no longer exists!`)}else if("checkMailbox"===f)Ia();else if("spawnThread"===f)Xd(h);else if("cleanupThread"===f)N(()=>{ae(K[h.M])});else if("loaded"===f)a.loaded=!0,k&&!a.h&&a.unref(),b(a);else if("setimmediate"===h.target)a.postMessage(h);else if("uncaughtException"===f)a.onerror(h.error);else if("callHandler"===
f)g[h.G](...h.args);else f&&p(`worker sent an unknown command ${f}`)};a.onerror=f=>{p(`${"worker sent an error!"} ${f.filename}:${f.lineno}: ${f.message}`);throw f;};k&&(a.on("message",f=>a.onmessage({data:f})),a.on("error",f=>a.onerror(f)));var c=[],d=[],e;for(e of d)g.propertyIsEnumerable(e)&&c.push(e);a.postMessage({i:"load",H:c,N:t,O:ra})});async function $d(){if(!m)return Promise.all(J.map(Vd))}
function Ud(){var a=new Worker(new URL(import.meta.url),{type:"module",workerData:"em-pthread",name:"em-pthread"});J.push(a)}function Ca(a){var b=(q(),A)[a+52>>>2>>>0];a=(q(),A)[a+56>>>2>>>0];Ld(b,b-a);H(b)}var be=[],Ha=async(a,b)=>{L=0;var c=WebAssembly,d=c.promising,e=be[a];e||(be[a]=e=Nd.get(a),ed?.has(e)&&(be[a]=e=WebAssembly.promising(e)));a=d.call(c,e)(b);a=await a;0<L?ta=a:Hd(a)},t;function ce(a,b,c,d){return m?M(2,1,a,b,c,d):Ya(a,b,c,d)}
var O=a=>-9007199254740992>a||9007199254740992<a?NaN:Number(a);function Ya(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;if(!globalThis.SharedArrayBuffer)return 6;var e=[];if(m&&0===e.length)return ce(a,b,c,d);a={K:c,h:a,u:d,A:e};return m?(a.i="spawnThread",postMessage(a,e),0):Xd(a)}
var de=globalThis.TextDecoder&&new TextDecoder,ee=(a,b,c,d)=>{c=b+c;if(d)return c;for(;a[b]&&!(b>=c);)++b;return b},fe=(a,b=0,c,d)=>{b>>>=0;c=ee(a,b,c,d);if(16<c-b&&a.buffer&&de)return de.decode(a.buffer instanceof ArrayBuffer?a.subarray(b,c):a.slice(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var f=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var h=a[b++]&63;e=224==(e&240)?(e&15)<<12|f<<6|h:(e&7)<<18|f<<12|h<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|
e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},ge=(a,b,c)=>(a>>>=0)?fe((q(),x),a,b,c):"";function Za(a,b,c){return m?M(3,1,a,b,c):0}function $a(a,b){if(m)return M(4,1,a,b)}function ab(a,b){if(m)return M(5,1,a,b)}function bb(a,b,c){if(m)return M(6,1,a,b,c)}function cb(a,b,c){return m?M(7,1,a,b,c):0}function db(a,b){if(m)return M(8,1,a,b)}function eb(a,b,c){if(m)return M(9,1,a,b,c)}function fb(a,b,c,d){if(m)return M(10,1,a,b,c,d)}function gb(a,b,c,d){if(m)return M(11,1,a,b,c,d)}
function hb(a,b,c,d){if(m)return M(12,1,a,b,c,d)}function ib(a){if(m)return M(13,1,a)}function jb(a,b){if(m)return M(14,1,a,b)}function kb(a,b,c){if(m)return M(15,1,a,b,c)}var lb=()=>Qa(""),P=a=>{a>>>=0;for(var b="";;){var c=(q(),x)[a++>>>0];if(!c)return b;b+=String.fromCharCode(c)}},he={},ie={},je={},ke=class extends Error{constructor(a){super(a);this.name="BindingError"}};
function le(a,b,c={}){var d=b.name;if(!a)throw new ke(`type "${d}" must have a positive integer typeid pointer`);if(ie.hasOwnProperty(a)){if(c.I)return;throw new ke(`Cannot register type '${d}' twice`);}ie[a]=b;delete je[a];he.hasOwnProperty(a)&&(b=he[a],delete he[a],b.forEach(e=>e()))}function Q(a,b,c={}){return le(a,b,c)}
var me=(a,b,c)=>{switch(b){case 1:return c?d=>(q(),w)[d>>>0]:d=>(q(),x)[d>>>0];case 2:return c?d=>(q(),Ka)[d>>>1>>>0]:d=>(q(),La)[d>>>1>>>0];case 4:return c?d=>(q(),z)[d>>>2>>>0]:d=>(q(),A)[d>>>2>>>0];case 8:return c?d=>(q(),E)[d>>>3>>>0]:d=>(q(),Na)[d>>>3>>>0];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}};
function nb(a,b,c,d,e){a>>>=0;c>>>=0;b=P(b>>>0);d=0n===d;let f=h=>h;if(d){const h=8*c;f=l=>BigInt.asUintN(h,l);e=f(e)}Q(a,{name:b,g:f,l:(h,l)=>{"number"==typeof l&&(l=BigInt(l));return l},j:me(b,c,!d),m:null})}function ob(a,b,c,d){a>>>=0;b=P(b>>>0);Q(a,{name:b,g:function(e){return!!e},l:function(e,f){return f?c:d},j:function(e){return this.g((q(),x)[e>>>0])},m:null})}var ne=[],oe=[0,1,,1,null,1,!0,1,!1,1];function Eb(a){a>>>=0;9<a&&0===--oe[a+1]&&(oe[a]=void 0,ne.push(a))}
var R=a=>{if(!a)throw new ke(`Cannot use deleted val. handle = ${a}`);return oe[a]},S=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=ne.pop()||oe.length;oe[b]=a;oe[b+1]=1;return b}};function pe(a){return this.g((q(),A)[a>>>2>>>0])}var qe={name:"emscripten::val",g:a=>{var b=R(a);Eb(a);return b},l:(a,b)=>S(b),j:pe,m:null};function pb(a){return Q(a>>>0,qe)}
var re=(a,b)=>{switch(b){case 4:return function(c){return this.g((q(),Ma)[c>>>2>>>0])};case 8:return function(c){return this.g((q(),C)[c>>>3>>>0])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}};function qb(a,b,c){a>>>=0;c>>>=0;b=P(b>>>0);Q(a,{name:b,g:d=>d,l:(d,e)=>e,j:re(b,c),m:null})}function rb(a,b,c,d,e){a>>>=0;c>>>=0;b=P(b>>>0);let f=l=>l;if(0===d){var h=32-8*c;f=l=>l<<h>>>h;e=f(e)}Q(a,{name:b,g:f,l:(l,n)=>n,j:me(b,c,0!==d),m:null})}
function sb(a,b,c){function d(f){var h=(q(),A)[f>>>2>>>0];f=(q(),A)[f+4>>>2>>>0];return new e((q(),w).buffer,f,h)}a>>>=0;var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];c=P(c>>>0);Q(a,{name:c,g:d,j:d},{I:!0})}
var T=(a,b,c)=>{var d=(q(),x);b>>>=0;if(0<c){var e=b;c=b+c-1;for(var f=0;f<a.length;++f){var h=a.codePointAt(f);if(127>=h){if(b>=c)break;d[b++>>>0]=h}else if(2047>=h){if(b+1>=c)break;d[b++>>>0]=192|h>>6;d[b++>>>0]=128|h&63}else if(65535>=h){if(b+2>=c)break;d[b++>>>0]=224|h>>12;d[b++>>>0]=128|h>>6&63;d[b++>>>0]=128|h&63}else{if(b+3>=c)break;d[b++>>>0]=240|h>>18;d[b++>>>0]=128|h>>12&63;d[b++>>>0]=128|h>>6&63;d[b++>>>0]=128|h&63;f++}}d[b>>>0]=0;a=b-e}else a=0;return a},U=a=>{for(var b=0,c=0;c<a.length;++c){var d=
a.charCodeAt(c);127>=d?b++:2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b};
function tb(a,b){a>>>=0;b=P(b>>>0);Q(a,{name:b,g(c){var d=(q(),A)[c>>>2>>>0];d=ge(c+4,d,!0);G(c);return d},l(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new ke("Cannot pass non-string to std::string");var f=e?U(d):d.length;var h=md(4+f+1),l=h+4;(q(),A)[h>>>2>>>0]=f;e?T(d,l,f+1):(q(),x).set(d,l>>>0);null!==c&&c.push(G,h);return h},j:pe,m(c){G(c)}})}
var se=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,te=(a,b,c)=>{a>>>=1;b=ee((q(),La),a,b/2,c);if(16<b-a&&se)return se.decode((q(),La).slice(a,b));for(c="";a<b;++a){var d=(q(),La)[a>>>0];c+=String.fromCharCode(d)}return c},ue=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e){var f=a.charCodeAt(e);(q(),Ka)[b>>>1>>>0]=f;b+=2}(q(),Ka)[b>>>1>>>0]=0;return b-d},ve=a=>2*a.length,we=(a,b,c)=>{var d="";a>>>=2;for(var e=0;!(e>=b/4);e++){var f=
(q(),A)[a+e>>>0];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},xe=(a,b,c)=>{b>>>=0;c??=2147483647;if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var f=a.codePointAt(e);65535<f&&e++;(q(),z)[b>>>2>>>0]=f;b+=4;if(b+4>c)break}(q(),z)[b>>>2>>>0]=0;return b-d},ye=a=>{for(var b=0,c=0;c<a.length;++c)65535<a.codePointAt(c)&&c++,b+=4;return b};
function ub(a,b,c){a>>>=0;b>>>=0;c>>>=0;c=P(c);if(2===b){var d=te;var e=ue;var f=ve}else d=we,e=xe,f=ye;Q(a,{name:c,g:h=>{var l=(q(),A)[h>>>2>>>0];l=d(h+4,l*b,!0);G(h);return l},l:(h,l)=>{if("string"!=typeof l)throw new ke(`Cannot pass non-string to C++ string type ${c}`);var n=f(l),u=md(4+n+b);(q(),A)[u>>>2>>>0]=n/b;e(l,u+4,n+b);null!==h&&h.push(G,u);return u},j:pe,m(h){G(h)}})}function vb(a,b){a>>>=0;b=P(b>>>0);Q(a,{J:!0,name:b,g:()=>{},l:()=>{}})}
function wb(a){Da(a>>>0,!ba,1,!aa,131072,!1);Ea()}var N=a=>{if(!sa)try{if(a(),!(0<L))try{m?ld()&&Hd(ta):Ac(ta)}catch(b){b instanceof Od||"unwind"==b||ea(1,b)}}catch(b){b instanceof Od||"unwind"==b||ea(1,b)}},ze=!Atomics.waitAsync||globalThis.navigator?.userAgent&&91>Number((navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)||[])[2]);function Fa(a){a>>>=0;ze||(Atomics.waitAsync((q(),z),a>>>2,a).value.then(Ia),a+=128,Atomics.store((q(),z),a>>>2,1))}var Ia=()=>N(()=>{var a=ld();a&&(Fa(a),Jd())});
function xb(a,b){a>>>=0;a==b>>>0?setTimeout(Ia):m?postMessage({s:a,i:"checkMailbox"}):(a=K[a])&&a.postMessage({i:"checkMailbox"})}var Ae=[];function yb(a,b,c,d,e){b>>>=0;e>>>=0;Ae.length=0;c=e>>>3;for(d=e+d>>>3;c<d;){var f;(q(),E)[c++>>>0]?f=(q(),E)[c++>>>0]:f=(q(),C)[c++>>>0];Ae.push(f)}return(b?Be[b]:Ce[a])(...Ae)}var zb=()=>{L=0};function Ab(a){a>>>=0;m?postMessage({i:"cleanupThread",M:a}):ae(K[a])}function Bb(a){k&&K[a>>>0].ref()}function fd(a){return(...b)=>a(...b)}
var ed=null,De=async a=>{L+=1;try{return await a()}finally{--L}};function Cb(a){a>>>=0;return De(async()=>{var b=await R(a);return S(b)})}Cb.v=!0;
var Ee=[],Fe=a=>{var b=Ee.length;Ee.push(a);return b},Ge=(a,b)=>{for(var c=Array(a),d=0;d<a;++d){var e=d,f=(q(),A)[b+4*d>>>2>>>0],h=ie[f];if(void 0===h)throw a=`parameter ${d}`,f=jd(f),b=P(f),G(f),new ke(`${a} has unknown type ${b}`);c[e]=h}return c},He=(a,b,c)=>{var d=[];a=a(d,c);d.length&&((q(),A)[b>>>2>>>0]=S(d));return a},Ie={},Je=a=>{var b=Ie[a];return void 0===b?P(a):b};
function Db(a,b,c){var [d,...e]=Ge(a,b>>>0);b=d.l.bind(d);var f=e.map(n=>n.j.bind(n));a--;var h={toValue:R};a=f.map((n,u)=>{var D=`argFromPtr${u}`;h[D]=n;return`${D}(args${u?"+"+8*u:""})`});switch(c){case 0:var l="toValue(handle)";break;case 2:l="new (toValue(handle))";break;case 3:l="";break;case 1:h.getStringOrSymbol=Je,l="toValue(handle)[getStringOrSymbol(methodName)]"}l+=`(${a})`;d.J||(h.toReturnWire=b,h.emval_returnValue=He,l=`return emval_returnValue(toReturnWire, destructorsRef, ${l})`);l=
`return function (handle, methodName, destructorsRef, args) {\n  ${l}\n  }`;c=(new Function(Object.keys(h),l))(...Object.values(h));l=`methodCaller<(${e.map(n=>n.name)}) => ${d.name}>`;return Fe(Object.defineProperty(c,"name",{value:l}))}function Fb(a,b){b>>>=0;a=R(a>>>0);b=R(b);return a==b}function Gb(a){a>>>=0;if(!a)return S(globalThis);a=Je(a);return S(globalThis[a])}function Hb(a){a=Je(a>>>0);return S(g[a])}function Ib(a,b){b>>>=0;a=R(a>>>0);b=R(b);return S(a[b])}
function Jb(a){a>>>=0;9<a&&(oe[a+1]+=1)}function Kb(a,b,c,d,e){return Ee[a>>>0](b>>>0,c>>>0,d>>>0,e>>>0)}function Lb(a,b,c,d,e){return Kb(a>>>0,b>>>0,c>>>0,d>>>0,e>>>0)}function Mb(){return S([])}function Nb(a){a=R(a>>>0);for(var b=Array(a.length),c=0;c<a.length;c++)b[c]=a[c];return S(b)}function Ob(a){return S(Je(a>>>0))}function Pb(){return S({})}function Qb(a){a>>>=0;for(var b=R(a);b.length;){var c=b.pop();b.pop()(c)}Eb(a)}function Rb(a,b,c){b>>>=0;c>>>=0;a=R(a>>>0);b=R(b);c=R(c);a[b]=c}
function Sb(a,b){a=O(a);b>>>=0;a=new Date(1E3*a);(q(),z)[b>>>2>>>0]=a.getUTCSeconds();(q(),z)[b+4>>>2>>>0]=a.getUTCMinutes();(q(),z)[b+8>>>2>>>0]=a.getUTCHours();(q(),z)[b+12>>>2>>>0]=a.getUTCDate();(q(),z)[b+16>>>2>>>0]=a.getUTCMonth();(q(),z)[b+20>>>2>>>0]=a.getUTCFullYear()-1900;(q(),z)[b+24>>>2>>>0]=a.getUTCDay();a=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;(q(),z)[b+28>>>2>>>0]=a}
var Ke=a=>0===a%4&&(0!==a%100||0===a%400),Le=[0,31,60,91,121,152,182,213,244,274,305,335],Me=[0,31,59,90,120,151,181,212,243,273,304,334];
function Tb(a,b){a=O(a);b>>>=0;a=new Date(1E3*a);(q(),z)[b>>>2>>>0]=a.getSeconds();(q(),z)[b+4>>>2>>>0]=a.getMinutes();(q(),z)[b+8>>>2>>>0]=a.getHours();(q(),z)[b+12>>>2>>>0]=a.getDate();(q(),z)[b+16>>>2>>>0]=a.getMonth();(q(),z)[b+20>>>2>>>0]=a.getFullYear()-1900;(q(),z)[b+24>>>2>>>0]=a.getDay();var c=(Ke(a.getFullYear())?Le:Me)[a.getMonth()]+a.getDate()-1|0;(q(),z)[b+28>>>2>>>0]=c;(q(),z)[b+36>>>2>>>0]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),
0,1)).getTimezoneOffset();a=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0;(q(),z)[b+32>>>2>>>0]=a}
function Ub(a){a>>>=0;var b=new Date((q(),z)[a+20>>>2>>>0]+1900,(q(),z)[a+16>>>2>>>0],(q(),z)[a+12>>>2>>>0],(q(),z)[a+8>>>2>>>0],(q(),z)[a+4>>>2>>>0],(q(),z)[a>>>2>>>0],0),c=(q(),z)[a+32>>>2>>>0],d=b.getTimezoneOffset(),e=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),f=(new Date(b.getFullYear(),0,1)).getTimezoneOffset(),h=Math.min(f,e);0>c?(q(),z)[a+32>>>2>>>0]=Number(e!=f&&h==d):0<c!=(h==d)&&(e=Math.max(f,e),b.setTime(b.getTime()+6E4*((0<c?h:e)-d)));(q(),z)[a+24>>>2>>>0]=b.getDay();c=(Ke(b.getFullYear())?
Le:Me)[b.getMonth()]+b.getDate()-1|0;(q(),z)[a+28>>>2>>>0]=c;(q(),z)[a>>>2>>>0]=b.getSeconds();(q(),z)[a+4>>>2>>>0]=b.getMinutes();(q(),z)[a+8>>>2>>>0]=b.getHours();(q(),z)[a+12>>>2>>>0]=b.getDate();(q(),z)[a+16>>>2>>>0]=b.getMonth();(q(),z)[a+20>>>2>>>0]=b.getYear();a=b.getTime();return BigInt(isNaN(a)?-1:a/1E3)}function Vb(a,b,c,d,e,f,h){return m?M(16,1,a,b,c,d,e,f,h):-52}function Wb(a,b,c,d,e,f){if(m)return M(17,1,a,b,c,d,e,f)}var Ne={},gc=()=>performance.timeOrigin+performance.now();
function Xb(a,b){if(m)return M(18,1,a,b);Ne[a]&&(clearTimeout(Ne[a].id),delete Ne[a]);if(!b)return 0;var c=setTimeout(()=>{delete Ne[a];N(()=>Id(a,performance.timeOrigin+performance.now()))},b);Ne[a]={id:c,V:b};return 0}
function Yb(a,b,c,d){a>>>=0;b>>>=0;c>>>=0;d>>>=0;var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();var h=Math.max(f,e);(q(),A)[a>>>2>>>0]=60*h;(q(),z)[b>>>2>>>0]=Number(f!=e);b=l=>{var n=Math.abs(l);return`UTC${0<=l?"-":"+"}${String(Math.floor(n/60)).padStart(2,"0")}${String(n%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(T(a,c,17),T(b,d,17)):(T(a,d,17),T(b,c,17))}var cc=()=>Date.now(),Oe=1;
function Zb(a,b,c){c>>>=0;if(!(0<=a&&3>=a))return 28;if(0===a)a=Date.now();else if(Oe)a=performance.timeOrigin+performance.now();else return 52;a=Math.round(1E6*a);(q(),E)[c>>>3>>>0]=BigInt(a);return 0}var Pe=[],Qe=(a,b)=>{Pe.length=0;for(var c;c=(q(),x)[a++>>>0];){var d=105!=c;d&=112!=c;b+=d&&b%8?4:0;Pe.push(112==c?(q(),A)[b>>>2>>>0]:106==c?(q(),E)[b>>>3>>>0]:105==c?(q(),z)[b>>>2>>>0]:(q(),C)[b>>>3>>>0]);b+=d?8:4}return Pe};function $b(a,b,c){a>>>=0;b=Qe(b>>>0,c>>>0);return Be[a](...b)}
function ac(a,b,c){a>>>=0;b=Qe(b>>>0,c>>>0);return Be[a](...b)}var bc=()=>{};function dc(a,b){return p(ge(a>>>0,b>>>0))}var ec=()=>{L+=1;throw"unwind";};function fc(){return 4294901760}var hc=()=>2,ic=()=>k?require("os").cpus().length:navigator.hardwareConcurrency;
function jc(a){a>>>=0;var b=(q(),x).length;if(a<=b||4294901760<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(4294901760,65536*Math.ceil(Math.max(a,d)/65536))-t.buffer.byteLength+65535)/65536|0;try{t.grow(d);ua();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1}
var V=a=>{var b=U(a)+1,c=Md(b);T(a,c,b);return c},Re=(a,b)=>{(q(),A)[a>>>2>>>0]=b;var c=(q(),A)[a>>>2>>>0];(q(),A)[a+4>>>2>>>0]=(b-c)/4294967296},Se=a=>(q(),A)[a>>>2>>>0]+4294967296*(q(),z)[a+4>>>2>>>0],W=[],Te=(a,b)=>{W[a>>>0]=b},X=[],Ue=[],Ve=(a,b)=>{Ue[a]=new Promise(c=>b.finally(()=>c(a)))},Y=a=>{if(a)return W[a>>>0]},We=(a,b=0)=>{"unmapped"===a.mapState||Qa();b=vd(b);W[b>>>0]=a;return b},Xe=(a,b=0)=>{var c=xd(b);b=wd(b,c);W[c>>>0]=a.queue;W[b>>>0]=a;return b},Ye=(a,b)=>{for(a=(q(),A)[a>>>2>>>
0];a;a=(q(),A)[a>>>2>>>0]){var c=(q(),z)[a+4>>>2>>>0];b[c](a)}},Ze=(a,b,c)=>{(q(),A)[a>>>2>>>0]=b;(q(),A)[a+4>>>2>>>0]=c},$e=a=>{var b=(q(),A)[a>>>2>>>0];a=(q(),A)[a+4>>>2>>>0];return ge(b,a)},Z=a=>{var b=(q(),A)[a>>>2>>>0];a=(q(),A)[a+4>>>2>>>0];if(b)return ge(b,a);if(0===a)return""},af=a=>{var b=Z(a+4);var c=(c=(q(),A)[a+12>>>2>>>0])?Y(c):"auto";if(a+=16){var d=Y((q(),A)[a+4>>>2>>>0]);var e=(q(),A)[a+16>>>2>>>0];var f=(q(),A)[a+20>>>2>>>0];if(e){for(var h={},l=0;l<e;++l){var n=f+24*l,u=$e(n+4);
h[u]=(q(),C)[n+16>>>3>>>0]}e=h}else e=void 0;a={module:d,constants:e,entryPoint:Z(a+8)}}else a=void 0;return{label:b,layout:c,compute:a}},bf=(a,b)=>{function c(d,e){d=a[d];(q(),A)[b+e>>>2>>>0]=d}c("maxTextureDimension1D",4);c("maxTextureDimension2D",8);c("maxTextureDimension3D",12);c("maxTextureArrayLayers",16);c("maxBindGroups",20);c("maxBindGroupsPlusVertexBuffers",24);c("maxBindingsPerBindGroup",28);c("maxDynamicUniformBuffersPerPipelineLayout",32);c("maxDynamicStorageBuffersPerPipelineLayout",
36);c("maxSampledTexturesPerShaderStage",40);c("maxSamplersPerShaderStage",44);c("maxStorageBuffersPerShaderStage",48);c("maxStorageTexturesPerShaderStage",52);c("maxUniformBuffersPerShaderStage",56);c("minUniformBufferOffsetAlignment",80);c("minStorageBufferOffsetAlignment",84);Re(b+64,a.maxUniformBufferBindingSize);Re(b+72,a.maxStorageBufferBindingSize);c("maxVertexBuffers",88);Re(b+96,a.maxBufferSize);c("maxVertexAttributes",104);c("maxVertexBufferArrayStride",108);c("maxInterStageShaderVariables",
112);c("maxColorAttachments",116);c("maxColorAttachmentBytesPerSample",120);c("maxComputeWorkgroupStorageSize",124);c("maxComputeInvocationsPerWorkgroup",128);c("maxComputeWorkgroupSizeX",132);c("maxComputeWorkgroupSizeY",136);c("maxComputeWorkgroupSizeZ",140);c("maxComputeWorkgroupsPerDimension",144);void 0!==a.U&&c("maxImmediateSize",148)},cf=[,"validation","out-of-memory","internal"],df=[,"compatibility","core"],ef={1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",
4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",22:"texture-component-swizzle",327692:"chromium-experimental-unorm16-texture-formats",
327729:"chromium-experimental-multi-draw-indirect"},ff=[,"low-power","high-performance"],gf=[,"occlusion","timestamp"],hf={undefined:1,unknown:1,destroyed:2};
function kc(a,b,c,d,e,f){b=O(b);c=O(c);d>>>=0;e>>>=0;f>>>=0;var h=Y(a>>>0);a={};if(f){var l=(q(),A)[f+12>>>2>>>0];if(l){var n=(q(),A)[f+16>>>2>>>0];a.requiredFeatures=Array.from((q(),A).subarray(n>>>2>>>0,n+4*l>>>2>>>0),r=>ef[r])}var u=(q(),A)[f+20>>>2>>>0];if(u){var D={};function r(y,B,mb=!1){B=u+B;B=(q(),A)[B>>>2>>>0];4294967295==B||mb&&0==B||(D[y]=B)}function v(y,B){B=u+B;var mb=(q(),A)[B>>>2>>>0],mf=(q(),A)[B+4>>>2>>>0];if(4294967295!=mb||4294967295!=mf)D[y]=Se(B)}r("maxTextureDimension1D",4);
r("maxTextureDimension2D",8);r("maxTextureDimension3D",12);r("maxTextureArrayLayers",16);r("maxBindGroups",20);r("maxBindGroupsPlusVertexBuffers",24);r("maxDynamicUniformBuffersPerPipelineLayout",32);r("maxDynamicStorageBuffersPerPipelineLayout",36);r("maxSampledTexturesPerShaderStage",40);r("maxSamplersPerShaderStage",44);r("maxStorageBuffersPerShaderStage",48);r("maxStorageTexturesPerShaderStage",52);r("maxUniformBuffersPerShaderStage",56);r("minUniformBufferOffsetAlignment",80);r("minStorageBufferOffsetAlignment",
84);v("maxUniformBufferBindingSize",64);v("maxStorageBufferBindingSize",72);r("maxVertexBuffers",88);v("maxBufferSize",96);r("maxVertexAttributes",104);r("maxVertexBufferArrayStride",108);r("maxInterStageShaderVariables",112);r("maxColorAttachments",116);r("maxColorAttachmentBytesPerSample",120);r("maxComputeWorkgroupStorageSize",124);r("maxComputeInvocationsPerWorkgroup",128);r("maxComputeWorkgroupSizeX",132);r("maxComputeWorkgroupSizeY",136);r("maxComputeWorkgroupSizeZ",140);r("maxComputeWorkgroupsPerDimension",
144);r("maxImmediateSize",148,!0);a.requiredLimits=D}if(l=(q(),A)[f+24>>>2>>>0])l={label:Z(l+4)},a.defaultQueue=l;a.label=Z(f+4)}L+=1;Ve(b,h.requestDevice(a).then(r=>{--L;N(()=>{W[e>>>0]=r.queue;W[d>>>0]=r;L+=1;Ve(c,r.lost.then(v=>{N(()=>{r.onuncapturederror=()=>{};var y=I(),B=V(v.message);zd(c,hf[v.reason],B);H(y)});--L}));r.onuncapturederror=v=>{var y=5;v.error instanceof GPUValidationError?y=2:v.error instanceof GPUOutOfMemoryError?y=3:v.error instanceof GPUInternalError&&(y=4);var B=I();v=V(v.error.message);
Ed(d,y,v);H(B)};"adapterInfo"in r||(r.adapterInfo=h.info);Dd(b,1,d,0)})},r=>{--L;N(()=>{var v=I(),y=V(r.message);Dd(b,3,d,y);c&&zd(c,4,y);H(v)})}))}function lc(a){a>>>=0;var b=Y(a),c=X[a];if(c){for(var d=0;d<c.length;++d)c[d]();delete X[a]}b.destroy()}function mc(a,b,c){a>>>=0;c>>>=0;var d=Y(a);4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b>>>0,c)}catch(h){return 0}var f=Kd(16,e.byteLength);(q(),x).set(new Uint8Array(e),f>>>0);X[a].push(()=>G(f));return f}
function nc(a,b,c){a>>>=0;c>>>=0;var d=Y(a);4294967295==c&&(c=void 0);try{var e=d.getMappedRange(b>>>0,c)}catch(h){return 0}var f=Kd(16,e.byteLength);(q(),x).fill(0,f,e.byteLength);X[a].push(()=>{(new Uint8Array(e)).set((q(),x).subarray(f>>>0,f+e.byteLength>>>0));G(f)});return f}
function oc(a,b,c,d,e){a>>>=0;b=O(b);c=O(c);e>>>=0;var f=Y(a);X[a]=[];4294967295==e&&(e=void 0);L+=1;Ve(b,f.mapAsync(c,d>>>0,e).then(()=>{--L;N(()=>{Ad(b,1,0)})},h=>{--L;N(()=>{I();var l=V(h.message);Ad(b,"AbortError"===h.name?4:"OperationError"===h.name?3:0,l);delete X[a]})}))}function pc(a){a>>>=0;var b=Y(a),c=X[a];if(c){for(var d=0;d<c.length;++d)c[d]();delete X[a];b.unmap()}}function qc(a){delete W[a>>>0]}
function rc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=!!(q(),A)[b+32>>>2>>>0];b={label:Z(b+4),usage:(q(),A)[b+16>>>2>>>0],size:Se(b+24),mappedAtCreation:d};a=Y(a);try{var e=a.createBuffer(b)}catch(f){return!1}W[c>>>0]=e;d&&(X[c]=[]);return!0}function sc(a,b,c,d){a>>>=0;b=O(b);d>>>=0;c=af(c>>>0);a=Y(a);L+=1;Ve(b,a.createComputePipelineAsync(c).then(e=>{--L;N(()=>{W[d>>>0]=e;yd(b,1,d,0)})},e=>{--L;N(()=>{var f=I(),h=V(e.message);yd(b,"validation"===e.reason?3:"internal"===e.reason?4:0,d,h);H(f)})}))}
function tc(a,b,c){a>>>=0;b>>>=0;c>>>=0;var d=(q(),A)[b>>>2>>>0],e=(q(),z)[d+4>>>2>>>0];b={label:Z(b+4),code:""};switch(e){case 2:b.code=$e(d+8)}a=Y(a).createShaderModule(b);W[c>>>0]=a}var uc=a=>{a=Y(a);a.onuncapturederror=null;a.destroy()};
function vc(a,b){b=O(b);a=Y(a>>>0);L+=1;Ve(b,a.popErrorScope().then(c=>{--L;N(()=>{var d=5;c?c instanceof GPUValidationError?d=2:c instanceof GPUOutOfMemoryError?d=3:c instanceof GPUInternalError&&(d=4):d=1;var e=I(),f=c?V(c.message):0;Bd(b,1,d,f);H(e)})},c=>{--L;N(()=>{var d=I(),e=V(c.message);Bd(b,1,5,e);H(d)})}))}
function wc(a,b,c,d){b=O(b);c>>>=0;d>>>=0;if(c){var e={featureLevel:df[(q(),z)[c+4>>>2>>>0]],powerPreference:ff[(q(),z)[c+8>>>2>>>0]],forceFallbackAdapter:!!(q(),A)[c+12>>>2>>>0]};a=(q(),A)[c>>>2>>>0];0!==a&&(q(),e.X=!!(q(),A)[a+8>>>2>>>0])}"gpu"in navigator?(L+=1,Ve(b,navigator.gpu.requestAdapter(e).then(f=>{--L;N(()=>{if(f)W[d>>>0]=f,Cd(b,1,d,0);else{var h=I(),l=V("WebGPU not available on this browser (requestAdapter returned null)");Cd(b,3,d,l);H(h)}})},f=>{--L;N(()=>{var h=I(),l=V(f.message);
Cd(b,4,d,l);H(h)})}))):(e=I(),a=V("WebGPU not available on this browser (navigator.gpu is not available)"),Cd(b,3,d,a),H(e))}function xc(a,b,c){a>>>=0;b>>>=0;c>>>=0;return De(async()=>{var d=[];if(c){var e=(q(),z)[c>>>2>>>0];d.length=b+1;d[b]=new Promise(l=>setTimeout(l,e,0))}else d.length=b;for(var f=0;f<b;++f){var h=Se(a+8*f);if(!(h in Ue))return h;d[f]=Ue[h]}d=await Promise.race(d);delete Ue[d];return d})}xc.v=!0;
var jf={},lf=()=>{if(!kf){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in jf)void 0===jf[b]?delete a[b]:a[b]=jf[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);kf=c}return kf},kf;function yc(a,b){if(m)return M(19,1,a,b);a>>>=0;b>>>=0;var c=0,d=0,e;for(e of lf()){var f=b+c;(q(),A)[a+d>>>2>>>0]=f;c+=T(e,f,Infinity)+1;d+=4}return 0}
function zc(a,b){if(m)return M(20,1,a,b);a>>>=0;b>>>=0;var c=lf();(q(),A)[a>>>2>>>0]=c.length;a=0;for(var d of c)a+=U(d)+1;(q(),A)[b>>>2>>>0]=a;return 0}function Bc(a){return m?M(21,1,a):52}function Cc(a,b,c,d){return m?M(22,1,a,b,c,d):52}function Dc(a,b,c,d){return m?M(23,1,a,b,c,d):70}var nf=[null,[],[]];
function Ec(a,b,c,d){if(m)return M(24,1,a,b,c,d);b>>>=0;c>>>=0;d>>>=0;for(var e=0,f=0;f<c;f++){var h=(q(),A)[b>>>2>>>0],l=(q(),A)[b+4>>>2>>>0];b+=8;for(var n=0;n<l;n++){var u=a,D=(q(),x)[h+n>>>0],r=nf[u];0===D||10===D?((1===u?pa:p)(fe(r)),r.length=0):r.push(D)}e+=l}(q(),A)[d>>>2>>>0]=e;return 0}function Gc(a,b){bf(Y(a>>>0).limits,b>>>0);return 1}function Hc(a,b){return Y(a>>>0).features.has(ef[b])}function Ic(a){return BigInt(Y(a>>>0).size)}function Jc(a){return BigInt(Y(a>>>0).usage)}
function Kc(a,b){a>>>=0;b>>>=0;if(b){var c=Z(b+4);b=(q(),A)[b+12>>>2>>>0];b=0!==b?{querySet:Y((q(),A)[b+4>>>2>>>0]),beginningOfPassWriteIndex:(q(),A)[b+8>>>2>>>0],endOfPassWriteIndex:(q(),A)[b+12>>>2>>>0]}:void 0;c={label:c,timestampWrites:b}}b=Y(a);a=td(0);c=b.beginComputePass(c);W[a>>>0]=c;return a}function Lc(a,b,c,d){c=O(c);d=O(d);a=Y(a>>>0);-1==d&&(d=void 0);a.clearBuffer(Y(b>>>0),c,d)}function Mc(a,b,c,d,e,f){c=O(c);e=O(e);f=O(f);Y(a>>>0).copyBufferToBuffer(Y(b>>>0),c,Y(d>>>0),e,f)}
function Nc(a){var b=Y(a>>>0);a=rd(0);b=b.finish();W[a>>>0]=b;return a}function Oc(a,b,c,d,e,f){f=O(f);Y(a>>>0).resolveQuerySet(Y(b>>>0),c,d,Y(e>>>0),f)}function Pc(a,b,c,d){Y(a>>>0).dispatchWorkgroups(b,c,d)}function Qc(a,b,c){c=O(c);Y(a>>>0).dispatchWorkgroupsIndirect(Y(b>>>0),c)}function Rc(a){Y(a>>>0).end()}function Sc(a,b,c,d,e){d>>>=0;e>>>=0;a=Y(a>>>0);c=Y(c>>>0);0==d?a.setBindGroup(b,c):a.setBindGroup(b,c,(q(),A),e>>>2,d)}function Tc(a,b){Y(a>>>0).setPipeline(Y(b>>>0))}
function Uc(a,b,c){Y(a>>>0).W(Y(b>>>0),c)}function Vc(a,b){var c=Y(a>>>0);a=qd(0);b=c.getBindGroupLayout(b);W[a>>>0]=b;return a}
function Wc(a,b){function c(e){var f=(q(),A)[e+8>>>2>>>0],h=(q(),A)[e+32>>>2>>>0],l=(q(),A)[e+36>>>2>>>0],n=0;Ye(e,{327681:u=>{n=(q(),A)[u+8>>>2>>>0]}});f?(h=Se(e+24),-1==h&&(h=void 0),f={buffer:Y(f),offset:Se(e+16),size:h}):f=Y(h||l||n);return{binding:(q(),A)[e+4>>>2>>>0],resource:f}}a>>>=0;b>>>=0;b={label:Z(b+4),layout:Y((q(),A)[b+12>>>2>>>0]),entries:function(e,f){for(var h=[],l=0;l<e;++l)h.push(c(f+40*l));return h}((q(),A)[b+16>>>2>>>0],(q(),A)[b+20>>>2>>>0])};a=Y(a);var d=pd(0);Te(d,a.createBindGroup(b));
return d}function Xc(a,b){a>>>=0;b>>>=0;var c;b&&(c={label:Z(b+4)});b=Y(a);a=sd(0);c=b.createCommandEncoder(c);W[a>>>0]=c;return a}function Yc(a,b){a>>>=0;b>>>=0;b={type:gf[(q(),z)[b+12>>>2>>>0]],count:(q(),A)[b+16>>>2>>>0]};var c=Y(a);a=ud(0);b=c.createQuerySet(b);W[a>>>0]=b;return a}
function Zc(a,b){a=Y(a>>>0).adapterInfo;b>>>=0;(q(),A)[b+52>>>2>>>0]=a.subgroupMinSize;(q(),A)[b+56>>>2>>>0]=a.subgroupMaxSize;var c=a.vendor+a.architecture+a.device+a.description;var d=U(c)+1,e=md(d);e&&T(c,e,d);c=e;d=U(a.vendor);Ze(b+4,c,d);c+=d;d=U(a.architecture);Ze(b+12,c,d);c+=d;d=U(a.device);Ze(b+20,c,d);Ze(b+28,c+d,U(a.description));(q(),z)[b+36>>>2>>>0]=2;a=a.isFallbackAdapter?3:4;(q(),z)[b+40>>>2>>>0]=a;(q(),A)[b+44>>>2>>>0]=0;(q(),A)[b+48>>>2>>>0]=0;return 1}
var of={"core-features-and-limits":1,"depth-clip-control":2,"depth32float-stencil8":3,"texture-compression-bc":4,"texture-compression-bc-sliced-3d":5,"texture-compression-etc2":6,"texture-compression-astc":7,"texture-compression-astc-sliced-3d":8,"timestamp-query":9,"indirect-first-instance":10,"shader-f16":11,"rg11b10ufloat-renderable":12,"bgra8unorm-storage":13,"float32-filterable":14,"float32-blendable":15,"clip-distances":16,"dual-source-blending":17,subgroups:18,"texture-formats-tier1":19,"texture-formats-tier2":20,
"primitive-index":21,"texture-component-swizzle":22,"chromium-experimental-unorm16-texture-formats":327692,"chromium-experimental-multi-draw-indirect":327729};function $c(a,b){b>>>=0;var c=Y(a>>>0);a=md(4*c.features.size);var d=0,e=0;for(const f of c.features)c=of[f],0<=c&&((q(),z)[a+d>>>2>>>0]=c,d+=4,e++);(q(),A)[b+4>>>2>>>0]=a;(q(),A)[b>>>2>>>0]=e}function ad(a,b){bf(Y(a>>>0).limits,b>>>0);return 1}function bd(a,b){Y(a>>>0).pushErrorScope(cf[b])}
function cd(a,b,c){b>>>=0;c>>>=0;a=Y(a>>>0);b=Array.from((q(),z).subarray(c>>>2>>>0,c+4*b>>>2>>>0),d=>Y(d));a.submit(b)}function dd(a,b,c,d,e){c=O(c);d>>>=0;e>>>=0;a=Y(a>>>0);b=Y(b>>>0);d=(q(),x).subarray(d>>>0,d+e>>>0);a.writeBuffer(b,c,d,0,e)}m||Zd();m||(t=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),ua());g.wasmBinary&&(qa=g.wasmBinary);g.stackSave=()=>I();g.stackRestore=a=>H(a);g.stackAlloc=a=>Md(a);
g.setValue=function(a,b,c="i8"){c.endsWith("*")&&(c="*");switch(c){case "i1":(q(),w)[a>>>0]=b;break;case "i8":(q(),w)[a>>>0]=b;break;case "i16":(q(),Ka)[a>>>1>>>0]=b;break;case "i32":(q(),z)[a>>>2>>>0]=b;break;case "i64":(q(),E)[a>>>3>>>0]=BigInt(b);break;case "float":(q(),Ma)[a>>>2>>>0]=b;break;case "double":(q(),C)[a>>>3>>>0]=b;break;case "*":(q(),A)[a>>>2>>>0]=b;break;default:Qa(`invalid type for setValue: ${c}`)}};
g.getValue=function(a,b="i8"){b.endsWith("*")&&(b="*");switch(b){case "i1":return(q(),w)[a>>>0];case "i8":return(q(),w)[a>>>0];case "i16":return(q(),Ka)[a>>>1>>>0];case "i32":return(q(),z)[a>>>2>>>0];case "i64":return(q(),E)[a>>>3>>>0];case "float":return(q(),Ma)[a>>>2>>>0];case "double":return(q(),C)[a>>>3>>>0];case "*":return(q(),A)[a>>>2>>>0];default:Qa(`invalid type for getValue: ${b}`)}};g.UTF8ToString=ge;g.stringToUTF8=T;g.lengthBytesUTF8=U;
var Ce=[Fc,Yd,ce,Za,$a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,Vb,Wb,Xb,yc,zc,Bc,Cc,Dc,Ec],Be={984896:(a,b,c,d,e)=>{if("undefined"==typeof g||!g.o)return 1;a=ge(Number(a>>>0));a.startsWith("./")&&(a=a.substring(2));a=g.o.get(a);if(!a)return 2;b=Number(b>>>0);c=Number(c>>>0);d=Number(d>>>0);if(b+c>a.byteLength)return 3;try{const f=a.subarray(b,b+c);switch(e){case 0:(q(),x).set(f,d>>>0);break;case 1:g.B?g.B(d,f):g.T(d,f);break;default:return 4}return 0}catch{return 4}},985720:(a,b,c)=>{g.D(a,(q(),x).subarray(b>>>
0,b+c>>>0))},985784:()=>g.R(),985826:a=>{g.C(a)},985863:()=>"undefined"!==typeof wasmOffsetConverter},jd,Ga,kd,ld,G,md,nd,od,pd,qd,rd,sd,td,ud,vd,wd,xd,yd,zd,Ad,Bd,Cd,Dd,Ed,Da,Ja,Fd,Gd,Hd,Id,Jd,Kd,Ra,Ld,H,Md,I,Nd,Xa;
function gd(){var a=F;a=Object.assign({},a);var b=d=>e=>d(e)>>>0,c=d=>()=>d()>>>0;a.__getTypeName=b(a.__getTypeName);a.pthread_self=c(a.pthread_self);a.malloc=b(a.malloc);a.memalign=(d=>(e,f)=>d(e,f)>>>0)(a.memalign);a._emscripten_stack_alloc=b(a._emscripten_stack_alloc);a.emscripten_stack_get_current=c(a.emscripten_stack_get_current);return a}function Ba(){0<Sd?Td=Ba:m?(va?.(g),Pa()):(Rd(),0<Sd?Td=Ba:async function(){g.calledRun=!0;sa||(Pa(),va?.(g))}())}var F;m||(F=await (Aa()),Ba());
g.PTR_SIZE=4;
g.webgpuInit=a=>{const b=new WeakMap;let c=1,d=void 0,e=void 0;g.webgpuRegisterDevice=l=>{if(void 0!==e)throw Error("another WebGPU EP inference session is being created.");if(l){var n=b.get(l);if(!n){n=od(0);const u=Xe(l,n);n=[c++,n,u];b.set(l,n)}d=l;e=n[0];return n}d=void 0;e=0};const f=new Map;g.webgpuOnCreateSession=l=>{if(void 0!==e){var n=e;e=void 0;if(l){const u=kd(n);f.set(l,u);0===n&&a(d??Y(u))}d=void 0}};g.webgpuOnReleaseSession=l=>{f.delete(l)};const h=Symbol("gpuBufferMetadata");g.webgpuRegisterBuffer=
(l,n,u)=>{if(u)return l[h]=[u,NaN],u;if(u=l[h])return u[1]++,u[0];n=f.get(n);if(void 0===n)throw Error("Invalid session handle passed to webgpuRegisterBuffer");n=We(l,n);l[h]=[n,1];return n};g.webgpuUnregisterBuffer=l=>{const n=l[h];if(!n)throw Error("Buffer is not registered");n[1]--;0===n[1]&&(nd(n[0]),delete l[h])};g.webgpuGetBuffer=l=>Y(l);g.webgpuCreateDownloader=(l,n,u)=>{u=f.get(u);if(void 0===u)throw Error("Invalid session handle passed to webgpuRegisterBuffer");const D=Y(u),r=16*Math.ceil(Number(n)/
16);return async()=>{const v=D.createBuffer({size:r,usage:9});try{const y=D.createCommandEncoder();y.copyBufferToBuffer(l,0,v,0,r);D.queue.submit([y.finish()]);await v.mapAsync(GPUMapMode.READ);return v.getMappedRange().slice(0,n)}finally{v.destroy()}}};g.B=(l,n)=>{var u=n.buffer;const D=n.byteOffset,r=n.byteLength;n=16*Math.ceil(Number(r)/16);l=Y(l);if(!d){var v=kd(e);d=Y(v)}v=d.createBuffer({mappedAtCreation:!0,size:n,usage:6});const y=v.getMappedRange();(new Uint8Array(y)).set(new Uint8Array(u,
D,r));v.unmap();u=d.createCommandEncoder();u.copyBufferToBuffer(v,0,l,0,n);d.queue.submit([u.finish()]);v.destroy()}};
g.webnnInit=a=>{const b=a[0];[g.R,g.C,g.webnnEnsureTensor,g.D,g.webnnDownloadTensor,g.P,g.webnnEnableTraceEvent]=a.slice(1);g.webnnReleaseTensorId=g.C;g.webnnUploadTensor=g.D;g.webnnRegisterMLContext=g.P;g.webnnOnRunStart=c=>b.onRunStart(c);g.webnnOnRunEnd=b.onRunEnd.bind(b);g.webnnOnReleaseSession=c=>{b.onReleaseSession(c)};g.webnnCreateMLTensorDownloader=(c,d)=>b.createMLTensorDownloader(c,d);g.webnnRegisterMLTensor=(c,d,e,f)=>b.registerMLTensor(c,d,e,f);g.webnnCreateMLContext=c=>b.createMLContext(c);
g.webnnRegisterMLConstant=(c,d,e,f,h,l)=>b.registerMLConstant(c,d,e,f,h,g.o,l);g.webnnRegisterGraphInput=b.registerGraphInput.bind(b);g.webnnIsGraphInput=b.isGraphInput.bind(b);g.webnnRegisterGraphOutput=b.registerGraphOutput.bind(b);g.webnnIsGraphOutput=b.isGraphOutput.bind(b);g.webnnCreateTemporaryTensor=b.createTemporaryTensor.bind(b);g.webnnIsGraphInputOutputTypeSupported=b.isGraphInputOutputTypeSupported.bind(b)};Oa?moduleRtn=g:moduleRtn=new Promise((a,b)=>{va=a;wa=b});
;return moduleRtn}export default ortWasmThreaded;var isPthread=globalThis.self?.name?.startsWith("em-pthread");var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isPthread=(await import("worker_threads")).workerData==="em-pthread";isPthread&&ortWasmThreaded();
