From 72238f3444357f397de95643fcc5b2fa410fd36a Mon Sep 17 00:00:00 2001 From: Nomi Date: Sun, 12 Jan 2025 18:36:16 +0800 Subject: [PATCH] Updates --- assets/{index-BK0Jqenb.js => index-DJ-xcNaB.js} | 2 +- index.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename assets/{index-BK0Jqenb.js => index-DJ-xcNaB.js} (96%) diff --git a/assets/index-BK0Jqenb.js b/assets/index-DJ-xcNaB.js similarity index 96% rename from assets/index-BK0Jqenb.js rename to assets/index-DJ-xcNaB.js index 515472e..b26d720 100644 --- a/assets/index-BK0Jqenb.js +++ b/assets/index-DJ-xcNaB.js @@ -50,7 +50,7 @@ Error generating stack: `+y.message+` `),c=function($e){var Le=Function;if(!(Le instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof Le} which is not a function`);var Be=es(Le.name||"unknownFunctionName",function(){});return Be.prototype=Le.prototype,Be=new Be,($e=Le.apply(Be,$e))instanceof Object?$e:Be}(Z)(...oe),$=`methodCaller<(${v.map($e=>$e.name).join(", ")}) => ${k.name}>`,Yi(es($,c))}function br(c){return c=tn(c>>>0),Vt(f[c])}function ts(c,v){return v>>>=0,c=Ft(c>>>0),v=Ft(v),Vt(c[v])}function oi(c){9<(c>>>=0)&&(pt[c+1]+=1)}function al(){return Vt([])}function ns(c){c=Ft(c>>>0);for(var v=Array(c.length),$=0;$>>0))}function ui(){return Vt({})}function Xi(c){for(var v=Ft(c>>>=0);v.length;){var $=v.pop();v.pop()($)}Va(c)}function bo(c,v,$){v>>>=0,$>>>=0,c=Ft(c>>>0),v=Ft(v),$=Ft($),c[v]=$}function sl(c,v){return v>>>=0,c=(c=Ka(c>>>0,"_emval_take_value")).readValueFromPointer(v),Vt(c)}function ol(c,v){c=-9007199254740992>c||9007199254740992>>=0,c=new Date(1e3*c),u()[v>>>2>>>0]=c.getUTCSeconds(),u()[v+4>>>2>>>0]=c.getUTCMinutes(),u()[v+8>>>2>>>0]=c.getUTCHours(),u()[v+12>>>2>>>0]=c.getUTCDate(),u()[v+16>>>2>>>0]=c.getUTCMonth(),u()[v+20>>>2>>>0]=c.getUTCFullYear()-1900,u()[v+24>>>2>>>0]=c.getUTCDay(),c=(c.getTime()-Date.UTC(c.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,u()[v+28>>>2>>>0]=c}var Sr=c=>c%4==0&&(c%100!=0||c%400==0),Ji=[0,31,60,91,121,152,182,213,244,274,305,335],So=[0,31,59,90,120,151,181,212,243,273,304,334];function ul(c,v){c=-9007199254740992>c||9007199254740992>>=0,c=new Date(1e3*c),u()[v>>>2>>>0]=c.getSeconds(),u()[v+4>>>2>>>0]=c.getMinutes(),u()[v+8>>>2>>>0]=c.getHours(),u()[v+12>>>2>>>0]=c.getDate(),u()[v+16>>>2>>>0]=c.getMonth(),u()[v+20>>>2>>>0]=c.getFullYear()-1900,u()[v+24>>>2>>>0]=c.getDay();var $=(Sr(c.getFullYear())?Ji:So)[c.getMonth()]+c.getDate()-1|0;u()[v+28>>>2>>>0]=$,u()[v+36>>>2>>>0]=-60*c.getTimezoneOffset(),$=new Date(c.getFullYear(),6,1).getTimezoneOffset();var k=new Date(c.getFullYear(),0,1).getTimezoneOffset();c=0|($!=k&&c.getTimezoneOffset()==Math.min(k,$)),u()[v+32>>>2>>>0]=c}function ll(c){c>>>=0;var v=new Date(u()[c+20>>>2>>>0]+1900,u()[c+16>>>2>>>0],u()[c+12>>>2>>>0],u()[c+8>>>2>>>0],u()[c+4>>>2>>>0],u()[c>>>2>>>0],0),$=u()[c+32>>>2>>>0],k=v.getTimezoneOffset(),I=new Date(v.getFullYear(),6,1).getTimezoneOffset(),B=new Date(v.getFullYear(),0,1).getTimezoneOffset(),G=Math.min(B,I);return 0>$?u()[c+32>>>2>>>0]=+(I!=B&&G==k):0<$!=(G==k)&&(I=Math.max(B,I),v.setTime(v.getTime()+6e4*((0<$?G:I)-k))),u()[c+24>>>2>>>0]=v.getDay(),$=(Sr(v.getFullYear())?Ji:So)[v.getMonth()]+v.getDate()-1|0,u()[c+28>>>2>>>0]=$,u()[c>>>2>>>0]=v.getSeconds(),u()[c+4>>>2>>>0]=v.getMinutes(),u()[c+8>>>2>>>0]=v.getHours(),u()[c+12>>>2>>>0]=v.getDate(),u()[c+16>>>2>>>0]=v.getMonth(),u()[c+20>>>2>>>0]=v.getYear(),c=v.getTime(),BigInt(isNaN(c)?-1:c/1e3)}function ko(c,v,$,k,I,B,G){return T?Qe(16,1,c,v,$,k,I,B,G):-52}function Eo(c,v,$,k,I,B){if(T)return Qe(17,1,c,v,$,k,I,B)}function Co(c,v,$,k){c>>>=0,v>>>=0,$>>>=0,k>>>=0;var I=new Date().getFullYear(),B=new Date(I,0,1),G=new Date(I,6,1);I=B.getTimezoneOffset();var Z=G.getTimezoneOffset(),oe=Math.max(I,Z);h()[c>>>2>>>0]=60*oe,u()[v>>>2>>>0]=+(I!=Z),B=(c=le=>le.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1])(B),G=c(G),Z{is.length=0;for(var $;$=s()[c++>>>0];){var k=$!=105;v+=(k&=$!=112)&&v%8?4:0,is.push($==112?h()[v>>>2>>>0]:$==106?Ce[v>>>3]:$==105?u()[v>>>2>>>0]:g()[v>>>3>>>0]),v+=k?8:4}return is};function dl(c,v,$){return c>>>=0,v=To(v>>>0,$>>>0),Bi[c](...v)}function cl(c,v,$){return c>>>=0,v=To(v>>>0,$>>>0),Bi[c](...v)}var as=()=>{},fl=()=>Date.now();function pl(c,v){return de(rt(c>>>0,v>>>0))}var Io,zo=()=>{throw Xt+=1,"unwind"};function hl(){return 4294901760}Io=()=>performance.timeOrigin+performance.now();var ml=()=>navigator.hardwareConcurrency;function gl(){return Bn("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER"),0}function yl(c){c>>>=0;var v=s().length;if(c<=v||4294901760=$;$*=2){var k=v*(1+.2/$);k=Math.min(k,c+100663296);var I=Math;k=Math.max(c,k);e:{I=(I.min.call(I,4294901760,k+(65536-k%65536)%65536)-be.buffer.byteLength+65535)/65536;try{be.grow(I),He();var B=1;break e}catch{}B=void 0}if(B)return!0}return!1}var ea=()=>(Bn("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER"),0),li={},Ao=c=>{c.forEach(v=>{ea()})};function ss(){var c=Error().stack.toString().split(` `);return c[0]=="Error"&&c.shift(),Ao(c),li.Pb=ea(),li.ec=c,li.Pb}function di(c,v,$){if(c>>>=0,v>>>=0,li.Pb==c)var k=li.ec;else(k=Error().stack.toString().split(` `))[0]=="Error"&&k.shift(),Ao(k);for(var I=3;k[I]&&ea()!=c;)++I;for(c=0;c<$&&k[c+I];++c)u()[v+4*c>>>2>>>0]=ea();return c}var os,ta={},us=()=>{if(!os){var c,v={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:F};for(c in ta)ta[c]===void 0?delete v[c]:v[c]=ta[c];var $=[];for(c in v)$.push(`${c}=${v[c]}`);os=$}return os};function ls(c,v){if(T)return Qe(18,1,c,v);c>>>=0,v>>>=0;var $=0;return us().forEach((k,I)=>{var B=v+$;for(I=h()[c+4*I>>>2>>>0]=B,B=0;B>>0]=k.charCodeAt(B);i()[I>>>0]=0,$+=k.length+1}),0}function ds(c,v){if(T)return Qe(19,1,c,v);c>>>=0,v>>>=0;var $=us();h()[c>>>2>>>0]=$.length;var k=0;return $.forEach(I=>k+=I.length+1),h()[v>>>2>>>0]=k,0}function cs(c){return T?Qe(20,1,c):52}function er(c,v,$,k){return T?Qe(21,1,c,v,$,k):52}function Ro(c,v,$,k){return T?Qe(22,1,c,v,$,k):70}var vl=[null,[],[]];function Oo(c,v,$,k){if(T)return Qe(23,1,c,v,$,k);v>>>=0,$>>>=0,k>>>=0;for(var I=0,B=0;B<$;B++){var G=h()[v>>>2>>>0],Z=h()[v+4>>>2>>>0];v+=8;for(var oe=0;oe>>0],$e=vl[c];le===0||le===10?((c===1?xe:de)(Wi($e,0)),$e.length=0):$e.push(le)}I+=Z}return h()[k>>>2>>>0]=I,0}var fs=[31,29,31,30,31,30,31,31,30,31,30,31],ps=[31,28,31,30,31,30,31,31,30,31,30,31],ci=(c,v)=>{i().set(c,v>>>0)};function kr(c,v,$,k){function I(H,Me,et){for(H=typeof H=="number"?H.toString():H||"";H.lengthCr?-1:0rr-H.getDate())){H.setDate(H.getDate()+Me);break}Me-=rr-H.getDate()+1,H.setDate(1),11>et?H.setMonth(et+1):(H.setMonth(0),H.setFullYear(H.getFullYear()+1))}return et=new Date(H.getFullYear()+1,0,4),Me=Z(new Date(H.getFullYear(),0,4)),et=Z(et),0>=G(Me,H)?0>=G(et,H)?H.getFullYear()+1:H.getFullYear():H.getFullYear()-1}c>>>=0,v>>>=0,$>>>=0,k>>>=0;var le=h()[k+40>>>2>>>0];for(var $e in k={kc:u()[k>>>2>>>0],jc:u()[k+4>>>2>>>0],Hb:u()[k+8>>>2>>>0],Lb:u()[k+12>>>2>>>0],Ib:u()[k+16>>>2>>>0],Cb:u()[k+20>>>2>>>0],ub:u()[k+24>>>2>>>0],Bb:u()[k+28>>>2>>>0],rc:u()[k+32>>>2>>>0],ic:u()[k+36>>>2>>>0],lc:le?rt(le):""},$=rt($),le={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})$=$.replace(new RegExp($e,"g"),le[$e]);var Le="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Be="January February March April May June July August September October November December".split(" ");for($e in le={"%a":H=>Le[H.ub].substring(0,3),"%A":H=>Le[H.ub],"%b":H=>Be[H.Ib].substring(0,3),"%B":H=>Be[H.Ib],"%C":H=>B((H.Cb+1900)/100|0,2),"%d":H=>B(H.Lb,2),"%e":H=>I(H.Lb,2," "),"%g":H=>oe(H).toString().substring(2),"%G":oe,"%H":H=>B(H.Hb,2),"%I":H=>((H=H.Hb)==0?H=12:12{for(var Me=0,et=0;et<=H.Ib-1;Me+=(Sr(H.Cb+1900)?fs:ps)[et++]);return B(H.Lb+Me,3)},"%m":H=>B(H.Ib+1,2),"%M":H=>B(H.jc,2),"%n":()=>` -`,"%p":H=>0<=H.Hb&&12>H.Hb?"AM":"PM","%S":H=>B(H.kc,2),"%t":()=>" ","%u":H=>H.ub||7,"%U":H=>B(Math.floor((H.Bb+7-H.ub)/7),2),"%V":H=>{var Me=Math.floor((H.Bb+7-(H.ub+6)%7)/7);if(2>=(H.ub+371-H.Bb-2)%7&&Me++,Me)Me==53&&((et=(H.ub+371-H.Bb)%7)==4||et==3&&Sr(H.Cb)||(Me=1));else{Me=52;var et=(H.ub+7-H.Bb-1)%7;(et==4||et==5&&Sr(H.Cb%400-1))&&Me++}return B(Me,2)},"%w":H=>H.ub,"%W":H=>B(Math.floor((H.Bb+7-(H.ub+6)%7)/7),2),"%y":H=>(H.Cb+1900).toString().substring(2),"%Y":H=>H.Cb+1900,"%z":H=>{var Me=0<=(H=H.ic);return H=Math.abs(H)/60,(Me?"+":"-")+("0000"+(H/60*100+H%60)).slice(-4)},"%Z":H=>H.lc,"%%":()=>"%"},$=$.replace(/%%/g,"\0\0"),le)$.includes($e)&&($=$.replace(new RegExp($e,"g"),le[$e](k)));return $e=function(H){var Me=Array(gr(H)+1);return Jr(H,Me,0,Me.length),Me}($=$.replace(/\0\0/g,"%")),$e.length>v?0:(ci($e,c),$e.length-1)}function wl(c,v,$,k){return kr(c>>>0,v>>>0,$>>>0,k>>>0)}T||function(){for(var c=f.numThreads-1;c--;)Xn();ln.unshift(()=>{Ct++,function(v){T?v():Promise.all(Dn.map(Zn)).then(v)}(()=>Yr())})}();for(var fi=Array(256),na=0;256>na;++na)fi[na]=String.fromCharCode(na);co=fi,Un=f.BindingError=class extends Error{constructor(c){super(c),this.name="BindingError"}},f.InternalError=class extends Error{constructor(c){super(c),this.name="InternalError"}},pt.push(0,1,void 0,1,null,1,!0,1,!1,1),f.count_emval_handles=()=>pt.length/2-5-Fa.length;var Po=[Pa,Ma,ji,ao,mr,so,oo,uo,Ln,Da,Na,lo,La,Ua,ja,Wa,ko,Eo,ls,ds,cs,er,Ro,Oo],ye=function(){function c($,k){return ye=$.exports,ye=function(){var I=ye,B={};for(let[G,Z]of Object.entries(I))B[G]=typeof Z=="function"?(...oe)=>{Qi.push(G);try{return Z(...oe)}finally{Ne||(Qi.pop(),Mt&&bn===1&&Qi.length===0&&(bn=0,Xt+=1,Ki(nr),typeof Fibers<"u"&&Fibers.sc()))}}:Z;return B}(),ye=function(){var I=ye,B=Z=>oe=>Z(oe)>>>0,G=Z=>()=>Z()>>>0;return(I=Object.assign({},I)).Ca=B(I.Ca),I.fb=G(I.fb),I.gb=B(I.gb),I.emscripten_main_runtime_thread_id=G(I.emscripten_main_runtime_thread_id),I.sb=B(I.sb),I.tb=G(I.tb),I}(),Ni.push(ye.ib),at.unshift(ye.Ba),ke=k,Yr(),ye}var v=Ra();if(Ct++,f.instantiateWasm)try{return f.instantiateWasm(v,c)}catch($){de(`Module.instantiateWasm callback failed with error: ${$}`),w($)}return Oi||(Oi=f.locateFile?Pi("ort-wasm-simd-threaded.jsep.wasm")?"ort-wasm-simd-threaded.jsep.wasm":f.locateFile?f.locateFile("ort-wasm-simd-threaded.jsep.wasm",Q):Q+"ort-wasm-simd-threaded.jsep.wasm":new URL("/yolo-benchmark-onnxruntime-web/assets/ort-wasm-simd-threaded.jsep-Bj7LIWiD.wasm",import.meta.url).href),function($,k){var I=Oi;return se||typeof WebAssembly.instantiateStreaming!="function"||Pi(I)||fr(I)||typeof fetch!="function"?Mi(I,$,k):fetch(I,{credentials:"same-origin"}).then(B=>WebAssembly.instantiateStreaming(B,$).then(k,function(G){return de(`wasm streaming compile failed: ${G}`),de("falling back to ArrayBuffer instantiation"),Mi(I,$,k)}))}(v,function($){c($.instance,$.module)}).catch(w),{}}(),ra=c=>(ra=ye.Ca)(c),hs=()=>(hs=ye.Da)();f._OrtInit=(c,v)=>(f._OrtInit=ye.Ea)(c,v),f._OrtGetLastError=(c,v)=>(f._OrtGetLastError=ye.Fa)(c,v),f._OrtCreateSessionOptions=(c,v,$,k,I,B,G,Z,oe,le)=>(f._OrtCreateSessionOptions=ye.Ga)(c,v,$,k,I,B,G,Z,oe,le),f._OrtAppendExecutionProvider=(c,v)=>(f._OrtAppendExecutionProvider=ye.Ha)(c,v),f._OrtAddFreeDimensionOverride=(c,v,$)=>(f._OrtAddFreeDimensionOverride=ye.Ia)(c,v,$),f._OrtAddSessionConfigEntry=(c,v,$)=>(f._OrtAddSessionConfigEntry=ye.Ja)(c,v,$),f._OrtReleaseSessionOptions=c=>(f._OrtReleaseSessionOptions=ye.Ka)(c),f._OrtCreateSession=(c,v,$)=>(f._OrtCreateSession=ye.La)(c,v,$),f._OrtReleaseSession=c=>(f._OrtReleaseSession=ye.Ma)(c),f._OrtGetInputOutputCount=(c,v,$)=>(f._OrtGetInputOutputCount=ye.Na)(c,v,$),f._OrtGetInputName=(c,v)=>(f._OrtGetInputName=ye.Oa)(c,v),f._OrtGetOutputName=(c,v)=>(f._OrtGetOutputName=ye.Pa)(c,v),f._OrtFree=c=>(f._OrtFree=ye.Qa)(c),f._OrtCreateTensor=(c,v,$,k,I,B)=>(f._OrtCreateTensor=ye.Ra)(c,v,$,k,I,B),f._OrtGetTensorData=(c,v,$,k,I)=>(f._OrtGetTensorData=ye.Sa)(c,v,$,k,I),f._OrtReleaseTensor=c=>(f._OrtReleaseTensor=ye.Ta)(c),f._OrtCreateRunOptions=(c,v,$,k)=>(f._OrtCreateRunOptions=ye.Ua)(c,v,$,k),f._OrtAddRunConfigEntry=(c,v,$)=>(f._OrtAddRunConfigEntry=ye.Va)(c,v,$),f._OrtReleaseRunOptions=c=>(f._OrtReleaseRunOptions=ye.Wa)(c),f._OrtCreateBinding=c=>(f._OrtCreateBinding=ye.Xa)(c),f._OrtBindInput=(c,v,$)=>(f._OrtBindInput=ye.Ya)(c,v,$),f._OrtBindOutput=(c,v,$,k)=>(f._OrtBindOutput=ye.Za)(c,v,$,k),f._OrtClearBoundOutputs=c=>(f._OrtClearBoundOutputs=ye._a)(c),f._OrtReleaseBinding=c=>(f._OrtReleaseBinding=ye.$a)(c),f._OrtRunWithBinding=(c,v,$,k,I)=>(f._OrtRunWithBinding=ye.ab)(c,v,$,k,I),f._OrtRun=(c,v,$,k,I,B,G,Z)=>(f._OrtRun=ye.bb)(c,v,$,k,I,B,G,Z),f._OrtEndProfiling=c=>(f._OrtEndProfiling=ye.cb)(c),f._JsepOutput=(c,v,$)=>(f._JsepOutput=ye.db)(c,v,$),f._JsepGetNodeName=c=>(f._JsepGetNodeName=ye.eb)(c);var pi,tr=()=>(tr=ye.fb)(),ia=f._malloc=c=>(ia=f._malloc=ye.gb)(c),pn=f._free=c=>(pn=f._free=ye.hb)(c),ms=(c,v,$,k,I,B)=>(ms=ye.kb)(c,v,$,k,I,B),Mo=()=>(Mo=ye.lb)(),Bo=(c,v,$,k,I)=>(Bo=ye.mb)(c,v,$,k,I),Dt=c=>(Dt=ye.nb)(c),Fn=c=>(Fn=ye.ob)(c),gs=()=>(gs=ye.pb)(),ys=(c,v)=>(ys=ye.qb)(c,v),hi=c=>(hi=ye.rb)(c),aa=c=>(aa=ye.sb)(c),mi=()=>(mi=ye.tb)(),Do=f.dynCall_ii=(c,v)=>(Do=f.dynCall_ii=ye.vb)(c,v),No=c=>(No=ye.wb)(c),nr=()=>(nr=ye.xb)(),sa=c=>(sa=ye.yb)(c),Er=()=>(Er=ye.zb)();function oa(){0mi(),f.stackRestore=c=>hi(c),f.stackAlloc=c=>aa(c),f.UTF8ToString=rt,f.stringToUTF8=Nn,f.lengthBytesUTF8=gr,$n=function c(){pi||oa(),pi||($n=c)},oa(),b}),n0=Wd,((e=globalThis.self)==null?void 0:e.name)==="em-pthread"&&Wd()}),Ea,mh,gh,yh,Fd,r0,vh,i0,Xu=ne(()=>{var e,r;Gc(),Ea=import.meta.url??(typeof document<"u"?(e=document.currentScript)==null?void 0:e.src:typeof self<"u"?(r=self.location)==null?void 0:r.href:void 0),mh=typeof location>"u"?void 0:location.origin,gh=(i,s)=>{try{let o=s??Ea;return(o?new URL(i,o):new URL(i)).origin===mh}catch{return!1}},yh=async i=>{let s=await(await fetch(i,{credentials:"same-origin"})).blob();return URL.createObjectURL(s)},Fd=(T_(),Fu(Jy)).default,r0=async()=>{if(!Ea)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(gh(Ea))return[void 0,Fd()];let i=await yh(Ea);return[i,Fd(i)]},vh=(I_(),Fu(t0)).default,i0=async(i,s,o)=>[void 0,vh]}),Vd,zu,Ns,Hd,wh,_h,Kc,_t,Ri=ne(()=>{Xu(),zu=!1,Ns=!1,Hd=!1,wh=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},_h=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},Kc=async e=>{if(zu)return Promise.resolve();if(Ns)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Hd)throw new Error("previous call to 'initializeWebAssembly()' failed.");Ns=!0;let r=e.initTimeout,i=e.numThreads;if(!_h())throw new Error("WebAssembly SIMD is not supported in the current environment.");let s=wh();i>1&&!s&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+i+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=i=1);let o=e.wasmPaths,d=typeof o=="string"?o:void 0,u=o==null?void 0:o.mjs,h=(u==null?void 0:u.href)??u,m=o==null?void 0:o.wasm,g=(m==null?void 0:m.href)??m,_=e.wasmBinary,[w,f]=await i0(h,d,i>1),b=!1,S=[];if(r>0&&S.push(new Promise(x=>{setTimeout(()=>{b=!0,x()},r)})),S.push(new Promise((x,T)=>{let z={numThreads:i};_?z.wasmBinary=_:(g||d)&&(z.locateFile=(C,O)=>g??(d??O)+C),f(z).then(C=>{Ns=!1,zu=!0,Vd=C,x(),w&&URL.revokeObjectURL(w)},C=>{Ns=!1,Hd=!0,T(C)})})),await Promise.race(S),b)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},_t=()=>{if(zu&&Vd)return Vd;throw new Error("WebAssembly is not initialized yet.")}}),Et,Hu,lt,Qc=ne(()=>{Ri(),Et=(e,r)=>{let i=_t(),s=i.lengthBytesUTF8(e)+1,o=i._malloc(s);return i.stringToUTF8(e,o,s),r.push(o),o},Hu=(e,r,i,s)=>{if(typeof e=="object"&&e!==null){if(i.has(e))throw new Error("Circular reference in options");i.add(e)}Object.entries(e).forEach(([o,d])=>{let u=r?r+o:o;if(typeof d=="object")Hu(d,u+".",i,s);else if(typeof d=="string"||typeof d=="number")s(u,d.toString());else if(typeof d=="boolean")s(u,d?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof d}`)})},lt=e=>{let r=_t(),i=r.stackSave();try{let s=r.stackAlloc(8);r._OrtGetLastError(s,s+4);let o=r.HEAP32[s/4],d=r.HEAPU32[s/4+1],u=d?r.UTF8ToString(d):"";throw new Error(`${e} ERROR_CODE: ${o}, ERROR_MESSAGE: ${u}`)}finally{r.stackRestore(i)}}}),a0,z_=ne(()=>{Ri(),Qc(),a0=e=>{let r=_t(),i=0,s=[],o=e||{};try{if((e==null?void 0:e.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if((e==null?void 0:e.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);(e==null?void 0:e.terminate)===void 0&&(o.terminate=!1);let d=0;return(e==null?void 0:e.tag)!==void 0&&(d=Et(e.tag,s)),i=r._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,d),i===0&<("Can't create run options."),(e==null?void 0:e.extra)!==void 0&&Hu(e.extra,"",new WeakSet,(u,h)=>{let m=Et(u,s),g=Et(h,s);r._OrtAddRunConfigEntry(i,m,g)!==0&<(`Can't set a run config entry: ${u} - ${h}.`)}),[i,s]}catch(d){throw i!==0&&r._OrtReleaseRunOptions(i),s.forEach(u=>r._free(u)),d}}}),$h,xh,bh,Sh,s0,A_=ne(()=>{Ri(),Qc(),$h=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},xh=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},bh=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let r=e.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(i=>(typeof i=="string"?i:i.name)==="webgpu")&&(e.enableMemPattern=!1)},Sh=(e,r,i)=>{for(let s of r){let o=typeof s=="string"?s:s.name;switch(o){case"webnn":if(o="WEBNN",typeof s!="string"){let u=s==null?void 0:s.deviceType;if(u){let h=Et("deviceType",i),m=Et(u,i);_t()._OrtAddSessionConfigEntry(e,h,m)!==0&<(`Can't set a session config entry: 'deviceType' - ${u}.`)}}break;case"webgpu":if(o="JS",typeof s!="string"){let u=s;if(u!=null&&u.preferredLayout){if(u.preferredLayout!=="NCHW"&&u.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${u.preferredLayout}`);let h=Et("preferredLayout",i),m=Et(u.preferredLayout,i);_t()._OrtAddSessionConfigEntry(e,h,m)!==0&<(`Can't set a session config entry: 'preferredLayout' - ${u.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${o}`)}let d=Et(o,i);_t()._OrtAppendExecutionProvider(e,d)!==0&<(`Can't append execution provider: ${o}.`)}},s0=e=>{let r=_t(),i=0,s=[],o=e||{};bh(o);try{let d=$h(o.graphOptimizationLevel??"all"),u=xh(o.executionMode??"sequential"),h=typeof o.logId=="string"?Et(o.logId,s):0,m=o.logSeverityLevel??2;if(!Number.isInteger(m)||m<0||m>4)throw new Error(`log serverity level is not valid: ${m}`);let g=o.logVerbosityLevel??0;if(!Number.isInteger(g)||g<0||g>4)throw new Error(`log verbosity level is not valid: ${g}`);let _=typeof o.optimizedModelFilePath=="string"?Et(o.optimizedModelFilePath,s):0;if(i=r._OrtCreateSessionOptions(d,!!o.enableCpuMemArena,!!o.enableMemPattern,u,!!o.enableProfiling,0,h,m,g,_),i===0&<("Can't create session options."),o.executionProviders&&Sh(i,o.executionProviders,s),o.enableGraphCapture!==void 0){if(typeof o.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${o.enableGraphCapture}`);let w=Et("enableGraphCapture",s),f=Et(o.enableGraphCapture.toString(),s);r._OrtAddSessionConfigEntry(i,w,f)!==0&<(`Can't set a session config entry: 'enableGraphCapture' - ${o.enableGraphCapture}.`)}if(o.freeDimensionOverrides)for(let[w,f]of Object.entries(o.freeDimensionOverrides)){if(typeof w!="string")throw new Error(`free dimension override name must be a string: ${w}`);if(typeof f!="number"||!Number.isInteger(f)||f<0)throw new Error(`free dimension override value must be a non-negative integer: ${f}`);let b=Et(w,s);r._OrtAddFreeDimensionOverride(i,b,f)!==0&<(`Can't set a free dimension override: ${w} - ${f}.`)}return o.extra!==void 0&&Hu(o.extra,"",new WeakSet,(w,f)=>{let b=Et(w,s),S=Et(f,s);r._OrtAddSessionConfigEntry(i,b,S)!==0&<(`Can't set a session config entry: ${w} - ${f}.`)}),[i,s]}catch(d){throw i!==0&&r._OrtReleaseSessionOptions(i),s.forEach(u=>r._free(u)),d}}}),qs,Ai,Ta,Yc,qu,Zc,Xc,Ec,ze=ne(()=>{qs=e=>{switch(e){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},Ai=e=>{switch(e){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},Ta=(e,r)=>{let i=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],s=typeof r=="number"?r:r.reduce((o,d)=>o*d,1);return i>0?Math.ceil(s*i):void 0},Yc=e=>{switch(e){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},qu=e=>{switch(e){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${e}`)}},Zc=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Xc=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool",Ec=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),Jc,o0=ne(()=>{Gc(),Jc=async e=>{if(typeof e=="string"){let r=await fetch(e);if(!r.ok)throw new Error(`failed to load external data file: ${e}`);let i=r.headers.get("Content-Length"),s=i?parseInt(i,10):0;if(s<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let o=r.body.getReader(),d;try{d=new ArrayBuffer(s)}catch(h){if(h instanceof RangeError){let m=Math.ceil(s/65536);d=new WebAssembly.Memory({initial:m,maximum:m}).buffer}else throw h}let u=0;for(;;){let{done:h,value:m}=await o.read();if(h)break;let g=m.byteLength;new Uint8Array(d,u,g).set(m),u+=g}return new Uint8Array(d,0,s)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),kh,Eh,Ch,Th,ef,Ih,Ye,Qn=ne(()=>{ze(),kh=["V","I","W","E","F"],Eh=(e,r)=>{console.log(`[${kh[e]},${new Date().toISOString()}]${r}`)},ef=(e,r)=>{Ch=e,Th=r},Ih=(e,r)=>{let i=qu(e),s=qu(Ch);i>=s&&Eh(i,typeof r=="function"?r():r)},Ye=(...e)=>{Th&&Ih(...e)}}),tf,u0=ne(()=>{ze(),tf=(e,r)=>new(Yc(r))(e)}),nf=ne(()=>{}),qd,Au,Ru,zh,Ah,Gd,Cc,Rh,l0,R_=ne(()=>{Qn(),nf(),qd=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),Au=[],Ru=e=>Math.ceil(e/16)*16,zh=e=>{for(let r=0;rAh++,Cc=async(e,r,i,s)=>{let o=Ru(i),d=e.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let u=e.getCommandEncoder();e.endComputePass(),u.copyBufferToBuffer(r,0,d,0,o),e.flush(),await d.mapAsync(GPUMapMode.READ);let h=d.getMappedRange();if(s){let m=s();return m.set(new Uint8Array(h,0,i)),m}else return new Uint8Array(h.slice(0,i))}finally{d.destroy()}},Rh=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersForUploadingPending=[],this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[r]of qd)Au.push(r),this.freeBuffers.set(r,[]),this.freeUniformBuffers.set(r,[])}upload(e,r){let i=r.buffer,s=r.byteOffset,o=r.byteLength,d=Ru(o),u=this.storageCache.get(e);if(!u)throw new Error("gpu data for uploading does not exist");if(u.originalSize!==o)throw new Error(`inconsistent data size. gpu data size=${u.originalSize}, data size=${o}`);let h=this.backend.device.createBuffer({mappedAtCreation:!0,size:d,usage:GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC}),m=h.getMappedRange();new Uint8Array(m).set(new Uint8Array(i,s,o)),h.unmap();let g=this.backend.getCommandEncoder();this.backend.endComputePass(),g.copyBufferToBuffer(h,0,u.gpuData.buffer,0,d),Ye("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`),this.buffersForUploadingPending.push(h)}memcpy(e,r){let i=this.storageCache.get(e);if(!i)throw new Error("source gpu data for memcpy does not exist");let s=this.storageCache.get(r);if(!s)throw new Error("destination gpu data for memcpy does not exist");if(i.originalSize!==s.originalSize)throw new Error("inconsistent source and destination gpu data size");let o=Ru(i.originalSize),d=this.backend.getCommandEncoder();this.backend.endComputePass(),d.copyBufferToBuffer(i.gpuData.buffer,0,s.gpuData.buffer,0,o)}registerExternalBuffer(e,r,i){let s;if(i){if(s=i[0],e===i[1])return Ye("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, buffer is the same, skip.`),s;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet. +`,"%p":H=>0<=H.Hb&&12>H.Hb?"AM":"PM","%S":H=>B(H.kc,2),"%t":()=>" ","%u":H=>H.ub||7,"%U":H=>B(Math.floor((H.Bb+7-H.ub)/7),2),"%V":H=>{var Me=Math.floor((H.Bb+7-(H.ub+6)%7)/7);if(2>=(H.ub+371-H.Bb-2)%7&&Me++,Me)Me==53&&((et=(H.ub+371-H.Bb)%7)==4||et==3&&Sr(H.Cb)||(Me=1));else{Me=52;var et=(H.ub+7-H.Bb-1)%7;(et==4||et==5&&Sr(H.Cb%400-1))&&Me++}return B(Me,2)},"%w":H=>H.ub,"%W":H=>B(Math.floor((H.Bb+7-(H.ub+6)%7)/7),2),"%y":H=>(H.Cb+1900).toString().substring(2),"%Y":H=>H.Cb+1900,"%z":H=>{var Me=0<=(H=H.ic);return H=Math.abs(H)/60,(Me?"+":"-")+("0000"+(H/60*100+H%60)).slice(-4)},"%Z":H=>H.lc,"%%":()=>"%"},$=$.replace(/%%/g,"\0\0"),le)$.includes($e)&&($=$.replace(new RegExp($e,"g"),le[$e](k)));return $e=function(H){var Me=Array(gr(H)+1);return Jr(H,Me,0,Me.length),Me}($=$.replace(/\0\0/g,"%")),$e.length>v?0:(ci($e,c),$e.length-1)}function wl(c,v,$,k){return kr(c>>>0,v>>>0,$>>>0,k>>>0)}T||function(){for(var c=f.numThreads-1;c--;)Xn();ln.unshift(()=>{Ct++,function(v){T?v():Promise.all(Dn.map(Zn)).then(v)}(()=>Yr())})}();for(var fi=Array(256),na=0;256>na;++na)fi[na]=String.fromCharCode(na);co=fi,Un=f.BindingError=class extends Error{constructor(c){super(c),this.name="BindingError"}},f.InternalError=class extends Error{constructor(c){super(c),this.name="InternalError"}},pt.push(0,1,void 0,1,null,1,!0,1,!1,1),f.count_emval_handles=()=>pt.length/2-5-Fa.length;var Po=[Pa,Ma,ji,ao,mr,so,oo,uo,Ln,Da,Na,lo,La,Ua,ja,Wa,ko,Eo,ls,ds,cs,er,Ro,Oo],ye=function(){function c($,k){return ye=$.exports,ye=function(){var I=ye,B={};for(let[G,Z]of Object.entries(I))B[G]=typeof Z=="function"?(...oe)=>{Qi.push(G);try{return Z(...oe)}finally{Ne||(Qi.pop(),Mt&&bn===1&&Qi.length===0&&(bn=0,Xt+=1,Ki(nr),typeof Fibers<"u"&&Fibers.sc()))}}:Z;return B}(),ye=function(){var I=ye,B=Z=>oe=>Z(oe)>>>0,G=Z=>()=>Z()>>>0;return(I=Object.assign({},I)).Ca=B(I.Ca),I.fb=G(I.fb),I.gb=B(I.gb),I.emscripten_main_runtime_thread_id=G(I.emscripten_main_runtime_thread_id),I.sb=B(I.sb),I.tb=G(I.tb),I}(),Ni.push(ye.ib),at.unshift(ye.Ba),ke=k,Yr(),ye}var v=Ra();if(Ct++,f.instantiateWasm)try{return f.instantiateWasm(v,c)}catch($){de(`Module.instantiateWasm callback failed with error: ${$}`),w($)}return Oi||(Oi=f.locateFile?Pi("ort-wasm-simd-threaded.jsep.wasm")?"ort-wasm-simd-threaded.jsep.wasm":f.locateFile?f.locateFile("ort-wasm-simd-threaded.jsep.wasm",Q):Q+"ort-wasm-simd-threaded.jsep.wasm":new URL("/yolo-model-benchmark-onnxruntime-web/assets/ort-wasm-simd-threaded.jsep-Bj7LIWiD.wasm",import.meta.url).href),function($,k){var I=Oi;return se||typeof WebAssembly.instantiateStreaming!="function"||Pi(I)||fr(I)||typeof fetch!="function"?Mi(I,$,k):fetch(I,{credentials:"same-origin"}).then(B=>WebAssembly.instantiateStreaming(B,$).then(k,function(G){return de(`wasm streaming compile failed: ${G}`),de("falling back to ArrayBuffer instantiation"),Mi(I,$,k)}))}(v,function($){c($.instance,$.module)}).catch(w),{}}(),ra=c=>(ra=ye.Ca)(c),hs=()=>(hs=ye.Da)();f._OrtInit=(c,v)=>(f._OrtInit=ye.Ea)(c,v),f._OrtGetLastError=(c,v)=>(f._OrtGetLastError=ye.Fa)(c,v),f._OrtCreateSessionOptions=(c,v,$,k,I,B,G,Z,oe,le)=>(f._OrtCreateSessionOptions=ye.Ga)(c,v,$,k,I,B,G,Z,oe,le),f._OrtAppendExecutionProvider=(c,v)=>(f._OrtAppendExecutionProvider=ye.Ha)(c,v),f._OrtAddFreeDimensionOverride=(c,v,$)=>(f._OrtAddFreeDimensionOverride=ye.Ia)(c,v,$),f._OrtAddSessionConfigEntry=(c,v,$)=>(f._OrtAddSessionConfigEntry=ye.Ja)(c,v,$),f._OrtReleaseSessionOptions=c=>(f._OrtReleaseSessionOptions=ye.Ka)(c),f._OrtCreateSession=(c,v,$)=>(f._OrtCreateSession=ye.La)(c,v,$),f._OrtReleaseSession=c=>(f._OrtReleaseSession=ye.Ma)(c),f._OrtGetInputOutputCount=(c,v,$)=>(f._OrtGetInputOutputCount=ye.Na)(c,v,$),f._OrtGetInputName=(c,v)=>(f._OrtGetInputName=ye.Oa)(c,v),f._OrtGetOutputName=(c,v)=>(f._OrtGetOutputName=ye.Pa)(c,v),f._OrtFree=c=>(f._OrtFree=ye.Qa)(c),f._OrtCreateTensor=(c,v,$,k,I,B)=>(f._OrtCreateTensor=ye.Ra)(c,v,$,k,I,B),f._OrtGetTensorData=(c,v,$,k,I)=>(f._OrtGetTensorData=ye.Sa)(c,v,$,k,I),f._OrtReleaseTensor=c=>(f._OrtReleaseTensor=ye.Ta)(c),f._OrtCreateRunOptions=(c,v,$,k)=>(f._OrtCreateRunOptions=ye.Ua)(c,v,$,k),f._OrtAddRunConfigEntry=(c,v,$)=>(f._OrtAddRunConfigEntry=ye.Va)(c,v,$),f._OrtReleaseRunOptions=c=>(f._OrtReleaseRunOptions=ye.Wa)(c),f._OrtCreateBinding=c=>(f._OrtCreateBinding=ye.Xa)(c),f._OrtBindInput=(c,v,$)=>(f._OrtBindInput=ye.Ya)(c,v,$),f._OrtBindOutput=(c,v,$,k)=>(f._OrtBindOutput=ye.Za)(c,v,$,k),f._OrtClearBoundOutputs=c=>(f._OrtClearBoundOutputs=ye._a)(c),f._OrtReleaseBinding=c=>(f._OrtReleaseBinding=ye.$a)(c),f._OrtRunWithBinding=(c,v,$,k,I)=>(f._OrtRunWithBinding=ye.ab)(c,v,$,k,I),f._OrtRun=(c,v,$,k,I,B,G,Z)=>(f._OrtRun=ye.bb)(c,v,$,k,I,B,G,Z),f._OrtEndProfiling=c=>(f._OrtEndProfiling=ye.cb)(c),f._JsepOutput=(c,v,$)=>(f._JsepOutput=ye.db)(c,v,$),f._JsepGetNodeName=c=>(f._JsepGetNodeName=ye.eb)(c);var pi,tr=()=>(tr=ye.fb)(),ia=f._malloc=c=>(ia=f._malloc=ye.gb)(c),pn=f._free=c=>(pn=f._free=ye.hb)(c),ms=(c,v,$,k,I,B)=>(ms=ye.kb)(c,v,$,k,I,B),Mo=()=>(Mo=ye.lb)(),Bo=(c,v,$,k,I)=>(Bo=ye.mb)(c,v,$,k,I),Dt=c=>(Dt=ye.nb)(c),Fn=c=>(Fn=ye.ob)(c),gs=()=>(gs=ye.pb)(),ys=(c,v)=>(ys=ye.qb)(c,v),hi=c=>(hi=ye.rb)(c),aa=c=>(aa=ye.sb)(c),mi=()=>(mi=ye.tb)(),Do=f.dynCall_ii=(c,v)=>(Do=f.dynCall_ii=ye.vb)(c,v),No=c=>(No=ye.wb)(c),nr=()=>(nr=ye.xb)(),sa=c=>(sa=ye.yb)(c),Er=()=>(Er=ye.zb)();function oa(){0mi(),f.stackRestore=c=>hi(c),f.stackAlloc=c=>aa(c),f.UTF8ToString=rt,f.stringToUTF8=Nn,f.lengthBytesUTF8=gr,$n=function c(){pi||oa(),pi||($n=c)},oa(),b}),n0=Wd,((e=globalThis.self)==null?void 0:e.name)==="em-pthread"&&Wd()}),Ea,mh,gh,yh,Fd,r0,vh,i0,Xu=ne(()=>{var e,r;Gc(),Ea=import.meta.url??(typeof document<"u"?(e=document.currentScript)==null?void 0:e.src:typeof self<"u"?(r=self.location)==null?void 0:r.href:void 0),mh=typeof location>"u"?void 0:location.origin,gh=(i,s)=>{try{let o=s??Ea;return(o?new URL(i,o):new URL(i)).origin===mh}catch{return!1}},yh=async i=>{let s=await(await fetch(i,{credentials:"same-origin"})).blob();return URL.createObjectURL(s)},Fd=(T_(),Fu(Jy)).default,r0=async()=>{if(!Ea)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(gh(Ea))return[void 0,Fd()];let i=await yh(Ea);return[i,Fd(i)]},vh=(I_(),Fu(t0)).default,i0=async(i,s,o)=>[void 0,vh]}),Vd,zu,Ns,Hd,wh,_h,Kc,_t,Ri=ne(()=>{Xu(),zu=!1,Ns=!1,Hd=!1,wh=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},_h=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},Kc=async e=>{if(zu)return Promise.resolve();if(Ns)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Hd)throw new Error("previous call to 'initializeWebAssembly()' failed.");Ns=!0;let r=e.initTimeout,i=e.numThreads;if(!_h())throw new Error("WebAssembly SIMD is not supported in the current environment.");let s=wh();i>1&&!s&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+i+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=i=1);let o=e.wasmPaths,d=typeof o=="string"?o:void 0,u=o==null?void 0:o.mjs,h=(u==null?void 0:u.href)??u,m=o==null?void 0:o.wasm,g=(m==null?void 0:m.href)??m,_=e.wasmBinary,[w,f]=await i0(h,d,i>1),b=!1,S=[];if(r>0&&S.push(new Promise(x=>{setTimeout(()=>{b=!0,x()},r)})),S.push(new Promise((x,T)=>{let z={numThreads:i};_?z.wasmBinary=_:(g||d)&&(z.locateFile=(C,O)=>g??(d??O)+C),f(z).then(C=>{Ns=!1,zu=!0,Vd=C,x(),w&&URL.revokeObjectURL(w)},C=>{Ns=!1,Hd=!0,T(C)})})),await Promise.race(S),b)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},_t=()=>{if(zu&&Vd)return Vd;throw new Error("WebAssembly is not initialized yet.")}}),Et,Hu,lt,Qc=ne(()=>{Ri(),Et=(e,r)=>{let i=_t(),s=i.lengthBytesUTF8(e)+1,o=i._malloc(s);return i.stringToUTF8(e,o,s),r.push(o),o},Hu=(e,r,i,s)=>{if(typeof e=="object"&&e!==null){if(i.has(e))throw new Error("Circular reference in options");i.add(e)}Object.entries(e).forEach(([o,d])=>{let u=r?r+o:o;if(typeof d=="object")Hu(d,u+".",i,s);else if(typeof d=="string"||typeof d=="number")s(u,d.toString());else if(typeof d=="boolean")s(u,d?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof d}`)})},lt=e=>{let r=_t(),i=r.stackSave();try{let s=r.stackAlloc(8);r._OrtGetLastError(s,s+4);let o=r.HEAP32[s/4],d=r.HEAPU32[s/4+1],u=d?r.UTF8ToString(d):"";throw new Error(`${e} ERROR_CODE: ${o}, ERROR_MESSAGE: ${u}`)}finally{r.stackRestore(i)}}}),a0,z_=ne(()=>{Ri(),Qc(),a0=e=>{let r=_t(),i=0,s=[],o=e||{};try{if((e==null?void 0:e.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if((e==null?void 0:e.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);(e==null?void 0:e.terminate)===void 0&&(o.terminate=!1);let d=0;return(e==null?void 0:e.tag)!==void 0&&(d=Et(e.tag,s)),i=r._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,d),i===0&<("Can't create run options."),(e==null?void 0:e.extra)!==void 0&&Hu(e.extra,"",new WeakSet,(u,h)=>{let m=Et(u,s),g=Et(h,s);r._OrtAddRunConfigEntry(i,m,g)!==0&<(`Can't set a run config entry: ${u} - ${h}.`)}),[i,s]}catch(d){throw i!==0&&r._OrtReleaseRunOptions(i),s.forEach(u=>r._free(u)),d}}}),$h,xh,bh,Sh,s0,A_=ne(()=>{Ri(),Qc(),$h=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},xh=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},bh=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let r=e.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(i=>(typeof i=="string"?i:i.name)==="webgpu")&&(e.enableMemPattern=!1)},Sh=(e,r,i)=>{for(let s of r){let o=typeof s=="string"?s:s.name;switch(o){case"webnn":if(o="WEBNN",typeof s!="string"){let u=s==null?void 0:s.deviceType;if(u){let h=Et("deviceType",i),m=Et(u,i);_t()._OrtAddSessionConfigEntry(e,h,m)!==0&<(`Can't set a session config entry: 'deviceType' - ${u}.`)}}break;case"webgpu":if(o="JS",typeof s!="string"){let u=s;if(u!=null&&u.preferredLayout){if(u.preferredLayout!=="NCHW"&&u.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${u.preferredLayout}`);let h=Et("preferredLayout",i),m=Et(u.preferredLayout,i);_t()._OrtAddSessionConfigEntry(e,h,m)!==0&<(`Can't set a session config entry: 'preferredLayout' - ${u.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${o}`)}let d=Et(o,i);_t()._OrtAppendExecutionProvider(e,d)!==0&<(`Can't append execution provider: ${o}.`)}},s0=e=>{let r=_t(),i=0,s=[],o=e||{};bh(o);try{let d=$h(o.graphOptimizationLevel??"all"),u=xh(o.executionMode??"sequential"),h=typeof o.logId=="string"?Et(o.logId,s):0,m=o.logSeverityLevel??2;if(!Number.isInteger(m)||m<0||m>4)throw new Error(`log serverity level is not valid: ${m}`);let g=o.logVerbosityLevel??0;if(!Number.isInteger(g)||g<0||g>4)throw new Error(`log verbosity level is not valid: ${g}`);let _=typeof o.optimizedModelFilePath=="string"?Et(o.optimizedModelFilePath,s):0;if(i=r._OrtCreateSessionOptions(d,!!o.enableCpuMemArena,!!o.enableMemPattern,u,!!o.enableProfiling,0,h,m,g,_),i===0&<("Can't create session options."),o.executionProviders&&Sh(i,o.executionProviders,s),o.enableGraphCapture!==void 0){if(typeof o.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${o.enableGraphCapture}`);let w=Et("enableGraphCapture",s),f=Et(o.enableGraphCapture.toString(),s);r._OrtAddSessionConfigEntry(i,w,f)!==0&<(`Can't set a session config entry: 'enableGraphCapture' - ${o.enableGraphCapture}.`)}if(o.freeDimensionOverrides)for(let[w,f]of Object.entries(o.freeDimensionOverrides)){if(typeof w!="string")throw new Error(`free dimension override name must be a string: ${w}`);if(typeof f!="number"||!Number.isInteger(f)||f<0)throw new Error(`free dimension override value must be a non-negative integer: ${f}`);let b=Et(w,s);r._OrtAddFreeDimensionOverride(i,b,f)!==0&<(`Can't set a free dimension override: ${w} - ${f}.`)}return o.extra!==void 0&&Hu(o.extra,"",new WeakSet,(w,f)=>{let b=Et(w,s),S=Et(f,s);r._OrtAddSessionConfigEntry(i,b,S)!==0&<(`Can't set a session config entry: ${w} - ${f}.`)}),[i,s]}catch(d){throw i!==0&&r._OrtReleaseSessionOptions(i),s.forEach(u=>r._free(u)),d}}}),qs,Ai,Ta,Yc,qu,Zc,Xc,Ec,ze=ne(()=>{qs=e=>{switch(e){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},Ai=e=>{switch(e){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},Ta=(e,r)=>{let i=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],s=typeof r=="number"?r:r.reduce((o,d)=>o*d,1);return i>0?Math.ceil(s*i):void 0},Yc=e=>{switch(e){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},qu=e=>{switch(e){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${e}`)}},Zc=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Xc=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool",Ec=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),Jc,o0=ne(()=>{Gc(),Jc=async e=>{if(typeof e=="string"){let r=await fetch(e);if(!r.ok)throw new Error(`failed to load external data file: ${e}`);let i=r.headers.get("Content-Length"),s=i?parseInt(i,10):0;if(s<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let o=r.body.getReader(),d;try{d=new ArrayBuffer(s)}catch(h){if(h instanceof RangeError){let m=Math.ceil(s/65536);d=new WebAssembly.Memory({initial:m,maximum:m}).buffer}else throw h}let u=0;for(;;){let{done:h,value:m}=await o.read();if(h)break;let g=m.byteLength;new Uint8Array(d,u,g).set(m),u+=g}return new Uint8Array(d,0,s)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),kh,Eh,Ch,Th,ef,Ih,Ye,Qn=ne(()=>{ze(),kh=["V","I","W","E","F"],Eh=(e,r)=>{console.log(`[${kh[e]},${new Date().toISOString()}]${r}`)},ef=(e,r)=>{Ch=e,Th=r},Ih=(e,r)=>{let i=qu(e),s=qu(Ch);i>=s&&Eh(i,typeof r=="function"?r():r)},Ye=(...e)=>{Th&&Ih(...e)}}),tf,u0=ne(()=>{ze(),tf=(e,r)=>new(Yc(r))(e)}),nf=ne(()=>{}),qd,Au,Ru,zh,Ah,Gd,Cc,Rh,l0,R_=ne(()=>{Qn(),nf(),qd=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),Au=[],Ru=e=>Math.ceil(e/16)*16,zh=e=>{for(let r=0;rAh++,Cc=async(e,r,i,s)=>{let o=Ru(i),d=e.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let u=e.getCommandEncoder();e.endComputePass(),u.copyBufferToBuffer(r,0,d,0,o),e.flush(),await d.mapAsync(GPUMapMode.READ);let h=d.getMappedRange();if(s){let m=s();return m.set(new Uint8Array(h,0,i)),m}else return new Uint8Array(h.slice(0,i))}finally{d.destroy()}},Rh=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersForUploadingPending=[],this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[r]of qd)Au.push(r),this.freeBuffers.set(r,[]),this.freeUniformBuffers.set(r,[])}upload(e,r){let i=r.buffer,s=r.byteOffset,o=r.byteLength,d=Ru(o),u=this.storageCache.get(e);if(!u)throw new Error("gpu data for uploading does not exist");if(u.originalSize!==o)throw new Error(`inconsistent data size. gpu data size=${u.originalSize}, data size=${o}`);let h=this.backend.device.createBuffer({mappedAtCreation:!0,size:d,usage:GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC}),m=h.getMappedRange();new Uint8Array(m).set(new Uint8Array(i,s,o)),h.unmap();let g=this.backend.getCommandEncoder();this.backend.endComputePass(),g.copyBufferToBuffer(h,0,u.gpuData.buffer,0,d),Ye("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`),this.buffersForUploadingPending.push(h)}memcpy(e,r){let i=this.storageCache.get(e);if(!i)throw new Error("source gpu data for memcpy does not exist");let s=this.storageCache.get(r);if(!s)throw new Error("destination gpu data for memcpy does not exist");if(i.originalSize!==s.originalSize)throw new Error("inconsistent source and destination gpu data size");let o=Ru(i.originalSize),d=this.backend.getCommandEncoder();this.backend.endComputePass(),d.copyBufferToBuffer(i.gpuData.buffer,0,s.gpuData.buffer,0,o)}registerExternalBuffer(e,r,i){let s;if(i){if(s=i[0],e===i[1])return Ye("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, buffer is the same, skip.`),s;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet. Please use the previous external buffer!`)}else s=Gd();return this.storageCache.set(s,{gpuData:{id:s,type:0,buffer:e},originalSize:r}),Ye("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, registered.`),s}unregisterExternalBuffer(e){e!==void 0&&(this.storageCache.delete(e),Ye("verbose",()=>`[WebGPU] GpuDataManager.unregisterExternalBuffer() => id=${e}`))}create(e,r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST){let i=zh(e),s,o=(r&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE,d=(r&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM;if(o||d){let h=(o?this.freeBuffers:this.freeUniformBuffers).get(i);h?h.length>0?s=h.pop():s=this.backend.device.createBuffer({size:i,usage:r}):s=this.backend.device.createBuffer({size:i,usage:r})}else s=this.backend.device.createBuffer({size:i,usage:r});let u={id:Gd(),type:0,buffer:s};return this.storageCache.set(u.id,{gpuData:u,originalSize:e}),Ye("verbose",()=>`[WebGPU] GpuDataManager.create(size=${e}) => id=${u.id}`),u}get(e){var r;return(r=this.storageCache.get(e))==null?void 0:r.gpuData}release(e){let r=this.storageCache.get(e);if(!r)throw new Error("releasing data does not exist");return Ye("verbose",()=>`[WebGPU] GpuDataManager.release(id=${e}), gpuDataId=${r.gpuData.id}`),this.storageCache.delete(e),this.buffersPending.push(r.gpuData.buffer),r.originalSize}async download(e,r){let i=this.storageCache.get(e);if(!i)throw new Error("data does not exist");await Cc(this.backend,i.gpuData.buffer,i.originalSize,r)}refreshPendingBuffers(){for(let e of this.buffersForUploadingPending)e.destroy();if(this.buffersForUploadingPending=[],this.buffersPending.length!==0)if(this.backend.sessionStatus==="default"){for(let e of this.buffersPending){let r=qd.get(e.size);if((e.usage&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE){let i=this.freeBuffers.get(e.size)||[];r===void 0||i.length>=r?e.destroy():i.push(e)}else if((e.usage&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM){let i=this.freeUniformBuffers.get(e.size)||[];r===void 0||i.length>=r?e.destroy():i.push(e)}else e.destroy()}this.buffersPending=[]}else{let e=this.capturedPendingBuffers.get(this.backend.currentSessionId);e||(e=[],this.capturedPendingBuffers.set(this.backend.currentSessionId,e));for(let r of this.buffersPending)e.push(r);this.buffersPending=[]}}dispose(){this.freeBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.freeUniformBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache.forEach(e=>{e.gpuData.buffer.destroy()}),this.capturedPendingBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.capturedPendingBuffers=new Map}onReleaseSession(e){let r=this.capturedPendingBuffers.get(e);r&&(r.forEach(i=>{i.destroy()}),this.capturedPendingBuffers.delete(e))}},l0=(...e)=>new Rh(...e)}),Oh,Ze,mt=ne(()=>{Oh=class{constructor(e){Object.assign(this,e)}get cacheKey(){return this.key||(this.key=Object.getOwnPropertyNames(this).sort().map(e=>`${this[e]}`).join(";")),this.key}},Ze=e=>new Oh(e)}),Ph,za,K,Gu,d0,c0,f0,Oe=ne(()=>{Ph=class{static calcMatMulShape(e,r){return e[1]!==r[0]?void 0:[e[0],r[1]]}},za=class{static calcShape(e,r,i=!1){let s=e.length,o=r.length;if(s===0)return r;if(o===0)return e;let d=Math.max(e.length,r.length),u=new Array(d);if(i){if(s<2||o<2)return;let h=Ph.calcMatMulShape([e[s-2],e[s-1]],[r[o-2],r[o-1]]);if(h===void 0)return;[u[d-2],u[d-1]]=h}for(let h=i?3:1;h<=d;h++){let m=s-h<0?1:e[s-h],g=o-h<0?1:r[o-h];if(m!==g&&m>1&&g>1)return;let _=Math.max(m,g);if(m&&g)u[d-h]=Math.max(m,g);else{if(_>1)return;u[d-h]=0}}return u}static isValidBroadcast(e,r){let i=e.length,s=r.length;if(i>s)return!1;for(let o=1;o<=i;o++)if(e[i-o]!==1&&e[i-o]!==r[s-o])return!1;return!0}},K=class ju{static size(r){return ju.getSizeFromDimensionRange(r,0,r.length)}static convertShape(r,i=4){let s=r.length;if(s===0)return[];let o=new Array(s),d=s-1;for(;d>=0;){if(r[d]%i===0){o[d]=r[d]/i;break}if(i%r[d]!==0)throw new Error("cannot convert shape");o[d]=1,i/=r[d],d--}for(d--;d>=0;d--)o[d]=r[d];return o}static sizeFromDimension(r,i){if(i<0||i>r.length)throw new Error(`invalid dimension of ${i} for sizeFromDimension as Tensor has ${r.length} dimensions.`);return ju.getSizeFromDimensionRange(r,i,r.length)}static sizeToDimension(r,i){if(i<0||i>r.length)throw new Error(`invalid dimension of ${i} for sizeToDimension as Tensor has ${r.length} dimensions.`);return ju.getSizeFromDimensionRange(r,0,i)}static getSizeFromDimensionRange(r,i,s){let o=1;for(let d=i;d=0;--o)s[o]=s[o+1]*r[o+1];return s}static normalizeAxis(r,i){if(r<-i&&r>=i)throw new Error("unsupported axis for this operation.");return r<0?r+i:r}static normalizeAxes(r,i){return r.map(s=>this.normalizeAxis(s,i??r.length))}static sortBasedOnPerm(r,i){return i?i.map(s=>r[s]):r.slice().reverse()}static padShape(r,i){let s=r.length;return r.map((o,d)=>o+i[d]+i[d+s])}static areEqual(r,i){return r.length!==i.length?!1:r.every((s,o)=>s===i[o])}},Gu=class Gs{static adjustPoolAttributes(r,i,s,o,d,u){if(!r&&s.length!==i.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(r)for(let h=0;h=s.length?s.push(i[h+2]):s[h]=i[h+2];for(let h=0;h=s[h]||u[h+s.length]>=s[h])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(r,i,s,o,d,u,h){if(h){if(d.length!==2*(r.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(i.length!==r.length-2)throw new Error("length of strides should be the length of data dimensions");if(o.length!==r.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let m=0;m{ze(),Oe(),Aa=64,Ou=(e,r)=>{if(r===3)throw new Error("vec3 has same alignment as vec4, use vec4 instead");switch(e){case 10:return r>1?`vec${r}`:"f16";case 1:return r>1?`vec${r}`:"f32";case 6:return r>1?`vec${r}`:"i32";case 12:return r>1?`vec${r}`:"u32";case 7:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","i32"];case 13:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","u32"];case 9:if(r!==4)throw new Error("bool must be vec4");return["u32","vec4"];case 22:return"i32";case 21:return"u32";default:throw new Error(`Unknown data type: ${e}`)}},yt=(e,r=1)=>{let i=Ou(e,r);return typeof i=="string"?i:i[0]},Rt=(e,r=1)=>{let i=Ou(e,r);return typeof i=="string"?i:i[1]},he=(...e)=>{let r=[];return e.forEach(i=>{i.length!==0&&r.push({type:12,data:i},{type:12,data:K.computeStrides(i)})}),r},ft=e=>e%4===0?4:e%2===0?2:1,Tc=(e="f32",r,i="0")=>!r||r===1?`${e}(${i})`:`vec${r}<${e}>(${i})`,Ia=(e,r,i)=>e==="f32"?i:r===1?`f32(${i})`:`vec${r}(${i})`,Vr=(e,r)=>r===4?`(${e}.x + ${e}.y + ${e}.z + ${e}.w)`:r===2?`(${e}.x + ${e}.y)`:r===3?`(${e}.x + ${e}.y + ${e}.z)`:e,ge=(e,r,i,s)=>e.startsWith("uniforms.")&&i>4?typeof r=="string"?s==="f16"?`${e}[(${r}) / 8][(${r}) % 8 / 4][(${r}) % 8 % 4]`:`${e}[(${r}) / 4][(${r}) % 4]`:s==="f16"?`${e}[${Math.floor(r/8)}][${Math.floor(r%8/4)}][${r%8%4}]`:`${e}[${Math.floor(r/4)}][${r%4}]`:i>1?`${e}[${r}]`:e,Pu=(e,r,i,s,o)=>{let d=typeof i=="number",u=d?i:i.length,h=[...new Array(u).keys()],m=u<2?"u32":u<=4?`vec${u}`:`array`,g=Ou(r,o),_=typeof g=="string"?g:g[1],w=typeof g=="string"?g:g[0],f={indices:m,value:_,storage:w,tensor:r},b=A=>typeof A=="string"?A:`${A}u`,S={offsetToIndices:!1,indicesToOffset:!1,broadcastedIndicesToOffset:!1,set:!1,setByIndices:!1,get:!1,getByIndices:!1},x=d?"uniforms.":"",T=`${x}${e}_shape`,z=`${x}${e}_strides`,C="";for(let A=0;A Model Benchmark - - + +