(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15],{2018:function(module,__unused_webpack_exports,__webpack_require__){var process=__webpack_require__(2601);/*! * ONNX Runtime Web v1.14.0 * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */!function(tr,tn){module.exports=tn(__webpack_require__(7731))}(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(tr,tn,ti)=>{var to,ta=(to=(to="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(tr){function e(){return tE.buffer!=tP&&H(tE.buffer),tD}function r(){return tE.buffer!=tP&&H(tE.buffer),t$}function i(){return tE.buffer!=tP&&H(tE.buffer),tk}function o(){return tE.buffer!=tP&&H(tE.buffer),tC}function a(){return tE.buffer!=tP&&H(tE.buffer),tF}tr=tr||{},tn||(tn=void 0!==tr?tr:{}),tn.ready=new Promise(function(tr,tn){ta=tr,ts=tn});var tn,ta,ts,tu,tl,tc,tp,tf,td,th=Object.assign({},tn),tg="./this.program",y=(tr,tn)=>{throw tn},tb="object"==typeof window,tm="function"==typeof importScripts,ty="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,t_=tn.ENVIRONMENT_IS_PTHREAD||!1,tv="";function S(tr){return tn.locateFile?tn.locateFile(tr,tv):tv+tr}if(ty){let tr;tv=tm?ti(908).dirname(tv)+"/":"//",td=()=>{tf||(tp=ti(1384),tf=ti(908))},tu=function(tr,tn){return td(),tr=tf.normalize(tr),tp.readFileSync(tr,tn?void 0:"utf8")},tc=tr=>((tr=tu(tr,!0)).buffer||(tr=new Uint8Array(tr)),tr),tl=(tr,tn,ti)=>{td(),tr=tf.normalize(tr),tp.readFile(tr,function(tr,to){tr?ti(tr):tn(to.buffer)})},1{if(J())throw process.exitCode=tr,tn;tn instanceof ut||tO("exiting due to exception: "+tn),process.exit(tr)},tn.inspect=function(){return"[Emscripten Module object]"};try{tr=ti(9925)}catch(tr){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),tr}ti.g.Worker=tr.Worker}else(tb||tm)&&(tm?tv=self.location.href:"undefined"!=typeof document&&document.currentScript&&(tv=document.currentScript.src),to&&(tv=to),tv=0!==tv.indexOf("blob:")?tv.substr(0,tv.replace(/[?#].*/,"").lastIndexOf("/")+1):"",ty||(tu=tr=>{var tn=new XMLHttpRequest;return tn.open("GET",tr,!1),tn.send(null),tn.responseText},tm&&(tc=tr=>{var tn=new XMLHttpRequest;return tn.open("GET",tr,!1),tn.responseType="arraybuffer",tn.send(null),new Uint8Array(tn.response)}),tl=(tr,tn,ti)=>{var to=new XMLHttpRequest;to.open("GET",tr,!0),to.responseType="arraybuffer",to.onload=()=>{200==to.status||0==to.status&&to.response?tn(to.response):ti()},to.onerror=ti,to.send(null)}));ty&&"undefined"==typeof performance&&(ti.g.performance=ti(6953).performance);var tx=console.log.bind(console),tw=console.warn.bind(console);ty&&(td(),tx=tr=>tp.writeSync(1,tr+"\n"),tw=tr=>tp.writeSync(2,tr+"\n"));var tT,tS=tn.print||tx,tO=tn.printErr||tw;Object.assign(tn,th),th=null,tn.thisProgram&&(tg=tn.thisProgram),tn.quit&&(y=tn.quit),tn.wasmBinary&&(tT=tn.wasmBinary);var tA=tn.noExitRuntime||!1;"object"!=typeof WebAssembly&&it("no native wasm support detected");var tE,tI,tP,tD,t$,tk,tC,tF,tN=!1,tL="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function V(tr,tn,ti){var to=(tn>>>=0)+ti;for(ti=tn;tr[ti]&&!(ti>=to);)++ti;if(16(ta=224==(240&ta)?(15&ta)<<12|ts<<6|tu:(7&ta)<<18|ts<<12|tu<<6|63&tr[tn++])?to+=String.fromCharCode(ta):(ta-=65536,to+=String.fromCharCode(55296|ta>>10,56320|1023&ta))}}else to+=String.fromCharCode(ta)}return to}function B(tr,tn){return(tr>>>=0)?V(r(),tr,tn):""}function z(tr,tn,ti,to){if(!(0>>=0;to=ti+to-1;for(var ts=0;ts=tu&&(tu=65536+((1023&tu)<<10)|1023&tr.charCodeAt(++ts)),127>=tu){if(ti>=to)break;tn[ti++>>>0]=tu}else{if(2047>=tu){if(ti+1>=to)break;tn[ti++>>>0]=192|tu>>6}else{if(65535>=tu){if(ti+2>=to)break;tn[ti++>>>0]=224|tu>>12}else{if(ti+3>=to)break;tn[ti++>>>0]=240|tu>>18,tn[ti++>>>0]=128|tu>>12&63}tn[ti++>>>0]=128|tu>>6&63}tn[ti++>>>0]=128|63&tu}}return tn[ti>>>0]=0,ti-ta}function G(tr){for(var tn=0,ti=0;ti=to?tn++:2047>=to?tn+=2:55296<=to&&57343>=to?(tn+=4,++ti):tn+=3}return tn}function H(tr){tP=tr,tn.HEAP8=tD=new Int8Array(tr),tn.HEAP16=new Int16Array(tr),tn.HEAP32=tk=new Int32Array(tr),tn.HEAPU8=t$=new Uint8Array(tr),tn.HEAPU16=new Uint16Array(tr),tn.HEAPU32=tC=new Uint32Array(tr),tn.HEAPF32=new Float32Array(tr),tn.HEAPF64=tF=new Float64Array(tr)}t_&&(tP=tn.buffer);var tR=tn.INITIAL_MEMORY||16777216;if(t_)tE=tn.wasmMemory,tP=tn.buffer;else if(tn.wasmMemory)tE=tn.wasmMemory;else if(!((tE=new WebAssembly.Memory({initial:tR/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw tO("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),ty&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");tE&&(tP=tE.buffer),tR=tP.byteLength,H(tP);var tj,tM=[],tU=[],tV=[],tB=[];function J(){return tA||!1}function Q(){var tr=tn.preRun.shift();tM.unshift(tr)}var tz,tG=0,tH=null,tW=null;function it(tr){throw t_?postMessage({cmd:"onAbort",arg:tr}):tn.onAbort&&tn.onAbort(tr),tO(tr="Aborted("+tr+")"),tN=!0,tr=new WebAssembly.RuntimeError(tr+". Build with -sASSERTIONS for more info."),ts(tr),tr}function ot(){return tz.startsWith("data:application/octet-stream;base64,")}function at(){var tr=tz;try{if(tr==tz&&tT)return new Uint8Array(tT);if(tc)return tc(tr);throw"both async and sync fetching of the wasm failed"}catch(tr){it(tr)}}tz="ort-wasm-threaded.wasm",ot()||(tz=S(tz));var tq={};function ut(tr){this.name="ExitStatus",this.message="Program terminated with exit("+tr+")",this.status=tr}function ct(tr){(tr=tX.Vb[tr])||it(),tX.mc(tr)}function lt(tr){var tn=tX.Cc();if(!tn)return 6;tX.ac.push(tn),tX.Vb[tr.Ub]=tn,tn.Ub=tr.Ub;var ti={cmd:"run",start_routine:tr.Ic,arg:tr.zc,pthread_ptr:tr.Ub};return tn.$b=()=>{ti.time=performance.now(),tn.postMessage(ti,tr.Nc)},tn.loaded&&(tn.$b(),delete tn.$b),0}function pt(tr){if(t_)return qt(1,1,tr);J()||(tX.oc(),tn.onExit&&tn.onExit(tr),tN=!0),y(tr,new ut(tr))}function ft(tr,tn){if(!tn&&t_)throw bt(tr),"unwind";J()||t_||(ea(),ht(tV),eo(0),t4[1].length&&ie(1,10),t4[2].length&&ie(2,10),tX.oc()),pt(tr)}var tX={Yb:[],ac:[],qc:[],Vb:{},fc:function(){t_&&tX.Ec()},Pc:function(){},Ec:function(){tX.receiveObjectTransfer=tX.Gc,tX.threadInitTLS=tX.pc,tX.setExitStatus=tX.nc,tA=!1},nc:function(){},oc:function(){for(var tr of Object.values(tX.Vb))tX.mc(tr);for(tr of tX.Yb)tr.terminate();tX.Yb=[]},mc:function(tr){var tn=tr.Ub;delete tX.Vb[tn],tX.Yb.push(tr),tX.ac.splice(tX.ac.indexOf(tr),1),tr.Ub=0,ep(tn)},Gc:function(){},pc:function(){tX.qc.forEach(tr=>tr())},Fc:function(tr,ti){tr.onmessage=to=>{var ta=(to=to.data).cmd;if(tr.Ub&&(tX.Bc=tr.Ub),to.targetThread&&to.targetThread!=er()){var ts=tX.Vb[to.Qc];ts?ts.postMessage(to,to.transferList):tO('Internal error! Worker sent a message "'+ta+'" to target pthread '+to.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===ta?Vt(to.queue):"spawnThread"===ta?lt(to):"cleanupThread"===ta?ct(to.thread):"killThread"===ta?(to=to.thread,ta=tX.Vb[to],delete tX.Vb[to],ta.terminate(),ep(to),tX.ac.splice(tX.ac.indexOf(ta),1),ta.Ub=0):"cancelThread"===ta?tX.Vb[to.thread].postMessage({cmd:"cancel"}):"loaded"===ta?(tr.loaded=!0,ti&&ti(tr),tr.$b&&(tr.$b(),delete tr.$b)):"print"===ta?tS("Thread "+to.threadId+": "+to.text):"printErr"===ta?tO("Thread "+to.threadId+": "+to.text):"alert"===ta?alert("Thread "+to.threadId+": "+to.text):"setimmediate"===to.target?tr.postMessage(to):"onAbort"===ta?tn.onAbort&&tn.onAbort(to.arg):ta&&tO("worker sent an unknown command "+ta);tX.Bc=void 0},tr.onerror=tr=>{throw tO("worker sent an error! "+tr.filename+":"+tr.lineno+": "+tr.message),tr},ty&&(tr.on("message",function(tn){tr.onmessage({data:tn})}),tr.on("error",function(tn){tr.onerror(tn)}),tr.on("detachedExit",function(){})),tr.postMessage({cmd:"load",urlOrBlob:tn.mainScriptUrlOrBlob||to,wasmMemory:tE,wasmModule:tI})},yc:function(){var tr=S("ort-wasm-threaded.worker.js");tX.Yb.push(new Worker(tr))},Cc:function(){return 0==tX.Yb.length&&(tX.yc(),tX.Fc(tX.Yb[0])),tX.Yb.pop()}};function ht(tr){for(;0>2>>>0];tr=i()[tr+48>>2>>>0],eh(tn,tn-tr),eb(tn)};var tY=[];function yt(tr){var tn=tY[tr];return tn||(tr>=tY.length&&(tY.length=tr+1),tY[tr]=tn=tj.get(tr)),tn}tn.invokeEntryPoint=function(tr,tn){tr=yt(tr)(tn),J()?tX.nc(tr):ef(tr)};var tK,tZ,tJ=[],tQ=0,t0=0;function St(tr){this.Zb=tr,this.Sb=tr-24,this.xc=function(tr){o()[this.Sb+4>>2>>>0]=tr},this.bc=function(){return o()[this.Sb+4>>2>>>0]},this.wc=function(tr){o()[this.Sb+8>>2>>>0]=tr},this.Dc=function(){return o()[this.Sb+8>>2>>>0]},this.rc=function(){i()[this.Sb>>2>>>0]=0},this.hc=function(tr){tr=tr?1:0,e()[this.Sb+12>>0>>>0]=tr},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(tr){tr=tr?1:0,e()[this.Sb+13>>0>>>0]=tr},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(tr,tn){this.cc(0),this.xc(tr),this.wc(tn),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(i(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(i(),this.Sb>>2,1)},this.cc=function(tr){o()[this.Sb+16>>2>>>0]=tr},this.tc=function(){return o()[this.Sb+16>>2>>>0]},this.vc=function(){if(e_(this.bc()))return o()[this.Zb>>2>>>0];var tr=this.tc();return 0!==tr?tr:this.Zb}}function Ot(tr){return ei(new St(tr).Sb)}function At(tr,tn,ti,to){return t_?qt(3,1,tr,tn,ti,to):Et(tr,tn,ti,to)}function Et(tr,tn,ti,to){if("undefined"==typeof SharedArrayBuffer)return tO("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var ta=[];return t_&&0===ta.length?At(tr,tn,ti,to):(tr={Ic:ti,Ub:tr,zc:to,Nc:ta},t_?(tr.Oc="spawnThread",postMessage(tr,ta),0):lt(tr))}function It(tr,tn,ti){return t_?qt(4,1,tr,tn,ti):0}function Pt(tr,tn){if(t_)return qt(5,1,tr,tn)}function Dt(tr,tn){if(t_)return qt(6,1,tr,tn)}function $t(tr,tn,ti){if(t_)return qt(7,1,tr,tn,ti)}function kt(tr,tn,ti){return t_?qt(8,1,tr,tn,ti):0}function Ct(tr,tn){if(t_)return qt(9,1,tr,tn)}function Ft(tr,tn,ti){if(t_)return qt(10,1,tr,tn,ti)}function Nt(tr,tn,ti,to){if(t_)return qt(11,1,tr,tn,ti,to)}function Lt(tr,tn,ti,to){if(t_)return qt(12,1,tr,tn,ti,to)}function Rt(tr,tn,ti,to){if(t_)return qt(13,1,tr,tn,ti,to)}function jt(tr){if(t_)return qt(14,1,tr)}function Mt(tr,tn){if(t_)return qt(15,1,tr,tn)}function Ut(tr,tn,ti){if(t_)return qt(16,1,tr,tn,ti)}function Vt(tr){Atomics.store(i(),tr>>2,1),er()&&ec(tr),Atomics.compareExchange(i(),tr>>2,1,0)}function Bt(tr){return o()[tr>>>2]+4294967296*i()[tr+4>>>2]}function zt(tr,tn,ti,to,ta,ts){return t_?qt(17,1,tr,tn,ti,to,ta,ts):-52}function Gt(tr,tn,ti,to,ta,ts){if(t_)return qt(18,1,tr,tn,ti,to,ta,ts)}function Ht(tr){var tn=G(tr)+1,ti=en(tn);return ti&&z(tr,e(),ti,tn),ti}function Wt(tr,tn,ti){function r(tr){return(tr=tr.toTimeString().match(/\(([A-Za-z ]+)\)$/))?tr[1]:"GMT"}if(t_)return qt(19,1,tr,tn,ti);var to=(new Date).getFullYear(),ta=new Date(to,0,1),ts=new Date(to,6,1);to=ta.getTimezoneOffset();var tu=ts.getTimezoneOffset(),tl=Math.max(to,tu);i()[tr>>2>>>0]=60*tl,i()[tn>>2>>>0]=Number(to!=tu),tr=r(ta),tn=r(ts),tr=Ht(tr),tn=Ht(tn),tu>2>>>0]=tr,o()[ti+4>>2>>>0]=tn):(o()[ti>>2>>>0]=tn,o()[ti+4>>2>>>0]=tr)}function qt(tr,tn){var ti=arguments.length-2,to=arguments;return gt(()=>{for(var ta=em(8*ti),ts=ta>>3,tu=0;tu>>0]=tl}return el(tr,ti,ta,tn)})}tn.executeNotifiedProxyingQueue=Vt,tZ=ty?()=>{var tr=process.hrtime();return 1e3*tr[0]+tr[1]/1e6}:t_?()=>performance.now()-tn.__performance_now_clock_drift:()=>performance.now();var t1,t2=[],t3={};function Zt(){if(!t1){var tr,tn={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:tg||"./this.program"};for(tr in t3)void 0===t3[tr]?delete tn[tr]:tn[tr]=t3[tr];var ti=[];for(tr in tn)ti.push(tr+"="+tn[tr]);t1=ti}return t1}function Jt(tr,tn){if(t_)return qt(20,1,tr,tn);var ti=0;return Zt().forEach(function(to,ta){var ts=tn+ti;for(ta=o()[tr+4*ta>>2>>>0]=ts,ts=0;ts>0>>>0]=to.charCodeAt(ts);e()[ta>>0>>>0]=0,ti+=to.length+1}),0}function Qt(tr,tn){if(t_)return qt(21,1,tr,tn);var ti=Zt();o()[tr>>2>>>0]=ti.length;var to=0;return ti.forEach(function(tr){to+=tr.length+1}),o()[tn>>2>>>0]=to,0}function te(tr){return t_?qt(22,1,tr):52}function ee(tr,tn,ti,to){return t_?qt(23,1,tr,tn,ti,to):52}function ne(tr,tn,ti,to,ta){return t_?qt(24,1,tr,tn,ti,to,ta):70}var t4=[null,[],[]];function ie(tr,tn){var ti=t4[tr];0===tn||10===tn?((1===tr?tS:tO)(V(ti,0)),ti.length=0):ti.push(tn)}function oe(tr,tn,ti,to){if(t_)return qt(25,1,tr,tn,ti,to);for(var ta=0,ts=0;ts>2>>>0],tl=o()[tn+4>>2>>>0];tn+=8;for(var tc=0;tc>>0]);ta+=tl}return o()[to>>2>>>0]=ta,0}var t6=0;function se(tr){return 0==tr%4&&(0!=tr%100||0==tr%400)}var t8=[31,29,31,30,31,30,31,31,30,31,30,31],t5=[31,28,31,30,31,30,31,31,30,31,30,31];function le(tr,tn,ti,to){function a(tr,tn,ti){for(tr="number"==typeof tr?tr.toString():tr||"";tr.lengthtr?-1:0to-tr.getDate())){tr.setDate(tr.getDate()+tn);break}tn-=to-tr.getDate()+1,tr.setDate(1),11>ti?tr.setMonth(ti+1):(tr.setMonth(0),tr.setFullYear(tr.getFullYear()+1))}return ti=new Date(tr.getFullYear()+1,0,4),tn=c(new Date(tr.getFullYear(),0,4)),ti=c(ti),0>=u(tn,tr)?0>=u(ti,tr)?tr.getFullYear()+1:tr.getFullYear():tr.getFullYear()-1}var ta=i()[to+40>>2>>>0];for(var ts in to={Lc:i()[to>>2>>>0],Kc:i()[to+4>>2>>>0],dc:i()[to+8>>2>>>0],jc:i()[to+12>>2>>>0],ec:i()[to+16>>2>>>0],Xb:i()[to+20>>2>>>0],Tb:i()[to+24>>2>>>0],Wb:i()[to+28>>2>>>0],Rc:i()[to+32>>2>>>0],Jc:i()[to+36>>2>>>0],Mc:ta?B(ta):""},ti=B(ti),ta={"%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"})ti=ti.replace(RegExp(ts,"g"),ta[ts]);var tu="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),tl="January February March April May June July August September October November December".split(" ");for(ts in ta={"%a":function(tr){return tu[tr.Tb].substring(0,3)},"%A":function(tr){return tu[tr.Tb]},"%b":function(tr){return tl[tr.ec].substring(0,3)},"%B":function(tr){return tl[tr.ec]},"%C":function(tr){return s((tr.Xb+1900)/100|0,2)},"%d":function(tr){return s(tr.jc,2)},"%e":function(tr){return a(tr.jc,2," ")},"%g":function(tr){return l(tr).toString().substring(2)},"%G":function(tr){return l(tr)},"%H":function(tr){return s(tr.dc,2)},"%I":function(tr){return 0==(tr=tr.dc)?tr=12:12tr.dc?"AM":"PM"},"%S":function(tr){return s(tr.Lc,2)},"%t":function(){return" "},"%u":function(tr){return tr.Tb||7},"%U":function(tr){return s(Math.floor((tr.Wb+7-tr.Tb)/7),2)},"%V":function(tr){var tn=Math.floor((tr.Wb+7-(tr.Tb+6)%7)/7);if(2>=(tr.Tb+371-tr.Wb-2)%7&&tn++,tn)53==tn&&(4==(ti=(tr.Tb+371-tr.Wb)%7)||3==ti&&se(tr.Xb)||(tn=1));else{tn=52;var ti=(tr.Tb+7-tr.Wb-1)%7;(4==ti||5==ti&&se(tr.Xb%400-1))&&tn++}return s(tn,2)},"%w":function(tr){return tr.Tb},"%W":function(tr){return s(Math.floor((tr.Wb+7-(tr.Tb+6)%7)/7),2)},"%y":function(tr){return(tr.Xb+1900).toString().substring(2)},"%Y":function(tr){return tr.Xb+1900},"%z":function(tr){var tn=0<=(tr=tr.Jc);return(tn?"+":"-")+String("0000"+((tr=Math.abs(tr)/60)/60*100+tr%60)).slice(-4)},"%Z":function(tr){return tr.Mc},"%%":function(){return"%"}},ti=ti.replace(/%%/g,"\x00\x00"),ta)ti.includes(ts)&&(ti=ti.replace(RegExp(ts,"g"),ta[ts](to)));return(ts=function(tr){var tn=Array(G(tr)+1);return z(tr,tn,0,tn.length),tn}(ti=ti.replace(/\0\0/g,"%"))).length>tn?0:(function(tr,tn){e().set(tr,tn>>>0)}(ts,tr),ts.length-1)}tX.fc();var t7=[null,pt,bt,At,It,Pt,Dt,$t,kt,Ct,Ft,Nt,Lt,Rt,jt,Mt,Ut,zt,Gt,Wt,Jt,Qt,te,ee,ne,oe],t9={b:function(tr){return en(tr+24)+24},n:function(tr){return(tr=new St(tr)).uc()||(tr.hc(!0),tQ--),tr.ic(!1),tJ.push(tr),tr.sc(),tr.vc()},ma:function(tr){throw tO("Unexpected exception thrown, this is not properly supported - aborting"),tN=!0,tr},x:function(){ed(0);var tr=tJ.pop();if(tr.Hc()&&!tr.kc()){var tn=tr.Dc();tn&&yt(tn)(tr.Zb),Ot(tr.Zb)}t0=0},e:function(){var tr=t0;if(!tr)return t6=0;var tn=new St(tr);tn.cc(tr);var ti=tn.bc();if(!ti)return t6=0,tr;for(var to=Array.prototype.slice.call(arguments),ta=0;taVt(to));else if(t_)postMessage({targetThread:tr,cmd:"processProxyingQueue",queue:to});else{if(!(tr=tX.Vb[tr]))return;tr.postMessage({cmd:"processProxyingQueue",queue:to})}return 1},Ea:function(){return -1},Pa:function(tr,tn){tr=new Date(1e3*Bt(tr)),i()[tn>>2>>>0]=tr.getUTCSeconds(),i()[tn+4>>2>>>0]=tr.getUTCMinutes(),i()[tn+8>>2>>>0]=tr.getUTCHours(),i()[tn+12>>2>>>0]=tr.getUTCDate(),i()[tn+16>>2>>>0]=tr.getUTCMonth(),i()[tn+20>>2>>>0]=tr.getUTCFullYear()-1900,i()[tn+24>>2>>>0]=tr.getUTCDay(),tr=(tr.getTime()-Date.UTC(tr.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,i()[tn+28>>2>>>0]=tr},Qa:function(tr,tn){tr=new Date(1e3*Bt(tr)),i()[tn>>2>>>0]=tr.getSeconds(),i()[tn+4>>2>>>0]=tr.getMinutes(),i()[tn+8>>2>>>0]=tr.getHours(),i()[tn+12>>2>>>0]=tr.getDate(),i()[tn+16>>2>>>0]=tr.getMonth(),i()[tn+20>>2>>>0]=tr.getFullYear()-1900,i()[tn+24>>2>>>0]=tr.getDay();var ti=new Date(tr.getFullYear(),0,1),to=(tr.getTime()-ti.getTime())/864e5|0;i()[tn+28>>2>>>0]=to,i()[tn+36>>2>>>0]=-60*tr.getTimezoneOffset(),tr=0|((to=new Date(tr.getFullYear(),6,1).getTimezoneOffset())!=(ti=ti.getTimezoneOffset())&&tr.getTimezoneOffset()==Math.min(ti,to)),i()[tn+32>>2>>>0]=tr},Ra:function(tr){var tn=new Date(i()[tr+20>>2>>>0]+1900,i()[tr+16>>2>>>0],i()[tr+12>>2>>>0],i()[tr+8>>2>>>0],i()[tr+4>>2>>>0],i()[tr>>2>>>0],0),ti=i()[tr+32>>2>>>0],to=tn.getTimezoneOffset(),ta=new Date(tn.getFullYear(),0,1),ts=new Date(tn.getFullYear(),6,1).getTimezoneOffset(),tu=ta.getTimezoneOffset(),tl=Math.min(tu,ts);return 0>ti?i()[tr+32>>2>>>0]=Number(ts!=tu&&tl==to):0>2>>>0]=tn.getDay(),ti=(tn.getTime()-ta.getTime())/864e5|0,i()[tr+28>>2>>>0]=ti,i()[tr>>2>>>0]=tn.getSeconds(),i()[tr+4>>2>>>0]=tn.getMinutes(),i()[tr+8>>2>>>0]=tn.getHours(),i()[tr+12>>2>>>0]=tn.getDate(),i()[tr+16>>2>>>0]=tn.getMonth(),tn.getTime()/1e3|0},Aa:zt,Ba:Gt,Sa:function t(tr,tn,ti){t.Ac||(t.Ac=!0,Wt(tr,tn,ti))},y:function(){it("")},U:function(){if(!ty&&!tm){var tr="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";tK||(tK={}),tK[tr]||(tK[tr]=1,ty&&(tr="warning: "+tr),tO(tr))}},ra:function(){return 4294901760},B:tZ,Ia:function(tr,tn,ti){r().copyWithin(tr>>>0,tn>>>0,tn+ti>>>0)},F:function(){return ty?ti(3993).cpus().length:navigator.hardwareConcurrency},Da:function(tr,tn,ti){t2.length=tn,ti>>=3;for(var to=0;to>>0];return(0>tr?tq[-tr-1]:t7[tr]).apply(null,t2)},qa:function(tr){var tn=r().length;if((tr>>>=0)<=tn||4294901760=ti;ti*=2){var to=tn*(1+.2/ti);to=Math.min(to,tr+100663296);var ta=Math;to=Math.max(tr,to),ta=ta.min.call(ta,4294901760,to+(65536-to%65536)%65536);t:{try{tE.grow(ta-tP.byteLength+65535>>>16),H(tE.buffer);var ts=1;break t}catch(tr){}ts=void 0}if(ts)return!0}return!1},Na:function(){throw"unwind"},Ga:Jt,Ha:Qt,J:ft,I:te,S:ee,ga:ne,R:oe,d:function(){return t6},na:function t(tr,tn){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var tr=new Uint8Array(1);return()=>(crypto.getRandomValues(tr),tr[0])}if(ty)try{var tn=ti(Object(function(){var tr=Error("Cannot find module 'crypto'");throw tr.code="MODULE_NOT_FOUND",tr}()));return()=>tn.randomBytes(1)[0]}catch(tr){}return()=>it("randomDevice")}());for(var to=0;to>0>>>0]=t.lc();return 0},ia:function(tr,tn,ti){var to=eg();try{return yt(tr)(tn,ti)}catch(tr){if(eb(to),tr!==tr+0)throw tr;ed(1,0)}},ja:function(tr,tn,ti){var to=eg();try{return yt(tr)(tn,ti)}catch(tr){if(eb(to),tr!==tr+0)throw tr;ed(1,0)}},K:function(tr){var tn=eg();try{return yt(tr)()}catch(tr){if(eb(tn),tr!==tr+0)throw tr;ed(1,0)}},f:function(tr,tn){var ti=eg();try{return yt(tr)(tn)}catch(tr){if(eb(ti),tr!==tr+0)throw tr;ed(1,0)}},P:function(tr,tn,ti){var to=eg();try{return yt(tr)(tn,ti)}catch(tr){if(eb(to),tr!==tr+0)throw tr;ed(1,0)}},Q:function(tr,tn,ti){var to=eg();try{return yt(tr)(tn,ti)}catch(tr){if(eb(to),tr!==tr+0)throw tr;ed(1,0)}},k:function(tr,tn,ti){var to=eg();try{return yt(tr)(tn,ti)}catch(tr){if(eb(to),tr!==tr+0)throw tr;ed(1,0)}},p:function(tr,tn,ti,to){var ta=eg();try{return yt(tr)(tn,ti,to)}catch(tr){if(eb(ta),tr!==tr+0)throw tr;ed(1,0)}},q:function(tr,tn,ti,to,ta){var ts=eg();try{return yt(tr)(tn,ti,to,ta)}catch(tr){if(eb(ts),tr!==tr+0)throw tr;ed(1,0)}},N:function(tr,tn,ti,to,ta,ts){var tu=eg();try{return yt(tr)(tn,ti,to,ta,ts)}catch(tr){if(eb(tu),tr!==tr+0)throw tr;ed(1,0)}},s:function(tr,tn,ti,to,ta,ts){var tu=eg();try{return yt(tr)(tn,ti,to,ta,ts)}catch(tr){if(eb(tu),tr!==tr+0)throw tr;ed(1,0)}},w:function(tr,tn,ti,to,ta,ts,tu){var tl=eg();try{return yt(tr)(tn,ti,to,ta,ts,tu)}catch(tr){if(eb(tl),tr!==tr+0)throw tr;ed(1,0)}},L:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=eg();try{return yt(tr)(tn,ti,to,ta,ts,tu,tl)}catch(tr){if(eb(tc),tr!==tr+0)throw tr;ed(1,0)}},E:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td){var th=eg();try{return yt(tr)(tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td)}catch(tr){if(eb(th),tr!==tr+0)throw tr;ed(1,0)}},aa:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=eg();try{return eI(tr,tn,ti,to,ta,ts,tu,tl)}catch(tr){if(eb(tc),tr!==tr+0)throw tr;ed(1,0)}},_:function(tr,tn,ti,to,ta,ts,tu){var tl=eg();try{return ex(tr,tn,ti,to,ta,ts,tu)}catch(tr){if(eb(tl),tr!==tr+0)throw tr;ed(1,0)}},Z:function(tr,tn,ti,to,ta){var ts=eg();try{return eP(tr,tn,ti,to,ta)}catch(tr){if(eb(ts),tr!==tr+0)throw tr;ed(1,0)}},ca:function(tr,tn,ti,to){var ta=eg();try{return eA(tr,tn,ti,to)}catch(tr){if(eb(ta),tr!==tr+0)throw tr;ed(1,0)}},$:function(tr){var tn=eg();try{return ev(tr)}catch(tr){if(eb(tn),tr!==tr+0)throw tr;ed(1,0)}},ba:function(tr,tn){var ti=eg();try{return eE(tr,tn)}catch(tr){if(eb(ti),tr!==tr+0)throw tr;ed(1,0)}},Y:function(tr,tn,ti){var to=eg();try{return ew(tr,tn,ti)}catch(tr){if(eb(to),tr!==tr+0)throw tr;ed(1,0)}},g:function(tr){var tn=eg();try{yt(tr)()}catch(tr){if(eb(tn),tr!==tr+0)throw tr;ed(1,0)}},r:function(tr,tn){var ti=eg();try{yt(tr)(tn)}catch(tr){if(eb(ti),tr!==tr+0)throw tr;ed(1,0)}},i:function(tr,tn,ti){var to=eg();try{yt(tr)(tn,ti)}catch(tr){if(eb(to),tr!==tr+0)throw tr;ed(1,0)}},ha:function(tr,tn,ti,to){var ta=eg();try{yt(tr)(tn,ti,to)}catch(tr){if(eb(ta),tr!==tr+0)throw tr;ed(1,0)}},m:function(tr,tn,ti,to){var ta=eg();try{yt(tr)(tn,ti,to)}catch(tr){if(eb(ta),tr!==tr+0)throw tr;ed(1,0)}},v:function(tr,tn,ti,to,ta){var ts=eg();try{yt(tr)(tn,ti,to,ta)}catch(tr){if(eb(ts),tr!==tr+0)throw tr;ed(1,0)}},u:function(tr,tn,ti,to,ta,ts){var tu=eg();try{yt(tr)(tn,ti,to,ta,ts)}catch(tr){if(eb(tu),tr!==tr+0)throw tr;ed(1,0)}},O:function(tr,tn,ti,to,ta,ts,tu){var tl=eg();try{yt(tr)(tn,ti,to,ta,ts,tu)}catch(tr){if(eb(tl),tr!==tr+0)throw tr;ed(1,0)}},A:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=eg();try{yt(tr)(tn,ti,to,ta,ts,tu,tl)}catch(tr){if(eb(tc),tr!==tr+0)throw tr;ed(1,0)}},ka:function(tr,tn,ti,to,ta,ts,tu,tl,tc){var tp=eg();try{yt(tr)(tn,ti,to,ta,ts,tu,tl,tc)}catch(tr){if(eb(tp),tr!==tr+0)throw tr;ed(1,0)}},C:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf){var td=eg();try{yt(tr)(tn,ti,to,ta,ts,tu,tl,tc,tp,tf)}catch(tr){if(eb(td),tr!==tr+0)throw tr;ed(1,0)}},D:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td,th,tg,tb,tm){var ty=eg();try{yt(tr)(tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td,th,tg,tb,tm)}catch(tr){if(eb(ty),tr!==tr+0)throw tr;ed(1,0)}},fa:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=eg();try{eT(tr,tn,ti,to,ta,ts,tu,tl)}catch(tr){if(eb(tc),tr!==tr+0)throw tr;ed(1,0)}},da:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td){var th=eg();try{eO(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td)}catch(tr){if(eb(th),tr!==tr+0)throw tr;ed(1,0)}},ea:function(tr,tn,ti,to,ta,ts){var tu=eg();try{eS(tr,tn,ti,to,ta,ts)}catch(tr){if(eb(tu),tr!==tr+0)throw tr;ed(1,0)}},o:function(tr){return tr},a:tE||tn.wasmMemory,G:function(tr){t6=tr},la:le,z:function(tr,tn,ti,to){return le(tr,tn,ti,to)}};(function(){function t(tr,ti){tn.asm=tr.exports,tX.qc.push(tn.asm.sb),tj=tn.asm.ub,tU.unshift(tn.asm.Va),tI=ti,t_||(tG--,tn.monitorRunDependencies&&tn.monitorRunDependencies(tG),0==tG&&(null!==tH&&(clearInterval(tH),tH=null),tW&&(tr=tW,tW=null,tr())))}function e(tr){t(tr.instance,tr.module)}function n(tn){return(function(){if(!tT&&(tb||tm)){if("function"==typeof fetch&&!tz.startsWith("file://"))return fetch(tz,{credentials:"same-origin"}).then(function(tr){if(!tr.ok)throw"failed to load wasm binary file at '"+tz+"'";return tr.arrayBuffer()}).catch(function(){return at()});if(tl)return new Promise(function(tr,tn){tl(tz,function(tn){tr(new Uint8Array(tn))},tn)})}return Promise.resolve().then(function(){return at()})})().then(function(tn){return WebAssembly.instantiate(tn,tr)}).then(function(tr){return tr}).then(tn,function(tr){tO("failed to asynchronously prepare wasm: "+tr),it(tr)})}var tr={a:t9};if(t_||(tG++,tn.monitorRunDependencies&&tn.monitorRunDependencies(tG)),tn.instantiateWasm)try{return tn.instantiateWasm(tr,t)}catch(tr){return tO("Module.instantiateWasm callback failed with error: "+tr),!1}(tT||"function"!=typeof WebAssembly.instantiateStreaming||ot()||tz.startsWith("file://")||ty||"function"!=typeof fetch?n(e):fetch(tz,{credentials:"same-origin"}).then(function(tn){return WebAssembly.instantiateStreaming(tn,tr).then(e,function(tr){return tO("wasm streaming compile failed: "+tr),tO("falling back to ArrayBuffer instantiation"),n(e)})})).catch(ts)})(),tn.___wasm_call_ctors=function(){return(tn.___wasm_call_ctors=tn.asm.Va).apply(null,arguments)},tn._OrtInit=function(){return(tn._OrtInit=tn.asm.Wa).apply(null,arguments)},tn._OrtCreateSessionOptions=function(){return(tn._OrtCreateSessionOptions=tn.asm.Xa).apply(null,arguments)},tn._OrtAppendExecutionProvider=function(){return(tn._OrtAppendExecutionProvider=tn.asm.Ya).apply(null,arguments)},tn._OrtAddSessionConfigEntry=function(){return(tn._OrtAddSessionConfigEntry=tn.asm.Za).apply(null,arguments)},tn._OrtReleaseSessionOptions=function(){return(tn._OrtReleaseSessionOptions=tn.asm._a).apply(null,arguments)},tn._OrtCreateSession=function(){return(tn._OrtCreateSession=tn.asm.$a).apply(null,arguments)},tn._OrtReleaseSession=function(){return(tn._OrtReleaseSession=tn.asm.ab).apply(null,arguments)},tn._OrtGetInputCount=function(){return(tn._OrtGetInputCount=tn.asm.bb).apply(null,arguments)},tn._OrtGetOutputCount=function(){return(tn._OrtGetOutputCount=tn.asm.cb).apply(null,arguments)},tn._OrtGetInputName=function(){return(tn._OrtGetInputName=tn.asm.db).apply(null,arguments)},tn._OrtGetOutputName=function(){return(tn._OrtGetOutputName=tn.asm.eb).apply(null,arguments)},tn._OrtFree=function(){return(tn._OrtFree=tn.asm.fb).apply(null,arguments)},tn._OrtCreateTensor=function(){return(tn._OrtCreateTensor=tn.asm.gb).apply(null,arguments)},tn._OrtGetTensorData=function(){return(tn._OrtGetTensorData=tn.asm.hb).apply(null,arguments)},tn._OrtReleaseTensor=function(){return(tn._OrtReleaseTensor=tn.asm.ib).apply(null,arguments)},tn._OrtCreateRunOptions=function(){return(tn._OrtCreateRunOptions=tn.asm.jb).apply(null,arguments)},tn._OrtAddRunConfigEntry=function(){return(tn._OrtAddRunConfigEntry=tn.asm.kb).apply(null,arguments)},tn._OrtReleaseRunOptions=function(){return(tn._OrtReleaseRunOptions=tn.asm.lb).apply(null,arguments)},tn._OrtRun=function(){return(tn._OrtRun=tn.asm.mb).apply(null,arguments)},tn._OrtEndProfiling=function(){return(tn._OrtEndProfiling=tn.asm.nb).apply(null,arguments)};var er=tn._pthread_self=function(){return(er=tn._pthread_self=tn.asm.ob).apply(null,arguments)},en=tn._malloc=function(){return(en=tn._malloc=tn.asm.pb).apply(null,arguments)},ei=tn._free=function(){return(ei=tn._free=tn.asm.qb).apply(null,arguments)},eo=tn._fflush=function(){return(eo=tn._fflush=tn.asm.rb).apply(null,arguments)};tn.__emscripten_tls_init=function(){return(tn.__emscripten_tls_init=tn.asm.sb).apply(null,arguments)};var ea=tn.___funcs_on_exit=function(){return(ea=tn.___funcs_on_exit=tn.asm.tb).apply(null,arguments)},es=tn.__emscripten_thread_init=function(){return(es=tn.__emscripten_thread_init=tn.asm.vb).apply(null,arguments)};tn.__emscripten_thread_crashed=function(){return(tn.__emscripten_thread_crashed=tn.asm.wb).apply(null,arguments)};var eu,el=tn._emscripten_run_in_main_runtime_thread_js=function(){return(el=tn._emscripten_run_in_main_runtime_thread_js=tn.asm.xb).apply(null,arguments)},ec=tn.__emscripten_proxy_execute_task_queue=function(){return(ec=tn.__emscripten_proxy_execute_task_queue=tn.asm.yb).apply(null,arguments)},ep=tn.__emscripten_thread_free_data=function(){return(ep=tn.__emscripten_thread_free_data=tn.asm.zb).apply(null,arguments)},ef=tn.__emscripten_thread_exit=function(){return(ef=tn.__emscripten_thread_exit=tn.asm.Ab).apply(null,arguments)},ed=tn._setThrew=function(){return(ed=tn._setThrew=tn.asm.Bb).apply(null,arguments)},eh=tn._emscripten_stack_set_limits=function(){return(eh=tn._emscripten_stack_set_limits=tn.asm.Cb).apply(null,arguments)},eg=tn.stackSave=function(){return(eg=tn.stackSave=tn.asm.Db).apply(null,arguments)},eb=tn.stackRestore=function(){return(eb=tn.stackRestore=tn.asm.Eb).apply(null,arguments)},em=tn.stackAlloc=function(){return(em=tn.stackAlloc=tn.asm.Fb).apply(null,arguments)},ey=tn.___cxa_can_catch=function(){return(ey=tn.___cxa_can_catch=tn.asm.Gb).apply(null,arguments)},e_=tn.___cxa_is_pointer_type=function(){return(e_=tn.___cxa_is_pointer_type=tn.asm.Hb).apply(null,arguments)},ev=tn.dynCall_j=function(){return(ev=tn.dynCall_j=tn.asm.Ib).apply(null,arguments)},ex=tn.dynCall_iiiiij=function(){return(ex=tn.dynCall_iiiiij=tn.asm.Jb).apply(null,arguments)},ew=tn.dynCall_jii=function(){return(ew=tn.dynCall_jii=tn.asm.Kb).apply(null,arguments)},eT=tn.dynCall_viiiiij=function(){return(eT=tn.dynCall_viiiiij=tn.asm.Lb).apply(null,arguments)},eS=tn.dynCall_vjji=function(){return(eS=tn.dynCall_vjji=tn.asm.Mb).apply(null,arguments)},eO=tn.dynCall_viiijjjii=function(){return(eO=tn.dynCall_viiijjjii=tn.asm.Nb).apply(null,arguments)},eA=tn.dynCall_iij=function(){return(eA=tn.dynCall_iij=tn.asm.Ob).apply(null,arguments)},eE=tn.dynCall_ji=function(){return(eE=tn.dynCall_ji=tn.asm.Pb).apply(null,arguments)},eI=tn.dynCall_iiiiiij=function(){return(eI=tn.dynCall_iiiiiij=tn.asm.Qb).apply(null,arguments)},eP=tn.dynCall_iiij=function(){return(eP=tn.dynCall_iiij=tn.asm.Rb).apply(null,arguments)};function Ve(){function t(){if(!eu&&(eu=!0,tn.calledRun=!0,!tN)&&(t_||ht(tU),ta(tn),tn.onRuntimeInitialized&&tn.onRuntimeInitialized(),!t_)){if(tn.postRun)for("function"==typeof tn.postRun&&(tn.postRun=[tn.postRun]);tn.postRun.length;){var tr=tn.postRun.shift();tB.unshift(tr)}ht(tB)}}if(!(0{var to,ta=(to=(to="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(tr){tr=tr||{},tn||(tn=void 0!==tr?tr:{}),tn.ready=new Promise(function(tr,tn){ta=tr,ts=tn});var tn,ta,ts,tu,tl,tc,tp,tf,td,th=Object.assign({},tn),tg="./this.program",d=(tr,tn)=>{throw tn},tb="object"==typeof window,tm="function"==typeof importScripts,ty="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,t_="";ty?(t_=tm?ti(908).dirname(t_)+"/":"//",td=()=>{tf||(tp=ti(1384),tf=ti(908))},tu=function(tr,tn){return td(),tr=tf.normalize(tr),tp.readFileSync(tr,tn?void 0:"utf8")},tc=tr=>((tr=tu(tr,!0)).buffer||(tr=new Uint8Array(tr)),tr),tl=(tr,tn,ti)=>{td(),tr=tf.normalize(tr),tp.readFile(tr,function(tr,to){tr?ti(tr):tn(to.buffer)})},1{if(tT||0{var tn=new XMLHttpRequest;return tn.open("GET",tr,!1),tn.send(null),tn.responseText},tm&&(tc=tr=>{var tn=new XMLHttpRequest;return tn.open("GET",tr,!1),tn.responseType="arraybuffer",tn.send(null),new Uint8Array(tn.response)}),tl=(tr,tn,ti)=>{var to=new XMLHttpRequest;to.open("GET",tr,!0),to.responseType="arraybuffer",to.onload=()=>{200==to.status||0==to.status&&to.response?tn(to.response):ti()},to.onerror=ti,to.send(null)});var tv,tx=tn.print||console.log.bind(console),tw=tn.printErr||console.warn.bind(console);Object.assign(tn,th),th=null,tn.thisProgram&&(tg=tn.thisProgram),tn.quit&&(d=tn.quit),tn.wasmBinary&&(tv=tn.wasmBinary);var tT=tn.noExitRuntime||!1;"object"!=typeof WebAssembly&&W("no native wasm support detected");var tS,tO,tA,tE,tI,tP,tD=!1,t$="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function D(tr,tn,ti){var to=(tn>>>=0)+ti;for(ti=tn;tr[ti]&&!(ti>=to);)++ti;if(16(ta=224==(240&ta)?(15&ta)<<12|ts<<6|tu:(7&ta)<<18|ts<<12|tu<<6|63&tr[tn++])?to+=String.fromCharCode(ta):(ta-=65536,to+=String.fromCharCode(55296|ta>>10,56320|1023&ta))}}else to+=String.fromCharCode(ta)}return to}function $(tr,tn){return(tr>>>=0)?D(tE,tr,tn):""}function k(tr,tn,ti,to){if(!(0>>=0;to=ti+to-1;for(var ts=0;ts=tu&&(tu=65536+((1023&tu)<<10)|1023&tr.charCodeAt(++ts)),127>=tu){if(ti>=to)break;tn[ti++>>>0]=tu}else{if(2047>=tu){if(ti+1>=to)break;tn[ti++>>>0]=192|tu>>6}else{if(65535>=tu){if(ti+2>=to)break;tn[ti++>>>0]=224|tu>>12}else{if(ti+3>=to)break;tn[ti++>>>0]=240|tu>>18,tn[ti++>>>0]=128|tu>>12&63}tn[ti++>>>0]=128|tu>>6&63}tn[ti++>>>0]=128|63&tu}}return tn[ti>>>0]=0,ti-ta}function C(tr){for(var tn=0,ti=0;ti=to?tn++:2047>=to?tn+=2:55296<=to&&57343>=to?(tn+=4,++ti):tn+=3}return tn}function F(){var tr=tS.buffer;tO=tr,tn.HEAP8=tA=new Int8Array(tr),tn.HEAP16=new Int16Array(tr),tn.HEAP32=tI=new Int32Array(tr),tn.HEAPU8=tE=new Uint8Array(tr),tn.HEAPU16=new Uint16Array(tr),tn.HEAPU32=tP=new Uint32Array(tr),tn.HEAPF32=new Float32Array(tr),tn.HEAPF64=new Float64Array(tr)}var tk,tC=[],tF=[],tN=[],tL=[],tR=0;function V(){var tr=tn.preRun.shift();tC.unshift(tr)}var tj,tM=0,tU=null,tV=null;function W(tr){throw tn.onAbort&&tn.onAbort(tr),tw(tr="Aborted("+tr+")"),tD=!0,tr=new WebAssembly.RuntimeError(tr+". Build with -sASSERTIONS for more info."),ts(tr),tr}function q(){return tj.startsWith("data:application/octet-stream;base64,")}if(tj="ort-wasm.wasm",!q()){var tB=tj;tj=tn.locateFile?tn.locateFile(tB,t_):t_+tB}function Y(){var tr=tj;try{if(tr==tj&&tv)return new Uint8Array(tv);if(tc)return tc(tr);throw"both async and sync fetching of the wasm failed"}catch(tr){W(tr)}}function K(tr){this.name="ExitStatus",this.message="Program terminated with exit("+tr+")",this.status=tr}function Z(tr){for(;0>2>>>0]=tr},this.Eb=function(){return tP[this.zb+4>>2>>>0]},this.Sb=function(tr){tP[this.zb+8>>2>>>0]=tr},this.Wb=function(){return tP[this.zb+8>>2>>>0]},this.Tb=function(){tI[this.zb>>2>>>0]=0},this.Ib=function(tr){tA[this.zb+12>>0>>>0]=tr?1:0},this.Pb=function(){return 0!=tA[this.zb+12>>0>>>0]},this.Jb=function(tr){tA[this.zb+13>>0>>>0]=tr?1:0},this.Lb=function(){return 0!=tA[this.zb+13>>0>>>0]},this.Rb=function(tr,tn){this.Fb(0),this.Ub(tr),this.Sb(tn),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){tI[this.zb>>2>>>0]+=1},this.Xb=function(){var tr=tI[this.zb>>2>>>0];return tI[this.zb>>2>>>0]=tr-1,1===tr},this.Fb=function(tr){tP[this.zb+16>>2>>>0]=tr},this.Ob=function(){return tP[this.zb+16>>2>>>0]},this.Qb=function(){if(er(this.Eb()))return tP[this.Db>>2>>>0];var tr=this.Ob();return 0!==tr?tr:this.Db}}function nt(tr){return t2(new et(tr).zb)}var tW=[];function it(tr){var tn=tW[tr];return tn||(tr>=tW.length&&(tW.length=tr+1),tW[tr]=tn=tk.get(tr)),tn}function ot(tr){var tn=C(tr)+1,ti=t1(tn);return ti&&k(tr,tA,ti,tn),ti}var tq={};function st(){if(!tX){var tr,tn={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:tg||"./this.program"};for(tr in tq)void 0===tq[tr]?delete tn[tr]:tn[tr]=tq[tr];var ti=[];for(tr in tn)ti.push(tr+"="+tn[tr]);tX=ti}return tX}var tX,tY=[null,[],[]];function lt(tr,tn){var ti=tY[tr];0===tn||10===tn?((1===tr?tx:tw)(D(ti,0)),ti.length=0):ti.push(tn)}var tK=0;function ft(tr){return 0==tr%4&&(0!=tr%100||0==tr%400)}var tZ=[31,29,31,30,31,30,31,31,30,31,30,31],tJ=[31,28,31,30,31,30,31,31,30,31,30,31];function gt(tr,tn,ti,to){function i(tr,tn,ti){for(tr="number"==typeof tr?tr.toString():tr||"";tr.lengthtr?-1:0to-tr.getDate())){tr.setDate(tr.getDate()+tn);break}tn-=to-tr.getDate()+1,tr.setDate(1),11>ti?tr.setMonth(ti+1):(tr.setMonth(0),tr.setFullYear(tr.getFullYear()+1))}return ti=new Date(tr.getFullYear()+1,0,4),tn=s(new Date(tr.getFullYear(),0,4)),ti=s(ti),0>=a(tn,tr)?0>=a(ti,tr)?tr.getFullYear()+1:tr.getFullYear():tr.getFullYear()-1}var ta=tI[to+40>>2>>>0];for(var ts in to={$b:tI[to>>2>>>0],Zb:tI[to+4>>2>>>0],Gb:tI[to+8>>2>>>0],Kb:tI[to+12>>2>>>0],Hb:tI[to+16>>2>>>0],Cb:tI[to+20>>2>>>0],Ab:tI[to+24>>2>>>0],Bb:tI[to+28>>2>>>0],bc:tI[to+32>>2>>>0],Yb:tI[to+36>>2>>>0],ac:ta?$(ta):""},ti=$(ti),ta={"%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"})ti=ti.replace(RegExp(ts,"g"),ta[ts]);var tu="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),tl="January February March April May June July August September October November December".split(" ");for(ts in ta={"%a":function(tr){return tu[tr.Ab].substring(0,3)},"%A":function(tr){return tu[tr.Ab]},"%b":function(tr){return tl[tr.Hb].substring(0,3)},"%B":function(tr){return tl[tr.Hb]},"%C":function(tr){return o((tr.Cb+1900)/100|0,2)},"%d":function(tr){return o(tr.Kb,2)},"%e":function(tr){return i(tr.Kb,2," ")},"%g":function(tr){return u(tr).toString().substring(2)},"%G":function(tr){return u(tr)},"%H":function(tr){return o(tr.Gb,2)},"%I":function(tr){return 0==(tr=tr.Gb)?tr=12:12tr.Gb?"AM":"PM"},"%S":function(tr){return o(tr.$b,2)},"%t":function(){return" "},"%u":function(tr){return tr.Ab||7},"%U":function(tr){return o(Math.floor((tr.Bb+7-tr.Ab)/7),2)},"%V":function(tr){var tn=Math.floor((tr.Bb+7-(tr.Ab+6)%7)/7);if(2>=(tr.Ab+371-tr.Bb-2)%7&&tn++,tn)53==tn&&(4==(ti=(tr.Ab+371-tr.Bb)%7)||3==ti&&ft(tr.Cb)||(tn=1));else{tn=52;var ti=(tr.Ab+7-tr.Bb-1)%7;(4==ti||5==ti&&ft(tr.Cb%400-1))&&tn++}return o(tn,2)},"%w":function(tr){return tr.Ab},"%W":function(tr){return o(Math.floor((tr.Bb+7-(tr.Ab+6)%7)/7),2)},"%y":function(tr){return(tr.Cb+1900).toString().substring(2)},"%Y":function(tr){return tr.Cb+1900},"%z":function(tr){var tn=0<=(tr=tr.Yb);return(tn?"+":"-")+String("0000"+((tr=Math.abs(tr)/60)/60*100+tr%60)).slice(-4)},"%Z":function(tr){return tr.ac},"%%":function(){return"%"}},ti=ti.replace(/%%/g,"\x00\x00"),ta)ti.includes(ts)&&(ti=ti.replace(RegExp(ts,"g"),ta[ts](to)));return(ts=function(tr){var tn=Array(C(tr)+1);return k(tr,tn,0,tn.length),tn}(ti=ti.replace(/\0\0/g,"%"))).length>tn?0:(tA.set(ts,tr>>>0),ts.length-1)}var tQ={a:function(tr){return t1(tr+24)+24},m:function(tr){return(tr=new et(tr)).Pb()||(tr.Ib(!0),tG--),tr.Jb(!1),tz.push(tr),tr.Nb(),tr.Qb()},ia:function(tr){throw tw("Unexpected exception thrown, this is not properly supported - aborting"),tD=!0,tr},w:function(){t6(0);var tr=tz.pop();if(tr.Xb()&&!tr.Lb()){var tn=tr.Wb();tn&&it(tn)(tr.Db),nt(tr.Db)}tH=0},d:function(){var tr=tH;if(!tr)return tK=0;var tn=new et(tr);tn.Fb(tr);var ti=tn.Eb();if(!ti)return tK=0,tr;for(var to=Array.prototype.slice.call(arguments),ta=0;ta>>2]+4294967296*tI[tr+4>>>2])),tI[tn>>2>>>0]=tr.getUTCSeconds(),tI[tn+4>>2>>>0]=tr.getUTCMinutes(),tI[tn+8>>2>>>0]=tr.getUTCHours(),tI[tn+12>>2>>>0]=tr.getUTCDate(),tI[tn+16>>2>>>0]=tr.getUTCMonth(),tI[tn+20>>2>>>0]=tr.getUTCFullYear()-1900,tI[tn+24>>2>>>0]=tr.getUTCDay(),tI[tn+28>>2>>>0]=(tr.getTime()-Date.UTC(tr.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(tr,tn){tr=new Date(1e3*(tP[tr>>>2]+4294967296*tI[tr+4>>>2])),tI[tn>>2>>>0]=tr.getSeconds(),tI[tn+4>>2>>>0]=tr.getMinutes(),tI[tn+8>>2>>>0]=tr.getHours(),tI[tn+12>>2>>>0]=tr.getDate(),tI[tn+16>>2>>>0]=tr.getMonth(),tI[tn+20>>2>>>0]=tr.getFullYear()-1900,tI[tn+24>>2>>>0]=tr.getDay();var ti=new Date(tr.getFullYear(),0,1);tI[tn+28>>2>>>0]=(tr.getTime()-ti.getTime())/864e5|0,tI[tn+36>>2>>>0]=-60*tr.getTimezoneOffset();var to=new Date(tr.getFullYear(),6,1).getTimezoneOffset();ti=ti.getTimezoneOffset(),tI[tn+32>>2>>>0]=0|(to!=ti&&tr.getTimezoneOffset()==Math.min(ti,to))},Fa:function(tr){var tn=new Date(tI[tr+20>>2>>>0]+1900,tI[tr+16>>2>>>0],tI[tr+12>>2>>>0],tI[tr+8>>2>>>0],tI[tr+4>>2>>>0],tI[tr>>2>>>0],0),ti=tI[tr+32>>2>>>0],to=tn.getTimezoneOffset(),ta=new Date(tn.getFullYear(),0,1),ts=new Date(tn.getFullYear(),6,1).getTimezoneOffset(),tu=ta.getTimezoneOffset(),tl=Math.min(tu,ts);return 0>ti?tI[tr+32>>2>>>0]=Number(ts!=tu&&tl==to):0>2>>>0]=tn.getDay(),tI[tr+28>>2>>>0]=(tn.getTime()-ta.getTime())/864e5|0,tI[tr>>2>>>0]=tn.getSeconds(),tI[tr+4>>2>>>0]=tn.getMinutes(),tI[tr+8>>2>>>0]=tn.getHours(),tI[tr+12>>2>>>0]=tn.getDate(),tI[tr+16>>2>>>0]=tn.getMonth(),tn.getTime()/1e3|0},sa:function(){return -52},ta:function(){},Ga:function t(tr,tn,ti){t.Vb||(t.Vb=!0,function(tr,tn,ti){function r(tr){return(tr=tr.toTimeString().match(/\(([A-Za-z ]+)\)$/))?tr[1]:"GMT"}var to=(new Date).getFullYear(),ta=new Date(to,0,1),ts=new Date(to,6,1);to=ta.getTimezoneOffset();var tu=ts.getTimezoneOffset();tI[tr>>2>>>0]=60*Math.max(to,tu),tI[tn>>2>>>0]=Number(to!=tu),tr=r(ta),tn=r(ts),tr=ot(tr),tn=ot(tn),tu>2>>>0]=tr,tP[ti+4>>2>>>0]=tn):(tP[ti>>2>>>0]=tn,tP[ti+4>>2>>>0]=tr)}(tr,tn,ti))},B:function(){W("")},ma:function(){return 4294901760},I:ty?()=>{var tr=process.hrtime();return 1e3*tr[0]+tr[1]/1e6}:()=>performance.now(),xa:function(tr,tn,ti){tE.copyWithin(tr>>>0,tn>>>0,tn+ti>>>0)},G:function(tr){var tn=tE.length;if(4294901760<(tr>>>=0))return!1;for(var ti=1;4>=ti;ti*=2){var to=tn*(1+.2/ti);to=Math.min(to,tr+100663296);var ta=Math;to=Math.max(tr,to),ta=ta.min.call(ta,4294901760,to+(65536-to%65536)%65536);t:{try{tS.grow(ta-tO.byteLength+65535>>>16),F();var ts=1;break t}catch(tr){}ts=void 0}if(ts)return!0}return!1},va:function(tr,tn){var ti=0;return st().forEach(function(to,ta){var ts=tn+ti;for(ta=tP[tr+4*ta>>2>>>0]=ts,ts=0;ts>0>>>0]=to.charCodeAt(ts);tA[ta>>0>>>0]=0,ti+=to.length+1}),0},wa:function(tr,tn){var ti=st();tP[tr>>2>>>0]=ti.length;var to=0;return ti.forEach(function(tr){to+=tr.length+1}),tP[tn>>2>>>0]=to,0},ba:function(tr){tT||0>2>>>0],tl=tP[tn+4>>2>>>0];tn+=8;for(var tc=0;tc>>0]);ta+=tl}return tP[to>>2>>>0]=ta,0},c:function(){return tK},ja:function t(tr,tn){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var tr=new Uint8Array(1);return()=>(crypto.getRandomValues(tr),tr[0])}if(ty)try{var tn=ti(Object(function(){var tr=Error("Cannot find module 'crypto'");throw tr.code="MODULE_NOT_FOUND",tr}()));return()=>tn.randomBytes(1)[0]}catch(tr){}return()=>W("randomDevice")}());for(var to=0;to>0>>>0]=t.Mb();return 0},ea:function(tr,tn,ti){var to=t8();try{return it(tr)(tn,ti)}catch(tr){if(t5(to),tr!==tr+0)throw tr;t6(1,0)}},fa:function(tr,tn,ti){var to=t8();try{return it(tr)(tn,ti)}catch(tr){if(t5(to),tr!==tr+0)throw tr;t6(1,0)}},J:function(tr){var tn=t8();try{return it(tr)()}catch(tr){if(t5(tn),tr!==tr+0)throw tr;t6(1,0)}},e:function(tr,tn){var ti=t8();try{return it(tr)(tn)}catch(tr){if(t5(ti),tr!==tr+0)throw tr;t6(1,0)}},N:function(tr,tn,ti){var to=t8();try{return it(tr)(tn,ti)}catch(tr){if(t5(to),tr!==tr+0)throw tr;t6(1,0)}},O:function(tr,tn,ti){var to=t8();try{return it(tr)(tn,ti)}catch(tr){if(t5(to),tr!==tr+0)throw tr;t6(1,0)}},j:function(tr,tn,ti){var to=t8();try{return it(tr)(tn,ti)}catch(tr){if(t5(to),tr!==tr+0)throw tr;t6(1,0)}},o:function(tr,tn,ti,to){var ta=t8();try{return it(tr)(tn,ti,to)}catch(tr){if(t5(ta),tr!==tr+0)throw tr;t6(1,0)}},p:function(tr,tn,ti,to,ta){var ts=t8();try{return it(tr)(tn,ti,to,ta)}catch(tr){if(t5(ts),tr!==tr+0)throw tr;t6(1,0)}},M:function(tr,tn,ti,to,ta,ts){var tu=t8();try{return it(tr)(tn,ti,to,ta,ts)}catch(tr){if(t5(tu),tr!==tr+0)throw tr;t6(1,0)}},r:function(tr,tn,ti,to,ta,ts){var tu=t8();try{return it(tr)(tn,ti,to,ta,ts)}catch(tr){if(t5(tu),tr!==tr+0)throw tr;t6(1,0)}},v:function(tr,tn,ti,to,ta,ts,tu){var tl=t8();try{return it(tr)(tn,ti,to,ta,ts,tu)}catch(tr){if(t5(tl),tr!==tr+0)throw tr;t6(1,0)}},K:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=t8();try{return it(tr)(tn,ti,to,ta,ts,tu,tl)}catch(tr){if(t5(tc),tr!==tr+0)throw tr;t6(1,0)}},D:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td){var th=t8();try{return it(tr)(tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td)}catch(tr){if(t5(th),tr!==tr+0)throw tr;t6(1,0)}},X:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=t8();try{return ep(tr,tn,ti,to,ta,ts,tu,tl)}catch(tr){if(t5(tc),tr!==tr+0)throw tr;t6(1,0)}},V:function(tr,tn,ti,to,ta,ts,tu){var tl=t8();try{return ei(tr,tn,ti,to,ta,ts,tu)}catch(tr){if(t5(tl),tr!==tr+0)throw tr;t6(1,0)}},U:function(tr,tn,ti,to,ta){var ts=t8();try{return ef(tr,tn,ti,to,ta)}catch(tr){if(t5(ts),tr!==tr+0)throw tr;t6(1,0)}},Z:function(tr,tn,ti,to){var ta=t8();try{return el(tr,tn,ti,to)}catch(tr){if(t5(ta),tr!==tr+0)throw tr;t6(1,0)}},W:function(tr){var tn=t8();try{return en(tr)}catch(tr){if(t5(tn),tr!==tr+0)throw tr;t6(1,0)}},Y:function(tr,tn){var ti=t8();try{return ec(tr,tn)}catch(tr){if(t5(ti),tr!==tr+0)throw tr;t6(1,0)}},T:function(tr,tn,ti){var to=t8();try{return eo(tr,tn,ti)}catch(tr){if(t5(to),tr!==tr+0)throw tr;t6(1,0)}},f:function(tr){var tn=t8();try{it(tr)()}catch(tr){if(t5(tn),tr!==tr+0)throw tr;t6(1,0)}},q:function(tr,tn){var ti=t8();try{it(tr)(tn)}catch(tr){if(t5(ti),tr!==tr+0)throw tr;t6(1,0)}},h:function(tr,tn,ti){var to=t8();try{it(tr)(tn,ti)}catch(tr){if(t5(to),tr!==tr+0)throw tr;t6(1,0)}},da:function(tr,tn,ti,to){var ta=t8();try{it(tr)(tn,ti,to)}catch(tr){if(t5(ta),tr!==tr+0)throw tr;t6(1,0)}},l:function(tr,tn,ti,to){var ta=t8();try{it(tr)(tn,ti,to)}catch(tr){if(t5(ta),tr!==tr+0)throw tr;t6(1,0)}},t:function(tr,tn,ti,to,ta){var ts=t8();try{it(tr)(tn,ti,to,ta)}catch(tr){if(t5(ts),tr!==tr+0)throw tr;t6(1,0)}},u:function(tr,tn,ti,to,ta,ts){var tu=t8();try{it(tr)(tn,ti,to,ta,ts)}catch(tr){if(t5(tu),tr!==tr+0)throw tr;t6(1,0)}},x:function(tr,tn,ti,to,ta,ts,tu){var tl=t8();try{it(tr)(tn,ti,to,ta,ts,tu)}catch(tr){if(t5(tl),tr!==tr+0)throw tr;t6(1,0)}},z:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=t8();try{it(tr)(tn,ti,to,ta,ts,tu,tl)}catch(tr){if(t5(tc),tr!==tr+0)throw tr;t6(1,0)}},ga:function(tr,tn,ti,to,ta,ts,tu,tl,tc){var tp=t8();try{it(tr)(tn,ti,to,ta,ts,tu,tl,tc)}catch(tr){if(t5(tp),tr!==tr+0)throw tr;t6(1,0)}},A:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf){var td=t8();try{it(tr)(tn,ti,to,ta,ts,tu,tl,tc,tp,tf)}catch(tr){if(t5(td),tr!==tr+0)throw tr;t6(1,0)}},C:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td,th,tg,tb,tm){var ty=t8();try{it(tr)(tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td,th,tg,tb,tm)}catch(tr){if(t5(ty),tr!==tr+0)throw tr;t6(1,0)}},aa:function(tr,tn,ti,to,ta,ts,tu,tl){var tc=t8();try{ea(tr,tn,ti,to,ta,ts,tu,tl)}catch(tr){if(t5(tc),tr!==tr+0)throw tr;t6(1,0)}},_:function(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td){var th=t8();try{eu(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td)}catch(tr){if(t5(th),tr!==tr+0)throw tr;t6(1,0)}},$:function(tr,tn,ti,to,ta,ts){var tu=t8();try{es(tr,tn,ti,to,ta,ts)}catch(tr){if(t5(tu),tr!==tr+0)throw tr;t6(1,0)}},n:function(tr){return tr},F:function(tr){tK=tr},ha:gt,y:function(tr,tn,ti,to){return gt(tr,tn,ti,to)}};(function(){function t(tr){tn.asm=tr.exports,tS=tn.asm.Ka,F(),tk=tn.asm.ib,tF.unshift(tn.asm.La),tM--,tn.monitorRunDependencies&&tn.monitorRunDependencies(tM),0==tM&&(null!==tU&&(clearInterval(tU),tU=null),tV&&(tr=tV,tV=null,tr()))}function n(tr){t(tr.instance)}function r(tn){return(function(){if(!tv&&(tb||tm)){if("function"==typeof fetch&&!tj.startsWith("file://"))return fetch(tj,{credentials:"same-origin"}).then(function(tr){if(!tr.ok)throw"failed to load wasm binary file at '"+tj+"'";return tr.arrayBuffer()}).catch(function(){return Y()});if(tl)return new Promise(function(tr,tn){tl(tj,function(tn){tr(new Uint8Array(tn))},tn)})}return Promise.resolve().then(function(){return Y()})})().then(function(tn){return WebAssembly.instantiate(tn,tr)}).then(function(tr){return tr}).then(tn,function(tr){tw("failed to asynchronously prepare wasm: "+tr),W(tr)})}var tr={a:tQ};if(tM++,tn.monitorRunDependencies&&tn.monitorRunDependencies(tM),tn.instantiateWasm)try{return tn.instantiateWasm(tr,t)}catch(tr){return tw("Module.instantiateWasm callback failed with error: "+tr),!1}(tv||"function"!=typeof WebAssembly.instantiateStreaming||q()||tj.startsWith("file://")||ty||"function"!=typeof fetch?r(n):fetch(tj,{credentials:"same-origin"}).then(function(tn){return WebAssembly.instantiateStreaming(tn,tr).then(n,function(tr){return tw("wasm streaming compile failed: "+tr),tw("falling back to ArrayBuffer instantiation"),r(n)})})).catch(ts)})(),tn.___wasm_call_ctors=function(){return(tn.___wasm_call_ctors=tn.asm.La).apply(null,arguments)},tn._OrtInit=function(){return(tn._OrtInit=tn.asm.Ma).apply(null,arguments)},tn._OrtCreateSessionOptions=function(){return(tn._OrtCreateSessionOptions=tn.asm.Na).apply(null,arguments)},tn._OrtAppendExecutionProvider=function(){return(tn._OrtAppendExecutionProvider=tn.asm.Oa).apply(null,arguments)},tn._OrtAddSessionConfigEntry=function(){return(tn._OrtAddSessionConfigEntry=tn.asm.Pa).apply(null,arguments)},tn._OrtReleaseSessionOptions=function(){return(tn._OrtReleaseSessionOptions=tn.asm.Qa).apply(null,arguments)},tn._OrtCreateSession=function(){return(tn._OrtCreateSession=tn.asm.Ra).apply(null,arguments)},tn._OrtReleaseSession=function(){return(tn._OrtReleaseSession=tn.asm.Sa).apply(null,arguments)},tn._OrtGetInputCount=function(){return(tn._OrtGetInputCount=tn.asm.Ta).apply(null,arguments)},tn._OrtGetOutputCount=function(){return(tn._OrtGetOutputCount=tn.asm.Ua).apply(null,arguments)},tn._OrtGetInputName=function(){return(tn._OrtGetInputName=tn.asm.Va).apply(null,arguments)},tn._OrtGetOutputName=function(){return(tn._OrtGetOutputName=tn.asm.Wa).apply(null,arguments)},tn._OrtFree=function(){return(tn._OrtFree=tn.asm.Xa).apply(null,arguments)},tn._OrtCreateTensor=function(){return(tn._OrtCreateTensor=tn.asm.Ya).apply(null,arguments)},tn._OrtGetTensorData=function(){return(tn._OrtGetTensorData=tn.asm.Za).apply(null,arguments)},tn._OrtReleaseTensor=function(){return(tn._OrtReleaseTensor=tn.asm._a).apply(null,arguments)},tn._OrtCreateRunOptions=function(){return(tn._OrtCreateRunOptions=tn.asm.$a).apply(null,arguments)},tn._OrtAddRunConfigEntry=function(){return(tn._OrtAddRunConfigEntry=tn.asm.ab).apply(null,arguments)},tn._OrtReleaseRunOptions=function(){return(tn._OrtReleaseRunOptions=tn.asm.bb).apply(null,arguments)},tn._OrtRun=function(){return(tn._OrtRun=tn.asm.cb).apply(null,arguments)},tn._OrtEndProfiling=function(){return(tn._OrtEndProfiling=tn.asm.db).apply(null,arguments)};var t0,t1=tn._malloc=function(){return(t1=tn._malloc=tn.asm.eb).apply(null,arguments)},t2=tn._free=function(){return(t2=tn._free=tn.asm.fb).apply(null,arguments)},t3=tn._fflush=function(){return(t3=tn._fflush=tn.asm.gb).apply(null,arguments)},t4=tn.___funcs_on_exit=function(){return(t4=tn.___funcs_on_exit=tn.asm.hb).apply(null,arguments)},t6=tn._setThrew=function(){return(t6=tn._setThrew=tn.asm.jb).apply(null,arguments)},t8=tn.stackSave=function(){return(t8=tn.stackSave=tn.asm.kb).apply(null,arguments)},t5=tn.stackRestore=function(){return(t5=tn.stackRestore=tn.asm.lb).apply(null,arguments)},t7=tn.stackAlloc=function(){return(t7=tn.stackAlloc=tn.asm.mb).apply(null,arguments)},t9=tn.___cxa_can_catch=function(){return(t9=tn.___cxa_can_catch=tn.asm.nb).apply(null,arguments)},er=tn.___cxa_is_pointer_type=function(){return(er=tn.___cxa_is_pointer_type=tn.asm.ob).apply(null,arguments)},en=tn.dynCall_j=function(){return(en=tn.dynCall_j=tn.asm.pb).apply(null,arguments)},ei=tn.dynCall_iiiiij=function(){return(ei=tn.dynCall_iiiiij=tn.asm.qb).apply(null,arguments)},eo=tn.dynCall_jii=function(){return(eo=tn.dynCall_jii=tn.asm.rb).apply(null,arguments)},ea=tn.dynCall_viiiiij=function(){return(ea=tn.dynCall_viiiiij=tn.asm.sb).apply(null,arguments)},es=tn.dynCall_vjji=function(){return(es=tn.dynCall_vjji=tn.asm.tb).apply(null,arguments)},eu=tn.dynCall_viiijjjii=function(){return(eu=tn.dynCall_viiijjjii=tn.asm.ub).apply(null,arguments)},el=tn.dynCall_iij=function(){return(el=tn.dynCall_iij=tn.asm.vb).apply(null,arguments)},ec=tn.dynCall_ji=function(){return(ec=tn.dynCall_ji=tn.asm.wb).apply(null,arguments)},ep=tn.dynCall_iiiiiij=function(){return(ep=tn.dynCall_iiiiiij=tn.asm.xb).apply(null,arguments)},ef=tn.dynCall_iiij=function(){return(ef=tn.dynCall_iiij=tn.asm.yb).apply(null,arguments)};function jt(){function t(){if(!t0&&(t0=!0,tn.calledRun=!0,!tD)){if(Z(tF),ta(tn),tn.onRuntimeInitialized&&tn.onRuntimeInitialized(),tn.postRun)for("function"==typeof tn.postRun&&(tn.postRun=[tn.postRun]);tn.postRun.length;){var tr=tn.postRun.shift();tL.unshift(tr)}Z(tL)}}if(!(0{"use strict";tr.exports=function(tr,tn){for(var ti=Array(arguments.length-1),to=0,ta=2,ts=!0;ta{"use strict";var ti=tn;ti.length=function(tr){var tn=tr.length;if(!tn)return 0;for(var ti=0;--tn%4>1&&"="===tr.charAt(tn);)++ti;return Math.ceil(3*tr.length)/4-ti};for(var to=Array(64),ta=Array(123),ts=0;ts<64;)ta[to[ts]=ts<26?ts+65:ts<52?ts+71:ts<62?ts-4:ts-59|43]=ts++;ti.encode=function(tr,tn,ti){for(var ta,ts=null,tu=[],tl=0,tc=0;tn>2],ta=(3&tp)<<4,tc=1;break;case 1:tu[tl++]=to[ta|tp>>4],ta=(15&tp)<<2,tc=2;break;case 2:tu[tl++]=to[ta|tp>>6],tu[tl++]=to[63&tp],tc=0}tl>8191&&((ts||(ts=[])).push(String.fromCharCode.apply(String,tu)),tl=0)}return tc&&(tu[tl++]=to[ta],tu[tl++]=61,1===tc&&(tu[tl++]=61)),ts?(tl&&ts.push(String.fromCharCode.apply(String,tu.slice(0,tl))),ts.join("")):String.fromCharCode.apply(String,tu.slice(0,tl))};var tu="invalid encoding";ti.decode=function(tr,tn,ti){for(var to,ts=ti,tl=0,tc=0;tc1)break;if(void 0===(tp=ta[tp]))throw Error(tu);switch(tl){case 0:to=tp,tl=1;break;case 1:tn[ti++]=to<<2|(48&tp)>>4,to=tp,tl=2;break;case 2:tn[ti++]=(15&to)<<4|(60&tp)>>2,to=tp,tl=3;break;case 3:tn[ti++]=(3&to)<<6|tp,tl=0}}if(1===tl)throw Error(tu);return ti-ts},ti.test=function(tr){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(tr)}},9211:tr=>{"use strict";function e(){this._listeners={}}tr.exports=e,e.prototype.on=function(tr,tn,ti){return(this._listeners[tr]||(this._listeners[tr]=[])).push({fn:tn,ctx:ti||this}),this},e.prototype.off=function(tr,tn){if(void 0===tr)this._listeners={};else if(void 0===tn)this._listeners[tr]=[];else for(var ti=this._listeners[tr],to=0;to{"use strict";function e(tr){return"undefined"!=typeof Float32Array?function(){var tn=new Float32Array([-0]),ti=new Uint8Array(tn.buffer),to=128===ti[3];function i(tr,to,ta){tn[0]=tr,to[ta]=ti[0],to[ta+1]=ti[1],to[ta+2]=ti[2],to[ta+3]=ti[3]}function o(tr,to,ta){tn[0]=tr,to[ta]=ti[3],to[ta+1]=ti[2],to[ta+2]=ti[1],to[ta+3]=ti[0]}function a(tr,to){return ti[0]=tr[to],ti[1]=tr[to+1],ti[2]=tr[to+2],ti[3]=tr[to+3],tn[0]}function s(tr,to){return ti[3]=tr[to],ti[2]=tr[to+1],ti[1]=tr[to+2],ti[0]=tr[to+3],tn[0]}tr.writeFloatLE=to?i:o,tr.writeFloatBE=to?o:i,tr.readFloatLE=to?a:s,tr.readFloatBE=to?s:a}():function(){function e(tr,tn,ti,to){var ta=tn<0?1:0;if(ta&&(tn=-tn),0===tn)tr(1/tn>0?0:2147483648,ti,to);else if(isNaN(tn))tr(2143289344,ti,to);else if(tn>34028234663852886e22)tr((ta<<31|2139095040)>>>0,ti,to);else if(tn<11754943508222875e-54)tr((ta<<31|Math.round(tn/1401298464324817e-60))>>>0,ti,to);else{var ts=Math.floor(Math.log(tn)/Math.LN2);tr((ta<<31|ts+127<<23|8388607&Math.round(tn*Math.pow(2,-ts)*8388608))>>>0,ti,to)}}function a(tr,tn,ti){var to=tr(tn,ti),ta=2*(to>>31)+1,ts=to>>>23&255,tu=8388607&to;return 255===ts?tu?NaN:ta*(1/0):0===ts?1401298464324817e-60*ta*tu:ta*Math.pow(2,ts-150)*(tu+8388608)}tr.writeFloatLE=e.bind(null,n),tr.writeFloatBE=e.bind(null,r),tr.readFloatLE=a.bind(null,i),tr.readFloatBE=a.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var tn=new Float64Array([-0]),ti=new Uint8Array(tn.buffer),to=128===ti[7];function i(tr,to,ta){tn[0]=tr,to[ta]=ti[0],to[ta+1]=ti[1],to[ta+2]=ti[2],to[ta+3]=ti[3],to[ta+4]=ti[4],to[ta+5]=ti[5],to[ta+6]=ti[6],to[ta+7]=ti[7]}function o(tr,to,ta){tn[0]=tr,to[ta]=ti[7],to[ta+1]=ti[6],to[ta+2]=ti[5],to[ta+3]=ti[4],to[ta+4]=ti[3],to[ta+5]=ti[2],to[ta+6]=ti[1],to[ta+7]=ti[0]}function a(tr,to){return ti[0]=tr[to],ti[1]=tr[to+1],ti[2]=tr[to+2],ti[3]=tr[to+3],ti[4]=tr[to+4],ti[5]=tr[to+5],ti[6]=tr[to+6],ti[7]=tr[to+7],tn[0]}function s(tr,to){return ti[7]=tr[to],ti[6]=tr[to+1],ti[5]=tr[to+2],ti[4]=tr[to+3],ti[3]=tr[to+4],ti[2]=tr[to+5],ti[1]=tr[to+6],ti[0]=tr[to+7],tn[0]}tr.writeDoubleLE=to?i:o,tr.writeDoubleBE=to?o:i,tr.readDoubleLE=to?a:s,tr.readDoubleBE=to?s:a}():function(){function e(tr,tn,ti,to,ta,ts){var tu,tl=to<0?1:0;if(tl&&(to=-to),0===to)tr(0,ta,ts+tn),tr(1/to>0?0:2147483648,ta,ts+ti);else if(isNaN(to))tr(0,ta,ts+tn),tr(2146959360,ta,ts+ti);else if(to>17976931348623157e292)tr(0,ta,ts+tn),tr((tl<<31|2146435072)>>>0,ta,ts+ti);else if(to<22250738585072014e-324)tr((tu=to/5e-324)>>>0,ta,ts+tn),tr((tl<<31|tu/4294967296)>>>0,ta,ts+ti);else{var tc=Math.floor(Math.log(to)/Math.LN2);1024===tc&&(tc=1023),tr(4503599627370496*(tu=to*Math.pow(2,-tc))>>>0,ta,ts+tn),tr((tl<<31|tc+1023<<20|1048576*tu&1048575)>>>0,ta,ts+ti)}}function a(tr,tn,ti,to,ta){var ts=tr(to,ta+tn),tu=tr(to,ta+ti),tl=2*(tu>>31)+1,tc=tu>>>20&2047,tp=4294967296*(1048575&tu)+ts;return 2047===tc?tp?NaN:tl*(1/0):0===tc?5e-324*tl*tp:tl*Math.pow(2,tc-1075)*(tp+4503599627370496)}tr.writeDoubleLE=e.bind(null,n,0,4),tr.writeDoubleBE=e.bind(null,r,4,0),tr.readDoubleLE=a.bind(null,i,0,4),tr.readDoubleBE=a.bind(null,o,4,0)}(),tr}function n(tr,tn,ti){tn[ti]=255&tr,tn[ti+1]=tr>>>8&255,tn[ti+2]=tr>>>16&255,tn[ti+3]=tr>>>24}function r(tr,tn,ti){tn[ti]=tr>>>24,tn[ti+1]=tr>>>16&255,tn[ti+2]=tr>>>8&255,tn[ti+3]=255&tr}function i(tr,tn){return(tr[tn]|tr[tn+1]<<8|tr[tn+2]<<16|tr[tn+3]<<24)>>>0}function o(tr,tn){return(tr[tn]<<24|tr[tn+1]<<16|tr[tn+2]<<8|tr[tn+3])>>>0}tr.exports=e(e)},7199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},6662:tr=>{"use strict";tr.exports=function(tr,tn,ti){var to=ti||8192,ta=to>>>1,ts=null,tu=to;return function(ti){if(ti<1||ti>ta)return tr(ti);tu+ti>to&&(ts=tr(to),tu=0);var tl=tn.call(ts,tu,tu+=ti);return 7&tu&&(tu=1+(7|tu)),tl}}},4997:(tr,tn)=>{"use strict";var ti=tn;ti.length=function(tr){for(var tn=0,ti=0,to=0;to191&&to<224?ts[tu++]=(31&to)<<6|63&tr[tn++]:to>239&&to<365?(to=((7&to)<<18|(63&tr[tn++])<<12|(63&tr[tn++])<<6|63&tr[tn++])-65536,ts[tu++]=55296+(to>>10),ts[tu++]=56320+(1023&to)):ts[tu++]=(15&to)<<12|(63&tr[tn++])<<6|63&tr[tn++],tu>8191&&((ta||(ta=[])).push(String.fromCharCode.apply(String,ts)),tu=0);return ta?(tu&&ta.push(String.fromCharCode.apply(String,ts.slice(0,tu))),ta.join("")):String.fromCharCode.apply(String,ts.slice(0,tu))},ti.write=function(tr,tn,ti){for(var to,ta,ts=ti,tu=0;tu>6|192:(55296==(64512&to)&&56320==(64512&(ta=tr.charCodeAt(tu+1)))?(to=65536+((1023&to)<<10)+(1023&ta),++tu,tn[ti++]=to>>18|240,tn[ti++]=to>>12&63|128):tn[ti++]=to>>12|224,tn[ti++]=to>>6&63|128),tn[ti++]=63&to|128);return ti-ts}},3442:(tr,tn)=>{"use strict";tn.__esModule=!0;var ti=function(){function t(tr){if(!tr)throw TypeError("Invalid argument; `value` has no value.");this.value=t.EMPTY,tr&&t.isGuid(tr)&&(this.value=tr)}return t.isGuid=function(tr){var tn=tr.toString();return tr&&(tr instanceof t||t.validator.test(tn))},t.create=function(){return new t([t.gen(2),t.gen(1),t.gen(1),t.gen(1),t.gen(3)].join("-"))},t.createEmpty=function(){return new t("emptyguid")},t.parse=function(tr){return new t(tr)},t.raw=function(){return[t.gen(2),t.gen(1),t.gen(1),t.gen(1),t.gen(3)].join("-")},t.gen=function(tr){for(var tn="",ti=0;ti{tr.exports=n;var tn=null;try{tn=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(tr){}function n(tr,tn,ti){this.low=0|tr,this.high=0|tn,this.unsigned=!!ti}function r(tr){return!0===(tr&&tr.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var ti={},to={};function a(tr,tn){var ta,ts,tu;return tn?(tu=0<=(tr>>>=0)&&tr<256)&&(ts=to[tr])?ts:(ta=u(tr,(0|tr)<0?-1:0,!0),tu&&(to[tr]=ta),ta):(tu=-128<=(tr|=0)&&tr<128)&&(ts=ti[tr])?ts:(ta=u(tr,tr<0?-1:0,!1),tu&&(ti[tr]=ta),ta)}function s(tr,tn){if(isNaN(tr))return tn?tf:tp;if(tn){if(tr<0)return tf;if(tr>=tu)return tm}else{if(tr<=-tl)return ty;if(tr+1>=tl)return tb}return tr<0?s(-tr,tn).neg():u(tr%ts|0,tr/ts|0,tn)}function u(tr,tn,ti){return new n(tr,tn,ti)}n.fromInt=a,n.fromNumber=s,n.fromBits=u;var ta=Math.pow;function l(tr,tn,ti){if(0===tr.length)throw Error("empty string");if("NaN"===tr||"Infinity"===tr||"+Infinity"===tr||"-Infinity"===tr)return tp;if("number"==typeof tn?(ti=tn,tn=!1):tn=!!tn,(ti=ti||10)<2||360)throw Error("interior hyphen");if(0===to)return l(tr.substring(1),tn,ti).neg();for(var to,ts=s(ta(ti,8)),tu=tp,tl=0;tl>>0:this.low},t_.toNumber=function(){return this.unsigned?(this.high>>>0)*ts+(this.low>>>0):this.high*ts+(this.low>>>0)},t_.toString=function(tr){if((tr=tr||10)<2||36>>0).toString(tr);if((tu=tc).isZero())return tp+tl;for(;tp.length<6;)tp="0"+tp;tl=""+tp+tl}},t_.getHighBits=function(){return this.high},t_.getHighBitsUnsigned=function(){return this.high>>>0},t_.getLowBits=function(){return this.low},t_.getLowBitsUnsigned=function(){return this.low>>>0},t_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(ty)?64:this.neg().getNumBitsAbs();for(var tr=0!=this.high?this.high:this.low,tn=31;tn>0&&0==(tr&1<=0},t_.isOdd=function(){return 1==(1&this.low)},t_.isEven=function(){return 0==(1&this.low)},t_.equals=function(tr){return r(tr)||(tr=p(tr)),(this.unsigned===tr.unsigned||this.high>>>31!=1||tr.high>>>31!=1)&&this.high===tr.high&&this.low===tr.low},t_.eq=t_.equals,t_.notEquals=function(tr){return!this.eq(tr)},t_.neq=t_.notEquals,t_.ne=t_.notEquals,t_.lessThan=function(tr){return 0>this.comp(tr)},t_.lt=t_.lessThan,t_.lessThanOrEqual=function(tr){return 0>=this.comp(tr)},t_.lte=t_.lessThanOrEqual,t_.le=t_.lessThanOrEqual,t_.greaterThan=function(tr){return this.comp(tr)>0},t_.gt=t_.greaterThan,t_.greaterThanOrEqual=function(tr){return this.comp(tr)>=0},t_.gte=t_.greaterThanOrEqual,t_.ge=t_.greaterThanOrEqual,t_.compare=function(tr){if(r(tr)||(tr=p(tr)),this.eq(tr))return 0;var tn=this.isNegative(),ti=tr.isNegative();return tn&&!ti?-1:!tn&&ti?1:this.unsigned?tr.high>>>0>this.high>>>0||tr.high===this.high&&tr.low>>>0>this.low>>>0?-1:1:this.sub(tr).isNegative()?-1:1},t_.comp=t_.compare,t_.negate=function(){return!this.unsigned&&this.eq(ty)?ty:this.not().add(td)},t_.neg=t_.negate,t_.add=function(tr){r(tr)||(tr=p(tr));var tn,ti,to,ta,ts=this.high>>>16,tu=65535&this.high,tl=this.low>>>16,tc=65535&this.low,tp=tr.high>>>16,tf=65535&tr.high,td=tr.low>>>16;return ta=0+(((to=0+((tn=0+((ti=0+(tc+(65535&tr.low)))>>>16)+(tl+td))>>>16)+(tu+tf))>>>16)+(ts+tp)),u((tn&=65535)<<16|(ti&=65535),(ta&=65535)<<16|(to&=65535),this.unsigned)},t_.subtract=function(tr){return r(tr)||(tr=p(tr)),this.add(tr.neg())},t_.sub=t_.subtract,t_.multiply=function(tr){if(this.isZero())return tp;if(r(tr)||(tr=p(tr)),tn)return u(tn.mul(this.low,this.high,tr.low,tr.high),tn.get_high(),this.unsigned);if(tr.isZero())return tp;if(this.eq(ty))return tr.isOdd()?ty:tp;if(tr.eq(ty))return this.isOdd()?ty:tp;if(this.isNegative())return tr.isNegative()?this.neg().mul(tr.neg()):this.neg().mul(tr).neg();if(tr.isNegative())return this.mul(tr.neg()).neg();if(this.lt(tc)&&tr.lt(tc))return s(this.toNumber()*tr.toNumber(),this.unsigned);var ti,to,ta,ts=this.high>>>16,tu=65535&this.high,tl=this.low>>>16,tf=65535&this.low,td=tr.high>>>16,th=65535&tr.high,tg=tr.low>>>16,tb=65535&tr.low,tm=0;return ta=0+((ti=0+((to=0+tf*tb)>>>16)+tl*tb)>>>16),ti&=65535,ta+=(ti+=tf*tg)>>>16,tm+=(ta+=tu*tb)>>>16,ta&=65535,tm+=(ta+=tl*tg)>>>16,ta&=65535,tm+=((ta+=tf*th)>>>16)+(ts*tb+tu*tg+tl*th+tf*td),u((ti&=65535)<<16|(to&=65535),(tm&=65535)<<16|(ta&=65535),this.unsigned)},t_.mul=t_.multiply,t_.divide=function(tr){if(r(tr)||(tr=p(tr)),tr.isZero())throw Error("division by zero");if(tn)return this.unsigned||-2147483648!==this.high||-1!==tr.low||-1!==tr.high?u((this.unsigned?tn.div_u:tn.div_s)(this.low,this.high,tr.low,tr.high),tn.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?tf:tp;if(this.unsigned){if(tr.unsigned||(tr=tr.toUnsigned()),tr.gt(this))return tf;if(tr.gt(this.shru(1)))return th;ts=tf}else{if(this.eq(ty))return tr.eq(td)||tr.eq(tg)?ty:tr.eq(ty)?td:(ti=this.shr(1).div(tr).shl(1)).eq(tp)?tr.isNegative()?td:tg:(to=this.sub(tr.mul(ti)),ts=ti.add(to.div(tr)));if(tr.eq(ty))return this.unsigned?tf:tp;if(this.isNegative())return tr.isNegative()?this.neg().div(tr.neg()):this.neg().div(tr).neg();if(tr.isNegative())return this.div(tr.neg()).neg();ts=tp}for(to=this;to.gte(tr);){ti=Math.max(1,Math.floor(to.toNumber()/tr.toNumber()));for(var ti,to,ts,tu=Math.ceil(Math.log(ti)/Math.LN2),tl=tu<=48?1:ta(2,tu-48),tc=s(ti),tb=tc.mul(tr);tb.isNegative()||tb.gt(to);)tb=(tc=s(ti-=tl,this.unsigned)).mul(tr);tc.isZero()&&(tc=td),ts=ts.add(tc),to=to.sub(tb)}return ts},t_.div=t_.divide,t_.modulo=function(tr){return r(tr)||(tr=p(tr)),tn?u((this.unsigned?tn.rem_u:tn.rem_s)(this.low,this.high,tr.low,tr.high),tn.get_high(),this.unsigned):this.sub(this.div(tr).mul(tr))},t_.mod=t_.modulo,t_.rem=t_.modulo,t_.not=function(){return u(~this.low,~this.high,this.unsigned)},t_.and=function(tr){return r(tr)||(tr=p(tr)),u(this.low&tr.low,this.high&tr.high,this.unsigned)},t_.or=function(tr){return r(tr)||(tr=p(tr)),u(this.low|tr.low,this.high|tr.high,this.unsigned)},t_.xor=function(tr){return r(tr)||(tr=p(tr)),u(this.low^tr.low,this.high^tr.high,this.unsigned)},t_.shiftLeft=function(tr){return r(tr)&&(tr=tr.toInt()),0==(tr&=63)?this:tr<32?u(this.low<>>32-tr,this.unsigned):u(0,this.low<>>tr|this.high<<32-tr,this.high>>tr,this.unsigned):u(this.high>>tr-32,this.high>=0?0:-1,this.unsigned)},t_.shr=t_.shiftRight,t_.shiftRightUnsigned=function(tr){if(r(tr)&&(tr=tr.toInt()),0==(tr&=63))return this;var tn=this.high;return tr<32?u(this.low>>>tr|tn<<32-tr,tn>>>tr,this.unsigned):u(32===tr?tn:tn>>>tr-32,0,this.unsigned)},t_.shru=t_.shiftRightUnsigned,t_.shr_u=t_.shiftRightUnsigned,t_.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},t_.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},t_.toBytes=function(tr){return tr?this.toBytesLE():this.toBytesBE()},t_.toBytesLE=function(){var tr=this.high,tn=this.low;return[255&tn,tn>>>8&255,tn>>>16&255,tn>>>24,255&tr,tr>>>8&255,tr>>>16&255,tr>>>24]},t_.toBytesBE=function(){var tr=this.high,tn=this.low;return[tr>>>24,tr>>>16&255,tr>>>8&255,255&tr,tn>>>24,tn>>>16&255,tn>>>8&255,255&tn]},n.fromBytes=function(tr,tn,ti){return ti?n.fromBytesLE(tr,tn):n.fromBytesBE(tr,tn)},n.fromBytesLE=function(tr,tn){return new n(tr[0]|tr[1]<<8|tr[2]<<16|tr[3]<<24,tr[4]|tr[5]<<8|tr[6]<<16|tr[7]<<24,tn)},n.fromBytesBE=function(tr,tn){return new n(tr[4]<<24|tr[5]<<16|tr[6]<<8|tr[7],tr[0]<<24|tr[1]<<16|tr[2]<<8|tr[3],tn)}},1446:(tr,tn,ti)=>{"use strict";var to,ta,ts,tu=ti(2100),tl=tu.Reader,tc=tu.Writer,tp=tu.util,tf=tu.roots.default||(tu.roots.default={});tf.onnx=((ts={}).Version=((ta=Object.create(to={}))[to[0]="_START_VERSION"]=0,ta[to[1]="IR_VERSION_2017_10_10"]=1,ta[to[2]="IR_VERSION_2017_10_30"]=2,ta[to[3]="IR_VERSION_2017_11_3"]=3,ta[to[4]="IR_VERSION_2019_1_22"]=4,ta[to[5]="IR_VERSION"]=5,ta),ts.AttributeProto=function(){function t(tr){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],tr)for(var tn=Object.keys(tr),ti=0;ti>>3){case 1:to.name=tr.string();break;case 21:to.refAttrName=tr.string();break;case 13:to.docString=tr.string();break;case 20:to.type=tr.int32();break;case 2:to.f=tr.float();break;case 3:to.i=tr.int64();break;case 4:to.s=tr.bytes();break;case 5:to.t=tf.onnx.TensorProto.decode(tr,tr.uint32());break;case 6:to.g=tf.onnx.GraphProto.decode(tr,tr.uint32());break;case 7:if(to.floats&&to.floats.length||(to.floats=[]),2==(7&ta))for(var ts=tr.uint32()+tr.pos;tr.pos>>0,tr.i.high>>>0).toNumber())),null!=tr.s&&("string"==typeof tr.s?tp.base64.decode(tr.s,tn.s=tp.newBuffer(tp.base64.length(tr.s)),0):tr.s.length&&(tn.s=tr.s)),null!=tr.t){if("object"!=typeof tr.t)throw TypeError(".onnx.AttributeProto.t: object expected");tn.t=tf.onnx.TensorProto.fromObject(tr.t)}if(null!=tr.g){if("object"!=typeof tr.g)throw TypeError(".onnx.AttributeProto.g: object expected");tn.g=tf.onnx.GraphProto.fromObject(tr.g)}if(tr.floats){if(!Array.isArray(tr.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");tn.floats=[];for(var ti=0;ti>>0,tr.ints[ti].high>>>0).toNumber())}if(tr.strings){if(!Array.isArray(tr.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(tn.strings=[],ti=0;ti>>0,tr.i.high>>>0).toNumber():tr.i),null!=tr.s&&tr.hasOwnProperty("s")&&(ti.s=tn.bytes===String?tp.base64.encode(tr.s,0,tr.s.length):tn.bytes===Array?Array.prototype.slice.call(tr.s):tr.s),null!=tr.t&&tr.hasOwnProperty("t")&&(ti.t=tf.onnx.TensorProto.toObject(tr.t,tn)),null!=tr.g&&tr.hasOwnProperty("g")&&(ti.g=tf.onnx.GraphProto.toObject(tr.g,tn)),tr.floats&&tr.floats.length){ti.floats=[];for(var ta=0;ta>>0,tr.ints[ta].high>>>0).toNumber():tr.ints[ta];if(tr.strings&&tr.strings.length)for(ti.strings=[],ta=0;ta>>3){case 1:to.name=tr.string();break;case 2:to.type=tf.onnx.TypeProto.decode(tr,tr.uint32());break;case 3:to.docString=tr.string();break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.name&&tr.hasOwnProperty("name")&&!tp.isString(tr.name))return"name: string expected";if(null!=tr.type&&tr.hasOwnProperty("type")){var tn=tf.onnx.TypeProto.verify(tr.type);if(tn)return"type."+tn}return null!=tr.docString&&tr.hasOwnProperty("docString")&&!tp.isString(tr.docString)?"docString: string expected":null},t.fromObject=function(tr){if(tr instanceof tf.onnx.ValueInfoProto)return tr;var tn=new tf.onnx.ValueInfoProto;if(null!=tr.name&&(tn.name=String(tr.name)),null!=tr.type){if("object"!=typeof tr.type)throw TypeError(".onnx.ValueInfoProto.type: object expected");tn.type=tf.onnx.TypeProto.fromObject(tr.type)}return null!=tr.docString&&(tn.docString=String(tr.docString)),tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};return tn.defaults&&(ti.name="",ti.type=null,ti.docString=""),null!=tr.name&&tr.hasOwnProperty("name")&&(ti.name=tr.name),null!=tr.type&&tr.hasOwnProperty("type")&&(ti.type=tf.onnx.TypeProto.toObject(tr.type,tn)),null!=tr.docString&&tr.hasOwnProperty("docString")&&(ti.docString=tr.docString),ti},t.prototype.toJSON=function(){return this.constructor.toObject(this,tu.util.toJSONOptions)},t}(),ts.NodeProto=function(){function t(tr){if(this.input=[],this.output=[],this.attribute=[],tr)for(var tn=Object.keys(tr),ti=0;ti>>3){case 1:to.input&&to.input.length||(to.input=[]),to.input.push(tr.string());break;case 2:to.output&&to.output.length||(to.output=[]),to.output.push(tr.string());break;case 3:to.name=tr.string();break;case 4:to.opType=tr.string();break;case 7:to.domain=tr.string();break;case 5:to.attribute&&to.attribute.length||(to.attribute=[]),to.attribute.push(tf.onnx.AttributeProto.decode(tr,tr.uint32()));break;case 6:to.docString=tr.string();break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.input&&tr.hasOwnProperty("input")){if(!Array.isArray(tr.input))return"input: array expected";for(var tn=0;tn>>3){case 1:to.irVersion=tr.int64();break;case 8:to.opsetImport&&to.opsetImport.length||(to.opsetImport=[]),to.opsetImport.push(tf.onnx.OperatorSetIdProto.decode(tr,tr.uint32()));break;case 2:to.producerName=tr.string();break;case 3:to.producerVersion=tr.string();break;case 4:to.domain=tr.string();break;case 5:to.modelVersion=tr.int64();break;case 6:to.docString=tr.string();break;case 7:to.graph=tf.onnx.GraphProto.decode(tr,tr.uint32());break;case 14:to.metadataProps&&to.metadataProps.length||(to.metadataProps=[]),to.metadataProps.push(tf.onnx.StringStringEntryProto.decode(tr,tr.uint32()));break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.irVersion&&tr.hasOwnProperty("irVersion")&&!(tp.isInteger(tr.irVersion)||tr.irVersion&&tp.isInteger(tr.irVersion.low)&&tp.isInteger(tr.irVersion.high)))return"irVersion: integer|Long expected";if(null!=tr.opsetImport&&tr.hasOwnProperty("opsetImport")){if(!Array.isArray(tr.opsetImport))return"opsetImport: array expected";for(var tn,ti=0;ti>>0,tr.irVersion.high>>>0).toNumber())),tr.opsetImport){if(!Array.isArray(tr.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");tn.opsetImport=[];for(var ti=0;ti>>0,tr.modelVersion.high>>>0).toNumber())),null!=tr.docString&&(tn.docString=String(tr.docString)),null!=tr.graph){if("object"!=typeof tr.graph)throw TypeError(".onnx.ModelProto.graph: object expected");tn.graph=tf.onnx.GraphProto.fromObject(tr.graph)}if(tr.metadataProps){if(!Array.isArray(tr.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(tn.metadataProps=[],ti=0;ti>>0,tr.irVersion.high>>>0).toNumber():tr.irVersion),null!=tr.producerName&&tr.hasOwnProperty("producerName")&&(ti.producerName=tr.producerName),null!=tr.producerVersion&&tr.hasOwnProperty("producerVersion")&&(ti.producerVersion=tr.producerVersion),null!=tr.domain&&tr.hasOwnProperty("domain")&&(ti.domain=tr.domain),null!=tr.modelVersion&&tr.hasOwnProperty("modelVersion")&&("number"==typeof tr.modelVersion?ti.modelVersion=tn.longs===String?String(tr.modelVersion):tr.modelVersion:ti.modelVersion=tn.longs===String?tp.Long.prototype.toString.call(tr.modelVersion):tn.longs===Number?new tp.LongBits(tr.modelVersion.low>>>0,tr.modelVersion.high>>>0).toNumber():tr.modelVersion),null!=tr.docString&&tr.hasOwnProperty("docString")&&(ti.docString=tr.docString),null!=tr.graph&&tr.hasOwnProperty("graph")&&(ti.graph=tf.onnx.GraphProto.toObject(tr.graph,tn)),tr.opsetImport&&tr.opsetImport.length){ti.opsetImport=[];for(var ta=0;ta>>3){case 1:to.key=tr.string();break;case 2:to.value=tr.string();break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){return"object"!=typeof tr||null===tr?"object expected":null!=tr.key&&tr.hasOwnProperty("key")&&!tp.isString(tr.key)?"key: string expected":null!=tr.value&&tr.hasOwnProperty("value")&&!tp.isString(tr.value)?"value: string expected":null},t.fromObject=function(tr){if(tr instanceof tf.onnx.StringStringEntryProto)return tr;var tn=new tf.onnx.StringStringEntryProto;return null!=tr.key&&(tn.key=String(tr.key)),null!=tr.value&&(tn.value=String(tr.value)),tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};return tn.defaults&&(ti.key="",ti.value=""),null!=tr.key&&tr.hasOwnProperty("key")&&(ti.key=tr.key),null!=tr.value&&tr.hasOwnProperty("value")&&(ti.value=tr.value),ti},t.prototype.toJSON=function(){return this.constructor.toObject(this,tu.util.toJSONOptions)},t}(),ts.TensorAnnotation=function(){function t(tr){if(this.quantParameterTensorNames=[],tr)for(var tn=Object.keys(tr),ti=0;ti>>3){case 1:to.tensorName=tr.string();break;case 2:to.quantParameterTensorNames&&to.quantParameterTensorNames.length||(to.quantParameterTensorNames=[]),to.quantParameterTensorNames.push(tf.onnx.StringStringEntryProto.decode(tr,tr.uint32()));break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.tensorName&&tr.hasOwnProperty("tensorName")&&!tp.isString(tr.tensorName))return"tensorName: string expected";if(null!=tr.quantParameterTensorNames&&tr.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(tr.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var tn=0;tn>>3){case 1:to.node&&to.node.length||(to.node=[]),to.node.push(tf.onnx.NodeProto.decode(tr,tr.uint32()));break;case 2:to.name=tr.string();break;case 5:to.initializer&&to.initializer.length||(to.initializer=[]),to.initializer.push(tf.onnx.TensorProto.decode(tr,tr.uint32()));break;case 10:to.docString=tr.string();break;case 11:to.input&&to.input.length||(to.input=[]),to.input.push(tf.onnx.ValueInfoProto.decode(tr,tr.uint32()));break;case 12:to.output&&to.output.length||(to.output=[]),to.output.push(tf.onnx.ValueInfoProto.decode(tr,tr.uint32()));break;case 13:to.valueInfo&&to.valueInfo.length||(to.valueInfo=[]),to.valueInfo.push(tf.onnx.ValueInfoProto.decode(tr,tr.uint32()));break;case 14:to.quantizationAnnotation&&to.quantizationAnnotation.length||(to.quantizationAnnotation=[]),to.quantizationAnnotation.push(tf.onnx.TensorAnnotation.decode(tr,tr.uint32()));break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.node&&tr.hasOwnProperty("node")){if(!Array.isArray(tr.node))return"node: array expected";for(var tn,ti=0;ti>>3){case 1:if(to.dims&&to.dims.length||(to.dims=[]),2==(7&ta))for(var ts=tr.uint32()+tr.pos;tr.pos>>0,tr.dims[ti].high>>>0).toNumber())}if(null!=tr.dataType&&(tn.dataType=0|tr.dataType),null!=tr.segment){if("object"!=typeof tr.segment)throw TypeError(".onnx.TensorProto.segment: object expected");tn.segment=tf.onnx.TensorProto.Segment.fromObject(tr.segment)}if(tr.floatData){if(!Array.isArray(tr.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(tn.floatData=[],ti=0;ti>>0,tr.int64Data[ti].high>>>0).toNumber())}if(null!=tr.name&&(tn.name=String(tr.name)),null!=tr.docString&&(tn.docString=String(tr.docString)),null!=tr.rawData&&("string"==typeof tr.rawData?tp.base64.decode(tr.rawData,tn.rawData=tp.newBuffer(tp.base64.length(tr.rawData)),0):tr.rawData.length&&(tn.rawData=tr.rawData)),tr.externalData){if(!Array.isArray(tr.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(tn.externalData=[],ti=0;ti>>0,tr.uint64Data[ti].high>>>0).toNumber(!0))}return tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};if((tn.arrays||tn.defaults)&&(ti.dims=[],ti.floatData=[],ti.int32Data=[],ti.stringData=[],ti.int64Data=[],ti.doubleData=[],ti.uint64Data=[],ti.externalData=[]),tn.defaults&&(ti.dataType=0,ti.segment=null,ti.name="",tn.bytes===String?ti.rawData="":(ti.rawData=[],tn.bytes!==Array&&(ti.rawData=tp.newBuffer(ti.rawData))),ti.docString="",ti.dataLocation=tn.enums===String?"DEFAULT":0),tr.dims&&tr.dims.length){ti.dims=[];for(var to=0;to>>0,tr.dims[to].high>>>0).toNumber():tr.dims[to]}if(null!=tr.dataType&&tr.hasOwnProperty("dataType")&&(ti.dataType=tr.dataType),null!=tr.segment&&tr.hasOwnProperty("segment")&&(ti.segment=tf.onnx.TensorProto.Segment.toObject(tr.segment,tn)),tr.floatData&&tr.floatData.length)for(ti.floatData=[],to=0;to>>0,tr.int64Data[to].high>>>0).toNumber():tr.int64Data[to];if(null!=tr.name&&tr.hasOwnProperty("name")&&(ti.name=tr.name),null!=tr.rawData&&tr.hasOwnProperty("rawData")&&(ti.rawData=tn.bytes===String?tp.base64.encode(tr.rawData,0,tr.rawData.length):tn.bytes===Array?Array.prototype.slice.call(tr.rawData):tr.rawData),tr.doubleData&&tr.doubleData.length)for(ti.doubleData=[],to=0;to>>0,tr.uint64Data[to].high>>>0).toNumber(!0):tr.uint64Data[to];if(null!=tr.docString&&tr.hasOwnProperty("docString")&&(ti.docString=tr.docString),tr.externalData&&tr.externalData.length)for(ti.externalData=[],to=0;to>>3){case 1:to.begin=tr.int64();break;case 2:to.end=tr.int64();break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){return"object"!=typeof tr||null===tr?"object expected":null!=tr.begin&&tr.hasOwnProperty("begin")&&!(tp.isInteger(tr.begin)||tr.begin&&tp.isInteger(tr.begin.low)&&tp.isInteger(tr.begin.high))?"begin: integer|Long expected":null!=tr.end&&tr.hasOwnProperty("end")&&!(tp.isInteger(tr.end)||tr.end&&tp.isInteger(tr.end.low)&&tp.isInteger(tr.end.high))?"end: integer|Long expected":null},t.fromObject=function(tr){if(tr instanceof tf.onnx.TensorProto.Segment)return tr;var tn=new tf.onnx.TensorProto.Segment;return null!=tr.begin&&(tp.Long?(tn.begin=tp.Long.fromValue(tr.begin)).unsigned=!1:"string"==typeof tr.begin?tn.begin=parseInt(tr.begin,10):"number"==typeof tr.begin?tn.begin=tr.begin:"object"==typeof tr.begin&&(tn.begin=new tp.LongBits(tr.begin.low>>>0,tr.begin.high>>>0).toNumber())),null!=tr.end&&(tp.Long?(tn.end=tp.Long.fromValue(tr.end)).unsigned=!1:"string"==typeof tr.end?tn.end=parseInt(tr.end,10):"number"==typeof tr.end?tn.end=tr.end:"object"==typeof tr.end&&(tn.end=new tp.LongBits(tr.end.low>>>0,tr.end.high>>>0).toNumber())),tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};if(tn.defaults){if(tp.Long){var to=new tp.Long(0,0,!1);ti.begin=tn.longs===String?to.toString():tn.longs===Number?to.toNumber():to}else ti.begin=tn.longs===String?"0":0;tp.Long?(to=new tp.Long(0,0,!1),ti.end=tn.longs===String?to.toString():tn.longs===Number?to.toNumber():to):ti.end=tn.longs===String?"0":0}return null!=tr.begin&&tr.hasOwnProperty("begin")&&("number"==typeof tr.begin?ti.begin=tn.longs===String?String(tr.begin):tr.begin:ti.begin=tn.longs===String?tp.Long.prototype.toString.call(tr.begin):tn.longs===Number?new tp.LongBits(tr.begin.low>>>0,tr.begin.high>>>0).toNumber():tr.begin),null!=tr.end&&tr.hasOwnProperty("end")&&("number"==typeof tr.end?ti.end=tn.longs===String?String(tr.end):tr.end:ti.end=tn.longs===String?tp.Long.prototype.toString.call(tr.end):tn.longs===Number?new tp.LongBits(tr.end.low>>>0,tr.end.high>>>0).toNumber():tr.end),ti},t.prototype.toJSON=function(){return this.constructor.toObject(this,tu.util.toJSONOptions)},t}(),t.DataLocation=function(){var tr={},tn=Object.create(tr);return tn[tr[0]="DEFAULT"]=0,tn[tr[1]="EXTERNAL"]=1,tn}(),t}(),ts.TensorShapeProto=function(){function t(tr){if(this.dim=[],tr)for(var tn=Object.keys(tr),ti=0;ti>>3==1?(to.dim&&to.dim.length||(to.dim=[]),to.dim.push(tf.onnx.TensorShapeProto.Dimension.decode(tr,tr.uint32()))):tr.skipType(7&ta)}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.dim&&tr.hasOwnProperty("dim")){if(!Array.isArray(tr.dim))return"dim: array expected";for(var tn=0;tn>>3){case 1:to.dimValue=tr.int64();break;case 2:to.dimParam=tr.string();break;case 3:to.denotation=tr.string();break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";var tn={};if(null!=tr.dimValue&&tr.hasOwnProperty("dimValue")&&(tn.value=1,!(tp.isInteger(tr.dimValue)||tr.dimValue&&tp.isInteger(tr.dimValue.low)&&tp.isInteger(tr.dimValue.high))))return"dimValue: integer|Long expected";if(null!=tr.dimParam&&tr.hasOwnProperty("dimParam")){if(1===tn.value)return"value: multiple values";if(tn.value=1,!tp.isString(tr.dimParam))return"dimParam: string expected"}return null!=tr.denotation&&tr.hasOwnProperty("denotation")&&!tp.isString(tr.denotation)?"denotation: string expected":null},t.fromObject=function(tr){if(tr instanceof tf.onnx.TensorShapeProto.Dimension)return tr;var tn=new tf.onnx.TensorShapeProto.Dimension;return null!=tr.dimValue&&(tp.Long?(tn.dimValue=tp.Long.fromValue(tr.dimValue)).unsigned=!1:"string"==typeof tr.dimValue?tn.dimValue=parseInt(tr.dimValue,10):"number"==typeof tr.dimValue?tn.dimValue=tr.dimValue:"object"==typeof tr.dimValue&&(tn.dimValue=new tp.LongBits(tr.dimValue.low>>>0,tr.dimValue.high>>>0).toNumber())),null!=tr.dimParam&&(tn.dimParam=String(tr.dimParam)),null!=tr.denotation&&(tn.denotation=String(tr.denotation)),tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};return tn.defaults&&(ti.denotation=""),null!=tr.dimValue&&tr.hasOwnProperty("dimValue")&&("number"==typeof tr.dimValue?ti.dimValue=tn.longs===String?String(tr.dimValue):tr.dimValue:ti.dimValue=tn.longs===String?tp.Long.prototype.toString.call(tr.dimValue):tn.longs===Number?new tp.LongBits(tr.dimValue.low>>>0,tr.dimValue.high>>>0).toNumber():tr.dimValue,tn.oneofs&&(ti.value="dimValue")),null!=tr.dimParam&&tr.hasOwnProperty("dimParam")&&(ti.dimParam=tr.dimParam,tn.oneofs&&(ti.value="dimParam")),null!=tr.denotation&&tr.hasOwnProperty("denotation")&&(ti.denotation=tr.denotation),ti},t.prototype.toJSON=function(){return this.constructor.toObject(this,tu.util.toJSONOptions)},t}(),t}(),ts.TypeProto=function(){var tr;function t(tr){if(tr)for(var tn=Object.keys(tr),ti=0;ti>>3){case 1:to.tensorType=tf.onnx.TypeProto.Tensor.decode(tr,tr.uint32());break;case 6:to.denotation=tr.string();break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.tensorType&&tr.hasOwnProperty("tensorType")){var tn=tf.onnx.TypeProto.Tensor.verify(tr.tensorType);if(tn)return"tensorType."+tn}return null!=tr.denotation&&tr.hasOwnProperty("denotation")&&!tp.isString(tr.denotation)?"denotation: string expected":null},t.fromObject=function(tr){if(tr instanceof tf.onnx.TypeProto)return tr;var tn=new tf.onnx.TypeProto;if(null!=tr.tensorType){if("object"!=typeof tr.tensorType)throw TypeError(".onnx.TypeProto.tensorType: object expected");tn.tensorType=tf.onnx.TypeProto.Tensor.fromObject(tr.tensorType)}return null!=tr.denotation&&(tn.denotation=String(tr.denotation)),tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};return tn.defaults&&(ti.denotation=""),null!=tr.tensorType&&tr.hasOwnProperty("tensorType")&&(ti.tensorType=tf.onnx.TypeProto.Tensor.toObject(tr.tensorType,tn),tn.oneofs&&(ti.value="tensorType")),null!=tr.denotation&&tr.hasOwnProperty("denotation")&&(ti.denotation=tr.denotation),ti},t.prototype.toJSON=function(){return this.constructor.toObject(this,tu.util.toJSONOptions)},t.Tensor=function(){function t(tr){if(tr)for(var tn=Object.keys(tr),ti=0;ti>>3){case 1:to.elemType=tr.int32();break;case 2:to.shape=tf.onnx.TensorShapeProto.decode(tr,tr.uint32());break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){if("object"!=typeof tr||null===tr)return"object expected";if(null!=tr.elemType&&tr.hasOwnProperty("elemType")&&!tp.isInteger(tr.elemType))return"elemType: integer expected";if(null!=tr.shape&&tr.hasOwnProperty("shape")){var tn=tf.onnx.TensorShapeProto.verify(tr.shape);if(tn)return"shape."+tn}return null},t.fromObject=function(tr){if(tr instanceof tf.onnx.TypeProto.Tensor)return tr;var tn=new tf.onnx.TypeProto.Tensor;if(null!=tr.elemType&&(tn.elemType=0|tr.elemType),null!=tr.shape){if("object"!=typeof tr.shape)throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");tn.shape=tf.onnx.TensorShapeProto.fromObject(tr.shape)}return tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};return tn.defaults&&(ti.elemType=0,ti.shape=null),null!=tr.elemType&&tr.hasOwnProperty("elemType")&&(ti.elemType=tr.elemType),null!=tr.shape&&tr.hasOwnProperty("shape")&&(ti.shape=tf.onnx.TensorShapeProto.toObject(tr.shape,tn)),ti},t.prototype.toJSON=function(){return this.constructor.toObject(this,tu.util.toJSONOptions)},t}(),t}(),ts.OperatorSetIdProto=function(){function t(tr){if(tr)for(var tn=Object.keys(tr),ti=0;ti>>3){case 1:to.domain=tr.string();break;case 2:to.version=tr.int64();break;default:tr.skipType(7&ta)}}return to},t.decodeDelimited=function(tr){return tr instanceof tl||(tr=new tl(tr)),this.decode(tr,tr.uint32())},t.verify=function(tr){return"object"!=typeof tr||null===tr?"object expected":null!=tr.domain&&tr.hasOwnProperty("domain")&&!tp.isString(tr.domain)?"domain: string expected":null!=tr.version&&tr.hasOwnProperty("version")&&!(tp.isInteger(tr.version)||tr.version&&tp.isInteger(tr.version.low)&&tp.isInteger(tr.version.high))?"version: integer|Long expected":null},t.fromObject=function(tr){if(tr instanceof tf.onnx.OperatorSetIdProto)return tr;var tn=new tf.onnx.OperatorSetIdProto;return null!=tr.domain&&(tn.domain=String(tr.domain)),null!=tr.version&&(tp.Long?(tn.version=tp.Long.fromValue(tr.version)).unsigned=!1:"string"==typeof tr.version?tn.version=parseInt(tr.version,10):"number"==typeof tr.version?tn.version=tr.version:"object"==typeof tr.version&&(tn.version=new tp.LongBits(tr.version.low>>>0,tr.version.high>>>0).toNumber())),tn},t.toObject=function(tr,tn){tn||(tn={});var ti={};if(tn.defaults){if(ti.domain="",tp.Long){var to=new tp.Long(0,0,!1);ti.version=tn.longs===String?to.toString():tn.longs===Number?to.toNumber():to}else ti.version=tn.longs===String?"0":0}return null!=tr.domain&&tr.hasOwnProperty("domain")&&(ti.domain=tr.domain),null!=tr.version&&tr.hasOwnProperty("version")&&("number"==typeof tr.version?ti.version=tn.longs===String?String(tr.version):tr.version:ti.version=tn.longs===String?tp.Long.prototype.toString.call(tr.version):tn.longs===Number?new tp.LongBits(tr.version.low>>>0,tr.version.high>>>0).toNumber():tr.version),ti},t.prototype.toJSON=function(){return this.constructor.toObject(this,tu.util.toJSONOptions)},t}(),ts),tr.exports=tf},2100:(tr,tn,ti)=>{"use strict";tr.exports=ti(9482)},9482:(tr,tn,ti)=>{"use strict";var to=tn;function i(){to.util._configure(),to.Writer._configure(to.BufferWriter),to.Reader._configure(to.BufferReader)}to.build="minimal",to.Writer=ti(1173),to.BufferWriter=ti(3155),to.Reader=ti(1408),to.BufferReader=ti(593),to.util=ti(9693),to.rpc=ti(5994),to.roots=ti(5054),to.configure=i,i()},1408:(tr,tn,ti)=>{"use strict";tr.exports=u;var to,ta=ti(9693),ts=ta.LongBits,tu=ta.utf8;function s(tr,tn){return RangeError("index out of range: "+tr.pos+" + "+(tn||1)+" > "+tr.len)}function u(tr){this.buf=tr,this.pos=0,this.len=tr.length}var tl,tc="undefined"!=typeof Uint8Array?function(tr){if(tr instanceof Uint8Array||Array.isArray(tr))return new u(tr);throw Error("illegal buffer")}:function(tr){if(Array.isArray(tr))return new u(tr);throw Error("illegal buffer")},p=function(){return ta.Buffer?function(tr){return(u.create=function(tr){return ta.Buffer.isBuffer(tr)?new to(tr):tc(tr)})(tr)}:tc};function f(){var tr=new ts(0,0),tn=0;if(!(this.len-this.pos>4)){for(;tn<3;++tn){if(this.pos>=this.len)throw s(this);if(tr.lo=(tr.lo|(127&this.buf[this.pos])<<7*tn)>>>0,this.buf[this.pos++]<128)return tr}return tr.lo=(tr.lo|(127&this.buf[this.pos++])<<7*tn)>>>0,tr}for(;tn<4;++tn)if(tr.lo=(tr.lo|(127&this.buf[this.pos])<<7*tn)>>>0,this.buf[this.pos++]<128)return tr;if(tr.lo=(tr.lo|(127&this.buf[this.pos])<<28)>>>0,tr.hi=(tr.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return tr;if(tn=0,this.len-this.pos>4){for(;tn<5;++tn)if(tr.hi=(tr.hi|(127&this.buf[this.pos])<<7*tn+3)>>>0,this.buf[this.pos++]<128)return tr}else for(;tn<5;++tn){if(this.pos>=this.len)throw s(this);if(tr.hi=(tr.hi|(127&this.buf[this.pos])<<7*tn+3)>>>0,this.buf[this.pos++]<128)return tr}throw Error("invalid varint encoding")}function d(tr,tn){return(tr[tn-4]|tr[tn-3]<<8|tr[tn-2]<<16|tr[tn-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw s(this,8);return new ts(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}u.create=p(),u.prototype._slice=ta.Array.prototype.subarray||ta.Array.prototype.slice,u.prototype.uint32=(tl=4294967295,function(){if(tl=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(tl=(tl|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(tl=(tl|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(tl=(tl|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(tl=(tl|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return tl;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return tl}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var tr=this.uint32();return tr>>>1^-(1&tr)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return d(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|d(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var tr=ta.float.readFloatLE(this.buf,this.pos);return this.pos+=4,tr},u.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var tr=ta.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,tr},u.prototype.bytes=function(){var tr=this.uint32(),tn=this.pos,ti=this.pos+tr;if(ti>this.len)throw s(this,tr);return this.pos+=tr,Array.isArray(this.buf)?this.buf.slice(tn,ti):tn===ti?new this.buf.constructor(0):this._slice.call(this.buf,tn,ti)},u.prototype.string=function(){var tr=this.bytes();return tu.read(tr,0,tr.length)},u.prototype.skip=function(tr){if("number"==typeof tr){if(this.pos+tr>this.len)throw s(this,tr);this.pos+=tr}else do if(this.pos>=this.len)throw s(this);while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(tr){switch(tr){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(tr=7&this.uint32());)this.skipType(tr);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+tr+" at offset "+this.pos)}return this},u._configure=function(tr){to=tr,u.create=p(),to._configure();var tn=ta.Long?"toLong":"toNumber";ta.merge(u.prototype,{int64:function(){return f.call(this)[tn](!1)},uint64:function(){return f.call(this)[tn](!0)},sint64:function(){return f.call(this).zzDecode()[tn](!1)},fixed64:function(){return h.call(this)[tn](!0)},sfixed64:function(){return h.call(this)[tn](!1)}})}},593:(tr,tn,ti)=>{"use strict";tr.exports=o;var to=ti(1408);(o.prototype=Object.create(to.prototype)).constructor=o;var ta=ti(9693);function o(tr){to.call(this,tr)}o._configure=function(){ta.Buffer&&(o.prototype._slice=ta.Buffer.prototype.slice)},o.prototype.string=function(){var tr=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+tr,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+tr,this.len))},o._configure()},5054:tr=>{"use strict";tr.exports={}},5994:(tr,tn,ti)=>{"use strict";tn.Service=ti(7948)},7948:(tr,tn,ti)=>{"use strict";tr.exports=i;var to=ti(9693);function i(tr,tn,ti){if("function"!=typeof tr)throw TypeError("rpcImpl must be a function");to.EventEmitter.call(this),this.rpcImpl=tr,this.requestDelimited=!!tn,this.responseDelimited=!!ti}(i.prototype=Object.create(to.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function t(tr,tn,ti,ta,ts){if(!ta)throw TypeError("request must be specified");var tu=this;if(!ts)return to.asPromise(t,tu,tr,tn,ti,ta);if(tu.rpcImpl)try{return tu.rpcImpl(tr,tn[tu.requestDelimited?"encodeDelimited":"encode"](ta).finish(),function(tn,to){if(tn)return tu.emit("error",tn,tr),ts(tn);if(null!==to){if(!(to instanceof ti))try{to=ti[tu.responseDelimited?"decodeDelimited":"decode"](to)}catch(tn){return tu.emit("error",tn,tr),ts(tn)}return tu.emit("data",to,tr),ts(null,to)}tu.end(!0)})}catch(tn){return tu.emit("error",tn,tr),void setTimeout(function(){ts(tn)},0)}else setTimeout(function(){ts(Error("already ended"))},0)},i.prototype.end=function(tr){return this.rpcImpl&&(tr||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(tr,tn,ti)=>{"use strict";tr.exports=i;var to=ti(9693);function i(tr,tn){this.lo=tr>>>0,this.hi=tn>>>0}var ta=i.zero=new i(0,0);ta.toNumber=function(){return 0},ta.zzEncode=ta.zzDecode=function(){return this},ta.length=function(){return 1};var ts=i.zeroHash="\x00\x00\x00\x00\x00\x00\x00\x00";i.fromNumber=function(tr){if(0===tr)return ta;var tn=tr<0;tn&&(tr=-tr);var ti=tr>>>0,to=(tr-ti)/4294967296>>>0;return tn&&(to=~to>>>0,ti=~ti>>>0,++ti>4294967295&&(ti=0,++to>4294967295&&(to=0))),new i(ti,to)},i.from=function(tr){if("number"==typeof tr)return i.fromNumber(tr);if(to.isString(tr)){if(!to.Long)return i.fromNumber(parseInt(tr,10));tr=to.Long.fromString(tr)}return tr.low||tr.high?new i(tr.low>>>0,tr.high>>>0):ta},i.prototype.toNumber=function(tr){if(!tr&&this.hi>>>31){var tn=1+~this.lo>>>0,ti=~this.hi>>>0;return tn||(ti=ti+1>>>0),-(tn+4294967296*ti)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(tr){return to.Long?new to.Long(0|this.lo,0|this.hi,!!tr):{low:0|this.lo,high:0|this.hi,unsigned:!!tr}};var tu=String.prototype.charCodeAt;i.fromHash=function(tr){return tr===ts?ta:new i((tu.call(tr,0)|tu.call(tr,1)<<8|tu.call(tr,2)<<16|tu.call(tr,3)<<24)>>>0,(tu.call(tr,4)|tu.call(tr,5)<<8|tu.call(tr,6)<<16|tu.call(tr,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var tr=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^tr)>>>0,this.lo=(this.lo<<1^tr)>>>0,this},i.prototype.zzDecode=function(){var tr=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^tr)>>>0,this.hi=(this.hi>>>1^tr)>>>0,this},i.prototype.length=function(){var tr=this.lo,tn=(this.lo>>>28|this.hi<<4)>>>0,ti=this.hi>>>24;return 0===ti?0===tn?tr<16384?tr<128?1:2:tr<2097152?3:4:tn<16384?tn<128?5:6:tn<2097152?7:8:ti<128?9:10}},9693:function(tr,tn,ti){"use strict";var to=tn;function i(tr,tn,ti){for(var to=Object.keys(tn),ta=0;ta0)},to.Buffer=function(){try{var tr=to.inquire("buffer").Buffer;return tr.prototype.utf8Write?tr:null}catch(tr){return null}}(),to._Buffer_from=null,to._Buffer_allocUnsafe=null,to.newBuffer=function(tr){return"number"==typeof tr?to.Buffer?to._Buffer_allocUnsafe(tr):new to.Array(tr):to.Buffer?to._Buffer_from(tr):"undefined"==typeof Uint8Array?tr:new Uint8Array(tr)},to.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,to.Long=to.global.dcodeIO&&to.global.dcodeIO.Long||to.global.Long||to.inquire("long"),to.key2Re=/^true|false|0|1$/,to.key32Re=/^-?(?:0|[1-9][0-9]*)$/,to.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,to.longToHash=function(tr){return tr?to.LongBits.from(tr).toHash():to.LongBits.zeroHash},to.longFromHash=function(tr,tn){var ti=to.LongBits.fromHash(tr);return to.Long?to.Long.fromBits(ti.lo,ti.hi,tn):ti.toNumber(!!tn)},to.merge=i,to.lcFirst=function(tr){return tr.charAt(0).toLowerCase()+tr.substring(1)},to.newError=o,to.ProtocolError=o("ProtocolError"),to.oneOfGetter=function(tr){for(var tn={},ti=0;ti-1;--ti)if(1===tn[tr[ti]]&&void 0!==this[tr[ti]]&&null!==this[tr[ti]])return tr[ti]}},to.oneOfSetter=function(tr){return function(tn){for(var ti=0;ti{"use strict";tr.exports=p;var to,ta=ti(9693),ts=ta.LongBits,tu=ta.base64,tl=ta.utf8;function u(tr,tn,ti){this.fn=tr,this.len=tn,this.next=void 0,this.val=ti}function c(){}function l(tr){this.head=tr.head,this.tail=tr.tail,this.len=tr.len,this.next=tr.states}function p(){this.len=0,this.head=new u(c,0,0),this.tail=this.head,this.states=null}var f=function(){return ta.Buffer?function(){return(p.create=function(){return new to})()}:function(){return new p}};function d(tr,tn,ti){tn[ti]=255&tr}function h(tr,tn){this.len=tr,this.next=void 0,this.val=tn}function g(tr,tn,ti){for(;tr.hi;)tn[ti++]=127&tr.lo|128,tr.lo=(tr.lo>>>7|tr.hi<<25)>>>0,tr.hi>>>=7;for(;tr.lo>127;)tn[ti++]=127&tr.lo|128,tr.lo=tr.lo>>>7;tn[ti++]=tr.lo}function b(tr,tn,ti){tn[ti]=255&tr,tn[ti+1]=tr>>>8&255,tn[ti+2]=tr>>>16&255,tn[ti+3]=tr>>>24}p.create=f(),p.alloc=function(tr){return new ta.Array(tr)},ta.Array!==Array&&(p.alloc=ta.pool(p.alloc,ta.Array.prototype.subarray)),p.prototype._push=function(tr,tn,ti){return this.tail=this.tail.next=new u(tr,tn,ti),this.len+=tn,this},h.prototype=Object.create(u.prototype),h.prototype.fn=function(tr,tn,ti){for(;tr>127;)tn[ti++]=127&tr|128,tr>>>=7;tn[ti]=tr},p.prototype.uint32=function(tr){return this.len+=(this.tail=this.tail.next=new h((tr>>>=0)<128?1:tr<16384?2:tr<2097152?3:tr<268435456?4:5,tr)).len,this},p.prototype.int32=function(tr){return tr<0?this._push(g,10,ts.fromNumber(tr)):this.uint32(tr)},p.prototype.sint32=function(tr){return this.uint32((tr<<1^tr>>31)>>>0)},p.prototype.uint64=function(tr){var tn=ts.from(tr);return this._push(g,tn.length(),tn)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(tr){var tn=ts.from(tr).zzEncode();return this._push(g,tn.length(),tn)},p.prototype.bool=function(tr){return this._push(d,1,tr?1:0)},p.prototype.fixed32=function(tr){return this._push(b,4,tr>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(tr){var tn=ts.from(tr);return this._push(b,4,tn.lo)._push(b,4,tn.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(tr){return this._push(ta.float.writeFloatLE,4,tr)},p.prototype.double=function(tr){return this._push(ta.float.writeDoubleLE,8,tr)};var tc=ta.Array.prototype.set?function(tr,tn,ti){tn.set(tr,ti)}:function(tr,tn,ti){for(var to=0;to>>0;if(!tn)return this._push(d,1,0);if(ta.isString(tr)){var ti=p.alloc(tn=tu.length(tr));tu.decode(tr,ti,0),tr=ti}return this.uint32(tn)._push(tc,tn,tr)},p.prototype.string=function(tr){var tn=tl.length(tr);return tn?this.uint32(tn)._push(tl.write,tn,tr):this._push(d,1,0)},p.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new u(c,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(c,0,0),this.len=0),this},p.prototype.ldelim=function(){var tr=this.head,tn=this.tail,ti=this.len;return this.reset().uint32(ti),ti&&(this.tail.next=tr.next,this.tail=tn,this.len+=ti),this},p.prototype.finish=function(){for(var tr=this.head.next,tn=this.constructor.alloc(this.len),ti=0;tr;)tr.fn(tr.val,tn,ti),ti+=tr.len,tr=tr.next;return tn},p._configure=function(tr){to=tr,p.create=f(),to._configure()}},3155:(tr,tn,ti)=>{"use strict";tr.exports=o;var to=ti(1173);(o.prototype=Object.create(to.prototype)).constructor=o;var ta=ti(9693);function o(){to.call(this)}function a(tr,tn,ti){tr.length<40?ta.utf8.write(tr,tn,ti):tn.utf8Write?tn.utf8Write(tr,ti):tn.write(tr,ti)}o._configure=function(){o.alloc=ta._Buffer_allocUnsafe,o.writeBytesBuffer=ta.Buffer&&ta.Buffer.prototype instanceof Uint8Array&&"set"===ta.Buffer.prototype.set.name?function(tr,tn,ti){tn.set(tr,ti)}:function(tr,tn,ti){if(tr.copy)tr.copy(tn,ti,0,tr.length);else for(var to=0;to>>0;return this.uint32(tn),tn&&this._push(o.writeBytesBuffer,tn,tr),this},o.prototype.string=function(tr){var tn=ta.Buffer.byteLength(tr);return this.uint32(tn),tn&&this._push(a,tn,tr),this},o._configure()},7714:(tr,tn,ti)=>{"use strict";tn.R=void 0;let to=ti(6919),ta=ti(7448);tn.R=new class{async init(){}async createSessionHandler(tr,tn){let ti=new to.Session(tn);return await ti.loadModel(tr),new ta.OnnxjsSessionHandler(ti)}}},4200:(tr,tn,ti)=>{"use strict";tn.c8=tn.rX=void 0;let to=ti(1670),ta=ti(5381),ts=ti(2157),tu=ti(2306);tn.rX=()=>{if(("number"!=typeof to.env.wasm.initTimeout||to.env.wasm.initTimeout<0)&&(to.env.wasm.initTimeout=0),"boolean"!=typeof to.env.wasm.simd&&(to.env.wasm.simd=!0),"boolean"!=typeof to.env.wasm.proxy&&(to.env.wasm.proxy=!1),"number"!=typeof to.env.wasm.numThreads||!Number.isInteger(to.env.wasm.numThreads)||to.env.wasm.numThreads<=0){let tr="undefined"==typeof navigator?(0,ta.cpus)().length:navigator.hardwareConcurrency;to.env.wasm.numThreads=Math.min(4,Math.ceil((tr||1)/2))}},tn.c8=new class{async init(){(0,tn.rX)(),await (0,ts.initWasm)()}async createSessionHandler(tr,tn){let ti=new tu.OnnxruntimeWebAssemblySessionHandler;return await ti.loadModel(tr,tn),Promise.resolve(ti)}}},6018:function(tr,tn,ti){"use strict";var to=this&&this.__createBinding||(Object.create?function(tr,tn,ti,to){void 0===to&&(to=ti);var ta=Object.getOwnPropertyDescriptor(tn,ti);ta&&!("get"in ta?!tn.__esModule:ta.writable||ta.configurable)||(ta={enumerable:!0,get:function(){return tn[ti]}}),Object.defineProperty(tr,to,ta)}:function(tr,tn,ti,to){void 0===to&&(to=ti),tr[to]=tn[ti]}),ta=this&&this.__exportStar||function(tr,tn){for(var ti in tr)"default"===ti||Object.prototype.hasOwnProperty.call(tn,ti)||to(tn,tr,ti)};Object.defineProperty(tn,"__esModule",{value:!0}),ta(ti(1670),tn);let ts=ti(1670);{let tr=ti(7714).R;(0,ts.registerBackend)("webgl",tr,-10)}{let tr=ti(4200).c8;(0,ts.registerBackend)("cpu",tr,10),(0,ts.registerBackend)("wasm",tr,10),(0,ts.registerBackend)("xnnpack",tr,9)}},246:(tr,tn)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createAttributeWithCacheKey=void 0;let n=class n{constructor(tr){Object.assign(this,tr)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(tr=>`${this[tr]}`).join(";")),this._cacheKey}};tn.createAttributeWithCacheKey=tr=>new n(tr)},7778:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.Attribute=void 0;let to=ti(1446),ta=ti(9395),ts=ti(9162),tu=ti(2517);var tl=ta.onnxruntime.experimental.fbs;let u=class u{constructor(tr){if(this._attributes=new Map,null!=tr){for(let tn of tr)tn instanceof to.onnx.AttributeProto?this._attributes.set(tn.name,[u.getValue(tn),u.getType(tn)]):tn instanceof tl.Attribute&&this._attributes.set(tn.name(),[u.getValue(tn),u.getType(tn)]);if(this._attributes.sizets.Tensor.fromProto(tr));if(tr instanceof tl.Attribute)return ti.map(tr=>ts.Tensor.fromOrtTensor(tr))}if(tn===to.onnx.AttributeProto.AttributeType.STRING&&tr instanceof to.onnx.AttributeProto){let tr=ti;return(0,tu.decodeUtf8String)(tr)}return tn===to.onnx.AttributeProto.AttributeType.STRINGS&&tr instanceof to.onnx.AttributeProto?ti.map(tu.decodeUtf8String):ti}static getValueNoCheck(tr){return tr instanceof to.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(tr):this.getValueNoCheckFromOrtFormat(tr)}static getValueNoCheckFromOnnxFormat(tr){switch(tr.type){case to.onnx.AttributeProto.AttributeType.FLOAT:return tr.f;case to.onnx.AttributeProto.AttributeType.INT:return tr.i;case to.onnx.AttributeProto.AttributeType.STRING:return tr.s;case to.onnx.AttributeProto.AttributeType.TENSOR:return tr.t;case to.onnx.AttributeProto.AttributeType.GRAPH:return tr.g;case to.onnx.AttributeProto.AttributeType.FLOATS:return tr.floats;case to.onnx.AttributeProto.AttributeType.INTS:return tr.ints;case to.onnx.AttributeProto.AttributeType.STRINGS:return tr.strings;case to.onnx.AttributeProto.AttributeType.TENSORS:return tr.tensors;case to.onnx.AttributeProto.AttributeType.GRAPHS:return tr.graphs;default:throw Error(`unsupported attribute type: ${to.onnx.AttributeProto.AttributeType[tr.type]}`)}}static getValueNoCheckFromOrtFormat(tr){switch(tr.type()){case tl.AttributeType.FLOAT:return tr.f();case tl.AttributeType.INT:return tr.i();case tl.AttributeType.STRING:return tr.s();case tl.AttributeType.TENSOR:return tr.t();case tl.AttributeType.GRAPH:return tr.g();case tl.AttributeType.FLOATS:return tr.floatsArray();case tl.AttributeType.INTS:{let tn=[];for(let ti=0;ti{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.resolveBackend=tn.backend=void 0;let to=ti(5038),ta=new Map;async function o(tr){let ti=tn.backend;if(void 0!==ti[tr]&&function(tr){let tn=tr;return"initialize"in tn&&"function"==typeof tn.initialize&&"createSessionHandler"in tn&&"function"==typeof tn.createSessionHandler&&"dispose"in tn&&"function"==typeof tn.dispose}(ti[tr])){let tn=ti[tr],to=tn.initialize();if("object"==typeof to&&"then"in to&&(to=await to),to)return ta.set(tr,tn),tn}}tn.backend={webgl:new to.WebGLBackend},tn.resolveBackend=async function t(tr){if(!tr)return t(["webgl"]);{let tn="string"==typeof tr?[tr]:tr;for(let tr of tn){let tn=ta.get(tr);if(tn)return tn;let ti=await o(tr);if(ti)return ti}}throw Error("no available backend to use")}},5038:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.WebGLBackend=void 0;let to=ti(1670),ta=ti(6231),ts=ti(6416),tu=ti(7305);tn.WebGLBackend=class{get contextId(){return to.env.webgl.contextId}set contextId(tr){to.env.webgl.contextId=tr}get matmulMaxBatchSize(){return to.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(tr){to.env.webgl.matmulMaxBatchSize=tr}get textureCacheMode(){return to.env.webgl.textureCacheMode}set textureCacheMode(tr){to.env.webgl.textureCacheMode=tr}get pack(){return to.env.webgl.pack}set pack(tr){to.env.webgl.pack=tr}get async(){return to.env.webgl.async}set async(tr){to.env.webgl.async=tr}initialize(){try{return this.glContext=(0,tu.createWebGLContext)(this.contextId),"number"!=typeof this.matmulMaxBatchSize&&(this.matmulMaxBatchSize=16),"string"!=typeof this.textureCacheMode&&(this.textureCacheMode="full"),"boolean"!=typeof this.pack&&(this.pack=!1),"boolean"!=typeof this.async&&(this.async=!1),ta.Logger.setWithEnv(to.env),ta.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(tr){return ta.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${tr}`),!1}}createSessionHandler(tr){return new ts.WebGLSessionHandler(this,tr)}dispose(){this.glContext.dispose()}}},5107:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.CoordsGlslLib=void 0;let to=ti(2517),ta=ti(8520),ts=ti(5060),tu=ti(7859),tl=ti(9390);let u=class u extends ta.GlslLib{constructor(tr){super(tr)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new ta.GlslLibRoutine("\n vec2 offsetToCoords(int offset, int width, int height) {\n int t = offset / width;\n int s = offset - t*width;\n vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height);\n return coords;\n }\n ")}}coordsToOffset(){return{coordsToOffset:new ta.GlslLibRoutine("\n int coordsToOffset(vec2 coords, int width, int height) {\n float s = coords.s * float(width);\n float t = coords.t * float(height);\n int offset = int(t) * width + int(s);\n return offset;\n }\n ")}}getOutputSamplingSnippet(){let tr=this.context.outputTextureLayout;return tr.isPacked?this.getPackedOutputSamplingSnippet(tr):this.getUnpackedOutputSamplingSnippet(tr)}getPackedOutputSamplingSnippet(tr){let tn=tr.unpackedShape,ti=[tr.width,tr.height],to={},tu="getOutputCoords";switch(tn.length){case 0:to[tu]=this.getOutputScalarCoords();break;case 1:to[tu]=this.getOutputPacked1DCoords(tn,ti);break;case 2:to[tu]=this.getOutputPacked2DCoords(tn,ti);break;case 3:to[tu]=this.getOutputPacked3DCoords(tn,ti);break;default:to[tu]=this.getOutputPackedNDCoords(tn,ti)}let tl=` void setOutput(vec4 val) { ${(0,ts.getGlsl)(this.context.glContext.version).output} = val; } `;return to.floatTextureSetRGBA=new ta.GlslLibRoutine(tl),to}getUnpackedOutputSamplingSnippet(tr){let tn=tr.unpackedShape,ti=[tr.width,tr.height],to={},tu="getOutputCoords";switch(tn.length){case 0:to[tu]=this.getOutputScalarCoords();break;case 1:to[tu]=this.getOutputUnpacked1DCoords(tn,ti);break;case 2:to[tu]=this.getOutputUnpacked2DCoords(tn,ti);break;case 3:to[tu]=this.getOutputUnpacked3DCoords(tn,ti);break;case 4:to[tu]=this.getOutputUnpacked4DCoords(tn,ti);break;case 5:to[tu]=this.getOutputUnpacked5DCoords(tn,ti);break;case 6:to[tu]=this.getOutputUnpacked6DCoords(tn,ti);break;default:throw Error(`Unsupported output dimensionality: ${tn.length}`)}let tl=` void setOutput(float val) { ${(0,ts.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); } `;return to.floatTextureSetR=new ta.GlslLibRoutine(tl),to}getOutputScalarCoords(){return new ta.GlslLibRoutine("\n int getOutputCoords() {\n return 0;\n }\n ")}getOutputPacked1DCoords(tr,tn){let ti=tn,to="";return to=1===ti[0]?` int getOutputCoords() { return 2 * int(TexCoords.y * ${ti[1]}.0); } `:1===ti[1]?` int getOutputCoords() { return 2 * int(TexCoords.x * ${ti[0]}.0); } `:` int getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${ti[0]}, ${ti[1]})); return 2 * (resTexRC.y * ${ti[0]} + resTexRC.x); } `,new ta.GlslLibRoutine(to)}getOutputPacked2DCoords(tr,tn){let ti="";if(to.ArrayUtil.arraysEqual(tr,tn))return ti=` ivec2 getOutputCoords() { return 2 * ivec2(TexCoords.xy * vec2(${tn[0]}, ${tn[1]})); } `,new ta.GlslLibRoutine(ti);let ts=tn,tu=Math.ceil(tr[1]/2);return ti=` ivec2 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${ts[0]}, ${ts[1]})); int index = resTexRC.y * ${ts[0]} + resTexRC.x; // reverse r and c order for packed texture int r = imod(index, ${tu}) * 2; int c = 2 * (index / ${tu}); return ivec2(r, c); } `,new ta.GlslLibRoutine(ti)}getOutputPacked3DCoords(tr,tn){let ti=[tn[0],tn[1]],to=Math.ceil(tr[2]/2),ts=to*Math.ceil(tr[1]/2),tu=` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${ti[0]}, ${ti[1]})); int index = resTexRC.y * ${ti[0]} + resTexRC.x; int b = index / ${ts}; index -= b * ${ts}; // reverse r and c order for packed texture int r = imod(index, ${to}) * 2; int c = 2 * (index / ${to}); return ivec3(b, r, c); } `;return new ta.GlslLibRoutine(tu)}getOutputPackedNDCoords(tr,tn){let ti=[tn[0],tn[1]],to=Math.ceil(tr[tr.length-1]/2),ts=to*Math.ceil(tr[tr.length-2]/2),tu=ts,tl="",tc="b, r, c";for(let tn=2;tn=0;--tn)ts[tn]=ts[tn+1]*tr[tn+1];let tu=["r","c","d"],tl=ts.map((tr,tn)=>`int ${tu[tn]} = index / ${tr}; ${tn===ts.length-1?`int ${tu[tn+1]} = index - ${tu[tn]} * ${tr}`:`index -= ${tu[tn]} * ${tr}`};`).join("");return ti=` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${tn[0]}, ${tn[1]})); int index = resTexRC.y * ${tn[0]} + resTexRC.x; ${tl} return ivec3(r, c, d); } `,new ta.GlslLibRoutine(ti)}getOutputUnpacked4DCoords(tr,tn){let ti="",to=tr.length,ts=null;to<2&&(ts=[]),(ts=Array(to-1))[to-2]=tr[to-1];for(let tn=to-3;tn>=0;--tn)ts[tn]=ts[tn+1]*tr[tn+1];let tu=["r","c","d","d2"],tl=ts.map((tr,tn)=>`int ${tu[tn]} = index / ${tr}; ${tn===ts.length-1?`int ${tu[tn+1]} = index - ${tu[tn]} * ${tr}`:`index -= ${tu[tn]} * ${tr}`};`).join("");return ti=` ivec4 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${tn[0]}, ${tn[1]})); int index = resTexRC.y * ${tn[0]} + resTexRC.x; ${tl} return ivec4(r, c, d, d2); } `,new ta.GlslLibRoutine(ti)}getOutputUnpacked5DCoords(tr,tn){let ti="",to=tr.length,ts=null;to<2&&(ts=[]),(ts=Array(to-1))[to-2]=tr[to-1];for(let tn=to-3;tn>=0;--tn)ts[tn]=ts[tn+1]*tr[tn+1];let tu=["r","c","d","d2","d3"],tl=ts.map((tr,tn)=>`int ${tu[tn]} = index / ${tr}; ${tn===ts.length-1?`int ${tu[tn+1]} = index - ${tu[tn]} * ${tr}`:`index -= ${tu[tn]} * ${tr}`};`).join("");return ti=` ivec5 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${tn[0]}, ${tn[1]})); int index = resTexRC.y * ${tn[0]} + resTexRC.x; ${tl} return ivec5(r, c, d, d2, d3); } `,new ta.GlslLibRoutine(ti)}getOutputUnpacked6DCoords(tr,tn){let ti="",to=tr.length,ts=null;to<2&&(ts=[]),(ts=Array(to-1))[to-2]=tr[to-1];for(let tn=to-3;tn>=0;--tn)ts[tn]=ts[tn+1]*tr[tn+1];let tu=["r","c","d","d2","d3","d4"],tl=ts.map((tr,tn)=>`int ${tu[tn]} = index / ${tr}; ${tn===ts.length-1?`int ${tu[tn+1]} = index - ${tu[tn]} * ${tr}`:`index -= ${tu[tn]} * ${tr}`};`).join("");return ti=` ivec6 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${tn[0]}, ${tn[1]})); int index = resTexRC.y * ${tn[0]} + resTexRC.x; ${tl} return ivec6(r, c, d, d2, d3, d4); } `,new ta.GlslLibRoutine(ti)}getCommonUtilFuncs(){let tr={},tn="uvFromFlat";tr[tn]=new ta.GlslLibRoutine("\n vec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texC = index / texNumR;\n int texR = index - texC * texNumR;\n // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to\n // v.\n return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC);\n }\n "),tr[tn="packedUVfrom1D"]=new ta.GlslLibRoutine("\n vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n "),tr[tn="packedUVfrom2D"]=new ta.GlslLibRoutine("\n vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n "),tr[tn="packedUVfrom3D"]=new ta.GlslLibRoutine("\n vec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n "),tn="sampleTexture";let ti=(0,ts.getGlsl)(this.context.glContext.version);return tr[tn]=new ta.GlslLibRoutine(` float sampleTexture(sampler2D textureSampler, vec2 uv) { return ${ti.texture2D}(textureSampler, uv).r; }`),tr}getInputsSamplingSnippets(){let tr={},tn=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((ti,to)=>{let ta=this.context.inputTextureLayouts[to],ts=(0,tl.generateShaderFuncNameFromInputSamplerName)(ti);ta.isPacked?tr[ts]=this.getPackedSamplerFromInput(ts,ti,ta):tr[ts]=this.getUnpackedSamplerFromInput(ts,ti,ta);let tu=(0,tl.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(ti);ta.unpackedShape.length<=tn.unpackedShape.length&&(ta.isPacked?tr[tu]=this.getPackedSamplerAtOutputCoords(tu,ta,tn,ti):tr[tu]=this.getUnpackedSamplerAtOutputCoords(tu,ta,tn,ti))}),tr}getPackedSamplerAtOutputCoords(tr,tn,ti,ts){let tu;let tc=tn.unpackedShape,tp=ti.unpackedShape,tf=ts,td=(0,tl.generateShaderFuncNameFromInputSamplerName)(tf),th=tc.length,tg=tp.length,tb=to.BroadcastUtil.getBroadcastDims(tc,tp),tm=(0,tl.getCoordsDataType)(tg),ty=tg-th,t_=(0,tl.getGlChannels)();tu=0===th?"":tg<2&&tb.length>=1?"coords = 0;":tb.map(tr=>`coords.${t_[tr+ty]} = 0;`).join("\n");let tv="";tv=tg<2&&th>0?"coords":tc.map((tr,tn)=>`coords.${t_[tn+ty]}`).join(", ");let tx="return outputValue;",tw=1===to.ShapeUtil.size(tc),tT=1===to.ShapeUtil.size(tp);if(1!==th||tw||tT){if(tw&&!tT)tx=1===tg?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(tb.length){let tr=th-2,tn=th-1;tb.indexOf(tr)>-1&&tb.indexOf(tn)>-1?tx="return vec4(outputValue.x);":tb.indexOf(tr)>-1?tx="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":tb.indexOf(tn)>-1&&(tx="return vec4(outputValue.xx, outputValue.zz);")}}else tx="\n return vec4(outputValue.xy, outputValue.xy);\n ";let tS=` vec4 ${tr}() { ${tm} coords = getOutputCoords(); int lastDim = coords.${t_[tg-1]}; coords.${t_[tg-1]} = coords.${t_[tg-2]}; coords.${t_[tg-2]} = lastDim; ${tu} vec4 outputValue = ${td}(${tv}); ${tx} } `;return new ta.GlslLibRoutine(tS,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(tr,tn,ti,ts){let tu;let tc=[ti.width,ti.height],tp=[tn.width,tn.height],tf=tn.unpackedShape.length,td=ti.unpackedShape.length,th=tn.unpackedShape,tg=ti.unpackedShape,tb=(0,tl.generateShaderFuncNameFromInputSamplerName)(ts);if(tf===td&&to.ArrayUtil.arraysEqual(tp,tc)){let tn=` float ${tr}() { return sampleTexture(${ts}, TexCoords); } `;return new ta.GlslLibRoutine(tn,["coordinates.sampleTexture"])}let tm=(0,tl.getCoordsDataType)(td),ty=to.BroadcastUtil.getBroadcastDims(th,tg),t_=td-tf,tv=(0,tl.getGlChannels)();tu=0===tf?"":td<2&&ty.length>=1?"coords = 0;":ty.map(tr=>`coords.${tv[tr+t_]} = 0;`).join("\n");let tx="";tx=td<2&&tf>0?"coords":tn.unpackedShape.map((tr,tn)=>`coords.${tv[tn+t_]}`).join(", ");let tw=` float ${tr}() { ${tm} coords = getOutputCoords(); ${tu} return ${tb}(${tx}); } `;return new ta.GlslLibRoutine(tw,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(tr,tn,ti){switch(ti.unpackedShape.length){case 0:return this.getPackedSamplerScalar(tr,tn);case 1:return this.getPackedSampler1D(tr,tn,ti);case 2:return this.getPackedSampler2D(tr,tn,ti);case 3:return this.getPackedSampler3D(tr,tn,ti);default:return this.getPackedSamplerND(tr,tn,ti)}}getUnpackedSamplerFromInput(tr,tn,ti){let to=ti.unpackedShape;switch(to.length){case 0:return this.getUnpackedSamplerScalar(tr,tn,ti);case 1:return this.getUnpackedSampler1D(tr,tn,ti);case 2:return this.getUnpackedSampler2D(tr,tn,ti);case 3:return this.getUnpackedSampler3D(tr,tn,ti);case 4:return this.getUnpackedSampler4D(tr,tn,ti);case 5:return this.getUnpackedSampler5D(tr,tn,ti);case 6:return this.getUnpackedSampler6D(tr,tn,ti);default:throw Error(`Unsupported dimension ${to.length}-D`)}}getPackedSamplerScalar(tr,tn){let ti=` vec4 ${tr}() { return ${(0,ts.getGlsl)(this.context.glContext.version).texture2D}(${tn}, halfCR); } `;return new ta.GlslLibRoutine(ti)}getPackedSampler1D(tr,tn,ti){let to=[ti.width,ti.height],tu=[to[1],to[0]],tl=(0,ts.getGlsl)(this.context.glContext.version),tc=`vec4 ${tr}(int index) { vec2 uv = packedUVfrom1D( ${tu[0]}, ${tu[1]}, index); return ${tl.texture2D}(${tn}, uv); }`;return new ta.GlslLibRoutine(tc,["coordinates.packedUVfrom1D"])}getPackedSampler2D(tr,tn,ti){let tu=ti.unpackedShape,tl=[ti.width,ti.height],tc=(0,ts.getGlsl)(this.context.glContext.version),tp=tl[0],tf=tl[1];if(null!=tl&&to.ArrayUtil.arraysEqual(tu,tl)){let ti=`vec4 ${tr}(int row, int col) { vec2 uv = (vec2(col, row) + halfCR) / vec2(${tf}.0, ${tp}.0); return ${tc.texture2D}(${tn}, uv); }`;return new ta.GlslLibRoutine(ti)}let td=tl,th=Math.ceil(tu[1]/2),tg=`vec4 ${tr}(int row, int col) { vec2 uv = packedUVfrom2D(${td[1]}, ${td[0]}, ${th}, row, col); return ${tc.texture2D}(${tn}, uv); }`;return new ta.GlslLibRoutine(tg,["coordinates.packedUVfrom2D"])}getPackedSampler3D(tr,tn,ti){let to=ti.unpackedShape,tu=[ti.width,ti.height],tc=[tu[0],tu[1]],tp=(0,ts.getGlsl)(this.context.glContext.version);if(1===to[0]){let ts=to.slice(1),tu=[1,2],tc=(0,tl.squeezeInputShape)(to,ts),tp=["b","row","col"],tf=JSON.parse(JSON.stringify(ti));tf.unpackedShape=tc;let td=this.getPackedSamplerFromInput(tr,tn,tf),th=`${td.routineBody} vec4 ${tr}(int b, int row, int col) { return ${tr}(${(0,tl.getSqueezedParams)(tp,tu)}); } `;return new ta.GlslLibRoutine(th,td.dependencies)}let tf=tc[0],td=tc[1],th=Math.ceil(to[2]/2),tg=`vec4 ${tr}(int b, int row, int col) { vec2 uv = packedUVfrom3D( ${td}, ${tf}, ${th*Math.ceil(to[1]/2)}, ${th}, b, row, col); return ${tp.texture2D}(${tn}, uv);}`;return new ta.GlslLibRoutine(tg,["coordinates.packedUVfrom3D"])}getPackedSamplerND(tr,tn,ti){let to=ti.unpackedShape,tu=to.length,tl=[ti.width,ti.height],tc=(0,ts.getGlsl)(this.context.glContext.version),tp=[tl[0],tl[1]],tf=tp[1],td=tp[0],th=Math.ceil(to[tu-1]/2),tg=th*Math.ceil(to[tu-2]/2),tb="int b, int row, int col",tm=`b * ${tg} + (row / 2) * ${th} + (col / 2)`;for(let tr=2;tr{let to=this.context.inputTextureLayouts[ti],ts=(to.unpackedShape.length>0?to.unpackedShape:to.shape).length,tu=`_${tn}`;tr[tu]=new ta.GlslLibRoutine(this.getValueFromSingle(tn,ts,to.width,to.height,!1),[`shapeUtils.indicesToOffset${tu}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),tr[tu+="_T"]=new ta.GlslLibRoutine(this.getValueFromSingle(tn,ts,to.width,to.height,!0),[`shapeUtils.indicesToOffset${tu}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),tr}getValueFromSingle(tr,tn,ti,to,ta){let tu=`_${tr}`;return ta&&(tu+="_T"),` float ${tu}(int m[${tn}]) { int offset = indicesToOffset${tu}(m); vec2 coords = offsetToCoords(offset, ${ti}, ${to}); float value = getColorAsFloat(${(0,ts.getGlsl)(this.context.glContext.version).texture2D}(${tr}, coords)); return value; } `}getPackedValueFrom(tr,tn,ti,to,ta){let tu=`_${tr}_Pack`;return ta&&(tu+="_T"),` vec4 ${tu}(int m[${tn}]) { int offset = indicesToOffset_${tr}(m); vec2 coords = offsetToCoords(offset, ${ti}, ${to}); return ${(0,ts.getGlsl)(this.context.glContext.version).texture2D}(${tr}, coords); } `}};tn.CoordsGlslLib=u},8520:(tr,tn)=>{"use strict";var ti;Object.defineProperty(tn,"__esModule",{value:!0}),tn.TopologicalSortGlslRoutines=tn.GlslLibRoutineNode=tn.GlslLibRoutine=tn.GlslLib=tn.GlslContext=tn.FunctionType=void 0,(ti=tn.FunctionType||(tn.FunctionType={}))[ti.ValueBased=0]="ValueBased",ti[ti.Positional=1]="Positional",tn.GlslContext=class{constructor(tr,tn,ti,to){this.glContext=tr,this.programInfo=tn,this.inputTextureLayouts=ti,this.outputTextureLayout=to}},tn.GlslLib=class{constructor(tr){this.context=tr}},tn.GlslLibRoutine=class{constructor(tr,tn){this.routineBody=tr,this.dependencies=tn}},tn.GlslLibRoutineNode=class{constructor(tr,tn,ti){this.name=tr,this.dependencies=ti||[],tn&&(this.routineBody=tn)}addDependency(tr){tr&&this.dependencies.push(tr)}},tn.TopologicalSortGlslRoutines=class{static returnOrderedNodes(tr){if(!tr||0===tr.length)return[];if(1===tr.length)return tr;let tn=new Set,ti=new Set,to=[];return this.createOrderedNodes(tr,tn,ti,to),to}static createOrderedNodes(tr,tn,ti,to){for(let ta=0;ta0)for(let tr=0;tr{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.EncodingGlslLib=void 0;let to=ti(8520);let i=class i extends to.GlslLib{constructor(tr){super(tr)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new to.GlslLibRoutine("highp vec4 encode(highp float f) {\n return vec4(f, 0.0, 0.0, 0.0);\n }\n ")}}decodeFloat32(){return{decode:new to.GlslLibRoutine("highp float decode(highp vec4 rgba) {\n return rgba.r;\n }\n ")}}encodeUint8(){let tr=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new to.GlslLibRoutine(` highp vec4 encode(highp float f) { highp float F = abs(f); highp float Sign = step(0.0,-f); highp float Exponent = floor(log2(F)); highp float Mantissa = (exp2(- Exponent) * F); Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); highp vec4 rgba; rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); ${tr} rgba = rgba / 255.0; // values need to be normalized to [0,1] return rgba; } `)}}decodeUint8(){let tr=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new to.GlslLibRoutine(` highp float decode(highp vec4 rgba) { rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] ${tr} highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); return Result; } `)}}static isLittleEndian(){let tr=new ArrayBuffer(4),tn=new Uint32Array(tr),ti=new Uint8Array(tr);if(tn[0]=3735928559,239===ti[0])return!0;if(222===ti[0])return!1;throw Error("unknown endianness")}};tn.EncodingGlslLib=i},9894:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.FragColorGlslLib=void 0;let to=ti(8520),ta=ti(5060);let o=class o extends to.GlslLib{constructor(tr){super(tr)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){let tr=(0,ta.getGlsl)(this.context.glContext.version);return{setFragColor:new to.GlslLibRoutine(` void setFragColor(float value) { ${tr.output} = encode(value); } `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new to.GlslLibRoutine("\n float getColorAsFloat(vec4 color) {\n return decode(color);\n }\n ",["encoding.decode"])}}};tn.FragColorGlslLib=o},2848:(tr,tn)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.replaceInlines=void 0;let ti=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;tn.replaceInlines=function(tr){let tn;let to={};for(;null!==(tn=ti.exec(tr));){let tr=tn[3].split(",").map(tr=>{let tn=tr.trim().split(" ");return tn&&2===tn.length?{type:tn[0],name:tn[1]}:null}).filter(tr=>null!==tr);to[tn[2]]={params:tr,body:tn[4]}}for(let ti in to){let ta="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",ti),ts=RegExp(ta,"gm");for(;null!==(tn=ts.exec(tr));){let ta=tn[1],ts=tn[2],tu=tn[3].split(","),tl=ta?`${ta} ${ts};`:"",tc=to[ti].body,tp="";to[ti].params.forEach((tr,tn)=>{tr&&(tp+=`${tr.type} ${tr.name} = ${tu[tn]}; `)}),tc=(tc=`${tp} ${tc}`).replace("return",`${ts} = `);let tf=` ${tl} { ${tc} } `;tr=tr.replace(tn[0],tf)}}return tr.replace(ti,"")}},8879:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.GlslPreprocessor=void 0;let to=ti(8520),ta=ti(2848),ts=ti(5483),tu=ti(5060);tn.GlslPreprocessor=class{constructor(tr,tn,ti,ta){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new to.GlslContext(tr,tn,ti,ta),Object.keys(ts.glslRegistry).forEach(tr=>{let tn=new ts.glslRegistry[tr](this.context);this.libs[tr]=tn});let tu=this.glslLibRoutineDependencyGraph;for(let tr in this.libs){let tn=this.libs[tr].getFunctions();for(let ti in tn){let ta;let ts=tr+"."+ti;tu[ts]?(ta=tu[ts]).routineBody=tn[ti].routineBody:(ta=new to.GlslLibRoutineNode(ts,tn[ti].routineBody),tu[ts]=ta);let tl=tn[ti].dependencies;if(tl)for(let tr=0;tr{let to=ti.split(".")[1];-1!==tr.indexOf(to)&&tn.push(this.glslLibRoutineDependencyGraph[ti])}),to.TopologicalSortGlslRoutines.returnOrderedNodes(tn)}getUniforms(tr,tn){let ti=[];if(tr)for(let tn of tr)ti.push(`uniform sampler2D ${tn};`);if(tn)for(let tr of tn)ti.push(`uniform ${tr.type} ${tr.name}${tr.arrayLength?`[${tr.arrayLength}]`:""};`);return ti.join("\n")}}},5483:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.glslRegistry=void 0;let to=ti(5107),ta=ti(7341),ts=ti(9894),tu=ti(2655),tl=ti(3891);tn.glslRegistry={encoding:ta.EncodingGlslLib,fragcolor:ts.FragColorGlslLib,vec:tl.VecGlslLib,shapeUtils:tu.ShapeUtilsGlslLib,coordinates:to.CoordsGlslLib}},2655:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.ShapeUtilsGlslLib=void 0;let to=ti(8520);let i=class i extends to.GlslLib{constructor(tr){super(tr)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){let tr=this.context.outputTextureLayout.shape.length,tn={};return this.context.programInfo.inputNames.forEach((ti,ta)=>{let ts=this.context.inputTextureLayouts[ta].unpackedShape;if(ts.length<=tr){let ta=ts.length,tu=tr-ta,tl=`bcastIndices_${ti}`,tc="";for(let tr=0;tr{let ts=this.context.inputTextureLayouts[ta].shape;if(!(ts.length<2||ts.length>tr)){let ta=ts.length,tu=tr-ta,tl=`bcastMatmulIndices_${ti}`,tc="";for(let tr=0;tr{let ta=this.context.inputTextureLayouts[ti].shape,ts=this.context.inputTextureLayouts[ti].strides,tu=ta.length,tl=`indicesToOffset_${tn}`;tr[tl]=new to.GlslLibRoutine(i.indexToOffsetSingle(tl,tu,ts)),tr[tl=`indicesToOffset_${tn}_T`]=new to.GlslLibRoutine(i.indexToOffsetSingle(tl,tu,ts.slice().reverse()))}),tr}static indexToOffsetSingle(tr,tn,ti){let to="";for(let tr=tn-1;tr>=0;--tr)to+=` offset += indices[${tr}] * ${ti[tr]}; `;return` int ${tr}(int indices[${tn}]) { int offset = 0; ${to} return offset; } `}offsetToIndices(){let tr={};return this.context.programInfo.inputNames.forEach((tn,ti)=>{let ta=this.context.inputTextureLayouts[ti].shape,ts=this.context.inputTextureLayouts[ti].strides,tu=ta.length,tl=`offsetToIndices_${tn}`;tr[tl]=new to.GlslLibRoutine(i.offsetToIndicesSingle(tl,tu,ts)),tr[tl=`offsetToIndices_${tn}_T`]=new to.GlslLibRoutine(i.offsetToIndicesSingle(tl,tu,ts.slice().reverse()))}),tr}static offsetToIndicesSingle(tr,tn,ti){let to=[];for(let tr=0;tr{let ta=this.context.inputTextureLayouts[ti].shape,ts=ta.length,tu=`incrementIndices_${tn}`,tl="";for(let tr=0;tr= 0; --i) { if(i > axis) continue; indices[i] += 1; if(indices[i] < shape[i]) { break; } indices[i] = 0; } } `;tr[tu]=new to.GlslLibRoutine(tc)}),tr}};tn.ShapeUtilsGlslLib=i},5060:(tr,tn)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.getDefaultFragShaderMain=tn.getFragShaderPreamble=tn.getVertexShaderSource=tn.getGlsl=void 0;let ti={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},to={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function i(tr){return 1===tr?ti:to}tn.getGlsl=i,tn.getVertexShaderSource=function(tr){let tn=i(tr);return`${tn.version} precision highp float; ${tn.attribute} vec3 position; ${tn.attribute} vec2 textureCoord; ${tn.varyingVertex} vec2 TexCoords; void main() { gl_Position = vec4(position, 1.0); TexCoords = textureCoord; }`},tn.getFragShaderPreamble=function(tr){let tn=i(tr);return`${tn.version} precision highp float; precision highp int; precision highp sampler2D; ${tn.varyingFrag} vec2 TexCoords; ${tn.outputDeclaration} const vec2 halfCR = vec2(0.5, 0.5); // Custom vector types to handle higher dimenalities. struct ivec5 { int x; int y; int z; int w; int u; }; struct ivec6 { int x; int y; int z; int w; int u; int v; }; int imod(int x, int y) { return x - y * (x / y); } `},tn.getDefaultFragShaderMain=function(tr,tn){return` void main() { int indices[${tn}]; toVec(TexCoords, indices); vec4 result = vec4(process(indices)); ${i(tr).output} = result; } `}},3891:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.VecGlslLib=void 0;let to=ti(8520);let i=class i extends to.GlslLib{constructor(tr){super(tr)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){let tr=this.context.outputTextureLayout.shape.length,tn={add:"+=",sub:"-=",mul:"*=",div:"/="},ti={};for(let ta in tn){let ts=`${ta}Vec`,tu="";for(let ti=0;ti{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.WebGLInferenceHandler=void 0;let to=ti(6231),ta=ti(9162),ts=ti(2517),tu=ti(2403),tl=ti(7019),tc=ti(8710),tp=ti(5611),tf=ti(4057),td=ti(2039);tn.WebGLInferenceHandler=class{constructor(tr){this.session=tr,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(tr,tn){return(0,tf.calculateTextureWidthAndHeight)(this.session.layoutStrategy,tr,tn)}executeProgram(tr,tn){if(tn.length{let ti=tn.map(tr=>`${tr.unpackedShape.join(",")};${tr.width}x${tr.height}`).join("_"),to=tr.name;return tr.cacheHint&&(to+="["+tr.cacheHint+"]"),to+=":"+ti})(tr,ti),ta=this.session.programManager.getArtifact(to),ts=ta?ta.programInfo:"function"==typeof tr.get?tr.get():tr,tu=(0,tf.createTextureLayoutFromTextureType)(this.session.layoutStrategy,ts.output.dims,ts.output.textureType),tl=this.createTextureData(tu,ts.output.type);return ta||(ta=this.session.programManager.build(ts,ti,tl),this.session.programManager.setArtifact(to,ta)),this.runProgram(ta,ti,tl),tl}run(tr,tn){return this.executeProgram(tr,tn).tensor}runProgram(tr,tn,ti){for(let ti=0;tithis.readTexture(tu),async tr=>this.readTextureAsync(tu),void 0,ts),texture:ti});return this.setTextureData(tu.tensor.dataId,tu,tr.isPacked),tu}getTextureData(tr,tn=!1){return this.session.isInitializer(tr)?this.session.getTextureData(tr,tn):tn?this.packedTextureDataCache.get(tr):this.unpackedTextureDataCache.get(tr)}setTextureData(tr,tn,ti=!1){this.session.isInitializer(tr)?this.session.setTextureData(tr,tn,ti):(ti?this.packedTextureDataCache:this.unpackedTextureDataCache).set(tr,tn)}isTextureLayoutCached(tr,tn=!1){return!!this.getTextureData(tr.dataId,tn)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(tr=>this.session.textureManager.releaseTexture(tr)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(tr=>this.session.textureManager.releaseTexture(tr)),this.unpackedTextureDataCache=new Map}readTexture(tr){return tr.isPacked?this.readTexture(this.unpack(tr)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(tr,tr.tensor.type,tr.channels):this.session.textureManager.readUint8TextureAsFloat((0,tc.encodeAsUint8)(this,tr))}async readTextureAsync(tr){return tr.isPacked?this.readTextureAsync(this.unpack(tr)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(tr,tr.tensor.type,tr.channels):this.session.textureManager.readUint8TextureAsFloat((0,tc.encodeAsUint8)(this,tr))}pack(tr){return this.executeProgram((0,tu.createPackProgramInfoLoader)(this,tr.tensor),[tr.tensor])}unpack(tr){return this.executeProgram((0,tp.createUnpackProgramInfoLoader)(this,tr.tensor),[tr.tensor])}}},1640:function(tr,tn,ti){"use strict";var to=this&&this.__createBinding||(Object.create?function(tr,tn,ti,to){void 0===to&&(to=ti);var ta=Object.getOwnPropertyDescriptor(tn,ti);ta&&!("get"in ta?!tn.__esModule:ta.writable||ta.configurable)||(ta={enumerable:!0,get:function(){return tn[ti]}}),Object.defineProperty(tr,to,ta)}:function(tr,tn,ti,to){void 0===to&&(to=ti),tr[to]=tn[ti]}),ta=this&&this.__setModuleDefault||(Object.create?function(tr,tn){Object.defineProperty(tr,"default",{enumerable:!0,value:tn})}:function(tr,tn){tr.default=tn}),ts=this&&this.__importStar||function(tr){if(tr&&tr.__esModule)return tr;var tn={};if(null!=tr)for(var ti in tr)"default"!==ti&&Object.prototype.hasOwnProperty.call(tr,ti)&&to(tn,tr,ti);return ta(tn,tr),tn};Object.defineProperty(tn,"__esModule",{value:!0}),tn.WEBGL_OP_RESOLVE_RULES=void 0;let tu=ti(2898),tl=ts(ti(7839)),tc=ti(4196),tp=ti(2069),tf=ti(8138),td=ti(9663),th=ti(5193),tg=ti(7992),tb=ti(1253),tm=ti(4776),ty=ti(6572),t_=ti(3346),tv=ti(5623),tx=ti(2870),tw=ti(2143),tT=ti(4939),tS=ti(718),tO=ti(2268),tA=ti(8117),tE=ti(2278),tI=ti(5524),tP=ti(5975),tD=ti(3933),t$=ti(6558),tk=ti(5723),tC=ti(3738),tF=ts(ti(4909)),tN=ti(8428),tL=ti(9793);tn.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",tF.abs],["Acos","","7+",tF.acos],["Add","","7+",tl.add],["And","","7+",tl.and],["Asin","","7+",tF.asin],["Atan","","7+",tF.atan],["AveragePool","","7+",tw.averagePool,tw.parseAveragePoolAttributes],["BatchNormalization","","7+",tu.batchNormalization,tu.parseBatchNormalizationAttributes],["Cast","","6+",tc.cast,tc.parseCastAttributes],["Ceil","","6+",tF.ceil],["Clip","","6-10",tF.clip,tF.parseClipAttributes],["Clip","","11+",tF.clipV11],["Concat","","4+",tp.concat,tp.parseConcatAttributes],["Conv","","1+",tf.conv,tf.parseConvAttributes],["ConvTranspose","","1+",td.convTranspose,td.parseConvTransposeAttributes],["Cos","","7+",tF.cos],["Div","","7+",tl.div],["Dropout","","7+",tF.identity],["DepthToSpace","","1+",th.depthToSpace,th.parseDepthToSpaceAttributes],["Equal","","7+",tl.equal],["Elu","","6+",tF.elu,tF.parseEluAttributes],["Exp","","6+",tF.exp],["Flatten","","1+",tg.flatten,tg.parseFlattenAttributes],["Floor","","6+",tF.floor],["FusedConv","com.microsoft","1+",tf.conv,tf.parseConvAttributes],["Gather","","1+",tb.gather,tb.parseGatherAttributes],["Gemm","","7-10",tm.gemm,tm.parseGemmAttributesV7],["Gemm","","11+",tm.gemm,tm.parseGemmAttributesV11],["GlobalAveragePool","","1+",tw.globalAveragePool,tw.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",tw.globalMaxPool],["Greater","","7+",tl.greater],["Identity","","1+",tF.identity],["ImageScaler","","1+",ty.imageScaler,ty.parseImageScalerAttributes],["InstanceNormalization","","6+",t_.instanceNormalization,t_.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",tF.leakyRelu,tF.parseLeakyReluAttributes],["Less","","7+",tl.less],["Log","","6+",tF.log],["MatMul","","1+",tv.matMul,tv.parseMatMulAttributes],["MaxPool","","1+",tw.maxPool,tw.parseMaxPoolAttributes],["Mul","","7+",tl.mul],["Neg","","6+",tF.neg],["Not","","1+",tF.not],["Or","","7+",tl.or],["Pad","","2-10",tx.padV2,tx.parsePadAttributesV2],["Pad","","11+",tx.padV11,tx.parsePadAttributesV11],["Pow","","7+",tl.pow],["PRelu","","7+",tl.pRelu],["ReduceLogSum","","1+",tT.reduceLogSum,tT.parseReduceAttributes],["ReduceMax","","1+",tT.reduceMax,tT.parseReduceAttributes],["ReduceMean","","1+",tT.reduceMean,tT.parseReduceAttributes],["ReduceMin","","1+",tT.reduceMin,tT.parseReduceAttributes],["ReduceProd","","1+",tT.reduceProd,tT.parseReduceAttributes],["ReduceSum","","1-12",tT.reduceSum,tT.parseReduceAttributes],["ReduceSumSquare","","1+",tT.reduceLogSumSquare,tT.parseReduceAttributes],["Relu","","6+",tF.relu],["Reshape","","5+",tS.reshape],["Resize","","10",tO.resize,tO.parseResizeAttributesV10],["Resize","","11+",tO.resize,tO.parseResizeAttributesV11],["Shape","","1+",tA.shape],["Sigmoid","","6+",tF.sigmoid],["Sin","","7+",tF.sin],["Slice","","10+",tE.sliceV10],["Slice","","1-9",tE.slice,tE.parseSliceAttributes],["Softmax","","1-12",tI.softmax,tI.parseSoftmaxAttributes],["Softmax","","13+",tI.softmaxV13,tI.parseSoftmaxAttributesV13],["Split","","2-12",tP.split,tP.parseSplitAttributes],["Sqrt","","6+",tF.sqrt],["Squeeze","","1-12",tD.squeeze,tD.parseSqueezeAttributes],["Squeeze","","13+",tD.squeezeV13],["Sub","","7+",tl.sub],["Sum","","6+",t$.sum],["Tan","","7+",tF.tan],["Tanh","","6+",tF.tanh],["Tile","","6+",tk.tile],["Transpose","","1+",tC.transpose,tC.parseTransposeAttributes],["Upsample","","7-8",tL.upsample,tL.parseUpsampleAttributesV7],["Upsample","","9",tL.upsample,tL.parseUpsampleAttributesV9],["Unsqueeze","","1-12",tN.unsqueeze,tN.parseUnsqueezeAttributes],["Unsqueeze","","13+",tN.unsqueezeV13],["Xor","","7+",tl.xor]]},2898:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseBatchNormalizationAttributes=tn.batchNormalization=void 0;let to=ti(246),ta=ti(5060),ts=ti(2039),tu={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[ts.TextureType.unpacked,ts.TextureType.unpacked,ts.TextureType.unpacked,ts.TextureType.unpacked,ts.TextureType.unpacked]};tn.batchNormalization=(tr,tn,ti)=>(u(tn),[tr.run(Object.assign(Object.assign({},tu),{cacheHint:ti.cacheKey,get:()=>s(tr,tn,ti)}),tn)]),tn.parseBatchNormalizationAttributes=tr=>{let tn=tr.attributes.getFloat("epsilon",1e-5),ti=tr.attributes.getFloat("momentum",.9),ta=tr.attributes.getInt("spatial",1);return(0,to.createAttributeWithCacheKey)({epsilon:tn,momentum:ti,spatial:ta})};let s=(tr,tn,ti)=>{let to=(0,ta.getGlsl)(tr.session.backend.glContext.version),tl=tn[0].dims.length,[tc,tp]=tr.calculateTextureWidthAndHeight(tn[1].dims,ts.TextureType.unpacked),tf=` float process(int[${tl}] indices) { vec2 position = offsetToCoords(indices[1], ${tc}, ${tp}); float scale = getColorAsFloat(${to.texture2D}(Scale, position)); float mean = getColorAsFloat(${to.texture2D}(Mean, position)); float variance = getColorAsFloat(${to.texture2D}(Variance, position)); float b = getColorAsFloat(${to.texture2D}(B, position)); return scale * ( (_A(indices) - mean) / sqrt(variance + float(${ti.epsilon})) ) + b; }`;return Object.assign(Object.assign({},tu),{output:{dims:tn[0].dims,type:tn[0].type,textureType:ts.TextureType.unpacked},shaderSource:tf})},u=tr=>{if(!tr||5!==tr.length)throw Error("BatchNormalization requires 5 inputs.");let tn=tr[0],ti=tr[1],to=tr[2],ta=tr[3],ts=tr[4];if(tn.dims.length<3||1!==ti.dims.length||1!==to.dims.length||1!==ta.dims.length||1!==ts.dims.length||ti.dims[0]!==tn.dims[1]||to.dims[0]!==tn.dims[1]||ta.dims[0]!==tn.dims[1]||ts.dims[0]!==tn.dims[1])throw Error("invalid input shape.");if("float32"!==tn.type&&"float64"!==tn.type||"float32"!==ti.type&&"float64"!==ti.type||"float32"!==to.type&&"float64"!==to.type||"float32"!==ta.type&&"float64"!==ta.type||"float32"!==ts.type&&"float64"!==ts.type)throw Error("invalid input tensor types.")}},7839:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.xor=tn.sub=tn.pRelu=tn.pow=tn.or=tn.mul=tn.less=tn.greater=tn.equal=tn.div=tn.and=tn.add=tn.glslPRelu=tn.glslPow=tn.glslXor=tn.glslOr=tn.glslAnd=tn.glslLess=tn.glslGreater=tn.glslEqual=tn.glslSub=tn.glslMul=tn.glslDiv=tn.glslAdd=void 0;let to=ti(2517),ta=ti(8520),ts=ti(5060),tu=ti(2039);function s(){let tr="add_";return{body:` float ${tr}(float a, float b) { return a + b; } vec4 ${tr}(vec4 v1, vec4 v2) { return v1 + v2; } `,name:tr,type:ta.FunctionType.ValueBased}}function u(){let tr="div_";return{body:` float ${tr}(float a, float b) { return a / b; } vec4 ${tr}(vec4 v1, vec4 v2) { return v1 / v2; } `,name:tr,type:ta.FunctionType.ValueBased}}function c(){let tr="mul_";return{body:` float ${tr}(float a, float b) { return a * b; } vec4 ${tr}(vec4 v1, vec4 v2) { return v1 * v2; } `,name:tr,type:ta.FunctionType.ValueBased}}function l(){let tr="sub_";return{body:` float ${tr}(float a, float b) { return a - b; } vec4 ${tr}(vec4 v1, vec4 v2) { return v1 - v2; } `,name:tr,type:ta.FunctionType.ValueBased}}function p(){let tr="equal_";return{body:` float ${tr}(float a, float b) { return float(a == b); } vec4 ${tr}(vec4 v1, vec4 v2) { return vec4(equal(v1, v2)); } `,name:tr,type:ta.FunctionType.ValueBased}}function f(){let tr="greater_";return{body:` float ${tr}(float a, float b) { return float(a > b); } vec4 ${tr}(vec4 v1, vec4 v2) { return vec4( v1.r > v2.r , v1.g > v2.g, v1.b > v2.b, v1.a > v2.a ); } `,name:tr,type:ta.FunctionType.ValueBased}}function d(){let tr="less_";return{body:` float ${tr}(float a, float b) { return float(a < b); } vec4 ${tr}(vec4 v1, vec4 v2) { return vec4( v1.r < v2.r , v1.g < v2.g, v1.b < v2.b, v1.a < v2.a ); } `,name:tr,type:ta.FunctionType.ValueBased}}function h(){let tr="and_";return{body:` float ${tr}(float a, float b) { return float( bool(a) && bool(b) ); } vec4 ${tr}(vec4 v1, vec4 v2) { bvec4 b1 = bvec4(v1); bvec4 b2 = bvec4(v2); return vec4( b1.r && b2.r , b1.g && b2.g, b1.b && b2.b, b1.a && b2.a ); } `,name:tr,type:ta.FunctionType.ValueBased}}function g(){let tr="or_";return{body:` float ${tr}(float a, float b) { return float( bool(a) || bool(b) ); } vec4 ${tr}(vec4 v1, vec4 v2) { bvec4 b1 = bvec4(v1); bvec4 b2 = bvec4(v2); return vec4( b1.r || b2.r , b1.g || b2.g, b1.b || b2.b, b1.a || b2.a ); } `,name:tr,type:ta.FunctionType.ValueBased}}function b(){let tr="xor_";return{body:` float ${tr}(float a, float b) { return float( bool(a) ^^ bool(b) ); } vec4 ${tr}(vec4 v1, vec4 v2) { bvec4 b1 = bvec4(v1); bvec4 b2 = bvec4(v2); return vec4( b1.r ^^ b2.r , b1.g ^^ b2.g, b1.b ^^ b2.b, b1.a ^^ b2.a ); } `,name:tr,type:ta.FunctionType.ValueBased}}function m(){return function(tr){let tn=`${tr}_`;return{body:` float ${tn}(float a, float b) { return ${tr}(a, b); } vec4 ${tn}(vec4 v1, vec4 v2) { return ${tr}(v1, v2); } `,name:tn,type:ta.FunctionType.ValueBased}}("pow")}function y(){let tr="prelu_";return{body:` float ${tr}(float a, float b) { return a < 0.0 ? a * b: a; } vec4 ${tr}(vec4 v1, vec4 v2) { return vec4( v1.r < 0.0 ? v1.r * v2.r: v1.r, v1.g < 0.0 ? v1.g * v2.g: v1.g, v1.b < 0.0 ? v1.b * v2.b: v1.b, v1.a < 0.0 ? v1.a * v2.a: v1.a ); } `,name:tr,type:ta.FunctionType.ValueBased}}tn.glslAdd=s,tn.glslDiv=u,tn.glslMul=c,tn.glslSub=l,tn.glslEqual=p,tn.glslGreater=f,tn.glslLess=d,tn.glslAnd=h,tn.glslOr=g,tn.glslXor=b,tn.glslPow=m,tn.glslPRelu=y;let _=(tr,tn,ti,to=tn[0].type,ta)=>{let ts=tr.session.pack?tu.TextureType.packed:tu.TextureType.unpacked;return{name:ti.name,inputNames:["A","B"],inputTypes:[ts,ts],cacheHint:ta,get:()=>v(tr,tn,ti,to)}},v=(tr,tn,ti,ta=tn[0].type)=>{let tl=tr.session.pack?tu.TextureType.packed:tu.TextureType.unpacked,tc=!to.ShapeUtil.areEqual(tn[0].dims,tn[1].dims),tp=tn[0].dims,tf=tr.session.pack;if(tc){let tu=to.BroadcastUtil.calcShape(tn[0].dims,tn[1].dims,!1);if(!tu)throw Error("Can't perform binary op on the given tensors");tp=tu;let tc=tp.length,td=0!==tn[0].dims.length?tn[0].dims.length:1,th=0!==tn[1].dims.length?tn[1].dims.length:1,tg=0!==tn[0].dims.length?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",tb=0!==tn[1].dims.length?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",tm=(0,ts.getGlsl)(tr.session.backend.glContext.version),ty=tf?` ${ti.body} void main() { vec4 a = getAAtOutCoords(); vec4 b = getBAtOutCoords(); vec4 result = ${ti.name}(a, b); ${tm.output} = result; }`:` ${ti.body} float process(int indices[${tc}]) { int aindices[${td}]; int bindices[${th}]; ${tg} ${tb} return ${ti.name}(_A(aindices), _B(bindices)); }`;return{name:ti.name,inputNames:["A","B"],inputTypes:[tl,tl],output:{dims:tp,type:ta,textureType:tl},shaderSource:ty,hasMain:tf}}let td=(0,ts.getGlsl)(tr.session.backend.glContext.version),th=` ${ti.body} void main() { vec4 v1 = ${td.texture2D}(A, TexCoords); vec4 v2 = ${td.texture2D}(B, TexCoords); vec4 result = ${ti.name}(v1, v2); ${td.output} = result; } `;return{name:ti.name,inputNames:["A","B"],inputTypes:[tl,tl],output:{dims:tn[0].dims,type:ta,textureType:tl},shaderSource:th,hasMain:!0}};tn.add=(tr,tn)=>[tr.run(_(tr,tn,s()),tn)],tn.and=(tr,tn)=>[tr.run(_(tr,tn,h(),"bool"),tn)],tn.div=(tr,tn)=>[tr.run(_(tr,tn,u()),tn)],tn.equal=(tr,tn)=>[tr.run(_(tr,tn,p(),"bool"),tn)],tn.greater=(tr,tn)=>[tr.run(_(tr,tn,f(),"bool"),tn)],tn.less=(tr,tn)=>[tr.run(_(tr,tn,d(),"bool"),tn)],tn.mul=(tr,tn)=>[tr.run(_(tr,tn,c()),tn)],tn.or=(tr,tn)=>[tr.run(_(tr,tn,g(),"bool"),tn)],tn.pow=(tr,tn)=>[tr.run(_(tr,tn,m()),tn)],tn.pRelu=(tr,tn)=>[tr.run(_(tr,tn,y()),tn)],tn.sub=(tr,tn)=>[tr.run(_(tr,tn,l()),tn)],tn.xor=(tr,tn)=>[tr.run(_(tr,tn,b(),"bool"),tn)]},4196:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseCastAttributes=tn.cast=void 0;let to=ti(2517);tn.cast=(tr,tn,ti)=>(i(tn),[tr.cast(tn[0],ti)]),tn.parseCastAttributes=tr=>to.ProtoUtil.tensorDataTypeFromProto(tr.attributes.getInt("to"));let i=tr=>{if(!tr||1!==tr.length)throw Error("Cast requires 1 input.");if("string"===tr[0].type)throw Error("Invalid input type.")}},1163:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createPackedConcatProgramInfoLoader=void 0;let to=ti(5060),ta=ti(2039),ts=ti(9390),tu=ti(2827);tn.createPackedConcatProgramInfoLoader=(tr,tn,ti)=>{var tl,tc;let tp=(tl=tn.length,tc=ti.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:tl},(tr,tn)=>`X${tn}`),inputTypes:Array(tl).fill(ta.TextureType.packed),cacheHint:tc});return Object.assign(Object.assign({},tp),{get:()=>((tr,tn,ti,tl)=>{let tc=ti[0].dims.slice();if(tl>=tc.length||tl<-1*tc.length)throw Error("axis specified for concat doesn't match input dimensionality");tl<0&&(tl=tc.length+tl);let tp=tc.slice(0);for(let tr=1;trtr.dims),tm=(0,ts.getGlChannels)(tf),ty=Array(tb.length-1);ty[0]=tb[0][tl];for(let tr=1;tr= ${ty[tr-1]}) { return getChannel( getX${tr}(${s(tm,t_,tn)}), vec2(${s(tv,t_,tn)})); }`}let tT=ty.length,tS=ty[ty.length-1];tw+=` return getChannel( getX${tT}(${s(tm,t_,tS)}), vec2(${s(tv,t_,tS)}));`;let tO=(0,to.getGlsl)(tr.session.backend.glContext.version),tA=` ${tg} float getValue(${tm.map(tr=>"int "+tr)}) { ${tw} } void main() { ${th} coords = getOutputCoords(); int lastDim = coords.${tm[tf-1]}; coords.${tm[tf-1]} = coords.${tm[tf-2]}; coords.${tm[tf-2]} = lastDim; vec4 result = vec4(getValue(${td}), 0., 0., 0.); ${td[tf-1]} = ${td[tf-1]} + 1; if (${td[tf-1]} < ${tp[tf-1]}) { result.g = getValue(${td}); } ${td[tf-2]} = ${td[tf-2]} + 1; if (${td[tf-2]} < ${tp[tf-2]}) { result.a = getValue(${td}); } ${td[tf-1]} = ${td[tf-1]} - 1; if (${td[tf-2]} < ${tp[tf-2]} && ${td[tf-1]} < ${tp[tf-1]}) { result.b = getValue(${td}); } ${tO.output} = result; } `;return Object.assign(Object.assign({},tn),{output:{dims:tp,type:ti[0].type,textureType:ta.TextureType.packed},shaderSource:tA,hasMain:!0})})(tr,tp,tn,ti.axis)})};let s=(tr,tn,ti)=>{let to=tr.indexOf(tn);return tr.map((tr,tn)=>tn===to?`${tr} - ${ti}`:tr).join()}},2069:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseConcatAttributes=tn.concat=void 0;let to=ti(246),ta=ti(2039),ts=ti(1163);tn.concat=(tr,tn,ti)=>(p(tn),tr.session.pack&&tn[0].dims.length>1?[tr.run((0,ts.createPackedConcatProgramInfoLoader)(tr,tn,ti),tn)]:[tr.run(a(tr,tn,ti),tn)]);let a=(tr,tn,ti)=>{var to,ts;let tu=(to=tn.length,ts=ti.cacheKey,{name:"Concat",inputNames:Array.from({length:to},(tr,tn)=>`X${tn}`),inputTypes:Array(to).fill(ta.TextureType.unpacked),cacheHint:ts});return Object.assign(Object.assign({},tu),{get:()=>((tr,tn,ti,to)=>{let ts=ti[0].dims.slice();if(to>=ts.length||to<-1*ts.length)throw Error("axis specified for concat doesn't match input dimensionality");to<0&&(to=ts.length+to);let tu=ts.slice(0);for(let tr=1;tr`int getTextureWhereDataResides(int index) { ${tr.map((tr,tn)=>`if(index<${tr}) {return ${tn};} `).join("")} }`,u=tr=>s(tr),c=(tr,tn)=>{let ti=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${tn}]) {`];for(let tn=0;tn{let tn=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let ti=0;ti(0,to.createAttributeWithCacheKey)({axis:tr.attributes.getInt("axis")});let p=tr=>{if(!tr||tr.length<1)throw Error("too few inputs");let tn=tr[0].type,ti=tr[0].dims.length;if("string"===tn)throw Error("string tensor is not supported yet");for(let to of tr){if(to.type!==tn)throw Error("input tensors should be one type");if(to.dims.length!==ti)throw Error("input tensors should have the same shape")}}},4770:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createUnpackedGroupedConvProgramInfoLoader=void 0;let to=ti(6231),ta=ti(5060),ts=ti(2039),tu=ti(8138),tl=ti(2823);tn.createUnpackedGroupedConvProgramInfoLoader=(tr,tn,ti)=>{var tc,tp;let tf=(tc=tn.length>2,tp=ti.cacheKey,{name:"GroupedConv",inputNames:tc?["X","W","Bias"]:["X","W"],inputTypes:tc?[ts.TextureType.unpacked,ts.TextureType.unpacked,ts.TextureType.unpacked]:[ts.TextureType.unpacked,ts.TextureType.unpacked],cacheHint:tp});return Object.assign(Object.assign({},tf),{get:()=>((tr,tn,ti,tc)=>{let tp=tn.length>2?"value += getBias(output_channel);":"",tf=tn[0].dims.slice(),td=tn[1].dims.slice(),th=td[0]/tc.group;to.Logger.verbose("GroupedConv",`autpPad:${tc.autoPad}, dilations:${tc.dilations}, group:${tc.group}, kernelShape:${tc.kernelShape}, pads:${tc.pads}, strides:${tc.strides}`);let tg=(0,tu.calculateOutputShape)(tf,td,tc.dilations,tc.pads,tc.strides),tb=(0,ta.getGlsl)(tr.session.backend.glContext.version),{activationFunction:tm,applyActivation:ty}=(0,tl.getActivationSnippet)(tc),t_=` const ivec2 strides = ivec2(${tc.strides[0]}, ${tc.strides[1]}); const ivec2 pads = ivec2(${tc.pads[0]}, ${tc.pads[1]}); ${tm} void main() { ivec4 coords = getOutputCoords(); int batch = coords.x; int output_channel = coords.y; ivec2 xRCCorner = coords.zw * strides - pads; int group_id = output_channel / ${th}; float value = 0.0; for (int wInChannel = 0; wInChannel < ${td[1]}; wInChannel++) { int input_channel = group_id * ${td[1]} + wInChannel; for (int wHeight = 0; wHeight < ${td[2]}; wHeight++) { int xHeight = xRCCorner.x + wHeight * ${tc.dilations[0]}; if (xHeight < 0 || xHeight >= ${tf[2]}) { continue; } for (int wWidth = 0; wWidth < ${td[3]}; wWidth++) { int xWidth = xRCCorner.y + wWidth * ${tc.dilations[1]}; if (xWidth < 0 || xWidth >= ${tf[3]}) { continue; } float xVal = getX(batch, input_channel, xWidth, xHeight); float wVal = getW(output_channel, wInChannel, wWidth, wHeight); value += xVal*wVal; } } } ${tp} ${ty} ${tb.output} = vec4(value, .0, .0, .0); } `;return Object.assign(Object.assign({},ti),{output:{dims:tg,type:tn[0].type,textureType:ts.TextureType.unpacked},shaderSource:t_,hasMain:!0})})(tr,tn,tf,ti)})}},1386:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.conv2DPacked=tn.conv2DPackedPointwise=void 0;let to=ti(8138),ta=ti(8555),ts=ti(708);tn.conv2DPackedPointwise=(tr,tn,ti)=>{let ta=tn[0].dims,tu=tn[1].dims,tl=(0,to.calculateOutputShape)(ta,tu,ti.dilations,ti.pads,ti.strides),tc=tr.reshapePacked(tn[0],[ta[1],ta[2]*ta[3]]),tp=tr.reshapePacked(tn[1],[tu[0],tu[1]]),tf=tn.length>2?[tp,tc,tn[2]]:[tp,tc],td=tr.run((0,ts.createPackedMatmulProgramInfoLoader)(tr,tf,ti),tf);return tr.reshapePacked(td,tl)},tn.conv2DPacked=(tr,tn,ti)=>{let tu=tn[0].dims,tl=tn[1].dims,tc=(0,to.calculateOutputShape)(tu,tl,ti.dilations,ti.pads,ti.strides),tp=tr.run((0,ta.createPackedIm2ColProgramInfoLoader)(tr,tn[0],tn[1],tc,ti),[tn[0]]),tf=tr.reshapePacked(tn[1],[tl[0],tl[1]*tl[2]*tl[3]]),td=3===tn.length?[tf,tp,tn[2]]:[tf,tp],th=tr.run((0,ts.createPackedMatmulProgramInfoLoader)(tr,td,ti),td);return tr.reshapePacked(th,tc)}},9663:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseConvTransposeAttributes=tn.convTranspose=void 0;let to=ti(246),ta=ti(5060),ts=ti(2039),tu=ti(2823),s=(tr,tn,ti,to,ta,ts)=>(tr-1)*tn+ti+(to-1)*ta+1-ts,u=(tr,tn,ti,to,ta)=>{let ts=Math.floor(tr/2);"SAME_UPPER"===tn?(ti[to]=ts,ti[ta]=tr-ts):"SAME_LOWER"===tn&&(ti[to]=tr-ts,ti[ta]=ts)};tn.convTranspose=(tr,tn,ti)=>(f(tn,ti),c(tr,tn,ti));let c=(tr,tn,ti)=>{let to=p(ti,tn);return[l(tr,tn,to)]},l=(tr,tn,ti)=>tr.run(((tr,tn,ti)=>{var to,tl;let tc=(to=tn.length>2,tl=ti.cacheKey,{name:"ConvTranspose",inputNames:to?["X","W","B"]:["X","W"],inputTypes:to?[ts.TextureType.unpacked,ts.TextureType.unpacked,ts.TextureType.unpacked]:[ts.TextureType.unpacked,ts.TextureType.unpacked],cacheHint:tl});return Object.assign(Object.assign({},tc),{get:()=>((tr,tn,ti,to)=>{let tl=tn.length>2?"getB(output_channel)":"0.0",tc=tn[0].dims,tp=tn[1].dims,tf=tp[1],td=tp[0]/to.group,th=[tn[0].dims[0],tn[1].dims[1]*to.group,...to.outputShape],tg=(0,ta.getGlsl)(tr.session.backend.glContext.version),{activationFunction:tb,applyActivation:tm}=(0,tu.getActivationSnippet)(to),ty=` const ivec2 strides = ivec2(${to.strides[0]}, ${to.strides[1]}); const ivec2 pads = ivec2(${to.pads[0]}, ${to.pads[1]}); ${tb} void main() { ivec4 coords = getOutputCoords(); int batch = coords.x; int output_channel = coords.y; ivec2 loc = coords.zw + pads; int group_id = output_channel / ${tf}; int wOutChannel = output_channel - group_id * ${tf}; float value = ${tl}; for (int inChannelOffset = 0; inChannelOffset < ${td}; inChannelOffset++) { int input_channel = group_id * ${td} + inChannelOffset; for (int wWOff = 0; wWOff < ${tp[2]}; wWOff++) { for (int wHOff = 0; wHOff < ${tp[3]}; wHOff++) { ivec2 wOff = ivec2(wWOff * ${to.dilations[0]}, wHOff * ${to.dilations[1]}); ivec2 wLoc = loc - wOff; ivec2 wLocIn = wLoc / strides; if ( wLocIn * strides == wLoc && wLocIn.x >= 0 && wLocIn.x < ${tc[2]} && wLocIn.y >= 0 && wLocIn.y < ${tc[3]} ) { float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); value += xVal * wVal; } } } } ${tm} ${tg.output} = vec4(value, .0, .0, .0); } `;return Object.assign(Object.assign({},ti),{output:{dims:th,type:tn[0].type,textureType:ts.TextureType.unpacked},shaderSource:ty,hasMain:!0})})(tr,tn,tc,ti)})})(tr,tn,ti),tn),p=(tr,tn)=>{let ti=tr.kernelShape.slice();if(0===tr.kernelShape.length)for(let tr=2;tr{let tc=tr.length-2,tp=0===tl.length;for(let tf=0;tf{let tn=tr.attributes,ti=(0,tu.parseInternalActivationAttributes)(tn),ta=tn.getString("auto_pad","NOTSET"),ts=tn.getInts("dilations",[1,1]),tl=tn.getInt("group",1),tc=tn.getInts("kernel_shape",[]),tp=tn.getInts("output_padding",[0,0]),tf=tn.getInts("output_shape",[]),td=tn.getInts("pads",[0,0,0,0]),th=tn.getInts("strides",[1,1]);return(0,to.createAttributeWithCacheKey)(Object.assign({autoPad:ta,dilations:ts,group:tl,kernelShape:tc,outputPadding:tp,outputShape:tf,pads:td,strides:th},ti))};let f=(tr,tn)=>{if(!tr||2!==tr.length&&3!==tr.length)throw Error("Conv requires 2 or 3 inputs");if(4!==tr[0].dims.length||4!==tr[1].dims.length)throw Error("currently only support 2-dimensional conv");if(tr[0].dims[1]!==tr[1].dims[0])throw Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let ti=tr[1].dims[1]*tn.group;if(3===tr.length&&(1!==tr[2].dims.length||tr[2].dims[0]!==ti))throw Error("invalid bias");let to=tr[0].dims.length-2;if(tn.dilations.length!==to)throw Error(`dilations should be ${to}D`);if(tn.strides.length!==to)throw Error(`strides should be ${to}D`);if(tn.pads.length!==2*to)throw Error(`pads should be ${2*to}D`);if(tn.outputPadding.length!==to)throw Error(`output_padding should be ${to}D`);if(0!==tn.kernelShape.length&&tn.kernelShape.length!==tr[1].dims.length-2)throw Error("invalid kernel shape");if(0!==tn.outputShape.length&&tn.outputShape.length!==tr[0].dims.length-2)throw Error("invalid output shape");if("float32"!==tr[0].type||"float32"!==tr[1].type)throw Error("ConvTranspose input(X,W) should be float tensor");if(3===tr.length&&"float32"!==tr[2].type)throw Error("ConvTranspose input(bias) should be float tensor")}},8138:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseConvAttributes=tn.conv=tn.calculateOutputShape=void 0;let to=ti(246),ta=ti(2517),ts=ti(4770),tu=ti(1386),tl=ti(9828),tc=ti(2823),tp=ti(3248),tf=ti(5623);tn.calculateOutputShape=(tr,tn,ti,to,ta)=>{let ts=tr[0],tu=tr.slice(2),tl=tu.length,tc=tn[0],tp=tn.slice(2).map((tr,tn)=>tr+(tr-1)*(ti[tn]-1)),tf=tu.map((tr,tn)=>tr+to[tn]+to[tn+tl]).map((tr,tn)=>Math.floor((tr-tp[tn]+ta[tn])/ta[tn]));return[ts,tc].concat(...tf)},tn.conv=(tr,tn,ti)=>(g(tn,ti),p(tr,tn,ti));let p=(tr,tn,ti)=>{let to=h(ti,tn),ta=tr.session.pack,tl=1===to.kernelShape[0]&&1===to.kernelShape[1];return to.group>1?[tr.run((0,ts.createUnpackedGroupedConvProgramInfoLoader)(tr,tn,to),tn)]:tl&&ta?[f(tr,tn,to)]:ta&&4===tn[0].dims.length&&1===tn[0].dims[0]&&!tl?[(0,tu.conv2DPacked)(tr,tn,to)]:[d(tr,tn,to)]},f=(tr,ti,to)=>{let ta=ti[0].dims,ts=ti[1].dims,tu=(0,tn.calculateOutputShape)(ta,ts,to.dilations,to.pads,to.strides),tl=tr.reshapeUnpacked(ti[0],[ta[1],ta[2]*ta[3]]),tc=tr.reshapeUnpacked(ti[1],[ts[0],ts[1]]),tp=ti.length>2?[tc,tl,ti[2]]:[tc,tl],td=tr.run((0,tf.createMatmulProgramInfoLoader)(tp,to),tp);return tr.reshapeUnpacked(td,tu)},d=(tr,ti,to)=>{let ta=ti[0].dims,ts=ti[1].dims,tu=(0,tn.calculateOutputShape)(ta,ts,to.dilations,to.pads,to.strides),tc=tr.run((0,tp.createIm2ColProgramInfoLoader)(tr,ti[0],ti[1],tu,to),[ti[0]]),tf=3===ti.length?[tc,ti[1],ti[2]]:[tc,ti[1]];return tr.run((0,tl.createDotProductProgramInfoLoader)(tr,ti,tu,to),tf)},h=(tr,tn)=>{let ti=tr.kernelShape.slice();if(0===tr.kernelShape.length)for(let tr=2;tr{let tn=tr.attributes,ti=(0,tc.parseInternalActivationAttributes)(tn),ta=tn.getString("auto_pad","NOTSET"),ts=tn.getInts("dilations",[1,1]),tu=tn.getInt("group",1),tl=tn.getInts("kernel_shape",[]),tp=tn.getInts("pads",[0,0,0,0]),tf=tn.getInts("strides",[1,1]);return(0,to.createAttributeWithCacheKey)(Object.assign({autoPad:ta,dilations:ts,group:tu,kernelShape:tl,pads:tp,strides:tf},ti))};let g=(tr,tn)=>{if(!tr||2!==tr.length&&3!==tr.length)throw Error("Conv requires 2 or 3 inputs");if(4!==tr[0].dims.length||4!==tr[1].dims.length)throw Error("currently only support 2-dimensional conv");if(tr[0].dims[1]!==tr[1].dims[1]*tn.group)throw Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(3===tr.length&&(1!==tr[2].dims.length||tr[1].dims[0]!==tr[2].dims[0]))throw Error("invalid bias");let ti=tr[0].dims.length-2;if(tn.dilations.length!==ti)throw Error(`dilations should be ${ti}D`);if(tn.strides.length!==ti)throw Error(`strides should be ${ti}D`);if(tn.pads.length!==2*ti)throw Error(`pads should be ${2*ti}D`);if(0!==tn.kernelShape.length&&tn.kernelShape.length!==tr[1].dims.length-2)throw Error("invalid kernel shape");if("float32"!==tr[0].type||"float32"!==tr[1].type)throw Error("Conv input(X,W) should be float tensor");if(3===tr.length&&"float32"!==tr[2].type)throw Error("Conv input(bias) should be float tensor")}},5193:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseDepthToSpaceAttributes=tn.depthToSpace=void 0;let to=ti(3738);tn.depthToSpace=(tr,tn,ti)=>{i(tn);let ta=ti.blocksize,ts=ta*ta,tu="DCR"===ti.mode?[0,3,4,1,5,2]:[0,1,4,2,5,3],tl="DCR"===ti.mode?[tn[0].dims[0],ta,ta,tn[0].dims[1]/ts,tn[0].dims[2],tn[0].dims[3]]:[tn[0].dims[0],tn[0].dims[1]/ts,ta,ta,tn[0].dims[2],tn[0].dims[3]],tc=tr.reshapeUnpacked(tn[0],tl),tp={perm:tu,cacheKey:`${tu}`},[tf]=(0,to.transpose)(tr,[tc],tp),td=[tn[0].dims[0],tn[0].dims[1]/ts,tn[0].dims[2]*ta,tn[0].dims[3]*ta];return[tr.reshapeUnpacked(tf,td)]},tn.parseDepthToSpaceAttributes=tr=>{let tn=tr.attributes.getInt("blocksize");if(tn<1)throw Error(`blocksize must be >= 1, but got : ${tn} for DepthToSpace`);let ti=tr.attributes.getString("mode","DCR");if("DCR"!==ti&&"CRD"!==ti)throw Error(`unrecognized mode: ${ti} for DepthToSpace`);return{mode:ti,blocksize:tn}};let i=tr=>{if(1!==tr.length)throw Error(`DepthToSpace expect 1 inputs, but got ${tr.length}`);if("string"===tr[0].type||4!==tr[0].dims.length)throw TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createDotProductProgramInfoLoader=void 0;let to=ti(2517),ta=ti(5060),ts=ti(2039),tu=ti(2823),tl=ti(3248);tn.createDotProductProgramInfoLoader=(tr,tn,ti,tc)=>{var tp,tf;let td=(tp=tn.length>2,tf=tc,{name:"ConvDotProduct",inputNames:tp?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:tp?[ts.TextureType.unpacked,ts.TextureType.packedLastDimension,ts.TextureType.unpacked]:[ts.TextureType.unpacked,ts.TextureType.packedLastDimension],cacheKey:tf.activationCacheKey});return Object.assign(Object.assign({},td),{get:()=>((tr,tn,ti,tc,tp)=>{let tf=ti[0].dims,td=ti[1].dims,th=[td[0],Math.ceil(tf[1]*td[2]*td[3]/4)],tg=(0,tl.calculateIm2ColDims)(tf,td,tc),[tb,tm]=tr.calculateTextureWidthAndHeight(th,ts.TextureType.packedLastDimension),ty=to.ShapeUtil.computeStrides(tg),[t_,tv]=tr.calculateTextureWidthAndHeight(tg,ts.TextureType.packedLastDimension),tx=tc.length,tw=ti.length<3?"0.0":"_B(b)",tT=Math.ceil(tf[1]*td[2]*td[3]/4),{activationFunction:tS,applyActivation:tO}=(0,tu.getActivationSnippet)(tp),tA=(0,ta.getGlsl)(tr.session.backend.glContext.version),tE=` ${tS} float process(int indices[${tx}]) { int b[1]; b[0] = indices[1]; int im2col[4]; im2col[0] = indices[0]; im2col[1] = indices[2]; im2col[2] = indices[3]; int im2colOffset = im2col[0] * ${ty[0]} + im2col[1] * ${ty[1]} + im2col[2] * ${ty[2]}; int kernelOffset = indices[1] * ${th[1]}; float value = ${tw}; for (int i = 0; i < ${tT}; ++i) { vec2 im2colCoords = offsetToCoords(im2colOffset, ${t_}, ${tv}); vec2 kernelCoords = offsetToCoords(kernelOffset, ${tb}, ${tm}); value += dot(${tA.texture2D}(Im2Col, im2colCoords), ${tA.texture2D}(K, kernelCoords)); ++im2colOffset; ++kernelOffset; } ${tO} return value; }`;return Object.assign(Object.assign({},tn),{output:{dims:tc,type:ti[0].type,textureType:ts.TextureType.unpacked},shaderSource:tE})})(tr,td,tn,ti,tc)})}},7992:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseFlattenAttributes=tn.flatten=void 0;let to=ti(2517);tn.flatten=(tr,tn,ti)=>{i(tn,ti);let ta=to.ShapeUtil.flattenShape(tn[0].dims,ti);return[tr.reshapeUnpacked(tn[0],ta)]},tn.parseFlattenAttributes=tr=>tr.attributes.getInt("axis",1);let i=(tr,tn)=>{if(!tr||1!==tr.length)throw Error("Flatten requires 1 input.");let ti=tr[0].dims.length;if(0===ti)throw Error("scalar tensor is not supported.");if(tn<-ti||tn>ti)throw Error("Invalid axis");if("string"===tr[0].type)throw Error("string tensor is not supported.")}},2823:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseInternalActivationAttributes=tn.getActivationSnippet=void 0;let to=ti(2517),ta=ti(4909);tn.getActivationSnippet=function(tr){let tn;switch(tr.activation){case"Relu":tn=(0,ta.glslRelu)();break;case"Sigmoid":tn=(0,ta.glslSigmoid)();break;case"Clip":tn=(0,ta.glslClip)(tr.clipMin,tr.clipMax);break;default:return{activationFunction:"",applyActivation:""}}let ti=tn.name;return{activationFunction:tn.body,applyActivation:`value = ${ti}_(value);`}},tn.parseInternalActivationAttributes=tr=>{let tn=tr.getString("activation","");if("Clip"===tn){let[ti,ta]=tr.getFloats("activation_params",[to.MIN_CLIP,to.MAX_CLIP]);return{activation:tn,clipMax:ta,clipMin:ti,activationCacheKey:`${tn}:${ti},${ta}`}}return{activation:tn,activationCacheKey:tn}}},1253:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseGatherAttributes=tn.gather=void 0;let to=ti(246),ta=ti(782),ts=ti(2517),tu=ti(2039);tn.gather=(tr,tn,ti)=>(c(tn,ti.axis),[tr.run(u(tr,tn,ti),tn)]),tn.parseGatherAttributes=tr=>(0,to.createAttributeWithCacheKey)({axis:tr.attributes.getInt("axis",0)});let tl={name:"Gather",inputNames:["A","B"],inputTypes:[tu.TextureType.unpacked,tu.TextureType.unpacked]},u=(tr,tn,ti)=>{let to=Object.assign(Object.assign({},tl),{cacheHint:ti.cacheKey});return Object.assign(Object.assign({},to),{get:()=>((tr,tn,ti,to)=>{let ta=ti[0].dims.slice(),tl=ti[1].dims.slice(),tc=Array(ta.length+tl.length-1);to=ts.ShapeUtil.normalizeAxis(to,ta.length);let tp=[];for(let tr=0;tr{if(!tr||2!==tr.length)throw Error("Gather requires 2 inputs.");let ti=tr[0].dims.length;if(ti<1)throw Error("Invalid input shape.");if(tn<-ti||tn>ti-1)throw Error("Invalid axis.");if(-1===ta.NUMBER_TYPES.indexOf(tr[0].type)||"int32"!==tr[1].type&&"int16"!==tr[1].type)throw Error("Invaid input type.")}},4776:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseGemmAttributesV11=tn.parseGemmAttributesV7=tn.gemm=void 0;let to=ti(246),ta=ti(2517),ts=ti(2039);tn.gemm=(tr,tn,ti)=>(c(tn,ti),[tr.run(s(tn,ti),tn)]);let a=(tr,tn)=>{let ti=0!==tr.attributes.getInt("transA",0),ta=0!==tr.attributes.getInt("transB",0),ts=tr.attributes.getFloat("alpha",1),tu=tr.attributes.getFloat("beta",1);return(0,to.createAttributeWithCacheKey)({transA:ti,transB:ta,alpha:ts,beta:tu,isOptionalC:tn})};tn.parseGemmAttributesV7=tr=>a(tr,!1),tn.parseGemmAttributesV11=tr=>a(tr,!0);let s=(tr,tn)=>{let ti={name:"Gemm",inputNames:3===tr.length?["A","B","C"]:["A","B"],inputTypes:3===tr.length?[ts.TextureType.unpacked,ts.TextureType.unpacked,ts.TextureType.unpacked]:[ts.TextureType.unpacked,ts.TextureType.unpacked],key:tn.cacheKey};return Object.assign(Object.assign({},ti),{get:()=>u(ti,tr,tn)})},u=(tr,tn,ti)=>{let to=tn[0].dims.slice(),tu=tn[1].dims.slice(),[tl,tc]=ta.GemmUtil.getShapeOfGemmResult(to,ti.transA,tu,ti.transB,3===tn.length?tn[2].dims:void 0),tp=[tl,tc];if(!tp)throw Error("Can't use gemm on the given tensors");let tf=to[to.length-1],td="";ti.transA&&(tf=to[0]),ti.transA&&ti.transB?td="value += _A_T(a) * _B_T(b);":ti.transA&&!ti.transB?td="value += _A_T(a) * _B(b);":!ti.transA&&ti.transB?td="value += _A(a) * _B_T(b);":ti.transA||ti.transB||(td="value += _A(a) * _B(b);");let th=tp.length,tg=` float process(int indices[${th}]) { int a[${th}]; int b[${th}]; ${3===tn.length?`int c[${tn[2].dims.length}];`:""} copyVec(indices, a); copyVec(indices, b); ${3===tn.length?"bcastIndices_C(indices, c);":""} float value = 0.0; for (int k=0; k<${tf}; ++k) { a[${th-1}] = k; b[${th-2}] = k; ${td} } value = value * alpha; ${3===tn.length?"value += beta * _C(c);":""} return value; }`;return Object.assign(Object.assign({},tr),{output:{dims:tp,type:tn[0].type,textureType:ts.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:ti.alpha},{name:"beta",type:"float",data:ti.beta}],shaderSource:tg})},c=(tr,tn)=>{if(!tr)throw Error("Input is missing");if(tn.isOptionalC&&(tr.length<2||tr.length>3))throw Error("Invaid input shape.");if(!tn.isOptionalC&&3!==tr.length)throw Error("Gemm requires 3 inputs");if(3===tr.length&&1!==tr[2].dims.length&&2!==tr[2].dims.length)throw Error("Invalid input shape of C");if("float32"!==tr[0].type&&"float64"!==tr[0].type||"float32"!==tr[1].type&&"float64"!==tr[1].type||3===tr.length&&"float32"!==tr[2].type&&"float64"!==tr[2].type)throw Error("Invalid input type.");if(tr[0].type!==tr[1].type||3===tr.length&&tr[0].type!==tr[2].type)throw Error("Input types are mismatched")}},8555:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createPackedIm2ColProgramInfoLoader=void 0;let to=ti(5060),ta=ti(2039),ts=ti(2827);tn.createPackedIm2ColProgramInfoLoader=(tr,tn,ti,tu,tl)=>{var tc;let tp=(tc=tl.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[ta.TextureType.packed],cacheHint:tc});return Object.assign(Object.assign({},tp),{get:()=>((tr,tn,ti,tu,tl,tc)=>{let tp=ti.dims,tf=tu.dims,td=tl.length,th=[tf[1]*tf[2]*tf[3],tl[2]*tl[3]],tg=tf[2]*tf[3],tb=(0,ts.unpackFromChannel)(),tm=(0,to.getGlsl)(tr.session.backend.glContext.version),ty="";for(let tr=0;tr<=1;tr++)for(let tn=0;tn<=1;tn++)ty+=` blockIndex = rc.x + ${tn}; pos = rc.y + ${tr}; if(blockIndex < ${th[1]} && pos < ${th[0]}) { offsetY = int(blockIndex / (${tl[td-1]})) * ${tc.strides[0]} - ${tc.pads[0]}; d0 = offsetY + ${tc.dilations[0]} * (imod(pos, ${tg}) / ${tf[2]}); if(d0 < ${tp[2]} && d0 >= 0) { offsetX = imod(blockIndex, ${tl[td-1]}) * ${tc.strides[1]} - ${tc.pads[1]}; d1 = offsetX + ${tc.dilations[1]} * imod(imod(pos, ${tg}), ${tf[2]}); if(d1 < ${tp[3]} && d1 >= 0) { ch = int(float(pos)/ ${tg}.); innerDims = vec2(d0, d1); result[${2*tr+tn}] = getChannel( getA(0, ch, int(innerDims.x), int(innerDims.y)), innerDims); } } } `;let t_=` ${tb} void main() { ivec2 rc = getOutputCoords(); vec4 result = vec4(0.0); int blockIndex, pos, offsetY, d0, offsetX, d1, ch; vec2 innerDims; ${ty} ${tm.output} = result; } `;return Object.assign(Object.assign({},tn),{output:{dims:th,type:ti.type,textureType:ta.TextureType.packed},shaderSource:t_,hasMain:!0})})(tr,tp,tn,ti,tu,tl)})}},3248:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.calculateIm2ColDims=tn.createIm2ColProgramInfoLoader=void 0;let to=ti(2039);tn.createIm2ColProgramInfoLoader=(tr,ti,ta,ts,tu)=>{var tl;let tc=(tl=tu.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[to.TextureType.unpacked],cacheHint:tl});return Object.assign(Object.assign({},tc),{get:()=>((tr,ti,ta,ts,tu,tl)=>{let tc=ta.dims,tp=ts.dims,tf=tu.length,td=(0,tn.calculateIm2ColDims)(tc,tp,tu,4),th=` const int XC = ${tc[1]}; const int XH = ${tc[2]}; const int XW = ${tc[3]}; const int KH = ${tl.kernelShape[0]}; const int KW = ${tl.kernelShape[1]}; const int dilationH = ${tl.dilations[0]}; const int dilationW = ${tl.dilations[1]}; const int strideH = ${tl.strides[0]}; const int strideW = ${tl.strides[1]}; const int padH = ${tl.pads[0]}; const int padW = ${tl.pads[1]}; const int KHKW = KH*KW; const int XCKHKW = XC * KHKW; const int outputChannels = 4; vec4 process(int indices[${tf}]) { int b = indices[0]; // batch size int oh = indices[1] * strideH - padH; //output height int ow = indices[2] * strideW - padW; //output width int p = indices[3] * outputChannels; //patch vec4 value = vec4(0.0); for(int i=0; i < outputChannels; ++i) { if(p < XCKHKW) { int patchC = p / KHKW; int patchH = (p - patchC*KHKW) / KW; int patchW = (p - patchC*KHKW) - patchH * KW; int xh2 = oh + patchH * dilationH; int xw2 = ow + patchW * dilationW; int x[${tc.length}]; x[0] = b; x[1] = patchC; x[2] = xh2; x[3] = xw2; if(xh2 >= 0 && xh2 < XH && xw2 >= 0 && xw2 < XW) { value[i] = _X(x); } } ++p; } return value; } `;return Object.assign(Object.assign({},ti),{output:{dims:td,type:ta.type,textureType:to.TextureType.packedLastDimension},shaderSource:th})})(0,tc,ti,ta,ts,tu)})},tn.calculateIm2ColDims=(tr,tn,ti,to=4)=>[ti[0],ti[2],ti[3],Math.ceil(tr[1]*tn[2]*tn[3]/to)]},6572:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseImageScalerAttributes=tn.imageScaler=void 0;let to=ti(246),ta=ti(2039);tn.imageScaler=(tr,tn,ti)=>(u(tn),[tr.run(a(tr,tn,ti),tn)]),tn.parseImageScalerAttributes=tr=>{let tn=tr.attributes.getFloat("scale"),ti=tr.attributes.getFloats("bias");return(0,to.createAttributeWithCacheKey)({scale:tn,bias:ti})};let ts={name:"ImageScaler",inputNames:["X"],inputTypes:[ta.TextureType.unpacked]},a=(tr,tn,ti)=>{let to=Object.assign(Object.assign({},ts),{cacheHint:ti.cacheKey});return Object.assign(Object.assign({},to),{get:()=>((tr,tn,ti,to)=>{let ts=ti[0].dims.slice(),tu=ts.length,tl=` ${s(to.bias.length)} float process(int indices[${tu}]) { return _X(indices) * scale + getBias(bias, indices[1]); }`;return Object.assign(Object.assign({},tn),{output:{dims:ts,type:ti[0].type,textureType:ta.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:to.bias.length,data:to.bias},{name:"scale",type:"float",data:to.scale}],shaderSource:tl})})(0,to,tn,ti)})},s=tr=>{let tn=[`float getBias(float bias[${tr}], int channel) {`];for(let ti=0;ti{if(!tr||1!==tr.length)throw Error("ImageScaler requires 1 input.");if(4!==tr[0].dims.length)throw Error("Invalid input shape.");if("float32"!==tr[0].type&&"float64"!==tr[0].type)throw Error("Invalid input type.")}},3346:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseInstanceNormalizationAttributes=tn.instanceNormalization=void 0;let to=ti(5060),ta=ti(2039);tn.instanceNormalization=(tr,tn,ti)=>{c(tn);let to=tr.run(a(tn[0]),tn);return[tr.run(u(tr,tn[0],ti,to.dims),[tn[0],to,tn[1],tn[2]])]},tn.parseInstanceNormalizationAttributes=tr=>tr.attributes.getFloat("epsilon",1e-5);let ts={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[ta.TextureType.unpacked]},a=tr=>Object.assign(Object.assign({},ts),{get:()=>((tr,tn)=>{let ti=tn.dims.slice(),to=ti[1],ts=ti[2]*ti[3],tu=[ti[0],to],tl=` vec4 process(int[2] indices) { vec4 v = vec4(0.0); int a[4]; a[0] = indices[0]; a[1] = indices[1]; float temp = 0.0; for(int a2=0; a2<${ti[2]}; a2++) { a[2] = a2; for(int a3=0; a3<${ti[3]}; a3++) { a[3] = a3; float x = _X(a); temp += x; } } float mean = temp / float(${ts}); temp = 0.0; for(int a2=0; a2<${ti[2]}; a2++) { a[2] = a2; for(int a3=0; a3<${ti[3]}; a3++) { a[3] = a3; float x = _X(a); temp += (x - mean) * (x - mean); } } v.r = mean; v.g = temp / float(${ts}); return v; }`;return Object.assign(Object.assign({},tr),{output:{dims:tu,type:tn.type,textureType:ta.TextureType.packedLastDimension},shaderSource:tl})})(ts,tr)}),tu={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[ta.TextureType.unpacked,ta.TextureType.packedLastDimension,ta.TextureType.unpacked,ta.TextureType.unpacked]},u=(tr,tn,ti,ts)=>{let tl=Object.assign(Object.assign({},tu),{cacheHint:`${ti}`});return Object.assign(Object.assign({},tl),{get:()=>((tr,tn,ti,ts,tu)=>{let tl=(0,to.getGlsl)(tr.session.backend.glContext.version),[tc,tp]=tr.calculateTextureWidthAndHeight(tu,ta.TextureType.packedLastDimension),[tf,td]=[tc/4,tp],th=` vec4 get_MeanAndVariance(int[2] mv) { int offset = indicesToOffset_MeanAndVariance(mv); vec2 coords = offsetToCoords(offset, ${tf}, ${td}); return ${tl.texture2D}(MeanAndVariance, coords); } float process(int[4] indices) { int mv[2]; mv[0] = indices[0]; mv[1] = indices[1]; vec4 mean_and_variance = get_MeanAndVariance(mv); float mean = mean_and_variance.r; float variance = mean_and_variance.g; int sb[1]; sb[0] = indices[1]; float scale = _Scale(sb); float b = _B(sb); return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; }`;return Object.assign(Object.assign({},tn),{output:{dims:ti.dims,type:ti.type,textureType:ta.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:ts}],shaderSource:th})})(tr,tl,tn,ti,ts)})},c=tr=>{if(!tr||3!==tr.length)throw Error("InstanceNormalization requires 3 inputs.");let tn=tr[0],ti=tr[1],to=tr[2];if(tn.dims.length<3||1!==ti.dims.length||1!==to.dims.length)throw Error("Invalid input shape.");if(ti.dims[0]!==tn.dims[1]||to.dims[0]!==tn.dims[1])throw Error("Input shapes are mismatched.");if("float32"!==tn.type&&"float64"!==tn.type||"float32"!==ti.type&&"float64"!==ti.type||"float32"!==to.type&&"float64"!==to.type)throw Error("Invalid input type.");if(4!==tr[0].dims.length)throw Error("Only support 4-D input shape.")}},708:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createPackedMatmulProgramInfoLoader=void 0;let to=ti(2517),ta=ti(5060),ts=ti(2039),tu=ti(9390),tl=ti(2823),tc=ti(5623);tn.createPackedMatmulProgramInfoLoader=(tr,tn,ti)=>{var tp,tf;let td=(tp=tn.length>2,tf=ti.activationCacheKey,{name:"MatMul (packed)",inputNames:tp?["A","B","Bias"]:["A","B"],inputTypes:tp?[ts.TextureType.packed,ts.TextureType.packed,ts.TextureType.packed]:[ts.TextureType.packed,ts.TextureType.packed],cacheHint:tf});return Object.assign(Object.assign({},td),{get:()=>((tr,tn,ti,tp)=>{let tf=ti.length>2,td=tf?"value += getBiasForMatmul();":"",th=ti[0].dims,tg=ti[1].dims,tb=to.BroadcastUtil.calcShape(th,tg,!0),tm=!to.ShapeUtil.areEqual(ti[0].dims,ti[1].dims);if(!tb)throw Error("Can't use matmul on the given tensors");let ty=th[th.length-1],t_=Math.ceil(ty/2),tv=th.length,tx=tg.length,tw=(0,ta.getGlsl)(tr.session.backend.glContext.version),tT=(0,tu.getCoordsDataType)(tb.length),tS=tb.length,tO=(0,tu.getGlChannels)(),{activationFunction:tA,applyActivation:tE}=(0,tl.getActivationSnippet)(tp),tI=tf?`${(0,tc.getBiasForMatmul)(tT,tO,ti[2].dims,tb,!0)}`:"",tP=tm?`${function(tr,tn,ti,ta){let ts=[],tu=[],tl=ti[0].dims,tc=ti[1].dims,tp=tl.length,tf=tc.length,td=ta.length,th=td-tp,tg=td-tf;(ts=tl.map((tr,ti)=>`coords.${tn[ti+th]}`))[tp-1]="i*2",ts.join(", "),(tu=tc.map((tr,ti)=>`coords.${tn[ti+tg]}`))[tf-2]="i*2",tu.join(", ");let tb=to.BroadcastUtil.getBroadcastDims(tl,ta),tm=to.BroadcastUtil.getBroadcastDims(tc,ta),ty=tb.map(tr=>`coords.${tn[tr+th]} = 0;`).join("\n"),t_=tm.map(tr=>`coords.${tn[tr+tg]} = 0;`).join("\n"),tv=`int lastDim = coords.${tn[td-1]}; coords.${tn[td-1]} = coords.${tn[td-2]}; coords.${tn[td-2]} = lastDim;`;return` vec4 getAAtOutCoordsMatmul(int i) { ${tr} coords = getOutputCoords(); ${tv} ${ty} vec4 outputValue = getA(${ts}); return outputValue; } vec4 getBAtOutCoordsMatmul(int i) { ${tr} coords = getOutputCoords(); ${tv} ${t_} vec4 outputValue = getB(${tu}); return outputValue; }`}(tT,tO,ti,tb)}`:"",tD=tm?"getAAtOutCoordsMatmul(i)":`getA(${function(tr,tn){let ti="";for(let to=0;to{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.getBiasForMatmul=tn.createMatmulProgramInfoLoader=tn.parseMatMulAttributes=tn.matMul=void 0;let to=ti(2517),ta=ti(2039),ts=ti(9390),tu=ti(2823),tl=ti(708);function u(tr,tn){var ti,tl;let tc=(ti=tr.length>2,tl=tn.activationCacheKey,{name:"MatMul",inputNames:ti?["A","B","Bias"]:["A","B"],inputTypes:ti?[ta.TextureType.unpacked,ta.TextureType.unpacked,ta.TextureType.unpacked]:[ta.TextureType.unpacked,ta.TextureType.unpacked],cacheHint:tl});return Object.assign(Object.assign({},tc),{get:()=>(function(tr,tn,ti){let tl=tn[0].dims,tc=tn[1].dims,tp=to.BroadcastUtil.calcShape(tl,tc,!0);if(!tp)throw Error("Can't use matmul on the given tensors");let tf=(0,ts.getCoordsDataType)(tp.length),td=(0,ts.getGlChannels)(),{activationFunction:th,applyActivation:tg}=(0,tu.getActivationSnippet)(ti),tb=tn.length>2,tm=tb?"value += getBiasForMatmul();":"",ty=tb?`${l(tf,td,tn[2].dims,tp,!1)}`:"",t_=tp.length,tv=tl.length,tx=tc.length,tw=` ${th} ${ty} float process(int indices[${t_}]) { int a[${tv}]; int b[${tx}]; bcastMatmulIndices_A(indices, a); bcastMatmulIndices_B(indices, b); float value; for (int k=0; k<${tl[tl.length-1]}; ++k) { a[${tv-1}] = k; b[${tx-2}] = k; value += _A(a) * _B(b); } ${tm} ${tg} return value; }`;return Object.assign(Object.assign({},tr),{output:{dims:tp,type:tn[0].type,textureType:ta.TextureType.unpacked},shaderSource:tw})})(tc,tr,tn)})}tn.matMul=(tr,tn,ti)=>(c(tn),tr.session.pack?[tr.run((0,tl.createPackedMatmulProgramInfoLoader)(tr,tn,ti),tn)]:[tr.run(u(tn,ti),tn)]),tn.parseMatMulAttributes=tr=>(0,tu.parseInternalActivationAttributes)(tr.attributes),tn.createMatmulProgramInfoLoader=u;let c=tr=>{if(!tr||2!==tr.length)throw Error("MatMul requires 2 inputs.");if(tr[0].dims[tr[0].dims.length-1]!==tr[1].dims[tr[1].dims.length-2])throw Error("shared dimension does not match.");if("float32"!==tr[0].type&&"float64"!==tr[0].type||"float32"!==tr[1].type&&"float64"!==tr[1].type)throw Error("inputs should be float type");if(tr[0].type!==tr[1].type)throw Error("inputs types should match")};function l(tr,tn,ti,ta,ts){let tu="",tl=ti.length,tc=ta.length,tp=tc-tl;tu=tc<2&&tl>0?"coords":ti.map((tr,ti)=>`coords.${tn[ti+tp]}`).join(", ");let tf=to.BroadcastUtil.getBroadcastDims(ti,ta).map(tr=>`coords.${tn[tr+tp]} = 0;`).join("\n"),td="vec4(outputValue.xx, outputValue.yy)";return 1===to.ShapeUtil.size(ti)&&(td="vec4(outputValue.x)"),ts?` vec4 getBiasForMatmul() { ${tr} coords = getOutputCoords(); ${tf} vec4 outputValue = getBias(${tu}); return ${td}; }`:` float getBiasForMatmul() { ${tr} coords = getOutputCoords(); ${tf} return getBias(coords.x); }`}tn.getBiasForMatmul=l},2403:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createPackProgramInfoLoader=void 0;let to=ti(5060),ta=ti(2039),ts=ti(9390),tu=ti(2827),tl={name:"pack",inputNames:["A"],inputTypes:[ta.TextureType.unpackedReversed]};tn.createPackProgramInfoLoader=(tr,tn)=>Object.assign(Object.assign({},tl),{get:()=>((tr,tn)=>{var ti,tc,tp,tf;let td;let th=(0,to.getGlsl)(tr.session.backend.glContext.version),tg=tn.dims,tb=tg.length,tm=tn.dims.length,ty=(0,ts.getCoordsDataType)(tm),t_=(0,tu.getChannels)("rc",tm),tv=(ti=tm,tc=t_,tp=tg[tg.length-2],tf=tg[tg.length-1],0===ti||1===ti?"":` int r = ${tc[ti-2]}; int c = ${tc[ti-1]}; int rp1 = ${tc[ti-2]} + 1; int cp1 = ${tc[ti-1]} + 1; bool rEdge = rp1 >= ${tf}; bool cEdge = cp1 >= ${tp}; `);td=0===tb?[1,1]:1===tb?[tg[0],1]:[tg[tm-1],tg[tm-2]];let tx=function(tr,tn,ti){if(0===tr)return"false";if(1===tr)return`rc > ${tn[0]}`;let to="";for(let ta=tr-2;ta= ${tn[ta-tr+2]}`,ta= ${tr[0]} ? 0. : getA(rc + 1), 0, 0`;let to="";if(ti>2)for(let tr=0;tr{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.unpackFromChannel=tn.getChannels=tn.getVecChannels=void 0;let to=ti(9390);function i(tr,tn){return(0,to.getGlChannels)(tn).map(tn=>`${tr}.${tn}`)}tn.getVecChannels=i,tn.getChannels=function(tr,tn){return 1===tn?[tr]:i(tr,tn)},tn.unpackFromChannel=function(){return"\n float getChannel(vec4 frag, int dim) {\n int modCoord = imod(dim, 2);\n return modCoord == 0 ? frag.r : frag.g;\n }\n\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n "}},2870:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parsePadAttributesV11=tn.padV11=tn.parsePadAttributesV2=tn.padV2=void 0;let to=ti(246),ta=ti(2517),ts=ti(5060),tu=ti(2039),tl={name:"Pad",inputNames:["A"],inputTypes:[tu.TextureType.unpacked]};tn.padV2=(tr,tn,ti)=>(l(tn),[tr.run(Object.assign(Object.assign({},tl),{cacheHint:ti.cacheKey,get:()=>c(tr,tn[0],ti)}),tn)]),tn.parsePadAttributesV2=tr=>{let tn=tr.attributes.getString("mode","constant"),ti=tr.attributes.getFloat("value",0),ta=tr.attributes.getInts("pads");return(0,to.createAttributeWithCacheKey)({mode:tn,value:ti,pads:ta})},tn.padV11=(tr,ti,to)=>{p(ti);let ta=u(tr,ti,to);return(0,tn.padV2)(tr,[ti[0]],ta)},tn.parsePadAttributesV11=tr=>tr.attributes.getString("mode","constant");let u=(tr,tn,ti)=>{if(!tr.session.isInitializer(tn[1].dataId)||tn.length>=3&&!tr.session.isInitializer(tn[2].dataId))throw Error("dynamic pad attributes are not allowed");let ta=Array.from(tn[1].integerData),ts=tn.length>=3?tn[2].floatData[0]:0;return(0,to.createAttributeWithCacheKey)({mode:ti,pads:ta,value:ts})},c=(tr,tn,ti)=>{let to=ta.ShapeUtil.padShape(tn.dims.slice(),ti.pads),ts=to.length,tl=` ${f(tr,tn,ti)} float process(int[${ts}] indices) { return padA(indices); }`;return{name:"Pad",inputNames:["A"],inputTypes:[tu.TextureType.unpacked],output:{dims:to,type:tn.type,textureType:tu.TextureType.unpacked},shaderSource:tl}},l=tr=>{if(!tr||1!==tr.length)throw Error("Pad requires 1 input");if("float32"!==tr[0].type&&"float64"!==tr[0].type)throw Error("Invalid input type.")},p=tr=>{if(!tr||2!==tr.length&&3!==tr.length)throw Error("Pad requires 2 or 3 inputs");if("int32"!==tr[1].type||tr.length>=3&&"string"===tr[2].type)throw Error("Invalid input type.")},f=(tr,tn,ti)=>{let to=(0,ts.getGlsl)(tr.session.backend.glContext.version),[tl,tc]=tr.calculateTextureWidthAndHeight(tn.dims,tu.TextureType.unpacked),tp=ta.ShapeUtil.computeStrides(tn.dims);switch(ti.mode){case"constant":return d(to,tn.dims,tp,tl,tc,ti.pads,ti.value);case"reflect":return h(to,tn.dims,tp,tl,tc,ti.pads);case"edge":return g(to,tn.dims,tp,tl,tc,ti.pads);default:throw Error("Invalid mode")}},d=(tr,tn,ti,to,ta,ts,tu)=>{let tl=tn.length,tc="";for(let tr=tl-1;tr>=0;--tr)tc+=` k = m[${tr}] - ${ts[tr]}; if (k < 0) return constant; if (k >= ${tn[tr]}) return constant; offset += k * ${ti[tr]}; `;return` float padA(int m[${tl}]) { const float constant = float(${tu}); int offset = 0; int k = 0; ${tc} vec2 coords = offsetToCoords(offset, ${to}, ${ta}); float value = getColorAsFloat(${tr.texture2D}(A, coords)); return value; } `},h=(tr,tn,ti,to,ta,ts)=>{let tu=tn.length,tl="";for(let tr=tu-1;tr>=0;--tr)tl+=` k = m[${tr}] - ${ts[tr]}; if (k < 0) { k = -k; } { const int _2n_1 = ${2*(tn[tr]-1)}; k = int( mod( float(k), float(_2n_1) ) ) ; if(k >= ${tn[tr]}) { k = _2n_1 - k; } } offset += k * ${ti[tr]}; `;return` float padA(int m[${tu}]) { int offset = 0; int k = 0; ${tl} vec2 coords = offsetToCoords(offset, ${to}, ${ta}); float value = getColorAsFloat(${tr.texture2D}(A, coords)); return value; } `},g=(tr,tn,ti,to,ta,ts)=>{let tu=tn.length,tl="";for(let tr=tu-1;tr>=0;--tr)tl+=` k = m[${tr}] - ${ts[tr]}; if (k < 0) k = 0; if (k >= ${tn[tr]}) k = ${tn[tr]-1}; offset += k * ${ti[tr]}; `;return` float padA(int m[${tu}]) { int offset = 0; int k = 0; ${tl} vec2 coords = offsetToCoords(offset, ${to}, ${ta}); float value = getColorAsFloat(${tr.texture2D}(A, coords)); return value; } `}},2143:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.globalMaxPool=tn.parseMaxPoolAttributes=tn.maxPool=tn.parseGlobalAveragePoolAttributes=tn.globalAveragePool=tn.parseAveragePoolAttributes=tn.averagePool=void 0;let to=ti(246),ta=ti(2517),ts=ti(2039);tn.averagePool=(tr,tn,ti)=>{p(tn);let to={name:"AveragePool",inputNames:["X"],inputTypes:[ts.TextureType.unpacked],cacheHint:ti.cacheKey};return[tr.run(Object.assign(Object.assign({},to),{get:()=>a(tn,to,!1,ti)}),tn)]},tn.parseAveragePoolAttributes=tr=>{let tn=tr.attributes.getString("auto_pad","NOTSET"),ti=tr.attributes.getInt("ceil_mode",0),ta=0!==tr.attributes.getInt("count_include_pad",0),ts=tr.attributes.getInts("kernel_shape"),tu=tr.attributes.getInts("strides",[]),tl=tr.attributes.getInts("pads",[]);if(0!==ti)throw Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,to.createAttributeWithCacheKey)({autoPad:tn,ceilMode:ti,countIncludePad:ta,kernelShape:ts,strides:tu,pads:tl})};let a=(tr,tn,ti,to)=>{let[tu,tl]=u(tr,to,ti),tc=ta.ShapeUtil.size(tu.kernelShape),tp="";tu.countIncludePad?tp+=`value /= float(${tc});`:tp+=`value /= float(${tc} - pad);`;let tf=` ${f(tr[0].dims,tu,"value += _X(x);",tp,"0.0")} `;return Object.assign(Object.assign({},tn),{output:{dims:tl,type:tr[0].type,textureType:ts.TextureType.unpacked},shaderSource:tf})};tn.globalAveragePool=(tr,tn,ti)=>{p(tn);let to={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[ts.TextureType.unpacked],cacheHint:`${ti.countIncludePad}`};return[tr.run(Object.assign(Object.assign({},to),{get:()=>a(tn,to,!0,ti)}),tn)]},tn.parseGlobalAveragePoolAttributes=tr=>{let tn=0!==tr.attributes.getInt("count_include_pad",0);return(0,to.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:tn,kernelShape:[],strides:[],pads:[]})},tn.maxPool=(tr,tn,ti)=>{p(tn);let to={name:"MaxPool",inputNames:["X"],inputTypes:[ts.TextureType.unpacked],cacheHint:ti.cacheKey};return[tr.run(Object.assign(Object.assign({},to),{get:()=>s(tn,to,!1,ti)}),tn)]},tn.parseMaxPoolAttributes=tr=>{let tn=tr.attributes.getString("auto_pad","NOTSET"),ti=tr.attributes.getInt("ceil_mode",0),ta=tr.attributes.getInts("kernel_shape"),ts=tr.attributes.getInts("strides",[]),tu=tr.attributes.getInts("pads",[]),tl=tr.attributes.getInt("storage_order",0),tc=tr.attributes.getInts("dilations",[]);if(0!==tl)throw Error("column major storage order is not yet supported for MaxPool");if(0!==ti)throw Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,to.createAttributeWithCacheKey)({autoPad:tn,ceilMode:ti,countIncludePad:!1,kernelShape:ta,strides:ts,pads:tu,storageOrder:tl,dilations:tc})};let s=(tr,tn,ti,to)=>{let[ta,tu]=u(tr,to,ti),tl=` ${f(tr[0].dims,ta,"\n value = max(_X(x), value);\n ","","-1e5")} `;return Object.assign(Object.assign({},tn),{output:{dims:tu,type:tr[0].type,textureType:ts.TextureType.unpacked},shaderSource:tl})},u=(tr,tn,ti)=>{let to=tr[0].dims.slice(),ts=Object.hasOwnProperty.call(tn,"dilations"),tu=tn.kernelShape.slice(),tl=tn.strides.slice(),tc=ts?tn.dilations.slice():[],tp=tn.pads.slice();ta.PoolConvUtil.adjustPoolAttributes(ti,to,tu,tl,tc,tp);let tf=ta.PoolConvUtil.computePoolOutputShape(ti,to,tl,tc,tu,tp,tn.autoPad),td=Object.assign({},tn);return ts?Object.assign(td,{kernelShape:tu,strides:tl,pads:tp,dilations:tc,cacheKey:tn.cacheKey}):Object.assign(td,{kernelShape:tu,strides:tl,pads:tp,cacheKey:tn.cacheKey}),[td,tf]},tu={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},tl={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[ts.TextureType.unpacked]};tn.globalMaxPool=(tr,tn)=>(p(tn),[tr.run(Object.assign(Object.assign({},tl),{get:()=>s(tn,tl,!0,tu)}),tn)]);let p=tr=>{if(!tr||1!==tr.length)throw Error("Pool ops requires 1 input.");if("float32"!==tr[0].type&&"float64"!==tr[0].type)throw Error("Invalid input type.")},f=(tr,tn,ti,to,ts)=>{let tu=tr.length;if(tn.kernelShape.length<=2){let ta=tn.kernelShape[tn.kernelShape.length-1],tl=tn.strides[tn.strides.length-1],tc=tn.pads[tn.pads.length/2-1],tp=tn.pads[tn.pads.length-1],tf=tr[tu-1],td="",th="",tg="";if(td=tc+tp!==0?` for (int i = 0; i < ${ta}; i++) { x[${tu} - 1] = indices[${tu} - 1] * ${tl} - ${tc} + i; if (x[${tu} - 1] < 0 || x[${tu} - 1] >= ${tf}) { pad++; continue; } ${ti} }`:` for (int i = 0; i < ${ta}; i++) { x[${tu} - 1] = indices[${tu} - 1] * ${tl} - ${tc} + i; ${ti} }`,2===tn.kernelShape.length){let ti=tn.kernelShape[tn.kernelShape.length-2],to=tn.strides[tn.strides.length-2],ts=tn.pads[tn.pads.length/2-2],tl=tn.pads[tn.pads.length-2],tc=tr[tu-2];th=ts+tl!==0?` for (int j = 0; j < ${ti}; j++) { x[${tu} - 2] = indices[${tu} - 2] * ${to} - ${ts} + j; if (x[${tu} - 2] < 0 || x[${tu} - 2] >= ${tc}) { pad+= ${ta}; continue; } `:` for (int j = 0; j < ${ti}; j++) { x[${tu} - 2] = indices[${tu} - 2] * ${to} - ${ts} + j; `,tg="\n }\n "}return` float process(int indices[${tu}]) { int x[${tu}]; copyVec(indices, x); float value = ${ts}; int pad = 0; ${th} ${td} ${tg} ${to} return value; } `}{let tl=ta.ShapeUtil.size(tn.kernelShape),tc=ta.ShapeUtil.computeStrides(tn.kernelShape),tp=tc.length,tf=tn.pads.length,td=h(tp),th=d(tr,"inputDims"),tg=d(tn.pads,"pads"),tb=d(tc,"kernelStrides"),tm=d(tn.strides,"strides"),ty="";return ty=tn.pads.reduce((tr,tn)=>tr+tn)?` if (x[j] >= inputDims[j] || x[j] < 0) { pad++; isPad = true; break; } } if (!isPad) { ${ti} }`:` } ${ti} `,` ${td} float process(int indices[${tu}]) { int x[${tu}]; copyVec(indices, x); int offset[${tp}]; int pads[${tf}]; int inputDims[${tu}]; int kernelStrides[${tp}]; int strides[${tp}]; ${tg} ${th} ${tm} ${tb} float value = ${ts}; int pad = 0; bool isPad = false; for (int i = 0; i < ${tl}; i++) { offsetToIndices(i, kernelStrides, offset); isPad = false; for (int j = ${tu} - ${tp}; j < ${tu}; j++) { x[j] = indices[j] * strides[j - ${tu} + ${tp}] + offset[j - ${tu} + ${tp}] - pads[j - 2]; ${ty} } ${to} return value; } `}},d=(tr,tn)=>{let ti="";for(let to=0;to` void offsetToIndices(int offset, int[${tr}] strides, out int[${tr}] indices) { if (${tr} == 0) { return; } for (int i = 0; i < ${tr} - 1; ++i) { indices[i] = offset / strides[i]; offset -= indices[i] * strides[i]; } indices[${tr} - 1] = offset; }`},4939:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.reduceLogSumSquare=tn.reduceLogSum=tn.reduceProd=tn.reduceMin=tn.reduceMax=tn.reduceMean=tn.reduceSum=tn.parseReduceAttributes=void 0;let to=ti(246),ta=ti(782),ts=ti(2517),tu=ti(2039),s=(tr,tn,ti,to,ta)=>{c(tn);let ts={name:to,inputNames:["A"],inputTypes:[tu.TextureType.unpacked]};return[tr.run(Object.assign(Object.assign({},ts),{cacheHint:ti.cacheKey,get:()=>u(tr,tn,ti,to,ta,ts)}),tn)]};tn.parseReduceAttributes=tr=>{let tn=tr.attributes.getInts("axes",[]),ti=1===tr.attributes.getInt("keepdims",1);return(0,to.createAttributeWithCacheKey)({axes:tn,keepDims:ti})};let u=(tr,tn,ti,to,ta,tl)=>{let tc=[],tp=tn[0].dims.length||1,tf=[],td=ts.ShapeUtil.normalizeAxes(ti.axes,tn[0].dims.length),th=ta(tn,td),tg=th[1];for(let tr=0;tr=0||0===td.length?(ti.keepDims&&tc.push(1),tg=` for(int j${tr} = 0; j${tr} < ${tn[0].dims[tr]}; j${tr}++) { inputIdx[${tr}] = j${tr}; ${tg} }`):(tf.push(`inputIdx[${tr}] = outputIdx[${tc.length}];`),tc.push(tn[0].dims[tr]));let tb=` float process(int outputIdx[${tc.length||1}]) { float value; // final result int inputIdx[${tp}]; // addressing input data ${tf.join("\n")} ${th[0]} // init ops for reduce max/min ${tg} ${th[2]} // final computation for reduce mean return value; }`;return Object.assign(Object.assign({},tl),{output:{dims:tc,type:tn[0].type,textureType:tu.TextureType.unpacked},shaderSource:tb})},c=tr=>{if(!tr||1!==tr.length)throw Error("Reduce op requires 1 input.");if(-1===ta.NUMBER_TYPES.indexOf(tr[0].type))throw Error("Invalid input type.")};tn.reduceSum=(tr,tn,ti)=>s(tr,tn,ti,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),tn.reduceMean=(tr,tn,ti)=>s(tr,tn,ti,"ReduceMean",(tr,tn)=>{let ti=1;for(let to=0;to=0||0===tn.length)&&(ti*=tr[0].dims[to]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${ti}.;`]}),tn.reduceMax=(tr,tn,ti)=>s(tr,tn,ti,"ReduceMax",(tr,tn)=>{let ti=[];for(let to=0;to=0||0===tn.length)&&ti.push(`inputIdx[${to}] = 0;`);return[`${ti.join("\n")} value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),tn.reduceMin=(tr,tn,ti)=>s(tr,tn,ti,"ReduceMin",(tr,tn)=>{let ti=[];for(let to=0;to=0||0===tn.length)&&ti.push(`inputIdx[${to}] = 0;`);return[`${ti.join("\n")} value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),tn.reduceProd=(tr,tn,ti)=>s(tr,tn,ti,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),tn.reduceLogSum=(tr,tn,ti)=>s(tr,tn,ti,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),tn.reduceLogSumSquare=(tr,tn,ti)=>s(tr,tn,ti,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.isReshapeCheap=tn.processDims3D=tn.createPackedReshape3DProgramInfoLoader=void 0;let to=ti(2517),ta=ti(5060),ts=ti(2039),tu=ti(2827);tn.createPackedReshape3DProgramInfoLoader=(tr,tn,ti)=>{var tl;let tc=(tl=ti,{name:"Reshape (packed)",inputTypes:[ts.TextureType.packed],inputNames:["A"],cacheHint:`${tl}`});return Object.assign(Object.assign({},tc),{get:()=>((tr,tn,ti,tl)=>{let tc=tn.dims,tp=tl,tf="";for(let tr=0;tr<4;tr++){let tn="";switch(tr){case 0:tn="outputCoords = rc;";break;case 1:tn="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:tn="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:tn="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw Error()}tf+=` ${tn} ${tr>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} int flattenedIndex = getFlattenedIndex(outputCoords); ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); result[${tr}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); ${tr>0?"}":""} `}let td=(0,ta.getGlsl)(tr.session.backend.glContext.version),th=` ${function(tr){let tn=to.ShapeUtil.computeStrides(tr),ti=["b","r","c"],ta="index";return` ivec3 inputCoordsFromReshapedOutCoords(int index) { ${tn.map((tr,to)=>`int ${ti[to]} = ${ta} / ${tr}; ${to===tn.length-1?`int ${ti[to+1]} = ${ta} - ${ti[to]} * ${tr}`:`index -= ${ti[to]} * ${tr}`};`).join("")} return ivec3(b, r, c); } `}(tc)} ${function(tr){let tn=to.ShapeUtil.computeStrides(tr);return` int getFlattenedIndex(ivec3 coords) { // reverse y, z order return coords.x * ${tn[0]} + coords.z * ${tn[1]} + coords.y; } `}(tp)} ${(0,tu.unpackFromChannel)()} void main() { ivec3 rc = getOutputCoords(); vec4 result = vec4(0.0); ivec3 outputCoords; int rows = ${tp[2]}; int cols = ${tp[1]}; ${tf} ${td.output} = result; } `;return Object.assign(Object.assign({},ti),{output:{dims:tp,type:tn.type,textureType:ts.TextureType.packed},shaderSource:th,hasMain:!0})})(tr,tn,tc,ti)})},tn.processDims3D=function(tr){if(0===tr.length)return[1,1,1];let tn=1;for(let ti=0;ti1?tr[tr.length-2]:1,tr[tr.length-1]]},tn.isReshapeCheap=function(tr,tn){return 0===tr.length||0===tn.length||(tr.length<2||tn.length<2?tr[tr.length-1]===tn[tn.length-1]:tr[tr.length-1]===tn[tn.length-1]&&tr[tr.length-2]===tn[tn.length-2])}},718:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.reshape=void 0;let to=ti(2517);tn.reshape=(tr,tn)=>{let ti=to.ShapeUtil.calculateReshapedDims(tn[0].dims,tn[1].integerData);return tr.session.pack?[tr.reshapePacked(tn[0],ti)]:[tr.reshapeUnpacked(tn[0],ti)]}},2268:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseResizeAttributesV11=tn.parseResizeAttributesV10=tn.resize=void 0;let to=ti(5060),ta=ti(2039),ts=ti(9390),tu=ti(2827),tl=ti(9793),tc={name:"Resize",inputNames:["A"],inputTypes:[ta.TextureType.packed]};tn.resize=(tr,tn,ti)=>((0,tl.validateInputs)(tn,ti),[tr.run(Object.assign(Object.assign({},tc),{cacheHint:ti.cacheKey,get:()=>c(tr,tn,ti)}),tn)]),tn.parseResizeAttributesV10=tr=>(0,tl.parseUpsampleAttributes)(tr,10),tn.parseResizeAttributesV11=tr=>(0,tl.parseUpsampleAttributes)(tr,11);let c=(tr,tn,ti)=>{let tl=(0,to.getGlsl)(tr.session.backend.glContext.version),[tp,tf]=l(tn,ti);if(tp.every(tr=>1===tr)&&"tf_crop_and_resize"!==ti.coordinateTransformMode)return Object.assign(Object.assign({},tc),{output:{dims:tf,type:tn[0].type,textureType:ta.TextureType.packed},hasMain:!0,shaderSource:`void main() { vec4 v = ${tl.texture2D}(X, TexCoords); ${tl.output} = v; }`});let td=tf.length;if(td<2)throw Error(`output dimension should be at least 2, but got ${td}`);let th=tf[td-2],tg=tf[td-1],tb=tn[0].dims;if(td!==tb.length)throw Error(`output dimension should match input ${tb.length}, but got ${td}`);let tm=tb[td-2],ty=tb[td-1],t_=tp[td-2],tv=tp[td-1],tx="";if("linear"!==ti.mode)throw Error(`resize (packed) does not support mode: '${ti.mode}'`);switch(ti.coordinateTransformMode){case"asymmetric":tx="\n vec4 getSourceFracIndex(ivec4 coords) {\n return vec4(coords) / scaleWHWH;\n }\n ";break;case"half_pixel":tx="\n vec4 getSourceFracIndex(ivec4 coords) {\n return (vec4(coords) + 0.5) / scaleWHWH - 0.5;\n }\n ";break;case"pytorch_half_pixel":tx=` vec4 getSourceFracIndex(ivec4 coords) { vec4 fcoords = vec4(coords); return vec4( ${tg}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, ${th}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, ${tg}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, ${th}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 ); } `;break;case"align_corners":tx=` vec4 getSourceFracIndex(ivec4 coords) { vec4 resized = vec4(${tg}.0 - 1.0, ${th}.0 - 1.0, ${tg}.0 - 1.0, ${th}.0 - 1.0); vec4 original = vec4(${ty}.0 - 1.0, ${tm}.0 - 1.0, ${ty}.0 - 1.0, ${tm}.0 - 1.0); vec4 new_scale = original / resized; return vec4(coords) * new_scale; } `;break;default:throw Error(`resize (packed) does not support coordinateTransformMode: '${ti.coordinateTransformMode}'`)}let tw=(0,ts.getCoordsDataType)(td),tT=` const vec2 inputWH = vec2(${tm}.0, ${ty}.0); const vec4 scaleWHWH = vec4(float(${t_}), float(${tv}), float(${t_}), float(${tv})); ${(0,tu.unpackFromChannel)()} ${tx} float getAValue(int x10, int r, int c, int d) { return getChannel(getA(x10, r, c, d), vec2(c, d)); } void main() { ${tw} rc = getOutputCoords(); int batch = rc[0]; int depth = rc[1]; // retrieve the 4 coordinates that is used in the 4 packed output values. ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); // calculate the source index in fraction vec4 sourceFrac = getSourceFracIndex(coords); // get the lower and upper bound of the 4 values that will be packed into one texel. ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); bool hasNextRow = rc.w < ${th-1}; bool hasNextCol = rc.z < ${tg-1}; // pack x00, x01, x10, x11's top-left corner into one vec4 structure vec4 topLeft = vec4( getAValue(batch, depth, x00.x, x00.y), hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); // pack x00, x01, x10, x11's top-right corner into one vec4 structure vec4 topRight = vec4( getAValue(batch, depth, x00.x, x00.w), hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure vec4 bottomLeft = vec4( getAValue(batch, depth, x00.z, x00.y), hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure vec4 bottomRight = vec4( getAValue(batch, depth, x00.z, x00.w), hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); // calculate the interpolation fraction on u and v direction vec4 frac = vec4(sourceFrac) - floor(sourceFrac); vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); vec4 top = mix(topLeft, topRight, clampFrac.ywyw); vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); vec4 newValue = mix(top, bottom, clampFrac.xxzz); ${tl.output} = vec4(newValue); } `;return Object.assign(Object.assign({},tc),{output:{dims:tf,type:tn[0].type,textureType:ta.TextureType.packed},hasMain:!0,shaderSource:tT})},l=(tr,tn)=>{let ti=tr[0].dims,to,ta=tn.scales;if(0===ta.length){let ts=tr[tn.scalesInputIdx];if(ts&&0!==ts.size){if(tr[tn.sizesInputIdx])throw Error("Only one of scales or sizes must be provided as input.");ta=p(ts,tn.mode,tn.isResize)}else{let ts=tr[tn.sizesInputIdx];if(!ts||0===ts.size)throw Error("Either scales or sizes MUST be provided as input.");ta=f(to=Array.from(ts.integerData),ti,tn.mode,tn.isResize)}}else if(tr[tn.sizesInputIdx])throw Error("Only one of scales or sizes must be provided as input.");let ts=to||ti.map((tr,tn)=>Math.floor(tr*ta[tn]));return[ta,ts]},p=(tr,tn,ti)=>{let to=Array.from(tr.floatData);return(0,tl.scalesValidation)(to,tn,ti),to},f=(tr,tn,ti,to)=>{let ta=tn.length,ts=Array(ta);for(let ti=0,to=ta;ti{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.shape=void 0;let to=ti(9162);tn.shape=(tr,tn)=>(i(tn),[new to.Tensor([tn[0].dims.length],"int32",void 0,void 0,new Int32Array(tn[0].dims))]);let i=tr=>{if(!tr||1!==tr.length)throw Error("Shape requires 1 input.")}},2278:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.sliceV10=tn.parseSliceAttributes=tn.slice=void 0;let to=ti(246),ta=ti(782),ts=ti(2517),tu=ti(2039),tl={name:"Slice",inputNames:["A"],inputTypes:[tu.TextureType.unpacked]};tn.slice=(tr,tn,ti)=>(c(tn),[tr.run(Object.assign(Object.assign({},tl),{cacheHint:ti.cacheKey,get:()=>u(tr,tn[0],ti)}),tn)]),tn.parseSliceAttributes=tr=>{let tn=tr.attributes.getInts("starts"),ti=tr.attributes.getInts("ends"),ta=tr.attributes.getInts("axes",[]);return(0,to.createAttributeWithCacheKey)({starts:tn,ends:ti,axes:ta})};let u=(tr,tn,ti)=>{let to=0===ti.axes.length?tn.dims.slice(0).map((tr,tn)=>tn):ti.axes,ta=ts.ShapeUtil.normalizeAxes(to,tn.dims.length),tc=ti.starts.map((tr,ti)=>tr>tn.dims[ta[ti]]-1?tn.dims[ta[ti]]:ts.ShapeUtil.normalizeAxis(tr,tn.dims[ta[ti]])),tp=ti.ends.map((tr,ti)=>tr>tn.dims[ta[ti]]-1?tn.dims[ta[ti]]:ts.ShapeUtil.normalizeAxis(tr,tn.dims[ta[ti]])),tf=tn.dims.slice(),td=[];for(let tr=0;tr0&&td.push(`outputIdx[${ta[tr]}] += ${tc[tr]};`);let th=` float process(int outputIdx[${tf.length}]) { ${td.join("\n ")} return _A(outputIdx); }`;return Object.assign(Object.assign({},tl),{output:{dims:tf,type:tn.type,textureType:tu.TextureType.unpacked},shaderSource:th})},c=tr=>{if(!tr||1!==tr.length)throw Error("Slice requires 1 input.");if(-1===ta.NUMBER_TYPES.indexOf(tr[0].type))throw Error("Invalid input type.")};tn.sliceV10=(tr,tn)=>{p(tn);let ti=l(tr,tn);return[tr.run(Object.assign(Object.assign({},tl),{cacheHint:ti.cacheKey,get:()=>u(tr,tn[0],ti)}),[tn[0]])]};let l=(tr,tn)=>{if(!tr.session.isInitializer(tn[1].dataId)||!tr.session.isInitializer(tn[2].dataId)||tn.length>=4&&!tr.session.isInitializer(tn[3].dataId)||tn.length>=5&&!tr.session.isInitializer(tn[4].dataId))throw Error("dynamic slice attributes are not allowed");if(tn.length>=5&&tn[4].integerData.some(tr=>1!==tr))throw Error("currently non-1 steps is not supported for Slice");let ti=Array.from(tn[1].integerData),to=Array.from(tn[2].integerData),ta=tn.length>=4?Array.from(tn[3].integerData):[];return{starts:ti,ends:to,axes:ta,cacheKey:`${ta};${ti};${to}`}},p=tr=>{if(!tr||tr.length<3||tr.length>5)throw Error("Invalid input number.");if("int32"!==tr[1].type||1!==tr[1].dims.length||"int32"!==tr[2].type||1!==tr[2].dims.length||tr.length>=4&&("int32"!==tr[3].type||1!==tr[3].dims.length)||tr.length>=5&&("int32"!==tr[4].type||1!==tr[4].dims.length))throw Error("Invalid input type.")}},5524:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.softmaxV13=tn.parseSoftmaxAttributesV13=tn.parseSoftmaxAttributes=tn.softmax=void 0;let to=ti(246),ta=ti(2517),ts=ti(5060),tu=ti(2039),tl=ti(3738),tc={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[tu.TextureType.unpacked]},tp={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[tu.TextureType.unpacked,tu.TextureType.unpacked]},tf={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[tu.TextureType.unpacked,tu.TextureType.unpacked,tu.TextureType.unpacked]};tn.softmax=(tr,tn,ti)=>{g(tn);let to=tn[0].dims.slice(),ts=ta.ShapeUtil.normalizeAxis(ti.axis,to.length),tu=ta.ShapeUtil.sizeToDimension(to,ts),tl=ta.ShapeUtil.sizeFromDimension(to,ts);return p(tr,tn,ti,tu,tl)},tn.parseSoftmaxAttributes=tr=>(0,to.createAttributeWithCacheKey)({axis:tr.attributes.getInt("axis",1)}),tn.parseSoftmaxAttributesV13=tr=>(0,to.createAttributeWithCacheKey)({axis:tr.attributes.getInt("axis",-1)}),tn.softmaxV13=(tr,tn,ti)=>{g(tn);let ts=tn[0].dims.slice(),tu=ta.ShapeUtil.normalizeAxis(ti.axis,ts.length),tc=ts.length,tp=tu!==tc-1,tf=[],td,th=[],tg=[];tp&&((th=Array.from({length:tc}).map((tr,tn)=>tn))[tu]=tc-1,th[tc-1]=tu,th.map(tr=>tf.push(ts[tr])),td=(0,to.createAttributeWithCacheKey)({perm:th}),tg=(0,tl.transpose)(tr,tn,td));let tb=tp?ta.ShapeUtil.sizeToDimension(tf,tc-1):ta.ShapeUtil.sizeToDimension(ts,tc-1),tm=tp?ta.ShapeUtil.sizeFromDimension(tf,tc-1):ta.ShapeUtil.sizeFromDimension(ts,tc-1),ty=p(tr,tp?tg:tn,ti,tb,tm);return tp?(0,tl.transpose)(tr,ty,td):ty};let p=(tr,tn,ti,to,ta)=>{let ts=f(tr,tn[0],to,ta,[to]),tu=tr.run(Object.assign(Object.assign({},tc),{cacheHint:ti.cacheKey,get:()=>ts}),tn),tl=d(tr,tn[0],to,ta,ts.output.dims,[to]),td=tr.run(Object.assign(Object.assign({},tp),{cacheHint:ti.cacheKey,get:()=>tl}),[tn[0],tu]),th=h(tr,tn[0],to,ta,ts.output.dims,tl.output.dims);return[tr.run(Object.assign(Object.assign({},tf),{cacheHint:ti.cacheKey,get:()=>th}),[tn[0],tu,td])]},f=(tr,tn,ti,to,ta)=>{let[tl,tp]=tr.calculateTextureWidthAndHeight(tn.dims,tu.TextureType.unpacked),tf=ta.length;if(ti<1||to<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==ta.length)throw Error("Dimensionality of the output should be 1");if(ta[0]!==ti)throw Error("Shape of the output should be equal to logical row count");let td=(0,ts.getGlsl)(tr.session.backend.glContext.version),th=` float process(int[${tf}] indices) { int logical_row_start_offset = indices[0] * ${to}; float max = getColorAsFloat(${td.texture2D}(A, offsetToCoords(logical_row_start_offset, ${tl}, ${tp} ))); for(int i=1; i<${to}; ++i) { float current = getColorAsFloat(${td.texture2D}(A, offsetToCoords(logical_row_start_offset + i, ${tl}, ${tp}))); if(current > max) max = current; } return max; }`;return Object.assign(Object.assign({},tc),{output:{dims:ta,type:tn.type,textureType:tu.TextureType.unpacked},shaderSource:th})},d=(tr,tn,ti,to,ta,tl)=>{let[tc,tf]=tr.calculateTextureWidthAndHeight(tn.dims,tu.TextureType.unpacked),td=tl.length;if(ti<1||to<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==tl.length)throw Error("Dimensionality of the output should be 1");if(tl[0]!==ti)throw Error("Shape of the output should be equal to logical row count");if(1!==ta.length)throw Error("Dimensionality of the intermediate results should be 1");if(ta[0]!==ti)throw Error("Shape of the intermediate results should be equal to logical row count");let th=` float process(int[${td}] indices) { int logical_row_start_offset = indices[0] * ${to}; float norm_factor = 0.0; float max = _Max(indices); for(int i=0; i<${to}; ++i) { norm_factor += exp(getColorAsFloat(${(0,ts.getGlsl)(tr.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, ${tc}, ${tf}))) - max); } return norm_factor; }`;return Object.assign(Object.assign({},tp),{output:{dims:tl,type:tn.type,textureType:tu.TextureType.unpacked},shaderSource:th})},h=(tr,tn,ti,to,ta,ts)=>{let[tl,tc]=tr.calculateTextureWidthAndHeight(tn.dims,tu.TextureType.unpacked),tp=tn.dims.length;if(ti<1||to<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==ta.length||1!==ts.length)throw Error("Dimensionality of the intermediate results should be 1");if(ta[0]!==ti||ts[0]!==ti)throw Error("Shape of the intermediate results should be equal to logical row count");let td=` float process(int[${tp}] indices) { // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) int offset = coordsToOffset(TexCoords, ${tl}, ${tc}); //determine the logical row for this index int logical_row_index[1]; logical_row_index[0] = offset / ${to}; float norm_factor = _Norm(logical_row_index); // avoid possible division by 0 // if norm_facor is 0, all elements are zero // if so, return 0 if(norm_factor == 0.0) return 0.0; return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; }`;return Object.assign(Object.assign({},tf),{output:{dims:tn.dims,type:tn.type,textureType:tu.TextureType.unpacked},shaderSource:td})},g=tr=>{if(!tr||1!==tr.length)throw Error("Softmax requires 1 input.");if("float32"!==tr[0].type&&"float64"!==tr[0].type)throw Error("Invalid input type")}},5975:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseSplitAttributes=tn.split=void 0;let to=ti(246),ta=ti(2517),ts=ti(2039),tu={name:"Split",inputNames:["A"],inputTypes:[ts.TextureType.unpacked]};tn.split=(tr,tn,ti)=>{c(tn);let to=ta.ShapeUtil.normalizeAxis(ti.axis,tn[0].dims.length),ts=s(tr,tn,to,ti),tl=[];for(let ta=0;tau(tr,tn[0],ti,to,ta)}),tn));return tl},tn.parseSplitAttributes=tr=>{let tn=tr.attributes.getInt("axis",0),ti=tr.attributes.getInts("split",[]),ta=tr.outputs.length;return(0,to.createAttributeWithCacheKey)({axis:tn,split:ti,numOutputs:ta})};let s=(tr,tn,ti,to)=>{let[,ts]=ta.SplitUtil.splitShape(tn[0].dims,ti,to.split,to.numOutputs);return ts.length},u=(tr,tn,ti,to,tl)=>{let[tc,tp]=ta.SplitUtil.splitShape(tn.dims,to,ti.split,ti.numOutputs),tf=tp[tl],td=tc[tl],th=` float process(int indices[${td.length}]) { indices[${to}] += ${tf}; return _A(indices); } `;return Object.assign(Object.assign({},tu),{cacheHint:`${ti.cacheKey}:${tl}`,output:{dims:td,type:tn.type,textureType:ts.TextureType.unpacked},shaderSource:th})},c=tr=>{if(!tr||1!==tr.length)throw Error("Split requires one input.");if("int8"!==tr[0].type&&"uint8"!==tr[0].type&&"int16"!==tr[0].type&&"uint16"!==tr[0].type&&"int32"!==tr[0].type&&"uint32"!==tr[0].type&&"float32"!==tr[0].type&&"float64"!==tr[0].type&&"bool"!==tr[0].type)throw Error("Invalid input type.")}},3933:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseSqueezeAttributes=tn.squeezeV13=tn.squeeze=void 0;let to=ti(2517);tn.squeeze=(tr,tn,ti)=>{i(tn);let ta=to.ShapeUtil.squeezeShape(tn[0].dims,ti);return[tr.reshapeUnpacked(tn[0],ta)]},tn.squeezeV13=(tr,ti)=>(o(ti),(0,tn.squeeze)(tr,[ti[0]],Array.from(ti[1].integerData))),tn.parseSqueezeAttributes=tr=>tr.attributes.getInts("axes");let i=tr=>{if(!tr||1!==tr.length)throw Error("Squeeze requires 1 input.");if("string"===tr[0].type)throw Error("invalid input tensor types.")},o=tr=>{if(!tr||2!==tr.length)throw Error("Squeeze requires 2 inputs.");if("int32"!==tr[1].type)throw Error("Invalid input type.")}},6558:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.sum=void 0;let to=ti(5060),ta=ti(2039);tn.sum=(tr,tn)=>{a(tn);let ti={name:"Sum",inputNames:tn.map((tr,tn)=>`X${tn}`),inputTypes:Array(tn.length).fill(ta.TextureType.unpacked)};return[tr.run(Object.assign(Object.assign({},ti),{get:()=>o(tr,tn,ti)}),tn)]};let o=(tr,tn,ti)=>{let ts=(0,to.getGlsl)(tr.session.backend.glContext.version),tu=tn[0].dims.slice(),tl=` void main() { vec4 result = ${tn.map((tr,tn)=>`${ts.texture2D}(X${tn},TexCoords)`).join(" + ")}; ${ts.output} = result; } `;return Object.assign(Object.assign({},ti),{output:{dims:tu,type:tn[0].type,textureType:ta.TextureType.unpacked},hasMain:!0,shaderSource:tl})},a=tr=>{if(!tr||0===tr.length)throw Error("Sum requires inputs.");let tn=tr[0].dims.length;for(let ti=1;ti{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.tile=void 0;let to=ti(782),ta=ti(2039);tn.tile=(tr,tn)=>{a(tn);let ti={name:"Tile",inputNames:["A"],inputTypes:[ta.TextureType.unpacked]};return[tr.run(Object.assign(Object.assign({},ti),{get:()=>o(tr,tn,ti)}),tn)]};let o=(tr,tn,ti)=>{let to=tn[0].dims.slice(),ts=Array(to.length),tu=[];for(let tr=0;tr{if(!tr||2!==tr.length)throw Error("Tile requires 2 input.");if(1!==tr[1].dims.length)throw Error("The second input shape must 1 dimension.");if(tr[1].dims[0]!==tr[0].dims.length)throw Error("Invalid input shape.");if(-1===to.NUMBER_TYPES.indexOf(tr[0].type))throw Error("Invalid input type.");if("int32"!==tr[1].type&&"int16"!==tr[1].type)throw Error("Invalid repeat type.")}},3738:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseTransposeAttributes=tn.transpose=void 0;let to=ti(246),ta=ti(2517),ts=ti(2039),tu={name:"Transpose",inputNames:["A"],inputTypes:[ts.TextureType.unpacked]};tn.transpose=(tr,tn,ti)=>(p(tn),[tr.run(Object.assign(Object.assign({},tu),{cacheHint:ti.cacheKey,get:()=>s(tr,tn[0],ti.perm)}),tn)]),tn.parseTransposeAttributes=tr=>(0,to.createAttributeWithCacheKey)({perm:tr.attributes.getInts("perm",[])});let s=(tr,tn,ti)=>{let to=tn.dims;ti=u(to,ti);let ta=c(to,ti),tl=to.length,tc=` ${l("perm",ti,tl)} float process(int indices[${tl}]) { int a[${tl}]; perm(a, indices); return _A(a); }`;return Object.assign(Object.assign({},tu),{output:{dims:ta,type:tn.type,textureType:ts.TextureType.unpacked},shaderSource:tc})},u=(tr,tn)=>(tn&&tn.length!==tr.length&&(tn=[...tr.keys()].reverse()),tn),c=(tr,tn)=>(tn=u(tr,tn),ta.ShapeUtil.sortBasedOnPerm(tr,tn)),l=(tr,tn,ti)=>{let to=[];to.push(`void ${tr}(out int a[${ti}], int src[${ti}]) {`);for(let tr=0;tr{if(!tr||1!==tr.length)throw Error("Transpose requires 1 input.");if("float32"!==tr[0].type&&"float64"!==tr[0].type)throw Error("input should be float tensor")}},8710:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.encodeAsUint8=void 0;let to=ti(5060),ta=ti(2039);tn.encodeAsUint8=(tr,tn)=>{let ti=tn.shape,ts=(0,to.getGlsl)(tr.session.backend.glContext.version),tu=` const float FLOAT_MAX = 1.70141184e38; const float FLOAT_MIN = 1.17549435e-38; bool isNaN(float val) { return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; } highp vec4 encodeAsUint8(highp float v) { if (isNaN(v)) { return vec4(255, 255, 255, 255); } highp float av = abs(v); if(av < FLOAT_MIN) { return vec4(0.0, 0.0, 0.0, 0.0); } else if(v > FLOAT_MAX) { return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; } else if(v < -FLOAT_MAX) { return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; } highp vec4 c = vec4(0,0,0,0); highp float e = floor(log2(av)); highp float m = exp2(fract(log2(av))) - 1.0; c[2] = floor(128.0 * m); m -= c[2] / 128.0; c[1] = floor(32768.0 * m); m -= c[1] / 32768.0; c[0] = floor(8388608.0 * m); highp float ebias = e + 127.0; c[3] = floor(ebias / 2.0); ebias -= c[3] * 2.0; c[2] += floor(ebias) * 128.0; c[3] += 128.0 * step(0.0, -v); return c / 255.0; } void main() { float value = ${ts.texture2D}(X,TexCoords).r; ${ts.output} = encodeAsUint8(value); }`,tl={name:"Uint8Encode",inputTypes:[ta.TextureType.unpacked],inputNames:["X"],output:{dims:ti,type:tn.tensor.type,textureType:ta.TextureType.downloadUint8AsFloat},shaderSource:tu,hasMain:!0};return tr.executeProgram(tl,[tn.tensor])}},4909:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.tanh=tn.tan=tn.sqrt=tn.sin=tn.sigmoid=tn.relu=tn.not=tn.neg=tn.log=tn.parseLeakyReluAttributes=tn.leakyRelu=tn.identity=tn.floor=tn.exp=tn.parseEluAttributes=tn.elu=tn.cos=tn.ceil=tn.clipV11=tn.parseClipAttributes=tn.clip=tn.atan=tn.asin=tn.acos=tn.abs=tn.glslTanh=tn.glslTan=tn.glslSqrt=tn.glslSigmoid=tn.glslRelu=tn.glslSin=tn.glslNot=tn.glslNeg=tn.glslLog=tn.glslLeakyRelu=tn.glslIdentity=tn.glslClip=tn.glslFloor=tn.glslExp=tn.glslElu=tn.glslCos=tn.glslCeil=tn.glslAtan=tn.glslAsin=tn.glslAcos=tn.glslAbs=void 0;let to=ti(246),ta=ti(2517),ts=ti(8520),tu=ti(5060),tl=ti(2039);function u(){return P("abs")}function c(){return P("acos")}function l(){return P("asin")}function p(){return P("atan")}function f(){return P("ceil")}function d(){return P("cos")}function h(tr){let tn="elu";return{body:` const float alpha = float(${tr}); float ${tn}_(float a) { return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; } vec4 ${tn}_(vec4 v) { return vec4(${tn}_(v.x), ${tn}_(v.y), ${tn}_(v.z), ${tn}_(v.w)); } `,name:tn,type:ts.FunctionType.ValueBased}}function g(){return P("exp")}function b(){return P("floor")}function m(tr,tn){let ti="clip";return{body:` const float min = float(${tr}); const float max = float(${tn}); float ${ti}_(float a) { return clamp(a, min, max); } vec4 ${ti}_(vec4 v) { return clamp(v, min, max); } `,name:ti,type:ts.FunctionType.ValueBased}}function y(){let tr="indentity";return{body:` float ${tr}_(float a) { return a; } vec4 ${tr}_(vec4 v) { return v; } `,name:tr,type:ts.FunctionType.ValueBased}}function _(tr){let tn="leakyRelu";return{body:` const float alpha = float(${tr}); float ${tn}_(float a) { return a < 0.0 ? a * alpha : a; } vec4 ${tn}_(vec4 v) { return vec4(${tn}_(v.x), ${tn}_(v.y), ${tn}_(v.z), ${tn}_(v.w)); } `,name:tn,type:ts.FunctionType.ValueBased}}function v(){return P("log")}function w(){let tr="neg";return{body:` float ${tr}_(float a) { return -a; } vec4 ${tr}_(vec4 v) { return -v; } `,name:tr,type:ts.FunctionType.ValueBased}}function x(){let tr="not";return{body:` float ${tr}_(float a) { return float( ! bool(a) ); } bool ${tr}_(bool a) { return !a; } vec4 ${tr}_(vec4 v) { return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); } bvec4 ${tr}_(bvec4 v) { return bvec4(!v.x, !v.y, !v.z, !v.w); } `,name:tr,type:ts.FunctionType.ValueBased}}function T(){return P("sin")}function S(){let tr="relu";return{body:` float ${tr}_(float a) { return max( a, 0.0 ); } vec4 ${tr}_(vec4 v) { return max( v, 0.0 ); } `,name:tr,type:ts.FunctionType.ValueBased}}function O(){let tr="sigmoid";return{body:` float ${tr}_(float a) { return 1.0 / (1.0 + exp(-a)); } vec4 ${tr}_(vec4 v) { return 1.0 / (1.0 + exp(-v)); } `,name:tr,type:ts.FunctionType.ValueBased}}function A(){return P("sqrt")}function E(){return P("tan")}function I(){let tr="tanh";return{body:` float ${tr}_(float a) { a = clamp(a, -10., 10.); a = exp(2.*a); return (a - 1.) / (a + 1.); } vec4 ${tr}_(vec4 v) { v = clamp(v, -10., 10.); v = exp(2.*v); return (v - 1.) / (v + 1.); } `,name:tr,type:ts.FunctionType.ValueBased}}function P(tr){return{body:` float ${tr}_(float a) { return ${tr}(a); } vec4 ${tr}_(vec4 v) { return ${tr}(v); } `,name:tr,type:ts.FunctionType.ValueBased}}tn.glslAbs=u,tn.glslAcos=c,tn.glslAsin=l,tn.glslAtan=p,tn.glslCeil=f,tn.glslCos=d,tn.glslElu=h,tn.glslExp=g,tn.glslFloor=b,tn.glslClip=m,tn.glslIdentity=y,tn.glslLeakyRelu=_,tn.glslLog=v,tn.glslNeg=w,tn.glslNot=x,tn.glslSin=T,tn.glslRelu=S,tn.glslSigmoid=O,tn.glslSqrt=A,tn.glslTan=E,tn.glslTanh=I;let D=(tr,tn,ti,to)=>{let ta=tr.session.pack?tl.TextureType.packed:tl.TextureType.unpacked,ts={name:ti.name,inputTypes:[ta],inputNames:["A"],cacheHint:to};return Object.assign(Object.assign({},ts),{get:()=>((tr,tn,ti,to)=>{let ta=tr.session.pack?tl.TextureType.packed:tl.TextureType.unpacked,ts=(0,tu.getGlsl)(tr.session.backend.glContext.version);return Object.assign(Object.assign({},tn),{output:{dims:ti.dims,type:ti.type,textureType:ta},shaderSource:` ${to.body} void main() { vec4 v = ${ts.texture2D}(A, TexCoords); v = ${to.name}_(v); ${ts.output} = v; } `,hasMain:!0})})(tr,ts,tn,ti)})};tn.abs=(tr,tn)=>[tr.run(D(tr,tn[0],u()),tn)],tn.acos=(tr,tn)=>[tr.run(D(tr,tn[0],c()),tn)],tn.asin=(tr,tn)=>[tr.run(D(tr,tn[0],l()),tn)],tn.atan=(tr,tn)=>[tr.run(D(tr,tn[0],p()),tn)],tn.clip=(tr,tn,ti)=>[tr.run(D(tr,tn[0],m(ti.min,ti.max),ti.cacheKey),tn)],tn.parseClipAttributes=tr=>(0,to.createAttributeWithCacheKey)({min:tr.attributes.getFloat("min",ta.MIN_CLIP),max:tr.attributes.getFloat("max",ta.MAX_CLIP)}),tn.clipV11=(tr,ti)=>{let to=$(tr,ti);return(0,tn.clip)(tr,[ti[0]],to)};let $=(tr,tn)=>{if(tn.length>=3&&(!tr.session.isInitializer(tn[1].dataId)||!tr.session.isInitializer(tn[2].dataId)))throw Error("dynamic clip attributes are not allowed");let ti=tn.length>=3?tn[1].numberData[0]:ta.MIN_CLIP,ts=tn.length>=3?tn[2].numberData[0]:ta.MAX_CLIP;return(0,to.createAttributeWithCacheKey)({min:ti,max:ts})};tn.ceil=(tr,tn)=>[tr.run(D(tr,tn[0],f()),tn)],tn.cos=(tr,tn)=>[tr.run(D(tr,tn[0],d()),tn)],tn.elu=(tr,tn,ti)=>[tr.run(D(tr,tn[0],h(ti.alpha),ti.cacheKey),tn)],tn.parseEluAttributes=tr=>(0,to.createAttributeWithCacheKey)({alpha:tr.attributes.getFloat("alpha",1)}),tn.exp=(tr,tn)=>[tr.run(D(tr,tn[0],g()),tn)],tn.floor=(tr,tn)=>[tr.run(D(tr,tn[0],b()),tn)],tn.identity=(tr,tn)=>[tr.run(D(tr,tn[0],y()),tn)],tn.leakyRelu=(tr,tn,ti)=>[tr.run(D(tr,tn[0],_(ti.alpha),ti.cacheKey),tn)],tn.parseLeakyReluAttributes=tr=>(0,to.createAttributeWithCacheKey)({alpha:tr.attributes.getFloat("alpha",.01)}),tn.log=(tr,tn)=>[tr.run(D(tr,tn[0],v()),tn)],tn.neg=(tr,tn)=>[tr.run(D(tr,tn[0],w()),tn)],tn.not=(tr,tn)=>[tr.run(D(tr,tn[0],x()),tn)],tn.relu=(tr,tn)=>[tr.run(D(tr,tn[0],S()),tn)],tn.sigmoid=(tr,tn)=>[tr.run(D(tr,tn[0],O()),tn)],tn.sin=(tr,tn)=>[tr.run(D(tr,tn[0],T()),tn)],tn.sqrt=(tr,tn)=>[tr.run(D(tr,tn[0],A()),tn)],tn.tan=(tr,tn)=>[tr.run(D(tr,tn[0],E()),tn)],tn.tanh=(tr,tn)=>[tr.run(D(tr,tn[0],I()),tn)]},5611:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createUnpackProgramInfoLoader=tn.createUnpackProgramInfo=void 0;let to=ti(5060),ta=ti(2039),ts=ti(9390),tu=ti(2827),tl={name:"unpack",inputNames:["A"],inputTypes:[ta.TextureType.packed]};tn.createUnpackProgramInfo=(tr,tn)=>{let ti=tn.dims.length,tc=(0,tu.getChannels)("rc",ti),tp=tc.slice(-2),tf=(0,ts.getCoordsDataType)(ti),td=(0,tu.unpackFromChannel)(),th=0===tn.dims.length?"":function(tr,tn){if(1===tr)return"rc";let ti="";for(let to=0;toObject.assign(Object.assign({},tl),{get:()=>(0,tn.createUnpackProgramInfo)(tr,ti)})},8428:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.parseUnsqueezeAttributes=tn.unsqueezeV13=tn.unsqueeze=void 0;let to=ti(2517);tn.unsqueeze=(tr,tn,ti)=>{i(tn);let ta=to.ShapeUtil.unsqueezeShape(tn[0].dims,ti);return[tr.reshapeUnpacked(tn[0],ta)]},tn.unsqueezeV13=(tr,ti)=>(o(ti),(0,tn.unsqueeze)(tr,[ti[0]],Array.from(ti[1].integerData))),tn.parseUnsqueezeAttributes=tr=>tr.attributes.getInts("axes");let i=tr=>{if(!tr||1!==tr.length)throw Error("Unsqueeze requires 1 input.");if("string"===tr[0].type)throw Error("invalid input tensor types.")},o=tr=>{if(!tr||2!==tr.length)throw Error("Unsqueeze requires 2 inputs.");if("int32"!==tr[1].type)throw Error("Invalid input type.")}},9793:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.scalesValidation=tn.validateInputs=tn.parseUpsampleAttributes=tn.parseUpsampleAttributesV9=tn.parseUpsampleAttributesV7=tn.upsample=void 0;let to=ti(246),ta=ti(5060),ts=ti(2039),tu={name:"Upsample",inputNames:["X"],inputTypes:[ts.TextureType.unpacked]};tn.upsample=(tr,ti,to)=>((0,tn.validateInputs)(ti,to),[tr.run(Object.assign(Object.assign({},tu),{cacheHint:to.cacheKey,get:()=>s(tr,ti,to)}),ti)]),tn.parseUpsampleAttributesV7=tr=>(0,tn.parseUpsampleAttributes)(tr,7),tn.parseUpsampleAttributesV9=tr=>(0,tn.parseUpsampleAttributes)(tr,9),tn.parseUpsampleAttributes=(tr,ti)=>{let ta=ti>=10,ts=tr.attributes.getString("mode","nearest");if("nearest"!==ts&&"linear"!==ts&&(ti<11||"cubic"!==ts))throw Error(`unrecognized mode: ${ts}`);let tu=[];ti<9&&(tu=tr.attributes.getFloats("scales"),(0,tn.scalesValidation)(tu,ts,ta));let tl=tr.attributes.getFloat("extrapolation_value",0),tc=ti>10?tr.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(-1===["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(tc))throw Error(`coordinate_transform_mode '${tc}' is not supported`);let tp="tf_crop_and_resize"===tc,tf=tp,td="nearest"===ts&&ti>=11?tr.attributes.getString("nearest_mode","round_prefer_floor"):"";if(-1===["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(td))throw Error(`nearest_mode '${td}' is not supported`);let th=tr.attributes.getFloat("cubic_coeff_a",-.75),tg=0!==tr.attributes.getInt("exclude_outside",0);if(tg&&"cubic"!==ts)throw Error("exclude_outside can be set to 1 only when mode is CUBIC.");let tb=ti<11||"nearest"===ts&&"asymmetric"===tc&&"floor"===td,tm=0,ty=0,t_=0;return ti>10?tr.inputs.length>2?(tm=1,ty=2,t_=3):(ty=1,t_=2):9===ti&&(ty=1),(0,to.createAttributeWithCacheKey)({opset:ti,isResize:ta,mode:ts,scales:tu,extrapolationValue:tl,coordinateTransformMode:tc,useExtrapolation:tf,needRoiInput:tp,nearestMode:td,cubicCoefficientA:th,excludeOutside:tg,useNearest2xOptimization:tb,roiInputIdx:tm,scalesInputIdx:ty,sizesInputIdx:t_})};let s=(tr,tn,ti)=>{let to=(0,ta.getGlsl)(tr.session.backend.glContext.version),[tl,tc]=tr.calculateTextureWidthAndHeight(tn[0].dims,ts.TextureType.unpacked),tp=tn[0].dims.map((tr,tn)=>Math.floor(tr*ti.scales[tn])),[tf,td]=tr.calculateTextureWidthAndHeight(tp,ts.TextureType.unpacked),th=tp.length,tg=Array(th),tb=Array(th),tm=` int output_pitches[${th}]; int input_pitches[${th}]; `;for(let tr=th-1;tr>=0;tr--)tg[tr]=tr===th-1?1:tg[tr+1]*tp[tr+1],tb[tr]=tr===th-1?1:tb[tr+1]*tn[0].dims[tr+1],tm+=` output_pitches[${tr}] = ${tg[tr]}; input_pitches[${tr}] = ${tb[tr]}; `;let ty=` float getInputFloat(int index) { vec2 coords = offsetToCoords(index, ${tl}, ${tc}); float value = getColorAsFloat(${to.texture2D}(X, coords)); return value; } `,t_="nearest"===ti.mode?` ${ty} float process(int indices[${th}]) { int input_index = 0; int output_index = coordsToOffset(TexCoords, ${tf}, ${td}); ${tm} int d, m; for (int dim = 0; dim < ${th}; ++dim) { d = output_index / output_pitches[dim]; m = output_index - d * output_pitches[dim]; output_index = m; if (scales[dim] != 1 && d > 0) { int d2 = d / scales[dim]; m = d - d2 * scales[dim]; d = d2; } input_index += input_pitches[dim] * d; } return getInputFloat(input_index); }`:4===th?` ${ty} float process(int indices[4]) { int input_index = 0; int output_index = coordsToOffset(TexCoords, ${tf}, ${td}); ${tm} int m; int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; index_of_dim0 = output_index / output_pitches[0]; m = output_index - index_of_dim0 * output_pitches[0]; index_of_dim1 = m / output_pitches[1]; m = m - index_of_dim1 * output_pitches[1]; index_of_dim2 = m / output_pitches[2]; m = m - index_of_dim2 * output_pitches[2]; index_of_dim3 = m; int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; index_of_input_dim2 = index_of_dim2 / scales[2]; y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; index_of_input_dim3 = index_of_dim3 / scales[3]; x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; input_index = index_of_dim0 * input_pitches[0] + index_of_dim1 * input_pitches[1] + index_of_input_dim2 * input_pitches[2] + index_of_input_dim3; float x00 = getInputFloat(input_index); float x10, x01, x11; bool end_of_dim2 = false; if (index_of_input_dim2 == (${tn[0].dims[2]} - 1)) { // It's the end in dimension 2 x01 = x00; end_of_dim2 = true; } else { x01 = getInputFloat(input_index + input_pitches[2]); } if (index_of_input_dim3 == (input_pitches[2] - 1)) { // It's the end in dimension 3 x10 = x00; x11 = x01; } else { x10 = getInputFloat(input_index + 1); x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); } float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); }`:` ${ty} float process(int indices[2]) { int input_index = 0; int output_index = coordsToOffset(TexCoords, ${tf}, ${td}); ${tm} int m; int index_of_dim0, index_of_dim1; index_of_dim0 = output_index / output_pitches[0]; m = output_index - index_of_dim0 * output_pitches[0]; index_of_dim1 = m; int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; index_of_input_dim0 = index_of_dim0 / scales[0]; y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; index_of_input_dim1 = index_of_dim1 / scales[1]; x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; float x00 = getInputFloat(input_index); float x10, x01, x11; bool end_of_dim0 = false; if (index_of_input_dim0 == (${tn[0].dims[0]} - 1)) { // It's the end in dimension 0 x01 = x00; end_of_dim0 = true; } else { x01 = getInputFloat(input_index + input_pitches[0]); } if (index_of_input_dim1 == (input_pitches[0] - 1)) { // It's the end in dimension 1 x10 = x00; x11 = x01; } else { x10 = getInputFloat(input_index + 1); x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); } float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); }`;return Object.assign(Object.assign({},tu),{output:{dims:tp,type:tn[0].type,textureType:ts.TextureType.unpacked},shaderSource:t_,variables:[{name:"scales",type:"int",arrayLength:ti.scales.length,data:ti.scales.map(tr=>Math.ceil(tr))}]})};tn.validateInputs=(tr,tn)=>{if(!tr||tn.opset<9&&1!==tr.length||tn.opset>=9&&tn.opset<11&&2!==tr.length||tn.opset>=11&&tr.length<2)throw Error("invalid inputs.");if(tn.scales.length>0&&tr[0].dims.length!==tn.scales.length)throw Error("Invalid input shape.");if("string"===tr[0].type)throw Error("Invalid input tensor types.")},tn.scalesValidation=(tr,tn,ti)=>{if(ti){for(let tn of tr)if(tn<=0)throw Error("Scale value should be greater than 0.")}else for(let tn of tr)if(tn<1)throw Error("Scale value should be greater than or equal to 1.");if(!("linear"!==tn&&"cubic"!==tn||2===tr.length||4===tr.length&&1===tr[0]&&1===tr[1]))throw Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${ti?"Resize":"Upsample"} opeartor.`)}},1958:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.ProgramManager=void 0;let to=ti(1670),ta=ti(6231),ts=ti(8879),tu=ti(5060);tn.ProgramManager=class{constructor(tr,tn,ti){this.profiler=tr,this.glContext=tn,this.textureLayoutStrategy=ti,this.repo=new Map,this.attributesBound=!1}getArtifact(tr){return this.repo.get(tr)}setArtifact(tr,tn){this.repo.set(tr,tn)}run(tr,tn,ti){var to;this.profiler.event("op",`ProgramManager.run ${null!==(to=tr.programInfo.name)&&void 0!==to?to:"unknown kernel"}`,()=>{var to;let ts=this.glContext.gl,tu=tr.program;ts.useProgram(tu);try{this.bindOutput(ti),this.attributesBound||this.bindAttributes(tr.attribLocations),this.bindUniforms(tr.uniformLocations,null!==(to=tr.programInfo.variables)&&void 0!==to?to:[],tn)}catch(tn){throw ta.Logger.error("ProgramManager",tr.programInfo.shaderSource),tn}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(tr=>this.glContext.deleteProgram(tr.program))}build(tr,tn,ti){return this.profiler.event("backend","ProgramManager.build",()=>{let to=new ts.GlslPreprocessor(this.glContext,tr,tn,ti),ta=to.preprocess(),tu=this.compile(ta);return{programInfo:tr,program:tu,uniformLocations:this.getUniformLocations(tu,to.context.programInfo.inputNames,to.context.programInfo.variables),attribLocations:this.getAttribLocations(tu)}})}compile(tr){if(!this.vertexShader){ta.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");let tr=(0,tu.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(tr,this.glContext.gl.VERTEX_SHADER)}to.env.debug&&ta.Logger.verbose("ProrgramManager",`FragShader: ${tr} `);let tn=this.glContext.compileShader(tr,this.glContext.gl.FRAGMENT_SHADER),ti=this.glContext.createProgram(this.vertexShader,tn);return this.glContext.deleteShader(tn),ti}bindOutput(tr){let tn=tr.width,ti=tr.height;ta.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${tn}/${ti}, shape=${tr.shape}, type=${tr.tensor.type}`),this.glContext.attachFramebuffer(tr.texture,tn,ti)}bindAttributes(tr){let tn=tr.position,ti=tr.textureCoord;this.glContext.setVertexAttributes(tn,ti),this.attributesBound=!0}bindUniforms(tr,tn,ti){var to;let ta=this.glContext.gl,ts=0;for(let{name:tu,type:tl,location:tc,arrayLength:tp}of tr){let tr=null===(to=tn.find(tr=>tr.name===tu))||void 0===to?void 0:to.data;if("sampler2D"!==tl&&!tr)throw Error(`variable '${tu}' does not have data defined in program info`);switch(tl){case"sampler2D":this.bindTexture(ti[ts],tc,ts),ts++;break;case"float":tp?ta.uniform1fv(tc,tr):ta.uniform1f(tc,tr);break;case"int":tp?ta.uniform1iv(tc,tr):ta.uniform1i(tc,tr);break;default:throw Error(`Uniform not implemented: ${tl}`)}}}bindTexture(tr,tn,ti){this.glContext.bindTextureToUniform(tr.texture,ti,tn)}getAttribLocations(tr){return{position:this.getAttribLocation(tr,"position"),textureCoord:this.getAttribLocation(tr,"textureCoord")}}getUniformLocations(tr,tn,ti){let to=[];if(tn)for(let ti of tn)to.push({name:ti,type:"sampler2D",location:this.getUniformLocation(tr,ti)});if(ti)for(let tn of ti)to.push(Object.assign(Object.assign({},tn),{location:this.getUniformLocation(tr,tn.name)}));return to}getUniformLocation(tr,tn){let ti=this.glContext.gl.getUniformLocation(tr,tn);if(null===ti)throw Error(`Uniform ${tn} not found.`);return ti}getAttribLocation(tr,tn){return this.glContext.gl.getAttribLocation(tr,tn)}}},6416:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.WebGLSessionHandler=void 0;let to=ti(6231),ta=ti(1047),ts=ti(8316),tu=ti(1640),tl=ti(1958),tc=ti(7859),tp=ti(5702);tn.WebGLSessionHandler=class{constructor(tr,tn){this.backend=tr,this.context=tn,this.layoutStrategy=new tc.PreferLogicalStrategy(tr.glContext.maxTextureSize),this.programManager=new tl.ProgramManager(this.context.profiler,tr.glContext,this.layoutStrategy),this.textureManager=new tp.TextureManager(tr.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:"full"===tr.textureCacheMode}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=tr.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new ts.WebGLInferenceHandler(this)}onGraphInitialized(tr){let tn=tr.getValues().filter(tr=>-1===tr.from&&tr.tensor).map(tr=>tr.tensor.dataId);this.initializers=new Set(tn)}isInitializer(tr){return!!this.initializers&&this.initializers.has(tr)}addInitializer(tr){this.initializers.add(tr)}getTextureData(tr,tn){return tn?this.packedTextureDataCache.get(tr):this.unpackedTextureDataCache.get(tr)}setTextureData(tr,tn,ti=!1){to.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),ti?this.packedTextureDataCache.set(tr,tn):this.unpackedTextureDataCache.set(tr,tn)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(tr=>this.textureManager.releaseTexture(tr,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(tr=>this.textureManager.releaseTexture(tr,!0)),this.unpackedTextureDataCache=new Map}resolve(tr,tn,ti){let to=(0,ta.resolveOperator)(tr,tn,tu.WEBGL_OP_RESOLVE_RULES);return{impl:to.opImpl,context:to.opInit?to.opInit(tr,ti):tr}}}},7769:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.Uint8DataEncoder=tn.RGBAFloatDataEncoder=tn.RedFloat32DataEncoder=void 0;let to=ti(6231);tn.RedFloat32DataEncoder=class{constructor(tr,tn=1){if(1===tn)this.internalFormat=tr.R32F,this.format=tr.RED,this.textureType=tr.FLOAT,this.channelSize=tn;else{if(4!==tn)throw Error(`Invalid number of channels: ${tn}`);this.internalFormat=tr.RGBA32F,this.format=tr.RGBA,this.textureType=tr.FLOAT,this.channelSize=tn}}encode(tr,tn){let ti,ta;return tr.constructor!==Float32Array&&(to.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),ta=new Float32Array(tr)),tn*this.channelSize>tr.length?(to.Logger.warning("Encoder","Source data too small. Allocating larger array"),ta=tr,ti=this.allocate(tn*this.channelSize),ta.forEach((tr,tn)=>ti[tn]=tr)):ti=ta=tr,ti}allocate(tr){return new Float32Array(4*tr)}decode(tr,tn){return 1===this.channelSize?tr.filter((tr,tn)=>tn%4==0).subarray(0,tn):tr.subarray(0,tn)}},tn.RGBAFloatDataEncoder=class{constructor(tr,tn=1,ti){if(1!==tn&&4!==tn)throw Error(`Invalid number of channels: ${tn}`);this.internalFormat=tr.RGBA,this.format=tr.RGBA,this.channelSize=tn,this.textureType=ti||tr.FLOAT}encode(tr,tn){let ti=tr;return 1===this.channelSize&&(to.Logger.verbose("Encoder","Exploding into a larger array"),ti=this.allocate(tn),tr.forEach((tr,tn)=>ti[4*tn]=tr)),ti}allocate(tr){return new Float32Array(4*tr)}decode(tr,tn){return 1===this.channelSize?tr.filter((tr,tn)=>tn%4==0).subarray(0,tn):tr.subarray(0,tn)}},tn.Uint8DataEncoder=class{constructor(tr,tn=1){if(this.channelSize=4,1===tn)this.internalFormat=tr.ALPHA,this.format=tr.ALPHA,this.textureType=tr.UNSIGNED_BYTE,this.channelSize=tn;else{if(4!==tn)throw Error(`Invalid number of channels: ${tn}`);this.internalFormat=tr.RGBA,this.format=tr.RGBA,this.textureType=tr.UNSIGNED_BYTE,this.channelSize=tn}}encode(tr,tn){return new Uint8Array(tr.buffer,tr.byteOffset,tr.byteLength)}allocate(tr){return new Uint8Array(tr*this.channelSize)}decode(tr,tn){if(tr instanceof Uint8Array)return tr.subarray(0,tn);throw Error(`Invalid array type: ${tr.constructor}`)}}},7859:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.getBatchDim=tn.sizeToSquarishShape=tn.getRowsCols=tn.sizeFromShape=tn.isInt=tn.parseAxisParam=tn.squeezeShape=tn.PreferLogicalStrategy=tn.AlwaysKeepOriginalSizeStrategy=void 0;let to=ti(6231),ta=ti(2517);function o(tr,tn){let ti=[],to=[],ta=null!=tn&&Array.isArray(tn)&&0===tn.length,ts=null==tn||ta?null:a(tn,tr).sort(),tu=0;for(let tn=0;tntn)&&1===tr[tn]&&(ti.push(tr[tn]),to.push(tn)),ts[tu]<=tn&&tu++}1!==tr[tn]&&(ti.push(tr[tn]),to.push(tn))}return{newShape:ti,keptDims:to}}function a(tr,tn){let ti=tn.length;return tr=null==tr?tn.map((tr,tn)=>tn):[].concat(tr),(0,ta.assert)(tr.every(tr=>tr>=-ti&&tr`All values in axis param must be in range [-${ti}, ${ti}) but got axis ${tr}`),(0,ta.assert)(tr.every(s),()=>`All values in axis param must be integers but got axis ${tr}`),tr.map(tr=>tr<0?ti+tr:tr)}function s(tr){return tr%1==0}function u(tr){if(0===tr.length)return 1;let tn=tr[0];for(let ti=1;ti=tr.length?1:tr.slice(tn.breakAxis).reduce((tr,tn)=>tr*tn),ts=tn.breakAxis<=0?1:tr.slice(0,tn.breakAxis).reduce((tr,tn)=>tr*tn);if(!(ta>ti||ts>ti))return[ta,ts];to.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${tr}, breakAxis:${tn.breakAxis}`)}let ta=tr.reduce((tr,tn)=>tr*tn),ts=Math.floor(Math.sqrt(ta));for(;ts=ti||ta%ts!=0)throw Error(`The given dimensions are outside this GPU's boundaries: ${tr}`);return[ts,ta/ts]}},tn.PreferLogicalStrategy=class{constructor(tr){this.maxTextureSize=tr}computeTextureWH(tr,tn){let ti=this.computeTexture(tr,tn);return tn&&tn.isPacked&&(ti[0]/=2,ti[1]/=2),tn&&tn.reverseWH?[ti[1],ti[0]]:ti}computeTexture(tr,tn){let ti=tn&&tn.isPacked;if(0===tr.length)return ti?[2,2]:[1,1];let ta=this.maxTextureSize;if(tn&&void 0!==tn.breakAxis){let ti=tn.breakAxis>=tr.length?1:tr.slice(tn.breakAxis).reduce((tr,tn)=>tr*tn),ts=tn.breakAxis<=0?1:tr.slice(0,tn.breakAxis).reduce((tr,tn)=>tr*tn);if(!(ti>ta||ts>ta))return[ti,ts];to.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${tr}, breakAxis:${tn.breakAxis}`)}let ts=tr.slice(0);if(ti&&(ta*=2,1===(ts=ts.map((tr,tn)=>tn>=ts.length-2?ts[tn]%2==0?ts[tn]:ts[tn]+1:ts[tn])).length&&(ts=[2,ts[0]])),2!==ts.length){let tr=o(ts);ts=tr.newShape}let tu=u(ts);return ts.length<=1&&tu<=ta?[1,tu]:2===ts.length&&ts[0]<=ta&&ts[1]<=ta?ts:3===ts.length&&ts[0]*ts[1]<=ta&&ts[2]<=ta?[ts[0]*ts[1],ts[2]]:3===ts.length&&ts[0]<=ta&&ts[1]*ts[2]<=ta?[ts[0],ts[1]*ts[2]]:4===ts.length&&ts[0]*ts[1]*ts[2]<=ta&&ts[3]<=ta?[ts[0]*ts[1]*ts[2],ts[3]]:4===ts.length&&ts[0]<=ta&&ts[1]*ts[2]*ts[3]<=ta?[ts[0],ts[1]*ts[2]*ts[3]]:ti?c(tu/4).map(tr=>2*tr):c(tu)}},tn.squeezeShape=o,tn.parseAxisParam=a,tn.isInt=s,tn.sizeFromShape=u,tn.getRowsCols=function(tr){if(0===tr.length)throw Error("Cannot get rows and columns of an empty shape array.");return[tr.length>1?tr[tr.length-2]:1,tr[tr.length-1]]},tn.sizeToSquarishShape=c,tn.getBatchDim=function(tr,tn=2){return u(tr.slice(0,tr.length-tn))}},4057:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createTextureLayoutFromShape=tn.calculateTextureWidthAndHeight=tn.createTextureLayoutFromTextureType=void 0;let to=ti(2517),ta=ti(2039);tn.createTextureLayoutFromTextureType=(tr,ti,to)=>{let ts=to===ta.TextureType.unpacked||to===ta.TextureType.unpackedReversed?1:4,tu=to===ta.TextureType.packed,tl=to===ta.TextureType.unpackedReversed||to===ta.TextureType.packed,tc=to===ta.TextureType.packedLastDimension?ti.length-1:void 0,tp=to===ta.TextureType.packedLastDimension?ti.map((tr,tn)=>tn===ti.length-1?4*tr:tr):void 0;return(0,tn.createTextureLayoutFromShape)(tr,ti,ts,tp,{isPacked:tu,reverseWH:tl,breakAxis:tc})},tn.calculateTextureWidthAndHeight=(tr,ti,to)=>{let ta=(0,tn.createTextureLayoutFromTextureType)(tr,ti,to);return[ta.width,ta.height]},tn.createTextureLayoutFromShape=(tr,tn,ti=1,ta,ts)=>{let tu=!(!ts||!ts.isPacked),[tl,tc]=tr.computeTextureWH(tu&&ta||tn,ts),tp=tn.length,tf=tn.slice(0);if(0===tp&&(tf=[1]),1===ti)ta=tn;else if(tu){if(4!==ti)throw Error("a packed texture must be 4-channel");ta=tn,tp>0&&(tf[tp-1]=Math.ceil(tf[tp-1]/2)),tp>1&&(tf[tp-2]=Math.ceil(tf[tp-2]/2))}else if(!ta)throw Error("Unpacked shape is needed when using channels > 1");return{width:tl,height:tc,channels:ti,isPacked:tu,shape:tf,strides:to.ShapeUtil.computeStrides(tf),unpackedShape:ta,reversedWH:ts&&ts.reverseWH}}},5702:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.TextureManager=void 0;let to=ti(6231);tn.TextureManager=class{constructor(tr,tn,ti,to){this.glContext=tr,this.layoutStrategy=tn,this.profiler=ti,this.config=to,this.pendingRead=new Map,to.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(tr,tn,ti,ta){let ts,tu;let tl=this.toEncoderType(tr),tc=this.glContext.getEncoder(tl,tn.channels||1,ta);if(tn.isPacked&&1===ta)throw Error("not implemented");let tp=tn.width,tf=tn.height;if(this.config.reuseTextures){ts=`${tp}x${tf}_${tc.format}_${tc.internalFormat}_${tc.textureType}`,(tu=this.inUseTextures.get(ts))||(tu=[],this.inUseTextures.set(ts,tu));let tn=this.idleTextures.get(ts);if(tn&&tn.length>0){let to=tn.pop();return tu.push(to),1===ta&&this.glContext.updateTexture(to,tp,tf,tc,this.toTextureData(tr,ti)),to}}to.Logger.verbose("TextureManager",`Creating new texture of size ${tn.width}x${tn.height}`);let td=this.glContext.allocateTexture(tp,tf,tc,this.toTextureData(tr,ti));return this.config.reuseTextures&&(tu.push(td),this.textureLookup.set(td,ts)),td}readTexture(tr,tn,ti){return ti||(ti=1),this.profiler.event("backend","TextureManager.readTexture",()=>{let to=tr.shape.reduce((tr,tn)=>tr*tn)*ti,ta=this.glContext.readTexture(tr.texture,tr.width,tr.height,to,this.toEncoderType(tn),ti);return this.toTensorData(tn,ta)})}async readTextureAsync(tr,tn,ti){let to=tr.tensor.dataId;if(ti||(ti=1),this.pendingRead.has(to)){let tr=this.pendingRead.get(to);return new Promise(tn=>null==tr?void 0:tr.push(tn))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(to,[]);let ta=tr.shape.reduce((tr,tn)=>tr*tn)*ti;await this.glContext.createAndWaitForFence();let ts=this.glContext.readTexture(tr.texture,tr.width,tr.height,ta,this.toEncoderType(tn),ti),tu=this.toTensorData(tn,ts),tl=this.pendingRead.get(to);return this.pendingRead.delete(to),null==tl||tl.forEach(tr=>tr(tu)),tu})}readUint8TextureAsFloat(tr){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{let tn=tr.shape.reduce((tr,tn)=>tr*tn),ti=this.glContext.readTexture(tr.texture,tr.width,tr.height,4*tn,"byte",4);return new Float32Array(ti.buffer,ti.byteOffset,tn)})}releaseTexture(tr,tn){let ti;if(this.config.reuseTextures&&(ti=this.textureLookup.get(tr.texture))){tn&&this.textureLookup.delete(ti);let to=this.inUseTextures.get(ti);if(to){let tn=to.indexOf(tr.texture);if(-1!==tn){to.splice(tn,1);let ta=this.idleTextures.get(ti);ta||(ta=[],this.idleTextures.set(ti,ta)),ta.push(tr.texture)}}}ti&&!tn||(to.Logger.verbose("TextureManager",`Deleting texture of size ${tr.width}x${tr.height}`),this.glContext.deleteTexture(tr.texture))}toTensorData(tr,tn){switch(tr){case"int16":return tn instanceof Int16Array?tn:Int16Array.from(tn);case"int32":return tn instanceof Int32Array?tn:Int32Array.from(tn);case"int8":return tn instanceof Int8Array?tn:Int8Array.from(tn);case"uint16":return tn instanceof Uint16Array?tn:Uint16Array.from(tn);case"uint32":return tn instanceof Uint32Array?tn:Uint32Array.from(tn);case"uint8":case"bool":return tn instanceof Uint8Array?tn:Uint8Array.from(tn);case"float32":return tn instanceof Float32Array?tn:Float32Array.from(tn);case"float64":return tn instanceof Float64Array?tn:Float64Array.from(tn);default:throw Error(`TensorData type ${tr} is not supported`)}}toTextureData(tr,tn){if(tn)return tn instanceof Float32Array?tn:new Float32Array(tn)}toEncoderType(tr){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(tr,tn)=>{"use strict";var ti;Object.defineProperty(tn,"__esModule",{value:!0}),tn.TextureType=void 0,(ti=tn.TextureType||(tn.TextureType={}))[ti.unpacked=0]="unpacked",ti[ti.unpackedReversed=1]="unpackedReversed",ti[ti.packed=2]="packed",ti[ti.downloadUint8AsFloat=3]="downloadUint8AsFloat",ti[ti.packedLastDimension=4]="packedLastDimension"},9390:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.getGlChannels=tn.getCoordsDataType=tn.getSqueezedParams=tn.squeezeInputShape=tn.generateShaderFuncNameFromInputSamplerNameAtOutCoords=tn.generateShaderFuncNameFromInputSamplerName=tn.repeatedTry=tn.getPackedShape=void 0;let to=ti(2517);tn.getPackedShape=function(tr){let tn=tr.length;return tr.slice(0,tn-1).concat(tr[tn-1]/4)},tn.repeatedTry=async function(tr,tn=tr=>0,ti){return new Promise((to,ta)=>{let ts=0,a=()=>{if(tr())return void to();ts++;let tu=tn(ts);null!=ti&&ts>=ti?ta():setTimeout(a,tu)};a()})},tn.generateShaderFuncNameFromInputSamplerName=function(tr){return(0,to.assert)(void 0!==tr&&0!==tr.length,()=>"empty string found for sampler name"),"get"+tr.charAt(0).toUpperCase()+tr.slice(1)},tn.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(tr){return(0,to.assert)(void 0!==tr&&0!==tr.length,()=>"empty string found for sampler name"),"get"+tr.charAt(0).toUpperCase()+tr.slice(1)+"AtOutCoords"},tn.squeezeInputShape=function(tr,tn){return JSON.parse(JSON.stringify(tr)),tn},tn.getSqueezedParams=function(tr,tn){return tn.map(tn=>tr[tn]).join(", ")},tn.getCoordsDataType=function(tr){if(tr<=1)return"int";if(2===tr)return"ivec2";if(3===tr)return"ivec3";if(4===tr)return"ivec4";if(5===tr)return"ivec5";if(6===tr)return"ivec6";throw Error(`GPU for rank ${tr} is not yet supported`)},tn.getGlChannels=function(tr=6){return["x","y","z","w","u","v"].slice(0,tr)}},7305:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.createNewWebGLContext=tn.createWebGLContext=void 0;let to=ti(6231),ta=ti(1713),ts={};function a(tr){let tn;let ti=function(){if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas)throw TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}let tr=document.createElement("canvas");return tr.width=1,tr.height=1,tr}(),ts={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!tr||"webgl2"===tr)&&(tn=ti.getContext("webgl2",ts)))try{return new ta.WebGLContext(tn,2)}catch(tr){to.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${tr}`)}if((!tr||"webgl"===tr)&&(tn=ti.getContext("webgl",ts)||ti.getContext("experimental-webgl",ts)))try{return new ta.WebGLContext(tn,1)}catch(tr){to.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${tr}`)}throw Error("WebGL is not supported")}tn.createWebGLContext=function t(tr){let tn;(!tr||"webgl2"===tr)&&"webgl2"in ts?tn=ts.webgl2:(!tr||"webgl"===tr)&&"webgl"in ts&&(tn=ts.webgl),tn=tn||a(tr),tr=tr||1===tn.version?"webgl":"webgl2";let ti=tn.gl;return ts[tr]=tn,ti.isContextLost()?(delete ts[tr],t(tr)):(ti.disable(ti.DEPTH_TEST),ti.disable(ti.STENCIL_TEST),ti.disable(ti.BLEND),ti.disable(ti.DITHER),ti.disable(ti.POLYGON_OFFSET_FILL),ti.disable(ti.SAMPLE_COVERAGE),ti.enable(ti.SCISSOR_TEST),ti.enable(ti.CULL_FACE),ti.cullFace(ti.BACK),tn)},tn.createNewWebGLContext=a},1713:function(tr,tn,ti){"use strict";var to=this&&this.__createBinding||(Object.create?function(tr,tn,ti,to){void 0===to&&(to=ti);var ta=Object.getOwnPropertyDescriptor(tn,ti);ta&&!("get"in ta?!tn.__esModule:ta.writable||ta.configurable)||(ta={enumerable:!0,get:function(){return tn[ti]}}),Object.defineProperty(tr,to,ta)}:function(tr,tn,ti,to){void 0===to&&(to=ti),tr[to]=tn[ti]}),ta=this&&this.__setModuleDefault||(Object.create?function(tr,tn){Object.defineProperty(tr,"default",{enumerable:!0,value:tn})}:function(tr,tn){tr.default=tn}),ts=this&&this.__importStar||function(tr){if(tr&&tr.__esModule)return tr;var tn={};if(null!=tr)for(var ti in tr)"default"!==ti&&Object.prototype.hasOwnProperty.call(tr,ti)&&to(tn,tr,ti);return ta(tn,tr),tn};Object.defineProperty(tn,"__esModule",{value:!0}),tn.WebGLContext=tn.linearSearchLastTrue=void 0;let tu=ti(1670),tl=ts(ti(7769)),tc=ti(9390);function c(tr){let tn=0;for(;tnthis.isTimerResultAvailable(tr)),this.getTimerResult(tr)}async createAndWaitForFence(){let tr=this.createFence(this.gl);return this.pollFence(tr)}createFence(tr){let tn;let ti=tr,to=ti.fenceSync(ti.SYNC_GPU_COMMANDS_COMPLETE,0);return tr.flush(),tn=null===to?()=>!0:()=>{let tr=ti.clientWaitSync(to,0,0);return tr===ti.ALREADY_SIGNALED||tr===ti.CONDITION_SATISFIED},{query:to,isFencePassed:tn}}async pollFence(tr){return new Promise(tn=>{this.addItemToPoll(()=>tr.isFencePassed(),()=>tn())})}pollItems(){let tr=c(this.itemsToPoll.map(tr=>tr.isDoneFn));for(let tn=0;tn<=tr;++tn){let{resolveFn:tr}=this.itemsToPoll[tn];tr()}this.itemsToPoll=this.itemsToPoll.slice(tr+1)}async addItemToPoll(tr,tn){this.itemsToPoll.push({isDoneFn:tr,resolveFn:tn}),this.itemsToPoll.length>1||await (0,tc.repeatedTry)(()=>(this.pollItems(),0===this.itemsToPoll.length))}}},1036:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.ExecutionPlan=void 0;let to=ti(6231);let i=class i{constructor(tr,tn){this.op=tr,this.node=tn}};tn.ExecutionPlan=class{constructor(tr,tn,ti){this.graph=tr,this.profiler=ti,this.initialize(tn)}initialize(tr){this.profiler.event("session","ExecutionPlan.initialize",()=>{let tn=this.graph.getNodes();if(tn.length!==tr.length)throw Error("The size of nodes and OPs do not match.");this._ops=tr.map((tr,ti)=>new i(tr,tn[ti])),this.reset(),this._starter=[],this._ops.forEach((tr,tn)=>{let ti=!0;for(let tn of tr.node.inputs)if(!this._values[tn]&&-1===this.graph.getInputIndices().indexOf(tn)){ti=!1;break}ti&&this._starter.push(tn)})})}reset(){this._values=this.graph.getValues().map(tr=>tr.tensor)}async execute(tr,tn){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();let ti=tr.createInferenceHandler(),ta=this.graph.getInputIndices();if(tn.length!==ta.length)throw Error(`number of input tensors don't match the number of inputs to the model: actual: ${tn.length} expected: ${ta.length}`);tn.forEach((tr,tn)=>{let ti=ta[tn];this._values[ti]=tr});let ts=this._starter.slice(0),tu=this.graph.getValues(),tl=this.graph.getNodes(),tc=0;for(;tcthis._values[tr]);if(-1!==ta.indexOf(void 0))throw Error(`unresolved input detected: op: ${tn.node}`);let tp=ta;to.Logger.verbose("ExecPlan",`Runing op:${tn.node.name} (${tp.map((tr,ti)=>`'${tn.node.inputs[ti]}': ${tr.type}[${tr.dims.join(",")}]`).join(", ")})`);let tf=await this.profiler.event("node",tn.node.name,async()=>tn.op.impl(ti,tp,tn.op.context));if(tf.length!==tn.node.outputs.length)throw Error("the size of output does not match model definition.");tf.forEach((tr,ti)=>{let to=tn.node.outputs[ti];if(this._values[to])throw Error(`output [${to}] already has value: op:${tn.node.name}`);this._values[to]=tr});let td=new Set;tf.forEach((tr,ti)=>{let to=tn.node.outputs[ti];for(let tr of tu[to].to){let tn=tl[tr],ti=!0;for(let tr of tn.inputs)if(!this._values[tr]){ti=!1;break}ti&&td.add(tr)}}),ts.push(...td)}let tp=[];for(let tr=0;tr{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.Graph=void 0;let to=ti(1446),ta=ti(7778),ts=ti(9395),tu=ti(9162),tl=ti(2517);var tc=ts.onnxruntime.experimental.fbs;tn.Graph={from:(tr,tn)=>new p(tr,tn)};let c=class c{constructor(tr){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,tr&&(this.type=tl.ProtoUtil.tensorValueTypeFromProto(tr.type.tensorType))}get from(){return this._from}get to(){return this._to}};let l=class l{constructor(tr,tn){tr instanceof to.onnx.NodeProto?(this.name=tr.name,this.opType=tr.opType,this.attributes=new ta.Attribute(tr.attribute)):tr instanceof tc.Node&&(this.name=null!=tn?tn:tr.name(),this.opType=tr.opType(),this.attributes=new ta.Attribute(tl.ProtoUtil.tensorAttributesFromORTFormat(tr))),this.inputs=[],this.outputs=[],this.executeNode=!0}};let p=class p{constructor(tr,tn){if(!tr)throw TypeError("graph is empty");this.buildGraph(tr),this.transformGraph(tn),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(tr){if(tr instanceof to.onnx.GraphProto)this.buildGraphFromOnnxFormat(tr);else{if(!(tr instanceof tc.Graph))throw TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(tr)}}buildGraphFromOnnxFormat(tr){let tn=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let ti=new Map;if(!tr.input)throw Error("missing information in graph: input");let to=[];for(let ti of tr.input){if(tn.has(ti.name))throw Error(`duplicated input name: ${ti.name}`);let tr=this._allData.push(new c(ti))-1;tn.set(ti.name,tr),to.push(ti.name)}if(!tr.initializer)throw Error("missing information in graph: initializer");for(let ti of tr.initializer){let tr=tn.get(ti.name);if(void 0===tr){let to=new c;to.type={shape:{dims:tl.ProtoUtil.tensorDimsFromProto(ti.dims)},tensorType:tl.ProtoUtil.tensorDataTypeFromProto(ti.dataType)},tr=this._allData.push(to)-1,tn.set(ti.name,tr)}this._allData[tr]._from=-1,this._allData[tr].tensor=tu.Tensor.fromProto(ti)}for(let tr=0;tr{this._allData[tn]._to.forEach(tn=>{tr.add(tn)})});let tn=Array.from(tr),ti=Array(this._nodes.length).fill("white");for(;tn.length>0;){let tr=tn.pop();"gray"===ti[tr]?ti[tr]="black":(tn.push(tr),ti[tr]="gray",this._nodes[tr].outputs.forEach(to=>{let ta=this._allData[to];if(void 0!==ta.tensor)throw Error("node outputs should not be initialized");if(ta._from!==tr)throw Error("from property of the Value object doesn't match index of Node being processed");ta._to.forEach(tr=>{if("gray"===ti[tr])throw Error("model graph is cyclic");"white"===ti[tr]&&tn.push(tr)})}))}}transformGraph(tr){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),tr&&tr.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let tr=0;for(let tn=0;tn0&&(this._nodes[tn].inputs.forEach(ti=>{let to=this._allData[ti]._to.indexOf(tn+tr);-1!==to&&(this._allData[ti]._to[to]=tn)}),this._nodes[tn].outputs.forEach(ti=>{this._allData[ti]._from&&this._allData[ti]._from===tn+tr&&(this._allData[ti]._from=tn)})):(tr++,this._nodes[tn].outputs.forEach(tr=>{this._allData[tr]._from=-2}),this._nodes.splice(tn,1),tn--);tr=0;for(let tn=0;tn0){let ti=-1;void 0!==this._allData[tn].from&&-1!==this._allData[tn].from?-1!==(ti=this._nodes[this._allData[tn].from].outputs.indexOf(tn+tr))&&(this._nodes[this._allData[tn].from].outputs[ti]=tn):-1!==(ti=this._allInputIndices.indexOf(tn+tr))&&(this._allInputIndices[ti]=tn),this._allData[tn].to.forEach(to=>{-1!==(ti=this._nodes[to].inputs.indexOf(tn+tr))&&(this._nodes[to].inputs[ti]=tn)}),0===this._allData[tn].to.length&&-1!==(ti=this._allOutputIndices.indexOf(tn+tr))&&(this._allOutputIndices[ti]=tn)}}else tr++,this._allData.splice(tn,1),tn--}deleteNode(tr){let tn=this._nodes[tr];if(tn.outputs.length>1){for(let tr=1;tr0)throw Error("Node deletion with more than one output connected to other nodes is not supported. ")}tn.executeNode=!1;let ti=tn.inputs[0],to=tn.outputs[0],ta=this._allData[to].to,ts=this._allData[ti].to.indexOf(tr);if(-1===ts)throw Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[ti].to.splice(ts,1),this._allData[to]._to=[];let tu=this._allOutputIndices.indexOf(to);if(-1!==tu&&(this._allOutputIndices[tu]=ti),ta&&ta.length>0)for(let tr of ta){let tn=this._nodes[tr].inputs.indexOf(to);if(-1===tn)throw Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[tr].inputs[tn]=ti,this._allData[ti].to.push(tr)}}removeAllDropoutNodes(){let tr=0;for(let tn of this._nodes){if("Dropout"===tn.opType){if(1!==tn.inputs.length)throw Error("Dropout nodes should only contain one input. ");if(1!==tn.outputs.length&&2!==tn.outputs.length)throw Error("Dropout nodes should contain either 1 or 2 output(s)");if(2===tn.outputs.length&&0!==this._allData[tn.outputs[1]]._to.length)throw Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(tr)}tr++}}removeAllIdentityNodes(){let tr=0;for(let tn of this._nodes)"Identity"===tn.opType&&this.deleteNode(tr),tr++}isActivation(tr){switch(tr.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(let tr of this._nodes)if("Conv"===tr.opType){let tn=this._allData[tr.outputs[0]]._to;if(1===tn.length&&this.isActivation(this._nodes[tn[0]])){let ti=this._nodes[tn[0]];if("Clip"===ti.opType){if(1===ti.inputs.length)try{tr.attributes.set("activation_params","floats",[ti.attributes.getFloat("min"),ti.attributes.getFloat("max")])}catch(tn){tr.attributes.set("activation_params","floats",[tl.MIN_CLIP,tl.MAX_CLIP])}else{if(!(ti.inputs.length>=3&&void 0!==this._allData[ti.inputs[1]].tensor&&void 0!==this._allData[ti.inputs[2]].tensor))continue;tr.attributes.set("activation_params","floats",[this._allData[ti.inputs[1]].tensor.floatData[0],this._allData[ti.inputs[2]].tensor.floatData[0]])}}tr.attributes.set("activation","string",ti.opType),this.deleteNode(tn[0])}}}}},6231:(tr,tn)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.now=tn.Profiler=tn.Logger=void 0;let ti={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},to={none:new class{log(tr,tn,ti){}},console:new class{log(tr,tn,ti){console.log(`${this.color(tr)} ${ti?"\x1b[35m"+ti+"\x1b[0m ":""}${tn}`)}color(tr){switch(tr){case"verbose":return"\x1b[34;40mv\x1b[0m";case"info":return"\x1b[32mi\x1b[0m";case"warning":return"\x1b[30;43mw\x1b[0m";case"error":return"\x1b[31;40me\x1b[0m";case"fatal":return"\x1b[101mf\x1b[0m";default:throw Error(`unsupported severity: ${tr}`)}}}},ta={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1},ts={"":ta};function a(tr,tn,ti,to){var ta;if(void 0===tn)return ta=tr,{verbose:a.verbose.bind(null,ta),info:a.info.bind(null,ta),warning:a.warning.bind(null,ta),error:a.error.bind(null,ta),fatal:a.fatal.bind(null,ta)};if(void 0===ti)s(tr,tn);else if("number"==typeof ti&&void 0===to)s(tr,tn);else if("string"==typeof ti&&void 0===to)s(tr,ti,0,tn);else{if("string"!=typeof ti||"number"!=typeof to)throw TypeError("input is valid");s(tr,ti,0,tn)}}function s(tr,tn,ta,tu){let tl=ts[tu||""]||ts[""];ti[tr]{tu.then(async tn=>{ta&&await ta.end(),tr(tn)},async tr=>{ta&&await ta.end(),tn(tr)})});if(!ts&&ta){let tr=ta.end();if(tr&&"function"==typeof tr.then)return new Promise((tn,ti)=>{tr.then(()=>{tn(tu)},tr=>{ti(tr)})})}return tu}begin(tr,ti,to){if(!this._started)throw Error("profiler is not started yet");if(void 0===to){let to=(0,tn.now)();return this.flush(to),new u(tr,ti,to,tr=>this.endSync(tr))}{let tn=to.beginTimer();return new u(tr,ti,0,async tr=>this.end(tr),tn,to)}}async end(tr){let tn=await tr.checkTimer();this._timingEvents.length=this._flushBatchSize||tr-this._flushTime>=this._flushIntervalInMilliseconds){for(let tr=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.Model=void 0;let to=ti(5686),ta=ti(1446),ts=ti(7070),tu=ti(9395),tl=ti(2517);var tc=tu.onnxruntime.experimental.fbs;tn.Model=class{constructor(){}load(tr,tn,ti){if(!ti)try{return void this.loadFromOnnxFormat(tr,tn)}catch(tr){if(void 0!==ti)throw tr}this.loadFromOrtFormat(tr,tn)}loadFromOnnxFormat(tr,tn){let ti=ta.onnx.ModelProto.decode(tr);if(3>tl.LongUtil.longToNumber(ti.irVersion))throw Error("only support ONNX model with IR_VERSION>=3");this._opsets=ti.opsetImport.map(tr=>({domain:tr.domain,version:tl.LongUtil.longToNumber(tr.version)})),this._graph=ts.Graph.from(ti.graph,tn)}loadFromOrtFormat(tr,tn){let ti=new to.flatbuffers.ByteBuffer(tr),ta=tc.InferenceSession.getRootAsInferenceSession(ti).model();if(3>tl.LongUtil.longToNumber(ta.irVersion()))throw Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let tr=0;tr{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.FLOAT_TYPES=tn.INT_TYPES=tn.NUMBER_TYPES=void 0,tn.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],tn.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],tn.FLOAT_TYPES=["float32","float64"]},1047:(tr,tn)=>{"use strict";function n(tr,tn){if(tn.endsWith("+")){let ti=Number.parseInt(tn.substring(0,tn.length-1),10);return!isNaN(ti)&&ti<=tr}if(2===tn.split("-").length){let ti=tn.split("-"),to=Number.parseInt(ti[0],10),ta=Number.parseInt(ti[1],10);return!isNaN(to)&&!isNaN(ta)&&to<=tr&&tr<=ta}return Number.parseInt(tn,10)===tr}Object.defineProperty(tn,"__esModule",{value:!0}),tn.resolveOperator=void 0,tn.resolveOperator=function(tr,tn,ti){for(let to of ti){let ti=to[0],ta=to[1],ts=to[2],tu=to[3],tl=to[4];if(tr.opType===ti){for(let tr of tn)if((tr.domain===ta||"ai.onnx"===tr.domain&&""===ta)&&n(tr.version,ts))return{opImpl:tu,opInit:tl}}}throw TypeError(`cannot resolve operator '${tr.opType}' with opsets: ${tn.map(tr=>`${tr.domain||"ai.onnx"} v${tr.version}`).join(", ")}`)}},9395:(tr,tn,ti)=>{"use strict";var to,ta;Object.defineProperty(tn,"__esModule",{value:!0}),tn.onnxruntime=void 0;let ts=ti(5686);(function(tr){let tn;!function(tr){tr[tr.UNDEFINED=0]="UNDEFINED",tr[tr.FLOAT=1]="FLOAT",tr[tr.INT=2]="INT",tr[tr.STRING=3]="STRING",tr[tr.TENSOR=4]="TENSOR",tr[tr.GRAPH=5]="GRAPH",tr[tr.FLOATS=6]="FLOATS",tr[tr.INTS=7]="INTS",tr[tr.STRINGS=8]="STRINGS",tr[tr.TENSORS=9]="TENSORS",tr[tr.GRAPHS=10]="GRAPHS",tr[tr.SPARSE_TENSOR=11]="SPARSE_TENSOR",tr[tr.SPARSE_TENSORS=12]="SPARSE_TENSORS"}(tn=tr.AttributeType||(tr.AttributeType={}))})((ta=(to=tn.onnxruntime||(tn.onnxruntime={})).experimental||(to.experimental={})).fbs||(ta.fbs={})),function(tr){!function(tr){!function(tr){let tn;!function(tr){tr[tr.UNKNOWN=0]="UNKNOWN",tr[tr.VALUE=1]="VALUE",tr[tr.PARAM=2]="PARAM"}(tn=tr.DimensionValueType||(tr.DimensionValueType={}))}(tr.fbs||(tr.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tr){!function(tr){let tn;!function(tr){tr[tr.UNDEFINED=0]="UNDEFINED",tr[tr.FLOAT=1]="FLOAT",tr[tr.UINT8=2]="UINT8",tr[tr.INT8=3]="INT8",tr[tr.UINT16=4]="UINT16",tr[tr.INT16=5]="INT16",tr[tr.INT32=6]="INT32",tr[tr.INT64=7]="INT64",tr[tr.STRING=8]="STRING",tr[tr.BOOL=9]="BOOL",tr[tr.FLOAT16=10]="FLOAT16",tr[tr.DOUBLE=11]="DOUBLE",tr[tr.UINT32=12]="UINT32",tr[tr.UINT64=13]="UINT64",tr[tr.COMPLEX64=14]="COMPLEX64",tr[tr.COMPLEX128=15]="COMPLEX128",tr[tr.BFLOAT16=16]="BFLOAT16"}(tn=tr.TensorDataType||(tr.TensorDataType={}))}(tr.fbs||(tr.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tr){!function(tr){let tn;!function(tr){tr[tr.Primitive=0]="Primitive",tr[tr.Fused=1]="Fused"}(tn=tr.NodeType||(tr.NodeType={}))}(tr.fbs||(tr.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tr){!function(tr){let tn;!function(tr){tr[tr.NONE=0]="NONE",tr[tr.tensor_type=1]="tensor_type",tr[tr.sequence_type=2]="sequence_type",tr[tr.map_type=3]="map_type"}(tn=tr.TypeInfoValue||(tr.TypeInfoValue={}))}(tr.fbs||(tr.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsShape(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsShape(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}dim(tn,ti){let to=this.bb.__offset(this.bb_pos,4);return to?(ti||new tr.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}dimLength(){let tr=this.bb.__offset(this.bb_pos,4);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startShape(tr){tr.startObject(1)}static addDim(tr,tn){tr.addFieldOffset(0,tn,0)}static createDimVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startDimVector(tr,tn){tr.startVector(4,tn,4)}static endShape(tr){return tr.endObject()}static createShape(tr,tn){return n.startShape(tr),n.addDim(tr,tn),n.endShape(tr)}};tn.Shape=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsDimension(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsDimension(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}value(tn){let ti=this.bb.__offset(this.bb_pos,4);return ti?(tn||new tr.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}denotation(tr){let tn=this.bb.__offset(this.bb_pos,6);return tn?this.bb.__string(this.bb_pos+tn,tr):null}static startDimension(tr){tr.startObject(2)}static addValue(tr,tn){tr.addFieldOffset(0,tn,0)}static addDenotation(tr,tn){tr.addFieldOffset(1,tn,0)}static endDimension(tr){return tr.endObject()}static createDimension(tr,tn,ti){return n.startDimension(tr),n.addValue(tr,tn),n.addDenotation(tr,ti),n.endDimension(tr)}};tn.Dimension=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsDimensionValue(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsDimensionValue(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}dimType(){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.readInt8(this.bb_pos+tn):tr.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let tr=this.bb.__offset(this.bb_pos,6);return tr?this.bb.readInt64(this.bb_pos+tr):this.bb.createLong(0,0)}dimParam(tr){let tn=this.bb.__offset(this.bb_pos,8);return tn?this.bb.__string(this.bb_pos+tn,tr):null}static startDimensionValue(tr){tr.startObject(3)}static addDimType(tn,ti){tn.addFieldInt8(0,ti,tr.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(tr,tn){tr.addFieldInt64(1,tn,tr.createLong(0,0))}static addDimParam(tr,tn){tr.addFieldOffset(2,tn,0)}static endDimensionValue(tr){return tr.endObject()}static createDimensionValue(tr,tn,ti,to){return n.startDimensionValue(tr),n.addDimType(tr,tn),n.addDimValue(tr,ti),n.addDimParam(tr,to),n.endDimensionValue(tr)}};tn.DimensionValue=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsTensorTypeAndShape(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsTensorTypeAndShape(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}elemType(){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.readInt32(this.bb_pos+tn):tr.experimental.fbs.TensorDataType.UNDEFINED}shape(tn){let ti=this.bb.__offset(this.bb_pos,6);return ti?(tn||new tr.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}static startTensorTypeAndShape(tr){tr.startObject(2)}static addElemType(tn,ti){tn.addFieldInt32(0,ti,tr.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(tr,tn){tr.addFieldOffset(1,tn,0)}static endTensorTypeAndShape(tr){return tr.endObject()}static createTensorTypeAndShape(tr,tn,ti){return n.startTensorTypeAndShape(tr),n.addElemType(tr,tn),n.addShape(tr,ti),n.endTensorTypeAndShape(tr)}};tn.TensorTypeAndShape=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsMapType(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsMapType(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}keyType(){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.readInt32(this.bb_pos+tn):tr.experimental.fbs.TensorDataType.UNDEFINED}valueType(tn){let ti=this.bb.__offset(this.bb_pos,6);return ti?(tn||new tr.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}static startMapType(tr){tr.startObject(2)}static addKeyType(tn,ti){tn.addFieldInt32(0,ti,tr.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(tr,tn){tr.addFieldOffset(1,tn,0)}static endMapType(tr){return tr.endObject()}static createMapType(tr,tn,ti){return n.startMapType(tr),n.addKeyType(tr,tn),n.addValueType(tr,ti),n.endMapType(tr)}};tn.MapType=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsSequenceType(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsSequenceType(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}elemType(tn){let ti=this.bb.__offset(this.bb_pos,4);return ti?(tn||new tr.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}static startSequenceType(tr){tr.startObject(1)}static addElemType(tr,tn){tr.addFieldOffset(0,tn,0)}static endSequenceType(tr){return tr.endObject()}static createSequenceType(tr,tn){return n.startSequenceType(tr),n.addElemType(tr,tn),n.endSequenceType(tr)}};tn.SequenceType=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tr){(tr.fbs||(tr.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(tr,tn,ti,to){return tr.prep(4,12),tr.writeInt32(to),tr.writeInt32(ti),tr.writeInt32(tn),tr.offset()}}}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsNodeEdge(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsNodeEdge(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}nodeIndex(){let tr=this.bb.__offset(this.bb_pos,4);return tr?this.bb.readUint32(this.bb_pos+tr):0}inputEdges(tn,ti){let to=this.bb.__offset(this.bb_pos,6);return to?(ti||new tr.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+to)+12*tn,this.bb):null}inputEdgesLength(){let tr=this.bb.__offset(this.bb_pos,6);return tr?this.bb.__vector_len(this.bb_pos+tr):0}outputEdges(tn,ti){let to=this.bb.__offset(this.bb_pos,8);return to?(ti||new tr.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+to)+12*tn,this.bb):null}outputEdgesLength(){let tr=this.bb.__offset(this.bb_pos,8);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startNodeEdge(tr){tr.startObject(3)}static addNodeIndex(tr,tn){tr.addFieldInt32(0,tn,0)}static addInputEdges(tr,tn){tr.addFieldOffset(1,tn,0)}static startInputEdgesVector(tr,tn){tr.startVector(12,tn,4)}static addOutputEdges(tr,tn){tr.addFieldOffset(2,tn,0)}static startOutputEdgesVector(tr,tn){tr.startVector(12,tn,4)}static endNodeEdge(tr){return tr.endObject()}static createNodeEdge(tr,tn,ti,to){return n.startNodeEdge(tr),n.addNodeIndex(tr,tn),n.addInputEdges(tr,ti),n.addOutputEdges(tr,to),n.endNodeEdge(tr)}};tn.NodeEdge=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsNode(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsNode(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}name(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}docString(tr){let tn=this.bb.__offset(this.bb_pos,6);return tn?this.bb.__string(this.bb_pos+tn,tr):null}domain(tr){let tn=this.bb.__offset(this.bb_pos,8);return tn?this.bb.__string(this.bb_pos+tn,tr):null}sinceVersion(){let tr=this.bb.__offset(this.bb_pos,10);return tr?this.bb.readInt32(this.bb_pos+tr):0}index(){let tr=this.bb.__offset(this.bb_pos,12);return tr?this.bb.readUint32(this.bb_pos+tr):0}opType(tr){let tn=this.bb.__offset(this.bb_pos,14);return tn?this.bb.__string(this.bb_pos+tn,tr):null}type(){let tn=this.bb.__offset(this.bb_pos,16);return tn?this.bb.readInt32(this.bb_pos+tn):tr.experimental.fbs.NodeType.Primitive}executionProviderType(tr){let tn=this.bb.__offset(this.bb_pos,18);return tn?this.bb.__string(this.bb_pos+tn,tr):null}inputs(tr,tn){let ti=this.bb.__offset(this.bb_pos,20);return ti?this.bb.__string(this.bb.__vector(this.bb_pos+ti)+4*tr,tn):null}inputsLength(){let tr=this.bb.__offset(this.bb_pos,20);return tr?this.bb.__vector_len(this.bb_pos+tr):0}outputs(tr,tn){let ti=this.bb.__offset(this.bb_pos,22);return ti?this.bb.__string(this.bb.__vector(this.bb_pos+ti)+4*tr,tn):null}outputsLength(){let tr=this.bb.__offset(this.bb_pos,22);return tr?this.bb.__vector_len(this.bb_pos+tr):0}attributes(tn,ti){let to=this.bb.__offset(this.bb_pos,24);return to?(ti||new tr.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}attributesLength(){let tr=this.bb.__offset(this.bb_pos,24);return tr?this.bb.__vector_len(this.bb_pos+tr):0}inputArgCounts(tr){let tn=this.bb.__offset(this.bb_pos,26);return tn?this.bb.readInt32(this.bb.__vector(this.bb_pos+tn)+4*tr):0}inputArgCountsLength(){let tr=this.bb.__offset(this.bb_pos,26);return tr?this.bb.__vector_len(this.bb_pos+tr):0}inputArgCountsArray(){let tr=this.bb.__offset(this.bb_pos,26);return tr?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+tr),this.bb.__vector_len(this.bb_pos+tr)):null}implicitInputs(tr,tn){let ti=this.bb.__offset(this.bb_pos,28);return ti?this.bb.__string(this.bb.__vector(this.bb_pos+ti)+4*tr,tn):null}implicitInputsLength(){let tr=this.bb.__offset(this.bb_pos,28);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startNode(tr){tr.startObject(13)}static addName(tr,tn){tr.addFieldOffset(0,tn,0)}static addDocString(tr,tn){tr.addFieldOffset(1,tn,0)}static addDomain(tr,tn){tr.addFieldOffset(2,tn,0)}static addSinceVersion(tr,tn){tr.addFieldInt32(3,tn,0)}static addIndex(tr,tn){tr.addFieldInt32(4,tn,0)}static addOpType(tr,tn){tr.addFieldOffset(5,tn,0)}static addType(tn,ti){tn.addFieldInt32(6,ti,tr.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(tr,tn){tr.addFieldOffset(7,tn,0)}static addInputs(tr,tn){tr.addFieldOffset(8,tn,0)}static createInputsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startInputsVector(tr,tn){tr.startVector(4,tn,4)}static addOutputs(tr,tn){tr.addFieldOffset(9,tn,0)}static createOutputsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startOutputsVector(tr,tn){tr.startVector(4,tn,4)}static addAttributes(tr,tn){tr.addFieldOffset(10,tn,0)}static createAttributesVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startAttributesVector(tr,tn){tr.startVector(4,tn,4)}static addInputArgCounts(tr,tn){tr.addFieldOffset(11,tn,0)}static createInputArgCountsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addInt32(tn[ti]);return tr.endVector()}static startInputArgCountsVector(tr,tn){tr.startVector(4,tn,4)}static addImplicitInputs(tr,tn){tr.addFieldOffset(12,tn,0)}static createImplicitInputsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startImplicitInputsVector(tr,tn){tr.startVector(4,tn,4)}static endNode(tr){return tr.endObject()}static createNode(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td,th,tg){return n.startNode(tr),n.addName(tr,tn),n.addDocString(tr,ti),n.addDomain(tr,to),n.addSinceVersion(tr,ta),n.addIndex(tr,ts),n.addOpType(tr,tu),n.addType(tr,tl),n.addExecutionProviderType(tr,tc),n.addInputs(tr,tp),n.addOutputs(tr,tf),n.addAttributes(tr,td),n.addInputArgCounts(tr,th),n.addImplicitInputs(tr,tg),n.endNode(tr)}};tn.Node=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsValueInfo(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsValueInfo(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}name(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}docString(tr){let tn=this.bb.__offset(this.bb_pos,6);return tn?this.bb.__string(this.bb_pos+tn,tr):null}type(tn){let ti=this.bb.__offset(this.bb_pos,8);return ti?(tn||new tr.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}static startValueInfo(tr){tr.startObject(3)}static addName(tr,tn){tr.addFieldOffset(0,tn,0)}static addDocString(tr,tn){tr.addFieldOffset(1,tn,0)}static addType(tr,tn){tr.addFieldOffset(2,tn,0)}static endValueInfo(tr){return tr.endObject()}static createValueInfo(tr,tn,ti,to){return n.startValueInfo(tr),n.addName(tr,tn),n.addDocString(tr,ti),n.addType(tr,to),n.endValueInfo(tr)}};tn.ValueInfo=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsTypeInfo(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsTypeInfo(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}denotation(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}valueType(){let tn=this.bb.__offset(this.bb_pos,6);return tn?this.bb.readUint8(this.bb_pos+tn):tr.experimental.fbs.TypeInfoValue.NONE}value(tr){let tn=this.bb.__offset(this.bb_pos,8);return tn?this.bb.__union(tr,this.bb_pos+tn):null}static startTypeInfo(tr){tr.startObject(3)}static addDenotation(tr,tn){tr.addFieldOffset(0,tn,0)}static addValueType(tn,ti){tn.addFieldInt8(1,ti,tr.experimental.fbs.TypeInfoValue.NONE)}static addValue(tr,tn){tr.addFieldOffset(2,tn,0)}static endTypeInfo(tr){return tr.endObject()}static createTypeInfo(tr,tn,ti,to){return n.startTypeInfo(tr),n.addDenotation(tr,tn),n.addValueType(tr,ti),n.addValue(tr,to),n.endTypeInfo(tr)}};tn.TypeInfo=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tr){!function(tr){let e=class e{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsOperatorSetId(tr,tn){return(tn||new e).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsOperatorSetId(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new e).__init(tr.readInt32(tr.position())+tr.position(),tr)}domain(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}version(){let tr=this.bb.__offset(this.bb_pos,6);return tr?this.bb.readInt64(this.bb_pos+tr):this.bb.createLong(0,0)}static startOperatorSetId(tr){tr.startObject(2)}static addDomain(tr,tn){tr.addFieldOffset(0,tn,0)}static addVersion(tr,tn){tr.addFieldInt64(1,tn,tr.createLong(0,0))}static endOperatorSetId(tr){return tr.endObject()}static createOperatorSetId(tr,tn,ti){return e.startOperatorSetId(tr),e.addDomain(tr,tn),e.addVersion(tr,ti),e.endOperatorSetId(tr)}};tr.OperatorSetId=e}(tr.fbs||(tr.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsTensor(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsTensor(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}name(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}docString(tr){let tn=this.bb.__offset(this.bb_pos,6);return tn?this.bb.__string(this.bb_pos+tn,tr):null}dims(tr){let tn=this.bb.__offset(this.bb_pos,8);return tn?this.bb.readInt64(this.bb.__vector(this.bb_pos+tn)+8*tr):this.bb.createLong(0,0)}dimsLength(){let tr=this.bb.__offset(this.bb_pos,8);return tr?this.bb.__vector_len(this.bb_pos+tr):0}dataType(){let tn=this.bb.__offset(this.bb_pos,10);return tn?this.bb.readInt32(this.bb_pos+tn):tr.experimental.fbs.TensorDataType.UNDEFINED}rawData(tr){let tn=this.bb.__offset(this.bb_pos,12);return tn?this.bb.readUint8(this.bb.__vector(this.bb_pos+tn)+tr):0}rawDataLength(){let tr=this.bb.__offset(this.bb_pos,12);return tr?this.bb.__vector_len(this.bb_pos+tr):0}rawDataArray(){let tr=this.bb.__offset(this.bb_pos,12);return tr?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+tr),this.bb.__vector_len(this.bb_pos+tr)):null}stringData(tr,tn){let ti=this.bb.__offset(this.bb_pos,14);return ti?this.bb.__string(this.bb.__vector(this.bb_pos+ti)+4*tr,tn):null}stringDataLength(){let tr=this.bb.__offset(this.bb_pos,14);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startTensor(tr){tr.startObject(6)}static addName(tr,tn){tr.addFieldOffset(0,tn,0)}static addDocString(tr,tn){tr.addFieldOffset(1,tn,0)}static addDims(tr,tn){tr.addFieldOffset(2,tn,0)}static createDimsVector(tr,tn){tr.startVector(8,tn.length,8);for(let ti=tn.length-1;ti>=0;ti--)tr.addInt64(tn[ti]);return tr.endVector()}static startDimsVector(tr,tn){tr.startVector(8,tn,8)}static addDataType(tn,ti){tn.addFieldInt32(3,ti,tr.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(tr,tn){tr.addFieldOffset(4,tn,0)}static createRawDataVector(tr,tn){tr.startVector(1,tn.length,1);for(let ti=tn.length-1;ti>=0;ti--)tr.addInt8(tn[ti]);return tr.endVector()}static startRawDataVector(tr,tn){tr.startVector(1,tn,1)}static addStringData(tr,tn){tr.addFieldOffset(5,tn,0)}static createStringDataVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startStringDataVector(tr,tn){tr.startVector(4,tn,4)}static endTensor(tr){return tr.endObject()}static createTensor(tr,tn,ti,to,ta,ts,tu){return n.startTensor(tr),n.addName(tr,tn),n.addDocString(tr,ti),n.addDims(tr,to),n.addDataType(tr,ta),n.addRawData(tr,ts),n.addStringData(tr,tu),n.endTensor(tr)}};tn.Tensor=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsSparseTensor(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsSparseTensor(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}values(tn){let ti=this.bb.__offset(this.bb_pos,4);return ti?(tn||new tr.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}indices(tn){let ti=this.bb.__offset(this.bb_pos,6);return ti?(tn||new tr.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}dims(tr){let tn=this.bb.__offset(this.bb_pos,8);return tn?this.bb.readInt64(this.bb.__vector(this.bb_pos+tn)+8*tr):this.bb.createLong(0,0)}dimsLength(){let tr=this.bb.__offset(this.bb_pos,8);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startSparseTensor(tr){tr.startObject(3)}static addValues(tr,tn){tr.addFieldOffset(0,tn,0)}static addIndices(tr,tn){tr.addFieldOffset(1,tn,0)}static addDims(tr,tn){tr.addFieldOffset(2,tn,0)}static createDimsVector(tr,tn){tr.startVector(8,tn.length,8);for(let ti=tn.length-1;ti>=0;ti--)tr.addInt64(tn[ti]);return tr.endVector()}static startDimsVector(tr,tn){tr.startVector(8,tn,8)}static endSparseTensor(tr){return tr.endObject()}static createSparseTensor(tr,tn,ti,to){return n.startSparseTensor(tr),n.addValues(tr,tn),n.addIndices(tr,ti),n.addDims(tr,to),n.endSparseTensor(tr)}};tn.SparseTensor=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsAttribute(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsAttribute(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}name(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}docString(tr){let tn=this.bb.__offset(this.bb_pos,6);return tn?this.bb.__string(this.bb_pos+tn,tr):null}type(){let tn=this.bb.__offset(this.bb_pos,8);return tn?this.bb.readInt32(this.bb_pos+tn):tr.experimental.fbs.AttributeType.UNDEFINED}f(){let tr=this.bb.__offset(this.bb_pos,10);return tr?this.bb.readFloat32(this.bb_pos+tr):0}i(){let tr=this.bb.__offset(this.bb_pos,12);return tr?this.bb.readInt64(this.bb_pos+tr):this.bb.createLong(0,0)}s(tr){let tn=this.bb.__offset(this.bb_pos,14);return tn?this.bb.__string(this.bb_pos+tn,tr):null}t(tn){let ti=this.bb.__offset(this.bb_pos,16);return ti?(tn||new tr.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}g(tn){let ti=this.bb.__offset(this.bb_pos,18);return ti?(tn||new tr.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}floats(tr){let tn=this.bb.__offset(this.bb_pos,20);return tn?this.bb.readFloat32(this.bb.__vector(this.bb_pos+tn)+4*tr):0}floatsLength(){let tr=this.bb.__offset(this.bb_pos,20);return tr?this.bb.__vector_len(this.bb_pos+tr):0}floatsArray(){let tr=this.bb.__offset(this.bb_pos,20);return tr?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+tr),this.bb.__vector_len(this.bb_pos+tr)):null}ints(tr){let tn=this.bb.__offset(this.bb_pos,22);return tn?this.bb.readInt64(this.bb.__vector(this.bb_pos+tn)+8*tr):this.bb.createLong(0,0)}intsLength(){let tr=this.bb.__offset(this.bb_pos,22);return tr?this.bb.__vector_len(this.bb_pos+tr):0}strings(tr,tn){let ti=this.bb.__offset(this.bb_pos,24);return ti?this.bb.__string(this.bb.__vector(this.bb_pos+ti)+4*tr,tn):null}stringsLength(){let tr=this.bb.__offset(this.bb_pos,24);return tr?this.bb.__vector_len(this.bb_pos+tr):0}tensors(tn,ti){let to=this.bb.__offset(this.bb_pos,26);return to?(ti||new tr.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}tensorsLength(){let tr=this.bb.__offset(this.bb_pos,26);return tr?this.bb.__vector_len(this.bb_pos+tr):0}graphs(tn,ti){let to=this.bb.__offset(this.bb_pos,28);return to?(ti||new tr.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}graphsLength(){let tr=this.bb.__offset(this.bb_pos,28);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startAttribute(tr){tr.startObject(13)}static addName(tr,tn){tr.addFieldOffset(0,tn,0)}static addDocString(tr,tn){tr.addFieldOffset(1,tn,0)}static addType(tn,ti){tn.addFieldInt32(2,ti,tr.experimental.fbs.AttributeType.UNDEFINED)}static addF(tr,tn){tr.addFieldFloat32(3,tn,0)}static addI(tr,tn){tr.addFieldInt64(4,tn,tr.createLong(0,0))}static addS(tr,tn){tr.addFieldOffset(5,tn,0)}static addT(tr,tn){tr.addFieldOffset(6,tn,0)}static addG(tr,tn){tr.addFieldOffset(7,tn,0)}static addFloats(tr,tn){tr.addFieldOffset(8,tn,0)}static createFloatsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addFloat32(tn[ti]);return tr.endVector()}static startFloatsVector(tr,tn){tr.startVector(4,tn,4)}static addInts(tr,tn){tr.addFieldOffset(9,tn,0)}static createIntsVector(tr,tn){tr.startVector(8,tn.length,8);for(let ti=tn.length-1;ti>=0;ti--)tr.addInt64(tn[ti]);return tr.endVector()}static startIntsVector(tr,tn){tr.startVector(8,tn,8)}static addStrings(tr,tn){tr.addFieldOffset(10,tn,0)}static createStringsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startStringsVector(tr,tn){tr.startVector(4,tn,4)}static addTensors(tr,tn){tr.addFieldOffset(11,tn,0)}static createTensorsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startTensorsVector(tr,tn){tr.startVector(4,tn,4)}static addGraphs(tr,tn){tr.addFieldOffset(12,tn,0)}static createGraphsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startGraphsVector(tr,tn){tr.startVector(4,tn,4)}static endAttribute(tr){return tr.endObject()}static createAttribute(tr,tn,ti,to,ta,ts,tu,tl,tc,tp,tf,td,th,tg){return n.startAttribute(tr),n.addName(tr,tn),n.addDocString(tr,ti),n.addType(tr,to),n.addF(tr,ta),n.addI(tr,ts),n.addS(tr,tu),n.addT(tr,tl),n.addG(tr,tc),n.addFloats(tr,tp),n.addInts(tr,tf),n.addStrings(tr,td),n.addTensors(tr,th),n.addGraphs(tr,tg),n.endAttribute(tr)}};tn.Attribute=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsGraph(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsGraph(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}initializers(tn,ti){let to=this.bb.__offset(this.bb_pos,4);return to?(ti||new tr.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}initializersLength(){let tr=this.bb.__offset(this.bb_pos,4);return tr?this.bb.__vector_len(this.bb_pos+tr):0}nodeArgs(tn,ti){let to=this.bb.__offset(this.bb_pos,6);return to?(ti||new tr.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}nodeArgsLength(){let tr=this.bb.__offset(this.bb_pos,6);return tr?this.bb.__vector_len(this.bb_pos+tr):0}nodes(tn,ti){let to=this.bb.__offset(this.bb_pos,8);return to?(ti||new tr.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}nodesLength(){let tr=this.bb.__offset(this.bb_pos,8);return tr?this.bb.__vector_len(this.bb_pos+tr):0}maxNodeIndex(){let tr=this.bb.__offset(this.bb_pos,10);return tr?this.bb.readUint32(this.bb_pos+tr):0}nodeEdges(tn,ti){let to=this.bb.__offset(this.bb_pos,12);return to?(ti||new tr.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}nodeEdgesLength(){let tr=this.bb.__offset(this.bb_pos,12);return tr?this.bb.__vector_len(this.bb_pos+tr):0}inputs(tr,tn){let ti=this.bb.__offset(this.bb_pos,14);return ti?this.bb.__string(this.bb.__vector(this.bb_pos+ti)+4*tr,tn):null}inputsLength(){let tr=this.bb.__offset(this.bb_pos,14);return tr?this.bb.__vector_len(this.bb_pos+tr):0}outputs(tr,tn){let ti=this.bb.__offset(this.bb_pos,16);return ti?this.bb.__string(this.bb.__vector(this.bb_pos+ti)+4*tr,tn):null}outputsLength(){let tr=this.bb.__offset(this.bb_pos,16);return tr?this.bb.__vector_len(this.bb_pos+tr):0}sparseInitializers(tn,ti){let to=this.bb.__offset(this.bb_pos,18);return to?(ti||new tr.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}sparseInitializersLength(){let tr=this.bb.__offset(this.bb_pos,18);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startGraph(tr){tr.startObject(8)}static addInitializers(tr,tn){tr.addFieldOffset(0,tn,0)}static createInitializersVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startInitializersVector(tr,tn){tr.startVector(4,tn,4)}static addNodeArgs(tr,tn){tr.addFieldOffset(1,tn,0)}static createNodeArgsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startNodeArgsVector(tr,tn){tr.startVector(4,tn,4)}static addNodes(tr,tn){tr.addFieldOffset(2,tn,0)}static createNodesVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startNodesVector(tr,tn){tr.startVector(4,tn,4)}static addMaxNodeIndex(tr,tn){tr.addFieldInt32(3,tn,0)}static addNodeEdges(tr,tn){tr.addFieldOffset(4,tn,0)}static createNodeEdgesVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startNodeEdgesVector(tr,tn){tr.startVector(4,tn,4)}static addInputs(tr,tn){tr.addFieldOffset(5,tn,0)}static createInputsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startInputsVector(tr,tn){tr.startVector(4,tn,4)}static addOutputs(tr,tn){tr.addFieldOffset(6,tn,0)}static createOutputsVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startOutputsVector(tr,tn){tr.startVector(4,tn,4)}static addSparseInitializers(tr,tn){tr.addFieldOffset(7,tn,0)}static createSparseInitializersVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startSparseInitializersVector(tr,tn){tr.startVector(4,tn,4)}static endGraph(tr){return tr.endObject()}static createGraph(tr,tn,ti,to,ta,ts,tu,tl,tc){return n.startGraph(tr),n.addInitializers(tr,tn),n.addNodeArgs(tr,ti),n.addNodes(tr,to),n.addMaxNodeIndex(tr,ta),n.addNodeEdges(tr,ts),n.addInputs(tr,tu),n.addOutputs(tr,tl),n.addSparseInitializers(tr,tc),n.endGraph(tr)}};tn.Graph=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsModel(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsModel(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}irVersion(){let tr=this.bb.__offset(this.bb_pos,4);return tr?this.bb.readInt64(this.bb_pos+tr):this.bb.createLong(0,0)}opsetImport(tn,ti){let to=this.bb.__offset(this.bb_pos,6);return to?(ti||new tr.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}opsetImportLength(){let tr=this.bb.__offset(this.bb_pos,6);return tr?this.bb.__vector_len(this.bb_pos+tr):0}producerName(tr){let tn=this.bb.__offset(this.bb_pos,8);return tn?this.bb.__string(this.bb_pos+tn,tr):null}producerVersion(tr){let tn=this.bb.__offset(this.bb_pos,10);return tn?this.bb.__string(this.bb_pos+tn,tr):null}domain(tr){let tn=this.bb.__offset(this.bb_pos,12);return tn?this.bb.__string(this.bb_pos+tn,tr):null}modelVersion(){let tr=this.bb.__offset(this.bb_pos,14);return tr?this.bb.readInt64(this.bb_pos+tr):this.bb.createLong(0,0)}docString(tr){let tn=this.bb.__offset(this.bb_pos,16);return tn?this.bb.__string(this.bb_pos+tn,tr):null}graph(tn){let ti=this.bb.__offset(this.bb_pos,18);return ti?(tn||new tr.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}graphDocString(tr){let tn=this.bb.__offset(this.bb_pos,20);return tn?this.bb.__string(this.bb_pos+tn,tr):null}static startModel(tr){tr.startObject(9)}static addIrVersion(tr,tn){tr.addFieldInt64(0,tn,tr.createLong(0,0))}static addOpsetImport(tr,tn){tr.addFieldOffset(1,tn,0)}static createOpsetImportVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startOpsetImportVector(tr,tn){tr.startVector(4,tn,4)}static addProducerName(tr,tn){tr.addFieldOffset(2,tn,0)}static addProducerVersion(tr,tn){tr.addFieldOffset(3,tn,0)}static addDomain(tr,tn){tr.addFieldOffset(4,tn,0)}static addModelVersion(tr,tn){tr.addFieldInt64(5,tn,tr.createLong(0,0))}static addDocString(tr,tn){tr.addFieldOffset(6,tn,0)}static addGraph(tr,tn){tr.addFieldOffset(7,tn,0)}static addGraphDocString(tr,tn){tr.addFieldOffset(8,tn,0)}static endModel(tr){return tr.endObject()}static createModel(tr,tn,ti,to,ta,ts,tu,tl,tc,tp){return n.startModel(tr),n.addIrVersion(tr,tn),n.addOpsetImport(tr,ti),n.addProducerName(tr,to),n.addProducerVersion(tr,ta),n.addDomain(tr,ts),n.addModelVersion(tr,tu),n.addDocString(tr,tl),n.addGraph(tr,tc),n.addGraphDocString(tr,tp),n.endModel(tr)}};tn.Model=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tr){!function(tr){let e=class e{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsKernelCreateInfos(tr,tn){return(tn||new e).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsKernelCreateInfos(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new e).__init(tr.readInt32(tr.position())+tr.position(),tr)}nodeIndices(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.readUint32(this.bb.__vector(this.bb_pos+tn)+4*tr):0}nodeIndicesLength(){let tr=this.bb.__offset(this.bb_pos,4);return tr?this.bb.__vector_len(this.bb_pos+tr):0}nodeIndicesArray(){let tr=this.bb.__offset(this.bb_pos,4);return tr?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+tr),this.bb.__vector_len(this.bb_pos+tr)):null}kernelDefHashes(tr){let tn=this.bb.__offset(this.bb_pos,6);return tn?this.bb.readUint64(this.bb.__vector(this.bb_pos+tn)+8*tr):this.bb.createLong(0,0)}kernelDefHashesLength(){let tr=this.bb.__offset(this.bb_pos,6);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startKernelCreateInfos(tr){tr.startObject(2)}static addNodeIndices(tr,tn){tr.addFieldOffset(0,tn,0)}static createNodeIndicesVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addInt32(tn[ti]);return tr.endVector()}static startNodeIndicesVector(tr,tn){tr.startVector(4,tn,4)}static addKernelDefHashes(tr,tn){tr.addFieldOffset(1,tn,0)}static createKernelDefHashesVector(tr,tn){tr.startVector(8,tn.length,8);for(let ti=tn.length-1;ti>=0;ti--)tr.addInt64(tn[ti]);return tr.endVector()}static startKernelDefHashesVector(tr,tn){tr.startVector(8,tn,8)}static endKernelCreateInfos(tr){return tr.endObject()}static createKernelCreateInfos(tr,tn,ti){return e.startKernelCreateInfos(tr),e.addNodeIndices(tr,tn),e.addKernelDefHashes(tr,ti),e.endKernelCreateInfos(tr)}};tr.KernelCreateInfos=e}(tr.fbs||(tr.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsSubGraphSessionState(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsSubGraphSessionState(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}graphId(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}sessionState(tn){let ti=this.bb.__offset(this.bb_pos,6);return ti?(tn||new tr.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}static startSubGraphSessionState(tr){tr.startObject(2)}static addGraphId(tr,tn){tr.addFieldOffset(0,tn,0)}static addSessionState(tr,tn){tr.addFieldOffset(1,tn,0)}static endSubGraphSessionState(tr){let tn=tr.endObject();return tr.requiredField(tn,4),tn}static createSubGraphSessionState(tr,tn,ti){return n.startSubGraphSessionState(tr),n.addGraphId(tr,tn),n.addSessionState(tr,ti),n.endSubGraphSessionState(tr)}};tn.SubGraphSessionState=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsSessionState(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsSessionState(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}kernels(tn){let ti=this.bb.__offset(this.bb_pos,4);return ti?(tn||new tr.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}subGraphSessionStates(tn,ti){let to=this.bb.__offset(this.bb_pos,6);return to?(ti||new tr.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+to)+4*tn),this.bb):null}subGraphSessionStatesLength(){let tr=this.bb.__offset(this.bb_pos,6);return tr?this.bb.__vector_len(this.bb_pos+tr):0}static startSessionState(tr){tr.startObject(2)}static addKernels(tr,tn){tr.addFieldOffset(0,tn,0)}static addSubGraphSessionStates(tr,tn){tr.addFieldOffset(1,tn,0)}static createSubGraphSessionStatesVector(tr,tn){tr.startVector(4,tn.length,4);for(let ti=tn.length-1;ti>=0;ti--)tr.addOffset(tn[ti]);return tr.endVector()}static startSubGraphSessionStatesVector(tr,tn){tr.startVector(4,tn,4)}static endSessionState(tr){return tr.endObject()}static createSessionState(tr,tn,ti){return n.startSessionState(tr),n.addKernels(tr,tn),n.addSubGraphSessionStates(tr,ti),n.endSessionState(tr)}};tn.SessionState=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={})),function(tr){!function(tn){!function(tn){let n=class n{constructor(){this.bb=null,this.bb_pos=0}__init(tr,tn){return this.bb_pos=tr,this.bb=tn,this}static getRootAsInferenceSession(tr,tn){return(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static getSizePrefixedRootAsInferenceSession(tr,tn){return tr.setPosition(tr.position()+ts.flatbuffers.SIZE_PREFIX_LENGTH),(tn||new n).__init(tr.readInt32(tr.position())+tr.position(),tr)}static bufferHasIdentifier(tr){return tr.__has_identifier("ORTM")}ortVersion(tr){let tn=this.bb.__offset(this.bb_pos,4);return tn?this.bb.__string(this.bb_pos+tn,tr):null}model(tn){let ti=this.bb.__offset(this.bb_pos,6);return ti?(tn||new tr.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}sessionState(tn){let ti=this.bb.__offset(this.bb_pos,8);return ti?(tn||new tr.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+ti),this.bb):null}static startInferenceSession(tr){tr.startObject(3)}static addOrtVersion(tr,tn){tr.addFieldOffset(0,tn,0)}static addModel(tr,tn){tr.addFieldOffset(1,tn,0)}static addSessionState(tr,tn){tr.addFieldOffset(2,tn,0)}static endInferenceSession(tr){return tr.endObject()}static finishInferenceSessionBuffer(tr,tn){tr.finish(tn,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(tr,tn){tr.finish(tn,"ORTM",!0)}static createInferenceSession(tr,tn,ti,to){return n.startInferenceSession(tr),n.addOrtVersion(tr,tn),n.addModel(tr,ti),n.addSessionState(tr,to),n.endInferenceSession(tr)}};tn.InferenceSession=n}(tn.fbs||(tn.fbs={}))}(tr.experimental||(tr.experimental={}))}(tn.onnxruntime||(tn.onnxruntime={}))},7448:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.OnnxjsSessionHandler=void 0;let to=ti(1670),ta=ti(9162);tn.OnnxjsSessionHandler=class{constructor(tr){this.session=tr,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(tr,tn,ti){let ts=new Map;for(let tn in tr)if(Object.hasOwnProperty.call(tr,tn)){let ti=tr[tn];ts.set(tn,new ta.Tensor(ti.dims,ti.type,void 0,void 0,ti.data))}let tu=await this.session.run(ts),tl={};return tu.forEach((tr,tn)=>{tl[tn]=new to.Tensor(tr.type,tr.data,tr.dims)}),tl}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.Session=void 0;let to=ti(7067),ta=ti(1296),ts=ti(7091),tu=ti(1036),tl=ti(6231),tc=ti(2644);tn.Session=class{constructor(tr={}){this._initialized=!1,this.backendHint=tr.backendHint,this.profiler=tl.Profiler.create(tr.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(tr,tn,ti){await this.profiler.event("session","Session.loadModel",async()=>{let tu=await (0,ts.resolveBackend)(this.backendHint);if(this.sessionHandler=tu.createSessionHandler(this.context),this._model=new tc.Model,"string"==typeof tr){let tn=tr.endsWith(".ort");if("undefined"==typeof fetch){let ti=await (0,ta.promisify)(to.readFile)(tr);this.initialize(ti,tn)}else{let ti=await fetch(tr),to=await ti.arrayBuffer();this.initialize(new Uint8Array(to),tn)}}else if(ArrayBuffer.isView(tr))this.initialize(tr);else{let to=new Uint8Array(tr,tn||0,ti||tr.byteLength);this.initialize(to)}})}initialize(tr,tn){if(this._initialized)throw Error("already initialized");this.profiler.event("session","Session.initialize",()=>{let ti=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(tr,ti,tn),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new tu.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(tr){if(!this._initialized)throw Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{let tn=this.normalizeAndValidateInputs(tr),ti=await this._executionPlan.execute(this.sessionHandler,tn);return this.createOutput(ti)})}normalizeAndValidateInputs(tr){let tn=this._model.graph.getInputNames();if(Array.isArray(tr)){if(tr.length!==tn.length)throw Error(`incorrect input array length: expected ${tn.length} but got ${tr.length}`)}else{if(tr.size!==tn.length)throw Error(`incorrect input map size: expected ${tn.length} but got ${tr.size}`);let ti=Array(tr.size),to=0;for(let ta=0;ta"string"==typeof tr)))throw TypeError("cache should be a string array");tp&&(this.cache=Array(tl))}else{if(void 0!==ts){let tr=f(tn);if(!(ts instanceof tr))throw TypeError(`cache should be type ${tr.name}`)}if(tp){let tr=new ArrayBuffer(tl*function(tr){switch(tr){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw Error(`cannot calculate sizeof() on type ${tr}`)}}(tn));this.cache=function(tr,tn){return new(f(tn))(tr)}(tr,tn)}}}static fromProto(tr){if(!tr)throw Error("cannot construct Value from an empty tensor");let tn=tc.ProtoUtil.tensorDataTypeFromProto(tr.dataType),ti=tc.ProtoUtil.tensorDimsFromProto(tr.dims),to=new l(ti,tn);if("string"===tn)tr.stringData.forEach((tr,tn)=>{to.data[tn]=(0,tc.decodeUtf8String)(tr)});else if(tr.rawData&&"number"==typeof tr.rawData.byteLength&&tr.rawData.byteLength>0){let tn=to.data,ti=new DataView(tr.rawData.buffer,tr.rawData.byteOffset,tr.rawData.byteLength),ta=p(tr.dataType),ts=tr.rawData.byteLength/ta;if(tr.rawData.byteLength%ta!=0)throw Error("invalid buffer length");if(tn.length!==ts)throw Error("buffer length mismatch");for(let to=0;to0){let tn=to.data,ti=new DataView(tr.rawDataArray().buffer,tr.rawDataArray().byteOffset,tr.rawDataLength()),ta=p(tr.dataType()),ts=tr.rawDataLength()/ta;if(tr.rawDataLength()%ta!=0)throw Error("invalid buffer length");if(tn.length!==ts)throw Error("buffer length mismatch");for(let to=0;to1&&tc>1)return;tu[ts-tl]=Math.max(ti,tc)}return tu}static index(tr,tn){let ti=Array(tn.length);return c.fillIndex(tr,tn,ti),ti}static fillIndex(tr,tn,ti){let to=tr.length-tn.length;for(let ta=0;ta=0;tr--)to[tr]=tp%ts[tr],tp=Math.floor(tp/ts[tr]);th||(c.fillIndex(to,tr.dims,ta),tf=tr.get(ta)),tg||(c.fillIndex(to,tn.dims,tl),td=tn.get(tl)),tc.set(to,ti(tf,td))}}return tc}}static isValidBroadcast(tr,tn){let ti=tr.length,to=tn.length;if(ti>to)return!1;for(let ta=1;ta<=ti;ta++)if(1!==tr[ti-ta]&&tr[ti-ta]!==tn[to-ta])return!1;return!0}static getBroadcastDims(tr,tn){let ti=tr.length,to=[];for(let ta=0;ta1&&1===tu&&to.unshift(ts)}return to}};tn.BroadcastUtil=c,tn.arrayCopyHelper=function(tr,tn,ti,to,ta){if(to<0||to>=tn.length)throw Error("sourceIndex out of bounds");if(ti<0||ti>=tr.length)throw Error("targetIndex out of bounds");if(to+ta>tn.length)throw Error("source indices to be copied are outside bounds");if(ti+ta>tr.length)throw Error("target array is too small to hold result");for(let ts=0;tsts.default.isLong(tr)?tr.toNumber():tr)}static tensorValueTypeFromProto(tr){return{tensorType:l.tensorDataTypeFromProto(tr.elemType),shape:{dims:l.tensorDimsFromProto(tr.shape.dim.map(tr=>tr.dimValue))}}}static tensorDimsFromORTFormat(tr){let tn=[];for(let ti=0;titr.length)throw Error(`invalid dimension of ${tn} for sizeFromDimension as Tensor has ${tr.length} dimensions.`);return f.getSizeFromDimensionRange(tr,tn,tr.length)}static sizeToDimension(tr,tn){if(tn<0||tn>tr.length)throw Error(`invalid dimension of ${tn} for sizeToDimension as Tensor has ${tr.length} dimensions.`);return f.getSizeFromDimensionRange(tr,0,tn)}static getSizeFromDimensionRange(tr,tn,ti){let to=1;for(let ta=tn;ta=0;--to)ti[to]=ti[to+1]*tr[to+1];return ti}static transpose(tr){return tr.slice().reverse()}static indicesToOffset(tr,tn,ti){void 0===ti&&(ti=tr.length);let to=0;for(let ta=0;ta=tn)throw Error("unsupported axis for this operation.");return tr<0?tr+tn:tr}static normalizeAxes(tr,tn){return tr.map(tr=>this.normalizeAxis(tr,tn))}static incrementIndex(tr,tn,ti){if(0===tn.length||0===tr.length)throw Error("Index incrementing unsupported for scalar Tensor");if(void 0===ti)ti=tn.length;else if(ti<=0||ti>tn.length)throw Error("Incorrect axis to increment on");for(let to=ti-1;to>=0&&(tr[to]++,!(tr[to]=tr.length)throw Error("the dimension with value zero exceeds the dimension size of the input tensor");to[tu]=tr[tu]}else to[tu]=tn[tu];ts*=to[tu]}}let tu=f.size(tr);if(-1!==ta){if(tu%ts!=0)throw Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${tr}] Output shape: [${tn}]`);to[ta]=tu/ts}else if(ts!==tu)throw Error("reshapedDims and originalDims don't have matching sizes");return to}static sortBasedOnPerm(tr,tn){return tn?tn.map(tn=>tr[tn]):tr.slice().reverse()}static padShape(tr,tn){let ti=tr.length;return tr.map((tr,to)=>tr+tn[to]+tn[to+ti])}static areEqual(tr,tn){return tr.length===tn.length&&tr.every((tr,ti)=>tr===tn[ti])}static validateDimsAndCalcSize(tr){if(tr.length>6)throw TypeError("Only rank 0 to 6 is supported for tensor shape.");let tn=1;for(let ti of tr){if(!Number.isInteger(ti))throw TypeError(`Invalid shape: ${ti} is not an integer`);if(ti<0||ti>2147483647)throw TypeError(`Invalid shape: length ${ti} is not allowed`);tn*=ti}return tn}static flattenShape(tr,tn){tn<0&&(tn+=tr.length);let ti=tr.reduce((tr,tn)=>tr*tn,1),to=tr.slice(tn).reduce((tr,tn)=>tr*tn,1);return[ti/to,to]}static squeezeShape(tr,tn){let ti=[];tn=f.normalizeAxes(tn,tr.length);for(let to=0;to=0;if(ta&&1!==tr[to])throw Error("squeeze an axis of size different than 1");(0===tn.length&&tr[to]>1||tn.length>0&&!ta)&&ti.push(tr[to])}return ti}static unsqueezeShape(tr,tn){let ti=Array(tr.length+tn.length);ti.fill(0);for(let tr=0;tr=ti.length)throw Error("'axes' has an out of range axis");if(0!==ti[to])throw Error("'axes' has a duplicate axis");ti[to]=1}let to=0;for(let tn=0;tn=tn.length)throw Error("sourceIndex out of bounds");if(ti<0||ti>=tr.length)throw Error("targetIndex out of bounds");if(to+ta>tn.length)throw Error("source indices to be copied are outside bounds");if(ti+ta>tr.length)throw Error("target array is too small to hold result");for(let ts=0;ts=tn.length)throw Error("sourceIndex out of bounds");if(ti<0||ti>=tr.length)throw Error("targetIndex out of bounds");if(to+ta>tn.length)throw Error("source indices to be copied are outside bounds");if(ti+ta>tr.length)throw Error("target array is too small to hold result");for(let tu=0;tu=tn.length)throw Error("sourceIndex out of bounds");if(ti<0||ti>=tr.length)throw Error("targetIndex out of bounds");if(to+ta>tn.length)throw Error("source indices to be copied are outside bounds");if(ti+ta>tr.length)throw Error("target array is too small to hold result");for(let tu=0;tu=tn.length)throw Error("sourceIndex out of bounds");if(ti<0||ti>=tr.length)throw Error("targetIndex out of bounds");if(to+ta>tn.length)throw Error("source indices to be copied are outside bounds");if(ti+ta>tr.length)throw Error("target array is too small to hold result");for(let ts=0;tstn.push(ti));let tu=h.calcReduceShape(ts,tn,!0),tc=f.size(tu),tp=new tl.Tensor(tu,tr.type),tf=f.computeStrides(tu),td=f.computeStrides(ts),th=Array(ts.length);for(let ti=0;ti=tn.length)return ts(tr[ta]);let tc=tn[to],tp=tc>=ti.length?1:f.size(ti.slice(tc+1));for(let tf=0;tf0!==tr)}};tn.ReduceUtil=h;let g=class g{static adjustPoolAttributes(tr,tn,ti,to,ta,ts){if(!tr&&ti.length!==tn.length-2)throw Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(tr)for(let tr=0;tr=ti.length?ti.push(tn[tr+2]):ti[tr]=tn[tr+2];for(let tr=0;tr=ti[tr]||ts[tr+ti.length]>=ti[tr])throw Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(tr,tn,ti,to,ta,ts){if(ts){if(ta.length!==2*(tr.length-2))throw Error("length of pads should be twice the length of data dimensions");if(tn.length!==tr.length-2)throw Error("length of strides should be the length of data dimensions");if(to.length!==tr.length-2)throw Error("length of kernel shapes should be the length of data dimensions");for(let tu=0;tu{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.iterateExtraOptions=void 0,tn.iterateExtraOptions=(tr,ti,to,ta)=>{if("object"==typeof tr&&null!==tr){if(to.has(tr))throw Error("Circular reference in options");to.add(tr)}Object.entries(tr).forEach(([tr,ts])=>{let tu=ti?ti+tr:tr;if("object"==typeof ts)(0,tn.iterateExtraOptions)(ts,tu+".",to,ta);else if("string"==typeof ts||"number"==typeof ts)ta(tu,ts.toString());else{if("boolean"!=typeof ts)throw Error("Can't handle extra config type: "+typeof ts);ta(tu,ts?"1":"0")}})}},2157:function(tr,tn,ti){"use strict";var to,ta=this&&this.__createBinding||(Object.create?function(tr,tn,ti,to){void 0===to&&(to=ti);var ta=Object.getOwnPropertyDescriptor(tn,ti);ta&&!("get"in ta?!tn.__esModule:ta.writable||ta.configurable)||(ta={enumerable:!0,get:function(){return tn[ti]}}),Object.defineProperty(tr,to,ta)}:function(tr,tn,ti,to){void 0===to&&(to=ti),tr[to]=tn[ti]}),ts=this&&this.__setModuleDefault||(Object.create?function(tr,tn){Object.defineProperty(tr,"default",{enumerable:!0,value:tn})}:function(tr,tn){tr.default=tn}),tu=this&&this.__importStar||function(tr){if(tr&&tr.__esModule)return tr;var tn={};if(null!=tr)for(var ti in tr)"default"!==ti&&Object.prototype.hasOwnProperty.call(tr,ti)&&ta(tn,tr,ti);return ts(tn,tr),tn};Object.defineProperty(tn,"__esModule",{value:!0}),tn.endProfiling=tn.run=tn.releaseSession=tn.createSession=tn.createSessionFinalize=tn.createSessionAllocate=tn.initOrt=tn.initWasm=void 0;let tl=ti(1670),tc=tu(ti(349)),tp=ti(6361),l=()=>!!tl.env.wasm.proxy&&"undefined"!=typeof document,tf,td,th,tg=!1,tb=!1,tm=!1,ty=[],t_=[],tv=[],tx=[],tw=[],tT=[],T=()=>{if(tg||!tb||tm||!tf)throw Error("worker not ready")},S=tr=>{switch(tr.data.type){case"init-wasm":tg=!1,tr.data.err?(tm=!0,td[1](tr.data.err)):(tb=!0,td[0]());break;case"init-ort":tr.data.err?th[1](tr.data.err):th[0]();break;case"create_allocate":tr.data.err?ty.shift()[1](tr.data.err):ty.shift()[0](tr.data.out);break;case"create_finalize":tr.data.err?t_.shift()[1](tr.data.err):t_.shift()[0](tr.data.out);break;case"create":tr.data.err?tv.shift()[1](tr.data.err):tv.shift()[0](tr.data.out);break;case"release":tr.data.err?tx.shift()[1](tr.data.err):tx.shift()[0]();break;case"run":tr.data.err?tw.shift()[1](tr.data.err):tw.shift()[0](tr.data.out);break;case"end-profiling":tr.data.err?tT.shift()[1](tr.data.err):tT.shift()[0]()}},tS="undefined"!=typeof document?null===(to=null==document?void 0:document.currentScript)||void 0===to?void 0:to.src:void 0;tn.initWasm=async()=>{if(l()){if(tb)return;if(tg)throw Error("multiple calls to 'initWasm()' detected.");if(tm)throw Error("previous call to 'initWasm()' failed.");return tg=!0,void 0===tl.env.wasm.wasmPaths&&tS&&0!==tS.indexOf("blob:")&&(tl.env.wasm.wasmPaths=tS.substr(0,+tS.lastIndexOf("/")+1)),new Promise((tr,tn)=>{null==tf||tf.terminate(),(tf=ti(9710).Z()).onmessage=S,td=[tr,tn];let to={type:"init-wasm",in:tl.env.wasm};tf.postMessage(to)})}return(0,tp.initializeWebAssembly)(tl.env.wasm)},tn.initOrt=async(tr,tn)=>{if(l())return T(),new Promise((ti,to)=>{th=[ti,to];let ta={type:"init-ort",in:{numThreads:tr,loggingLevel:tn}};tf.postMessage(ta)});tc.initOrt(tr,tn)},tn.createSessionAllocate=async tr=>l()?(T(),new Promise((tn,ti)=>{ty.push([tn,ti]);let to={type:"create_allocate",in:{model:tr}};tf.postMessage(to,[tr.buffer])})):tc.createSessionAllocate(tr),tn.createSessionFinalize=async(tr,tn)=>l()?(T(),new Promise((ti,to)=>{t_.push([ti,to]);let ta={type:"create_finalize",in:{modeldata:tr,options:tn}};tf.postMessage(ta)})):tc.createSessionFinalize(tr,tn),tn.createSession=async(tr,tn)=>l()?(T(),new Promise((ti,to)=>{tv.push([ti,to]);let ta={type:"create",in:{model:tr,options:tn}};tf.postMessage(ta,[tr.buffer])})):tc.createSession(tr,tn),tn.releaseSession=async tr=>{if(l())return T(),new Promise((tn,ti)=>{tx.push([tn,ti]);let to={type:"release",in:tr};tf.postMessage(to)});tc.releaseSession(tr)},tn.run=async(tr,tn,ti,to,ta)=>l()?(T(),new Promise((ts,tu)=>{tw.push([ts,tu]);let tl={type:"run",in:{sessionId:tr,inputIndices:tn,inputs:ti,outputIndices:to,options:ta}};tf.postMessage(tl,tc.extractTransferableBuffers(ti))})):tc.run(tr,tn,ti,to,ta),tn.endProfiling=async tr=>{if(l())return T(),new Promise((tn,ti)=>{tT.push([tn,ti]);let to={type:"end-profiling",in:tr};tf.postMessage(to)});tc.endProfiling(tr)}},586:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.setRunOptions=void 0;let to=ti(7967),ta=ti(4983),ts=ti(6361);tn.setRunOptions=tr=>{let tn=(0,ts.getInstance)(),ti=0,tu=[],tl=tr||{};try{if(void 0===(null==tr?void 0:tr.logSeverityLevel))tl.logSeverityLevel=2;else if("number"!=typeof tr.logSeverityLevel||!Number.isInteger(tr.logSeverityLevel)||tr.logSeverityLevel<0||tr.logSeverityLevel>4)throw Error(`log serverity level is not valid: ${tr.logSeverityLevel}`);if(void 0===(null==tr?void 0:tr.logVerbosityLevel))tl.logVerbosityLevel=0;else if("number"!=typeof tr.logVerbosityLevel||!Number.isInteger(tr.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${tr.logVerbosityLevel}`);void 0===(null==tr?void 0:tr.terminate)&&(tl.terminate=!1);let ts=0;if(void 0!==(null==tr?void 0:tr.tag)&&(ts=(0,ta.allocWasmString)(tr.tag,tu)),ti=tn._OrtCreateRunOptions(tl.logSeverityLevel,tl.logVerbosityLevel,!!tl.terminate,ts),0===ti)throw Error("Can't create run options");return void 0!==(null==tr?void 0:tr.extra)&&(0,to.iterateExtraOptions)(tr.extra,"",new WeakSet,(tr,to)=>{let ts=(0,ta.allocWasmString)(tr,tu),tl=(0,ta.allocWasmString)(to,tu);if(0!==tn._OrtAddRunConfigEntry(ti,ts,tl))throw Error(`Can't set a run config entry: ${tr} - ${to}`)}),[ti,tu]}catch(tr){throw 0!==ti&&tn._OrtReleaseRunOptions(ti),tu.forEach(tn._free),tr}}},2306:(tr,tn,ti)=>{"use strict";let to;Object.defineProperty(tn,"__esModule",{value:!0}),tn.OnnxruntimeWebAssemblySessionHandler=void 0;let ta=ti(2806),ts=ti(1670),tu=ti(2850),tl=ti(2157);tn.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(tr){let tn=await fetch(tr),ti=await tn.arrayBuffer();return(0,tl.createSessionAllocate)(new Uint8Array(ti))}async loadModel(tr,tn){if(to||(await (0,tl.initOrt)(ts.env.wasm.numThreads,(tr=>{switch(tr){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw Error(`unsupported logging level: ${tr}`)}})(ts.env.logLevel)),to=!0),"string"==typeof tr){if("undefined"==typeof fetch){let ti=await (0,tu.promisify)(ta.readFile)(tr);[this.sessionId,this.inputNames,this.outputNames]=await (0,tl.createSession)(ti,tn)}else{let ti=await this.createSessionAllocate(tr);[this.sessionId,this.inputNames,this.outputNames]=await (0,tl.createSessionFinalize)(ti,tn)}}else[this.sessionId,this.inputNames,this.outputNames]=await (0,tl.createSession)(tr,tn)}async dispose(){return(0,tl.releaseSession)(this.sessionId)}async run(tr,tn,ti){let to=[],ta=[];Object.entries(tr).forEach(tr=>{let tn=tr[0],ti=tr[1],ts=this.inputNames.indexOf(tn);if(-1===ts)throw Error(`invalid input '${tn}'`);to.push(ti),ta.push(ts)});let tu=[];Object.entries(tn).forEach(tr=>{let tn=tr[0],ti=this.outputNames.indexOf(tn);if(-1===ti)throw Error(`invalid output '${tn}'`);tu.push(ti)});let tc=await (0,tl.run)(this.sessionId,ta,to.map(tr=>[tr.type,tr.dims,tr.data]),tu,ti),tp={};for(let tr=0;tr{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.setSessionOptions=void 0;let to=ti(7967),ta=ti(4983),ts=ti(6361);tn.setSessionOptions=tr=>{let tn=(0,ts.getInstance)(),ti=0,tu=[],tl=tr||{};(tr=>{tr.extra||(tr.extra={}),tr.extra.session||(tr.extra.session={});let tn=tr.extra.session;tn.use_ort_model_bytes_directly||(tn.use_ort_model_bytes_directly="1")})(tl);try{void 0===(null==tr?void 0:tr.graphOptimizationLevel)&&(tl.graphOptimizationLevel="all");let tc=(tr=>{switch(tr){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw Error(`unsupported graph optimization level: ${tr}`)}})(tl.graphOptimizationLevel);void 0===(null==tr?void 0:tr.enableCpuMemArena)&&(tl.enableCpuMemArena=!0),void 0===(null==tr?void 0:tr.enableMemPattern)&&(tl.enableMemPattern=!0),void 0===(null==tr?void 0:tr.executionMode)&&(tl.executionMode="sequential");let tp=(tr=>{switch(tr){case"sequential":return 0;case"parallel":return 1;default:throw Error(`unsupported execution mode: ${tr}`)}})(tl.executionMode),tf=0;if(void 0!==(null==tr?void 0:tr.logId)&&(tf=(0,ta.allocWasmString)(tr.logId,tu)),void 0===(null==tr?void 0:tr.logSeverityLevel))tl.logSeverityLevel=2;else if("number"!=typeof tr.logSeverityLevel||!Number.isInteger(tr.logSeverityLevel)||tr.logSeverityLevel<0||tr.logSeverityLevel>4)throw Error(`log serverity level is not valid: ${tr.logSeverityLevel}`);if(void 0===(null==tr?void 0:tr.logVerbosityLevel))tl.logVerbosityLevel=0;else if("number"!=typeof tr.logVerbosityLevel||!Number.isInteger(tr.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${tr.logVerbosityLevel}`);if(void 0===(null==tr?void 0:tr.enableProfiling)&&(tl.enableProfiling=!1),ti=tn._OrtCreateSessionOptions(tc,!!tl.enableCpuMemArena,!!tl.enableMemPattern,tp,!!tl.enableProfiling,0,tf,tl.logSeverityLevel,tl.logVerbosityLevel),0===ti)throw Error("Can't create session options");return(null==tr?void 0:tr.executionProviders)&&((tr,tn,ti)=>{for(let to of tn){let tn="string"==typeof to?to:to.name;switch(tn){case"xnnpack":tn="XNNPACK";break;case"wasm":case"cpu":continue;default:throw Error(`not supported EP: ${tn}`)}let tu=(0,ta.allocWasmString)(tn,ti);if(0!==(0,ts.getInstance)()._OrtAppendExecutionProvider(tr,tu))throw Error(`Can't append execution provider: ${tn}`)}})(ti,tr.executionProviders,tu),void 0!==(null==tr?void 0:tr.extra)&&(0,to.iterateExtraOptions)(tr.extra,"",new WeakSet,(tr,to)=>{let ts=(0,ta.allocWasmString)(tr,tu),tl=(0,ta.allocWasmString)(to,tu);if(0!==tn._OrtAddSessionConfigEntry(ti,ts,tl))throw Error(`Can't set a session config entry: ${tr} - ${to}`)}),[ti,tu]}catch(tr){throw 0!==ti&&tn._OrtReleaseSessionOptions(ti),tu.forEach(tn._free),tr}}},4983:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.allocWasmString=void 0;let to=ti(6361);tn.allocWasmString=(tr,tn)=>{let ti=(0,to.getInstance)(),ta=ti.lengthBytesUTF8(tr)+1,ts=ti._malloc(ta);return ti.stringToUTF8(tr,ts,ta),tn.push(ts),ts}},349:(tr,tn,ti)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0}),tn.extractTransferableBuffers=tn.endProfiling=tn.run=tn.releaseSession=tn.createSession=tn.createSessionFinalize=tn.createSessionAllocate=tn.initOrt=void 0;let to=ti(586),ta=ti(4919),ts=ti(4983),tu=ti(6361);tn.initOrt=(tr,tn)=>{let ti=(0,tu.getInstance)()._OrtInit(tr,tn);if(0!==ti)throw Error(`Can't initialize onnxruntime. error code = ${ti}`)};let tl=new Map;tn.createSessionAllocate=tr=>{let tn=(0,tu.getInstance)(),ti=tn._malloc(tr.byteLength);return tn.HEAPU8.set(tr,ti),[ti,tr.byteLength]},tn.createSessionFinalize=(tr,tn)=>{let ti=(0,tu.getInstance)(),to=0,ts=0,tc=[];try{if([ts,tc]=(0,ta.setSessionOptions)(tn),to=ti._OrtCreateSession(tr[0],tr[1],ts),0===to)throw Error("Can't create a session")}finally{ti._free(tr[0]),ti._OrtReleaseSessionOptions(ts),tc.forEach(ti._free)}let tp=ti._OrtGetInputCount(to),tf=ti._OrtGetOutputCount(to),td=[],th=[],tg=[],tb=[];for(let tr=0;tr{let to=(0,tn.createSessionAllocate)(tr);return(0,tn.createSessionFinalize)(to,ti)},tn.releaseSession=tr=>{let tn=(0,tu.getInstance)(),ti=tl.get(tr);if(!ti)throw Error("invalid session id");let to=ti[0],ta=ti[1],ts=ti[2];ta.forEach(tn._OrtFree),ts.forEach(tn._OrtFree),tn._OrtReleaseSession(to),tl.delete(tr)};let u=tr=>{switch(tr){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"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw Error(`unsupported data type: ${tr}`)}},c=tr=>{switch(tr){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 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw Error(`unsupported data type: ${tr}`)}},l=tr=>{switch(tr){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw Error(`unsupported type: ${tr}`)}};tn.run=(tr,tn,ti,ta,tc)=>{let tp=(0,tu.getInstance)(),tf=tl.get(tr);if(!tf)throw Error("invalid session id");let td=tf[0],th=tf[1],tg=tf[2],tb=tn.length,tm=ta.length,ty=0,t_=[],tv=[],tx=[];try{[ty,t_]=(0,to.setRunOptions)(tc);for(let tr=0;trtp.HEAP32[tr++]=tn);let ti=tp._OrtCreateTensor(u(ta),tn,to,tf,tu.length);if(0===ti)throw Error("Can't create a tensor");tv.push(ti)}finally{tp.stackRestore(tc)}}let tr=tp.stackSave(),tu=tp.stackAlloc(4*tb),tl=tp.stackAlloc(4*tb),tf=tp.stackAlloc(4*tm),tw=tp.stackAlloc(4*tm);try{let tr=tu/4,ti=tl/4,to=tf/4,ts=tw/4;for(let to=0;totr*tn);if(ta=c(ti),"string"===ta){let tr=[],tn=ts/4;for(let ti=0;ti{let tn=(0,tu.getInstance)(),ti=tl.get(tr);if(!ti)throw Error("invalid session id");let to=ti[0],ta=tn._OrtEndProfiling(to);if(0===ta)throw Error("Can't get an profile file name");tn._OrtFree(ta)},tn.extractTransferableBuffers=tr=>{let tn=[];for(let ti of tr){let tr=ti[2];!Array.isArray(tr)&&tr.buffer&&tn.push(tr.buffer)}return tn}},6361:function(tr,tn,ti){"use strict";var to=this&&this.__createBinding||(Object.create?function(tr,tn,ti,to){void 0===to&&(to=ti);var ta=Object.getOwnPropertyDescriptor(tn,ti);ta&&!("get"in ta?!tn.__esModule:ta.writable||ta.configurable)||(ta={enumerable:!0,get:function(){return tn[ti]}}),Object.defineProperty(tr,to,ta)}:function(tr,tn,ti,to){void 0===to&&(to=ti),tr[to]=tn[ti]}),ta=this&&this.__setModuleDefault||(Object.create?function(tr,tn){Object.defineProperty(tr,"default",{enumerable:!0,value:tn})}:function(tr,tn){tr.default=tn}),ts=this&&this.__importStar||function(tr){if(tr&&tr.__esModule)return tr;var tn={};if(null!=tr)for(var ti in tr)"default"!==ti&&Object.prototype.hasOwnProperty.call(tr,ti)&&to(tn,tr,ti);return ta(tn,tr),tn},tu=this&&this.__importDefault||function(tr){return tr&&tr.__esModule?tr:{default:tr}};Object.defineProperty(tn,"__esModule",{value:!0}),tn.dispose=tn.getInstance=tn.initializeWebAssembly=void 0;let tl=ts(ti(6449)),tc=tu(ti(932)),tp=ti(3474),tf,td=!1,th=!1,tg=!1,h=(tr,tn)=>tn?tr?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":tr?"ort-wasm-simd.wasm":"ort-wasm.wasm";tn.initializeWebAssembly=async tr=>{if(td)return Promise.resolve();if(th)throw Error("multiple calls to 'initializeWebAssembly()' detected.");if(tg)throw Error("previous call to 'initializeWebAssembly()' failed.");th=!0;let tn=tr.initTimeout,to=tr.numThreads,ta=tr.simd,ts=to>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(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(tr){return!1}})(),tu=ta&&(()=>{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(tr){return!1}})(),tb="string"==typeof tr.wasmPaths?tr.wasmPaths:void 0,tm=h(!1,ts),ty=h(tu,ts),t_="object"==typeof tr.wasmPaths?tr.wasmPaths[ty]:void 0,tv=!1,tx=[];if(tn>0&&tx.push(new Promise(tr=>{setTimeout(()=>{tv=!0,tr()},tn)})),tx.push(new Promise((tr,tn)=>{let to=ts?tp:tc.default,ta={locateFile:(tr,tn)=>ts&&tr.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([ti(4154)],{type:"text/javascript"})):tr===tm?null!=t_?t_:(null!=tb?tb:tn)+ty:tn+tr};if(ts){if("undefined"==typeof Blob)ta.mainScriptUrlOrBlob=tl.join("/","ort-wasm-threaded.js");else{let tr=`var ortWasmThreaded=(function(){var _scriptDir;return ${to.toString()}})();`;ta.mainScriptUrlOrBlob=new Blob([tr],{type:"text/javascript"})}}to(ta).then(tn=>{th=!1,td=!0,tf=tn,tr()},tr=>{th=!1,tg=!0,tn(tr)})})),await Promise.race(tx),tv)throw Error(`WebAssembly backend initializing failed due to timeout: ${tn}ms`)},tn.getInstance=()=>{if(td&&tf)return tf;throw Error("WebAssembly is not initialized yet.")},tn.dispose=()=>{var tr;!td||th||tg||(th=!0,null===(tr=tf.PThread)||void 0===tr||tr.terminateAllThreads(),tf=void 0,th=!1,td=!1,tg=!0)}},9710:(tr,tn,ti)=>{"use strict";ti.d(tn,{Z:()=>o});var to=ti(477),ta=ti.n(to);function o(){return ta()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%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"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&>(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;azt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(_||0{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%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"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){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"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){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 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;tp.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;tt*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(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(t){return!1}})(),o=a&&(()=>{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(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:tr=>{"use strict";tr.exports=function(tr,tn,ti,to){var ta=self||window;try{try{try{ts=new ta.Blob([tr])}catch(tn){(ts=new(ta.BlobBuilder||ta.WebKitBlobBuilder||ta.MozBlobBuilder||ta.MSBlobBuilder)).append(tr),ts=ts.getBlob()}var ts,tu=ta.URL||ta.webkitURL,tl=tu.createObjectURL(ts),tc=new ta[tn](tl,ti);return tu.revokeObjectURL(tl),tc}catch(to){return new ta[tn]("data:application/javascript,".concat(encodeURIComponent(tr)),ti)}}catch(tr){if(!to)throw Error("Inline worker is not supported");return new ta[tn](to,ti)}}},4154:tr=>{"use strict";tr.exports='"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\n'},1670:tr=>{"use strict";tr.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(tr,tn,ti)=>{"use strict";ti.r(tn),ti.d(tn,{flatbuffers:()=>to});var to={};to.Offset,to.Table,to.SIZEOF_SHORT=2,to.SIZEOF_INT=4,to.FILE_IDENTIFIER_LENGTH=4,to.SIZE_PREFIX_LENGTH=4,to.Encoding={UTF8_BYTES:1,UTF16_STRING:2},to.int32=new Int32Array(2),to.float32=new Float32Array(to.int32.buffer),to.float64=new Float64Array(to.int32.buffer),to.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],to.Long=function(tr,tn){this.low=0|tr,this.high=0|tn},to.Long.create=function(tr,tn){return 0==tr&&0==tn?to.Long.ZERO:new to.Long(tr,tn)},to.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},to.Long.prototype.equals=function(tr){return this.low==tr.low&&this.high==tr.high},to.Long.ZERO=new to.Long(0,0),to.Builder=function(tr){if(tr)tn=tr;else var tn=1024;this.bb=to.ByteBuffer.allocate(tn),this.space=tn,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},to.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},to.Builder.prototype.forceDefaults=function(tr){this.force_defaults=tr},to.Builder.prototype.dataBuffer=function(){return this.bb},to.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},to.Builder.prototype.prep=function(tr,tn){tr>this.minalign&&(this.minalign=tr);for(var ti=1+~(this.bb.capacity()-this.space+tn)&tr-1;this.space=0&&0==this.vtable[tn];tn--);for(var ti=tn+1;tn>=0;tn--)this.addInt16(0!=this.vtable[tn]?tr-this.vtable[tn]:0);this.addInt16(tr-this.object_start);var ta=(ti+2)*to.SIZEOF_SHORT;this.addInt16(ta);var ts=0,tu=this.space;t:for(tn=0;tn=0;tu--)this.writeInt8(ts.charCodeAt(tu))}this.prep(this.minalign,to.SIZEOF_INT+ta),this.addOffset(tr),ta&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},to.Builder.prototype.finishSizePrefixed=function(tr,tn){this.finish(tr,tn,!0)},to.Builder.prototype.requiredField=function(tr,tn){var ti=this.bb.capacity()-tr,to=ti-this.bb.readInt32(ti);if(0==this.bb.readInt16(to+tn))throw Error("FlatBuffers: field "+tn+" must be set")},to.Builder.prototype.startVector=function(tr,tn,ti){this.notNested(),this.vector_num_elems=tn,this.prep(to.SIZEOF_INT,tr*tn),this.prep(ti,tr*tn)},to.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},to.Builder.prototype.createString=function(tr){if(tr instanceof Uint8Array)var tn=tr;else{tn=[];for(var ti=0;ti=56320?ta:(ta<<10)+tr.charCodeAt(ti++)+-56613888)<128?tn.push(to):(to<2048?tn.push(to>>6&31|192):(to<65536?tn.push(to>>12&15|224):tn.push(to>>18&7|240,to>>12&63|128),tn.push(to>>6&63|128)),tn.push(63&to|128))}}this.addInt8(0),this.startVector(1,tn.length,1),this.bb.setPosition(this.space-=tn.length),ti=0;for(var ts=this.space,tu=this.bb.bytes();ti>24},to.ByteBuffer.prototype.readUint8=function(tr){return this.bytes_[tr]},to.ByteBuffer.prototype.readInt16=function(tr){return this.readUint16(tr)<<16>>16},to.ByteBuffer.prototype.readUint16=function(tr){return this.bytes_[tr]|this.bytes_[tr+1]<<8},to.ByteBuffer.prototype.readInt32=function(tr){return this.bytes_[tr]|this.bytes_[tr+1]<<8|this.bytes_[tr+2]<<16|this.bytes_[tr+3]<<24},to.ByteBuffer.prototype.readUint32=function(tr){return this.readInt32(tr)>>>0},to.ByteBuffer.prototype.readInt64=function(tr){return new to.Long(this.readInt32(tr),this.readInt32(tr+4))},to.ByteBuffer.prototype.readUint64=function(tr){return new to.Long(this.readUint32(tr),this.readUint32(tr+4))},to.ByteBuffer.prototype.readFloat32=function(tr){return to.int32[0]=this.readInt32(tr),to.float32[0]},to.ByteBuffer.prototype.readFloat64=function(tr){return to.int32[to.isLittleEndian?0:1]=this.readInt32(tr),to.int32[to.isLittleEndian?1:0]=this.readInt32(tr+4),to.float64[0]},to.ByteBuffer.prototype.writeInt8=function(tr,tn){this.bytes_[tr]=tn},to.ByteBuffer.prototype.writeUint8=function(tr,tn){this.bytes_[tr]=tn},to.ByteBuffer.prototype.writeInt16=function(tr,tn){this.bytes_[tr]=tn,this.bytes_[tr+1]=tn>>8},to.ByteBuffer.prototype.writeUint16=function(tr,tn){this.bytes_[tr]=tn,this.bytes_[tr+1]=tn>>8},to.ByteBuffer.prototype.writeInt32=function(tr,tn){this.bytes_[tr]=tn,this.bytes_[tr+1]=tn>>8,this.bytes_[tr+2]=tn>>16,this.bytes_[tr+3]=tn>>24},to.ByteBuffer.prototype.writeUint32=function(tr,tn){this.bytes_[tr]=tn,this.bytes_[tr+1]=tn>>8,this.bytes_[tr+2]=tn>>16,this.bytes_[tr+3]=tn>>24},to.ByteBuffer.prototype.writeInt64=function(tr,tn){this.writeInt32(tr,tn.low),this.writeInt32(tr+4,tn.high)},to.ByteBuffer.prototype.writeUint64=function(tr,tn){this.writeUint32(tr,tn.low),this.writeUint32(tr+4,tn.high)},to.ByteBuffer.prototype.writeFloat32=function(tr,tn){to.float32[0]=tn,this.writeInt32(tr,to.int32[0])},to.ByteBuffer.prototype.writeFloat64=function(tr,tn){to.float64[0]=tn,this.writeInt32(tr,to.int32[to.isLittleEndian?0:1]),this.writeInt32(tr+4,to.int32[to.isLittleEndian?1:0])},to.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&tu)))}return ta},to.ByteBuffer.prototype.__indirect=function(tr){return tr+this.readInt32(tr)},to.ByteBuffer.prototype.__vector=function(tr){return tr+this.readInt32(tr)+to.SIZEOF_INT},to.ByteBuffer.prototype.__vector_len=function(tr){return this.readInt32(tr+this.readInt32(tr))},to.ByteBuffer.prototype.__has_identifier=function(tr){if(tr.length!=to.FILE_IDENTIFIER_LENGTH)throw Error("FlatBuffers: file identifier must be length "+to.FILE_IDENTIFIER_LENGTH);for(var tn=0;tn{var tn=tr&&tr.__esModule?()=>tr.default:()=>tr;return __nested_webpack_require_546802__.d(tn,{a:tn}),tn},__nested_webpack_require_546802__.d=(tr,tn)=>{for(var ti in tn)__nested_webpack_require_546802__.o(tn,ti)&&!__nested_webpack_require_546802__.o(tr,ti)&&Object.defineProperty(tr,ti,{enumerable:!0,get:tn[ti]})},__nested_webpack_require_546802__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(tr){if("object"==typeof window)return window}}(),__nested_webpack_require_546802__.o=(tr,tn)=>Object.prototype.hasOwnProperty.call(tr,tn),__nested_webpack_require_546802__.r=tr=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(tr,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(tr,"__esModule",{value:!0})};var __nested_webpack_exports__=__nested_webpack_require_546802__(6018);return __nested_webpack_exports__})())}}]);