vendor: 25,749 bytes, line 1
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1015],{52895:function(module,__unused_webpack_exports,__webpack_require__){var process=__webpack_require__(40257);!function(t,e){module.exports=e(__webpack_require__(12250))}(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(t,e,r)=>{var n,i=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return k.buffer!=F&&W(k.buffer),N}function i(){return k.buffer!=F&&W(k.buffer),L}function o(){return k.buffer!=F&&W(k.buffer),R}function a(){return k.buffer!=F&&W(k.buffer),j}function s(){return k.buffer!=F&&W(k.buffer),M}t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise(function(t,e){l=t,c=e});var u,l,c,p,f,d,h,g,b,m=Object.assign({},u),y="./this.program",_=(t,e)=>{throw e},v="object"==typeof window,x="function"==typeof importScripts,w="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,T=u.ENVIRONMENT_IS_PTHREAD||!1,S="";function O(t){return u.locateFile?u.locateFile(t,S):S+t}if(w){let t;S=x?r(908).dirname(S)+"/":"//",b=()=>{g||(h=r(1384),g=r(908))},p=function(t,e){return b(),t=g.normalize(t),h.readFileSync(t,e?void 0:"utf8")},d=t=>((t=p(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,r)=>{b(),t=g.normalize(t),h.readFile(t,function(t,n){t?r(t):e(n.buffer)})},1<process.argv.length&&(y=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(t){if(!(t instanceof tl))throw t}),process.on("unhandledRejection",function(t){throw t}),_=(t,e)=>{if(Q())throw process.exitCode=t,e;e instanceof tl||D("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{t=r(9925)}catch(t){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),t}r.g.Worker=t.Worker}else(v||x)&&(x?S=self.location.href:"undefined"!=typeof document&&document.currentScript&&(S=document.currentScript.src),n&&(S=n),S=0!==S.indexOf("blob:")?S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1):"",w||(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},x&&(d=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)}));w&&"undefined"==typeof performance&&(r.g.performance=r(6953).performance);var A=console.log.bind(console),E=console.warn.bind(console);w&&(b(),A=t=>h.writeSync(1,t+"\n"),E=t=>h.writeSync(2,t+"\n"));var I,P=u.print||A,D=u.printErr||E;Object.assign(u,m),m=null,u.thisProgram&&(y=u.thisProgram),u.quit&&(_=u.quit),u.wasmBinary&&(I=u.wasmBinary);var $=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&to("no native wasm support detected");var k,C,F,N,L,R,j,M,U=!1,V="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function B(t,e,r){var n=(e>>>=0)+r;for(r=e;t[r]&&!(r>=n);)++r;if(16<r-e&&t.buffer&&V)return V.decode(t.buffer instanceof SharedArrayBuffer?t.slice(e,r):t.subarray(e,r));for(n="";e<r;){var i=t[e++];if(128&i){var o=63&t[e++];if(192==(224&i))n+=String.fromCharCode((31&i)<<6|o);else{var a=63&t[e++];65536>(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else n+=String.fromCharCode(i)}return n}function z(t,e){return(t>>>=0)?B(i(),t,e):""}function G(t,e,r,n){if(!(0<n))return 0;var i=r>>>=0;n=r+n-1;for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o)),127>=a){if(r>=n)break;e[r++>>>0]=a}else{if(2047>=a){if(r+1>=n)break;e[r++>>>0]=192|a>>6}else{if(65535>=a){if(r+2>=n)break;e[r++>>>0]=224|a>>12}else{if(r+3>=n)break;e[r++>>>0]=240|a>>18,e[r++>>>0]=128|a>>12&63}e[r++>>>0]=128|a>>6&63}e[r++>>>0]=128|63&a}}return e[r>>>0]=0,r-i}function H(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);127>=n?e++:2047>=n?e+=2:55296<=n&&57343>=n?(e+=4,++r):e+=3}return e}function W(t){F=t,u.HEAP8=N=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=R=new Int32Array(t),u.HEAPU8=L=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=j=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=M=new Float64Array(t)}T&&(F=u.buffer);var q=u.INITIAL_MEMORY||16777216;if(T)k=u.wasmMemory,F=u.buffer;else if(u.wasmMemory)k=u.wasmMemory;else if(!((k=new WebAssembly.Memory({initial:q/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw D("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"),w&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");k&&(F=k.buffer),q=F.byteLength,W(F);var X,Y=[],K=[],Z=[],J=[];function Q(){return $||!1}function tt(){var t=u.preRun.shift();Y.unshift(t)}var te,tr=0,tn=null,ti=null;function to(t){throw T?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),D(t="Aborted("+t+")"),U=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),c(t),t}function ta(){return te.startsWith("data:application/octet-stream;base64,")}function ts(){var t=te;try{if(t==te&&I)return new Uint8Array(I);if(d)return d(t);throw"both async and sync fetching of the wasm failed"}catch(t){to(t)}}te="ort-wasm-threaded.wasm",ta()||(te=O(te));var tu={};function tl(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function tc(t){(t=th.Vb[t])||to(),th.mc(t)}function tp(t){var e=th.Cc();if(!e)return 6;th.ac.push(e),th.Vb[t.Ub]=e,e.Ub=t.Ub;var r={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{r.time=performance.now(),e.postMessage(r,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function tf(t){if(T)return tX(1,1,t);Q()||(th.oc(),u.onExit&&u.onExit(t),U=!0),_(t,new tl(t))}function td(t,e){if(!e&&T)throw tm(t),"unwind";Q()||T||(eu(),tg(Z),es(0),t4[1].length&&t6(1,10),t4[2].length&&t6(2,10),th.oc()),tf(t)}var th={Yb:[],ac:[],qc:[],Vb:{},fc:function(){T&&th.Ec()},Pc:function(){},Ec:function(){th.receiveObjectTransfer=th.Gc,th.threadInitTLS=th.pc,th.setExitStatus=th.nc,$=!1},nc:function(){},oc:function(){for(var t of Object.values(th.Vb))th.mc(t);for(t of th.Yb)t.terminate();th.Yb=[]},mc:function(t){var e=t.Ub;delete th.Vb[e],th.Yb.push(t),th.ac.splice(th.ac.indexOf(t),1),t.Ub=0,ed(e)},Gc:function(){},pc:function(){th.qc.forEach(t=>t())},Fc:function(t,e){t.onmessage=r=>{var n=(r=r.data).cmd;if(t.Ub&&(th.Bc=t.Ub),r.targetThread&&r.targetThread!=ei()){var i=th.Vb[r.Qc];i?i.postMessage(r,r.transferList):D('Internal error! Worker sent a message "'+n+'" to target pthread '+r.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===n?tB(r.queue):"spawnThread"===n?tp(r):"cleanupThread"===n?tc(r.thread):"killThread"===n?(r=r.thread,n=th.Vb[r],delete th.Vb[r],n.terminate(),ed(r),th.ac.splice(th.ac.indexOf(n),1),n.Ub=0):"cancelThread"===n?th.Vb[r.thread].postMessage({cmd:"cancel"}):"loaded"===n?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===n?P("Thread "+r.threadId+": "+r.text):"printErr"===n?D("Thread "+r.threadId+": "+r.text):"alert"===n?alert("Thread "+r.threadId+": "+r.text):"setimmediate"===r.target?t.postMessage(r):"onAbort"===n?u.onAbort&&u.onAbort(r.arg):n&&D("worker sent an unknown command "+n);th.Bc=void 0},t.onerror=t=>{throw D("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},w&&(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||n,wasmMemory:k,wasmModule:C})},yc:function(){var t=O("ort-wasm-threaded.worker.js");th.Yb.push(new Worker(t))},Cc:function(){return 0==th.Yb.length&&(th.yc(),th.Fc(th.Yb[0])),th.Yb.pop()}};function tg(t){for(;0<t.length;)t.shift()(u)}function tb(t){var e=em();return t=t(),ey(e),t}function tm(t){if(T)return tX(2,0,t);try{td(t)}catch(t){t instanceof tl||"unwind"==t||_(1,t)}}u.PThread=th,u.establishStackSpace=function(){var t=ei(),e=o()[t+44>>2>>>0];t=o()[t+48>>2>>>0],eb(e,e-t),ey(e)};var ty=[];function t_(t){var e=ty[t];return e||(t>=ty.length&&(ty.length=t+1),ty[t]=e=X.get(t)),e}u.invokeEntryPoint=function(t,e){t=t_(t)(e),Q()?th.nc(t):eh(t)};var tv,tx,tw=[],tT=0,tS=0;function tO(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){a()[this.Sb+4>>2>>>0]=t},this.bc=function(){return a()[this.Sb+4>>2>>>0]},this.wc=function(t){a()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return a()[this.Sb+8>>2>>>0]},this.rc=function(){o()[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(o(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(o(),this.Sb>>2,1)},this.cc=function(t){a()[this.Sb+16>>2>>>0]=t},this.tc=function(){return a()[this.Sb+16>>2>>>0]},this.vc=function(){if(ex(this.bc()))return a()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function tA(t){return ea(new tO(t).Sb)}function tE(t,e,r,n){return T?tX(3,1,t,e,r,n):tI(t,e,r,n)}function tI(t,e,r,n){if("undefined"==typeof SharedArrayBuffer)return D("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var i=[];return T&&0===i.length?tE(t,e,r,n):(t={Ic:r,Ub:t,zc:n,Nc:i},T?(t.Oc="spawnThread",postMessage(t,i),0):tp(t))}function tP(t,e,r){return T?tX(4,1,t,e,r):0}function tD(t,e){if(T)return tX(5,1,t,e)}function t$(t,e){if(T)return tX(6,1,t,e)}function tk(t,e,r){if(T)return tX(7,1,t,e,r)}function tC(t,e,r){return T?tX(8,1,t,e,r):0}function tF(t,e){if(T)return tX(9,1,t,e)}function tN(t,e,r){if(T)return tX(10,1,t,e,r)}function tL(t,e,r,n){if(T)return tX(11,1,t,e,r,n)}function tR(t,e,r,n){if(T)return tX(12,1,t,e,r,n)}function tj(t,e,r,n){if(T)return tX(13,1,t,e,r,n)}function tM(t){if(T)return tX(14,1,t)}function tU(t,e){if(T)return tX(15,1,t,e)}function tV(t,e,r){if(T)return tX(16,1,t,e,r)}function tB(t){Atomics.store(o(),t>>2,1),ei()&&ef(t),Atomics.compareExchange(o(),t>>2,1,0)}function tz(t){return a()[t>>>2]+4294967296*o()[t+4>>>2]}function tG(t,e,r,n,i,o){return T?tX(17,1,t,e,r,n,i,o):-52}function tH(t,e,r,n,i,o){if(T)return tX(18,1,t,e,r,n,i,o)}function tW(t){var r=H(t)+1,n=eo(r);return n&&G(t,e(),n,r),n}function tq(t,e,r){function n(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}if(T)return tX(19,1,t,e,r);var i=(new Date).getFullYear(),s=new Date(i,0,1),u=new Date(i,6,1);i=s.getTimezoneOffset();var l=u.getTimezoneOffset(),c=Math.max(i,l);o()[t>>2>>>0]=60*c,o()[e>>2>>>0]=Number(i!=l),t=n(s),e=n(u),t=tW(t),e=tW(e),l<i?(a()[r>>2>>>0]=t,a()[r+4>>2>>>0]=e):(a()[r>>2>>>0]=e,a()[r+4>>2>>>0]=t)}function tX(t,e){var r=arguments.length-2,n=arguments;return tb(()=>{for(var i=e_(8*r),o=i>>3,a=0;a<r;a++){var u=n[2+a];s()[o+a>>>0]=u}return ep(t,r,i,e)})}u.executeNotifiedProxyingQueue=tB,tx=w?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:T?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var tY,tK=[],tZ={};function tJ(){if(!tY){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",_:y||"./this.program"};for(t in tZ)void 0===tZ[t]?delete e[t]:e[t]=tZ[t];var r=[];for(t in e)r.push(t+"="+e[t]);tY=r}return tY}function tQ(t,r){if(T)return tX(20,1,t,r);var n=0;return tJ().forEach(function(i,o){var s=r+n;for(o=a()[t+4*o>>2>>>0]=s,s=0;s<i.length;++s)e()[o++>>0>>>0]=i.charCodeAt(s);e()[o>>0>>>0]=0,n+=i.length+1}),0}function t0(t,e){if(T)return tX(21,1,t,e);var r=tJ();a()[t>>2>>>0]=r.length;var n=0;return r.forEach(function(t){n+=t.length+1}),a()[e>>2>>>0]=n,0}function t1(t){return T?tX(22,1,t):52}function t2(t,e,r,n){return T?tX(23,1,t,e,r,n):52}function t3(t,e,r,n,i){return T?tX(24,1,t,e,r,n,i):70}var t4=[null,[],[]];function t6(t,e){var r=t4[t];0===e||10===e?((1===t?P:D)(B(r,0)),r.length=0):r.push(e)}function t8(t,e,r,n){if(T)return tX(25,1,t,e,r,n);for(var o=0,s=0;s<r;s++){var u=a()[e>>2>>>0],l=a()[e+4>>2>>>0];e+=8;for(var c=0;c<l;c++)t6(t,i()[u+c>>>0]);o+=l}return a()[n>>2>>>0]=o,0}var t5=0;function t7(t){return 0==t%4&&(0!=t%100||0==t%400)}var t9=[31,29,31,30,31,30,31,31,30,31,30,31],et=[31,28,31,30,31,30,31,31,30,31,30,31];function ee(t,r,n,i){function a(t,e,r){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=r[0]+t;return t}function s(t,e){return a(t,e,"0")}function u(t,e){var r;function n(t){return 0>t?-1:0<t?1:0}return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function l(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function c(t){var e=t.Wb;for(t=new Date(new Date(t.Xb+1900,0,1).getTime());0<e;){var r=t.getMonth(),n=(t7(t.getFullYear())?t9:et)[r];if(!(e>n-t.getDate())){t.setDate(t.getDate()+e);break}e-=n-t.getDate()+1,t.setDate(1),11>r?t.setMonth(r+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return r=new Date(t.getFullYear()+1,0,4),e=l(new Date(t.getFullYear(),0,4)),r=l(r),0>=u(e,t)?0>=u(r,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var p=o()[i+40>>2>>>0];for(var f in i={Lc:o()[i>>2>>>0],Kc:o()[i+4>>2>>>0],dc:o()[i+8>>2>>>0],jc:o()[i+12>>2>>>0],ec:o()[i+16>>2>>>0],Xb:o()[i+20>>2>>>0],Tb:o()[i+24>>2>>>0],Wb:o()[i+28>>2>>>0],Rc:o()[i+32>>2>>>0],Jc:o()[i+36>>2>>>0],Mc:p?z(p):""},n=z(n),p={"%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(RegExp(f,"g"),p[f]);var d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),h="January February March April May June July August September October November December".split(" ");for(f in p={"%a":function(t){return d[t.Tb].substring(0,3)},"%A":function(t){return d[t.Tb]},"%b":function(t){return h[t.ec].substring(0,3)},"%B":function(t){return h[t.ec]},"%C":function(t){return s((t.Xb+1900)/100|0,2)},"%d":function(t){return s(t.jc,2)},"%e":function(t){return a(t.jc,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return s(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12<t&&(t-=12),s(t,2)},"%j":function(t){for(var e=0,r=0;r<=t.ec-1;e+=(t7(t.Xb+1900)?t9:et)[r++]);return s(t.jc+e,3)},"%m":function(t){return s(t.ec+1,2)},"%M":function(t){return s(t.Kc,2)},"%n":function(){return"\n"},"%p":function(t){return 0<=t.dc&&12>t.dc?"AM":"PM"},"%S":function(t){return s(t.Lc,2)},"%t":function(){return" "},"%u":function(t){return t.Tb||7},"%U":function(t){return s(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==(r=(t.Tb+371-t.Wb)%7)||3==r&&t7(t.Xb)||(e=1));else{e=52;var r=(t.Tb+7-t.Wb-1)%7;(4==r||5==r&&t7(t.Xb%400-1))&&e++}return s(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return s(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(e?"+":"-")+String("0000"+((t=Math.abs(t)/60)/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),p)n.includes(f)&&(n=n.replace(RegExp(f,"g"),p[f](i)));return(f=function(t){var e=Array(H(t)+1);return G(t,e,0,e.length),e}(n=n.replace(/\0\0/g,"%"))).length>r?0:(function(t,r){e().set(t,r>>>0)}(f,t),f.length-1)}th.fc();var er=[null,tf,tm,tE,tP,tD,t$,tk,tC,tF,tN,tL,tR,tj,tM,tU,tV,tG,tH,tq,tQ,t0,t1,t2,t3,t8],en={b:function(t){return eo(t+24)+24},n:function(t){return(t=new tO(t)).uc()||(t.hc(!0),tT--),t.ic(!1),tw.push(t),t.sc(),t.vc()},ma:function(t){throw D("Unexpected exception thrown, this is not properly supported - aborting"),U=!0,t},x:function(){eg(0);var t=tw.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&&t_(e)(t.Zb),tA(t.Zb)}tS=0},e:function(){var t=tS;if(!t)return t5=0;var e=new tO(t);e.cc(t);var r=e.bc();if(!r)return t5=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;i<n.length;i++){var o=n[i];if(0===o||o===r)break;if(ev(o,r,e.Sb+16))return t5=o,t}return t5=r,t},l:function(){var t=tS;if(!t)return t5=0;var e=new tO(t);e.cc(t);var r=e.bc();if(!r)return t5=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;i<n.length;i++){var o=n[i];if(0===o||o===r)break;if(ev(o,r,e.Sb+16))return t5=o,t}return t5=r,t},h:function(){var t=tS;if(!t)return t5=0;var e=new tO(t);e.cc(t);var r=e.bc();if(!r)return t5=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;i<n.length;i++){var o=n[i];if(0===o||o===r)break;if(ev(o,r,e.Sb+16))return t5=o,t}return t5=r,t},t:tA,M:function(){var t=tw.pop();t||to("no exception to throw");var e=t.Zb;throw t.kc()||(tw.push(t),t.ic(!0),t.hc(!1),tT++),tS=e,e},c:function(t,e,r){throw new tO(t).fc(e,r),tS=t,tT++,t},pa:function(){return tT},Fa:function(t){el(t,!x,1,!v),th.pc()},T:function(t){T?postMessage({cmd:"cleanupThread",thread:t}):tc(t)},xa:tI,j:function(t){throw tS||(tS=t),t},H:tP,Ma:tD,ua:t$,wa:tk,oa:tC,Ka:tF,Ca:tN,Ja:tL,V:tR,va:tj,sa:tM,La:tU,ta:tV,Ta:function(){},X:function(){to("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ua:function(){to("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},W:function(){return Date.now()},ya:function(){return 2097152},Oa:function(){return!0},za:function(t,e,r,n){if(t==e)setTimeout(()=>tB(n));else if(T)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:n});else{if(!(t=th.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:n})}return 1},Ea:function(){return -1},Pa:function(t,e){t=new Date(1e3*tz(t)),o()[e>>2>>>0]=t.getUTCSeconds(),o()[e+4>>2>>>0]=t.getUTCMinutes(),o()[e+8>>2>>>0]=t.getUTCHours(),o()[e+12>>2>>>0]=t.getUTCDate(),o()[e+16>>2>>>0]=t.getUTCMonth(),o()[e+20>>2>>>0]=t.getUTCFullYear()-1900,o()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,o()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*tz(t)),o()[e>>2>>>0]=t.getSeconds(),o()[e+4>>2>>>0]=t.getMinutes(),o()[e+8>>2>>>0]=t.getHours(),o()[e+12>>2>>>0]=t.getDate(),o()[e+16>>2>>>0]=t.getMonth(),o()[e+20>>2>>>0]=t.getFullYear()-1900,o()[e+24>>2>>>0]=t.getDay();var r=new Date(t.getFullYear(),0,1),n=(t.getTime()-r.getTime())/864e5|0;o()[e+28>>2>>>0]=n,o()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),t=0|((n=new Date(t.getFullYear(),6,1).getTimezoneOffset())!=(r=r.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(r,n)),o()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(o()[t+20>>2>>>0]+1900,o()[t+16>>2>>>0],o()[t+12>>2>>>0],o()[t+8>>2>>>0],o()[t+4>>2>>>0],o()[t>>2>>>0],0),r=o()[t+32>>2>>>0],n=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),u=Math.min(s,a);return 0>r?o()[t+32>>2>>>0]=Number(a!=s&&u==n):0<r!=(u==n)&&(a=Math.max(s,a),e.setTime(e.getTime()+6e4*((0<r?u:a)-n))),o()[t+24>>2>>>0]=e.getDay(),r=(e.getTime()-i.getTime())/864e5|0,o()[t+28>>2>>>0]=r,o()[t>>2>>>0]=e.getSeconds(),o()[t+4>>2>>>0]=e.getMinutes(),o()[t+8>>2>>>0]=e.getHours(),o()[t+12>>2>>>0]=e.getDate(),o()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:tG,Ba:tH,Sa:function t(e,r,n){t.Ac||(t.Ac=!0,tq(e,r,n))},y:function(){to("")},U:function(){if(!w&&!x){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";tv||(tv={}),tv[t]||(tv[t]=1,w&&(t="warning: "+t),D(t))}},ra:function(){return 4294901760},B:tx,Ia:function(t,e,r){i().copyWithin(t>>>0,e>>>0,e+r>>>0)},F:function(){return w?r(3993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,r){tK.length=e,r>>=3;for(var n=0;n<e;n++)tK[n]=s()[r+n>>>0];return(0>t?tu[-t-1]:er[t]).apply(null,tK)},qa:function(t){var e=i().length;if((t>>>=0)<=e||4294901760<t)return!1;for(var r=1;4>=r;r*=2){var n=e*(1+.2/r);n=Math.min(n,t+100663296);var o=Math;n=Math.max(t,n),o=o.min.call(o,4294901760,n+(65536-n%65536)%65536);t:{try{k.grow(o-F.byteLength+65535>>>16),W(k.buffer);var a=1;break t}catch(t){}a=void 0}if(a)return!0}return!1},Na:function(){throw"unwind"},Ga:tQ,Ha:t0,J:td,I:t1,S:t2,ga:t3,R:t8,d:function(){return t5},na:function t(n,i){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(w)try{var e=r(Object(function(){var t=Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>to("randomDevice")}());for(var o=0;o<i;o++)e()[n+o>>0>>>0]=t.lc();return 0},ia:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},ja:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},K:function(t){var e=em();try{return t_(t)()}catch(t){if(ey(e),t!==t+0)throw t;eg(1,0)}},f:function(t,e){var r=em();try{return t_(t)(e)}catch(t){if(ey(r),t!==t+0)throw t;eg(1,0)}},P:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},Q:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},k:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},p:function(t,e,r,n){var i=em();try{return t_(t)(e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},q:function(t,e,r,n,i){var o=em();try{return t_(t)(e,r,n,i)}catch(t){if(ey(o),t!==t+0)throw t;eg(1,0)}},N:function(t,e,r,n,i,o){var a=em();try{return t_(t)(e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},s:function(t,e,r,n,i,o){var a=em();try{return t_(t)(e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},w:function(t,e,r,n,i,o,a){var s=em();try{return t_(t)(e,r,n,i,o,a)}catch(t){if(ey(s),t!==t+0)throw t;eg(1,0)}},L:function(t,e,r,n,i,o,a,s){var u=em();try{return t_(t)(e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},E:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=em();try{return t_(t)(e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(ey(f),t!==t+0)throw t;eg(1,0)}},aa:function(t,e,r,n,i,o,a,s){var u=em();try{return eD(t,e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},_:function(t,e,r,n,i,o,a){var s=em();try{return eT(t,e,r,n,i,o,a)}catch(t){if(ey(s),t!==t+0)throw t;eg(1,0)}},Z:function(t,e,r,n,i){var o=em();try{return e$(t,e,r,n,i)}catch(t){if(ey(o),t!==t+0)throw t;eg(1,0)}},ca:function(t,e,r,n){var i=em();try{return eI(t,e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},$:function(t){var e=em();try{return ew(t)}catch(t){if(ey(e),t!==t+0)throw t;eg(1,0)}},ba:function(t,e){var r=em();try{return eP(t,e)}catch(t){if(ey(r),t!==t+0)throw t;eg(1,0)}},Y:function(t,e,r){var n=em();try{return eS(t,e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},g:function(t){var e=em();try{t_(t)()}catch(t){if(ey(e),t!==t+0)throw t;eg(1,0)}},r:function(t,e){var r=em();try{t_(t)(e)}catch(t){if(ey(r),t!==t+0)throw t;eg(1,0)}},i:function(t,e,r){var n=em();try{t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},ha:function(t,e,r,n){var i=em();try{t_(t)(e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},m:function(t,e,r,n){var i=em();try{t_(t)(e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},v:function(t,e,r,n,i){var o=em();try{t_(t)(e,r,n,i)}catch(t){if(ey(o),t!==t+0)throw t;eg(1,0)}},u:function(t,e,r,n,i,o){var a=em();try{t_(t)(e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},O:function(t,e,r,n,i,o,a){var s=em();try{t_(t)(e,r,n,i,o,a)}catch(t){if(ey(s),t!==t+0)throw t;eg(1,0)}},A:function(t,e,r,n,i,o,a,s){var u=em();try{t_(t)(e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},ka:function(t,e,r,n,i,o,a,s,u){var l=em();try{t_(t)(e,r,n,i,o,a,s,u)}catch(t){if(ey(l),t!==t+0)throw t;eg(1,0)}},C:function(t,e,r,n,i,o,a,s,u,l,c){var p=em();try{t_(t)(e,r,n,i,o,a,s,u,l,c)}catch(t){if(ey(p),t!==t+0)throw t;eg(1,0)}},D:function(t,e,r,n,i,o,a,s,u,l,c,p,f,d,h,g){var b=em();try{t_(t)(e,r,n,i,o,a,s,u,l,c,p,f,d,h,g)}catch(t){if(ey(b),t!==t+0)throw t;eg(1,0)}},fa:function(t,e,r,n,i,o,a,s){var u=em();try{eO(t,e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},da:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=em();try{eE(t,e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(ey(f),t!==t+0)throw t;eg(1,0)}},ea:function(t,e,r,n,i,o){var a=em();try{eA(t,e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},o:function(t){return t},a:k||u.wasmMemory,G:function(t){t5=t},la:ee,z:function(t,e,r,n){return ee(t,e,r,n)}};(function(){function t(t,e){u.asm=t.exports,th.qc.push(u.asm.sb),X=u.asm.ub,K.unshift(u.asm.Va),C=e,T||(tr--,u.monitorRunDependencies&&u.monitorRunDependencies(tr),0==tr&&(null!==tn&&(clearInterval(tn),tn=null),ti&&(t=ti,ti=null,t())))}function e(e){t(e.instance,e.module)}
1function r(t){return(function(){if(!I&&(v||x)){if("function"==typeof fetch&&!te.startsWith("file://"))return fetch(te,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw"failed to load wasm binary file at '"+te+"'";return t.arrayBuffer()}).catch(function(){return ts()});if(f)return new Promise(function(t,e){f(te,function(e){t(new Uint8Array(e))},e)})}return Promise.resolve().then(function(){return ts()})})().then(function(t){return WebAssembly.instantiate(t,n)}).then(function(t){return t}).then(t,function(t){D("failed to asynchronously prepare wasm: "+t),to(t)})}var n={a:en};if(T||(tr++,u.monitorRunDependencies&&u.monitorRunDependencies(tr)),u.instantiateWasm)try{return u.instantiateWasm(n,t)}catch(t){return D("Module.instantiateWasm callback failed with error: "+t),!1}(I||"function"!=typeof WebAssembly.instantiateStreaming||ta()||te.startsWith("file://")||w||"function"!=typeof fetch?r(e):fetch(te,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,n).then(e,function(t){return D("wasm streaming compile failed: "+t),D("falling back to ArrayBuffer instantiation"),r(e)})})).catch(c)})(),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 ei=u._pthread_self=function(){return(ei=u._pthread_self=u.asm.ob).apply(null,arguments)},eo=u._malloc=function(){return(eo=u._malloc=u.asm.pb).apply(null,arguments)},ea=u._free=function(){return(ea=u._free=u.asm.qb).apply(null,arguments)},es=u._fflush=function(){return(es=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 eu=u.___funcs_on_exit=function(){return(eu=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},el=u.__emscripten_thread_init=function(){return(el=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 ec,ep=u._emscripten_run_in_main_runtime_thread_js=function(){return(ep=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},ef=u.__emscripten_proxy_execute_task_queue=function(){return(ef=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},ed=u.__emscripten_thread_free_data=function(){return(ed=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},eh=u.__emscripten_thread_exit=function(){return(eh=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},eg=u._setThrew=function(){return(eg=u._setThrew=u.asm.Bb).apply(null,arguments)},eb=u._emscripten_stack_set_limits=function(){return(eb=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},em=u.stackSave=function(){return(em=u.stackSave=u.asm.Db).apply(null,arguments)},ey=u.stackRestore=function(){return(ey=u.stackRestore=u.asm.Eb).apply(null,arguments)},e_=u.stackAlloc=function(){return(e_=u.stackAlloc=u.asm.Fb).apply(null,arguments)},ev=u.___cxa_can_catch=function(){return(ev=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},ex=u.___cxa_is_pointer_type=function(){return(ex=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},ew=u.dynCall_j=function(){return(ew=u.dynCall_j=u.asm.Ib).apply(null,arguments)},eT=u.dynCall_iiiiij=function(){return(eT=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},eS=u.dynCall_jii=function(){return(eS=u.dynCall_jii=u.asm.Kb).apply(null,arguments)}
vendor: 19,059 bytes, line 1
1,eO=u.dynCall_viiiiij=function(){return(eO=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},eA=u.dynCall_vjji=function(){return(eA=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},eE=u.dynCall_viiijjjii=function(){return(eE=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},eI=u.dynCall_iij=function(){return(eI=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},eP=u.dynCall_ji=function(){return(eP=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},eD=u.dynCall_iiiiiij=function(){return(eD=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},e$=u.dynCall_iiij=function(){return(e$=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ek(){function t(){if(!ec&&(ec=!0,u.calledRun=!0,!U)&&(T||tg(K),l(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!T)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();J.unshift(t)}tg(J)}}if(!(0<tr)){if(T)l(u),T||tg(K),postMessage({cmd:"loaded"});else{if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)tt();tg(Y),0<tr||(u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),t()},1)):t())}}}if(u.UTF8ToString=z,u.stringToUTF8=function(t,e,r){return G(t,i(),e,r)},u.lengthBytesUTF8=H,u.keepRuntimeAlive=Q,u.wasmMemory=k,u.stackSave=em,u.stackRestore=ey,u.stackAlloc=e_,u.ExitStatus=tl,u.PThread=th,ti=function t(){ec||ek(),ec||(ti=t)},u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);0<u.preInit.length;)u.preInit.pop()();return ek(),t.ready});t.exports=i},932:(t,e,r)=>{var n,i=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise(function(t,e){i=t,o=e});var e,i,o,a,s,u,l,c,p,f=Object.assign({},e),d="./this.program",h=(t,e)=>{throw e},g="object"==typeof window,b="function"==typeof importScripts,m="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,y="";m?(y=b?r(908).dirname(y)+"/":"//",p=()=>{c||(l=r(1384),c=r(908))},a=function(t,e){return p(),t=c.normalize(t),l.readFileSync(t,e?void 0:"utf8")},u=t=>((t=a(t,!0)).buffer||(t=new Uint8Array(t)),t),s=(t,e,r)=>{p(),t=c.normalize(t),l.readFile(t,function(t,n){t?r(t):e(n.buffer)})},1<process.argv.length&&(d=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(t){if(!(t instanceof Z))throw t}),process.on("unhandledRejection",function(t){throw t}),h=(t,e)=>{if(w||0<V)throw process.exitCode=t,e;e instanceof Z||x("exiting due to exception: "+e),process.exit(t)},e.inspect=function(){return"[Emscripten Module object]"}):(g||b)&&(b?y=self.location.href:"undefined"!=typeof document&&document.currentScript&&(y=document.currentScript.src),n&&(y=n),y=0!==y.indexOf("blob:")?y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",a=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},b&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),s=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var _,v=e.print||console.log.bind(console),x=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(d=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(_=e.wasmBinary);var w=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&q("no native wasm support detected");var T,S,O,A,E,I,P=!1,D="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function $(t,e,r){var n=(e>>>=0)+r;for(r=e;t[r]&&!(r>=n);)++r;if(16<r-e&&t.buffer&&D)return D.decode(t.subarray(e,r));for(n="";e<r;){var i=t[e++];if(128&i){var o=63&t[e++];if(192==(224&i))n+=String.fromCharCode((31&i)<<6|o);else{var a=63&t[e++];65536>(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else n+=String.fromCharCode(i)}return n}function k(t,e){return(t>>>=0)?$(A,t,e):""}function C(t,e,r,n){if(!(0<n))return 0;var i=r>>>=0;n=r+n-1;for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o)),127>=a){if(r>=n)break;e[r++>>>0]=a}else{if(2047>=a){if(r+1>=n)break;e[r++>>>0]=192|a>>6}else{if(65535>=a){if(r+2>=n)break;e[r++>>>0]=224|a>>12}else{if(r+3>=n)break;e[r++>>>0]=240|a>>18,e[r++>>>0]=128|a>>12&63}e[r++>>>0]=128|a>>6&63}e[r++>>>0]=128|63&a}}return e[r>>>0]=0,r-i}function F(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);127>=n?e++:2047>=n?e+=2:55296<=n&&57343>=n?(e+=4,++r):e+=3}return e}function N(){var t=T.buffer;S=t,e.HEAP8=O=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=A=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=I=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var L,R=[],j=[],M=[],U=[],V=0;function B(){var t=e.preRun.shift();R.unshift(t)}var z,G=0,H=null,W=null;function q(t){throw e.onAbort&&e.onAbort(t),x(t="Aborted("+t+")"),P=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),o(t),t}function X(){return z.startsWith("data:application/octet-stream;base64,")}if(z="ort-wasm.wasm",!X()){var Y=z;z=e.locateFile?e.locateFile(Y,y):y+Y}function K(){var t=z;try{if(t==z&&_)return new Uint8Array(_);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){q(t)}}function Z(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function J(t){for(;0<t.length;)t.shift()(e)}var Q=[],tt=0,te=0;function tr(t){this.Db=t,this.zb=t-24,this.Ub=function(t){I[this.zb+4>>2>>>0]=t},this.Eb=function(){return I[this.zb+4>>2>>>0]},this.Sb=function(t){I[this.zb+8>>2>>>0]=t},this.Wb=function(){return I[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){O[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=O[this.zb+12>>0>>>0]},this.Jb=function(t){O[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=O[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){I[this.zb+16>>2>>>0]=t},this.Ob=function(){return I[this.zb+16>>2>>>0]},this.Qb=function(){if(tI(this.Eb()))return I[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function tn(t){return tv(new tr(t).zb)}var ti=[];function to(t){var e=ti[t];return e||(t>=ti.length&&(ti.length=t+1),ti[t]=e=L.get(t)),e}function ta(t){var e=F(t)+1,r=t_(e);return r&&C(t,O,r,e),r}var ts={};function tu(){if(!tl){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",_:d||"./this.program"};for(t in ts)void 0===ts[t]?delete e[t]:e[t]=ts[t];var r=[];for(t in e)r.push(t+"="+e[t]);tl=r}return tl}var tl,tc=[null,[],[]];function tp(t,e){var r=tc[t];0===e||10===e?((1===t?v:x)($(r,0)),r.length=0):r.push(e)}var tf=0;function td(t){return 0==t%4&&(0!=t%100||0==t%400)}var th=[31,29,31,30,31,30,31,31,30,31,30,31],tg=[31,28,31,30,31,30,31,31,30,31,30,31];function tb(t,e,r,n){function i(t,e,r){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=r[0]+t;return t}function o(t,e){return i(t,e,"0")}function a(t,e){var r;function n(t){return 0>t?-1:0<t?1:0}return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function s(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function u(t){var e=t.Bb;for(t=new Date(new Date(t.Cb+1900,0,1).getTime());0<e;){var r=t.getMonth(),n=(td(t.getFullYear())?th:tg)[r];if(!(e>n-t.getDate())){t.setDate(t.getDate()+e);break}e-=n-t.getDate()+1,t.setDate(1),11>r?t.setMonth(r+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return r=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),r=s(r),0>=a(e,t)?0>=a(r,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var l=E[n+40>>2>>>0];for(var c in n={$b:E[n>>2>>>0],Zb:E[n+4>>2>>>0],Gb:E[n+8>>2>>>0],Kb:E[n+12>>2>>>0],Hb:E[n+16>>2>>>0],Cb:E[n+20>>2>>>0],Ab:E[n+24>>2>>>0],Bb:E[n+28>>2>>>0],bc:E[n+32>>2>>>0],Yb:E[n+36>>2>>>0],ac:l?k(l):""},r=k(r),l={"%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(RegExp(c,"g"),l[c]);var p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),f="January February March April May June July August September October November December".split(" ");for(c in l={"%a":function(t){return p[t.Ab].substring(0,3)},"%A":function(t){return p[t.Ab]},"%b":function(t){return f[t.Hb].substring(0,3)},"%B":function(t){return f[t.Hb]},"%C":function(t){return o((t.Cb+1900)/100|0,2)},"%d":function(t){return o(t.Kb,2)},"%e":function(t){return i(t.Kb,2," ")},"%g":function(t){return u(t).toString().substring(2)},"%G":function(t){return u(t)},"%H":function(t){return o(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12<t&&(t-=12),o(t,2)},"%j":function(t){for(var e=0,r=0;r<=t.Hb-1;e+=(td(t.Cb+1900)?th:tg)[r++]);return o(t.Kb+e,3)},"%m":function(t){return o(t.Hb+1,2)},"%M":function(t){return o(t.Zb,2)},"%n":function(){return"\n"},"%p":function(t){return 0<=t.Gb&&12>t.Gb?"AM":"PM"},"%S":function(t){return o(t.$b,2)},"%t":function(){return" "},"%u":function(t){return t.Ab||7},"%U":function(t){return o(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==(r=(t.Ab+371-t.Bb)%7)||3==r&&td(t.Cb)||(e=1));else{e=52;var r=(t.Ab+7-t.Bb-1)%7;(4==r||5==r&&td(t.Cb%400-1))&&e++}return o(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return o(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(e?"+":"-")+String("0000"+((t=Math.abs(t)/60)/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},r=r.replace(/%%/g,"\0\0"),l)r.includes(c)&&(r=r.replace(RegExp(c,"g"),l[c](n)));return(c=function(t){var e=Array(F(t)+1);return C(t,e,0,e.length),e}(r=r.replace(/\0\0/g,"%"))).length>e?0:(O.set(c,t>>>0),c.length-1)}var tm={a:function(t){return t_(t+24)+24},m:function(t){return(t=new tr(t)).Pb()||(t.Ib(!0),tt--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),P=!0,t},w:function(){tT(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&to(e)(t.Db),tn(t.Db)}te=0},d:function(){var t=te;if(!t)return tf=0;var e=new tr(t);e.Fb(t);var r=e.Eb();if(!r)return tf=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;i<n.length;i++){var o=n[i];if(0===o||o===r)break;if(tE(o,r,e.zb+16))return tf=o,t}return tf=r,t},k:function(){var t=te;if(!t)return tf=0;var e=new tr(t);e.Fb(t);var r=e.Eb();if(!r)return tf=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;i<n.length;i++){var o=n[i];if(0===o||o===r)break;if(tE(o,r,e.zb+16))return tf=o,t}return tf=r,t},g:function(){var t=te;if(!t)return tf=0;var e=new tr(t);e.Fb(t);var r=e.Eb();if(!r)return tf=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;i<n.length;i++){var o=n[i];if(0===o||o===r)break;if(tE(o,r,e.zb+16))return tf=o,t}return tf=r,t},s:tn,L:function(){var t=Q.pop();t||q("no exception to throw");var e=t.Db;throw t.Lb()||(Q.push(t),t.Jb(!0),t.Ib(!1),tt++),te=e,e},b:function(t,e,r){throw new tr(t).Rb(e,r),te=t,tt++,t},la:function(){return tt},i:function(t){throw te||(te=t),t},H:function(){return 0},Ba:function(){},pa:function(){},ra:function(){},ka:function(){return 0},za:function(){},ua:function(){},ya:function(){},R:function(){},qa:function(){},na:function(){},Aa:function(){},oa:function(){},Ha:function(){},Ja:function(){q("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){q("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},S:function(){return Date.now()},Ca:function(){return!0},Da:function(t,e){t=new Date(1e3*(I[t>>>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*(I[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 r=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-r.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var n=new Date(t.getFullYear(),6,1).getTimezoneOffset();r=r.getTimezoneOffset(),E[e+32>>2>>>0]=0|(n!=r&&t.getTimezoneOffset()==Math.min(r,n))},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),r=E[t+32>>2>>>0],n=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),a=i.getTimezoneOffset(),s=Math.min(a,o);return 0>r?E[t+32>>2>>>0]=Number(o!=a&&s==n):0<r!=(s==n)&&(o=Math.max(a,o),e.setTime(e.getTime()+6e4*((0<r?s:o)-n))),E[t+24>>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-i.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,r,n){t.Vb||(t.Vb=!0,function(t,e,r){function n(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}var i=(new Date).getFullYear(),o=new Date(i,0,1),a=new Date(i,6,1);i=o.getTimezoneOffset();var s=a.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(i,s),E[e>>2>>>0]=Number(i!=s),t=n(o),e=n(a),t=ta(t),e=ta(e),s<i?(I[r>>2>>>0]=t,I[r+4>>2>>>0]=e):(I[r>>2>>>0]=e,I[r+4>>2>>>0]=t)}(e,r,n))},B:function(){q("")},ma:function(){return 4294901760},I:m?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,r){A.copyWithin(t>>>0,e>>>0,e+r>>>0)},G:function(t){var e=A.length;if(4294901760<(t>>>=0))return!1;for(var r=1;4>=r;r*=2){var n=e*(1+.2/r);n=Math.min(n,t+100663296);var i=Math;n=Math.max(t,n),i=i.min.call(i,4294901760,n+(65536-n%65536)%65536);t:{try{T.grow(i-S.byteLength+65535>>>16),N();var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},va:function(t,e){var r=0;return tu().forEach(function(n,i){var o=e+r;for(i=I[t+4*i>>2>>>0]=o,o=0;o<n.length;++o)O[i++>>0>>>0]=n.charCodeAt(o);O[i>>0>>>0]=0,r+=n.length+1}),0},wa:function(t,e){var r=tu();I[t>>2>>>0]=r.length;var n=0;return r.forEach(function(t){n+=t.length+1}),I[e>>2>>>0]=n,0},ba:function(t){w||0<V||(tw(),J(M),tx(0),tc[1].length&&tp(1,10),tc[2].length&&tp(2,10)),w||0<V||(e.onExit&&e.onExit(t),P=!0),h(t,new Z(t))},E:function(){return 52},Q:function(){return 52},ca:function(){return 70},P:function(t,e,r,n){for(var i=0,o=0;o<r;o++){var a=I[e>>2>>>0],s=I[e+4>>2>>>0];e+=8;for(var u=0;u<s;u++)tp(t,A[a+u>>>0]);i+=s}return I[n>>2>>>0]=i,0},c:function(){return tf},ja:function t(e,n){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(m)try{var e=r(Object(function(){var t=Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>q("randomDevice")}());for(var i=0;i<n;i++)O[e+i>>0>>>0]=t.Mb();return 0},ea:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},fa:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},J:function(t){var e=tS();try{return to(t)()}catch(t){if(tO(e),t!==t+0)throw t;tT(1,0)}},e:function(t,e){var r=tS();try{return to(t)(e)}catch(t){if(tO(r),t!==t+0)throw t;tT(1,0)}},N:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},O:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},j:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},o:function(t,e,r,n){var i=tS();try{return to(t)(e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},p:function(t,e,r,n,i){var o=tS();try{return to(t)(e,r,n,i)}catch(t){if(tO(o),t!==t+0)throw t;tT(1,0)}},M:function(t,e,r,n,i,o){var a=tS();try{return to(t)(e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},r:function(t,e,r,n,i,o){var a=tS();try{return to(t)(e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},v:function(t,e,r,n,i,o,a){var s=tS();try{return to(t)(e,r,n,i,o,a)}catch(t){if(tO(s),t!==t+0)throw t;tT(1,0)}},K:function(t,e,r,n,i,o,a,s){var u=tS();try{return to(t)(e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},D:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=tS();try{return to(t)(e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(tO(f),t!==t+0)throw t;tT(1,0)}},X:function(t,e,r,n,i,o,a,s){var u=tS();try{return tR(t,e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},V:function(t,e,r,n,i,o,a){var s=tS();try{return tD(t,e,r,n,i,o,a)}catch(t){if(tO(s),t!==t+0)throw t;tT(1,0)}},U:function(t,e,r,n,i){var o=tS();try{return tj(t,e,r,n,i)}catch(t){if(tO(o),t!==t+0)throw t;tT(1,0)}},Z:function(t,e,r,n){var i=tS();try{return tN(t,e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},W:function(t){var e=tS();try{return tP(t)}catch(t){if(tO(e),t!==t+0)throw t;tT(1,0)}},Y:function(t,e){var r=tS();try{return tL(t,e)}catch(t){if(tO(r),t!==t+0)throw t;tT(1,0)}},T:function(t,e,r){var n=tS();try{return t$(t,e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},f:function(t){var e=tS();try{to(t)()}catch(t){if(tO(e),t!==t+0)throw t;tT(1,0)}},q:function(t,e){var r=tS();try{to(t)(e)}catch(t){if(tO(r),t!==t+0)throw t;tT(1,0)}},h:function(t,e,r){var n=tS();try{to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},da:function(t,e,r,n){var i=tS();try{to(t)(e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},l:function(t,e,r,n){var i=tS();try{to(t)(e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},t:function(t,e,r,n,i){var o=tS();try{to(t)(e,r,n,i)}
1catch(t){if(tO(o),t!==t+0)throw t;tT(1,0)}},u:function(t,e,r,n,i,o){var a=tS();try{to(t)(e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},x:function(t,e,r,n,i,o,a){var s=tS();try{to(t)(e,r,n,i,o,a)}catch(t){if(tO(s),t!==t+0)throw t;tT(1,0)}},z:function(t,e,r,n,i,o,a,s){var u=tS();try{to(t)(e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},ga:function(t,e,r,n,i,o,a,s,u){var l=tS();try{to(t)(e,r,n,i,o,a,s,u)}catch(t){if(tO(l),t!==t+0)throw t;tT(1,0)}},A:function(t,e,r,n,i,o,a,s,u,l,c){var p=tS();try{to(t)(e,r,n,i,o,a,s,u,l,c)}catch(t){if(tO(p),t!==t+0)throw t;tT(1,0)}},C:function(t,e,r,n,i,o,a,s,u,l,c,p,f,d,h,g){var b=tS();try{to(t)(e,r,n,i,o,a,s,u,l,c,p,f,d,h,g)}catch(t){if(tO(b),t!==t+0)throw t;tT(1,0)}},aa:function(t,e,r,n,i,o,a,s){var u=tS();try{tk(t,e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},_:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=tS();try{tF(t,e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(tO(f),t!==t+0)throw t;tT(1,0)}},$:function(t,e,r,n,i,o){var a=tS();try{tC(t,e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},n:function(t){return t},F:function(t){tf=t},ha:tb,y:function(t,e,r,n){return tb(t,e,r,n)}};(function(){function t(t){e.asm=t.exports,T=e.asm.Ka,N(),L=e.asm.ib,j.unshift(e.asm.La),G--,e.monitorRunDependencies&&e.monitorRunDependencies(G),0==G&&(null!==H&&(clearInterval(H),H=null),W&&(t=W,W=null,t()))}function r(e){t(e.instance)}function n(t){return(function(){if(!_&&(g||b)){if("function"==typeof fetch&&!z.startsWith("file://"))return fetch(z,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw"failed to load wasm binary file at '"+z+"'";return t.arrayBuffer()}).catch(function(){return K()});if(s)return new Promise(function(t,e){s(z,function(e){t(new Uint8Array(e))},e)})}return Promise.resolve().then(function(){return K()})})().then(function(t){return WebAssembly.instantiate(t,i)}).then(function(t){return t}).then(t,function(t){x("failed to asynchronously prepare wasm: "+t),q(t)})}var i={a:tm};if(G++,e.monitorRunDependencies&&e.monitorRunDependencies(G),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(_||"function"!=typeof WebAssembly.instantiateStreaming||X()||z.startsWith("file://")||m||"function"!=typeof fetch?n(r):fetch(z,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,i).then(r,function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(r)})})).catch(o)})(),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 ty,t_=e._malloc=function(){return(t_=e._malloc=e.asm.eb).apply(null,arguments)},tv=e._free=function(){return(tv=e._free=e.asm.fb).apply(null,arguments)},tx=e._fflush=function(){return(tx=e._fflush=e.asm.gb).apply(null,arguments)},tw=e.___funcs_on_exit=function(){return(tw=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},tT=e._setThrew=function(){return(tT=e._setThrew=e.asm.jb).apply(null,arguments)},tS=e.stackSave=function(){return(tS=e.stackSave=e.asm.kb).apply(null,arguments)},tO=e.stackRestore=function(){return(tO=e.stackRestore=e.asm.lb).apply(null,arguments)},tA=e.stackAlloc=function(){return(tA=e.stackAlloc=e.asm.mb).apply(null,arguments)},tE=e.___cxa_can_catch=function(){return(tE=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},tI=e.___cxa_is_pointer_type=function(){return(tI=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},tP=e.dynCall_j=function(){return(tP=e.dynCall_j=e.asm.pb).apply(null,arguments)},tD=e.dynCall_iiiiij=function(){return(tD=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},t$=e.dynCall_jii=function(){return(t$=e.dynCall_jii=e.asm.rb).apply(null,arguments)},tk=e.dynCall_viiiiij=function(){return(tk=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},tC=e.dynCall_vjji=function(){return(tC=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},tF=e.dynCall_viiijjjii=function(){return(tF=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},tN=e.dynCall_iij=function(){return(tN=e.dynCall_iij=e.asm.vb).apply(null,arguments)},tL=e.dynCall_ji=function(){return(tL=e.dynCall_ji=e.asm.wb).apply(null,arguments)},tR=e.dynCall_iiiiiij=function(){return(tR=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},tj=e.dynCall_iiij=function(){return(tj=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function tM(){function t(){if(!ty&&(ty=!0,e.calledRun=!0,!P)){if(J(j),i(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();U.unshift(t)}J(U)}}if(!(0<G)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)B();J(R),0<G||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),t()},1)):t())}}if(e.UTF8ToString=k,e.stringToUTF8=function(t,e,r){return C(t,A,e,r)},e.lengthBytesUTF8=F,e.stackSave=tS,e.stackRestore=tO,e.stackAlloc=tA,W=function t(){ty||tM(),ty||(W=t)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return tM(),t.ready});t.exports=i},4537:t=>{"use strict";
vendor: 99,571 bytes, line 1
1t.exports=function(t,e){for(var r=Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(i,a){r[n]=function(t){if(o){if(o=!1,t)a(t);else{for(var e=Array(arguments.length-1),r=0;r<e.length;)e[r++]=arguments[r];i.apply(null,e)}}};try{t.apply(e||null,r)}catch(t){o&&(o=!1,a(t))}})}},7419:(t,e)=>{"use strict";var r=e;r.length=function(t){var e=t.length;if(!e)return 0;for(var r=0;--e%4>1&&"="===t.charAt(e);)++r;return Math.ceil(3*t.length)/4-r};for(var n=Array(64),i=Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(t,e,r){for(var i,o=null,a=[],s=0,u=0;e<r;){var l=t[e++];switch(u){case 0:a[s++]=n[l>>2],i=(3&l)<<4,u=1;break;case 1:a[s++]=n[i|l>>4],i=(15&l)<<2,u=2;break;case 2:a[s++]=n[i|l>>6],a[s++]=n[63&l],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=n[i],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var a="invalid encoding";r.decode=function(t,e,r){for(var n,o=r,s=0,u=0;u<t.length;){var l=t.charCodeAt(u++);if(61===l&&s>1)break;if(void 0===(l=i[l]))throw Error(a);switch(s){case 0:n=l,s=1;break;case 1:e[r++]=n<<2|(48&l)>>4,n=l,s=2;break;case 2:e[r++]=(15&n)<<4|(60&l)>>2,n=l,s=3;break;case 3:e[r++]=(3&n)<<6|l,s=0}}if(1===s)throw Error(a);return r-o},r.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},9211:t=>{"use strict";function e(){this._listeners={}}t.exports=e,e.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this},e.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var r=this._listeners[t],n=0;n<r.length;)r[n].fn===e?r.splice(n,1):++n;return this},e.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<e.length;)e[n].fn.apply(e[n++].ctx,r)}return this}},945:t=>{"use strict";function e(t){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=128===r[3];function i(t,n,i){e[0]=t,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(t,n,i){e[0]=t,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function a(t,n){return r[0]=t[n],r[1]=t[n+1],r[2]=t[n+2],r[3]=t[n+3],e[0]}function s(t,n){return r[3]=t[n],r[2]=t[n+1],r[1]=t[n+2],r[0]=t[n+3],e[0]}t.writeFloatLE=n?i:o,t.writeFloatBE=n?o:i,t.readFloatLE=n?a:s,t.readFloatBE=n?s:a}():function(){function e(t,e,r,n){var i=e<0?1:0;if(i&&(e=-e),0===e)t(1/e>0?0:2147483648,r,n);else if(isNaN(e))t(2143289344,r,n);else if(e>34028234663852886e22)t((i<<31|2139095040)>>>0,r,n);else if(e<11754943508222875e-54)t((i<<31|Math.round(e/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(e)/Math.LN2);t((i<<31|o+127<<23|8388607&Math.round(e*Math.pow(2,-o)*8388608))>>>0,r,n)}}function a(t,e,r){var n=t(e,r),i=2*(n>>31)+1,o=n>>>23&255,a=8388607&n;return 255===o?a?NaN:1/0*i:0===o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(a+8388608)}t.writeFloatLE=e.bind(null,r),t.writeFloatBE=e.bind(null,n),t.readFloatLE=a.bind(null,i),t.readFloatBE=a.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=128===r[7];function i(t,n,i){e[0]=t,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(t,n,i){e[0]=t,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function a(t,n){return r[0]=t[n],r[1]=t[n+1],r[2]=t[n+2],r[3]=t[n+3],r[4]=t[n+4],r[5]=t[n+5],r[6]=t[n+6],r[7]=t[n+7],e[0]}function s(t,n){return r[7]=t[n],r[6]=t[n+1],r[5]=t[n+2],r[4]=t[n+3],r[3]=t[n+4],r[2]=t[n+5],r[1]=t[n+6],r[0]=t[n+7],e[0]}t.writeDoubleLE=n?i:o,t.writeDoubleBE=n?o:i,t.readDoubleLE=n?a:s,t.readDoubleBE=n?s:a}():function(){function e(t,e,r,n,i,o){var a,s=n<0?1:0;if(s&&(n=-n),0===n)t(0,i,o+e),t(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))t(0,i,o+e),t(2146959360,i,o+r);else if(n>17976931348623157e292)t(0,i,o+e),t((s<<31|2146435072)>>>0,i,o+r);else if(n<22250738585072014e-324)t((a=n/5e-324)>>>0,i,o+e),t((s<<31|a/4294967296)>>>0,i,o+r);else{var u=Math.floor(Math.log(n)/Math.LN2);1024===u&&(u=1023),t(4503599627370496*(a=n*Math.pow(2,-u))>>>0,i,o+e),t((s<<31|u+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}function a(t,e,r,n,i){var o=t(n,i+e),a=t(n,i+r),s=2*(a>>31)+1,u=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===u?l?NaN:1/0*s:0===u?5e-324*s*l:s*Math.pow(2,u-1075)*(l+4503599627370496)}t.writeDoubleLE=e.bind(null,r,0,4),t.writeDoubleBE=e.bind(null,n,4,0),t.readDoubleLE=a.bind(null,i,0,4),t.readDoubleBE=a.bind(null,o,4,0)}(),t}function r(t,e,r){e[r]=255&t,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function n(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=255&t}function i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function o(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}t.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:t=>{"use strict";t.exports=function(t,e,r){var n=r||8192,i=n>>>1,o=null,a=n;return function(r){if(r<1||r>i)return t(r);a+r>n&&(o=t(n),a=0);var s=e.call(o,a,a+=r);return 7&a&&(a=1+(7|a)),s}}},4997:(t,e)=>{"use strict";var r=e;r.length=function(t){for(var e=0,r=0,n=0;n<t.length;++n)(r=t.charCodeAt(n))<128?e+=1:r<2048?e+=2:55296==(64512&r)&&56320==(64512&t.charCodeAt(n+1))?(++n,e+=4):e+=3;return e},r.read=function(t,e,r){if(r-e<1)return"";for(var n,i=null,o=[],a=0;e<r;)(n=t[e++])<128?o[a++]=n:n>191&&n<224?o[a++]=(31&n)<<6|63&t[e++]:n>239&&n<365?(n=((7&n)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[a++]=55296+(n>>10),o[a++]=56320+(1023&n)):o[a++]=(15&n)<<12|(63&t[e++])<<6|63&t[e++],a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},r.write=function(t,e,r){for(var n,i,o=r,a=0;a<t.length;++a)(n=t.charCodeAt(a))<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(55296==(64512&n)&&56320==(64512&(i=t.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&i),++a,e[r++]=n>>18|240,e[r++]=n>>12&63|128):e[r++]=n>>12|224,e[r++]=n>>6&63|128),e[r++]=63&n|128);return r-o}},3442:(t,e)=>{"use strict";e.__esModule=!0;var r=function(){function t(e){if(!e)throw TypeError("Invalid argument; `value` has no value.");this.value=t.EMPTY,e&&t.isGuid(e)&&(this.value=e)}return t.isGuid=function(e){var r=e.toString();return e&&(e instanceof t||t.validator.test(r))},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(e){return new t(e)},t.raw=function(){return[t.gen(2),t.gen(1),t.gen(1),t.gen(1),t.gen(3)].join("-")},t.gen=function(t){for(var e="",r=0;r<t;r++)e+=(65536*(1+Math.random())|0).toString(16).substring(1);return e},t.prototype.equals=function(e){return t.isGuid(e)&&this.value===e.toString()},t.prototype.isEmpty=function(){return this.value===t.EMPTY},t.prototype.toString=function(){return this.value},t.prototype.toJSON=function(){return{value:this.value}},t.validator=RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i"),t.EMPTY="00000000-0000-0000-0000-000000000000",t}();e.Guid=r},3720:t=>{t.exports=r;var e=null;try{e=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(t){}function r(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function n(t){return!0===(t&&t.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=n;var i={},o={};function a(t,e){var r,n,a;return e?(a=0<=(t>>>=0)&&t<256)&&(n=o[t])?n:(r=u(t,(0|t)<0?-1:0,!0),a&&(o[t]=r),r):(a=-128<=(t|=0)&&t<128)&&(n=i[t])?n:(r=u(t,t<0?-1:0,!1),a&&(i[t]=r),r)}function s(t,e){if(isNaN(t))return e?m:b;if(e){if(t<0)return m;if(t>=d)return w}else{if(t<=-h)return T;if(t+1>=h)return x}return t<0?s(-t,e).neg():u(t%f|0,t/f|0,e)}function u(t,e,n){return new r(t,e,n)}r.fromInt=a,r.fromNumber=s,r.fromBits=u;var l=Math.pow;function c(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return b;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||36<r)throw RangeError("radix");if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return c(t.substring(1),e,r).neg();for(var n,i=s(l(r,8)),o=b,a=0;a<t.length;a+=8){var u=Math.min(8,t.length-a),p=parseInt(t.substring(a,a+u),r);if(u<8){var f=s(l(r,u));o=o.mul(f).add(s(p))}else o=(o=o.mul(i)).add(s(p))}return o.unsigned=e,o}function p(t,e){return"number"==typeof t?s(t,e):"string"==typeof t?c(t,e):u(t.low,t.high,"boolean"==typeof e?e:t.unsigned)}r.fromString=c,r.fromValue=p;var f=4294967296,d=18446744073709552e3,h=18446744073709552e3/2,g=a(16777216),b=a(0);r.ZERO=b;var m=a(0,!0);r.UZERO=m;var y=a(1);r.ONE=y;var _=a(1,!0);r.UONE=_;var v=a(-1);r.NEG_ONE=v;var x=u(-1,2147483647,!1);r.MAX_VALUE=x;var w=u(-1,-1,!0);r.MAX_UNSIGNED_VALUE=w;var T=u(0,-2147483648,!1);r.MIN_VALUE=T;var S=r.prototype;S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},S.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var e=s(t),r=this.div(e),n=r.mul(e).sub(this);return r.toString(t)+n.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var i=s(l(t,6),this.unsigned),o=this,a="";;){var u=o.div(i),c=(o.sub(u.mul(i)).toInt()>>>0).toString(t);if((o=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},S.isZero=function(){return 0===this.high&&0===this.low},S.eqz=S.isZero,S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return 1==(1&this.low)},S.isEven=function(){return 0==(1&this.low)},S.equals=function(t){return n(t)||(t=p(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},S.eq=S.equals,S.notEquals=function(t){return!this.eq(t)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(t){return 0>this.comp(t)},S.lt=S.lessThan,S.lessThanOrEqual=function(t){return 0>=this.comp(t)},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(t){return this.comp(t)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(t){return this.comp(t)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(t){if(n(t)||(t=p(t)),this.eq(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(y)},S.neg=S.negate,S.add=function(t){n(t)||(t=p(t));var e,r,i,o,a=this.high>>>16,s=65535&this.high,l=this.low>>>16,c=65535&this.low,f=t.high>>>16,d=65535&t.high,h=t.low>>>16;return o=0+(((i=0+((e=0+((r=0+(c+(65535&t.low)))>>>16)+(l+h))>>>16)+(s+d))>>>16)+(a+f)),u((e&=65535)<<16|(r&=65535),(o&=65535)<<16|(i&=65535),this.unsigned)},S.subtract=function(t){return n(t)||(t=p(t)),this.add(t.neg())},S.sub=S.subtract,S.multiply=function(t){if(this.isZero())return b;if(n(t)||(t=p(t)),e)return u(e.mul(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned);if(t.isZero())return b;if(this.eq(T))return t.isOdd()?T:b;if(t.eq(T))return this.isOdd()?T:b;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(g)&&t.lt(g))return s(this.toNumber()*t.toNumber(),this.unsigned);var r,i,o,a=this.high>>>16,l=65535&this.high,c=this.low>>>16,f=65535&this.low,d=t.high>>>16,h=65535&t.high,m=t.low>>>16,y=65535&t.low,_=0;return o=0+((r=0+((i=0+f*y)>>>16)+c*y)>>>16),r&=65535,o+=(r+=f*m)>>>16,_+=(o+=l*y)>>>16,o&=65535,_+=(o+=c*m)>>>16,o&=65535,_+=((o+=f*h)>>>16)+(a*y+l*m+c*h+f*d),u((r&=65535)<<16|(i&=65535),(_&=65535)<<16|(o&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(t){if(n(t)||(t=p(t)),t.isZero())throw Error("division by zero");if(e)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?u((this.unsigned?e.div_u:e.div_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:b;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return _;o=m}else{if(this.eq(T))return t.eq(y)||t.eq(v)?T:t.eq(T)?y:(r=this.shr(1).div(t).shl(1)).eq(b)?t.isNegative()?y:v:(i=this.sub(t.mul(r)),o=r.add(i.div(t)));if(t.eq(T))return this.unsigned?m:b;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=b}for(i=this;i.gte(t);){r=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var r,i,o,a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:l(2,a-48),f=s(r),d=f.mul(t);d.isNegative()||d.gt(i);)d=(f=s(r-=c,this.unsigned)).mul(t);f.isZero()&&(f=y),o=o.add(f),i=i.sub(d)}return o},S.div=S.divide,S.modulo=function(t){return n(t)||(t=p(t)),e?u((this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return u(~this.low,~this.high,this.unsigned)},S.and=function(t){return n(t)||(t=p(t)),u(this.low&t.low,this.high&t.high,this.unsigned)},S.or=function(t){return n(t)||(t=p(t)),u(this.low|t.low,this.high|t.high,this.unsigned)},S.xor=function(t){return n(t)||(t=p(t)),u(this.low^t.low,this.high^t.high,this.unsigned)},S.shiftLeft=function(t){return n(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):u(0,this.low<<t-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(t){return n(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):u(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(t){if(n(t)&&(t=t.toInt()),0==(t&=63))return this;var e=this.high;return t<32?u(this.low>>>t|e<<32-t,e>>>t,this.unsigned):u(32===t?e:e>>>t-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},S.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},S.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},S.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},r.fromBytes=function(t,e,n){return n?r.fromBytesLE(t,e):r.fromBytesBE(t,e)},r.fromBytesLE=function(t,e){return new r(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},r.fromBytesBE=function(t,e){return new r(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},1446:(t,e,r)=>{"use strict";var n,i,o,a=r(2100),s=a.Reader,u=a.Writer,l=a.util,c=a.roots.default||(a.roots.default={});c.onnx=((o={}).Version=((i=Object.create(n={}))[n[0]="_START_VERSION"]=0,i[n[1]="IR_VERSION_2017_10_10"]=1,i[n[2]="IR_VERSION_2017_10_30"]=2,i[n[3]="IR_VERSION_2017_11_3"]=3,i[n[4]="IR_VERSION_2019_1_22"]=4,i[n[5]="IR_VERSION"]=5,i),o.AttributeProto=function(){function t(t){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.name="",t.prototype.refAttrName="",t.prototype.docString="",t.prototype.type=0,t.prototype.f=0,t.prototype.i=l.Long?l.Long.fromBits(0,0,!1):0,t.prototype.s=l.newBuffer([]),t.prototype.t=null,t.prototype.g=null,t.prototype.floats=l.emptyArray,t.prototype.ints=l.emptyArray,t.prototype.strings=l.emptyArray,t.prototype.tensors=l.emptyArray,t.prototype.graphs=l.emptyArray,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=u.create()),null!=t.name&&t.hasOwnProperty("name")&&e.uint32(10).string(t.name),null!=t.f&&t.hasOwnProperty("f")&&e.uint32(21).float(t.f),null!=t.i&&t.hasOwnProperty("i")&&e.uint32(24).int64(t.i),null!=t.s&&t.hasOwnProperty("s")&&e.uint32(34).bytes(t.s),null!=t.t&&t.hasOwnProperty("t")&&c.onnx.TensorProto.encode(t.t,e.uint32(42).fork()).ldelim(),null!=t.g&&t.hasOwnProperty("g")&&c.onnx.GraphProto.encode(t.g,e.uint32(50).fork()).ldelim(),null!=t.floats&&t.floats.length){e.uint32(58).fork();for(var r=0;r<t.floats.length;++r)e.float(t.floats[r]);e.ldelim()}if(null!=t.ints&&t.ints.length){for(e.uint32(66).fork(),r=0;r<t.ints.length;++r)e.int64(t.ints[r]);e.ldelim()}if(null!=t.strings&&t.strings.length)for(r=0;r<t.strings.length;++r)e.uint32(74).bytes(t.strings[r]);if(null!=t.tensors&&t.tensors.length)for(r=0;r<t.tensors.length;++r)c.onnx.TensorProto.encode(t.tensors[r],e.uint32(82).fork()).ldelim();if(null!=t.graphs&&t.graphs.length)for(r=0;r<t.graphs.length;++r)c.onnx.GraphProto.encode(t.graphs[r],e.uint32(90).fork()).ldelim();return null!=t.docString&&t.hasOwnProperty("docString")&&e.uint32(106).string(t.docString),null!=t.type&&t.hasOwnProperty("type")&&e.uint32(160).int32(t.type),null!=t.refAttrName&&t.hasOwnProperty("refAttrName")&&e.uint32(170).string(t.refAttrName),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.AttributeProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.name=t.string();break;case 21:n.refAttrName=t.string();break;case 13:n.docString=t.string();break;case 20:n.type=t.int32();break;case 2:n.f=t.float();break;case 3:n.i=t.int64();break;case 4:n.s=t.bytes();break;case 5:n.t=c.onnx.TensorProto.decode(t,t.uint32());break;case 6:n.g=c.onnx.GraphProto.decode(t,t.uint32());break;case 7:if(n.floats&&n.floats.length||(n.floats=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos<o;)n.floats.push(t.float());else n.floats.push(t.float());break;case 8:if(n.ints&&n.ints.length||(n.ints=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)n.ints.push(t.int64());else n.ints.push(t.int64());break;case 9:n.strings&&n.strings.length||(n.strings=[]),n.strings.push(t.bytes());break;case 10:n.tensors&&n.tensors.length||(n.tensors=[]),n.tensors.push(c.onnx.TensorProto.decode(t,t.uint32()));break;case 11:n.graphs&&n.graphs.length||(n.graphs=[]),n.graphs.push(c.onnx.GraphProto.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.name&&t.hasOwnProperty("name")&&!l.isString(t.name))return"name: string expected";if(null!=t.refAttrName&&t.hasOwnProperty("refAttrName")&&!l.isString(t.refAttrName))return"refAttrName: string expected";if(null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString))return"docString: string expected";if(null!=t.type&&t.hasOwnProperty("type"))switch(t.type){default:return"type: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:}if(null!=t.f&&t.hasOwnProperty("f")&&"number"!=typeof t.f)return"f: number expected";if(null!=t.i&&t.hasOwnProperty("i")&&!(l.isInteger(t.i)||t.i&&l.isInteger(t.i.low)&&l.isInteger(t.i.high)))return"i: integer|Long expected";if(null!=t.s&&t.hasOwnProperty("s")&&!(t.s&&"number"==typeof t.s.length||l.isString(t.s)))return"s: buffer expected";if(null!=t.t&&t.hasOwnProperty("t")&&(e=c.onnx.TensorProto.verify(t.t)))return"t."+e;if(null!=t.g&&t.hasOwnProperty("g")&&(e=c.onnx.GraphProto.verify(t.g)))return"g."+e;if(null!=t.floats&&t.hasOwnProperty("floats")){if(!Array.isArray(t.floats))return"floats: array expected";for(var e,r=0;r<t.floats.length;++r)if("number"!=typeof t.floats[r])return"floats: number[] expected"}if(null!=t.ints&&t.hasOwnProperty("ints")){if(!Array.isArray(t.ints))return"ints: array expected";for(r=0;r<t.ints.length;++r)if(!(l.isInteger(t.ints[r])||t.ints[r]&&l.isInteger(t.ints[r].low)&&l.isInteger(t.ints[r].high)))return"ints: integer|Long[] expected"}if(null!=t.strings&&t.hasOwnProperty("strings")){if(!Array.isArray(t.strings))return"strings: array expected";for(r=0;r<t.strings.length;++r)if(!(t.strings[r]&&"number"==typeof t.strings[r].length||l.isString(t.strings[r])))return"strings: buffer[] expected"}if(null!=t.tensors&&t.hasOwnProperty("tensors")){if(!Array.isArray(t.tensors))return"tensors: array expected";for(r=0;r<t.tensors.length;++r)if(e=c.onnx.TensorProto.verify(t.tensors[r]))return"tensors."+e}if(null!=t.graphs&&t.hasOwnProperty("graphs")){if(!Array.isArray(t.graphs))return"graphs: array expected";for(r=0;r<t.graphs.length;++r)if(e=c.onnx.GraphProto.verify(t.graphs[r]))return"graphs."+e}return null},t.fromObject=function(t){if(t instanceof c.onnx.AttributeProto)return t;var e=new c.onnx.AttributeProto;switch(null!=t.name&&(e.name=String(t.name)),null!=t.refAttrName&&(e.refAttrName=String(t.refAttrName)),null!=t.docString&&(e.docString=String(t.docString)),t.type){case"UNDEFINED":case 0:e.type=0;break;case"FLOAT":case 1:e.type=1;break;case"INT":case 2:e.type=2;break;case"STRING":case 3:e.type=3;break;case"TENSOR":case 4:e.type=4;break;case"GRAPH":case 5:e.type=5;break;case"FLOATS":case 6:e.type=6;break;case"INTS":case 7:e.type=7;break;case"STRINGS":case 8:e.type=8;break;case"TENSORS":case 9:e.type=9;break;case"GRAPHS":case 10:e.type=10}if(null!=t.f&&(e.f=Number(t.f)),null!=t.i&&(l.Long?(e.i=l.Long.fromValue(t.i)).unsigned=!1:"string"==typeof t.i?e.i=parseInt(t.i,10):"number"==typeof t.i?e.i=t.i:"object"==typeof t.i&&(e.i=new l.LongBits(t.i.low>>>0,t.i.high>>>0).toNumber())),null!=t.s&&("string"==typeof t.s?l.base64.decode(t.s,e.s=l.newBuffer(l.base64.length(t.s)),0):t.s.length&&(e.s=t.s)),null!=t.t){if("object"!=typeof t.t)throw TypeError(".onnx.AttributeProto.t: object expected");e.t=c.onnx.TensorProto.fromObject(t.t)}if(null!=t.g){if("object"!=typeof t.g)throw TypeError(".onnx.AttributeProto.g: object expected");e.g=c.onnx.GraphProto.fromObject(t.g)}if(t.floats){if(!Array.isArray(t.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");e.floats=[];for(var r=0;r<t.floats.length;++r)e.floats[r]=Number(t.floats[r])}if(t.ints){if(!Array.isArray(t.ints))throw TypeError(".onnx.AttributeProto.ints: array expected");for(e.ints=[],r=0;r<t.ints.length;++r)l.Long?(e.ints[r]=l.Long.fromValue(t.ints[r])).unsigned=!1:"string"==typeof t.ints[r]?e.ints[r]=parseInt(t.ints[r],10):"number"==typeof t.ints[r]?e.ints[r]=t.ints[r]:"object"==typeof t.ints[r]&&(e.ints[r]=new l.LongBits(t.ints[r].low>>>0,t.ints[r].high>>>0).toNumber())}if(t.strings){if(!Array.isArray(t.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(e.strings=[],r=0;r<t.strings.length;++r)"string"==typeof t.strings[r]?l.base64.decode(t.strings[r],e.strings[r]=l.newBuffer(l.base64.length(t.strings[r])),0):t.strings[r].length&&(e.strings[r]=t.strings[r])}if(t.tensors){if(!Array.isArray(t.tensors))throw TypeError(".onnx.AttributeProto.tensors: array expected");for(e.tensors=[],r=0;r<t.tensors.length;++r){if("object"!=typeof t.tensors[r])throw TypeError(".onnx.AttributeProto.tensors: object expected");e.tensors[r]=c.onnx.TensorProto.fromObject(t.tensors[r])}}if(t.graphs){if(!Array.isArray(t.graphs))throw TypeError(".onnx.AttributeProto.graphs: array expected");for(e.graphs=[],r=0;r<t.graphs.length;++r){if("object"!=typeof t.graphs[r])throw TypeError(".onnx.AttributeProto.graphs: object expected");e.graphs[r]=c.onnx.GraphProto.fromObject(t.graphs[r])}}return e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.floats=[],r.ints=[],r.strings=[],r.tensors=[],r.graphs=[]),e.defaults){if(r.name="",r.f=0,l.Long){var n=new l.Long(0,0,!1);r.i=e.longs===String?n.toString():e.longs===Number?n.toNumber():n}else r.i=e.longs===String?"0":0;e.bytes===String?r.s="":(r.s=[],e.bytes!==Array&&(r.s=l.newBuffer(r.s))),r.t=null,r.g=null,r.docString="",r.type=e.enums===String?"UNDEFINED":0,r.refAttrName=""}if(null!=t.name&&t.hasOwnProperty("name")&&(r.name=t.name),null!=t.f&&t.hasOwnProperty("f")&&(r.f=e.json&&!isFinite(t.f)?String(t.f):t.f),null!=t.i&&t.hasOwnProperty("i")&&("number"==typeof t.i?r.i=e.longs===String?String(t.i):t.i:r.i=e.longs===String?l.Long.prototype.toString.call(t.i):e.longs===Number?new l.LongBits(t.i.low>>>0,t.i.high>>>0).toNumber():t.i),null!=t.s&&t.hasOwnProperty("s")&&(r.s=e.bytes===String?l.base64.encode(t.s,0,t.s.length):e.bytes===Array?Array.prototype.slice.call(t.s):t.s),null!=t.t&&t.hasOwnProperty("t")&&(r.t=c.onnx.TensorProto.toObject(t.t,e)),null!=t.g&&t.hasOwnProperty("g")&&(r.g=c.onnx.GraphProto.toObject(t.g,e)),t.floats&&t.floats.length){r.floats=[];for(var i=0;i<t.floats.length;++i)r.floats[i]=e.json&&!isFinite(t.floats[i])?String(t.floats[i]):t.floats[i]}if(t.ints&&t.ints.length)for(r.ints=[],i=0;i<t.ints.length;++i)"number"==typeof t.ints[i]?r.ints[i]=e.longs===String?String(t.ints[i]):t.ints[i]:r.ints[i]=e.longs===String?l.Long.prototype.toString.call(t.ints[i]):e.longs===Number?new l.LongBits(t.ints[i].low>>>0,t.ints[i].high>>>0).toNumber():t.ints[i];if(t.strings&&t.strings.length)for(r.strings=[],i=0;i<t.strings.length;++i)r.strings[i]=e.bytes===String?l.base64.encode(t.strings[i],0,t.strings[i].length):e.bytes===Array?Array.prototype.slice.call(t.strings[i]):t.strings[i];if(t.tensors&&t.tensors.length)for(r.tensors=[],i=0;i<t.tensors.length;++i)r.tensors[i]=c.onnx.TensorProto.toObject(t.tensors[i],e);if(t.graphs&&t.graphs.length)for(r.graphs=[],i=0;i<t.graphs.length;++i)r.graphs[i]=c.onnx.GraphProto.toObject(t.graphs[i],e);return null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),null!=t.type&&t.hasOwnProperty("type")&&(r.type=e.enums===String?c.onnx.AttributeProto.AttributeType[t.type]:t.type),null!=t.refAttrName&&t.hasOwnProperty("refAttrName")&&(r.refAttrName=t.refAttrName),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t.AttributeType=function(){var t={},e=Object.create(t);return e[t[0]="UNDEFINED"]=0,e[t[1]="FLOAT"]=1,e[t[2]="INT"]=2,e[t[3]="STRING"]=3,e[t[4]="TENSOR"]=4,e[t[5]="GRAPH"]=5,e[t[6]="FLOATS"]=6,e[t[7]="INTS"]=7,e[t[8]="STRINGS"]=8,e[t[9]="TENSORS"]=9,e[t[10]="GRAPHS"]=10,e}(),t}(),o.ValueInfoProto=function(){function t(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.name="",t.prototype.type=null,t.prototype.docString="",t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=u.create()),null!=t.name&&t.hasOwnProperty("name")&&e.uint32(10).string(t.name),null!=t.type&&t.hasOwnProperty("type")&&c.onnx.TypeProto.encode(t.type,e.uint32(18).fork()).ldelim(),null!=t.docString&&t.hasOwnProperty("docString")&&e.uint32(26).string(t.docString),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.ValueInfoProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.name=t.string();break;case 2:n.type=c.onnx.TypeProto.decode(t,t.uint32());break;case 3:n.docString=t.string();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.name&&t.hasOwnProperty("name")&&!l.isString(t.name))return"name: string expected";if(null!=t.type&&t.hasOwnProperty("type")){var e=c.onnx.TypeProto.verify(t.type);if(e)return"type."+e}return null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString)?"docString: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.ValueInfoProto)return t;var e=new c.onnx.ValueInfoProto;if(null!=t.name&&(e.name=String(t.name)),null!=t.type){if("object"!=typeof t.type)throw TypeError(".onnx.ValueInfoProto.type: object expected");e.type=c.onnx.TypeProto.fromObject(t.type)}return null!=t.docString&&(e.docString=String(t.docString)),e},t.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.name="",r.type=null,r.docString=""),null!=t.name&&t.hasOwnProperty("name")&&(r.name=t.name),null!=t.type&&t.hasOwnProperty("type")&&(r.type=c.onnx.TypeProto.toObject(t.type,e)),null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.NodeProto=function(){function t(t){if(this.input=[],this.output=[],this.attribute=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.input=l.emptyArray,t.prototype.output=l.emptyArray,t.prototype.name="",t.prototype.opType="",t.prototype.domain="",t.prototype.attribute=l.emptyArray,t.prototype.docString="",t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=u.create()),null!=t.input&&t.input.length)for(var r=0;r<t.input.length;++r)e.uint32(10).string(t.input[r]);if(null!=t.output&&t.output.length)for(r=0;r<t.output.length;++r)e.uint32(18).string(t.output[r]);if(null!=t.name&&t.hasOwnProperty("name")&&e.uint32(26).string(t.name),null!=t.opType&&t.hasOwnProperty("opType")&&e.uint32(34).string(t.opType),null!=t.attribute&&t.attribute.length)for(r=0;r<t.attribute.length;++r)c.onnx.AttributeProto.encode(t.attribute[r],e.uint32(42).fork()).ldelim();return null!=t.docString&&t.hasOwnProperty("docString")&&e.uint32(50).string(t.docString),null!=t.domain&&t.hasOwnProperty("domain")&&e.uint32(58).string(t.domain),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.NodeProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.input&&n.input.length||(n.input=[]),n.input.push(t.string());break;case 2:n.output&&n.output.length||(n.output=[]),n.output.push(t.string());break;case 3:n.name=t.string();break;case 4:n.opType=t.string();break;case 7:n.domain=t.string();break;case 5:n.attribute&&n.attribute.length||(n.attribute=[]),n.attribute.push(c.onnx.AttributeProto.decode(t,t.uint32()));break;case 6:n.docString=t.string();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.input&&t.hasOwnProperty("input")){if(!Array.isArray(t.input))return"input: array expected";for(var e=0;e<t.input.length;++e)if(!l.isString(t.input[e]))return"input: string[] expected"}if(null!=t.output&&t.hasOwnProperty("output")){if(!Array.isArray(t.output))return"output: array expected";for(e=0;e<t.output.length;++e)if(!l.isString(t.output[e]))return"output: string[] expected"}if(null!=t.name&&t.hasOwnProperty("name")&&!l.isString(t.name))return"name: string expected";if(null!=t.opType&&t.hasOwnProperty("opType")&&!l.isString(t.opType))return"opType: string expected";if(null!=t.domain&&t.hasOwnProperty("domain")&&!l.isString(t.domain))return"domain: string expected";if(null!=t.attribute&&t.hasOwnProperty("attribute")){if(!Array.isArray(t.attribute))return"attribute: array expected";for(e=0;e<t.attribute.length;++e){var r=c.onnx.AttributeProto.verify(t.attribute[e]);if(r)return"attribute."+r}}return null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString)?"docString: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.NodeProto)return t;var e=new c.onnx.NodeProto;if(t.input){if(!Array.isArray(t.input))throw TypeError(".onnx.NodeProto.input: array expected");e.input=[];for(var r=0;r<t.input.length;++r)e.input[r]=String(t.input[r])}if(t.output){if(!Array.isArray(t.output))throw TypeError(".onnx.NodeProto.output: array expected");for(e.output=[],r=0;r<t.output.length;++r)e.output[r]=String(t.output[r])}if(null!=t.name&&(e.name=String(t.name)),null!=t.opType&&(e.opType=String(t.opType)),null!=t.domain&&(e.domain=String(t.domain)),t.attribute){if(!Array.isArray(t.attribute))throw TypeError(".onnx.NodeProto.attribute: array expected");for(e.attribute=[],r=0;r<t.attribute.length;++r){if("object"!=typeof t.attribute[r])throw TypeError(".onnx.NodeProto.attribute: object expected");e.attribute[r]=c.onnx.AttributeProto.fromObject(t.attribute[r])}}return null!=t.docString&&(e.docString=String(t.docString)),e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.input=[],r.output=[],r.attribute=[]),e.defaults&&(r.name="",r.opType="",r.docString="",r.domain=""),t.input&&t.input.length){r.input=[];for(var n=0;n<t.input.length;++n)r.input[n]=t.input[n]}if(t.output&&t.output.length)for(r.output=[],n=0;n<t.output.length;++n)r.output[n]=t.output[n];if(null!=t.name&&t.hasOwnProperty("name")&&(r.name=t.name),null!=t.opType&&t.hasOwnProperty("opType")&&(r.opType=t.opType),t.attribute&&t.attribute.length)for(r.attribute=[],n=0;n<t.attribute.length;++n)r.attribute[n]=c.onnx.AttributeProto.toObject(t.attribute[n],e);return null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),null!=t.domain&&t.hasOwnProperty("domain")&&(r.domain=t.domain),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.ModelProto=function(){function t(t){if(this.opsetImport=[],this.metadataProps=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.irVersion=l.Long?l.Long.fromBits(0,0,!1):0,t.prototype.opsetImport=l.emptyArray,t.prototype.producerName="",t.prototype.producerVersion="",t.prototype.domain="",t.prototype.modelVersion=l.Long?l.Long.fromBits(0,0,!1):0,t.prototype.docString="",t.prototype.graph=null,t.prototype.metadataProps=l.emptyArray,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=u.create()),null!=t.irVersion&&t.hasOwnProperty("irVersion")&&e.uint32(8).int64(t.irVersion),null!=t.producerName&&t.hasOwnProperty("producerName")&&e.uint32(18).string(t.producerName),null!=t.producerVersion&&t.hasOwnProperty("producerVersion")&&e.uint32(26).string(t.producerVersion),null!=t.domain&&t.hasOwnProperty("domain")&&e.uint32(34).string(t.domain),null!=t.modelVersion&&t.hasOwnProperty("modelVersion")&&e.uint32(40).int64(t.modelVersion),null!=t.docString&&t.hasOwnProperty("docString")&&e.uint32(50).string(t.docString),null!=t.graph&&t.hasOwnProperty("graph")&&c.onnx.GraphProto.encode(t.graph,e.uint32(58).fork()).ldelim(),null!=t.opsetImport&&t.opsetImport.length)for(var r=0;r<t.opsetImport.length;++r)c.onnx.OperatorSetIdProto.encode(t.opsetImport[r],e.uint32(66).fork()).ldelim();if(null!=t.metadataProps&&t.metadataProps.length)for(r=0;r<t.metadataProps.length;++r)c.onnx.StringStringEntryProto.encode(t.metadataProps[r],e.uint32(114).fork()).ldelim();return e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.ModelProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.irVersion=t.int64();break;case 8:n.opsetImport&&n.opsetImport.length||(n.opsetImport=[]),n.opsetImport.push(c.onnx.OperatorSetIdProto.decode(t,t.uint32()));break;case 2:n.producerName=t.string();break;case 3:n.producerVersion=t.string();break;case 4:n.domain=t.string();break;case 5:n.modelVersion=t.int64();break;case 6:n.docString=t.string();break;case 7:n.graph=c.onnx.GraphProto.decode(t,t.uint32());break;case 14:n.metadataProps&&n.metadataProps.length||(n.metadataProps=[]),n.metadataProps.push(c.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.irVersion&&t.hasOwnProperty("irVersion")&&!(l.isInteger(t.irVersion)||t.irVersion&&l.isInteger(t.irVersion.low)&&l.isInteger(t.irVersion.high)))return"irVersion: integer|Long expected";if(null!=t.opsetImport&&t.hasOwnProperty("opsetImport")){if(!Array.isArray(t.opsetImport))return"opsetImport: array expected";for(var e,r=0;r<t.opsetImport.length;++r)if(e=c.onnx.OperatorSetIdProto.verify(t.opsetImport[r]))return"opsetImport."+e}if(null!=t.producerName&&t.hasOwnProperty("producerName")&&!l.isString(t.producerName))return"producerName: string expected";if(null!=t.producerVersion&&t.hasOwnProperty("producerVersion")&&!l.isString(t.producerVersion))return"producerVersion: string expected";if(null!=t.domain&&t.hasOwnProperty("domain")&&!l.isString(t.domain))return"domain: string expected";if(null!=t.modelVersion&&t.hasOwnProperty("modelVersion")&&!(l.isInteger(t.modelVersion)||t.modelVersion&&l.isInteger(t.modelVersion.low)&&l.isInteger(t.modelVersion.high)))return"modelVersion: integer|Long expected";if(null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString))return"docString: string expected";if(null!=t.graph&&t.hasOwnProperty("graph")&&(e=c.onnx.GraphProto.verify(t.graph)))return"graph."+e;if(null!=t.metadataProps&&t.hasOwnProperty("metadataProps")){if(!Array.isArray(t.metadataProps))return"metadataProps: array expected";for(r=0;r<t.metadataProps.length;++r)if(e=c.onnx.StringStringEntryProto.verify(t.metadataProps[r]))return"metadataProps."+e}return null},t.fromObject=function(t){if(t instanceof c.onnx.ModelProto)return t;var e=new c.onnx.ModelProto;if(null!=t.irVersion&&(l.Long?(e.irVersion=l.Long.fromValue(t.irVersion)).unsigned=!1:"string"==typeof t.irVersion?e.irVersion=parseInt(t.irVersion,10):"number"==typeof t.irVersion?e.irVersion=t.irVersion:"object"==typeof t.irVersion&&(e.irVersion=new l.LongBits(t.irVersion.low>>>0,t.irVersion.high>>>0).toNumber())),t.opsetImport){if(!Array.isArray(t.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");e.opsetImport=[];for(var r=0;r<t.opsetImport.length;++r){if("object"!=typeof t.opsetImport[r])throw TypeError(".onnx.ModelProto.opsetImport: object expected");e.opsetImport[r]=c.onnx.OperatorSetIdProto.fromObject(t.opsetImport[r])}}if(null!=t.producerName&&(e.producerName=String(t.producerName)),null!=t.producerVersion&&(e.producerVersion=String(t.producerVersion)),null!=t.domain&&(e.domain=String(t.domain)),null!=t.modelVersion&&(l.Long?(e.modelVersion=l.Long.fromValue(t.modelVersion)).unsigned=!1:"string"==typeof t.modelVersion?e.modelVersion=parseInt(t.modelVersion,10):"number"==typeof t.modelVersion?e.modelVersion=t.modelVersion:"object"==typeof t.modelVersion&&(e.modelVersion=new l.LongBits(t.modelVersion.low>>>0,t.modelVersion.high>>>0).toNumber())),null!=t.docString&&(e.docString=String(t.docString)),null!=t.graph){if("object"!=typeof t.graph)throw TypeError(".onnx.ModelProto.graph: object expected");e.graph=c.onnx.GraphProto.fromObject(t.graph)}if(t.metadataProps){if(!Array.isArray(t.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(e.metadataProps=[],r=0;r<t.metadataProps.length;++r){if("object"!=typeof t.metadataProps[r])throw TypeError(".onnx.ModelProto.metadataProps: object expected");e.metadataProps[r]=c.onnx.StringStringEntryProto.fromObject(t.metadataProps[r])}}return e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.opsetImport=[],r.metadataProps=[]),e.defaults){if(l.Long){var n=new l.Long(0,0,!1);r.irVersion=e.longs===String?n.toString():e.longs===Number?n.toNumber():n}else r.irVersion=e.longs===String?"0":0;r.producerName="",r.producerVersion="",r.domain="",l.Long?(n=new l.Long(0,0,!1),r.modelVersion=e.longs===String?n.toString():e.longs===Number?n.toNumber():n):r.modelVersion=e.longs===String?"0":0,r.docString="",r.graph=null}if(null!=t.irVersion&&t.hasOwnProperty("irVersion")&&("number"==typeof t.irVersion?r.irVersion=e.longs===String?String(t.irVersion):t.irVersion:r.irVersion=e.longs===String?l.Long.prototype.toString.call(t.irVersion):e.longs===Number?new l.LongBits(t.irVersion.low>>>0,t.irVersion.high>>>0).toNumber():t.irVersion),null!=t.producerName&&t.hasOwnProperty("producerName")&&(r.producerName=t.producerName),null!=t.producerVersion&&t.hasOwnProperty("producerVersion")&&(r.producerVersion=t.producerVersion),null!=t.domain&&t.hasOwnProperty("domain")&&(r.domain=t.domain),null!=t.modelVersion&&t.hasOwnProperty("modelVersion")&&("number"==typeof t.modelVersion?r.modelVersion=e.longs===String?String(t.modelVersion):t.modelVersion:r.modelVersion=e.longs===String?l.Long.prototype.toString.call(t.modelVersion):e.longs===Number?new l.LongBits(t.modelVersion.low>>>0,t.modelVersion.high>>>0).toNumber():t.modelVersion),null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),null!=t.graph&&t.hasOwnProperty("graph")&&(r.graph=c.onnx.GraphProto.toObject(t.graph,e)),t.opsetImport&&t.opsetImport.length){r.opsetImport=[];for(var i=0;i<t.opsetImport.length;++i)r.opsetImport[i]=c.onnx.OperatorSetIdProto.toObject(t.opsetImport[i],e)}if(t.metadataProps&&t.metadataProps.length)for(r.metadataProps=[],i=0;i<t.metadataProps.length;++i)r.metadataProps[i]=c.onnx.StringStringEntryProto.toObject(t.metadataProps[i],e);return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.StringStringEntryProto=function(){function t(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.key="",t.prototype.value="",t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=u.create()),null!=t.key&&t.hasOwnProperty("key")&&e.uint32(10).string(t.key),null!=t.value&&t.hasOwnProperty("value")&&e.uint32(18).string(t.value),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.StringStringEntryProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.key=t.string();break;case 2:n.value=t.string();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.key&&t.hasOwnProperty("key")&&!l.isString(t.key)?"key: string expected":null!=t.value&&t.hasOwnProperty("value")&&!l.isString(t.value)?"value: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.StringStringEntryProto)return t;var e=new c.onnx.StringStringEntryProto;return null!=t.key&&(e.key=String(t.key)),null!=t.value&&(e.value=String(t.value)),e},t.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.key="",r.value=""),null!=t.key&&t.hasOwnProperty("key")&&(r.key=t.key),null!=t.value&&t.hasOwnProperty("value")&&(r.value=t.value),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.TensorAnnotation=function(){function t(t){if(this.quantParameterTensorNames=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.tensorName="",t.prototype.quantParameterTensorNames=l.emptyArray,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=u.create()),null!=t.tensorName&&t.hasOwnProperty("tensorName")&&e.uint32(10).string(t.tensorName),null!=t.quantParameterTensorNames&&t.quantParameterTensorNames.length)for(var r=0;r<t.quantParameterTensorNames.length;++r)c.onnx.StringStringEntryProto.encode(t.quantParameterTensorNames[r],e.uint32(18).fork()).ldelim();return e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.TensorAnnotation;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.tensorName=t.string();break;case 2:n.quantParameterTensorNames&&n.quantParameterTensorNames.length||(n.quantParameterTensorNames=[]),n.quantParameterTensorNames.push(c.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.tensorName&&t.hasOwnProperty("tensorName")&&!l.isString(t.tensorName))return"tensorName: string expected";if(null!=t.quantParameterTensorNames&&t.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(t.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var e=0;e<t.quantParameterTensorNames.length;++e){var r=c.onnx.StringStringEntryProto.verify(t.quantParameterTensorNames[e]);if(r)return"quantParameterTensorNames."+r}}return null},t.fromObject=function(t){if(t instanceof c.onnx.TensorAnnotation)return t;var e=new c.onnx.TensorAnnotation;if(null!=t.tensorName&&(e.tensorName=String(t.tensorName)),t.quantParameterTensorNames){if(!Array.isArray(t.quantParameterTensorNames))throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: array expected");e.quantParameterTensorNames=[];for(var r=0;r<t.quantParameterTensorNames.length;++r){if("object"!=typeof t.quantParameterTensorNames[r])throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: object expected");e.quantParameterTensorNames[r]=c.onnx.StringStringEntryProto.fromObject(t.quantParameterTensorNames[r])}}return e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.quantParameterTensorNames=[]),e.defaults&&(r.tensorName=""),null!=t.tensorName&&t.hasOwnProperty("tensorName")&&(r.tensorName=t.tensorName),t.quantParameterTensorNames&&t.quantParameterTensorNames.length){r.quantParameterTensorNames=[];for(var n=0;n<t.quantParameterTensorNames.length;++n)r.quantParameterTensorNames[n]=c.onnx.StringStringEntryProto.toObject(t.quantParameterTensorNames[n],e)}return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.GraphProto=function(){function t(t){if(this.node=[],this.initializer=[],this.input=[],this.output=[],this.valueInfo=[],this.quantizationAnnotation=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.node=l.emptyArray,t.prototype.name="",t.prototype.initializer=l.emptyArray,t.prototype.docString="",t.prototype.input=l.emptyArray,t.prototype.output=l.emptyArray,t.prototype.valueInfo=l.emptyArray,t.prototype.quantizationAnnotation=l.emptyArray,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=u.create()),null!=t.node&&t.node.length)for(var r=0;r<t.node.length;++r)c.onnx.NodeProto.encode(t.node[r],e.uint32(10).fork()).ldelim();if(null!=t.name&&t.hasOwnProperty("name")&&e.uint32(18).string(t.name),null!=t.initializer&&t.initializer.length)for(r=0;r<t.initializer.length;++r)c.onnx.TensorProto.encode(t.initializer[r],e.uint32(42).fork()).ldelim();if(null!=t.docString&&t.hasOwnProperty("docString")&&e.uint32(82).string(t.docString),null!=t.input&&t.input.length)for(r=0;r<t.input.length;++r)c.onnx.ValueInfoProto.encode(t.input[r],e.uint32(90).fork()).ldelim();if(null!=t.output&&t.output.length)for(r=0;r<t.output.length;++r)c.onnx.ValueInfoProto.encode(t.output[r],e.uint32(98).fork()).ldelim();if(null!=t.valueInfo&&t.valueInfo.length)for(r=0;r<t.valueInfo.length;++r)c.onnx.ValueInfoProto.encode(t.valueInfo[r],e.uint32(106).fork()).ldelim();if(null!=t.quantizationAnnotation&&t.quantizationAnnotation.length)for(r=0;r<t.quantizationAnnotation.length;++r)c.onnx.TensorAnnotation.encode(t.quantizationAnnotation[r],e.uint32(114).fork()).ldelim();return e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.GraphProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.node&&n.node.length||(n.node=[]),n.node.push(c.onnx.NodeProto.decode(t,t.uint32()));break;case 2:n.name=t.string();break;case 5:n.initializer&&n.initializer.length||(n.initializer=[]),n.initializer.push(c.onnx.TensorProto.decode(t,t.uint32()));break;case 10:n.docString=t.string();break;case 11:n.input&&n.input.length||(n.input=[]),n.input.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 12:n.output&&n.output.length||(n.output=[]),n.output.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 13:n.valueInfo&&n.valueInfo.length||(n.valueInfo=[]),n.valueInfo.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 14:n.quantizationAnnotation&&n.quantizationAnnotation.length||(n.quantizationAnnotation=[]),n.quantizationAnnotation.push(c.onnx.TensorAnnotation.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.node&&t.hasOwnProperty("node")){if(!Array.isArray(t.node))return"node: array expected";for(var e,r=0;r<t.node.length;++r)if(e=c.onnx.NodeProto.verify(t.node[r]))return"node."+e}if(null!=t.name&&t.hasOwnProperty("name")&&!l.isString(t.name))return"name: string expected";if(null!=t.initializer&&t.hasOwnProperty("initializer")){if(!Array.isArray(t.initializer))return"initializer: array expected";for(r=0;r<t.initializer.length;++r)if(e=c.onnx.TensorProto.verify(t.initializer[r]))return"initializer."+e}if(null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString))return"docString: string expected";if(null!=t.input&&t.hasOwnProperty("input")){if(!Array.isArray(t.input))return"input: array expected";for(r=0;r<t.input.length;++r)if(e=c.onnx.ValueInfoProto.verify(t.input[r]))return"input."+e}if(null!=t.output&&t.hasOwnProperty("output")){if(!Array.isArray(t.output))return"output: array expected";for(r=0;r<t.output.length;++r)if(e=c.onnx.ValueInfoProto.verify(t.output[r]))return"output."+e}if(null!=t.valueInfo&&t.hasOwnProperty("valueInfo")){if(!Array.isArray(t.valueInfo))return"valueInfo: array expected";for(r=0;r<t.valueInfo.length;++r)if(e=c.onnx.ValueInfoProto.verify(t.valueInfo[r]))return"valueInfo."+e}if(null!=t.quantizationAnnotation&&t.hasOwnProperty("quantizationAnnotation")){if(!Array.isArray(t.quantizationAnnotation))return"quantizationAnnotation: array expected";for(r=0;r<t.quantizationAnnotation.length;++r)if(e=c.onnx.TensorAnnotation.verify(t.quantizationAnnotation[r]))return"quantizationAnnotation."+e}return null},t.fromObject=function(t){if(t instanceof c.onnx.GraphProto)return t;var e=new c.onnx.GraphProto;if(t.node){if(!Array.isArray(t.node))throw TypeError(".onnx.GraphProto.node: array expected");e.node=[];for(var r=0;r<t.node.length;++r){if("object"!=typeof t.node[r])throw TypeError(".onnx.GraphProto.node: object expected");e.node[r]=c.onnx.NodeProto.fromObject(t.node[r])}}if(null!=t.name&&(e.name=String(t.name)),t.initializer){if(!Array.isArray(t.initializer))throw TypeError(".onnx.GraphProto.initializer: array expected");for(e.initializer=[],r=0;r<t.initializer.length;++r){if("object"!=typeof t.initializer[r])throw TypeError(".onnx.GraphProto.initializer: object expected");e.initializer[r]=c.onnx.TensorProto.fromObject(t.initializer[r])}}if(null!=t.docString&&(e.docString=String(t.docString)),t.input){if(!Array.isArray(t.input))throw TypeError(".onnx.GraphProto.input: array expected");for(e.input=[],r=0;r<t.input.length;++r){if("object"!=typeof t.input[r])throw TypeError(".onnx.GraphProto.input: object expected");e.input[r]=c.onnx.ValueInfoProto.fromObject(t.input[r])}}if(t.output){if(!Array.isArray(t.output))throw TypeError(".onnx.GraphProto.output: array expected");for(e.output=[],r=0;r<t.output.length;++r){if("object"!=typeof t.output[r])throw TypeError(".onnx.GraphProto.output: object expected");e.output[r]=c.onnx.ValueInfoProto.fromObject(t.output[r])}}if(t.valueInfo){if(!Array.isArray(t.valueInfo))throw TypeError(".onnx.GraphProto.valueInfo: array expected");for(e.valueInfo=[],r=0;r<t.valueInfo.length;++r){if("object"!=typeof t.valueInfo[r])throw TypeError(".onnx.GraphProto.valueInfo: object expected");e.valueInfo[r]=c.onnx.ValueInfoProto.fromObject(t.valueInfo[r])}}if(t.quantizationAnnotation){if(!Array.isArray(t.quantizationAnnotation))throw TypeError(".onnx.GraphProto.quantizationAnnotation: array expected");for(e.quantizationAnnotation=[],r=0;r<t.quantizationAnnotation.length;++r){if("object"!=typeof t.quantizationAnnotation[r])throw TypeError(".onnx.GraphProto.quantizationAnnotation: object expected");e.quantizationAnnotation[r]=c.onnx.TensorAnnotation.fromObject(t.quantizationAnnotation[r])}}return e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.node=[],r.initializer=[],r.input=[],r.output=[],r.valueInfo=[],r.quantizationAnnotation=[]),e.defaults&&(r.name="",r.docString=""),t.node&&t.node.length){r.node=[];for(var n=0;n<t.node.length;++n)r.node[n]=c.onnx.NodeProto.toObject(t.node[n],e)}if(null!=t.name&&t.hasOwnProperty("name")&&(r.name=t.name),t.initializer&&t.initializer.length)for(r.initializer=[],n=0;n<t.initializer.length;++n)r.initializer[n]=c.onnx.TensorProto.toObject(t.initializer[n],e);if(null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),t.input&&t.input.length)for(r.input=[],n=0;n<t.input.length;++n)r.input[n]=c.onnx.ValueInfoProto.toObject(t.input[n],e);if(t.output&&t.output.length)for(r.output=[],n=0;n<t.output.length;++n)r.output[n]=c.onnx.ValueInfoProto.toObject(t.output[n],e);if(t.valueInfo&&t.valueInfo.length)for(r.valueInfo=[],n=0;n<t.valueInfo.length;++n)r.valueInfo[n]=c.onnx.ValueInfoProto.toObject(t.valueInfo[n],e);if(t.quantizationAnnotation&&t.quantizationAnnotation.length)for(r.quantizationAnnotation=[],n=0;n<t.quantizationAnnotation.length;++n)r.quantizationAnnotation[n]=c.onnx.TensorAnnotation.toObject(t.quantizationAnnotation[n],e);return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.TensorProto=function(){function t(t){if(this.dims=[],this.floatData=[],this.int32Data=[],this.stringData=[],this.int64Data=[],this.externalData=[],this.doubleData=[],this.uint64Data=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.dims=l.emptyArray,t.prototype.dataType=0,t.prototype.segment=null,t.prototype.floatData=l.emptyArray,t.prototype.int32Data=l.emptyArray,t.prototype.stringData=l.emptyArray,t.prototype.int64Data=l.emptyArray,t.prototype.name="",t.prototype.docString="",t.prototype.rawData=l.newBuffer([]),t.prototype.externalData=l.emptyArray,t.prototype.dataLocation=0,t.prototype.doubleData=l.emptyArray,t.prototype.uint64Data=l.emptyArray,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=u.create()),null!=t.dims&&t.dims.length){e.uint32(10).fork();for(var r=0;r<t.dims.length;++r)e.int64(t.dims[r]);e.ldelim()}if(null!=t.dataType&&t.hasOwnProperty("dataType")&&e.uint32(16).int32(t.dataType),null!=t.segment&&t.hasOwnProperty("segment")&&c.onnx.TensorProto.Segment.encode(t.segment,e.uint32(26).fork()).ldelim(),null!=t.floatData&&t.floatData.length){for(e.uint32(34).fork(),r=0;r<t.floatData.length;++r)e.float(t.floatData[r]);e.ldelim()}if(null!=t.int32Data&&t.int32Data.length){for(e.uint32(42).fork(),r=0;r<t.int32Data.length;++r)e.int32(t.int32Data[r]);e.ldelim()}if(null!=t.stringData&&t.stringData.length)for(r=0;r<t.stringData.length;++r)e.uint32(50).bytes(t.stringData[r]);if(null!=t.int64Data&&t.int64Data.length){for(e.uint32(58).fork(),r=0;r<t.int64Data.length;++r)e.int64(t.int64Data[r]);e.ldelim()}if(null!=t.name&&t.hasOwnProperty("name")&&e.uint32(66).string(t.name),null!=t.rawData&&t.hasOwnProperty("rawData")&&e.uint32(74).bytes(t.rawData),null!=t.doubleData&&t.doubleData.length){for(e.uint32(82).fork(),r=0;r<t.doubleData.length;++r)e.double(t.doubleData[r]);e.ldelim()}if(null!=t.uint64Data&&t.uint64Data.length){for(e.uint32(90).fork(),r=0;r<t.uint64Data.length;++r)e.uint64(t.uint64Data[r]);e.ldelim()}if(null!=t.docString&&t.hasOwnProperty("docString")&&e.uint32(98).string(t.docString),null!=t.externalData&&t.externalData.length)for(r=0;r<t.externalData.length;++r)c.onnx.StringStringEntryProto.encode(t.externalData[r],e.uint32(106).fork()).ldelim();return null!=t.dataLocation&&t.hasOwnProperty("dataLocation")&&e.uint32(112).int32(t.dataLocation),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.TensorProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:if(n.dims&&n.dims.length||(n.dims=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos<o;)n.dims.push(t.int64());else n.dims.push(t.int64());break;case 2:n.dataType=t.int32();break;case 3:n.segment=c.onnx.TensorProto.Segment.decode(t,t.uint32());break;case 4:if(n.floatData&&n.floatData.length||(n.floatData=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)n.floatData.push(t.float());else n.floatData.push(t.float());break;case 5:if(n.int32Data&&n.int32Data.length||(n.int32Data=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)n.int32Data.push(t.int32());else n.int32Data.push(t.int32());break;case 6:n.stringData&&n.stringData.length||(n.stringData=[]),n.stringData.push(t.bytes());break;case 7:if(n.int64Data&&n.int64Data.length||(n.int64Data=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)n.int64Data.push(t.int64());else n.int64Data.push(t.int64());break;case 8:n.name=t.string();break;case 12:n.docString=t.string();break;case 9:n.rawData=t.bytes();break;case 13:n.externalData&&n.externalData.length||(n.externalData=[]),n.externalData.push(c.onnx.StringStringEntryProto.decode(t,t.uint32()));break;case 14:n.dataLocation=t.int32();break;case 10:if(n.doubleData&&n.doubleData.length||(n.doubleData=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)n.doubleData.push(t.double());else n.doubleData.push(t.double());break;case 11:if(n.uint64Data&&n.uint64Data.length||(n.uint64Data=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)n.uint64Data.push(t.uint64());else n.uint64Data.push(t.uint64());break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.dims&&t.hasOwnProperty("dims")){if(!Array.isArray(t.dims))return"dims: array expected";for(var e,r=0;r<t.dims.length;++r)if(!(l.isInteger(t.dims[r])||t.dims[r]&&l.isInteger(t.dims[r].low)&&l.isInteger(t.dims[r].high)))return"dims: integer|Long[] expected"}if(null!=t.dataType&&t.hasOwnProperty("dataType")&&!l.isInteger(t.dataType))return"dataType: integer expected";if(null!=t.segment&&t.hasOwnProperty("segment")&&(e=c.onnx.TensorProto.Segment.verify(t.segment)))return"segment."+e;if(null!=t.floatData&&t.hasOwnProperty("floatData")){if(!Array.isArray(t.floatData))return"floatData: array expected";for(r=0;r<t.floatData.length;++r)if("number"!=typeof t.floatData[r])return"floatData: number[] expected"}if(null!=t.int32Data&&t.hasOwnProperty("int32Data")){if(!Array.isArray(t.int32Data))return"int32Data: array expected";for(r=0;r<t.int32Data.length;++r)if(!l.isInteger(t.int32Data[r]))return"int32Data: integer[] expected"}if(null!=t.stringData&&t.hasOwnProperty("stringData")){if(!Array.isArray(t.stringData))return"stringData: array expected";for(r=0;r<t.stringData.length;++r)if(!(t.stringData[r]&&"number"==typeof t.stringData[r].length||l.isString(t.stringData[r])))return"stringData: buffer[] expected"}if(null!=t.int64Data&&t.hasOwnProperty("int64Data")){if(!Array.isArray(t.int64Data))return"int64Data: array expected";for(r=0;r<t.int64Data.length;++r)if(!(l.isInteger(t.int64Data[r])||t.int64Data[r]&&l.isInteger(t.int64Data[r].low)&&l.isInteger(t.int64Data[r].high)))return"int64Data: integer|Long[] expected"}if(null!=t.name&&t.hasOwnProperty("name")&&!l.isString(t.name))return"name: string expected";if(null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString))return"docString: string expected";if(null!=t.rawData&&t.hasOwnProperty("rawData")&&!(t.rawData&&"number"==typeof t.rawData.length||l.isString(t.rawData)))return"rawData: buffer expected";if(null!=t.externalData&&t.hasOwnProperty("externalData")){if(!Array.isArray(t.externalData))return"externalData: array expected";for(r=0;r<t.externalData.length;++r)if(e=c.onnx.StringStringEntryProto.verify(t.externalData[r]))return"externalData."+e}if(null!=t.dataLocation&&t.hasOwnProperty("dataLocation"))switch(t.dataLocation){default:return"dataLocation: enum value expected";case 0:case 1:}if(null!=t.doubleData&&t.hasOwnProperty("doubleData")){if(!Array.isArray(t.doubleData))return"doubleData: array expected";for(r=0;r<t.doubleData.length;++r)if("number"!=typeof t.doubleData[r])return"doubleData: number[] expected"}if(null!=t.uint64Data&&t.hasOwnProperty("uint64Data")){if(!Array.isArray(t.uint64Data))return"uint64Data: array expected";for(r=0;r<t.uint64Data.length;++r)if(!(l.isInteger(t.uint64Data[r])||t.uint64Data[r]&&l.isInteger(t.uint64Data[r].low)&&l.isInteger(t.uint64Data[r].high)))return"uint64Data: integer|Long[] expected"}return null},t.fromObject=function(t){if(t instanceof c.onnx.TensorProto)return t;var e=new c.onnx.TensorProto;if(t.dims){if(!Array.isArray(t.dims))throw TypeError(".onnx.TensorProto.dims: array expected");e.dims=[];for(var r=0;r<t.dims.length;++r)l.Long?(e.dims[r]=l.Long.fromValue(t.dims[r])).unsigned=!1:"string"==typeof t.dims[r]?e.dims[r]=parseInt(t.dims[r],10):"number"==typeof t.dims[r]?e.dims[r]=t.dims[r]:"object"==typeof t.dims[r]&&(e.dims[r]=new l.LongBits(t.dims[r].low>>>0,t.dims[r].high>>>0).toNumber())}if(null!=t.dataType&&(e.dataType=0|t.dataType),null!=t.segment){if("object"!=typeof t.segment)throw TypeError(".onnx.TensorProto.segment: object expected");e.segment=c.onnx.TensorProto.Segment.fromObject(t.segment)}if(t.floatData){if(!Array.isArray(t.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(e.floatData=[],r=0;r<t.floatData.length;++r)e.floatData[r]=Number(t.floatData[r])}if(t.int32Data){if(!Array.isArray(t.int32Data))throw TypeError(".onnx.TensorProto.int32Data: array expected");for(e.int32Data=[],r=0;r<t.int32Data.length;++r)e.int32Data[r]=0|t.int32Data[r]}if(t.stringData){if(!Array.isArray(t.stringData))throw TypeError(".onnx.TensorProto.stringData: array expected");for(e.stringData=[],r=0;r<t.stringData.length;++r)"string"==typeof t.stringData[r]?l.base64.decode(t.stringData[r],e.stringData[r]=l.newBuffer(l.base64.length(t.stringData[r])),0):t.stringData[r].length&&(e.stringData[r]=t.stringData[r])}if(t.int64Data){if(!Array.isArray(t.int64Data))throw TypeError(".onnx.TensorProto.int64Data: array expected");for(e.int64Data=[],r=0;r<t.int64Data.length;++r)l.Long?(e.int64Data[r]=l.Long.fromValue(t.int64Data[r])).unsigned=!1:"string"==typeof t.int64Data[r]?e.int64Data[r]=parseInt(t.int64Data[r],10):"number"==typeof t.int64Data[r]?e.int64Data[r]=t.int64Data[r]:"object"==typeof t.int64Data[r]&&(e.int64Data[r]=new l.LongBits(t.int64Data[r].low>>>0,t.int64Data[r].high>>>0).toNumber())}if(null!=t.name&&(e.name=String(t.name)),null!=t.docString&&(e.docString=String(t.docString)),null!=t.rawData&&("string"==typeof t.rawData?l.base64.decode(t.rawData,e.rawData=l.newBuffer(l.base64.length(t.rawData)),0):t.rawData.length&&(e.rawData=t.rawData)),t.externalData){if(!Array.isArray(t.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(e.externalData=[],r=0;r<t.externalData.length;++r){if("object"!=typeof t.externalData[r])throw TypeError(".onnx.TensorProto.externalData: object expected");e.externalData[r]=c.onnx.StringStringEntryProto.fromObject(t.externalData[r])}}switch(t.dataLocation){case"DEFAULT":case 0:e.dataLocation=0;break;case"EXTERNAL":case 1:e.dataLocation=1}if(t.doubleData){if(!Array.isArray(t.doubleData))throw TypeError(".onnx.TensorProto.doubleData: array expected");for(e.doubleData=[],r=0;r<t.doubleData.length;++r)e.doubleData[r]=Number(t.doubleData[r])}if(t.uint64Data){if(!Array.isArray(t.uint64Data))throw TypeError(".onnx.TensorProto.uint64Data: array expected");for(e.uint64Data=[],r=0;r<t.uint64Data.length;++r)l.Long?(e.uint64Data[r]=l.Long.fromValue(t.uint64Data[r])).unsigned=!0:"string"==typeof t.uint64Data[r]?e.uint64Data[r]=parseInt(t.uint64Data[r],10):"number"==typeof t.uint64Data[r]?e.uint64Data[r]=t.uint64Data[r]:"object"==typeof t.uint64Data[r]&&(e.uint64Data[r]=new l.LongBits(t.uint64Data[r].low>>>0,t.uint64Data[r].high>>>0).toNumber(!0))}return e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.dims=[],r.floatData=[],r.int32Data=[],r.stringData=[],r.int64Data=[],r.doubleData=[],r.uint64Data=[],r.externalData=[]),e.defaults&&(r.dataType=0,r.segment=null,r.name="",e.bytes===String?r.rawData="":(r.rawData=[],e.bytes!==Array&&(r.rawData=l.newBuffer(r.rawData))),r.docString="",r.dataLocation=e.enums===String?"DEFAULT":0),t.dims&&t.dims.length){r.dims=[];for(var n=0;n<t.dims.length;++n)"number"==typeof t.dims[n]?r.dims[n]=e.longs===String?String(t.dims[n]):t.dims[n]:r.dims[n]=e.longs===String?l.Long.prototype.toString.call(t.dims[n]):e.longs===Number?new l.LongBits(t.dims[n].low>>>0,t.dims[n].high>>>0).toNumber():t.dims[n]}if(null!=t.dataType&&t.hasOwnProperty("dataType")&&(r.dataType=t.dataType),null!=t.segment&&t.hasOwnProperty("segment")&&(r.segment=c.onnx.TensorProto.Segment.toObject(t.segment,e)),t.floatData&&t.floatData.length)for(r.floatData=[],n=0;n<t.floatData.length;++n)r.floatData[n]=e.json&&!isFinite(t.floatData[n])?String(t.floatData[n]):t.floatData[n];if(t.int32Data&&t.int32Data.length)for(r.int32Data=[],n=0;n<t.int32Data.length;++n)r.int32Data[n]=t.int32Data[n];if(t.stringData&&t.stringData.length)for(r.stringData=[],n=0;n<t.stringData.length;++n)r.stringData[n]=e.bytes===String?l.base64.encode(t.stringData[n],0,t.stringData[n].length):e.bytes===Array?Array.prototype.slice.call(t.stringData[n]):t.stringData[n];if(t.int64Data&&t.int64Data.length)for(r.int64Data=[],n=0;n<t.int64Data.length;++n)"number"==typeof t.int64Data[n]?r.int64Data[n]=e.longs===String?String(t.int64Data[n]):t.int64Data[n]:r.int64Data[n]=e.longs===String?l.Long.prototype.toString.call(t.int64Data[n]):e.longs===Number?new l.LongBits(t.int64Data[n].low>>>0,t.int64Data[n].high>>>0).toNumber():t.int64Data[n];if(null!=t.name&&t.hasOwnProperty("name")&&(r.name=t.name),null!=t.rawData&&t.hasOwnProperty("rawData")&&(r.rawData=e.bytes===String?l.base64.encode(t.rawData,0,t.rawData.length):e.bytes===Array?Array.prototype.slice.call(t.rawData):t.rawData),t.doubleData&&t.doubleData.length)for(r.doubleData=[],n=0;n<t.doubleData.length;++n)r.doubleData[n]=e.json&&!isFinite(t.doubleData[n])?String(t.doubleData[n]):t.doubleData[n];if(t.uint64Data&&t.uint64Data.length)for(r.uint64Data=[],n=0;n<t.uint64Data.length;++n)"number"==typeof t.uint64Data[n]?r.uint64Data[n]=e.longs===String?String(t.uint64Data[n]):t.uint64Data[n]:r.uint64Data[n]=e.longs===String?l.Long.prototype.toString.call(t.uint64Data[n]):e.longs===Number?new l.LongBits(t.uint64Data[n].low>>>0,t.uint64Data[n].high>>>0).toNumber(!0):t.uint64Data[n];if(null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),t.externalData&&t.externalData.length)for(r.externalData=[],n=0;n<t.externalData.length;++n)r.externalData[n]=c.onnx.StringStringEntryProto.toObject(t.externalData[n],e);return null!=t.dataLocation&&t.hasOwnProperty("dataLocation")&&(r.dataLocation=e.enums===String?c.onnx.TensorProto.DataLocation[t.dataLocation]:t.dataLocation),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t.DataType=function(){var t={},e=Object.create(t);return e[t[0]="UNDEFINED"]=0,e[t[1]="FLOAT"]=1,e[t[2]="UINT8"]=2,e[t[3]="INT8"]=3,e[t[4]="UINT16"]=4,e[t[5]="INT16"]=5,e[t[6]="INT32"]=6,e[t[7]="INT64"]=7,e[t[8]="STRING"]=8,e[t[9]="BOOL"]=9,e[t[10]="FLOAT16"]=10,e[t[11]="DOUBLE"]=11,e[t[12]="UINT32"]=12,e[t[13]="UINT64"]=13,e[t[14]="COMPLEX64"]=14,e[t[15]="COMPLEX128"]=15,e[t[16]="BFLOAT16"]=16,e}(),t.Segment=function(){function t(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.begin=l.Long?l.Long.fromBits(0,0,!1):0,t.prototype.end=l.Long?l.Long.fromBits(0,0,!1):0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=u.create()),null!=t.begin&&t.hasOwnProperty("begin")&&e.uint32(8).int64(t.begin),null!=t.end&&t.hasOwnProperty("end")&&e.uint32(16).int64(t.end),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.TensorProto.Segment;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.begin=t.int64();break;case 2:n.end=t.int64();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.begin&&t.hasOwnProperty("begin")&&!(l.isInteger(t.begin)||t.begin&&l.isInteger(t.begin.low)&&l.isInteger(t.begin.high))?"begin: integer|Long expected":null!=t.end&&t.hasOwnProperty("end")&&!(l.isInteger(t.end)||t.end&&l.isInteger(t.end.low)&&l.isInteger(t.end.high))?"end: integer|Long expected":null},t.fromObject=function(t){if(t instanceof c.onnx.TensorProto.Segment)return t;var e=new c.onnx.TensorProto.Segment;return null!=t.begin&&(l.Long?(e.begin=l.Long.fromValue(t.begin)).unsigned=!1:"string"==typeof t.begin?e.begin=parseInt(t.begin,10):"number"==typeof t.begin?e.begin=t.begin:"object"==typeof t.begin&&(e.begin=new l.LongBits(t.begin.low>>>0,t.begin.high>>>0).toNumber())),null!=t.end&&(l.Long?(e.end=l.Long.fromValue(t.end)).unsigned=!1:"string"==typeof t.end?e.end=parseInt(t.end,10):"number"==typeof t.end?e.end=t.end:"object"==typeof t.end&&(e.end=new l.LongBits(t.end.low>>>0,t.end.high>>>0).toNumber())),e},t.toObject=function(t,e){e||(e={});var r={};if(e.defaults){if(l.Long){var n=new l.Long(0,0,!1);r.begin=e.longs===String?n.toString():e.longs===Number?n.toNumber():n}else r.begin=e.longs===String?"0":0;l.Long?(n=new l.Long(0,0,!1),r.end=e.longs===String?n.toString():e.longs===Number?n.toNumber():n):r.end=e.longs===String?"0":0}return null!=t.begin&&t.hasOwnProperty("begin")&&("number"==typeof t.begin?r.begin=e.longs===String?String(t.begin):t.begin:r.begin=e.longs===String?l.Long.prototype.toString.call(t.begin):e.longs===Number?new l.LongBits(t.begin.low>>>0,t.begin.high>>>0).toNumber():t.begin),null!=t.end&&t.hasOwnProperty("end")&&("number"==typeof t.end?r.end=e.longs===String?String(t.end):t.end:r.end=e.longs===String?l.Long.prototype.toString.call(t.end):e.longs===Number?new l.LongBits(t.end.low>>>0,t.end.high>>>0).toNumber():t.end),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),t.DataLocation=function(){var t={},e=Object.create(t);return e[t[0]="DEFAULT"]=0,e[t[1]="EXTERNAL"]=1,e}(),t}(),o.TensorShapeProto=function(){function t(t){if(this.dim=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.dim=l.emptyArray,t.create=function(e){return new t(e)},t.encode=function(t,e){if(e||(e=u.create()),null!=t.dim&&t.dim.length)for(var r=0;r<t.dim.length;++r)c.onnx.TensorShapeProto.Dimension.encode(t.dim[r],e.uint32(10).fork()).ldelim();return e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.TensorShapeProto;t.pos<r;){var i=t.uint32();i>>>3==1?(n.dim&&n.dim.length||(n.dim=[]),n.dim.push(c.onnx.TensorShapeProto.Dimension.decode(t,t.uint32()))):t.skipType(7&i)}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.dim&&t.hasOwnProperty("dim")){if(!Array.isArray(t.dim))return"dim: array expected";for(var e=0;e<t.dim.length;++e){var r=c.onnx.TensorShapeProto.Dimension.verify(t.dim[e]);if(r)return"dim."+r}}return null},t.fromObject=function(t){if(t instanceof c.onnx.TensorShapeProto)return t;var e=new c.onnx.TensorShapeProto;if(t.dim){if(!Array.isArray(t.dim))throw TypeError(".onnx.TensorShapeProto.dim: array expected");e.dim=[];for(var r=0;r<t.dim.length;++r){if("object"!=typeof t.dim[r])throw TypeError(".onnx.TensorShapeProto.dim: object expected");e.dim[r]=c.onnx.TensorShapeProto.Dimension.fromObject(t.dim[r])}}return e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.dim=[]),t.dim&&t.dim.length){r.dim=[];for(var n=0;n<t.dim.length;++n)r.dim[n]=c.onnx.TensorShapeProto.Dimension.toObject(t.dim[n],e)}return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t.Dimension=function(){var t;function e(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return e.prototype.dimValue=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.dimParam="",e.prototype.denotation="",Object.defineProperty(e.prototype,"value",{get:l.oneOfGetter(t=["dimValue","dimParam"]),set:l.oneOfSetter(t)}),e.create=function(t){return new e(t)},e.encode=function(t,e){return e||(e=u.create()),null!=t.dimValue&&t.hasOwnProperty("dimValue")&&e.uint32(8).int64(t.dimValue),null!=t.dimParam&&t.hasOwnProperty("dimParam")&&e.uint32(18).string(t.dimParam),null!=t.denotation&&t.hasOwnProperty("denotation")&&e.uint32(26).string(t.denotation),e},e.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},e.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.TensorShapeProto.Dimension;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.dimValue=t.int64();break;case 2:n.dimParam=t.string();break;case 3:n.denotation=t.string();break;default:t.skipType(7&i)}}return n},e.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},e.verify=function(t){if("object"!=typeof t||null===t)return"object expected";var e={};if(null!=t.dimValue&&t.hasOwnProperty("dimValue")&&(e.value=1,!(l.isInteger(t.dimValue)||t.dimValue&&l.isInteger(t.dimValue.low)&&l.isInteger(t.dimValue.high))))return"dimValue: integer|Long expected";if(null!=t.dimParam&&t.hasOwnProperty("dimParam")){if(1===e.value)return"value: multiple values";if(e.value=1,!l.isString(t.dimParam))return"dimParam: string expected"}return null!=t.denotation&&t.hasOwnProperty("denotation")&&!l.isString(t.denotation)?"denotation: string expected":null},e.fromObject=function(t){if(t instanceof c.onnx.TensorShapeProto.Dimension)return t;var e=new c.onnx.TensorShapeProto.Dimension;return null!=t.dimValue&&(l.Long?(e.dimValue=l.Long.fromValue(t.dimValue)).unsigned=!1:"string"==typeof t.dimValue?e.dimValue=parseInt(t.dimValue,10):"number"==typeof t.dimValue?e.dimValue=t.dimValue:"object"==typeof t.dimValue&&(e.dimValue=new l.LongBits(t.dimValue.low>>>0,t.dimValue.high>>>0).toNumber())),null!=t.dimParam&&(e.dimParam=String(t.dimParam)),null!=t.denotation&&(e.denotation=String(t.denotation)),e},e.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.denotation=""),null!=t.dimValue&&t.hasOwnProperty("dimValue")&&("number"==typeof t.dimValue?r.dimValue=e.longs===String?String(t.dimValue):t.dimValue:r.dimValue=e.longs===String?l.Long.prototype.toString.call(t.dimValue):e.longs===Number?new l.LongBits(t.dimValue.low>>>0,t.dimValue.high>>>0).toNumber():t.dimValue,e.oneofs&&(r.value="dimValue")),null!=t.dimParam&&t.hasOwnProperty("dimParam")&&(r.dimParam=t.dimParam,e.oneofs&&(r.value="dimParam")),null!=t.denotation&&t.hasOwnProperty("denotation")&&(r.denotation=t.denotation),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),t}(),o.TypeProto=function(){var t;function e(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return e.prototype.tensorType=null,e.prototype.denotation="",Object.defineProperty(e.prototype,"value",{get:l.oneOfGetter(t=["tensorType"]),set:l.oneOfSetter(t)}),e.create=function(t){return new e(t)},e.encode=function(t,e){return e||(e=u.create()),null!=t.tensorType&&t.hasOwnProperty("tensorType")&&c.onnx.TypeProto.Tensor.encode(t.tensorType,e.uint32(10).fork()).ldelim(),null!=t.denotation&&t.hasOwnProperty("denotation")&&e.uint32(50).string(t.denotation),e},e.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},e.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.TypeProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.tensorType=c.onnx.TypeProto.Tensor.decode(t,t.uint32());break;case 6:n.denotation=t.string();break;default:t.skipType(7&i)}}return n},e.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},e.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.tensorType&&t.hasOwnProperty("tensorType")){var e=c.onnx.TypeProto.Tensor.verify(t.tensorType);if(e)return"tensorType."+e}return null!=t.denotation&&t.hasOwnProperty("denotation")&&!l.isString(t.denotation)?"denotation: string expected":null},e.fromObject=function(t){if(t instanceof c.onnx.TypeProto)return t;var e=new c.onnx.TypeProto;if(null!=t.tensorType){if("object"!=typeof t.tensorType)throw TypeError(".onnx.TypeProto.tensorType: object expected");e.tensorType=c.onnx.TypeProto.Tensor.fromObject(t.tensorType)}return null!=t.denotation&&(e.denotation=String(t.denotation)),e},e.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.denotation=""),null!=t.tensorType&&t.hasOwnProperty("tensorType")&&(r.tensorType=c.onnx.TypeProto.Tensor.toObject(t.tensorType,e),e.oneofs&&(r.value="tensorType")),null!=t.denotation&&t.hasOwnProperty("denotation")&&(r.denotation=t.denotation),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Tensor=function(){function t(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.elemType=0,t.prototype.shape=null,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=u.create()),null!=t.elemType&&t.hasOwnProperty("elemType")&&e.uint32(8).int32(t.elemType),null!=t.shape&&t.hasOwnProperty("shape")&&c.onnx.TensorShapeProto.encode(t.shape,e.uint32(18).fork()).ldelim(),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.TypeProto.Tensor;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.elemType=t.int32();break;case 2:n.shape=c.onnx.TensorShapeProto.decode(t,t.uint32());break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.elemType&&t.hasOwnProperty("elemType")&&!l.isInteger(t.elemType))return"elemType: integer expected";if(null!=t.shape&&t.hasOwnProperty("shape")){var e=c.onnx.TensorShapeProto.verify(t.shape);if(e)return"shape."+e}return null},t.fromObject=function(t){if(t instanceof c.onnx.TypeProto.Tensor)return t;var e=new c.onnx.TypeProto.Tensor;if(null!=t.elemType&&(e.elemType=0|t.elemType),null!=t.shape){if("object"!=typeof t.shape)throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");e.shape=c.onnx.TensorShapeProto.fromObject(t.shape)}return e},t.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.elemType=0,r.shape=null),null!=t.elemType&&t.hasOwnProperty("elemType")&&(r.elemType=t.elemType),null!=t.shape&&t.hasOwnProperty("shape")&&(r.shape=c.onnx.TensorShapeProto.toObject(t.shape,e)),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),e}(),o.OperatorSetIdProto=function(){function t(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.domain="",t.prototype.version=l.Long?l.Long.fromBits(0,0,!1):0,t.create=function(e){return new t(e)},t.encode=function(t,e){return e||(e=u.create()),null!=t.domain&&t.hasOwnProperty("domain")&&e.uint32(10).string(t.domain),null!=t.version&&t.hasOwnProperty("version")&&e.uint32(16).int64(t.version),e},t.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},t.decode=function(t,e){t instanceof s||(t=s.create(t));for(var r=void 0===e?t.len:t.pos+e,n=new c.onnx.OperatorSetIdProto;t.pos<r;){var i=t.uint32();switch(i>>>3){case 1:n.domain=t.string();break;case 2:n.version=t.int64();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.domain&&t.hasOwnProperty("domain")&&!l.isString(t.domain)?"domain: string expected":null!=t.version&&t.hasOwnProperty("version")&&!(l.isInteger(t.version)||t.version&&l.isInteger(t.version.low)&&l.isInteger(t.version.high))?"version: integer|Long expected":null},t.fromObject=function(t){if(t instanceof c.onnx.OperatorSetIdProto)return t;var e=new c.onnx.OperatorSetIdProto;return null!=t.domain&&(e.domain=String(t.domain)),null!=t.version&&(l.Long?(e.version=l.Long.fromValue(t.version)).unsigned=!1:"string"==typeof t.version?e.version=parseInt(t.version,10):"number"==typeof t.version?e.version=t.version:"object"==typeof t.version&&(e.version=new l.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber())),e},t.toObject=function(t,e){e||(e={});var r={};if(e.defaults){if(r.domain="",l.Long){var n=new l.Long(0,0,!1);r.version=e.longs===String?n.toString():e.longs===Number?n.toNumber():n}else r.version=e.longs===String?"0":0}return null!=t.domain&&t.hasOwnProperty("domain")&&(r.domain=t.domain),null!=t.version&&t.hasOwnProperty("version")&&("number"==typeof t.version?r.version=e.longs===String?String(t.version):t.version:r.version=e.longs===String?l.Long.prototype.toString.call(t.version):e.longs===Number?new l.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber():t.version),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o),t.exports=c},2100:(t,e,r)=>{"use strict";t.exports=r(9482)},9482:(t,e,r)=>{"use strict";var n=e;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(1173),n.BufferWriter=r(3155),n.Reader=r(1408),n.BufferReader=r(593),n.util=r(9693),n.rpc=r(5994),n.roots=r(5054),n.configure=i,i()},1408:(t,e,r)=>{"use strict";t.exports=u;var n,i=r(9693),o=i.LongBits,a=i.utf8;function s(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function u(t){this.buf=t,this.pos=0,this.len=t.length}var l,c="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new u(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new u(t);throw Error("illegal buffer")},p=function(){return i.Buffer?function(t){return(u.create=function(t){return i.Buffer.isBuffer(t)?new n(t):c(t)})(t)}:c};function f(){var t=new o(0,0),e=0;if(!(this.len-this.pos>4)){for(;e<3;++e){if(this.pos>=this.len)throw s(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw s(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function d(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw s(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}u.create=p(),u.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return l;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|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 t=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},u.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var t=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},u.prototype.bytes=function(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw s(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,r):e===r?new this.buf.constructor(0):this._slice.call(this.buf,e,r)},u.prototype.string=function(){var t=this.bytes();return a.read(t,0,t.length)},u.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw s(this,t);this.pos+=t}else do if(this.pos>=this.len)throw s(this);while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},u._configure=function(t){n=t,u.create=p(),n._configure();var e=i.Long?"toLong":"toNumber";i.merge(u.prototype,{int64:function(){return f.call(this)[e](!1)},uint64:function(){return f.call(this)[e](!0)},sint64:function(){return f.call(this).zzDecode()[e](!1)},fixed64:function(){return h.call(this)[e](!0)},sfixed64:function(){return h.call(this)[e](!1)}})}},593:(t,e,r)=>{"use strict";t.exports=o;var n=r(1408);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(9693);function o(t){n.call(this,t)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},o._configure()},5054:t=>{"use strict";t.exports={}},5994:(t,e,r)=>{"use strict";e.Service=r(7948)},7948:(t,e,r)=>{"use strict";t.exports=i;var n=r(9693);function i(t,e,r){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function t(e,r,i,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return n.asPromise(t,s,e,r,i,o);if(s.rpcImpl)try{return s.rpcImpl(e,r[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(t,r){if(t)return s.emit("error",t,e),a(t);if(null!==r){if(!(r instanceof i))try{r=i[s.responseDelimited?"decodeDelimited":"decode"](r)}catch(t){return s.emit("error",t,e),a(t)}return s.emit("data",r,e),a(null,r)}s.end(!0)})}catch(t){return s.emit("error",t,e),void setTimeout(function(){a(t)},0)}else setTimeout(function(){a(Error("already ended"))},0)},i.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(t,e,r)=>{"use strict";t.exports=i;var n=r(9693);function i(t,e){this.lo=t>>>0,this.hi=e>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var a=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return o;var e=t<0;e&&(t=-t);var r=t>>>0,n=(t-r)/4294967296>>>0;return e&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(t){if("number"==typeof t)return i.fromNumber(t);if(n.isString(t)){if(!n.Long)return i.fromNumber(parseInt(t,10));t=n.Long.fromString(t)}return t.low||t.high?new i(t.low>>>0,t.high>>>0):o},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,r=~this.hi>>>0;return e||(r=r+1>>>0),-(e+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(t){return n.Long?new n.Long(0|this.lo,0|this.hi,!!t):{low:0|this.lo,high:0|this.hi,unsigned:!!t}};var s=String.prototype.charCodeAt;i.fromHash=function(t){return t===a?o:new i((s.call(t,0)|s.call(t,1)<<8|s.call(t,2)<<16|s.call(t,3)<<24)>>>0,(s.call(t,4)|s.call(t,5)<<8|s.call(t,6)<<16|s.call(t,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 t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:r<128?9:10}},9693:function(t,e,r){"use strict";var n=e;function i(t,e,r){for(var n=Object.keys(e),i=0;i<n.length;++i)void 0!==t[n[i]]&&r||(t[n[i]]=e[n[i]]);return t}function o(t){function e(t,r){if(!(this instanceof e))return new e(t,r);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack||""}),r&&i(this,r)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return t}}),e.prototype.toString=function(){return this.name+": "+this.message},e}n.asPromise=r(4537),n.base64=r(7419),n.EventEmitter=r(9211),n.float=r(945),n.inquire=r(7199),n.utf8=r(4997),n.pool=r(6662),n.LongBits=r(1945),n.isNode=!!(void 0!==r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},n.isString=function(t){return"string"==typeof t||t instanceof String},n.isObject=function(t){return t&&"object"==typeof t},n.isset=n.isSet=function(t,e){var r=t[e];return!(null==r||!t.hasOwnProperty(e))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var t=n.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(t){return"number"==typeof t?n.Buffer?n._Buffer_allocUnsafe(t):new n.Array(t):n.Buffer?n._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(t){return t?n.LongBits.from(t).toHash():n.LongBits.zeroHash},n.longFromHash=function(t,e){var r=n.LongBits.fromHash(t);return n.Long?n.Long.fromBits(r.lo,r.hi,e):r.toNumber(!!e)},n.merge=i,n.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(t){for(var e={},r=0;r<t.length;++r)e[t[r]]=1;return function(){for(var t=Object.keys(this),r=t.length-1;r>-1;--r)if(1===e[t[r]]&&void 0!==this[t[r]]&&null!==this[t[r]])return t[r]}},n.oneOfSetter=function(t){return function(e){for(var r=0;r<t.length;++r)t[r]!==e&&delete this[t[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var t=n.Buffer;t?(n._Buffer_from=t.from!==Uint8Array.from&&t.from||function(e,r){return new t(e,r)},n._Buffer_allocUnsafe=t.allocUnsafe||function(e){return new t(e)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},1173:(t,e,r)=>{"use strict";t.exports=p;var n,i=r(9693),o=i.LongBits,a=i.base64,s=i.utf8;function u(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function l(){}function c(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function p(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var f=function(){return i.Buffer?function(){return(p.create=function(){return new n})()}:function(){return new p}};function d(t,e,r){e[r]=255&t}function h(t,e){this.len=t,this.next=void 0,this.val=e}function g(t,e,r){for(;t.hi;)e[r++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=127&t.lo|128,t.lo=t.lo>>>7;e[r++]=t.lo}function b(t,e,r){e[r]=255&t,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}p.create=f(),p.alloc=function(t){return new i.Array(t)},i.Array!==Array&&(p.alloc=i.pool(p.alloc,i.Array.prototype.subarray)),p.prototype._push=function(t,e,r){return this.tail=this.tail.next=new u(t,e,r),this.len+=e,this},h.prototype=Object.create(u.prototype),h.prototype.fn=function(t,e,r){for(;t>127;)e[r++]=127&t|128,t>>>=7;e[r]=t},p.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new h((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},p.prototype.int32=function(t){return t<0?this._push(g,10,o.fromNumber(t)):this.uint32(t)},p.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},p.prototype.uint64=function(t){var e=o.from(t);return this._push(g,e.length(),e)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(t){var e=o.from(t).zzEncode();return this._push(g,e.length(),e)},p.prototype.bool=function(t){return this._push(d,1,t?1:0)},p.prototype.fixed32=function(t){return this._push(b,4,t>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(t){var e=o.from(t);return this._push(b,4,e.lo)._push(b,4,e.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(t){return this._push(i.float.writeFloatLE,4,t)},p.prototype.double=function(t){return this._push(i.float.writeDoubleLE,8,t)};var m=i.Array.prototype.set?function(t,e,r){e.set(t,r)}:function(t,e,r){for(var n=0;n<t.length;++n)e[r+n]=t[n]};p.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(d,1,0);if(i.isString(t)){var r=p.alloc(e=a.length(t));a.decode(t,r,0),t=r}return this.uint32(e)._push(m,e,t)},p.prototype.string=function(t){var e=s.length(t);return e?this.uint32(e)._push(s.write,e,t):this._push(d,1,0)},p.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new u(l,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(l,0,0),this.len=0),this},p.prototype.ldelim=function(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this},p.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e},p._configure=function(t){n=t,p.create=f(),n._configure()}},3155:(t,e,r)=>{"use strict";t.exports=o;var n=r(1173);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(9693);function o(){n.call(this)}function a(t,e,r){t.length<40?i.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var n=0;n<t.length;)e[r++]=t[n++]}},o.prototype.bytes=function(t){i.isString(t)&&(t=i._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(o.writeBytesBuffer,e,t),this},o.prototype.string=function(t){var e=i.Buffer.byteLength(t);return this.uint32(e),e&&this._push(a,e,t),this},o._configure()},7714:(t,e,r)=>{"use strict";e.R=void 0;let n=r(6919),i=r(7448);e.R=new class{async init(){}async createSessionHandler(t,e){let r=new n.Session(e);return await r.loadModel(t),new i.OnnxjsSessionHandler(r)}}},4200:(t,e,r)=>{"use strict";e.c8=e.rX=void 0;let n=r(1670),i=r(5381),o=r(2157),a=r(2306);e.rX=()=>{if(("number"!=typeof n.env.wasm.initTimeout||n.env.wasm.initTimeout<0)&&(n.env.wasm.initTimeout=0),"boolean"!=typeof n.env.wasm.simd&&(n.env.wasm.simd=!0),"boolean"!=typeof n.env.wasm.proxy&&(n.env.wasm.proxy=!1),"number"!=typeof n.env.wasm.numThreads||!Number.isInteger(n.env.wasm.numThreads)||n.env.wasm.numThreads<=0){let t="undefined"==typeof navigator?(0,i.cpus)().length:navigator.hardwareConcurrency;n.env.wasm.numThreads=Math.min(4,Math.ceil((t||1)/2))}},e.c8=new class{async init(){(0,e.rX)(),await (0,o.initWasm)()}async createSessionHandler(t,e){let r=new a.OnnxruntimeWebAssemblySessionHandler;return await r.loadModel(t,e),Promise.resolve(r)}}},6018:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(1670),e);
1let o=r(1670);{let t=r(7714).R;(0,o.registerBackend)("webgl",t,-10)}{let t=r(4200).c8;(0,o.registerBackend)("cpu",t,10),(0,o.registerBackend)("wasm",t,10),(0,o.registerBackend)("xnnpack",t,9)}},246:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createAttributeWithCacheKey=void 0;class r{constructor(t){Object.assign(this,t)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(t=>`${this[t]}`).join(";")),this._cacheKey}}e.createAttributeWithCacheKey=t=>new r(t)},7778:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Attribute=void 0;let n=r(1446),i=r(9395),o=r(9162),a=r(2517);var s=i.onnxruntime.experimental.fbs;class u{constructor(t){if(this._attributes=new Map,null!=t){for(let e of t)e instanceof n.onnx.AttributeProto?this._attributes.set(e.name,[u.getValue(e),u.getType(e)]):e instanceof s.Attribute&&this._attributes.set(e.name(),[u.getValue(e),u.getType(e)]);if(this._attributes.size<t.length)throw Error("duplicated attribute names")}}set(t,e,r){this._attributes.set(t,[r,e])}delete(t){this._attributes.delete(t)}getFloat(t,e){return this.get(t,"float",e)}getInt(t,e){return this.get(t,"int",e)}getString(t,e){return this.get(t,"string",e)}getTensor(t,e){return this.get(t,"tensor",e)}getFloats(t,e){return this.get(t,"floats",e)}getInts(t,e){return this.get(t,"ints",e)}getStrings(t,e){return this.get(t,"strings",e)}getTensors(t,e){return this.get(t,"tensors",e)}get(t,e,r){let n=this._attributes.get(t);if(void 0===n){if(void 0!==r)return r;throw Error(`required attribute not found: ${t}`)}if(n[1]!==e)throw Error(`type mismatch: expected ${e} but got ${n[1]}`);return n[0]}static getType(t){let e=t instanceof n.onnx.AttributeProto?t.type:t.type();switch(e){case n.onnx.AttributeProto.AttributeType.FLOAT:return"float";case n.onnx.AttributeProto.AttributeType.INT:return"int";case n.onnx.AttributeProto.AttributeType.STRING:return"string";case n.onnx.AttributeProto.AttributeType.TENSOR:return"tensor";case n.onnx.AttributeProto.AttributeType.FLOATS:return"floats";case n.onnx.AttributeProto.AttributeType.INTS:return"ints";case n.onnx.AttributeProto.AttributeType.STRINGS:return"strings";case n.onnx.AttributeProto.AttributeType.TENSORS:return"tensors";default:throw Error(`attribute type is not supported yet: ${n.onnx.AttributeProto.AttributeType[e]}`)}}static getValue(t){let e=t instanceof n.onnx.AttributeProto?t.type:t.type();if(e===n.onnx.AttributeProto.AttributeType.GRAPH||e===n.onnx.AttributeProto.AttributeType.GRAPHS)throw Error("graph attribute is not supported yet");let r=this.getValueNoCheck(t);if(e===n.onnx.AttributeProto.AttributeType.INT&&a.LongUtil.isLong(r))return a.LongUtil.longToNumber(r);if(e===n.onnx.AttributeProto.AttributeType.INTS){let t=r,e=Array(t.length);for(let r=0;r<t.length;r++){let n=t[r];e[r]=a.LongUtil.longToNumber(n)}return e}if(e===n.onnx.AttributeProto.AttributeType.TENSOR)return t instanceof n.onnx.AttributeProto?o.Tensor.fromProto(r):o.Tensor.fromOrtTensor(r);if(e===n.onnx.AttributeProto.AttributeType.TENSORS){if(t instanceof n.onnx.AttributeProto)return r.map(t=>o.Tensor.fromProto(t));if(t instanceof s.Attribute)return r.map(t=>o.Tensor.fromOrtTensor(t))}if(e===n.onnx.AttributeProto.AttributeType.STRING&&t instanceof n.onnx.AttributeProto){let t=r;return(0,a.decodeUtf8String)(t)}return e===n.onnx.AttributeProto.AttributeType.STRINGS&&t instanceof n.onnx.AttributeProto?r.map(a.decodeUtf8String):r}static getValueNoCheck(t){return t instanceof n.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(t):this.getValueNoCheckFromOrtFormat(t)}static getValueNoCheckFromOnnxFormat(t){switch(t.type){case n.onnx.AttributeProto.AttributeType.FLOAT:return t.f;case n.onnx.AttributeProto.AttributeType.INT:return t.i;case n.onnx.AttributeProto.AttributeType.STRING:return t.s;case n.onnx.AttributeProto.AttributeType.TENSOR:return t.t;case n.onnx.AttributeProto.AttributeType.GRAPH:return t.g;case n.onnx.AttributeProto.AttributeType.FLOATS:return t.floats;case n.onnx.AttributeProto.AttributeType.INTS:return t.ints;case n.onnx.AttributeProto.AttributeType.STRINGS:return t.strings;case n.onnx.AttributeProto.AttributeType.TENSORS:return t.tensors;case n.onnx.AttributeProto.AttributeType.GRAPHS:return t.graphs;default:throw Error(`unsupported attribute type: ${n.onnx.AttributeProto.AttributeType[t.type]}`)}}static getValueNoCheckFromOrtFormat(t){switch(t.type()){case s.AttributeType.FLOAT:return t.f();case s.AttributeType.INT:return t.i();case s.AttributeType.STRING:return t.s();case s.AttributeType.TENSOR:return t.t();case s.AttributeType.GRAPH:return t.g();case s.AttributeType.FLOATS:return t.floatsArray();case s.AttributeType.INTS:{let e=[];for(let r=0;r<t.intsLength();r++)e.push(t.ints(r));return e}case s.AttributeType.STRINGS:{let e=[];for(let r=0;r<t.stringsLength();r++)e.push(t.strings(r));return e}case s.AttributeType.TENSORS:{let e=[];for(let r=0;r<t.tensorsLength();r++)e.push(t.tensors(r));return e}default:throw Error(`unsupported attribute type: ${s.AttributeType[t.type()]}`)}}}e.Attribute=u},7091:(t,e,r)=>{"use strict";
1Object.defineProperty(e,"__esModule",{value:!0}),e.resolveBackend=e.backend=void 0;let n=r(5038),i=new Map;async function o(t){let r=e.backend;if(void 0!==r[t]&&function(t){let e=t;return"initialize"in e&&"function"==typeof e.initialize&&"createSessionHandler"in e&&"function"==typeof e.createSessionHandler&&"dispose"in e&&"function"==typeof e.dispose}(r[t])){let e=r[t],n=e.initialize();if("object"==typeof n&&"then"in n&&(n=await n),n)return i.set(t,e),e}}e.backend={webgl:new n.WebGLBackend},e.resolveBackend=async function t(e){if(!e)return t(["webgl"]);for(let t of"string"==typeof e?[e]:e){let e=i.get(t);if(e)return e;let r=await o(t);if(r)return r}throw Error("no available backend to use")}},5038:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLBackend=void 0;let n=r(1670),i=r(6231),o=r(6416),a=r(7305);e.WebGLBackend=class{get contextId(){return n.env.webgl.contextId}set contextId(t){n.env.webgl.contextId=t}get matmulMaxBatchSize(){return n.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(t){n.env.webgl.matmulMaxBatchSize=t}get textureCacheMode(){return n.env.webgl.textureCacheMode}set textureCacheMode(t){n.env.webgl.textureCacheMode=t}get pack(){return n.env.webgl.pack}set pack(t){n.env.webgl.pack=t}get async(){return n.env.webgl.async}set async(t){n.env.webgl.async=t}initialize(){try{return this.glContext=(0,a.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),i.Logger.setWithEnv(n.env),i.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(t){return i.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${t}`),!1}}createSessionHandler(t){return new o.WebGLSessionHandler(this,t)}dispose(){this.glContext.dispose()}}},5107:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CoordsGlslLib=void 0;let n=r(2517),i=r(8520),o=r(5060),a=r(7859),s=r(9390);class u extends i.GlslLib{constructor(t){super(t)}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.getInputsSampl
1ingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new i.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 i.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 t=this.context.outputTextureLayout;return t.isPacked?this.getPackedOutputSamplingSnippet(t):this.getUnpackedOutputSamplingSnippet(t)}getPackedOutputSamplingSnippet(t){let e=t.unpackedShape,r=[t.width,t.height],n={},a="getOutputCoords";switch(e.length){case 0:n[a]=this.getOutputScalarCoords();break;case 1:n[a]=this.getOutputPacked1DCoords(e,r);break;case 2:n[a]=this.getOutputPacked2DCoords(e,r);break;case 3:n[a]=this.getOutputPacked3DCoords(e,r);break;default:n[a]=this.getOutputPackedNDCoords(e,r)}let s=` 2 void setOutput(vec4 val) { 3 ${(0,o.getGlsl)(this.context.glContext.version).output} = val; 4 } 5 `;return n.floatTextureSetRGBA=new i.GlslLibRoutine(s),n}getUnpackedOutputSamplingSnippet(t){let e=t.unpackedShape,r=[t.width,t.height],n={},a="getOutputCoords";switch(e.length){case 0:n[a]=this.getOutputScalarCoords();break;case 1:n[a]=this.getOutputUnpacked1DCoords(e,r);break;case 2:n[a]=this.getOutputUnpacked2DCoords(e,r);break;case 3:n[a]=this.getOutputUnpacked3DCoords(e,r);break;case 4:n[a]=this.getOutputUnpacked4DCoords(e,r);break;case 5:n[a]=this.getOutputUnpacked5DCoords(e,r);break;case 6:n[a]=this.getOutputUnpacked6DCoords(e,r);break;default:throw Error(`Unsupported output dimensionality: ${e.length}`)}let s=` 6 void setOutput(float val) { 7 ${(0,o.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); 8 } 9 `;return n.floatTextureSetR=new i.GlslLibRoutine(s),n}getOutputScalarCoords(){return new i.GlslLibRoutine("\n int getOutputCoords() {\n return 0;\n }\n ")}getOutputPacked1DCoords(t,e){let r=e,n="";return n=1===r[0]?` 10 int getOutputCoords() { 11 return 2 * int(TexCoords.y * ${r[1]}.0); 12 } 13 `:1===r[1]?` 14 int getOutputCoords() { 15 return 2 * int(TexCoords.x * ${r[0]}.0); 16 } 17 `:` 18 int getOutputCoords() { 19 ivec2 resTexRC = ivec2(TexCoords.xy * 20 vec2(${r[0]}, ${r[1]})); 21 return 2 * (resTexRC.y * ${r[0]} + resTexRC.x); 22 } 23 `,new i.GlslLibRoutine(n)}getOutputPacked2DCoords(t,e){let r="";if(n.ArrayUtil.arraysEqual(t,e))return r=` 24 ivec2 getOutputCoords() { 25 return 2 * ivec2(TexCoords.xy * vec2(${e[0]}, ${e[1]})); 26 } 27 `,new i.GlslLibRoutine(r);let o=e,a=Math.ceil(t[1]/2);return r=` 28 ivec2 getOutputCoords() { 29 ivec2 resTexRC = ivec2(TexCoords.xy * 30 vec2(${o[0]}, ${o[1]})); 31 32 int index = resTexRC.y * ${o[0]} + resTexRC.x; 33 34 // reverse r and c order for packed texture 35 int r = imod(index, ${a}) * 2; 36 int c = 2 * (index / ${a}); 37 38 return ivec2(r, c); 39 } 40 `,new i.GlslLibRoutine(r)}getOutputPacked3DCoords(t,e){let r=[e[0],e[1]],n=Math.ceil(t[2]/2),o=n*Math.ceil(t[1]/2),a=` 41 ivec3 getOutputCoords() { 42 ivec2 resTexRC = ivec2(TexCoords.xy * 43 vec2(${r[0]}, ${r[1]})); 44 int index = resTexRC.y * ${r[0]} + resTexRC.x; 45 46 int b = index / ${o}; 47 index -= b * ${o}; 48 49 // reverse r and c order for packed texture 50 int r = imod(index, ${n}) * 2; 51 int c = 2 * (index / ${n}); 52 53 return ivec3(b, r, c); 54 } 55 `;return new i.GlslLibRoutine(a)}getOutputPackedNDCoords(t,e){let r=[e[0],e[1]],n=Math.ceil(t[t.length-1]/2),o=n*Math.ceil(t[t.length-2]/2),a=o,s="",u="b, r, c";for(let e=2;e<t.length-1;e++)a*=t[t.length-e-1],s=` 56 int b${e} = index / ${a}; 57 index -= b${e} * ${a}; 58 `+s,u=`b${e}, `+u;let l=` 59 ivec${t.length} getOutputCoords() {
60 ivec2 resTexRC = ivec2(TexCoords.xy * 61 vec2(${r[0]}, ${r[1]})); 62 int index = resTexRC.y * ${r[0]} + resTexRC.x; 63 64 ${s} 65 66 int b = index / ${o}; 67 index -= b * ${o}; 68 69 // reverse r and c order for packed texture 70 int r = imod(index, ${n}) * 2; 71 int c = 2 * (index / ${n}); 72 73 return ivec${t.length}(${u}); 74 } 75 `;return new i.GlslLibRoutine(l)}getOutputUnpacked1DCoords(t,e){let r=` 76 int getOutputCoords() { 77 ivec2 resTexRC = ivec2(TexCoords.xy * 78 vec2(${e[0]}, ${e[1]})); 79 return resTexRC.y * ${e[0]} + resTexRC.x; 80 } 81 `;return new i.GlslLibRoutine(r)}getOutputUnpacked2DCoords(t,e){let r=` 82 ivec2 getOutputCoords() { 83 ivec2 resTexRC = ivec2(TexCoords.xy * 84 vec2(${e[0]}, ${e[1]})); 85 int index = resTexRC.y * ${e[0]} + resTexRC.x; 86 int r = index / ${t[1]}; 87 int c = index - r * ${t[1]}; 88 return ivec2(r, c); 89 } 90 `;return new i.GlslLibRoutine(r)}getOutputUnpacked3DCoords(t,e){let r="",n=t.length,o=null;n<2&&(o=[]),(o=Array(n-1))[n-2]=t[n-1];for(let e=n-3;e>=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` 91 ivec3 getOutputCoords() { 92 ivec2 resTexRC = ivec2(TexCoords.xy * 93 vec2(${e[0]}, ${e[1]})); 94 int index = resTexRC.y * ${e[0]} + resTexRC.x; 95 ${s} 96 return ivec3(r, c, d); 97 } 98 `,new i.GlslLibRoutine(r)}getOutputUnpacked4DCoords(t,e){let r="",n=t.length,o=null;n<2&&(o=[]),(o=Array(n-1))[n-2]=t[n-1];for(let e=n-3;e>=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d","d2"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` 99 ivec4 getOutputCoords() { 100 ivec2 resTexRC = ivec2(TexCoords.xy * 101 vec2(${e[0]}, ${e[1]})); 102 int index = resTexRC.y * ${e[0]} + resTexRC.x; 103 ${s} 104 return ivec4(r, c, d, d2); 105 } 106 `,new i.GlslLibRoutine(r)}getOutputUnpacked5DCoords(t,e){let r="",n=t.length,o=null;n<2&&(o=[]),(o=Array(n-1))[n-2]=t[n-1];for(let e=n-3;e>=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d","d2","d3"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` 107 ivec5 getOutputCoords() { 108 ivec2 resTexRC = ivec2(TexCoords.xy * 109 vec2(${e[0]}, ${e[1]})); 110 int index = resTexRC.y * ${e[0]} + resTexRC.x; 111 ${s} 112 return ivec5(r, c, d, d2, d3); 113 } 114 `,new i.GlslLibRoutine(r)}getOutputUnpacked6DCoords(t,e){let r="",n=t.length,o=null;n<2&&(o=[]),(o=Array(n-1))[n-2]=t[n-1];for(let e=n-3;e>=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d","d2","d3","d4"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` 115 ivec6 getOutputCoords() { 116 ivec2 resTexRC = ivec2(TexCoords.xy * 117 vec2(${e[0]}, ${e[1]})); 118 int index = resTexRC.y * ${e[0]} + resTexRC.x; 119 ${s} 120 return ivec6(r, c, d, d2, d3, d4); 121 } 122 `,new i.GlslLibRoutine(r)}getCommonUtilFuncs(){let t={},e="uvFromFlat";t[e]=new i.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 "),t[e="packedUVfrom1D"]=new i.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 "),t[e="packedUVfrom2D"]=new i.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 "),t[e="packedUVfrom3D"]=new i.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 "),e="sampleTexture";let r=(0,o.getGlsl)(this.context.glContext.version);return t[e]=new i.GlslLibRoutine(` 123 float sampleTexture(sampler2D textureSampler, vec2 uv) { 124 return ${r.texture2D}(textureSampler, uv).r; 125 }`),t}
125getInputsSamplingSnippets(){let t={},e=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((r,n)=>{let i=this.context.inputTextureLayouts[n],o=(0,s.generateShaderFuncNameFromInputSamplerName)(r);i.isPacked?t[o]=this.getPackedSamplerFromInput(o,r,i):t[o]=this.getUnpackedSamplerFromInput(o,r,i);let a=(0,s.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(r);i.unpackedShape.length<=e.unpackedShape.length&&(i.isPacked?t[a]=this.getPackedSamplerAtOutputCoords(a,i,e,r):t[a]=this.getUnpackedSamplerAtOutputCoords(a,i,e,r))}),t}getPackedSamplerAtOutputCoords(t,e,r,o){let a;let u=e.unpackedShape,l=r.unpackedShape,c=o,p=(0,s.generateShaderFuncNameFromInputSamplerName)(c),f=u.length,d=l.length,h=n.BroadcastUtil.getBroadcastDims(u,l),g=(0,s.getCoordsDataType)(d),b=d-f,m=(0,s.getGlChannels)();a=0===f?"":d<2&&h.length>=1?"coords = 0;":h.map(t=>`coords.${m[t+b]} = 0;`).join("\n");let y="";y=d<2&&f>0?"coords":u.map((t,e)=>`coords.${m[e+b]}`).join(", ");let _="return outputValue;",v=1===n.ShapeUtil.size(u),x=1===n.ShapeUtil.size(l);if(1!==f||v||x){if(v&&!x)_=1===d?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(h.length){let t=f-2,e=f-1;h.indexOf(t)>-1&&h.indexOf(e)>-1?_="return vec4(outputValue.x);":h.indexOf(t)>-1?_="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":h.indexOf(e)>-1&&(_="return vec4(outputValue.xx, outputValue.zz);")}}else _="\n return vec4(outputValue.xy, outputValue.xy);\n ";let w=` 126 vec4 ${t}() { 127 ${g} coords = getOutputCoords(); 128 129 int lastDim = coords.${m[d-1]}; 130 coords.${m[d-1]} = coords.${m[d-2]}; 131 coords.${m[d-2]} = lastDim; 132 133 ${a} 134 vec4 outputValue = ${p}(${y}); 135 ${_} 136 } 137 `;return new i.GlslLibRoutine(w,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(t,e,r,o){let a;let u=[r.width,r.height],l=[e.width,e.height],c=e.unpackedShape.length,p=r.unpackedShape.length,f=e.unpackedShape,d=r.unpackedShape,h=(0,s.generateShaderFuncNameFromInputSamplerName)(o);if(c===p&&n.ArrayUtil.arraysEqual(l,u)){let e=` 138 float ${t}() { 139 return sampleTexture(${o}, TexCoords); 140 } 141 `;return new i.GlslLibRoutine(e,["coordinates.sampleTexture"])}let g=(0,s.getCoordsDataType)(p),b=n.BroadcastUtil.getBroadcastDims(f,d),m=p-c,y=(0,s.getGlChannels)();a=0===c?"":p<2&&b.length>=1?"coords = 0;":b.map(t=>`coords.${y[t+m]} = 0;`).join("\n");let _="";_=p<2&&c>0?"coords":e.unpackedShape.map((t,e)=>`coords.${y[e+m]}`).join(", ");let v=` 142 float ${t}() { 143 ${g} coords = getOutputCoords(); 144 ${a} 145 return ${h}(${_}); 146 } 147 `;return new i.GlslLibRoutine(v,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(t,e,r){switch(r.unpackedShape.length){case 0:return this.getPackedSamplerScalar(t,e);case 1:return this.getPackedSampler1D(t,e,r);case 2:return this.getPackedSampler2D(t,e,r);case 3:return this.getPackedSampler3D(t,e,r);default:return this.getPackedSamplerND(t,e,r)}}getUnpackedSamplerFromInput(t,e,r){let n=r.unpackedShape;switch(n.length){case 0:return this.getUnpackedSamplerScalar(t,e,r);case 1:return this.getUnpackedSampler1D(t,e,r);case 2:return this.getUnpackedSampler2D(t,e,r);case 3:return this.getUnpackedSampler3D(t,e,r);case 4:return this.getUnpackedSampler4D(t,e,r);case 5:return this.getUnpackedSampler5D(t,e,r);case 6:return this.getUnpackedSampler6D(t,e,r);default:throw Error(`Unsupported dimension ${n.length}-D`)}}getPackedSamplerScalar(t,e){let r=` 148 vec4 ${t}() { 149 return ${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${e}, halfCR); 150 } 151 `;return new i.GlslLibRoutine(r)}getPackedSampler1D(t,e,r){let n=[r.width,r.height],a=[n[1],n[0]],s=(0,o.getGlsl)(this.context.glContext.version),u=`vec4 ${t}(int index) { 152 vec2 uv = packedUVfrom1D( 153 ${a[0]}, ${a[1]}, index); 154 return ${s.texture2D}(${e}, uv); 155 }`;return new i.GlslLibRoutine(u,["coordinates.packedUVfrom1D"])}getPackedSampler2D(t,e,r){let a=r.unpackedShape,s=[r.width,r.height],u=(0,o.getGlsl)(this.context.glContext.version),l=s[0],c=s[1];if(null!=s&&n.ArrayUtil.arraysEqual(a,s)){let r=`vec4 ${t}(int row, int col) { 156 vec2 uv = (vec2(col, row) + halfCR) / vec2(${c}.0, ${l}.0); 157 return ${u.texture2D}(${e}, uv); 158 }`;return new i.GlslLibRoutine(r)}let p=s,f=Math.ceil(a[1]/2),d=`vec4 ${t}(int row, int col) { 159 vec2 uv = packedUVfrom2D(${p[1]}, ${p[0]}, ${f}
159, row, col); 160 return ${u.texture2D}(${e}, uv); 161 }`;return new i.GlslLibRoutine(d,["coordinates.packedUVfrom2D"])}getPackedSampler3D(t,e,r){let n=r.unpackedShape,a=[r.width,r.height],u=[a[0],a[1]],l=(0,o.getGlsl)(this.context.glContext.version);if(1===n[0]){let o=n.slice(1),a=[1,2],u=(0,s.squeezeInputShape)(n,o),l=["b","row","col"],c=JSON.parse(JSON.stringify(r));c.unpackedShape=u;let p=this.getPackedSamplerFromInput(t,e,c),f=`${p.routineBody} 162 vec4 ${t}(int b, int row, int col) { 163 return ${t}(${(0,s.getSqueezedParams)(l,a)}); 164 } `;return new i.GlslLibRoutine(f,p.dependencies)}let c=u[0],p=u[1],f=Math.ceil(n[2]/2),d=`vec4 ${t}(int b, int row, int col) { 165 vec2 uv = packedUVfrom3D( 166 ${p}, ${c}, ${f*Math.ceil(n[1]/2)}, ${f}, b, row, col); 167 return ${l.texture2D}(${e}, uv);}`;return new i.GlslLibRoutine(d,["coordinates.packedUVfrom3D"])}getPackedSamplerND(t,e,r){let n=r.unpackedShape,a=n.length,s=[r.width,r.height],u=(0,o.getGlsl)(this.context.glContext.version),l=[s[0],s[1]],c=l[1],p=l[0],f=Math.ceil(n[a-1]/2),d=f*Math.ceil(n[a-2]/2),h="int b, int row, int col",g=`b * ${d} + (row / 2) * ${f} + (col / 2)`;for(let t=2;t<a-1;t++)h=`int b${t}, `+h,d*=n[a-t-1],g=`b${t} * ${d} + `+g;let b=`vec4 ${t}(${h}) { 168 int index = ${g}; 169 int texR = index / ${p}; 170 int texC = index - texR * ${p}; 171 vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${p}, ${c}); 172 return ${u.texture2D}(${e}, uv); 173 }`;return new i.GlslLibRoutine(b)}getUnpackedSamplerScalar(t,e,r){let[n,o]=[r.width,r.height];if(1===n&&1===o){let r=` 174 float ${t}() { 175 return sampleTexture(${e}, halfCR); 176 } 177 `;return new i.GlslLibRoutine(r,["coordinates.sampleTexture"])}let a=` 178 float ${t}() { 179 int offset_${e} = coordsToOffset(TexCoords, ${n}, ${o}); 180 vec2 uv = uvFromFlat(${n}, ${o}, offset_${e}); 181 return sampleTexture(${e}, uv); 182 } 183 `;return new i.GlslLibRoutine(a,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler1D(t,e,r){let n=r.width,o=r.height;if(1===o&&1===n){let r=` 184 float ${t}(int index) { 185 return sampleTexture(${e}, halfCR); 186 } 187 `;return new i.GlslLibRoutine(r,["coordinates.sampleTexture"])}if(1===o){let r=` 188 float ${t}(int index) { 189 vec2 uv = vec2((float(index) + 0.5) / ${n}.0, 0.5); 190 return sampleTexture(${e}, uv); 191 } 192 `;return new i.GlslLibRoutine(r,["coordinates.sampleTexture"])}if(1===n){let r=` 193 float ${t}(int index) { 194 vec2 uv = vec2(0.5, (float(index) + 0.5) / ${o}.0); 195 return sampleTexture(${e}, uv); 196 } 197 `;return new i.GlslLibRoutine(r,["coordinates.sampleTexture"])}let a=` 198 float ${t}(int index) { 199 vec2 uv = uvFromFlat(${n}, ${o}, index); 200 return sampleTexture(${e}, uv); 201 } 202 `;return new i.GlslLibRoutine(a,["coordinates.uvFromFlat","coordinates.sampleTexture"])}getUnpackedSampler2D(t,e,r){let o=r.unpackedShape,u=[r.height,r.width];if(null!=u&&n.ArrayUtil.arraysEqual(o,u)){let r=` 203 float ${t}(int row, int col) { 204 vec2 uv = (vec2(row, col) + halfCR) / vec2(${u[1]}.0, ${u[0]}.0); 205 return sampleTexture(${e}, uv); 206 } 207 `;return new i.GlslLibRoutine(r,["coordinates.sampleTexture"])}let{newShape:l,keptDims:c}=(0,a.squeezeShape)(o),p=l;if(p.length<o.length){let n=(0,s.squeezeInputShape)(o,p),a=JSON.parse(JSON.stringify(r));a.unpackedShape=n;let u=["col","row"],l=` 208 ${this.getUnpackedSamplerFromInput(t,e,a).routineBody} 209 float ${t}(int row, int col) { 210 return ${t}(${(0,s.getSqueezedParams)(u,c)}); 211 } 212 `;return new i.GlslLibRoutine(l,["coordinates.sampleTexture"])}let f=u[1],d=u[0];if(1===d){let r=` 213 float ${t}(int row, int col) { 214 int offset_${e} = coordsToOffset(TexCoords, ${f}, ${d}); 215 float index = dot(vec3(row, col, offset_${e}), vec3(${o[1]}, 1, 1)); 216 vec2 uv = vec2(0.5, (index + 0.5) / ${f}.0); 217 return sampleTexture(${e}, uv); 218 } 219 `;return new i.GlslLibRoutine(r,["coordinates.sampleTexture","coordinates.coordsToOffset"])}if(1===f){let r=` 220 float ${t}(int row, int col) { 221 int offset_${e} = coordsToOffset(TexCoords, ${f}, ${d}); 222 float index = dot(vec3(row, col, offset_${e}), vec3(${o[1]}, 1, 1)); 223 vec2 uv = vec2((index + 0.5) / ${d}.0, 0.5); 224 return sampleTexture(${e}, uv); 225 } 226 `;return new i.GlslLibRoutine(r,["coordinates.sampleTexture","coordinates.coordsToOffset"])}let h=` 227 float ${t}(int row, int col) { 228 int index = col * ${o[1]} + row; 229 vec2 uv = uvFromFlat(${f}, ${d}, index); 230 return sampleTexture(${e}, uv); 231 } 232 `;return new i.GlslLibRoutine(h,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler3D(t,e,r){let n=r.unpackedShape,o=n[1]*n[2],u=n[2],{newShape:l,keptDims:c}=(0,a.squeezeShape)(n),p=l;if(p.length<n.length){let o=(0,s.squeezeInputShape)(n,p),a=["batch","col","row"],u=JSON.parse(JSON.stringify(r));u.unpackedShape=o;let l=this.getUnpackedSamplerFromInput(t,e,u),f=c.reverse(),d=`
233 ${l.routineBody} 234 float ${t}(int batch, int row, int col) { 235 return ${t}(${(0,s.getSqueezedParams)(a,f)}); 236 } 237 `;return new i.GlslLibRoutine(d,l.dependencies)}let f=` 238 float ${t}(int depth, int row, int col) { 239 // Explicitly use integer operations as dot() only works on floats. 240 int index = depth * ${o} + col * ${u} + row; 241 vec2 uv = uvFromFlat(${r.width}, ${r.height}, index); 242 return sampleTexture(${e}, uv); 243 } 244 `;return new i.GlslLibRoutine(f,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler4D(t,e,r){let n=r.unpackedShape,o=n[3],a=n[2]*o,s=` 245 float ${t}(int row, int col, int depth, int depth2) { 246 int index = row * ${n[1]*a} + col * ${a} + 247 depth2 * ${o} + depth; 248 vec2 uv = uvFromFlat(${r.width}, ${r.height}, index); 249 return sampleTexture(${e}, uv); 250 } 251 `;return new i.GlslLibRoutine(s,["coordinates.uvFromFlat","coordinates.sampleTexture"])}getUnpackedSampler5D(t,e,r){let n=r.unpackedShape,o=n[4],u=n[3]*o,l=n[2]*u,c=n[1]*l,{newShape:p,keptDims:f}=(0,a.squeezeShape)(n);if(p.length<n.length){let o=(0,s.squeezeInputShape)(n,p),a=["row","col","depth","depth2","depth3"],u=JSON.parse(JSON.stringify(r));u.unpackedShape=o;let l=` 252 ${this.getUnpackedSamplerFromInput(t,e,u).routineBody} 253 float ${t}(int row, int col, int depth, int depth2, int depth3) { 254 return ${t}(${(0,s.getSqueezedParams)(a,f)}); 255 } 256 `;return new i.GlslLibRoutine(l,["coordinates.sampleTexture","coordinates.uvFromFlat"])}let d=` 257 float ${t}(int row, int col, int depth, int depth2, int depth3) { 258 int index = row * ${c} + col * ${l} + depth * ${u} + 259 depth3 * ${o} + depth2; 260 vec2 uv = uvFromFlat(${r.width}, ${r.height}, index); 261 return sampleTexture(${e}, uv); 262 } 263 `;return new i.GlslLibRoutine(d,["coordinates.sampleTexture","coordinates.uvFromFlat"])}getUnpackedSampler6D(t,e,r){let n=r.unpackedShape,o=n[5],u=n[4]*o,l=n[3]*u,c=n[2]*l,p=n[1]*c,{newShape:f,keptDims:d}=(0,a.squeezeShape)(n);if(f.length<n.length){let o=(0,s.squeezeInputShape)(n,f),a=["row","col","depth","depth2","depth3","depth4"],u=JSON.parse(JSON.stringify(r));u.unpackedShape=o;let l=` 264 ${this.getUnpackedSamplerFromInput(t,e,u).routineBody} 265 float ${t}(int row, int col, int depth, 266 int depth2, int depth3, int depth4) { 267 return ${t}(${(0,s.getSqueezedParams)(a,d)}); 268 } 269 `;return new i.GlslLibRoutine(l,["coordinates.sampleTexture","coordinates.uvFromFlat"])}let h=` 270 float ${t}(int row, int col, int depth, 271 int depth2, int depth3, int depth4) { 272 int index = row * ${p} + col * ${c} + depth * ${l} + 273 depth2 * ${u} + depth3 * ${o} + depth4; 274 vec2 uv = uvFromFlat(${r.width}, ${r.height}, index); 275 return sampleTexture(${e}, uv); 276 } 277 `;return new i.GlslLibRoutine(h,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}
277toVec(){let t=this.context.outputTextureLayout,e=t.shape.length,r=t.strides,n=t.width,o=t.height,a=[];for(let t=0;t<e-1;++t)a.push(` 278 c[${t}] = offset / ${r[t]};`),a.push(` 279 offset -= c[${t}] * ${r[t]};`);a.push(` 280 c[${e-1}] = offset;`);let s=` 281 void toVec(vec2 texCoords, out int c[${e}]) { 282 int offset = coordsToOffset(texCoords, ${n}, ${o}); 283 ${a.join("")} 284 } 285 void toVec(int offset, out int c[${e}]) { 286 ${a.join("")} 287 } 288 `;return{toVec:new i.GlslLibRoutine(s,["coordinates.coordsToOffset"])}}valueFrom(){let t={};return this.context.programInfo.inputNames.forEach((e,r)=>{let n=this.context.inputTextureLayouts[r],o=(n.unpackedShape.length>0?n.unpackedShape:n.shape).length,a=`_${e}`;t[a]=new i.GlslLibRoutine(this.getValueFromSingle(e,o,n.width,n.height,!1),[`shapeUtils.indicesToOffset${a}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),t[a+="_T"]=new i.GlslLibRoutine(this.getValueFromSingle(e,o,n.width,n.height,!0),[`shapeUtils.indicesToOffset${a}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),t}getValueFromSingle(t,e,r,n,i){let a=`_${t}`;return i&&(a+="_T"),` 289 float ${a}(int m[${e}]) { 290 int offset = indicesToOffset${a}(m); 291 vec2 coords = offsetToCoords(offset, ${r}, ${n}); 292 float value = getColorAsFloat(${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${t}, coords)); 293 return value; 294 } 295 `}getPackedValueFrom(t,e,r,n,i){let a=`_${t}_Pack`;return i&&(a+="_T"),` 296 vec4 ${a}(int m[${e}]) { 297 int offset = indicesToOffset_${t}(m); 298 vec2 coords = offsetToCoords(offset, ${r}, ${n}); 299 return ${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${t}, coords); 300 } 301 `}}e.CoordsGlslLib=u},8520:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.TopologicalSortGlslRoutines=e.GlslLibRoutineNode=e.GlslLibRoutine=e.GlslLib=e.GlslContext=e.FunctionType=void 0,(r=e.FunctionType||(e.FunctionType={}))[r.ValueBased=0]="ValueBased",r[r.Positional=1]="Positional",e.GlslContext=class{constructor(t,e,r,n){this.glContext=t,this.programInfo=e,this.inputTextureLayouts=r,this.outputTextureLayout=n}},e.GlslLib=class{constructor(t){this.context=t}},e.GlslLibRoutine=class{constructor(t,e){this.routineBody=t,this.dependencies=e}},e.GlslLibRoutineNode=class{constructor(t,e,r){this.name=t,this.dependencies=r||[],e&&(this.routineBody=e)}addDependency(t){t&&this.dependencies.push(t)}},e.TopologicalSortGlslRoutines=class{static returnOrderedNodes(t){if(!t||0===t.length)return[];if(1===t.length)return t;let e=new Set,r=new Set,n=[];return this.createOrderedNodes(t,e,r,n),n}static createOrderedNodes(t,e,r,n){for(let i=0;i<t.length;++i)this.dfsTraverse(t[i],e,r,n)}static dfsTraverse(t,e,r,n){if(!t||r.has(t.name))return;if(e.has(t.name))throw Error("Cyclic dependency detected. Can't topologically sort routines needed for shader.");e.add(t.name);let i=t.dependencies;if(i&&i.length>0)for(let t=0;t<i.length;++t)this.dfsTraverse(i[t],e,r,n);n.push(t),r.add(t.name),e.delete(t.name)}}},7341:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodingGlslLib=void 0;let n=r(8520);class i extends n.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new n.GlslLibRoutine("highp vec4 encode(highp float f) {\n return vec4(f, 0.0, 0.0, 0.0);\n }\n ")}}decodeFloat32(){return{decode:new n.GlslLibRoutine("highp float decode(highp vec4 rgba) {\n return rgba.r;\n }\n ")}}encodeUint8(){let t=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new n.GlslLibRoutine(` 302 highp vec4 encode(highp float f) { 303 highp float F = abs(f); 304 highp float Sign = step(0.0,-f); 305 highp float Exponent = floor(log2(F)); 306 highp float Mantissa = (exp2(- Exponent) * F); 307 Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); 308 highp vec4 rgba; 309 rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); 310 rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); 311 rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); 312 rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); 313 ${t} 314 rgba = rgba / 255.0; // values need to be normalized to [0,1] 315 return rgba; 316 } 317 `)}}decodeUint8(){let t=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new n.GlslLibRoutine(` 318 highp float decode(highp vec4 rgba) { 319 rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] 320 ${t} 321 highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; 322 highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1])
322- 127.0; 323 highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); 324 highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); 325 return Result; 326 } 327 `)}}static isLittleEndian(){let t=new ArrayBuffer(4),e=new Uint32Array(t),r=new Uint8Array(t);if(e[0]=3735928559,239===r[0])return!0;if(222===r[0])return!1;throw Error("unknown endianness")}}e.EncodingGlslLib=i},9894:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FragColorGlslLib=void 0;let n=r(8520),i=r(5060);class o extends n.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){let t=(0,i.getGlsl)(this.context.glContext.version);return{setFragColor:new n.GlslLibRoutine(` 328 void setFragColor(float value) { 329 ${t.output} = encode(value); 330 } 331 `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new n.GlslLibRoutine("\n float getColorAsFloat(vec4 color) {\n return decode(color);\n }\n ",["encoding.decode"])}}}e.FragColorGlslLib=o},2848:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.replaceInlines=void 0;let r=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;e.replaceInlines=function(t){let e;let n={};for(;null!==(e=r.exec(t));){let t=e[3].split(",").map(t=>{let e=t.trim().split(" ");return e&&2===e.length?{type:e[0],name:e[1]}:null}).filter(t=>null!==t);n[e[2]]={params:t,body:e[4]}}for(let r in n){let i=RegExp("(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",r),"gm");for(;null!==(e=i.exec(t));){let i=e[1],o=e[2],a=e[3].split(","),s=i?`${i} ${o};`:"",u=n[r].body,l="";n[r].params.forEach((t,e)=>{t&&(l+=`${t.type} ${t.name} = ${a[e]}; 332`)}),u=(u=`${l} 333 ${u}`).replace("return",`${o} = `);let c=` 334 ${s} 335 { 336 ${u} 337 } 338 `;t=t.replace(e[0],c)}}return t.replace(r,"")}},8879:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GlslPreprocessor=void 0;let n=r(8520),i=r(2848),o=r(5483),a=r(5060);e.GlslPreprocessor=class{constructor(t,e,r,i){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new n.GlslContext(t,e,r,i),Object.keys(o.glslRegistry).forEach(t=>{let e=new o.glslRegistry[t](this.context);this.libs[t]=e});let a=this.glslLibRoutineDependencyGraph;for(let t in this.libs){let e=this.libs[t].getFunctions();for(let r in e){let i;let o=t+"."+r;a[o]?(i=a[o]).routineBody=e[r].routineBody:(i=new n.GlslLibRoutineNode(o,e[r].routineBody),a[o]=i);let s=e[r].dependencies;if(s)for(let t=0;t<s.length;++t)if(a[s[t]])i.addDependency(a[s[t]]);else{let e=new n.GlslLibRoutineNode(s[t]);a[s[t]]=e,i.addDependency(e)}}}}preprocess(){let t=this.context.programInfo,e=t.shaderSource;return this.context.programInfo.hasMain||(e=`${e} 339 ${(0,a.getDefaultFragShaderMain)(this.context.glContext.version,this.context.outputTextureLayout.shape.length)}`),e=(0,i.replaceInlines)(e),`${(0,a.getFragShaderPreamble)(this.context.glContext.version)} 340 ${this.getUniforms(t.inputNames,t.variables)} 341 ${this.getImports(e)} 342 ${e}`}getImports(t){let e=this.selectGlslLibRoutinesToBeIncluded(t);if(0===e.length)return"";let r="";for(let t=0;t<e.length;++t){if(!e[t].routineBody)throw Error(`Missing body for the Glsl Library routine: ${e[t].name}`);r+=e[t].routineBody+"\n"}return r}selectGlslLibRoutinesToBeIncluded(t){let e=[];return Object.keys(this.glslLibRoutineDependencyGraph).forEach(r=>{let n=r.split(".")[1];-1!==t.indexOf(n)&&e.push(this.glslLibRoutineDependencyGraph[r])}),n.TopologicalSortGlslRoutines.returnOrderedNodes(e)}getUniforms(t,e){let r=[];if(t)for(let e of t)r.push(`uniform sampler2D ${e};`);if(e)for(let t of e)r.push(`uniform ${t.type} ${t.name}${t.arrayLength?`[${t.arrayLength}]`:""};`);return r.join("\n")}}},5483:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.glslRegistry=void 0;let n=r(5107),i=r(7341),o=r(9894),a=r(2655),s=r(3891);e.glslRegistry={encoding:i.EncodingGlslLib,fragcolor:o.FragColorGlslLib,vec:s.VecGlslLib,shapeUtils:a.ShapeUtilsGlslLib,coordinates:n.CoordsGlslLib}},2655:(t,e,r)=>{"use strict";
342Object.defineProperty(e,"__esModule",{value:!0}),e.ShapeUtilsGlslLib=void 0;let n=r(8520);class i extends n.GlslLib{constructor(t){super(t)}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 t=this.context.outputTextureLayout.shape.length,e={};return this.context.programInfo.inputNames.forEach((r,i)=>{let o=this.context.inputTextureLayouts[i].unpackedShape;if(o.length<=t){let i=o.length,a=t-i,s=`bcastIndices_${r}`,u="";for(let t=0;t<i;++t)u+=` 343 realIndices[${t}] = int( mod(float(bcastedIndices[${a+t}]), ${o[t]}.0) ); 344 `;let l=` 345 void ${s} (int bcastedIndices[${t}], out int realIndices[${i}]) { 346 ${u} 347 } 348 `;e[s]=new n.GlslLibRoutine(l)}}),e}bcastMatmulIndex(){let t=this.context.outputTextureLayout.shape.length,e={};return this.context.programInfo.inputNames.forEach((r,i)=>{let o=this.context.inputTextureLayouts[i].shape;if(!(o.length<2||o.length>t)){let i=o.length,a=t-i,s=`bcastMatmulIndices_${r}`,u="";for(let t=0;t<i-2;++t)u+=` 349 realIndices[${t}] = int( mod(float(bcastedIndices[${a+t}]), ${o[t]}.0) ); 350 `;let l=` 351 void ${s}(int bcastedIndices[${t}], out int realIndices[${i}]) { 352 ${u} 353 realIndices[${i-1}] = bcastedIndices[${t-1}]; 354 realIndices[${i-2}] = bcastedIndices[${t-2}]; 355 } 356 `;e[s]=new n.GlslLibRoutine(l)}}),e}indicesToOffset(){let t={};return this.context.programInfo.inputNames.forEach((e,r)=>{let o=this.context.inputTextureLayouts[r].shape,a=this.context.inputTextureLayouts[r].strides,s=o.length,u=`indicesToOffset_${e}`;t[u]=new n.GlslLibRoutine(i.indexToOffsetSingle(u,s,a)),t[u=`indicesToOffset_${e}_T`]=new n.GlslLibRoutine(i.indexToOffsetSingle(u,s,a.slice().reverse()))}),t}static indexToOffsetSingle(t,e,r){let n="";for(let t=e-1;t>=0;--t)n+=` 357 offset += indices[${t}] * ${r[t]}; 358 `;return` 359 int ${t}(int indices[${e}]) { 360 int offset = 0; 361 ${n} 362 return offset; 363 } 364 `}offsetToIndices(){let t={};return this.context.programInfo.inputNames.forEach((e,r)=>{let o=this.context.inputTextureLayouts[r].shape,a=this.context.inputTextureLayouts[r].strides,s=o.length,u=`offsetToIndices_${e}`;t[u]=new n.GlslLibRoutine(i.offsetToIndicesSingle(u,s,a)),t[u=`offsetToIndices_${e}_T`]=new n.GlslLibRoutine(i.offsetToIndicesSingle(u,s,a.slice().reverse()))}),t}static offsetToIndicesSingle(t,e,r){let n=[];for(let t=0;t<e-1;++t)n.push(` 365 indices[${t}] = offset / ${r[t]};`),n.push(` 366 offset -= indices[${t}] * ${r[t]};`);return n.push(` 367 indices[${e-1}] = offset;`),` 368 void ${t}(int offset, out int indices[${e}]) { 369 ${n.join("")} 370 } 371 `}incrementIndices(){let t={};return this.context.programInfo.inputNames.forEach((e,r)=>{let i=this.context.inputTextureLayouts[r].shape,o=i.length,a=`incrementIndices_${e}`,s="";for(let t=0;t<o;++t)s+=` 372 shape[${t}] = ${i[t]};`;let u=` 373 void ${a}(int axis, out int indices[${o}]) { 374 int shape[${o}]; 375 ${s}; 376 for(int i = ${o} -1 ; i >= 0; --i) { 377 if(i > axis) continue; 378 indices[i] += 1; 379 if(indices[i] < shape[i]) { 380 break; 381 } 382 indices[i] = 0; 383 } 384 } 385 `;t[a]=new n.GlslLibRoutine(u)}),t}}e.ShapeUtilsGlslLib=i},5060:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultFragShaderMain=e.getFragShaderPreamble=e.getVertexShaderSource=e.getGlsl=void 0;let r={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},n={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function i(t){return 1===t?r:n}e.getGlsl=i,e.getVertexShaderSource=function(t){let e=i(t);return`${e.version} 386 precision highp float; 387 ${e.attribute} vec3 position; 388 ${e.attribute} vec2 textureCoord; 389 390 ${e.varyingVertex} vec2 TexCoords; 391 392 void main() 393 {
394 gl_Position = vec4(position, 1.0); 395 TexCoords = textureCoord; 396 }`},e.getFragShaderPreamble=function(t){let e=i(t);return`${e.version} 397 precision highp float; 398 precision highp int; 399 precision highp sampler2D; 400 ${e.varyingFrag} vec2 TexCoords; 401 ${e.outputDeclaration} 402 const vec2 halfCR = vec2(0.5, 0.5); 403 404 // Custom vector types to handle higher dimenalities. 405 struct ivec5 406 { 407 int x; 408 int y; 409 int z; 410 int w; 411 int u; 412 }; 413 414 struct ivec6 415 { 416 int x; 417 int y; 418 int z; 419 int w; 420 int u; 421 int v; 422 }; 423 424 int imod(int x, int y) { 425 return x - y * (x / y); 426 } 427 428 `},e.getDefaultFragShaderMain=function(t,e){return` 429 void main() { 430 int indices[${e}]; 431 toVec(TexCoords, indices); 432 vec4 result = vec4(process(indices)); 433 ${i(t).output} = result; 434 } 435 `}},3891:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VecGlslLib=void 0;let n=r(8520);class i extends n.GlslLib{constructor(t){super(t)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){let t=this.context.outputTextureLayout.shape.length,e={add:"+=",sub:"-=",mul:"*=",div:"/="},r={};for(let i in e){let o=`${i}Vec`,a="";for(let r=0;r<t;++r)a+=` 436 dest[${r}] ${e[i]} src[${r}]; 437 `;let s=` 438 void ${o}(int src[${t}], out int dest[${t}]) { 439 ${a} 440 } 441 `;r[o]=new n.GlslLibRoutine(s)}return r}copyVec(){let t=this.context.outputTextureLayout.shape.length,e="";for(let r=0;r<t;++r)e+=` 442 dest[${r}] = src[${r}]; 443 `;let r=` 444 void copyVec(int src[${t}], out int dest[${t}]) { 445 ${e} 446 } 447 `;return{copyVec:new n.GlslLibRoutine(r)}}setVecItem(){let t=this.context.outputTextureLayout.shape.length,e=` 448 if(index < 0) 449 index =${t} + index; 450 if (index == 0) 451 m[0] = value; 452 `;for(let r=1;r<t-1;++r)e+=` 453 else if (index == ${r}) 454 m[${r}] = value; 455 `;e+=` 456 else 457 m[${t-1}] = value; 458 `;let r=` 459 void setVecItem(out int m[${t}], int index, int value) { 460 ${e} 461 } 462 `;return{setVecItem:new n.GlslLibRoutine(r)}}getVecItem(){let t=this.context.outputTextureLayout.shape.length,e=` 463 if(index < 0) 464 index = ${t} + index; 465 if (index == 0) 466 return m[0]; 467 `;for(let r=1;r<t-1;++r)e+=` 468 else if (index == ${r}) 469 return m[${r}]; 470 `;e+=` 471 else 472 return m[${t-1}]; 473 `;let r=` 474 int getVecItem(int m[${t}], int index) { 475 ${e} 476 } 477 `;return{getVecItem:new n.GlslLibRoutine(r)}}}e.VecGlslLib=i},8316:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLInferenceHandler=void 0;let n=r(6231),i=r(9162),o=r(2517),a=r(2403),s=r(7019),u=r(8710),l=r(5611),c=r(4057),p=r(2039);e.WebGLInferenceHandler=class{constructor(t){this.session=t,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(t,e){return(0,c.calculateTextureWidthAndHeight)(this.session.layoutStrategy,t,e)}executeProgram(t,e){if(e.length<t.inputNames.length)throw Error(`Input size mustn't be less than ${t.inputNames.length}.`);if(t.inputNames.length!==t.inputTypes.length)throw Error("input names size does not match input types");let r=[];for(let n=0;n<t.inputNames.length;++n)r[n]=this.getOrCreateTextureData(e[n],t.inputTypes[n]);let n=((t,e)=>{let r=e.map(t=>`${t.unpackedShape.join(",")};${t.width}x${t.height}`).join("_"),n=t.name;return t.cacheHint&&(n+="["+t.cacheHint+"]"),n+=":"+r})(t,r),i=this.session.programManager.getArtifact(n),o=i?i.programInfo:"function"==typeof t.get?t.get():t,a=(0,c.createTextureLayoutFromTextureType)(this.session.layoutStrategy,o.output.dims,o.output.textureType),s=this.createTextureData(a,o.output.type);return i||(i=this.session.programManager.build(o,r,s),this.session.programManager.setArtifact(n,i)),this.runProgram(i,r,s),s}run(t,e){return this.executeProgram(t,e).tensor}runProgram(t,e,r){for(let r=0;r<e.length;++r)if(!!e[r].isPacked!=(t.programInfo.inputTypes[r]===p.TextureType.packed))throw Error(`input[${r}] property packed inconsistent`);if(!!r.isPacked!=(t.programInfo.output.textureType===p.TextureType.packed))throw Error("output property packed inconsistent");this.session.programManager.run(t,e,r)}getOrCreateTextureData(t,e){let r=this.getTextureData(t.dataId,e===p.TextureType.packed);if(!r&&(r=this.getTextureData(t.dataId,e!==p.TextureType.packed)))return e===p.TextureType.packed?this.pack(r):this.unpack(r);if(!r){let n=(0,c.createTextureLayoutFromTextureType)(this.session.layoutStrategy,t.dims,e);if(e===p.TextureType.packedLastDimension){let r=1,n=4,i=t.dims;if(4===i.length){let o=[i[0],Math.ceil(i[1]*i[2]*i[3]/n)],a=(0,c.createTextureLayoutFromTextureType)(this.session.layoutStrategy,o,e),s=t.numberData;if(i[1]*i[2]*i[3]%n!=0){let e=i[0],o=i[1]*i[2]*i[3],a=Math.ceil(o*r/n)*n;s=new Float32Array(e*a);for(let n=0;n<e;++n){let e=n*o,i=n*a+n%r*o;s.set(t.numberData.subarray(e,e+o),i)}}return this.createTextureData(a,t.type,s,t,1)}}if(e===p.TextureType.packed){let e=(0,c.createTextureLayoutFromShape)(this.session.layoutStrategy,t.dims,1,[],{reverseWH:!0}),n=this.createTextureData(e,t.type,t.numberData,t,1);r=this.pack(n)}else r=this.createTextureData(n,t.type,t.numberData,t,1)}return r}createTextureDataFromLayoutBindTensor(t,e,r,n){return this.createTextureData(t,e,r,n,1)}createTextureData(t,e,r,i,o){n.Logger.verbose("InferenceHandler",`Creating TextureData: layout:[${JSON.stringify(t)}]`);
vendor: 5,844 bytes, line 477
477let a=this.session.textureManager.createTextureFromLayout(e,t,r,o);return this.createTextureDataFromTexture(t,e,a,i)}reshapeUnpacked(t,e){let r=this.getOrCreateTextureData(t,p.TextureType.unpacked),n={channels:r.channels,height:r.height,width:r.width,shape:0!==e.length?e:[1],strides:o.ShapeUtil.computeStrides(e),unpackedShape:e};return this.createTextureDataFromTexture(n,t.type,r.texture).tensor}reshapePacked(t,e){let r=this.getOrCreateTextureData(t,p.TextureType.packed);if((0,s.isReshapeCheap)(t.dims,e)){let n={channels:r.channels,height:r.height,width:r.width,shape:0!==e.length?e:[1],strides:o.ShapeUtil.computeStrides(e),unpackedShape:e,isPacked:!0};return this.createTextureDataFromTexture(n,t.type,r.texture).tensor}let n=(0,s.processDims3D)(t.dims),i=(0,s.processDims3D)(e),a=this.reshapePacked(t,n),u=this.run((0,s.createPackedReshape3DProgramInfoLoader)(this,a,i),[a]);return this.reshapePacked(u,e)}cast(t,e){let r=this.getOrCreateTextureData(t,p.TextureType.unpacked);return this.createTextureDataFromTexture(r,e,r.texture).tensor}createTextureDataFromTexture(t,e,r,n,o){let a=Object.assign(Object.assign({},t),{tensor:n||new i.Tensor(t.unpackedShape,e,t=>this.readTexture(a),async t=>this.readTextureAsync(a),void 0,o),texture:r});return this.setTextureData(a.tensor.dataId,a,t.isPacked),a}getTextureData(t,e=!1){return this.session.isInitializer(t)?this.session.getTextureData(t,e):e?this.packedTextureDataCache.get(t):this.unpackedTextureDataCache.get(t)}setTextureData(t,e,r=!1){this.session.isInitializer(t)?this.session.setTextureData(t,e,r):(r?this.packedTextureDataCache:this.unpackedTextureDataCache).set(t,e)}isTextureLayoutCached(t,e=!1){return!!this.getTextureData(t.dataId,e)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(t=>this.session.textureManager.releaseTexture(t)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(t=>this.session.textureManager.releaseTexture(t)),this.unpackedTextureDataCache=new Map}readTexture(t){return t.isPacked?this.readTexture(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,u.encodeAsUint8)(this,t))}async readTextureAsync(t){return t.isPacked?this.readTextureAsync(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,u.encodeAsUint8)(this,t))}pack(t){return this.executeProgram((0,a.createPackProgramInfoLoader)(this,t.tensor),[t.tensor])}unpack(t){return this.executeProgram((0,l.createUnpackProgramInfoLoader)(this,t.tensor),[t.tensor])}}},1640:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WEBGL_OP_RESOLVE_RULES=void 0;let a=r(2898),s=o(r(7839)),u=r(4196),l=r(2069),c=r(8138),p=r(9663),f=r(5193),d=r(7992),h=r(1253),g=r(4776),b=r(6572),m=r(3346),y=r(5623),_=r(2870),v=r(2143),x=r(4939),w=r(718),T=r(2268),S=r(8117),O=r(2278),A=r(5524),E=r(5975),I=r(3933),P=r(6558),D=r(5723),$=r(3738),k=o(r(4909)),C=r(8428),F=r(9793);e.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",k.abs],["Acos","","7+",k.acos],["Add","","7+",s.add],["And","","7+",s.and],["Asin","","7+",k.asin],["Atan","","7+",k.atan],["AveragePool","","7+",v.averagePool,v.parseAveragePoolAttributes],["BatchNormalization","","7+",a.batchNormalization,a.parseBatchNormalizationAttributes],["Cast","","6+",u.cast,u.parseCastAttributes],["Ceil","","6+",k.ceil],["Clip","","6-10",k.clip,k.parseClipAttributes],["Clip","","11+",k.clipV11],["Concat","","4+",l.concat,l.parseConcatAttributes],["Conv","","1+",c.conv,c.parseConvAttributes],["ConvTranspose","","1+",p.convTranspose,p.parseConvTransposeAttributes],["Cos","","7+",k.cos],["Div","","7+",s.div],["Dropout","","7+",k.identity],["DepthToSpace","","1+",f.depthToSpace,f.parseDepthToSpaceAttributes],["Equal","","7+",s.equal],["Elu","","6+",k.elu,k.parseEluAttributes],["Exp","","6+",k.exp],["Flatten","","1+",d.flatten,d.parseFlattenAttributes],["Floor","","6+",k.floor],["FusedConv","com.microsoft","1+",c.conv,c.parseConvAttributes],["Gather","","1+",h.gather,h.parseGatherAttributes],["Gemm","","7-10",g.gemm,g.parseGemmAttributesV7],["Gemm","","11+",g.gemm,g.parseGemmAttributesV11],["GlobalAveragePool","","1+",v.globalAveragePool,v.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",v.globalMaxPool],["Greater","","7+",s.greater],["Identity","","1+",k.identity],["ImageScaler","","1+",b.imageScaler,b.parseImageScalerAttributes],["InstanceNormalization","","6+",m.instanceNormalization,m.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",k.leakyRelu,k.parseLeakyReluAttributes],["Less","","7+",s.less],["Log","","6+",k.log],["MatMul","","1+",y.matMul,y.parseMatMulAttributes],["MaxPool","","1+",v.maxPool,v.parseMaxPoolAttributes],["Mul","","7+",s.mul],["Neg","","6+",k.neg],["Not","","1+",k.not],["Or","","7+",s.or],["Pad","","2-10",_.padV2,_.parsePadAttributesV2],["Pad","","11+",_.padV11,_.parsePadAttributesV11],["Pow","","7+",s.pow],["PRelu","","7+",s.pRelu],["ReduceLogSum","","1+",x.reduceL
477ogSum,x.parseReduceAttributes],["ReduceMax","","1+",x.reduceMax,x.parseReduceAttributes],["ReduceMean","","1+",x.reduceMean,x.parseReduceAttributes],["ReduceMin","","1+",x.reduceMin,x.parseReduceAttributes],["ReduceProd","","1+",x.reduceProd,x.parseReduceAttributes],["ReduceSum","","1-12",x.reduceSum,x.parseReduceAttributes],["ReduceSumSquare","","1+",x.reduceLogSumSquare,x.parseReduceAttributes],["Relu","","6+",k.relu],["Reshape","","5+",w.reshape],["Resize","","10",T.resize,T.parseResizeAttributesV10],["Resize","","11+",T.resize,T.parseResizeAttributesV11],["Shape","","1+",S.shape],["Sigmoid","","6+",k.sigmoid],["Sin","","7+",k.sin],["Slice","","10+",O.sliceV10],["Slice","","1-9",O.slice,O.parseSliceAttributes],["Softmax","","1-12",A.softmax,A.parseSoftmaxAttributes],["Softmax","","13+",A.softmaxV13,A.parseSoftmaxAttributesV13],["Split","","2-12",E.split,E.parseSplitAttributes],["Sqrt","","6+",k.sqrt],["Squeeze","","1-12",I.squeeze,I.parseSqueezeAttributes],["Squeeze","","13+",I.squeezeV13],["Sub","","7+",s.sub],["Sum","","6+",P.sum],["Tan","","7+",k.tan],["Tanh","","6+",k.tanh],["Tile","","6+",D.tile],["Transpose","","1+",$.transpose,$.parseTransposeAttributes],["Upsample","","7-8",F.upsample,F.parseUpsampleAttributesV7],["Upsample","","9",F.upsample,F.parseUpsampleAttributesV9],["Unsqueeze","","1-12",C.unsqueeze,C.parseUnsqueezeAttributes],["Unsqueeze","","13+",C.unsqueezeV13],["Xor","","7+",s.xor]]},2898:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchNormalizationAttributes=e.batchNormalization=void 0;let n=r(246),i=r(5060),o=r(2039),a={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]};e.batchNormalization=(t,e,r)=>(u(e),[t.run(Object.assign(Object.assign({},a),{cacheHint:r.cacheKey,get:()=>s(t,e,r)}),e)]),e.parseBatchNormalizationAttributes=t=>{let e=t.attributes.getFloat("epsilon",1e-5),r=t.attributes.getFloat("momentum",.9),i=t.attributes.getInt("spatial",1);return(0,n.createAttributeWithCacheKey)({epsilon:e,momentum:r,spatial:i})};let s=(t,e,r)=>{let n=(0,i.getGlsl)(t.session.backend.glContext.version),s=e[0].dims.length,[u,l]=t.calculateTextureWidthAndHeight(e[1].dims,o.TextureType.unpacked),c=` 478 float process(int[${s}] indices) { 479 vec2 position = offsetToCoords(indices[1], ${u}, ${l}); 480 float scale = getColorAsFloat(${n.texture2D}(Scale, position)); 481 float mean = getColorAsFloat(${n.texture2D}(Mean, position)); 482 float variance = getColorAsFloat(${n.texture2D}(Variance, position)); 483 float b = getColorAsFloat(${n.texture2D}(B, position)); 484 485 return scale * ( (_A(indices) - mean) / sqrt(variance + float(${r.epsilon})) ) + b; 486 }`;return Object.assign(Object.assign({},a),{output:{dims:e[0].dims,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:c})},u=t=>{if(!t||5!==t.length)throw Error("BatchNormalization requires 5 inputs.");let e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(e.dims.length<3||1!==r.dims.length||1!==n.dims.length||1!==i.dims.length||1!==o.dims.length||r.dims[0]!==e.dims[1]||n.dims[0]!==e.dims[1]||i.dims[0]!==e.dims[1]||o.dims[
4860]!==e.dims[1])throw Error("invalid input shape.");if("float32"!==e.type&&"float64"!==e.type||"float32"!==r.type&&"float64"!==r.type||"float32"!==n.type&&"float64"!==n.type||"float32"!==i.type&&"float64"!==i.type||"float32"!==o.type&&"float64"!==o.type)throw Error("invalid input tensor types.")}},7839:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.xor=e.sub=e.pRelu=e.pow=e.or=e.mul=e.less=e.greater=e.equal=e.div=e.and=e.add=e.glslPRelu=e.glslPow=e.glslXor=e.glslOr=e.glslAnd=e.glslLess=e.glslGreater=e.glslEqual=e.glslSub=e.glslMul=e.glslDiv=e.glslAdd=void 0;let n=r(2517),i=r(8520),o=r(5060),a=r(2039);function s(){let t="add_";return{body:` 487 float ${t}(float a, float b) { 488 return a + b; 489 } 490 vec4 ${t}(vec4 v1, vec4 v2) { 491 return v1 + v2; 492 } 493 `,name:t,type:i.FunctionType.ValueBased}}function u(){let t="div_";return{body:` 494 float ${t}(float a, float b) { 495 return a / b; 496 } 497 vec4 ${t}(vec4 v1, vec4 v2) { 498 return v1 / v2; 499 } 500 `,name:t,type:i.FunctionType.ValueBased}}function l(){let t="mul_";return{body:` 501 float ${t}(float a, float b) { 502 return a * b; 503 } 504 vec4 ${t}(vec4 v1, vec4 v2) { 505 return v1 * v2; 506 } 507 `,name:t,type:i.FunctionType.ValueBased}}function c(){let t="sub_";return{body:` 508 float ${t}(float a, float b) { 509 return a - b; 510 } 511 vec4 ${t}(vec4 v1, vec4 v2) { 512 return v1 - v2; 513 } 514 `,name:t,type:i.FunctionType.ValueBased}}function p(){let t="equal_";return{body:` 515 float ${t}(float a, float b) { 516 return float(a == b); 517 } 518 vec4 ${t}(vec4 v1, vec4 v2) { 519 return vec4(equal(v1, v2)); 520 } 521 `,name:t,type:i.FunctionType.ValueBased}}function f(){let t="greater_";return{body:` 522 float ${t}(float a, float b) { 523 return float(a > b); 524 } 525 vec4 ${t}(vec4 v1, vec4 v2) { 526 return vec4( v1.r > v2.r , 527 v1.g > v2.g, 528 v1.b > v2.b, 529 v1.a > v2.a ); 530 } 531 `,name:t,type:i.FunctionType.ValueBased}}function d(){let t="less_";return{body:` 532 float ${t}(float a, float b) { 533 return float(a < b); 534 } 535 vec4 ${t}(vec4 v1, vec4 v2) { 536 return vec4( v1.r < v2.r , 537 v1.g < v2.g, 538 v1.b < v2.b, 539 v1.a < v2.a ); 540 } 541 `,name:t,type:i.FunctionType.ValueBased}}function h(){let t="and_";return{body:` 542 float ${t}(float a, float b) { 543 return float( bool(a) && bool(b) ); 544 } 545 vec4 ${t}(vec4 v1, vec4 v2) { 546 bvec4 b1 = bvec4(v1); 547 bvec4 b2 = bvec4(v2); 548 return vec4( b1.r && b2.r , 549 b1.g && b2.g, 550 b1.b && b2.b, 551 b1.a && b2.a ); 552 } 553 `,name:t,type:i.FunctionType.ValueBased}}function g(){let t="or_";return{body:` 554 float ${t}(float a, float b) { 555 return float( bool(a) || bool(b) ); 556 } 557 vec4 ${t}(vec4 v1, vec4 v2) { 558 bvec4 b1 = bvec4(v1); 559 bvec4 b2 = bvec4(v2); 560 return vec4( b1.r || b2.r , 561 b1.g || b2.g, 562 b1.b || b2.b, 563 b1.a || b2.a ); 564 } 565 `,name:t,type:i.FunctionType.ValueBased}}function b(){let t="xor_";return{body:` 566 float ${t}(float a, float b) { 567 return float( bool(a) ^^ bool(b) ); 568 } 569 vec4 ${t}(vec4 v1, vec4 v2) { 570 bvec4 b1 = bvec4(v1); 571 bvec4 b2 = bvec4(v2); 572 return vec4( b1.r ^^ b2.r , 573 b1.g ^^ b2.g, 574 b1.b ^^ b2.b, 575 b1.a ^^ b2.a ); 576 } 577 `,name:t,type:i.FunctionType.ValueBased}}function m(){return function(t){let e="pow_";return{body:` 578 float ${e}(float a, float b) { 579 return pow(a, b); 580 } 581 vec4 ${e}(vec4 v1, vec4 v2) { 582 return pow(v1, v2); 583 } 584 `,name:e,type:i.FunctionType.ValueBased}}("pow")}function y(){let t="prelu_";return{body:` 585 float ${t}(float a, float b) { 586 return a < 0.0 ? a * b: a; 587 } 588 vec4 ${t}(vec4 v1, vec4 v2) { 589 return vec4( 590 v1.r < 0.0 ? v1.r * v2.r: v1.r, 591 v1.g < 0.0 ? v1.g * v2.g: v1.g, 592 v1.b < 0.0 ? v1.b * v2.b: v1.b, 593 v1.a < 0.0 ? v1.a * v2.a: v1.a 594 ); 595 } 596 `,name:t,type:i.FunctionType.ValueBased}}e.glslAdd=s,e.glslDiv=u,e.glslMul=l,e.glslSub=c,e.glslEqual=p,e.glslGreater=f,e.glslLess=d,e.glslAnd=h,e.glslOr=g,e.glslXor=b,e.glslPow=m,e.glslPRelu=y;let _=(t,e,r,n=e[0].type,i)=>{let o=t.session.pack?a.TextureType.packed:a.TextureType.unpacked;return{name:r.name,inputNames:["A","B"],inputTypes:[o,o],cacheHint:i,get:()=>v(t,e,r,n)}},v=(t,e,r,i=e[0].type)=>{let s=t.session.pack?a.TextureType.packed:a.TextureType.unpacked,u=!n.ShapeUtil.areEqual(e[0].dims,e[1].dims),l=e[0].dims,c=t.session.pack;
596if(u){let a=n.BroadcastUtil.calcShape(e[0].dims,e[1].dims,!1);if(!a)throw Error("Can't perform binary op on the given tensors");let u=(l=a).length,p=0!==e[0].dims.length?e[0].dims.length:1,f=0!==e[1].dims.length?e[1].dims.length:1,d=0!==e[0].dims.length?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",h=0!==e[1].dims.length?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",g=(0,o.getGlsl)(t.session.backend.glContext.version),b=c?` 597 ${r.body} 598 void main() { 599 vec4 a = getAAtOutCoords(); 600 vec4 b = getBAtOutCoords(); 601 vec4 result = ${r.name}(a, b); 602 ${g.output} = result; 603 }`:` 604 ${r.body} 605 float process(int indices[${u}]) { 606 int aindices[${p}]; 607 int bindices[${f}]; 608 ${d} 609 ${h} 610 return ${r.name}(_A(aindices), _B(bindices)); 611 }`;return{name:r.name,inputNames:["A","B"],inputTypes:[s,s],output:{dims:l,type:i,textureType:s},shaderSource:b,hasMain:c}}let p=(0,o.getGlsl)(t.session.backend.glContext.version),f=` 612 ${r.body} 613 void main() { 614 vec4 v1 = ${p.texture2D}(A, TexCoords); 615 vec4 v2 = ${p.texture2D}(B, TexCoords); 616 vec4 result = ${r.name}(v1, v2); 617 ${p.output} = result; 618 } 619 `;return{name:r.name,inputNames:["A","B"],inputTypes:[s,s],output:{dims:e[0].dims,type:i,textureType:s},shaderSource:f,hasMain:!0}};e.add=(t,e)=>[t.run(_(t,e,s()),e)],e.and=(t,e)=>[t.run(_(t,e,h(),"bool"),e)],e.div=(t,e)=>[t.run(_(t,e,u()),e)],e.equal=(t,e)=>[t.run(_(t,e,p(),"bool"),e)],e.greater=(t,e)=>[t.run(_(t,e,f(),"bool"),e)],e.less=(t,e)=>[t.run(_(t,e,d(),"bool"),e)],e.mul=(t,e)=>[t.run(_(t,e,l()),e)],e.or=(t,e)=>[t.run(_(t,e,g(),"bool"),e)],e.pow=(t,e)=>[t.run(_(t,e,m()),e)],e.pRelu=(t,e)=>[t.run(_(t,e,y()),e)],e.sub=(t,e)=>[t.run(_(t,e,c()),e)],e.xor=(t,e)=>[t.run(_(t,e,b(),"bool"),e)]},4196:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseCastAttributes=e.cast=void 0;let n=r(2517);e.cast=(t,e,r)=>(i(e),[t.cast(e[0],r)]),e.parseCastAttributes=t=>n.ProtoUtil.tensorDataTypeFromProto(t.attributes.getInt("to"));let i=t=>{if(!t||1!==t.length)throw Error("Cast requires 1 input.");if("string"===t[0].type)throw Error("Invalid input type.")}},1163:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedConcatProgramInfoLoader=void 0;let n=r(5060),i=r(2039),o=r(9390),a=r(2827);e.createPackedConcatProgramInfoLoader=(t,e,r)=>{var u,l;let c=(u=e.length,l=r.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:u},(t,e)=>`X${e}`),inputTypes:Array(u).fill(i.TextureType.packed),cacheHint:l});return Object.assign(Object.assign({},c),{get:()=>((t,e,r,u)=>{let l=r[0].dims.slice();if(u>=l.length||u<-1*l.length)throw Error("axis specified for concat doesn't match input dimensionality");u<0&&(u=l.length+u);let c=l.slice(0);for(let t=1;t<r.length;t++){let e=r[t].dims.slice();for(let t=0;t<l.length;t++)if(t===u)c[u]+=e[t];else if(l[t]!==e[t])throw Error("non concat dimensions must match")}let p=c.length,f=(0,a.getChannels)("coords",p),d=(0,o.getCoordsDataType)(p),h=(0,a.unpackFromChannel)(),g=r.map(t=>t.dims),b=(0,o.getGlChannels)(p),m=Array(g.length-1);m[0]=g[0][u];for(let t=1;t<m.length;t++)m[t]=m[t-1]+g[t][u];let y=b[u],_=b.slice(-2),v=b.join(),x=`if (${y} < ${m[0]}) { 620 return getChannel( 621 getX0(${v}), vec2(${_.join()})); 622 }`;for(let t=1;t<m.length;t++){let e=m[t-1];x+=` 623 if (${y} < ${m[t]} && ${y} >= ${m[t-1]}) { 624 return getChannel( 625 getX${t}(${s(b,y,e)}), 626 vec2(${s(_,y,e)})); 627 }`}let w=m.length,T=m[m.length-1];x+=` 628 return getChannel( 629 getX${w}(${s(b,y,T)}), 630 vec2(${s(_,y,T)}));`;let S=(0,n.getGlsl)(t.session.backend.glContext.version),O=` 631 ${h} 632 float getValue(${b.map(t=>"int "+t)}) { 633 ${x} 634 } 635 636 void main() { 637 ${d} coords = getOutputCoords(); 638 int lastDim = coords.${b[p-1]}; 639 coords.${b[p-1]} = coords.${b[p-2]}; 640 coords.${b[p-2]} = lastDim; 641 642 vec4 result = vec4(getValue(${f}), 0., 0., 0.); 643 644 ${f[p-1]} = ${f[p-1]} + 1; 645 if (${f[p-1]} < ${c[p-1]}) { 646 result.g = getValue(${f}); 647 } 648 649 ${f[p-2]} = ${f[p-2]} + 1; 650 if (${f[p-2]} < ${c[p-2]}) { 651 result.a = getValue(${f}); 652 } 653 654 ${f[p-1]} = ${f[p-1]} - 1; 655 if (${f[p-2]} < ${c[p-2]} && 656 ${f[p-1]} < ${c[p-1]}) { 657 result.b = getValue(${f}); 658 } 659 ${S.output} = result; 660 } 661 `;return Object.assign(Object.assign({},e),{output:{dims:c,type:r[0].type,textureType:i.TextureType.packed},shaderSource:O,hasMain:!0})})(t,c,e,r.axis)})};let s=(t,e,r)=>{let n=t.indexOf(e);return t.map((t,e)=>e===n?`${t} - ${r}`:t).join()}},2069:(t,e,r)=>{"use strict";
661Object.defineProperty(e,"__esModule",{value:!0}),e.parseConcatAttributes=e.concat=void 0;let n=r(246),i=r(2039),o=r(1163);e.concat=(t,e,r)=>(p(e),t.session.pack&&e[0].dims.length>1?[t.run((0,o.createPackedConcatProgramInfoLoader)(t,e,r),e)]:[t.run(a(t,e,r),e)]);let a=(t,e,r)=>{var n,o;let a=(n=e.length,o=r.cacheKey,{name:"Concat",inputNames:Array.from({length:n},(t,e)=>`X${e}`),inputTypes:Array(n).fill(i.TextureType.unpacked),cacheHint:o});return Object.assign(Object.assign({},a),{get:()=>((t,e,r,n)=>{let o=r[0].dims.slice();if(n>=o.length||n<-1*o.length)throw Error("axis specified for concat doesn't match input dimensionality");n<0&&(n=o.length+n);let a=o.slice(0);for(let t=1;t<r.length;t++){let e=r[t].dims.slice();for(let t=0;t<o.length;t++)if(t===n)a[n]+=e[t];else if(o[t]!==e[t])throw Error("non concat dimensions must match")}let p=a.length,f=Array(r.length),d=0;for(let t=0;t<f.length;++t)d+=r[t].dims[n],f[t]=d;let h="";h=r.length<5?s(f):u(f);let g=` 662 ${l(r.length,p)} 663 ${c(f)} 664 ${h} 665 float process(int indices[${p}]) { 666 int textureIndex = getTextureWhereDataResides (indices[${n}]); 667 668 if(textureIndex != 0) { 669 indices[${n}] = indices[${n}] - int(getSizeInConcatAxisValueFromIndex(textureIndex-int(1))); 670 } 671 672 return fetchDataFromCorrectTexture(textureIndex, indices); 673 }`;return Object.assign(Object.assign({},e),{output:{dims:a,type:r[0].type,textureType:i.TextureType.unpacked},shaderSource:g})})(0,a,e,r.axis)})},s=t=>`int getTextureWhereDataResides(int index) { 674 ${t.map((t,e)=>`if(index<${t}) {return ${e};} 675`).join("")} 676 }`,u=t=>s(t),l=(t,e)=>{let r=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${e}]) {`];for(let e=0;e<t;++e)0===e?r.push(` if (textureIndex == ${e}) { return _X${e}(indices); }`):e===t-1?r.push(` else { return _X${e}(indices); }`):r.push(` else if (textureIndex == ${e}) { return _X${e}(indices); }`);return r.push(" }"),r.join("\n")},c=t=>{let e=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let r=0;r<t.length;++r)0===r?e.push(` if (index == ${r}) { return ${t[r]}; }`):r===t.length-1?e.push(` else { return ${t[r]}; }`):e.push(` else if (index == ${r}) { return ${t[r]}; }`);return e.push(" }"),e.join("\n")};e.parseConcatAttributes=t=>(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis")});let p=t=>{if(!t||t.length<1)throw Error("too few inputs");let e=t[0].type,r=t[0].dims.length;if("string"===e)throw Error("string tensor is not supported yet");for(let n of t){if(n.type!==e)throw Error("input tensors should be one type");if(n.dims.length!==r)throw Error("input tensors should have the same shape")}}},4770:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackedGroupedConvProgramInfoLoader=void 0;let n=r(6231),i=r(5060),o=r(2039),a=r(8138),s=r(2823);e.createUnpackedGroupedConvProgramInfoLoader=(t,e,r)=>{var u,l;let c=(u=e.length>2,l=r.cacheKey,{name:"GroupedConv",inputNames:u?["X","W","Bias"]:["X","W"],inputTypes:u?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],cacheHint:l});return Object.assign(Object.assign({},c),{get:()=>((t,e,r,u)=>{let l=e.length>2?"value += getBias(output_channel);":"",c=e[0].dims.slice(),p=e[1].dims.slice(),f=p[0]/u.group;n.Logger.verbose("GroupedConv",`autpPad:${u.autoPad}, dilations:${u.dilations}, group:${u.group}, kernelShape:${u.kernelShape}, pads:${u.pads}, strides:${u.strides}`);let d=(0,a.calculateOutputShape)(c,p,u.dilations,u.pads,u.strides),h=(0,i.getGlsl)(t.session.backend.glContext.version),{activationFunction:g,applyActivation:b}=(0,s.getActivationSnippet)(u),m=` 677 const ivec2 strides = ivec2(${u.strides[0]}, ${u.strides[1]}); 678 const ivec2 pads = ivec2(${u.pads[0]}, ${u.pads[1]}); 679 ${g} 680 void main() { 681 ivec4 coords = getOutputCoords(); 682 int batch = coords.x; 683 int output_channel = coords.y; 684 ivec2 xRCCorner = coords.zw * strides - pads; 685 int group_id = output_channel / ${f}; 686 687 float value = 0.0; 688 for (int wInChannel = 0; wInChannel < ${p[1]}; wInChannel++) { 689 int input_channel = group_id * ${p[1]} + wInChannel; 690 for (int wHeight = 0; wHeight < ${p[2]}; wHeight++) { 691 int xHeight = xRCCorner.x + wHeight * ${u.dilations[0]}; 692 693 if (xHeight < 0 || xHeight >= ${c[2]}) { 694 continue; 695 } 696 697 for (int wWidth = 0; wWidth < ${p[3]}; wWidth++) { 698 int xWidth = xRCCorner.y + wWidth * ${u.dilations[1]}; 699 if (xWidth < 0 || xWidth >= ${c[3]}) { 700 continue; 701 } 702 703 float xVal = getX(batch, input_channel, xWidth, xHeight); 704 float wVal = getW(output_channel, wInChannel, wWidth, wHeight); 705 value += xVal*wVal; 706 } 707 } 708 } 709 ${l} 710 ${b} 711 ${h.output} = vec4(value, .0, .0, .0); 712 } 713`;return Object.assign(Object.assign({},r),{output:{dims:d,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:m,hasMain:!0})})(t,e,c,r)})}},1386:(t,e,r)=>{"use strict";
713Object.defineProperty(e,"__esModule",{value:!0}),e.conv2DPacked=e.conv2DPackedPointwise=void 0;let n=r(8138),i=r(8555),o=r(708);e.conv2DPackedPointwise=(t,e,r)=>{let i=e[0].dims,a=e[1].dims,s=(0,n.calculateOutputShape)(i,a,r.dilations,r.pads,r.strides),u=t.reshapePacked(e[0],[i[1],i[2]*i[3]]),l=t.reshapePacked(e[1],[a[0],a[1]]),c=e.length>2?[l,u,e[2]]:[l,u],p=t.run((0,o.createPackedMatmulProgramInfoLoader)(t,c,r),c);return t.reshapePacked(p,s)},e.conv2DPacked=(t,e,r)=>{let a=e[0].dims,s=e[1].dims,u=(0,n.calculateOutputShape)(a,s,r.dilations,r.pads,r.strides),l=t.run((0,i.createPackedIm2ColProgramInfoLoader)(t,e[0],e[1],u,r),[e[0]]),c=t.reshapePacked(e[1],[s[0],s[1]*s[2]*s[3]]),p=3===e.length?[c,l,e[2]]:[c,l],f=t.run((0,o.createPackedMatmulProgramInfoLoader)(t,p,r),p);return t.reshapePacked(f,u)}},9663:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvTransposeAttributes=e.convTranspose=void 0;let n=r(246),i=r(5060),o=r(2039),a=r(2823),s=(t,e,r,n,i,o)=>(t-1)*e+r+(n-1)*i+1-o,u=(t,e,r,n,i)=>{let o=Math.floor(t/2);"SAME_UPPER"===e?(r[n]=o,r[i]=t-o):"SAME_LOWER"===e&&(r[n]=t-o,r[i]=o)};e.convTranspose=(t,e,r)=>(f(e,r),l(t,e,r));let l=(t,e,r)=>{let n=p(r,e);return[c(t,e,n)]},c=(t,e,r)=>t.run(((t,e,r)=>{var n,s;let u=(n=e.length>2,s=r.cacheKey,{name:"ConvTranspose",inputNames:n?["X","W","B"]:["X","W"],inputTypes:n?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],cacheHint:s});return Object.assign(Object.assign({},u),{get:()=>((t,e,r,n)=>{let s=e.length>2?"getB(output_channel)":"0.0",u=e[0].dims,l=e[1].dims,c=l[1],p=l[0]/n.group,f=[e[0].dims[0],e[1].dims[1]*n.group,...n.outputShape],d=(0,i.getGlsl)(t.session.backend.glContext.version),{activationFunction:h,applyActivation:g}=(0,a.getActivationSnippet)(n),b=` 714 const ivec2 strides = ivec2(${n.strides[0]}, ${n.strides[1]}); 715 const ivec2 pads = ivec2(${n.pads[0]}, ${n.pads[1]}); 716 ${h} 717 void main() { 718 ivec4 coords = getOutputCoords(); 719 int batch = coords.x; 720 int output_channel = coords.y; 721 722 ivec2 loc = coords.zw + pads; 723 724 int group_id = output_channel / ${c}; 725 int wOutChannel = output_channel - group_id * ${c}; 726 727 float value = ${s}; 728 for (int inChannelOffset = 0; inChannelOffset < ${p}; inChannelOffset++) { 729 int input_channel = group_id * ${p} + inChannelOffset; 730 for (int wWOff = 0; wWOff < ${l[2]}; wWOff++) { 731 for (int wHOff = 0; wHOff < ${l[3]}; wHOff++) { 732 ivec2 wOff = ivec2(wWOff * ${n.dilations[0]}, wHOff * ${n.dilations[1]}); 733 ivec2 wLoc = loc - wOff; 734 ivec2 wLocIn = wLoc / strides; 735 if ( 736 wLocIn * strides == wLoc && 737 wLocIn.x >= 0 && wLocIn.x < ${u[2]} && 738 wLocIn.y >= 0 && wLocIn.y < ${u[3]} 739 ) { 740 float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); 741 float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); 742 value += xVal * wVal; 743 } 744 } 745 } 746 } 747 ${g} 748 ${d.output} = vec4(value, .0, .0, .0); 749 } 750`;return Object.assign(Object.assign({},r),{output:{dims:f,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:b,hasMain:!0})})(t,e,u,r)})})(t,e,r),e),p=(t,e)=>{let r=t.kernelShape.slice();if(0===t.kernelShape.length)for(let t=2;t<e[1].dims.length;++t)r.push(e[1].dims[t]);let n=t.pads.slice(),i=t.outputShape.slice();((t,e,r,n,i,o,a,l)=>{let c=t.length-2,p=0===l.length;for(let f=0;f<c;++f){let d=p?t[f+2]*o[f]:l[f];u(s(t[f+2],o[f],i[f],e[f],r[f],d),n,i,f,f+c),p&&l.push(o[f]*(t[f+2]-1)+a[f]+(e[f]-1)*r[f]+1-i[f]-i[f+c])}})(e[0].dims,r,t.dilations,t.autoPad,n,t.strides,t.outputPadding,i);let o=Object.assign({},t);return Object.assign(o,{kernelShape:r,pads:n,outputShape:i,cacheKey:t.cacheKey}),o};e.parseConvTransposeAttributes=t=>{let e=t.attributes,r=(0,a.parseInternalActivationAttributes)(e),i=e.getString("auto_pad","NOTSET"),o=e.getInts("dilations",[1,1]),s=e.getInt("group",1),u=e.getInts("kernel_shape",[]),l=e.getInts("output_padding",[0,0]),c=e.getInts("output_shape",[]),p=e.getInts("pads",[0,0,0,0]),f=e.getInts("strides",[1,1]);return(0,n.createAttributeWithCacheKey)(Object.assign({autoPad:i,dilations:o,group:s,kernelShape:u,outputPadding:l,outputShape:c,pads:p,strides:f},r))};let f=(t,e)=>{if(!t||2!==t.length&&3!==t.length)throw Error("Conv requires 2 or 3 inputs");if(4!==t[0].dims.length||4!==t[1].dims.length)throw Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[0])throw Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let r=t[1].dims[1]*e.group;
750if(3===t.length&&(1!==t[2].dims.length||t[2].dims[0]!==r))throw Error("invalid bias");let n=t[0].dims.length-2;if(e.dilations.length!==n)throw Error(`dilations should be ${n}D`);if(e.strides.length!==n)throw Error(`strides should be ${n}D`);if(e.pads.length!==2*n)throw Error(`pads should be ${2*n}D`);if(e.outputPadding.length!==n)throw Error(`output_padding should be ${n}D`);if(0!==e.kernelShape.length&&e.kernelShape.length!==t[1].dims.length-2)throw Error("invalid kernel shape");if(0!==e.outputShape.length&&e.outputShape.length!==t[0].dims.length-2)throw Error("invalid output shape");if("float32"!==t[0].type||"float32"!==t[1].type)throw Error("ConvTranspose input(X,W) should be float tensor");if(3===t.length&&"float32"!==t[2].type)throw Error("ConvTranspose input(bias) should be float tensor")}},8138:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvAttributes=e.conv=e.calculateOutputShape=void 0;let n=r(246),i=r(2517),o=r(4770),a=r(1386),s=r(9828),u=r(2823),l=r(3248),c=r(5623);e.calculateOutputShape=(t,e,r,n,i)=>{let o=t[0],a=t.slice(2),s=a.length,u=e[0],l=e.slice(2).map((t,e)=>t+(t-1)*(r[e]-1));return[o,u].concat(...a.map((t,e)=>t+n[e]+n[e+s]).map((t,e)=>Math.floor((t-l[e]+i[e])/i[e])))},e.conv=(t,e,r)=>(g(e,r),p(t,e,r));let p=(t,e,r)=>{let n=h(r,e),i=t.session.pack,s=1===n.kernelShape[0]&&1===n.kernelShape[1];return n.group>1?[t.run((0,o.createUnpackedGroupedConvProgramInfoLoader)(t,e,n),e)]:s&&i?[f(t,e,n)]:i&&4===e[0].dims.length&&1===e[0].dims[0]&&!s?[(0,a.conv2DPacked)(t,e,n)]:[d(t,e,n)]},f=(t,r,n)=>{let i=r[0].dims,o=r[1].dims,a=(0,e.calculateOutputShape)(i,o,n.dilations,n.pads,n.strides),s=t.reshapeUnpacked(r[0],[i[1],i[2]*i[3]]),u=t.reshapeUnpacked(r[1],[o[0],o[1]]),l=r.length>2?[u,s,r[2]]:[u,s],p=t.run((0,c.createMatmulProgramInfoLoader)(l,n),l);return t.reshapeUnpacked(p,a)},d=(t,r,n)=>{let i=r[0].dims,o=r[1].dims,a=(0,e.calculateOutputShape)(i,o,n.dilations,n.pads,n.strides),u=t.run((0,l.createIm2ColProgramInfoLoader)(t,r[0],r[1],a,n),[r[0]]),c=3===r.length?[u,r[1],r[2]]:[u,r[1]];return t.run((0,s.createDotProductProgramInfoLoader)(t,r,a,n),c)},h=(t,e)=>{let r=t.kernelShape.slice();if(0===t.kernelShape.length)for(let t=2;t<e[1].dims.length;++t)r.push(e[1].dims[t]);let n=t.pads.slice();i.PoolConvUtil.adjustPadsBasedOnAutoPad(e[0].dims,t.strides,t.dilations,r,n,t.autoPad);let o=Object.assign({},t);return Object.assign(o,{kernelShape:r,pads:n,cacheKey:t.cacheKey}),o};e.parseConvAttributes=t=>{let e=t.attributes,r=(0,u.parseInternalActivationAttributes)(e),i=e.getString("auto_pad","NOTSET"),o=e.getInts("dilations",[1,1]),a=e.getInt("group",1),s=e.getInts("kernel_shape",[]),l=e.getInts("pads",[0,0,0,0]),c=e.getInts("strides",[1,1]);return(0,n.createAttributeWithCacheKey)(Object.assign({autoPad:i,dilations:o,group:a,kernelShape:s,pads:l,strides:c},r))};let g=(t,e)=>{if(!t||2!==t.length&&3!==t.length)throw Error("Conv requires 2 or 3 inputs");if(4!==t[0].dims.length||4!==t[1].dims.length)throw Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[1]*e.group)throw Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(3===t.length&&(1!==t[2].dims.length||t[1].dims[0]!==t[2].dims[0]))throw Error("invalid bias");let r=t[0].dims.length-2;if(e.dilations.length!==r)throw Error(`dilations should be ${r}D`);if(e.strides.length!==r)throw Error(`strides should be ${r}D`);if(e.pads.length!==2*r)throw Error(`pads should be ${2*r}D`);if(0!==e.kernelShape.length&&e.kernelShape.length!==t[1].dims.length-2)throw Error("invalid kernel shape");if("float32"!==t[0].type||"float32"!==t[1].type)throw Error("Conv input(X,W) should be float tensor");if(3===t.length&&"float32"!==t[2].type)throw Error("Conv input(bias) should be float tensor")}},5193:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseDepthToSpaceAttributes=e.depthToSpace=void 0;let n=r(3738);e.depthToSpace=(t,e,r)=>{i(e);let o=r.blocksize,a=o*o,s="DCR"===r.mode?[0,3,4,1,5,2]:[0,1,4,2,5,3],u="DCR"===r.mode?[e[0].dims[0],o,o,e[0].dims[1]/a,e[0].dims[2],e[0].dims[3]]:[e[0].dims[0],e[0].dims[1]/
750a,o,o,e[0].dims[2],e[0].dims[3]],l=t.reshapeUnpacked(e[0],u),c={perm:s,cacheKey:`${s}`},[p]=(0,n.transpose)(t,[l],c),f=[e[0].dims[0],e[0].dims[1]/a,e[0].dims[2]*o,e[0].dims[3]*o];return[t.reshapeUnpacked(p,f)]},e.parseDepthToSpaceAttributes=t=>{let e=t.attributes.getInt("blocksize");if(e<1)throw Error(`blocksize must be >= 1, but got : ${e} for DepthToSpace`);let r=t.attributes.getString("mode","DCR");if("DCR"!==r&&"CRD"!==r)throw Error(`unrecognized mode: ${r} for DepthToSpace`);return{mode:r,blocksize:e}};let i=t=>{if(1!==t.length)throw Error(`DepthToSpace expect 1 inputs, but got ${t.length}`);if("string"===t[0].type||4!==t[0].dims.length)throw TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createDotProductProgramInfoLoader=void 0;let n=r(2517),i=r(5060),o=r(2039),a=r(2823),s=r(3248);e.createDotProductProgramInfoLoader=(t,e,r,u)=>{let l,c;let p=(l=e.length>2,c=u,{name:"ConvDotProduct",inputNames:l?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:l?[o.TextureType.unpacked,o.TextureType.packedLastDimension,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.packedLastDimension],cacheKey:c.activationCacheKey});return Object.assign(Object.assign({},p),{get:()=>((t,e,r,u,l)=>{let c=r[0].dims,p=r[1].dims,f=[p[0],Math.ceil(c[1]*p[2]*p[3]/4)],d=(0,s.calculateIm2ColDims)(c,p,u),[h,g]=t.calculateTextureWidthAndHeight(f,o.TextureType.packedLastDimension),b=n.ShapeUtil.computeStrides(d),[m,y]=t.calculateTextureWidthAndHeight(d,o.TextureType.packedLastDimension),_=u.length,v=r.length<3?"0.0":"_B(b)",x=Math.ceil(c[1]*p[2]*p[3]/4),{activationFunction:w,applyActivation:T}=(0,a.getActivationSnippet)(l),S=(0,i.getGlsl)(t.session.backend.glContext.version),O=` 751${w} 752float process(int indices[${_}]) { 753 int b[1]; 754 b[0] = indices[1]; 755 int im2col[4]; 756 im2col[0] = indices[0]; 757 im2col[1] = indices[2]; 758 im2col[2] = indices[3]; 759 int im2colOffset = im2col[0] * ${b[0]} + im2col[1] * ${b[1]} + im2col[2] * ${b[2]}; 760 int kernelOffset = indices[1] * ${f[1]}; 761 float value = ${v}; 762 for (int i = 0; i < ${x}; ++i) { 763 vec2 im2colCoords = offsetToCoords(im2colOffset, ${m}, ${y}); 764 vec2 kernelCoords = offsetToCoords(kernelOffset, ${h}, ${g}); 765 value += dot(${S.texture2D}(Im2Col, im2colCoords), ${S.texture2D}(K, kernelCoords)); 766 ++im2colOffset; 767 ++kernelOffset; 768 } 769 ${T} 770 return value; 771}`;return Object.assign(Object.assign({},e),{output:{dims:u,type:r[0].type,textureType:o.TextureType.unpacked},shaderSource:O})})(t,p,e,r,u)})}},7992:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseFlattenAttributes=e.flatten=void 0;let n=r(2517);e.flatten=(t,e,r)=>{i(e,r);let o=n.ShapeUtil.flattenShape(e[0].dims,r);return[t.reshapeUnpacked(e[0],o)]},e.parseFlattenAttributes=t=>t.attributes.getInt("axis",1);let i=(t,e)=>{if(!t||1!==t.length)throw Error("Flatten requires 1 input.");let r=t[0].dims.length;if(0===r)throw Error("scalar tensor is not supported.");if(e<-r||e>r)throw Error("Invalid axis");if("string"===t[0].type)throw Error("string tensor is not supported.")}},2823:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseInternalActivationAttributes=e.getActivationSnippet=void 0;let n=r(2517),i=r(4909);e.getActivationSnippet=function(t){let e;switch(t.activation){case"Relu":e=(0,i.glslRelu)();break;case"Sigmoid":e=(0,i.glslSigmoid)();break;case"Clip":e=(0,i.glslClip)(t.clipMin,t.clipMax);break;default:return{activationFunction:"",applyActivation:""}}let r=e.name;return{activationFunction:e.body,applyActivation:`value = ${r}_(value);`}},e.parseInternalActivationAttributes=t=>{let e=t.getString("activation","");if("Clip"===e){let[r,i]=t.getFloats("activation_params",[n.MIN_CLIP,n.MAX_CLIP]);return{activation:e,clipMax:i,clipMin:r,activationCacheKey:`${e}:${r},${i}`}}return{activation:e,activationCacheKey:e}}},1253:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseGatherAttributes=e.gather=void 0;let n=r(246),i=r(782),o=r(2517),a=r(2039);e.gather=(t,e,r)=>(l(e,r.axis),[t.run(u(t,e,r),e)]),e.parseGatherAttributes=t=>(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",0)});let s={name:"Gather",inputNames:["A","B"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},u=(t,e,r)=>{let n=Object.assign(Object.assign({}
771,s),{cacheHint:r.cacheKey});return Object.assign(Object.assign({},n),{get:()=>((t,e,r,n)=>{let i=r[0].dims.slice(),s=r[1].dims.slice(),u=Array(i.length+s.length-1);n=o.ShapeUtil.normalizeAxis(n,i.length);let l=[];for(let t=0;t<u.length;t++)t<n?(u[t]=i[t],l.push(`inputIdx[${t}] = outputIdx[${t}];`)):t<n+s.length?(u[t]=s[t-n],l.push(`indexDataIdx[${t-n}] = outputIdx[${t}];`)):(u[t]=i[t-s.length+1],l.push(`inputIdx[${t-s.length+1}] = outputIdx[${t}];`));let c=` 772 float process(int outputIdx[${u.length||1}]) { 773 int inputIdx[${i.length}]; 774 int indexDataIdx[${s.length||1}]; 775 indexDataIdx[0] = 0; 776 ${l.join("\n ")} 777 int idx = int(_B(indexDataIdx)); 778 inputIdx[${n}] = idx < 0 ? idx + ${i[n]} : idx; 779 return _A(inputIdx); 780 }`;return Object.assign(Object.assign({},e),{output:{dims:u,type:r[0].type,textureType:a.TextureType.unpacked},shaderSource:c})})(0,n,e,r.axis)})},l=(t,e)=>{if(!t||2!==t.length)throw Error("Gather requires 2 inputs.");let r=t[0].dims.length;if(r<1)throw Error("Invalid input shape.");if(e<-r||e>r-1)throw Error("Invalid axis.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type)||"int32"!==t[1].type&&"int16"!==t[1].type)throw Error("Invaid input type.")}},4776:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseGemmAttributesV11=e.parseGemmAttributesV7=e.gemm=void 0;let n=r(246),i=r(2517),o=r(2039);e.gemm=(t,e,r)=>(l(e,r),[t.run(s(e,r),e)]);let a=(t,e)=>{let r=0!==t.attributes.getInt("transA",0),i=0!==t.attributes.getInt("transB",0),o=t.attributes.getFloat("alpha",1),a=t.attributes.getFloat("beta",1);return(0,n.createAttributeWithCacheKey)({transA:r,transB:i,alpha:o,beta:a,isOptionalC:e})};e.parseGemmAttributesV7=t=>a(t,!1),e.parseGemmAttributesV11=t=>a(t,!0);let s=(t,e)=>{let r={name:"Gemm",inputNames:3===t.length?["A","B","C"]:["A","B"],inputTypes:3===t.length?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],key:e.cacheKey};return Object.assign(Object.assign({},r),{get:()=>u(r,t,e)})},u=(t,e,r)=>{let n=e[0].dims.slice(),a=e[1].dims.slice(),[s,u]=i.GemmUtil.getShapeOfGemmResult(n,r.transA,a,r.transB,3===e.length?e[2].dims:void 0),l=[s,u];if(!l)throw Error("Can't use gemm on the given tensors");let c=n[n.length-1],p="";r.transA&&(c=n[0]),r.transA&&r.transB?p="value += _A_T(a) * _B_T(b);":r.transA&&!r.transB?p="value += _A_T(a) * _B(b);":!r.transA&&r.transB?p="value += _A(a) * _B_T(b);":r.transA||r.transB||(p="value += _A(a) * _B(b);");let f=l.length,d=` 781 float process(int indices[${f}]) { 782 int a[${f}]; 783 int b[${f}]; 784 ${3===e.length?`int c[${e[2].dims.length}];`:""} 785 786 copyVec(indices, a); 787 copyVec(indices, b); 788 ${3===e.length?"bcastIndices_C(indices, c);":""} 789 790 float value = 0.0; 791 for (int k=0; k<${c}; ++k) { 792 a[${f-1}] = k; 793 b[${f-2}] = k; 794 ${p} 795 } 796 797 value = value * alpha; 798 ${3===e.length?"value += beta * _C(c);":""} 799 return value; 800 }`;return Object.assign(Object.assign({},t),{output:{dims:l,type:e[0].type,textureType:o.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:r.alpha},{name:"beta",type:"float",data:r.beta}],shaderSource:d})},l=(t,e)=>{if(!t)throw Error("Input is missing");if(e.isOptionalC&&(t.length<2||t.length>3))throw Error("Invaid input shape.");if(!e.isOptionalC&&3!==t.length)throw Error("Gemm requires 3 inputs");if(3===t.length&&1!==t[2].dims.length&&2!==t[2].dims.length)throw Error("Invalid input shape of C");if("float32"!==t[0].type&&"float64"!==t[0].type||"float32"!==t[1].type&&"float64"!==t[1].type||3===t.length&&"float32"!==t[2].type&&"float64"!==t[2].type)throw Error("Invalid input type.");if(t[0].type!==t[1].type||3===t.length&&t[0].type!==t[2].type)throw Error("Input types are mismatched")}},8555:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedIm2ColProgramInfoLoader=void 0;let n=r(5060),i=r(2039),o=r(2827);e.createPackedIm2ColProgramInfoLoader=(t,e,r,a,s)=>{var u;let l=(u=s.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[i.TextureType.packed],cacheHint:u});return Object.assign(Object.assign({},l),{get:()=>((t,e,r,a,s,u)=>{let l=r.dims,c=a.dims,p=s.length,f=[c[1]*c[2]*c[3],s[2]*s[3]],d=c[2]*c[3],h=(0,o.unpackFromChannel)(),g=(0,n.getGlsl)(t.session.backend.glContext.version),b="";for(let t=0;t<=1;t++)for(let e=0;e<=1;e++)b+=` 801 blockIndex = rc.x + ${e}; 802 pos = rc.y + ${t}; 803 804 if(blockIndex < ${f[1]} && pos < ${f[0]}) { 805 offsetY = int(blockIndex / (${s[p-1]})) * ${u.strides[0]} - 806 ${u.pads[0]}; 807 d0 = offsetY + ${u.dilations[0]} * (imod(pos, ${d}) / ${c[2]}); 808 809 if(d0 < ${l[2]} && d0 >= 0) { 810 offsetX = imod(blockIndex, ${s[p-1]}) * ${u.strides[1]} - 811 ${u.pads[1]}; 812 d1 = offsetX + ${u.dilations[1]} * imod(imod(pos, ${d}), ${c[2]}); 813 814 if(d1 < ${l[3]} && d1 >= 0) { 815 816 ch = int(float(pos)/ ${d}.); 817 innerDims = vec2(d0, d1); 818 result[${2*t+e}] = getChannel( 819 getA(0, ch, int(innerDims.x), 820 int(innerDims.y)), innerDims); 821 } 822 } 823 } 824 825 `;let m=` 826 ${h} 827 828 void main() { 829 ivec2 rc = getOutputCoords(); 830 vec4 result = vec4(0.0); 831 int blockIndex, pos, offsetY, d0, offsetX, d1, ch; 832 vec2 innerDims; 833 ${b} 834 ${g.output} = result; 835 } 836 `;return Object.assign(Object.assign({},e),{output:{dims:f,type:r.type,textureType:i.TextureType.packed},shaderSource:m,hasMain:!0})})(t,l,e,r,a,s)})}},3248:(t,e,r)=>{"use strict";
836Object.defineProperty(e,"__esModule",{value:!0}),e.calculateIm2ColDims=e.createIm2ColProgramInfoLoader=void 0;let n=r(2039);e.createIm2ColProgramInfoLoader=(t,r,i,o,a)=>{var s;let u=(s=a.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[n.TextureType.unpacked],cacheHint:s});return Object.assign(Object.assign({},u),{get:()=>((t,r,i,o,a,s)=>{let u=i.dims,l=o.dims,c=a.length,p=(0,e.calculateIm2ColDims)(u,l,a,4),f=` 837 const int XC = ${u[1]}; 838 const int XH = ${u[2]}; 839 const int XW = ${u[3]}; 840 const int KH = ${s.kernelShape[0]}; 841 const int KW = ${s.kernelShape[1]}; 842 const int dilationH = ${s.dilations[0]}; 843 const int dilationW = ${s.dilations[1]}; 844 const int strideH = ${s.strides[0]}; 845 const int strideW = ${s.strides[1]}; 846 const int padH = ${s.pads[0]}; 847 const int padW = ${s.pads[1]}; 848 const int KHKW = KH*KW; 849 const int XCKHKW = XC * KHKW; 850 const int outputChannels = 4; 851 vec4 process(int indices[${c}]) { 852 int b = indices[0]; // batch size 853 int oh = indices[1] * strideH - padH; //output height 854 int ow = indices[2] * strideW - padW; //output width 855 int p = indices[3] * outputChannels; //patch 856 vec4 value = vec4(0.0); 857 for(int i=0; i < outputChannels; ++i) { 858 if(p < XCKHKW) { 859 int patchC = p / KHKW; 860 int patchH = (p - patchC*KHKW) / KW; 861 int patchW = (p - patchC*KHKW) - patchH * KW; 862 int xh2 = oh + patchH * dilationH; 863 int xw2 = ow + patchW * dilationW; 864 int x[${u.length}]; 865 x[0] = b; 866 x[1] = patchC; 867 x[2] = xh2; 868 x[3] = xw2; 869 if(xh2 >= 0 && 870 xh2 < XH && 871 xw2 >= 0 && 872 xw2 < XW) { 873 value[i] = _X(x); 874 } 875 } 876 ++p; 877 } 878 return value; 879 } 880 `;return Object.assign(Object.assign({},r),{output:{dims:p,type:i.type,textureType:n.TextureType.packedLastDimension},shaderSource:f})})(0,u,r,i,o,a)})},e.calculateIm2ColDims=(t,e,r,n=4)=>[r[0],r[2],r[3],Math.ceil(t[1]*e[2]*e[3]/n)]},6572:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseImageScalerAttributes=e.imageScaler=void 0;let n=r(246),i=r(2039);e.imageScaler=(t,e,r)=>(u(e),[t.run(a(t,e,r),e)]),e.parseImageScalerAttributes=t=>{let e=t.attributes.getFloat("scale"),r=t.attributes.getFloats("bias");return(0,n.createAttributeWithCacheKey)({scale:e,bias:r})};let o={name:"ImageScaler",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},a=(t,e,r)=>{let n=Object.assign(Object.assign({},o),{cacheHint:r.cacheKey});return Object.assign(Object.assign({},n),{get:()=>((t,e,r,n)=>{let o=r[0].dims.slice(),a=o.length,u=` 881 ${s(n.bias.length)} 882 float process(int indices[${a}]) { 883 return _X(indices) * scale + getBias(bias, indices[1]); 884 }`;return Object.assign(Object.assign({},e),{output:{dims:o,type:r[0].type,textureType:i.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:n.bias.length,data:n.bias},{name:"scale",type:"float",data:n.scale}],shaderSource:u})})(0,n,e,r)})},s=t=>{let e=[`float getBias(float bias[${t}], int channel) {`];for(let r=0;r<t;++r)0===r?e.push(` if (channel == ${r}) { return bias[${r}]; }`):r===t-1?e.push(` else { return bias[${r}]; }`):e.push(` else if (channel == ${r}) { return bias[${r}]; }`);return e.push(" }"),e.join("\n")},u=t=>{if(!t||1!==t.length)throw Error("ImageScaler requires 1 input.");if(4!==t[0].dims.length)throw Error("Invalid input shape.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type.")}},3346:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseInstanceNormalizationAttributes=e.instanceNormalization=void 0;let n=r(5060),i=r(2039);e.instanceNormalization=(t,e,r)=>{l(e);let n=t.run(a(e[0]),e);return[t.run(u(t,e[0],r,n.dims),[e[0],n,e[1],e[2]])]},e.parseInstanceNormalizationAttributes=t=>t.attributes.getFloat("epsilon",1e-5);let o={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},a=t=>Object.assign(Object.assign({},o),{get:()=>((t,e)=>{let r=e.dims.slice(),n=r[1],o=r[2]*r[3],a=[r[0],n],s=` 885 vec4 process(int[2] indices) { 886 vec4 v = vec4(0.0); 887 int a[4];
888 a[0] = indices[0]; 889 a[1] = indices[1]; 890 float temp = 0.0; 891 for(int a2=0; a2<${r[2]}; a2++) { 892 a[2] = a2; 893 for(int a3=0; a3<${r[3]}; a3++) { 894 a[3] = a3; 895 float x = _X(a); 896 temp += x; 897 } 898 } 899 float mean = temp / float(${o}); 900 temp = 0.0; 901 for(int a2=0; a2<${r[2]}; a2++) { 902 a[2] = a2; 903 for(int a3=0; a3<${r[3]}; a3++) { 904 a[3] = a3; 905 float x = _X(a); 906 temp += (x - mean) * (x - mean); 907 } 908 } 909 v.r = mean; 910 v.g = temp / float(${o}); 911 912 return v; 913 }`;return Object.assign(Object.assign({},t),{output:{dims:a,type:e.type,textureType:i.TextureType.packedLastDimension},shaderSource:s})})(o,t)}),s={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[i.TextureType.unpacked,i.TextureType.packedLastDimension,i.TextureType.unpacked,i.TextureType.unpacked]},u=(t,e,r,o)=>{let a=Object.assign(Object.assign({},s),{cacheHint:`${r}`});return Object.assign(Object.assign({},a),{get:()=>((t,e,r,o,a)=>{let s=(0,n.getGlsl)(t.session.backend.glContext.version),[u,l]=t.calculateTextureWidthAndHeight(a,i.TextureType.packedLastDimension),[c,p]=[u/4,l],f=` 914 vec4 get_MeanAndVariance(int[2] mv) { 915 int offset = indicesToOffset_MeanAndVariance(mv); 916 vec2 coords = offsetToCoords(offset, ${c}, ${p}); 917 return ${s.texture2D}(MeanAndVariance, coords); 918 } 919 920 float process(int[4] indices) { 921 int mv[2]; 922 mv[0] = indices[0]; 923 mv[1] = indices[1]; 924 vec4 mean_and_variance = get_MeanAndVariance(mv); 925 float mean = mean_and_variance.r; 926 float variance = mean_and_variance.g; 927 928 int sb[1]; 929 sb[0] = indices[1]; 930 float scale = _Scale(sb); 931 float b = _B(sb); 932 933 return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; 934 }`;return Object.assign(Object.assign({},e),{output:{dims:r.dims,type:r.type,textureType:i.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:o}],shaderSource:f})})(t,a,e,r,o)})},l=t=>{if(!t||3!==t.length)throw Error("InstanceNormalization requires 3 inputs.");let e=t[0],r=t[1],n=t[2];if(e.dims.length<3||1!==r.dims.length||1!==n.dims.length)throw Error("Invalid input shape.");if(r.dims[0]!==e.dims[1]||n.dims[0]!==e.dims[1])throw Error("Input shapes are mismatched.");if("float32"!==e.type&&"float64"!==e.type||"float32"!==r.type&&"float64"!==r.type||"float32"!==n.type&&"float64"!==n.type)throw Error("Invalid input type.");if(4!==t[0].dims.length)throw Error("Only support 4-D input shape.")}},708:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedMatmulProgramInfoLoader=void 0;let n=r(2517),i=r(5060),o=r(2039),a=r(9390),s=r(2823),u=r(5623);e.createPackedMatmulProgramInfoLoader=(t,e,r)=>{var l,c;let p=(l=e.length>2,c=r.activationCacheKey,{name:"MatMul (packed)",inputNames:l?["A","B","Bias"]:["A","B"],inputTypes:l?[o.TextureType.packed,o.TextureType.packed,o.TextureType.packed]:[o.TextureType.packed,o.TextureType.packed],cacheHint:c});return Object.assign(Object.assign({},p),{get:()=>((t,e,r,l)=>{let c=r.length>2,p=c?"value += getBiasForMatmul();":"",f=r[0].dims,d=r[1].dims,h=n.BroadcastUtil.calcShape(f,d,!0),g=!n.ShapeUtil.areEqual(r[0].dims,r[1].dims);if(!h)throw Error("Can't use matmul on the given tensors");let b=Math.ceil(f[f.length-1]/2),m=f.length,y=d.length,_=(0,i.getGlsl)(t.session.backend.glContext.version),v=(0,a.getCoordsDataType)(h.length),x=h.length,w=(0,a.getGlChannels)(),{activationFunction:T,applyActivation:S}=(0,s.getActivationSnippet)(l),O=c?`${(0,u.getBiasForMatmul)(v,w,r[2].dims,h,!0)}`:"",A=g?`${function(t,e,r,i){let o=[],a=[],s=r[0].dims,u=r[1].dims,l=s.length,c=u.length,p=i.length,f=p-l,d=p-c;(o=s.map((t,r)=>`coords.${e[r+f]}`))[l-1]="i*2",o.join(", "),(a=u.map((t,r)=>`coords.${e[r+d]}`))[c-2]="i*2",a.join(", ");let h=n.BroadcastUtil.getBroadcastDims(s,i),g=n.BroadcastUtil.getBroadcastDims(u,i),b=h.map(t=>`coords.${e[t+f]} = 0;`).join("\n"),m=g.map(t=>`coords.${e[t+d]} = 0;`).join("\n"),y=`int lastDim = coords.${e[p-1]}; 935 coords.${e[p-1]}
935 = coords.${e[p-2]}; 936 coords.${e[p-2]} = lastDim;`;return` 937vec4 getAAtOutCoordsMatmul(int i) { 938 ${t} coords = getOutputCoords(); 939 ${y} 940 ${b} 941 vec4 outputValue = getA(${o}); 942 return outputValue; 943} 944 945vec4 getBAtOutCoordsMatmul(int i) { 946 ${t} coords = getOutputCoords(); 947 ${y} 948 ${m} 949 vec4 outputValue = getB(${a}); 950 return outputValue; 951}`}(v,w,r,h)}`:"",E=g?"getAAtOutCoordsMatmul(i)":`getA(${function(t,e){let r="";for(let n=0;n<e-2;n++)r+=`rc.${t[n]}, `;return r+`rc.${t[e-2]}, i*2`}(w,m)})`,I=g?"getBAtOutCoordsMatmul(i)":`getB(${function(t,e){let r="";for(let n=0;n<e-2;n++)r+=`rc.${t[n]}, `;return r+`i*2, rc.${t[e-1]}`}(w,y)})`,P=` 952 ${A} 953 ${O} 954 ${T} 955 void main() { 956 ${g?"":`${v} rc = 957 getOutputCoords(); int lastDim = rc.${w[x-1]}; rc.${w[x-1]} = 958 rc.${w[x-2]}; rc.${w[x-2]} = lastDim; 959 `} 960 961 vec4 value = vec4(0); 962 for (int i = 0; i < ${b}; i++) { 963 vec4 a = ${E}; 964 vec4 b = ${I}; 965 966 value += (a.rrbb * b.rgrg); 967 value += (a.ggaa * b.baba); 968 } 969 ${p} 970 ${S} 971 ${_.output} = value; 972 }`;return Object.assign(Object.assign({},e),{output:{dims:h,type:r[0].type,textureType:o.TextureType.packed},shaderSource:P,hasMain:!0})})(t,p,e,r)})}},5623:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBiasForMatmul=e.createMatmulProgramInfoLoader=e.parseMatMulAttributes=e.matMul=void 0;let n=r(2517),i=r(2039),o=r(9390),a=r(2823),s=r(708);function u(t,e){var r,s;let u=(r=t.length>2,s=e.activationCacheKey,{name:"MatMul",inputNames:r?["A","B","Bias"]:["A","B"],inputTypes:r?[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.unpacked],cacheHint:s});return Object.assign(Object.assign({},u),{get:()=>(function(t,e,r){let s=e[0].dims,u=e[1].dims,l=n.BroadcastUtil.calcShape(s,u,!0);if(!l)throw Error("Can't use matmul on the given tensors");let p=(0,o.getCoordsDataType)(l.length),f=(0,o.getGlChannels)(),{activationFunction:d,applyActivation:h}=(0,a.getActivationSnippet)(r),g=e.length>2,b=g?"value += getBiasForMatmul();":"",m=g?`${c(p,f,e[2].dims,l,!1)}`:"",y=l.length,_=s.length,v=u.length,x=` 973 ${d} 974 ${m} 975 float process(int indices[${y}]) { 976 int a[${_}]; 977 int b[${v}]; 978 bcastMatmulIndices_A(indices, a); 979 bcastMatmulIndices_B(indices, b); 980 981 float value; 982 for (int k=0; k<${s[s.length-1]}; ++k) { 983 a[${_-1}] = k; 984 b[${v-2}] = k; 985 value += _A(a) * _B(b); 986 } 987 ${b} 988 ${h} 989 return value; 990 }`;return Object.assign(Object.assign({},t),{output:{dims:l,type:e[0].type,textureType:i.TextureType.unpacked},shaderSource:x})})(u,t,e)})}e.matMul=(t,e,r)=>(l(e),t.session.pack?[t.run((0,s.createPackedMatmulProgramInfoLoader)(t,e,r),e)]:[t.run(u(e,r),e)]),e.parseMatMulAttributes=t=>(0,a.parseInternalActivationAttributes)(t.attributes),e.createMatmulProgramInfoLoader=u;let l=t=>{if(!t||2!==t.length)throw Error("MatMul requires 2 inputs.");if(t[0].dims[t[0].dims.length-1]!==t[1].dims[t[1].dims.length-2])throw Error("shared dimension does not match.");if("float32"!==t[0].type&&"float64"!==t[0].type||"float32"!==t[1].type&&"float64"!==t[1].type)throw Error("inputs should be float type");if(t[0].type!==t[1].type)throw Error("inputs types should match")};function c(t,e,r,i,o){let a="",s=r.length,u=i.length,l=u-s;a=u<2&&s>0?"coords":r.map((t,r)=>`coords.${e[r+l]}`).join(", ");let c=n.BroadcastUtil.getBroadcastDims(r,i).map(t=>`coords.${e[t+l]} = 0;`).join("\n"),p="vec4(outputValue.xx, outputValue.yy)";return 1===n.ShapeUtil.size(r)&&(p="vec4(outputValue.x)"),o?` 991vec4 getBiasForMatmul() { 992 ${t} coords = getOutputCoords(); 993 ${c} 994 vec4 outputValue = getBias(${a}); 995 return ${p}; 996}`:` 997float getBiasForMatmul() { 998 ${t} coords = getOutputCoords(); 999 ${c} 1000 return getBias(coords.x); 1001}`}e.getBiasForMatmul=c},2403:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackProgramInfoLoader=void 0;
1001let n=r(5060),i=r(2039),o=r(9390),a=r(2827),s={name:"pack",inputNames:["A"],inputTypes:[i.TextureType.unpackedReversed]};e.createPackProgramInfoLoader=(t,e)=>Object.assign(Object.assign({},s),{get:()=>((t,e)=>{var r,u,l,c;let p;let f=(0,n.getGlsl)(t.session.backend.glContext.version),d=e.dims,h=d.length,g=e.dims.length,b=(0,o.getCoordsDataType)(g),m=(0,a.getChannels)("rc",g),y=(r=g,u=m,l=d[d.length-2],c=d[d.length-1],0===r||1===r?"":` 1002 int r = ${u[r-2]}; 1003 int c = ${u[r-1]}; 1004 int rp1 = ${u[r-2]} + 1; 1005 int cp1 = ${u[r-1]} + 1; 1006 bool rEdge = rp1 >= ${c}; 1007 bool cEdge = cp1 >= ${l}; 1008 `);p=0===h?[1,1]:1===h?[d[0],1]:[d[g-1],d[g-2]];let _=function(t,e,r){if(0===t)return"false";if(1===t)return`rc > ${e[0]}`;let n="";for(let i=t-2;i<t;i++)n+=`${r[i]} >= ${e[i-t+2]}`,i<t-1&&(n+="||");return n}(g,p,m),v=function(t,e){let r=t.length;if(0===r)return"getA(), 0, 0, 0";if(1===r)return`getA(rc), 1009 rc + 1 >= ${t[0]} ? 0. : getA(rc + 1), 1010 0, 0`;let n="";if(r>2)for(let t=0;t<r-2;++t)n+=`${e[t]},`;return`getA(${n}r, c), 1011 rEdge ? 0. : getA(${n}rp1, c), 1012 cEdge ? 0. : getA(${n}r, cp1), 1013 rEdge || cEdge ? 0. : getA(${n}rp1, cp1)`}(d,m),x=` 1014 void main() { 1015 ${b} rc = getOutputCoords(); 1016 1017 if(${_}) { 1018 ${f.output} = vec4(0); 1019 } else { 1020 ${y} 1021 1022 ${f.output} = vec4(${v}); 1023 } 1024 } 1025 `;return Object.assign(Object.assign({},s),{hasMain:!0,output:{dims:e.dims,type:e.type,textureType:i.TextureType.packed},shaderSource:x})})(t,e)})},2827:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unpackFromChannel=e.getChannels=e.getVecChannels=void 0;let n=r(9390);function i(t,e){return(0,n.getGlChannels)(e).map(e=>`${t}.${e}`)}e.getVecChannels=i,e.getChannels=function(t,e){return 1===e?[t]:i(t,e)},e.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 "}}
1025,2870:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parsePadAttributesV11=e.padV11=e.parsePadAttributesV2=e.padV2=void 0;let n=r(246),i=r(2517),o=r(5060),a=r(2039),s={name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.padV2=(t,e,r)=>(c(e),[t.run(Object.assign(Object.assign({},s),{cacheHint:r.cacheKey,get:()=>l(t,e[0],r)}),e)]),e.parsePadAttributesV2=t=>{let e=t.attributes.getString("mode","constant"),r=t.attributes.getFloat("value",0),i=t.attributes.getInts("pads");return(0,n.createAttributeWithCacheKey)({mode:e,value:r,pads:i})},e.padV11=(t,r,n)=>{p(r);let i=u(t,r,n);return(0,e.padV2)(t,[r[0]],i)},e.parsePadAttributesV11=t=>t.attributes.getString("mode","constant");let u=(t,e,r)=>{if(!t.session.isInitializer(e[1].dataId)||e.length>=3&&!t.session.isInitializer(e[2].dataId))throw Error("dynamic pad attributes are not allowed");let i=Array.from(e[1].integerData),o=e.length>=3?e[2].floatData[0]:0;return(0,n.createAttributeWithCacheKey)({mode:r,pads:i,value:o})},l=(t,e,r)=>{let n=i.ShapeUtil.padShape(e.dims.slice(),r.pads),o=n.length,s=` 1026 ${f(t,e,r)} 1027 float process(int[${o}] indices) { 1028 return padA(indices); 1029 }`;return{name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked],output:{dims:n,type:e.type,textureType:a.TextureType.unpacked},shaderSource:s}},c=t=>{if(!t||1!==t.length)throw Error("Pad requires 1 input");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type.")},p=t=>{if(!t||2!==t.length&&3!==t.length)throw Error("Pad requires 2 or 3 inputs");if("int32"!==t[1].type||t.length>=3&&"string"===t[2].type)throw Error("Invalid input type.")},f=(t,e,r)=>{let n=(0,o.getGlsl)(t.session.backend.glContext.version),[s,u]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),l=i.ShapeUtil.computeStrides(e.dims);switch(r.mode){case"constant":return d(n,e.dims,l,s,u,r.pads,r.value);case"reflect":return h(n,e.dims,l,s,u,r.pads);case"edge":return g(n,e.dims,l,s,u,r.pads);default:throw Error("Invalid mode")}},d=(t,e,r,n,i,o,a)=>{let s=e.length,u="";for(let t=s-1;t>=0;--t)u+=` 1030 k = m[${t}] - ${o[t]}; 1031 if (k < 0) return constant; 1032 if (k >= ${e[t]}) return constant; 1033 offset += k * ${r[t]}; 1034 `;return` 1035 float padA(int m[${s}]) { 1036 const float constant = float(${a}); 1037 int offset = 0; 1038 int k = 0; 1039 ${u} 1040 vec2 coords = offsetToCoords(offset, ${n}, ${i}); 1041 float value = getColorAsFloat(${t.texture2D}(A, coords)); 1042 return value; 1043 } 1044 `},h=(t,e,r,n,i,o)=>{let a=e.length,s="";for(let t=a-1;t>=0;--t)s+=` 1045 k = m[${t}] - ${o[t]}; 1046 if (k < 0) { k = -k; } 1047 { 1048 const int _2n_1 = ${2*(e[t]-1)}; 1049 k = int( mod( float(k), float(_2n_1) ) ) ; 1050 if(k >= ${e[t]}) { k = _2n_1 - k; } 1051 } 1052 offset += k * ${r[t]}; 1053 `;return` 1054 float padA(int m[${a}]) { 1055 int offset = 0; 1056 int k = 0; 1057 ${s} 1058 vec2 coords = offsetToCoords(offset, ${n}, ${i}); 1059 float value = getColorAsFloat(${t.texture2D}(A, coords)); 1060 return value; 1061 } 1062 `},g=(t,e,r,n,i,o)=>{let a=e.length,s="";for(let t=a-1;t>=0;--t)s+=` 1063 k = m[${t}] - ${o[t]}; 1064 if (k < 0) k = 0; 1065 if (k >= ${e[t]}) k = ${e[t]-1}; 1066 offset += k * ${r[t]}; 1067 `;return` 1068 float padA(int m[${a}]) { 1069 int offset = 0; 1070 int k = 0; 1071 ${s} 1072 vec2 coords = offsetToCoords(offset, ${n}, ${i}); 1073 float value = getColorAsFloat(${t.texture2D}(A, coords)); 1074 return value; 1075 } 1076 `}},2143:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.globalMaxPool=e.parseMaxPoolAttributes=e.maxPool=e.parseGlobalAveragePoolAttributes=e.globalAveragePool=e.parseAveragePoolAttributes=e.averagePool=void 0;let n=r(246),i=r(2517),o=r(2039);e.averagePool=(t,e,r)=>{p(e);let n={name:"AveragePool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:r.cacheKey};return[t.run(Object.assign(Object.assign({},n),{get:()=>a(e,n,!1,r)}),e)]},e.parseAveragePoolAttributes=t=>{let e=t.attributes.getString("auto_pad","NOTSET"),r=t.attributes.getInt("ceil_mode",0),i=0!==t.attributes.getInt("count_include_pad",0),o=t.attributes.getInts("kernel_shape"),a=t.attributes.getInts("strides",[]),s=t.attributes.getInts("pads",[]);if(0!==r)throw Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,n.createAttributeWithCacheKey)({autoPad:e,ceilMode:r,countIncludePad:i,kernelShape:o,strides:a,pads:s})};let a=(t,e,r,n)=>{let[a,s]=u(t,n,r),l=i.ShapeUtil.size(a.kernelShape),c="";a.countIncludePad?c+=`value /= float(${l});`:c+=`value /= float(${l} - pad);`;let p=` 1077 ${f(t[0].dims,a,"value += _X(x);",c,"0.0")} 1078 `;return Object.assign(Object.assign({},e),{output:{dims:s,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:p})};e.globalAveragePool=(t,e,r)=>{p(e);let n={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:`${r.countIncludePad}`};return[t.run(Object.assign(Object.assign({},n),{get:()=>a(e,n,!0,r)}),e)]},e.parseGlobalAveragePoolAttributes=t=>{let e=0!==t.attributes.getInt("count_include_pad",0);return(0,n.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:e,kernelShape:[],strides:[],pads:[]})},e.maxPool=(t,e,r)=>{p(e);let n={name:"MaxPool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:r.cacheKey};return[t.run(Object.assign(Object.assign({},n),{get:()=>s(e,n,!1,r)}),e)]},e.parseMaxPoolAttributes=t=>{let e=t.attributes.getString("auto_pad","NOTSET"),r=t.attributes.getInt("ceil_mode",0),i=t.attributes.getInts("kernel_shape"),o=t.attributes.getInts("strides",[]),a=t.attributes.getInts("pads",[]),s=t.attributes.getInt("storage_order",0),u=t.attributes.getInts("dilations",[]);if(0!==s)throw Error("column major storage order is not yet supported for MaxPool");if(0!==r)throw Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,n.createAttributeWithCacheKey)({autoPad:e,ceilMode:r,countIncludePad:!1,kernelShape:i,strides:o,pads:a,storageOrder:s,dilations:u})};let s=(t,e,r,n)=>{let[i,a]=u(t,n,r),s=` 1079 ${f(t[0].dims,i,"\n value = max(_X(x), value);\n ","","-1e5")} 1080 `;return Object.assign(Object.assign({},e),{output:{dims:a,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:s})},u=(t,e,r)=>{let n=t[0].dims.slice(),o=Object.hasOwnProperty.call(e,"dilations"),a=e.kernelShape.slice(),s=e.strides.slice(),u=o?e.dilations.slice():[],l=e.pads.slice();i.PoolConvUtil.adjustPoolAttributes(r,n,a,s,u,l);let c=i.PoolConvUtil.computePoolOutputShape(r,n,s,u,a,l,e.autoPad),p=Object.assign({},e);return o?Object.assign(p,{kernelShape:a,strides:s,pads:l,dilations:u,cacheKey:e.cacheKey}):Object.assign(p,{kernelShape:a,strides:s,pads:l,cacheKey:e.cacheKey}),[p,c]},l={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},c={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[o.TextureType.unpacked]};e.globalMaxPool=(t,e)=>(p(e),[t.run(Object.assign(Object.assign({},c),{get:()=>s(e,c,!0,l)}),e)]);let p=t=>{if(!t||1!==t.length)throw Error("Pool ops requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type.")},f=(t,e,r,n,o)=>{let a=t.length;if(e.kernelShape.length<=2){let i=e.kernelShape[e.kernelShape.length-1],s=e.strides[e.strides.length-1],u=e.pads[e.pads.length/2-1],l=e.pads[e.pads.length-1],c=t[a-1],p="",f="",d="";if(p=u+l!==0?` 1081 for (int i = 0; i < ${i}; i++) { 1082 x[${a} - 1] = indices[${a} - 1] * ${s} - ${u} + i; 1083 if (x[${a} - 1] < 0 || x[${a} - 1] >= ${c}) { 1084 pad++; 1085 continue; 1086 } 1087 ${r} 1088 }`:` 1089 for (int i = 0; i < ${i}; i++) { 1090 x[${a} - 1] = indices[${a} - 1] * ${s} - ${u} + i; 1091 ${r} 1092 }`,2===e.kernelShape.length){let r=e.kernelShape[e.kernelShape.length-2],n=e.strides[e.strides.length-2],o=e.pads[e.pads.length/2-2],s=e.pads[e.pads.length-2],u=t[a-2];f=o+s!==0?` 1093 for (int j = 0; j < ${r}; j++) { 1094 x[${a} - 2] = indices[${a} - 2] * ${n} - ${o} + j; 1095 if (x[${a} - 2] < 0 || x[${a} - 2] >= ${u}) { 1096 pad+= ${i}; 1097 continue; 1098 } 1099 `:` 1100 for (int j = 0; j < ${r}; j++) { 1101 x[${a} - 2] = indices[${a} - 2] * ${n} - ${o} + j; 1102 `,d="\n }\n "}return` 1103 float process(int indices[${a}]) { 1104 int x[${a}]; 1105 copyVec(indices, x); 1106 1107 float value = ${o}; 1108 int pad = 0; 1109 ${f} 1110 ${p} 1111 ${d} 1112 ${n} 1113 return value; 1114 } 1115 `}{let s=i.ShapeUtil.size(e.kernelShape),u=i.ShapeUtil.computeStrides(e.kernelShape),l=u.length,c=e.pads.length,p=h(l),f=d(t,"inputDims"),g=d(e.pads,"pads"),b=d(u,"kernelStrides"),m=d(e.strides,"strides"),y="";return y=e.pads.reduce((t,e)=>t+e)?` 1116 if (x[j] >= inputDims[j] || x[j] < 0) { 1117 pad++; 1118 isPad = true; 1119 break; 1120 } 1121 } 1122 if (!isPad) { 1123 ${r} 1124 }`:` 1125 } 1126 ${r} 1127 `,` 1128 ${p} 1129 float process(int indices[${a}]) { 1130 int x[${a}]; 1131 copyVec(indices, x); 1132 int offset[${l}]; 1133 int pads[${c}]; 1134 int inputDims[${a}]; 1135 int kernelStrides[${l}];
1136 int strides[${l}]; 1137 ${g} 1138 ${f} 1139 ${m} 1140 ${b} 1141 1142 float value = ${o}; 1143 int pad = 0; 1144 bool isPad = false; 1145 for (int i = 0; i < ${s}; i++) { 1146 offsetToIndices(i, kernelStrides, offset); 1147 isPad = false; 1148 for (int j = ${a} - ${l}; j < ${a}; j++) { 1149 x[j] = indices[j] * strides[j - ${a} + ${l}] 1150 + offset[j - ${a} + ${l}] - pads[j - 2]; 1151 ${y} 1152 } 1153 ${n} 1154 1155 return value; 1156 } 1157 `}},d=(t,e)=>{let r="";for(let n=0;n<t.length;n++)r+=` 1158 ${e}[${n}] = ${t[n]}; 1159 `;return r},h=t=>` 1160 void offsetToIndices(int offset, int[${t}] strides, out int[${t}] indices) { 1161 if (${t} == 0) { 1162 return; 1163 } 1164 for (int i = 0; i < ${t} - 1; ++i) { 1165 indices[i] = offset / strides[i]; 1166 offset -= indices[i] * strides[i]; 1167 } 1168 indices[${t} - 1] = offset; 1169 }`},4939:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.reduceLogSumSquare=e.reduceLogSum=e.reduceProd=e.reduceMin=e.reduceMax=e.reduceMean=e.reduceSum=e.parseReduceAttributes=void 0;let n=r(246),i=r(782),o=r(2517),a=r(2039),s=(t,e,r,n,i)=>{l(e);let o={name:n,inputNames:["A"],inputTypes:[a.TextureType.unpacked]};return[t.run(Object.assign(Object.assign({},o),{cacheHint:r.cacheKey,get:()=>u(t,e,r,n,i,o)}),e)]};e.parseReduceAttributes=t=>{let e=t.attributes.getInts("axes",[]),r=1===t.attributes.getInt("keepdims",1);return(0,n.createAttributeWithCacheKey)({axes:e,keepDims:r})};let u=(t,e,r,n,i,s)=>{let u=[],l=e[0].dims.length||1,c=[],p=o.ShapeUtil.normalizeAxes(r.axes,e[0].dims.length),f=i(e,p),d=f[1];for(let t=0;t<e[0].dims.length;t++)p.indexOf(t)>=0||0===p.length?(r.keepDims&&u.push(1),d=` 1170 for(int j${t} = 0; j${t} < ${e[0].dims[t]}; j${t}++) { 1171 inputIdx[${t}] = j${t}; 1172 ${d} 1173 }`):(c.push(`inputIdx[${t}] = outputIdx[${u.length}];`),u.push(e[0].dims[t]));let h=` 1174 float process(int outputIdx[${u.length||1}]) { 1175 float value; // final result 1176 int inputIdx[${l}]; // addressing input data 1177 ${c.join("\n")} 1178 ${f[0]} // init ops for reduce max/min 1179 ${d} 1180 ${f[2]} // final computation for reduce mean 1181 return value; 1182 }`;return Object.assign(Object.assign({},s),{output:{dims:u,type:e[0].type,textureType:a.TextureType.unpacked},shaderSource:h})},l=t=>{if(!t||1!==t.length)throw Error("Reduce op requires 1 input.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type))throw Error("Invalid input type.")};e.reduceSum=(t,e,r)=>s(t,e,r,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),e.reduceMean=(t,e,r)=>s(t,e,r,"ReduceMean",(t,e)=>{let r=1;for(let n=0;n<t[0].dims.length;n++)(e.indexOf(n)>=0||0===e.length)&&(r*=t[0].dims[n]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${r}.;`]}),e.reduceMax=(t,e,r)=>s(t,e,r,"ReduceMax",(t,e)=>{let r=[];for(let n=0;n<t[0].dims.length;n++)(e.indexOf(n)>=0||0===e.length)&&r.push(`inputIdx[${n}] = 0;`);return[`${r.join("\n")} 1183value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),e.reduceMin=(t,e,r)=>s(t,e,r,"ReduceMin",(t,e)=>{let r=[];for(let n=0;n<t[0].dims.length;n++)(e.indexOf(n)>=0||0===e.length)&&r.push(`inputIdx[${n}] = 0;`);return[`${r.join("\n")} 1184value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),e.reduceProd=(t,e,r)=>s(t,e,r,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),e.reduceLogSum=(t,e,r)=>s(t,e,r,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),e.reduceLogSumSquare=(t,e,r)=>s(t,e,r,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isReshapeCheap=e.processDims3D=e.createPackedReshape3DProgramInfoLoader=void 0;let n=r(2517),i=r(5060),o=r(2039),a=r(2827);e.createPackedReshape3DProgramInfoLoader=(t,e,r)=>{let s;let u=(s=r,{name:"Reshape (packed)",inputTypes:[o.TextureType.packed],inputNames:["A"],cacheHint:`${s}`});return Object.assign(Object.assign({},u),{get:()=>((t,e,r,s)=>{let u=e.dims,l=s,c="";for(let t=0;t<4;t++){let e="";switch(t){case 0:e="outputCoords = rc;";break;
1184case 1:e="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:e="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:e="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw Error()}c+=` 1185 ${e} 1186 ${t>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} 1187 int flattenedIndex = getFlattenedIndex(outputCoords); 1188 1189 ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); 1190 vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); 1191 1192 result[${t}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); 1193 1194 ${t>0?"}":""} 1195 `}let p=(0,i.getGlsl)(t.session.backend.glContext.version),f=` 1196 ${function(t){let e=n.ShapeUtil.computeStrides(t),r=["b","r","c"],i="index";return` 1197 ivec3 inputCoordsFromReshapedOutCoords(int index) { 1198 ${e.map((t,n)=>`int ${r[n]} = ${i} / ${t}; ${n===e.length-1?`int ${r[n+1]} = ${i} - ${r[n]} * ${t}`:`index -= ${r[n]} * ${t}`};`).join("")} 1199 return ivec3(b, r, c); 1200 } 1201 `}(u)} 1202 ${function(t){let e=n.ShapeUtil.computeStrides(t);return` 1203 int getFlattenedIndex(ivec3 coords) { 1204 // reverse y, z order 1205 return coords.x * ${e[0]} + coords.z * ${e[1]} + coords.y; 1206 } 1207`}(l)} 1208 ${(0,a.unpackFromChannel)()} 1209 1210 void main() { 1211 ivec3 rc = getOutputCoords(); 1212 1213 vec4 result = vec4(0.0); 1214 1215 ivec3 outputCoords; 1216 int rows = ${l[2]}; 1217 int cols = ${l[1]}; 1218 1219 ${c} 1220 ${p.output} = result; 1221 } 1222 `;return Object.assign(Object.assign({},r),{output:{dims:l,type:e.type,textureType:o.TextureType.packed},shaderSource:f,hasMain:!0})})(t,e,u,r)})},e.processDims3D=function(t){if(0===t.length)return[1,1,1];let e=1;for(let r=0;r<t.length-2;++r)e*=t[r];return[e,t.length>1?t[t.length-2]:1,t[t.length-1]]},e.isReshapeCheap=function(t,e){return 0===t.length||0===e.length||(t.length<2||e.length<2?t[t.length-1]===e[e.length-1]:t[t.length-1]===e[e.length-1]&&t[t.length-2]===e[e.length-2])}},718:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.reshape=void 0;let n=r(2517);e.reshape=(t,e)=>{let r=n.ShapeUtil.calculateReshapedDims(e[0].dims,e[1].integerData);return t.session.pack?[t.reshapePacked(e[0],r)]:[t.reshapeUnpacked(e[0],r)]}},2268:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseResizeAttributesV11=e.parseResizeAttributesV10=e.resize=void 0;let n=r(5060),i=r(2039),o=r(9390),a=r(2827),s=r(9793),u={name:"Resize",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.resize=(t,e,r)=>((0,s.validateInputs)(e,r),[t.run(Object.assign(Object.assign({},u),{cacheHint:r.cacheKey,get:()=>l(t,e,r)}),e)]),e.parseResizeAttributesV10=t=>(0,s.parseUpsampleAttributes)(t,10),e.parseResizeAttributesV11=t=>(0,s.parseUpsampleAttributes)(t,11);let l=(t,e,r)=>{let s=(0,n.getGlsl)(t.session.backend.glContext.version),[l,p]=c(e,r);if(l.every(t=>1===t)&&"tf_crop_and_resize"!==r.coordinateTransformMode)return Object.assign(Object.assign({},u),{output:{dims:p,type:e[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:`void main() { 1223 vec4 v = ${s.texture2D}(X, TexCoords); 1224 ${s.output} = v; 1225 }`});let f=p.length;if(f<2)throw Error(`output dimension should be at least 2, but got ${f}`);let d=p[f-2],h=p[f-1],g=e[0].dims;if(f!==g.length)throw Error(`output dimension should match input ${g.length}, but got ${f}`);let b=g[f-2],m=g[f-1],y=l[f-2],_=l[f-1],v="";if("linear"!==r.mode)throw Error(`resize (packed) does not support mode: '${r.mode}'`);switch(r.coordinateTransformMode){case"asymmetric":v="\n vec4 getSourceFracIndex(ivec4 coords) {\n return vec4(coords) / scaleWHWH;\n }\n ";break;case"half_pixel":v="\n vec4 getSourceFracIndex(ivec4 coords) {\n return (vec4(coords) + 0.5) / scaleWHWH - 0.5;\n }\n ";break;case"pytorch_half_pixel":v=` 1226 vec4 getSourceFracIndex(ivec4 coords) { 1227 vec4 fcoords = vec4(coords); 1228 return vec4( 1229 ${h}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, 1230 ${d}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, 1231 ${h}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, 1232 ${d}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 1233 ); 1234 } 1235 `;break;case"align_corners":v=` 1236 vec4 getSourceFracIndex(ivec4 coords) { 1237 vec4 resized = vec4(${h}.0 - 1.0, ${d}.0 - 1.0, ${h}.0 - 1.0, 1238 ${d}.0 - 1.0); 1239 vec4 original = vec4(${m}.0 - 1.0, ${b}.0 - 1.0, ${m}.0 - 1.0, 1240 ${b}.0 - 1.0); 1241 vec4 new_scale = original / resized; 1242 return vec4(coords) * new_scale; 1243 } 1244 `;break;default:throw Error(`resize (packed) does not support coordinateTransformMode: '${r.coordinateTransformMode}'`)}let x=(0,o.getCoordsDataType)(f),w=` 1245 const vec2 inputWH = vec2(${b}.0, ${m}.0); 1246 const vec4 scaleWHWH = vec4(float(${y}), float(${_}), float(${y}), float(${_})); 1247 ${(0,a.unpackFromChannel)()} 1248 ${v} 1249 float getAValue(int x10, int r, int c, int d) { 1250 return getChannel(getA(x10, r, c, d), vec2(c, d)); 1251 } 1252 void main() { 1253 ${x} rc = getOutputCoords(); 1254 1255 int batch = rc[0]; 1256 int depth = rc[1]; 1257 1258 // retrieve the 4 coordinates that is used in the 4 packed output values.
1259 ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); 1260 1261 // calculate the source index in fraction 1262 vec4 sourceFrac = getSourceFracIndex(coords); 1263 1264 // get the lower and upper bound of the 4 values that will be packed into one texel. 1265 ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); 1266 ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); 1267 ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); 1268 ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); 1269 1270 bool hasNextRow = rc.w < ${d-1}; 1271 bool hasNextCol = rc.z < ${h-1}; 1272 1273 // pack x00, x01, x10, x11's top-left corner into one vec4 structure 1274 vec4 topLeft = vec4( 1275 getAValue(batch, depth, x00.x, x00.y), 1276 hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, 1277 hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, 1278 (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); 1279 1280 // pack x00, x01, x10, x11's top-right corner into one vec4 structure 1281 vec4 topRight = vec4( 1282 getAValue(batch, depth, x00.x, x00.w), 1283 hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, 1284 hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, 1285 (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); 1286 1287 // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure 1288 vec4 bottomLeft = vec4( 1289 getAValue(batch, depth, x00.z, x00.y), 1290 hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, 1291 hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, 1292 (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); 1293 1294 // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure 1295 vec4 bottomRight = vec4( 1296 getAValue(batch, depth, x00.z, x00.w), 1297 hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, 1298 hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, 1299 (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); 1300 1301 // calculate the interpolation fraction on u and v direction 1302 vec4 frac = vec4(sourceFrac) - floor(sourceFrac); 1303 vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); 1304
1305 vec4 top = mix(topLeft, topRight, clampFrac.ywyw); 1306 vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); 1307 vec4 newValue = mix(top, bottom, clampFrac.xxzz); 1308 1309 ${s.output} = vec4(newValue); 1310 } 1311 `;return Object.assign(Object.assign({},u),{output:{dims:p,type:e[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:w})},c=(t,e)=>{let r=t[0].dims,n,i=e.scales;if(0===i.length){let o=t[e.scalesInputIdx];if(o&&0!==o.size){if(t[e.sizesInputIdx])throw Error("Only one of scales or sizes must be provided as input.");i=p(o,e.mode,e.isResize)}else{let o=t[e.sizesInputIdx];if(!o||0===o.size)throw Error("Either scales or sizes MUST be provided as input.");i=f(n=Array.from(o.integerData),r,e.mode,e.isResize)}}else if(t[e.sizesInputIdx])throw Error("Only one of scales or sizes must be provided as input.");let o=n||r.map((t,e)=>Math.floor(t*i[e]));return[i,o]},p=(t,e,r)=>{let n=Array.from(t.floatData);return(0,s.scalesValidation)(n,e,r),n},f=(t,e,r,n)=>{let i=e.length,o=Array(i);for(let r=0,n=i;r<n;r++)if(0===e[r]){if(0!==t[r])throw Error("Input dim is zero but required output dim is non-zero.");o[r]=1}else o[r]=t[r]/e[r];return(0,s.scalesValidation)(o,r,n),o}},8117:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.shape=void 0;let n=r(9162);e.shape=(t,e)=>(i(e),[new n.Tensor([e[0].dims.length],"int32",void 0,void 0,new Int32Array(e[0].dims))]);let i=t=>{if(!t||1!==t.length)throw Error("Shape requires 1 input.")}},2278:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sliceV10=e.parseSliceAttributes=e.slice=void 0;let n=r(246),i=r(782),o=r(2517),a=r(2039),s={name:"Slice",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.slice=(t,e,r)=>(l(e),[t.run(Object.assign(Object.assign({},s),{cacheHint:r.cacheKey,get:()=>u(t,e[0],r)}),e)]),e.parseSliceAttributes=t=>{let e=t.attributes.getInts("starts"),r=t.attributes.getInts("ends"),i=t.attributes.getInts("axes",[]);return(0,n.createAttributeWithCacheKey)({starts:e,ends:r,axes:i})};let u=(t,e,r)=>{let n=0===r.axes.length?e.dims.slice(0).map((t,e)=>e):r.axes,i=o.ShapeUtil.normalizeAxes(n,e.dims.length),u=r.starts.map((t,r)=>t>e.dims[i[r]]-1?e.dims[i[r]]:o.ShapeUtil.normalizeAxis(t,e.dims[i[r]])),l=r.ends.map((t,r)=>t>e.dims[i[r]]-1?e.dims[i[r]]:o.ShapeUtil.normalizeAxis(t,e.dims[i[r]])),c=e.dims.slice(),p=[];for(let t=0;t<i.length;t++)c[i[t]]=l[t]-u[t],u[t]>0&&p.push(`outputIdx[${i[t]}] += ${u[t]};`);let f=` 1312 float process(int outputIdx[${c.length}]) { 1313 ${p.join("\n ")} 1314 return _A(outputIdx); 1315 }`;return Object.assign(Object.assign({},s),{output:{dims:c,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},l=t=>{if(!t||1!==t.length)throw Error("Slice requires 1 input.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type))throw Error("Invalid input type.")};e.sliceV10=(t,e)=>{p(e);let r=c(t,e);return[t.run(Object.assign(Object.assign({},s),{cacheHint:r.cacheKey,get:()=>u(t,e[0],r)}),[e[0]])]};let c=(t,e)=>{if(!t.session.isInitializer(e[1].dataId)||!t.session.isInitializer(e[2].dataId)||e.length>=4&&!t.session.isInitializer(e[3].dataId)||e.length>=5&&!t.session.isInitializer(e[4].dataId))throw Error("dynamic slice attributes are not allowed");if(e.length>=5&&e[4].integerData.some(t=>1!==t))throw Error("currently non-1 steps is not supported for Slice");let r=Array.from(e[1].integerData),n=Array.from(e[2].integerData),i=e.length>=4?Array.from(e[3].integerData):[];return{starts:r,ends:n,axes:i,cacheKey:`${i};${r};${n}`}},p=t=>{if(!t||t.length<3||t.length>5)throw Error("Invalid input number.");if("int32"!==t[1].type||1!==t[1].dims.length||"int32"!==t[2].type||1!==t[2].dims.length||t.length>=4&&("int32"!==t[3].type||1!==t[3].dims.length)||t.length>=5&&("int32"!==t[4].type||1!==t[4].dims.length))throw Error("Invalid input type.")}},5524:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.softmaxV13=e.parseSoftmaxAttributesV13=e.parseSoftmaxAttributes=e.softmax=void 0;let n=r(246),i=r(2517),o=r(5060),a=r(2039),s=r(3738),u={name:"SoftmaxComputeMax",
1315inputNames:["A"],inputTypes:[a.TextureType.unpacked]},l={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},c={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]};e.softmax=(t,e,r)=>{g(e);let n=e[0].dims.slice(),o=i.ShapeUtil.normalizeAxis(r.axis,n.length);return p(t,e,r,i.ShapeUtil.sizeToDimension(n,o),i.ShapeUtil.sizeFromDimension(n,o))},e.parseSoftmaxAttributes=t=>(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",1)}),e.parseSoftmaxAttributesV13=t=>(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",-1)}),e.softmaxV13=(t,e,r)=>{g(e);let o=e[0].dims.slice(),a=i.ShapeUtil.normalizeAxis(r.axis,o.length),u=o.length,l=a!==u-1,c=[],f,d=[],h=[];l&&((d=Array.from({length:u}).map((t,e)=>e))[a]=u-1,d[u-1]=a,d.map(t=>c.push(o[t])),f=(0,n.createAttributeWithCacheKey)({perm:d}),h=(0,s.transpose)(t,e,f));let b=l?i.ShapeUtil.sizeToDimension(c,u-1):i.ShapeUtil.sizeToDimension(o,u-1),m=l?i.ShapeUtil.sizeFromDimension(c,u-1):i.ShapeUtil.sizeFromDimension(o,u-1),y=p(t,l?h:e,r,b,m);return l?(0,s.transpose)(t,y,f):y};let p=(t,e,r,n,i)=>{let o=f(t,e[0],n,i,[n]),a=t.run(Object.assign(Object.assign({},u),{cacheHint:r.cacheKey,get:()=>o}),e),s=d(t,e[0],n,i,o.output.dims,[n]),p=t.run(Object.assign(Object.assign({},l),{cacheHint:r.cacheKey,get:()=>s}),[e[0],a]),g=h(t,e[0],n,i,o.output.dims,s.output.dims);return[t.run(Object.assign(Object.assign({},c),{cacheHint:r.cacheKey,get:()=>g}),[e[0],a,p])]},f=(t,e,r,n,i)=>{let[s,l]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),c=i.length;if(r<1||n<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==i.length)throw Error("Dimensionality of the output should be 1");if(i[0]!==r)throw Error("Shape of the output should be equal to logical row count");let p=(0,o.getGlsl)(t.session.backend.glContext.version),f=` 1316 float process(int[${c}] indices) { 1317 int logical_row_start_offset = indices[0] * ${n}; 1318 1319 float max = getColorAsFloat(${p.texture2D}(A, offsetToCoords(logical_row_start_offset, ${s}, 1320 ${l} ))); 1321 for(int i=1; i<${n}; ++i) 1322 { 1323 float current = getColorAsFloat(${p.texture2D}(A, offsetToCoords(logical_row_start_offset + i, 1324 ${s}, ${l}))); 1325 if(current > max) 1326 max = current; 1327 } 1328 1329 return max; 1330 }`;return Object.assign(Object.assign({},u),{output:{dims:i,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},d=(t,e,r,n,i,s)=>{let[u,c]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),p=s.length;if(r<1||n<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==s.length)throw Error("Dimensionality of the output should be 1");if(s[0]!==r)throw Error("Shape of the output should be equal to logical row count");if(1!==i.length)throw Error("Dimensionality of the intermediate results should be 1");if(i[0]!==r)throw Error("Shape of the intermediate results should be equal to logical row count");let f=` 1331 float process(int[${p}] indices) { 1332 int logical_row_start_offset = indices[0] * ${n}; 1333 1334 float norm_factor = 0.0; 1335 float max = _Max(indices); 1336 for(int i=0; i<${n}; ++i) 1337 { 1338 norm_factor += exp(getColorAsFloat(${(0,o.getGlsl)(t.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, 1339 ${u}, ${c}))) - max); 1340 } 1341 1342 return norm_factor; 1343 }`;return Object.assign(Object.assign({},l),{output:{dims:s,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},h=(t,e,r,n,i,o)=>{let[s,u]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),l=e.dims.length;if(r<1||n<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==i.length||1!==o.length)throw Error("Dimensionality of the intermediate results should be 1");if(i[0]!==r||o[0]!==r)throw Error("Shape of the intermediate results should be equal to logical row count");let p=` 1344 float process(int[${l}] indices) { 1345 1346 // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) 1347 int offset = coordsToOffset(TexCoords, ${s}, ${u}); 1348 1349 //determine the logical row for this index 1350 int logical_row_index[1]; 1351 logical_row_index[0] = offset / ${n}; 1352 1353 float norm_factor = _Norm(logical_row_index); 1354 1355 // avoid possible division by 0 1356 // if norm_facor is 0, all elements are zero 1357 // if so, return 0 1358 if(norm_factor == 0.0) 1359 return 0.0; 1360 1361 return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; 1362 }`;return Object.assign(Object.assign({},c),{output:{dims:e.dims,type:e.type,textureType:a.TextureType.unpacked},shaderSource:p})},g=t=>{if(!t||1!==t.length)throw Error("Softmax requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type")}},5975:(t,e,r)=>{"use strict";
1362Object.defineProperty(e,"__esModule",{value:!0}),e.parseSplitAttributes=e.split=void 0;let n=r(246),i=r(2517),o=r(2039),a={name:"Split",inputNames:["A"],inputTypes:[o.TextureType.unpacked]};e.split=(t,e,r)=>{l(e);let n=i.ShapeUtil.normalizeAxis(r.axis,e[0].dims.length),o=s(t,e,n,r),c=[];for(let i=0;i<o;++i)c.push(t.run(Object.assign(Object.assign({},a),{cacheHint:`${r.cacheKey};${i}`,get:()=>u(t,e[0],r,n,i)}),e));return c},e.parseSplitAttributes=t=>{let e=t.attributes.getInt("axis",0),r=t.attributes.getInts("split",[]),i=t.outputs.length;return(0,n.createAttributeWithCacheKey)({axis:e,split:r,numOutputs:i})};let s=(t,e,r,n)=>{let[,o]=i.SplitUtil.splitShape(e[0].dims,r,n.split,n.numOutputs);return o.length},u=(t,e,r,n,s)=>{let[u,l]=i.SplitUtil.splitShape(e.dims,n,r.split,r.numOutputs),c=l[s],p=u[s],f=` 1363 float process(int indices[${p.length}]) { 1364 indices[${n}] += ${c}; 1365 return _A(indices); 1366 } 1367 `;return Object.assign(Object.assign({},a),{cacheHint:`${r.cacheKey}:${s}`,output:{dims:p,type:e.type,textureType:o.TextureType.unpacked},shaderSource:f})},l=t=>{if(!t||1!==t.length)throw Error("Split requires one input.");if("int8"!==t[0].type&&"uint8"!==t[0].type&&"int16"!==t[0].type&&"uint16"!==t[0].type&&"int32"!==t[0].type&&"uint32"!==t[0].type&&"float32"!==t[0].type&&"float64"!==t[0].type&&"bool"!==t[0].type)throw Error("Invalid input type.")}},3933:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseSqueezeAttributes=e.squeezeV13=e.squeeze=void 0;let n=r(2517);e.squeeze=(t,e,r)=>{i(e);let o=n.ShapeUtil.squeezeShape(e[0].dims,r);return[t.reshapeUnpacked(e[0],o)]},e.squeezeV13=(t,r)=>(o(r),(0,e.squeeze)(t,[r[0]],Array.from(r[1].integerData))),e.parseSqueezeAttributes=t=>t.attributes.getInts("axes");let i=t=>{if(!t||1!==t.length)throw Error("Squeeze requires 1 input.");if("string"===t[0].type)throw Error("invalid input tensor types.")},o=t=>{if(!t||2!==t.length)throw Error("Squeeze requires 2 inputs.");if("int32"!==t[1].type)throw Error("Invalid input type.")}},6558:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sum=void 0;let n=r(5060),i=r(2039);e.sum=(t,e)=>{a(e);let r={name:"Sum",inputNames:e.map((t,e)=>`X${e}`),inputTypes:Array(e.length).fill(i.TextureType.unpacked)};return[t.run(Object.assign(Object.assign({},r),{get:()=>o(t,e,r)}),e)]};let o=(t,e,r)=>{let o=(0,n.getGlsl)(t.session.backend.glContext.version),a=e[0].dims.slice(),s=` 1368 void main() { 1369 vec4 result = ${e.map((t,e)=>`${o.texture2D}(X${e},TexCoords)`).join(" + ")}; 1370 ${o.output} = result; 1371 } 1372 `;return Object.assign(Object.assign({},r),{output:{dims:a,type:e[0].type,textureType:i.TextureType.unpacked},hasMain:!0,shaderSource:s})},a=t=>{if(!t||0===t.length)throw Error("Sum requires inputs.");let e=t[0].dims.length;for(let r=1;r<t.length;r++){if(e!==t[r].dims.length)throw Error("Input shapes are mismatched.");for(let n=0;n<e;n++)if(t[0].dims[n]!==t[r].dims[n])throw Error("Input shapes are not matched.")}if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type.");for(let e=1;e<t.length;e++)if(t[0].type!==t[e].type)throw Error("Input types are not matched.")}},5723:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tile=void 0;let n=r(782),i=r(2039);e.tile=(t,e)=>{a(e);let r={name:"Tile",inputNames:["A"],inputTypes:[i.TextureType.unpacked]};return[t.run(Object.assign(Object.assign({},r),{get:()=>o(t,e,r)}),e)]};let o=(t,e,r)=>{let n=e[0].dims.slice(),o=Array(n.length),a=[];for(let t=0;t<n.length;t++)o[t]=n[t]*e[1].numberData[t],a.push(`inputIdx[${t}] = int(mod(float(outputIdx[${t}]), ${n[t]}.));`);let s=o.length,u=` 1373 float process(int outputIdx[${s}]) { 1374 int inputIdx[${s}]; 1375 ${a.join("\n")} 1376 return _A(inputIdx); 1377 } 1378 `;return Object.assign(Object.assign({},r),{output:{dims:o,type:e[0].type,textureType:i.TextureType.unpacked},shaderSource:u})},a=t=>{if(!t||2!==t.length)throw Error("Tile requires 2 input.");if(1!==t[1].dims.length)throw Error("The second input shape must 1 dimension.");if(t[1].dims[0]!==t[0].dims.length)throw Error("Invalid input shape.");if(-1===n.NUMBER_TYPES.indexOf(t[0].type))throw Error("Invalid input type.");if("int32"!==t[1].type&&"int16"!==t[1].type)throw Error("Invalid repeat type.")}},3738:(t,e,r)=>{"use strict";
1378Object.defineProperty(e,"__esModule",{value:!0}),e.parseTransposeAttributes=e.transpose=void 0;let n=r(246),i=r(2517),o=r(2039),a={name:"Transpose",inputNames:["A"],inputTypes:[o.TextureType.unpacked]};e.transpose=(t,e,r)=>(p(e),[t.run(Object.assign(Object.assign({},a),{cacheHint:r.cacheKey,get:()=>s(t,e[0],r.perm)}),e)]),e.parseTransposeAttributes=t=>(0,n.createAttributeWithCacheKey)({perm:t.attributes.getInts("perm",[])});let s=(t,e,r)=>{let n=e.dims;r=u(n,r);let i=l(n,r),s=n.length,p=` 1379 ${c("perm",r,s)} 1380 float process(int indices[${s}]) { 1381 int a[${s}]; 1382 perm(a, indices); 1383 return _A(a); 1384 }`;return Object.assign(Object.assign({},a),{output:{dims:i,type:e.type,textureType:o.TextureType.unpacked},shaderSource:p})},u=(t,e)=>(e&&e.length!==t.length&&(e=[...t.keys()].reverse()),e),l=(t,e)=>(e=u(t,e),i.ShapeUtil.sortBasedOnPerm(t,e)),c=(t,e,r)=>{let n=[];n.push(`void ${t}(out int a[${r}], int src[${r}]) {`);for(let t=0;t<r;++t)n.push(` a[${e[t]}]=src[${t}];`);return n.push(" }"),n.join("\n")},p=t=>{if(!t||1!==t.length)throw Error("Transpose requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("input should be float tensor")}},8710:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encodeAsUint8=void 0;let n=r(5060),i=r(2039);e.encodeAsUint8=(t,e)=>{let r=e.shape,o=(0,n.getGlsl)(t.session.backend.glContext.version),a=` 1385 const float FLOAT_MAX = 1.70141184e38; 1386 const float FLOAT_MIN = 1.17549435e-38; 1387 1388 bool isNaN(float val) { 1389 return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; 1390 } 1391 1392 highp vec4 encodeAsUint8(highp float v) { 1393 if (isNaN(v)) { 1394 return vec4(255, 255, 255, 255); 1395 } 1396 1397 highp float av = abs(v); 1398 1399 if(av < FLOAT_MIN) { 1400 return vec4(0.0, 0.0, 0.0, 0.0); 1401 } else if(v > FLOAT_MAX) { 1402 return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; 1403 } else if(v < -FLOAT_MAX) { 1404 return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; 1405 } 1406 1407 highp vec4 c = vec4(0,0,0,0); 1408 1409 highp float e = floor(log2(av)); 1410 highp float m = exp2(fract(log2(av))) - 1.0; 1411 1412 c[2] = floor(128.0 * m); 1413 m -= c[2] / 128.0; 1414 c[1] = floor(32768.0 * m); 1415 m -= c[1] / 32768.0; 1416 c[0] = floor(8388608.0 * m); 1417 1418 highp float ebias = e + 127.0; 1419 c[3] = floor(ebias / 2.0); 1420 ebias -= c[3] * 2.0; 1421 c[2] += floor(ebias) * 128.0; 1422 1423 c[3] += 128.0 * step(0.0, -v); 1424 1425 return c / 255.0; 1426 } 1427 1428 void main() { 1429 float value = ${o.texture2D}(X,TexCoords).r; 1430 ${o.output} = encodeAsUint8(value); 1431 }`,s={name:"Uint8Encode",inputTypes:[i.TextureType.unpacked],inputNames:["X"],output:{dims:r,type:e.tensor.type,textureType:i.TextureType.downloadUint8AsFloat},shaderSource:a,hasMain:!0};return t.executeProgram(s,[e.tensor])}},4909:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tanh=e.tan=e.sqrt=e.sin=e.sigmoid=e.relu=e.not=e.neg=e.log=e.parseLeakyReluAttributes=e.leakyRelu=e.identity=e.floor=e.exp=e.parseEluAttributes=e.elu=e.cos=e.ceil=e.clipV11=e.parseClipAttributes=e.clip=e.atan=e.asin=e.acos=e.abs=e.glslTanh=e.glslTan=e.glslSqrt=e.glslSigmoid=e.glslRelu=e.glslSin=e.glslNot=e.glslNeg=e.glslLog=e.glslLeakyRelu=e.glslIdentity=e.glslClip=e.glslFloor=e.glslExp=e.glslElu=e.glslCos=e.glslCeil=e.glslAtan=e.glslAsin=e.glslAcos=e.glslAbs=void 0;let n=r(246),i=r(2517),o=r(8520),a=r(5060),s=r(2039);function u(){return P("abs")}function l(){return P("acos")}function c(){return P("asin")}function p(){return P("atan")}function f(){return P("ceil")}function d(){return P("cos")}function h(t){let e="elu";return{body:` 1432 const float alpha = float(${t}); 1433 1434 float ${e}_(float a) { 1435 return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; 1436 } 1437 vec4 ${e}_(vec4 v) { 1438 return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w)); 1439 } 1440 `,name:e,type:o.FunctionType.ValueBased}}function g(){return P("exp")}function b(){return P("floor")}function m(t,e){let r="clip";return{body:` 1441 const float min = float(${t}); 1442 const float max = float(${e}); 1443 1444 float ${r}_(float a) { 1445 return clamp(a, min, max); 1446 } 1447 vec4 ${r}_(vec4 v) { 1448 return clamp(v, min, max); 1449 } 1450 `,name:r,type:o.FunctionType.ValueBased}}function y(){let t="indentity";return{body:` 1451 float ${t}_(float a) { 1452 return a; 1453 } 1454 vec4 ${t}_(vec4 v) { 1455 return v; 1456 } 1457 `,name:t,type:o.FunctionType.ValueBased}}function _(t){let e="leakyRelu";return{body:` 1458 const float alpha = float(${t}); 1459 1460 float ${e}_(float a) { 1461 return a < 0.0 ? a * alpha : a; 1462 } 1463 vec4 ${e}_(vec4 v) { 1464 return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w)); 1465 } 1466 `,name:e,type:o.FunctionType.ValueBased}}function v(){return P("log")}function x(){let t="neg";return{body:` 1467 float ${t}_(float a) { 1468 return -a; 1469 } 1470 vec4 ${t}_(vec4 v) { 1471 return -v; 1472 } 1473 `,name:t,type:o.FunctionType.ValueBased}}function w(){let t="not";return{body:` 1474 float ${t}_(float a) { 1475 return float( ! bool(a) ); 1476 } 1477 bool ${t}_(bool a) { 1478 return !a; 1479 } 1480 vec4 ${t}_(vec4 v) { 1481 return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); 1482 } 1483 bvec4 ${t}_(bvec4 v) { 1484 return bvec4(!v.x, !v.y, !v.z, !v.w); 1485 } 1486 `,name:t,type:o.FunctionType.ValueBased}}function T(){return P("sin")}function S(){let t="relu";return{body:` 1487 float ${t}_(float a) { 1488 return max( a, 0.0 ); 1489 } 1490 vec4 ${t}_(vec4 v) { 1491 return max( v, 0.0 ); 1492 } 1493 `,name:t,type:o.FunctionType.ValueBased}}function O(){let t="sigmoid";return{body:` 1494 float ${t}_(float a) { 1495 return 1.0 / (1.0 + exp(-a)); 1496 } 1497 vec4 ${t}_(vec4 v) { 1498 return 1.0 / (1.0 + exp(-v)); 1499 } 1500 `,name:t,type:o.FunctionType.ValueBased}}function A(){return P("sqrt")}function E(){return P("tan")}function I(){let t="tanh";return{body:` 1501 float ${t}_(float a) { 1502 a = clamp(a, -10., 10.); 1503 a = exp(2.*a);
1504 return (a - 1.) / (a + 1.); 1505 } 1506 vec4 ${t}_(vec4 v) { 1507 v = clamp(v, -10., 10.); 1508 v = exp(2.*v); 1509 return (v - 1.) / (v + 1.); 1510 } 1511 `,name:t,type:o.FunctionType.ValueBased}}function P(t){return{body:` 1512 float ${t}_(float a) { 1513 return ${t}(a); 1514 } 1515 vec4 ${t}_(vec4 v) { 1516 return ${t}(v); 1517 } 1518 `,name:t,type:o.FunctionType.ValueBased}}e.glslAbs=u,e.glslAcos=l,e.glslAsin=c,e.glslAtan=p,e.glslCeil=f,e.glslCos=d,e.glslElu=h,e.glslExp=g,e.glslFloor=b,e.glslClip=m,e.glslIdentity=y,e.glslLeakyRelu=_,e.glslLog=v,e.glslNeg=x,e.glslNot=w,e.glslSin=T,e.glslRelu=S,e.glslSigmoid=O,e.glslSqrt=A,e.glslTan=E,e.glslTanh=I;let D=(t,e,r,n)=>{let i=t.session.pack?s.TextureType.packed:s.TextureType.unpacked,o={name:r.name,inputTypes:[i],inputNames:["A"],cacheHint:n};return Object.assign(Object.assign({},o),{get:()=>((t,e,r,n)=>{let i=t.session.pack?s.TextureType.packed:s.TextureType.unpacked,o=(0,a.getGlsl)(t.session.backend.glContext.version);return Object.assign(Object.assign({},e),{output:{dims:r.dims,type:r.type,textureType:i},shaderSource:` 1519 ${n.body} 1520 void main() { 1521 vec4 v = ${o.texture2D}(A, TexCoords); 1522 v = ${n.name}_(v); 1523 ${o.output} = v; 1524 } 1525 `,hasMain:!0})})(t,o,e,r)})};e.abs=(t,e)=>[t.run(D(t,e[0],u()),e)],e.acos=(t,e)=>[t.run(D(t,e[0],l()),e)],e.asin=(t,e)=>[t.run(D(t,e[0],c()),e)],e.atan=(t,e)=>[t.run(D(t,e[0],p()),e)],e.clip=(t,e,r)=>[t.run(D(t,e[0],m(r.min,r.max),r.cacheKey),e)],e.parseClipAttributes=t=>(0,n.createAttributeWithCacheKey)({min:t.attributes.getFloat("min",i.MIN_CLIP),max:t.attributes.getFloat("max",i.MAX_CLIP)}),e.clipV11=(t,r)=>{let n=$(t,r);return(0,e.clip)(t,[r[0]],n)};let $=(t,e)=>{if(e.length>=3&&(!t.session.isInitializer(e[1].dataId)||!t.session.isInitializer(e[2].dataId)))throw Error("dynamic clip attributes are not allowed");let r=e.length>=3?e[1].numberData[0]:i.MIN_CLIP,o=e.length>=3?e[2].numberData[0]:i.MAX_CLIP;return(0,n.createAttributeWithCacheKey)({min:r,max:o})};e.ceil=(t,e)=>[t.run(D(t,e[0],f()),e)],e.cos=(t,e)=>[t.run(D(t,e[0],d()),e)],e.elu=(t,e,r)=>[t.run(D(t,e[0],h(r.alpha),r.cacheKey),e)],e.parseEluAttributes=t=>(0,n.createAttributeWithCacheKey)({alpha:t.attributes.getFloat("alpha",1)}),e.exp=(t,e)=>[t.run(D(t,e[0],g()),e)],e.floor=(t,e)=>
vendor: 3,075 bytes, lines 1525-1535
1525[t.run(D(t,e[0],b()),e)],e.identity=(t,e)=>[t.run(D(t,e[0],y()),e)],e.leakyRelu=(t,e,r)=>[t.run(D(t,e[0],_(r.alpha),r.cacheKey),e)],e.parseLeakyReluAttributes=t=>(0,n.createAttributeWithCacheKey)({alpha:t.attributes.getFloat("alpha",.01)}),e.log=(t,e)=>[t.run(D(t,e[0],v()),e)],e.neg=(t,e)=>[t.run(D(t,e[0],x()),e)],e.not=(t,e)=>[t.run(D(t,e[0],w()),e)],e.relu=(t,e)=>[t.run(D(t,e[0],S()),e)],e.sigmoid=(t,e)=>[t.run(D(t,e[0],O()),e)],e.sin=(t,e)=>[t.run(D(t,e[0],T()),e)],e.sqrt=(t,e)=>[t.run(D(t,e[0],A()),e)],e.tan=(t,e)=>[t.run(D(t,e[0],E()),e)],e.tanh=(t,e)=>[t.run(D(t,e[0],I()),e)]},5611:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackProgramInfoLoader=e.createUnpackProgramInfo=void 0;let n=r(5060),i=r(2039),o=r(9390),a=r(2827),s={name:"unpack",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.createUnpackProgramInfo=(t,e)=>{let r=e.dims.length,u=(0,a.getChannels)("rc",r),l=u.slice(-2),c=(0,o.getCoordsDataType)(r),p=(0,a.unpackFromChannel)(),f=0===e.dims.length?"":function(t,e){if(1===t)return"rc";let r="";for(let n=0;n<t;n++)r+=e[n],n<t-1&&(r+=",");return r}(r,u),d=r<=1?"rc":`vec2(${l.join(",")})`,h=` 1526 ${p} 1527 void main() { 1528 ${c} rc = getOutputCoords(); 1529 1530 // Sample the texture with the coords to get the rgba channel value. 1531 vec4 packedInput = getA(${f}); 1532 1533 ${(0,n.getGlsl)(t.session.backend.glContext.version).output} = vec4(getChannel(packedInput, ${d}), 0, 0, 0); 1534 } 1535 `;return Object.assign(Object.assign({},s),{hasMain:!0,output:{dims:e.dims,type:e.type,textureType:i.TextureType.unpacked},shaderSource:h})},e.createUnpackProgramInfoLoader=(t,r)=>Object.assign(Object.assign({},s),{get:()=>(0,e.createUnpackProgramInfo)(t,r)})},8428:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseUnsqueezeAttributes=e.unsqueezeV13=e.unsqueeze=void 0;let n=r(2517);e.unsqueeze=(t,e,r)=>{i(e);let o=n.ShapeUtil.unsqueezeShape(e[0].dims,r);return[t.reshapeUnpacked(e[0],o)]},e.unsqueezeV13=(t,r)=>(o(r),(0,e.unsqueeze)(t,[r[0]],Array.from(r[1].integerData))),e.parseUnsqueezeAttributes=t=>t.attributes.getInts("axes");let i=t=>{if(!t||1!==t.length)throw Error("Unsqueeze requires 1 input.");if("string"===t[0].type)throw Error("invalid input tensor types.")},o=t=>{if(!t||2!==t.length)throw Error("Unsqueeze requires 2 inputs.");if("int32"!==t[1].type)throw Error("Invalid input type.")}},9793:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.scalesValidation=e.validateInputs=e.parseUpsampleAttributes=e.parseUpsampleAttributesV9=e.parseUpsampleAttributesV7=e.upsample=void 0;let n=r(246),i=r(5060),o=r(2039),a={name:"Upsample",inputNames:["X"],inputTypes:[o.TextureType.unpacked]};e.upsample=(t,r,n)=>((0,e.validateInputs)(r,n),[t.run(Object.assign(Object.assign({},a),{cacheHint:n.cacheKey,get:()=>s(t,r,n)}),r)]),e.parseUpsampleAttributesV7=t=>(0,e.parseUpsampleAttributes)(t,7),e.parseUpsampleAttributesV9=t=>(0,e.parseUpsampleAttributes)(t,9),e.parseUpsampleAttributes=(t,r)=>{let i=r>=10,o=t.attributes.getString("mode","nearest");
1535if("nearest"!==o&&"linear"!==o&&(r<11||"cubic"!==o))throw Error(`unrecognized mode: ${o}`);let a=[];r<9&&(a=t.attributes.getFloats("scales"),(0,e.scalesValidation)(a,o,i));let s=t.attributes.getFloat("extrapolation_value",0),u=r>10?t.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(u))throw Error(`coordinate_transform_mode '${u}' is not supported`);let l="tf_crop_and_resize"===u,c=l,p="nearest"===o&&r>=11?t.attributes.getString("nearest_mode","round_prefer_floor"):"";if(-1===["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(p))throw Error(`nearest_mode '${p}' is not supported`);let f=t.attributes.getFloat("cubic_coeff_a",-.75),d=0!==t.attributes.getInt("exclude_outside",0);if(d&&"cubic"!==o)throw Error("exclude_outside can be set to 1 only when mode is CUBIC.");let h=r<11||"nearest"===o&&"asymmetric"===u&&"floor"===p,g=0,b=0,m=0;return r>10?t.inputs.length>2?(g=1,b=2,m=3):(b=1,m=2):9===r&&(b=1),(0,n.createAttributeWithCacheKey)({opset:r,isResize:i,mode:o,scales:a,extrapolationValue:s,coordinateTransformMode:u,useExtrapolation:c,needRoiInput:l,nearestMode:p,cubicCoefficientA:f,excludeOutside:d,useNearest2xOptimization:h,roiInputIdx:g,scalesInputIdx:b,sizesInputIdx:m})};let s=(t,e,r)=>{let n=(0,i.getGlsl)(t.session.backend.glContext.version),[s,u]=t.calculateTextureWidthAndHeight(e[0].dims,o.TextureType.unpacked),l=e[0].dims.map((t,e)=>Math.floor(t*r.scales[e])),[c,p]=t.calculateTextureWidthAndHeight(l,o.TextureType.unpacked),f=l.length,d=Array(f),h=Array(f),g=` 1536 int output_pitches[${f}]; 1537 int input_pitches[${f}]; 1538 `;for(let t=f-1;t>=0;t--)d[t]=t===f-1?1:d[t+1]*l[t+1],h[t]=t===f-1?1:h[t+1]*e[0].dims[t+1],g+=` 1539 output_pitches[${t}] = ${d[t]}; 1540 input_pitches[${t}] = ${h[t]}; 1541 `;let b=` 1542 float getInputFloat(int index) { 1543 vec2 coords = offsetToCoords(index, ${s}, ${u}); 1544 float value = getColorAsFloat(${n.texture2D}(X, coords)); 1545 return value; 1546 } 1547 `,m="nearest"===r.mode?` 1548 ${b} 1549 float process(int indices[${f}]) { 1550 int input_index = 0; 1551 int output_index = coordsToOffset(TexCoords, ${c}, ${p}); 1552 1553 ${g} 1554 1555 int d, m; 1556 for (int dim = 0; dim < ${f}; ++dim) { 1557 d = output_index / output_pitches[dim]; 1558 m = output_index - d * output_pitches[dim]; 1559 output_index = m; 1560 1561 if (scales[dim] != 1 && d > 0) { 1562 int d2 = d / scales[dim]; 1563 m = d - d2 * scales[dim]; 1564 d = d2; 1565 } 1566 input_index += input_pitches[dim] * d; 1567 } 1568 1569 return getInputFloat(input_index); 1570 }`:4===f?` 1571 ${b} 1572 float process(int indices[4]) { 1573 int input_index = 0; 1574 int output_index = coordsToOffset(TexCoords, ${c}, ${p}); 1575 1576 ${g} 1577 1578 int m; 1579 int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; 1580 index_of_dim0 = output_index / output_pitches[0]; 1581 m = output_index - index_of_dim0 * output_pitches[0]; 1582 index_of_dim1 = m / output_pitches[1]; 1583 m = m - index_of_dim1 * output_pitches[1]; 1584 index_of_dim2 = m / output_pitches[2]; 1585 m = m - index_of_dim2 * output_pitches[2]; 1586 index_of_dim3 = m; 1587 1588 int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; 1589 index_of_input_dim2 = index_of_dim2 / scales[2]; 1590 y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; 1591 index_of_input_dim3 = index_of_dim3 / scales[3]; 1592 x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; 1593 1594 input_index = index_of_dim0 * input_pitches[0] + 1595 index_of_dim1 * input_pitches[1] + 1596 index_of_input_dim2 * input_pitches[2] + 1597 index_of_input_dim3; 1598 1599 float x00 = getInputFloat(input_index); 1600 float x10, x01, x11; 1601 1602 bool end_of_dim2 = false; 1603 if (index_of_input_dim2 == (${e[0].dims[2]} - 1)) { 1604 // It's the end in dimension 2 1605 x01 = x00; 1606 end_of_dim2 = true; 1607 } else { 1608 x01 = getInputFloat(input_index + input_pitches[2]); 1609 } 1610 1611 if (index_of_input_dim3 == (input_pitches[2] - 1)) { 1612 // It's the end in dimension 3 1613 x10 = x00; 1614 x11 = x01; 1615 } 1616 else { 1617 x10 = getInputFloat(input_index + 1); 1618 x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); 1619 } 1620 1621 float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); 1622 float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); 1623 return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); 1624 }`:` 1625 ${b} 1626 float process(int indices[2]) { 1627 int input_index = 0; 1628 int output_index = coordsToOffset(TexCoords, ${c}, ${p}); 1629 1630 ${g} 1631 1632 int m; 1633 int index_of_dim0, index_of_dim1; 1634 index_of_dim0 = output_index / output_pitches[0]; 1635 m = output_index - index_of_dim0 * output_pitches[0]; 1636 index_of_dim1 = m; 1637 1638 int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; 1639 index_of_input_dim0 = index_of_dim0 / scales[0]; 1640 y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; 1641 index_of_input_dim1 = index_of_dim1 / scales[1]; 1642 x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; 1643 1644 input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; 1645 1646 float x00 = getInputFloat(input_index); 1647 float x10, x01, x11; 1648 1649 bool end_of_dim0 = false;
1650 if (index_of_input_dim0 == (${e[0].dims[0]} - 1)) { 1651 // It's the end in dimension 0 1652 x01 = x00; 1653 end_of_dim0 = true; 1654 } else { 1655 x01 = getInputFloat(input_index + input_pitches[0]); 1656 } 1657 1658 if (index_of_input_dim1 == (input_pitches[0] - 1)) { 1659 // It's the end in dimension 1 1660 x10 = x00; 1661 x11 = x01; 1662 } 1663 else { 1664 x10 = getInputFloat(input_index + 1); 1665 x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); 1666 } 1667 1668 float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); 1669 float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); 1670 return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); 1671 }`;return Object.assign(Object.assign({},a),{output:{dims:l,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:m,variables:[{name:"scales",type:"int",arrayLength:r.scales.length,data:r.scales.map(t=>Math.ceil(t))}]})};e.validateInputs=(t,e)=>{if(!t||e.opset<9&&1!==t.length||e.opset>=9&&e.opset<11&&2!==t.length||e.opset>=11&&t.length<2)throw Error("invalid inputs.");if(e.scales.length>0&&t[0].dims.length!==e.scales.length)throw Error("Invalid input shape.");if("string"===t[0].type)throw Error("Invalid input tensor types.")},e.scalesValidation=(t,e,r)=>{if(r){for(let e of t)if(e<=0)throw Error("Scale value should be greater than 0.")}else for(let e of t)if(e<1)throw Error("Scale value should be greater than or equal to 1.");if(!("linear"!==e&&"cubic"!==e||2===t.length||4===t.length&&1===t[0]&&1===t[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 ${r?"Resize":"Upsample"} opeartor.`)}},1958:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgramManager=void 0;let n=r(1670),i=r(6231),o=r(8879),a=r(5060);e.ProgramManager=class{constructor(t,e,r){this.profiler=t,this.glContext=e,this.textureLayoutStrategy=r,this.repo=new Map,this.attributesBound=!1}getArtifact(t){return this.repo.get(t)}setArtifact(t,e){this.repo.set(t,e)}run(t,e,r){var n;this.profiler.event("op",`ProgramManager.run ${null!==(n=t.programInfo.name)&&void 0!==n?n:"unknown kernel"}`,()=>{var n;let o=this.glContext.gl,a=t.program;o.useProgram(a);try{this.bindOutput(r),this.attributesBound||this.bindAttributes(t.attribLocations),this.bindUniforms(t.uniformLocations,null!==(n=t.programInfo.variables)&&void 0!==n?n:[],e)}catch(e){throw i.Logger.error("ProgramManager",t.programInfo.shaderSource),e}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEac
1671h(t=>this.glContext.deleteProgram(t.program))}build(t,e,r){return this.profiler.event("backend","ProgramManager.build",()=>{let n=new o.GlslPreprocessor(this.glContext,t,e,r),i=n.preprocess(),a=this.compile(i);return{programInfo:t,program:a,uniformLocations:this.getUniformLocations(a,n.context.programInfo.inputNames,n.context.programInfo.variables),attribLocations:this.getAttribLocations(a)}})}compile(t){if(!this.vertexShader){i.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");let t=(0,a.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(t,this.glContext.gl.VERTEX_SHADER)}n.env.debug&&i.Logger.verbose("ProrgramManager",`FragShader: 1672${t} 1673`);let e=this.glContext.compileShader(t,this.glContext.gl.FRAGMENT_SHADER),r=this.glContext.createProgram(this.vertexShader,e);return this.glContext.deleteShader(e),r}bindOutput(t){let e=t.width,r=t.height;i.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${e}/${r}, shape=${t.shape}, type=${t.tensor.type}`),this.glContext.attachFramebuffer(t.texture,e,r)}bindAttributes(t){let e=t.position,r=t.textureCoord;this.glContext.setVertexAttributes(e,r),this.attributesBound=!0}bindUniforms(t,e,r){var n;let i=this.glContext.gl,o=0;for(let{name:a,type:s,location:u,arrayLength:l}of t){let t=null===(n=e.find(t=>t.name===a))||void 0===n?void 0:n.data;if("sampler2D"!==s&&!t)throw Error(`variable '${a}' does not have data defined in program info`);switch(s){case"sampler2D":this.bindTexture(r[o],u,o),o++;break;case"float":l?i.uniform1fv(u,t):i.uniform1f(u,t);break;case"int":l?i.uniform1iv(u,t):i.uniform1i(u,t);break;default:throw Error(`Uniform not implemented: ${s}`)}}}bindTexture(t,e,r){this.glContext.bindTextureToUniform(t.texture,r,e)}getAttribLocations(t){return{position:this.getAttribLocation(t,"position"),textureCoord:this.getAttribLocation(t,"textureCoord")}}getUniformLocations(t,e,r){let n=[];if(e)for(let r of e)n.push({name:r,type:"sampler2D",location:this.getUniformLocation(t,r)});if(r)for(let e of r)n.push(Object.assign(Object.assign({},e),{location:this.getUniformLocation(t,e.name)}));return n}getUniformLocation(t,e){let r=this.glContext.gl.getUniformLocation(t,e);if(null===r)throw Error(`Uniform ${e} not found.`);return r}getAttribLocation(t,e){return this.glContext.gl.getAttribLocation(t,e)}}},6416:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLSessionHandler=void 0;let n=r(6231),i=r(1047),o=r(8316),a=r(1640),s=r(1958),u=r(7859),l=r(5702);e.WebGLSessionHandler=class{constructor(t,e){this.backend=t,this.context=e,this.layoutStrategy=new u.PreferLogicalStrategy(t.glContext.maxTextureSize),this.programManager=new s.ProgramManager(this.context.profiler,t.glContext,this.layoutStrategy),this.textureManager=new l.TextureManager(t.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:"full"===t.textureCacheMode}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=t.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new o.WebGLInferenceHandler(this)}onGraphInitialized(t){let e=t.getValues().filter(t=>-1===t.from&&t.tensor).map(t=>t.tensor.dataId);this.initializers=new Set(e)}isInitializer(t){return!!this.initializers&&this.initializers.has(t)}addInitializer(t){this.initializers.add(t)}getTextureData(t,e){return e?this.packedTextureDataCache.get(t):this.unpackedTextureDataCache.get(t)}setTextureData(t,e,r=!1){n.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),r?this.packedTextureDataCache.set(t,e):this.unpackedTextureDataCache.set(t,e)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(t=>this.textureManager.releaseTexture(t,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(t=>this.textureManager.releaseTexture(t,!0)),this.unpackedTextureDataCache=new Map}resolve(t,e,r){let n=(0,i.resolveOperator)(t,e,a.WEBGL_OP_RESOLVE_RULES);return{impl:n.opImpl,context:n.opInit?n.opInit(t,r):t}}}},7769:(t,e,r)=>{"use strict";
1673Object.defineProperty(e,"__esModule",{value:!0}),e.Uint8DataEncoder=e.RGBAFloatDataEncoder=e.RedFloat32DataEncoder=void 0;let n=r(6231);e.RedFloat32DataEncoder=class{constructor(t,e=1){if(1===e)this.internalFormat=t.R32F,this.format=t.RED,this.textureType=t.FLOAT,this.channelSize=e;else{if(4!==e)throw Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA32F,this.format=t.RGBA,this.textureType=t.FLOAT,this.channelSize=e}}encode(t,e){let r,i;return t.constructor!==Float32Array&&(n.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),i=new Float32Array(t)),e*this.channelSize>t.length?(n.Logger.warning("Encoder","Source data too small. Allocating larger array"),i=t,r=this.allocate(e*this.channelSize),i.forEach((t,e)=>r[e]=t)):r=i=t,r}allocate(t){return new Float32Array(4*t)}decode(t,e){return 1===this.channelSize?t.filter((t,e)=>e%4==0).subarray(0,e):t.subarray(0,e)}},e.RGBAFloatDataEncoder=class{constructor(t,e=1,r){if(1!==e&&4!==e)throw Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA,this.format=t.RGBA,this.channelSize=e,this.textureType=r||t.FLOAT}encode(t,e){let r=t;return 1===this.channelSize&&(n.Logger.verbose("Encoder","Exploding into a larger array"),r=this.allocate(e),t.forEach((t,e)=>r[4*e]=t)),r}allocate(t){return new Float32Array(4*t)}decode(t,e){return 1===this.channelSize?t.filter((t,e)=>e%4==0).subarray(0,e):t.subarray(0,e)}},e.Uint8DataEncoder=class{constructor(t,e=1){if(this.channelSize=4,1===e)this.internalFormat=t.ALPHA,this.format=t.ALPHA,this.textureType=t.UNSIGNED_BYTE,this.channelSize=e;else{if(4!==e)throw Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA,this.format=t.RGBA,this.textureType=t.UNSIGNED_BYTE,this.channelSize=e}}encode(t,e){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}allocate(t){return new Uint8Array(t*this.channelSize)}decode(t,e){if(t instanceof Uint8Array)return t.subarray(0,e);throw Error(`Invalid array type: ${t.constructor}`)}}},7859:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBatchDim=e.sizeToSquarishShape=e.getRowsCols=e.sizeFromShape=e.isInt=e.parseAxisParam=e.squeezeShape=e.PreferLogicalStrategy=e.AlwaysKeepOriginalSizeStrategy=void 0;let n=r(6231),i=r(2517);function o(t,e){let r=[],n=[],i=null!=e&&Array.isArray(e)&&0===e.length,o=null==e||i?null:a(e,t).sort(),s=0;for(let e=0;e<t.length;++e){if(null!=o){if(o[s]===e&&1!==t[e])throw Error(`Can't squeeze axis ${e} since its dim '${t[e]}' is not 1`);(null==o[s]||o[s]>e)&&1===t[e]&&(r.push(t[e]),n.push(e)),o[s]<=e&&s++}1!==t[e]&&(r.push(t[e]),n.push(e))}return{newShape:r,keptDims:n}}function a(t,e){let r=e.length;return t=null==t?e.map((t,e)=>e):[].concat(t),(0,i.assert)(t.every(t=>t>=-r&&t<r),()=>`All values in axis param must be in range [-${r}, ${r}) but got axis ${t}`),(0,i.assert)(t.every(s),()=>`All values in axis param must be integers but got axis ${t}`),t.map(t=>t<0?r+t:t)}function s(t){return t%1==0}function u(t){if(0===t.length)return 1;let e=t[0];for(let r=1;r<t.length;r++)e*=t[r];return e}function l(t){let e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}e.AlwaysKeepOriginalSizeStrategy=class{constructor(t){this.maxTextureSize=t}computeTextureWH(t,e){if(0===t.length)return[1,1];let r=this.maxTextureSize;if(e&&void 0!==e.breakAxis){let i=e.breakAxis>=t.length?1:t.slice(e.breakAxis).reduce((t,e)=>t*e),o=e.breakAxis<=0?1:t.slice(0,e.breakAxis).reduce((t,e)=>t*e);if(!(i>r||o>r))return[i,o];n.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${t}, breakAxis:${e.breakAxis}`)}let i=t.reduce((t,e)=>t*e),o=Math.floor(Math.sqrt(i));for(;o<r&&o<i&&i%o!=0;o++);if(o>=r||i%o!=0)throw Error(`The given dimensions are outside this GPU's boundaries: ${t}`);return[o,i/o]}},e.PreferLogicalStrategy=class{constructor(t){this.maxTextureSize=t}computeTextureWH(t,e){let r=this.computeTexture(t,e);return e&&e.isPacked&&(r[0]/=2,r[1]/=2),e&&e.reverseWH?[r[1],r[0]]:r}computeTexture(t,e){let r=e&&e.isPacked;if(0===t.length)return r?[2,2]:[1,1];let i=this.maxTextureSize;if(e&&void 0!==e.breakAxis){let r=e.breakAxis>=t.length?1:t.slice(e.breakAxis).reduce((t,e)=>t*e),o=e.breakAxis<=0?1:t.slice(0,e.breakAxis).reduce((t,e)=>t*e);if(!(r>i||o>i))return[r,o];n.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${t}, breakAxis:${e.breakAxis}`)}let a=t.slice(0);r&&(i*=2,1===(a=a.map((t,e)=>e>=a.length-2?a[e]%2==0?a[e]:a[e]+1:a[e])).length&&(a=[2,a[0]])),2!==a.length&&(a=o(a).newShape);let s=u(a);return a.length<=1&&s<=i?[1,s]:2===a.length&&a[0]<=i&&a[1]<=i?a:3===a.length&&a[0]*a[1]<=i&&a[2]<=i?[a[0]*a[1],a[2]]:3===a.length&&a[0]<=i&&a[1]*a[2]<=i?[a[0],a[1]*a[2]]:4===a.length&&a[0]*a[1]*a[2]<=i&&a[3]<=i?[a[0]*a[1]*a[2],a[3]]:4===a.length&&a[0]<=i&&a[1]*a[2]*a[3]<=i?[a[0],a[1]*a[2]*a[3]]:r?l(s/4).map(t=>2*t):l(s)}},e.squeezeShape=o,e.parseAxisParam=a,e.isInt=s,e.sizeFromShape=u,e.getRowsCols=function(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[t.length>1?t[t.length-2]:1,t[t.length-1]]},e.sizeToSquarishShape=l,e.getBatchDim=function(t,e=2){return u(t.slice(0,t.length-e))}},4057:(t,e,r)=>{"use strict";
1673Object.defineProperty(e,"__esModule",{value:!0}),e.createTextureLayoutFromShape=e.calculateTextureWidthAndHeight=e.createTextureLayoutFromTextureType=void 0;let n=r(2517),i=r(2039);e.createTextureLayoutFromTextureType=(t,r,n)=>{let o=n===i.TextureType.unpacked||n===i.TextureType.unpackedReversed?1:4,a=n===i.TextureType.packed,s=n===i.TextureType.unpackedReversed||n===i.TextureType.packed,u=n===i.TextureType.packedLastDimension?r.length-1:void 0,l=n===i.TextureType.packedLastDimension?r.map((t,e)=>e===r.length-1?4*t:t):void 0;return(0,e.createTextureLayoutFromShape)(t,r,o,l,{isPacked:a,reverseWH:s,breakAxis:u})},e.calculateTextureWidthAndHeight=(t,r,n)=>{let i=(0,e.createTextureLayoutFromTextureType)(t,r,n);return[i.width,i.height]},e.createTextureLayoutFromShape=(t,e,r=1,i,o)=>{let a=!(!o||!o.isPacked),[s,u]=t.computeTextureWH(a&&i||e,o),l=e.length,c=e.slice(0);if(0===l&&(c=[1]),1===r)i=e;else if(a){if(4!==r)throw Error("a packed texture must be 4-channel");i=e,l>0&&(c[l-1]=Math.ceil(c[l-1]/2)),l>1&&(c[l-2]=Math.ceil(c[l-2]/2))}else if(!i)throw Error("Unpacked shape is needed when using channels > 1");return{width:s,height:u,channels:r,isPacked:a,shape:c,strides:n.ShapeUtil.computeStrides(c),unpackedShape:i,reversedWH:o&&o.reverseWH}}},5702:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextureManager=void 0;let n=r(6231);e.TextureManager=class{constructor(t,e,r,n){this.glContext=t,this.layoutStrategy=e,this.profiler=r,this.config=n,this.pendingRead=new Map,n.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(t,e,r,i){let o,a;let s=this.toEncoderType(t),u=this.glContext.getEncoder(s,e.channels||1,i);if(e.isPacked&&1===i)throw Error("not implemented");let l=e.width,c=e.height;if(this.config.reuseTextures){o=`${l}x${c}_${u.format}_${u.internalFormat}_${u.textureType}`,(a=this.inUseTextures.get(o))||(a=[],this.inUseTextures.set(o,a));let e=this.idleTextures.get(o);if(e&&e.length>0){let n=e.pop();return a.push(n),1===i&&this.glContext.updateTexture(n,l,c,u,this.toTextureData(t,r)),n}}n.Logger.verbose("TextureManager",`Creating new texture of size ${e.width}x${e.height}`);let p=this.glContext.allocateTexture(l,c,u,this.toTextureData(t,r));return this.config.reuseTextures&&(a.push(p),this.textureLookup.set(p,o)),p}readTexture(t,e,r){return r||(r=1),this.profiler.event("backend","TextureManager.readTexture",()=>{let n=t.shape.reduce((t,e)=>t*e)*r,i=this.glContext.readTexture(t.texture,t.width,t.height,n,this.toEncoderType(e),r);return this.toTensorData(e,i)})}async readTextureAsync(t,e,r){let n=t.tensor.dataId;if(r||(r=1),this.pendingRead.has(n)){let t=this.pendingRead.get(n);return new Promise(e=>null==t?void 0:t.push(e))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(n,[]);let i=t.shape.reduce((t,e)=>t*e)*r;await this.glContext.createAndWaitForFence();let o=this.glContext.readTexture(t.texture,t.width,t.height,i,this.toEncoderType(e),r),a=this.toTensorData(e,o),s=this.pendingRead.get(n);return this.pendingRead.delete(n),null==s||s.forEach(t=>t(a)),a})}readUint8TextureAsFloat(t){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{let e=t.shape.reduce((t,e)=>t*e),r=this.glContext.readTexture(t.texture,t.width,t.height,4*e,"byte",4);return new Float32Array(r.buffer,r.byteOffset,e)})}releaseTexture(t,e){let r;if(this.config.reuseTextures&&(r=this.textureLookup.get(t.texture))){e&&this.textureLookup.delete(r);let n=this.inUseTextures.get(r);if(n){let e=n.indexOf(t.texture);if(-1!==e){n.splice(e,1);let i=this.idleTextures.get(r);i||(i=[],this.idleTextures.set(r,i)),i.push(t.texture)}}}r&&!e||(n.Logger.verbose("TextureManager",`Deleting texture of size ${t.width}x${t.height}`),this.glContext.deleteTexture(t.texture))}toTensorData(t,e){switch(t){case"int16":return e instanceof Int16Array?e:Int16Array.from(e);case"int32":return e instanceof Int32Array?e:Int32Array.from(e);case"int8":return e instanceof Int8Array?e:Int8Array.from(e);case"uint16":return e instanceof Uint16Array?e:Uint16Array.from(e);case"uint32":return e instanceof Uint32Array?e:Uint32Array.from(e);case"uint8":case"bool":return e instanceof Uint8Array?e:Uint8Array.from(e);case"float32":return e instanceof Float32Array?e:Float32Array.from(e);case"float64":return e instanceof Float64Array?e:Float64Array.from(e);default:throw Error(`TensorData type ${t} is not supported`)}}toTextureData(t,e){if(e)return e instanceof Float32Array?e:new Float32Array(e)}toEncoderType(t){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(t,e)=>{"use strict";var r;
1673Object.defineProperty(e,"__esModule",{value:!0}),e.TextureType=void 0,(r=e.TextureType||(e.TextureType={}))[r.unpacked=0]="unpacked",r[r.unpackedReversed=1]="unpackedReversed",r[r.packed=2]="packed",r[r.downloadUint8AsFloat=3]="downloadUint8AsFloat",r[r.packedLastDimension=4]="packedLastDimension"},9390:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getGlChannels=e.getCoordsDataType=e.getSqueezedParams=e.squeezeInputShape=e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=e.generateShaderFuncNameFromInputSamplerName=e.repeatedTry=e.getPackedShape=void 0;let n=r(2517);e.getPackedShape=function(t){let e=t.length;return t.slice(0,e-1).concat(t[e-1]/4)},e.repeatedTry=async function(t,e=t=>0,r){return new Promise((n,i)=>{let o=0,a=()=>{if(t())return void n();let s=e(++o);null!=r&&o>=r?i():setTimeout(a,s)};a()})},e.generateShaderFuncNameFromInputSamplerName=function(t){return(0,n.assert)(void 0!==t&&0!==t.length,()=>"empty string found for sampler name"),"get"+t.charAt(0).toUpperCase()+t.slice(1)},e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(t){return(0,n.assert)(void 0!==t&&0!==t.length,()=>"empty string found for sampler name"),"get"+t.charAt(0).toUpperCase()+t.slice(1)+"AtOutCoords"},e.squeezeInputShape=function(t,e){return JSON.parse(JSON.stringify(t)),e},e.getSqueezedParams=function(t,e){return e.map(e=>t[e]).join(", ")},e.getCoordsDataType=function(t){if(t<=1)return"int";if(2===t)return"ivec2";if(3===t)return"ivec3";if(4===t)return"ivec4";if(5===t)return"ivec5";if(6===t)return"ivec6";throw Error(`GPU for rank ${t} is not yet supported`)},e.getGlChannels=function(t=6){return["x","y","z","w","u","v"].slice(0,t)}},7305:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createNewWebGLContext=e.createWebGLContext=void 0;let n=r(6231),i=r(1713),o={};function a(t){let e;let r=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 t=document.createElement("canvas");return t.width=1,t.height=1,t}(),o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};
1673if((!t||"webgl2"===t)&&(e=r.getContext("webgl2",o)))try{return new i.WebGLContext(e,2)}catch(t){n.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${t}`)}if((!t||"webgl"===t)&&(e=r.getContext("webgl",o)||r.getContext("experimental-webgl",o)))try{return new i.WebGLContext(e,1)}catch(t){n.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${t}`)}throw Error("WebGL is not supported")}e.createWebGLContext=function t(e){let r;(!e||"webgl2"===e)&&"webgl2"in o?r=o.webgl2:(!e||"webgl"===e)&&"webgl"in o&&(r=o.webgl),r=r||a(e),e=e||1===r.version?"webgl":"webgl2";let n=r.gl;return o[e]=r,n.isContextLost()?(delete o[e],t(e)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),r)},e.createNewWebGLContext=a},1713:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLContext=e.linearSearchLastTrue=void 0;let a=r(1670),s=o(r(7769)),u=r(9390);function l(t){let e=0;for(;e<t.length&&t[e]();++e);return e-1}e.linearSearchLastTrue=l,e.WebGLContext=class{constructor(t,e){this.frameBufferBound=!1,this.itemsToPoll=[],this.gl=t,this.version=e,this.getExtensions(),this.vertexbuffer=this.createVertexbuffer(),this.framebuffer=this.createFramebuffer(),this.queryVitalParameters()}allocateTexture(t,e,r,n){let i=this.gl,o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);let a=n?r.encode(n,t*e):null;return i.texImage2D(i.TEXTURE_2D,0,r.internalFormat,t,e,0,r.format,r.textureType,a),this.checkError(),o}updateTexture(t,e,r,n,i){let o=this.gl;o.bindTexture(o.TEXTURE_2D,t);let a=n.encode(i,e*r);o.texSubImage2D(o.TEXTURE_2D,0,0,0,e,r,n.format,n.textureType,a),this.checkError()}attachFramebuffer(t,e,r){let n=this.gl;n.bindTexture(n.TEXTURE_2D,t),n.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.checkError(),n.viewport(0,0,e,r),n.scissor(0,0,e,r)}readTexture(t,e,r,n,i,o){let a=this.gl;o||(o=1),this.frameBufferBound||this.attachFramebuffer(t,e,r);let s=this.getEncoder(i,o),u=s.allocate(e*r);return a.bindTexture(a.TEXTURE_2D,t),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,t,0),a.readPixels(0,0,e,r,a.RGBA,s.textureType,u),this.checkError(),s.decode(u,n)}isFramebufferReady(){return!0}getActiveTexture(){let t=this.gl;return"TEXTURE"+(t.getParameter(this.gl.ACTIVE_TEXTURE)-t.TEXTURE0)}getTextureBinding(){return this.gl.getParameter(this.gl.TEXTURE_BINDING_2D)}getFramebufferBinding(){return this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING)}setVertexAttributes(t,e){let r=this.gl;r.vertexAttribPointer(t,3,r.FLOAT,!1,20,0),r.enableVertexAttribArray(t),-1!==e&&(r.vertexAttribPointer(e,2,r.FLOAT,!1,20,12),r.enableVertexAttribArray(e)),this.checkError()}createProgram(t,e){let r=this.gl,n=r.createProgram();return r.attachShader(n,t),r.attachShader(n,e),r.linkProgram(n),n}compileShader(t,e){let r=this.gl,n=r.createShader(e);if(!n)throw Error(`createShader() returned null with type ${e}`);if(r.shaderSource(n,t),r.compileShader(n),!1===r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Failed to compile shader: ${r.getShaderInfoLog(n)} 1674Shader source: 1675${t}`);return n}deleteShader(t){this.gl.deleteShader(t)}bindTextureToUniform(t,e,r){let n=this.gl;n.activeTexture(n.TEXTURE0+e),this.checkError(),n.bindTexture(n.TEXTURE_2D,t),this.checkError(),n.uniform1i(r,e),this.checkError()}draw(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.checkError()}checkError(){if(a.env.debug){let t=this.gl,e=t.getError(),r="";switch(e){case t.NO_ERROR:return;case t.INVALID_ENUM:r="INVALID_ENUM";break;case t.INVALID_VALUE:r="INVALID_VALUE";break;case t.INVALID_OPERATION:r="INVALID_OPERATION";break;case t.INVALID_FRAMEBUFFER_OPERATION:r="INVALID_FRAMEBUFFER_OPERATION";break;case t.OUT_OF_MEMORY:r="OUT_OF_MEMORY";break;case t.CONTEXT_LOST_WEBGL:r="CONTEXT_LOST_WEBGL";break;default:r=`Unknown WebGL Error: ${e.toString(16)}`}throw Error(r)}}deleteTexture(t){this.gl.deleteTexture(t)}deleteProgram(t){this.gl.deleteProgram(t)}getEncoder(t,e,r=0){if(2===this.version)return new s.RedFloat32DataEncoder(this.gl,e);switch(t){case"float":return 1===r||this.isRenderFloat32Supported?new s.RGBAFloatDataEncoder(this.gl,e):new s.RGBAFloatDataEncoder(this.gl,e,this.textureHalfFloatExtension.HALF_FLOAT_OES);case"int":throw Error("not implemented");case"byte":return new s.Uint8DataEncoder(this.gl,e);default:throw Error(`Invalid dataType: ${t}`)}}clearActiveTextures(){let t=this.gl;for(let e=0;e<this.maxTextureImageUnits;++e)t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,null)}dispose(){if(this.disposed)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(this.framebuffer),t.bindBuffer(t.ARRAY_BUFFER,null),t.deleteBuffer(this.vertexbuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null),t.finish(),this.disposed=!0}createDefaultGeometry(){return new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0])}createVertexbuffer(){let t=this.gl,e=t.createBuffer();if(!e)throw Error("createBuffer() returned null");let r=this.createDefaultGeometry();return t.bindBuffer(t.ARRAY_BUFFER,e),t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW),this.checkError(),e}createFramebuffer(){let t=this.gl.createFramebuffer();if(!t)throw Error("createFramebuffer returned null");return t}queryVitalParameters(){let t=this.gl;if(this.isFloatTextureAttachableToFrameBuffer=this.checkFloatTextureAttachableToFrameBuffer(),this.isRenderFloat32Supported=this.checkRenderFloat32(),this.isFloat32DownloadSupported=this.checkFloat32Download(),1===this.version&&!this.textureHalfFloatExtension&&!this.isRenderFloat32Supported)throw Error("both float32 and float16 TextureType are not supported");this.isBlendSupported=!this.isRenderFloat32Supported||this.checkFloat32Blend(),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxTextureImageUnits=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.version}getExtensions(){2===this.version?(this.colorBufferFloatExtension=this.gl.getExtension("EXT_color_buffer_float"),this.disjointTimerQueryWebgl2Extension=this.gl.getExtension("EXT_disjoint_timer_query_webgl2")):(this.textureFloatExtension=this.gl.getExtension("OES_texture_float"),this.textureHalfFloatExtension=this.gl.getExtension("OES_texture_half_float"))}checkFloatTextureAttachableToFrameBuffer(){let t=this.gl,e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);let r=2===this.version?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,r,1,1,0,t.RGBA,t.FLOAT,null);let n=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0);let i=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(e),t.deleteFramebuffer(n),i}checkRenderFloat32(){if(2===this.version){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension)return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Download(){if(2===this.version){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension||!this.gl.getExtension("WEBGL_color_buffer_float"))return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Blend(){let t,e,r,n,i;let o=this.gl;try{t=o.createTexture(),e=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,t);let a=2===this.version?o.RGBA32F:o.RGBA;return o.texImage2D(o.TEXTURE_2D,0,a,1,1,0,o.RGBA,o.FLOAT,null),o.bindFramebuffer(o.FRAMEBUFFER,e),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,t,0),o.enable(o.BLEND),!!(r=o.createShader(o.VERTEX_SHADER))&&(o.shaderSource(r,"void main(){}"),o.compileShader(r),!!(n=o.createShader(o.FRAGMENT_SHADER))&&(o.shaderSource(n,"precision highp float;void main(){gl_FragColor=vec4(0.5);}"),o.compileShader(n),!!(i=o.createProgram())&&(o.attachShader(i,r),o.attachShader(i,n),o.linkProgram(i),o.useProgram(i),o.drawArrays(o.POINTS,0,1),o.getError()===o.NO_ERROR)))}finally{o.disable(o.BLEND),i&&o.deleteProgram(i),r&&o.deleteShader(r),n&&o.deleteShader(n),e&&(o.bindFramebuffer(o.FRAMEBUFFER,null),o.deleteFramebuffer(e)),t&&(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(t))}}beginTimer(){if(2===this.version&&this.disjointTimerQueryWebgl2Extension){let t=this.gl,e=this.disjointTimerQueryWebgl2Extension,r=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,r),r}throw Error("WebGL1 profiling currently not supported.")}endTimer(){if(2!==this.version||!this.disjointTimerQueryWebgl2Extension)throw Error("WebGL1 profiling currently not supported");{let t=this.gl,e=this.disjointTimerQueryWebgl2Extension;t.endQuery(e.TIME_ELAPSED_EXT)}}isTimerResultAvailable(t){let e=!1,r=!1;if(2!==this.version||!this.disjointTimerQueryWebgl2Extension)throw Error("WebGL1 profiling currently not supported");{let n=this.gl,i=this.disjointTimerQueryWebgl2Extension;e=n.getQueryParameter(t,n.QUERY_RESULT_AVAILABLE),r=n.getParameter(i.GPU_DISJOINT_EXT)}return e&&!r}getTimerResult(t){let e=0;if(2!==this.version)throw Error("WebGL1 profiling currently not supported");{let r=this.gl;e=r.getQueryParameter(t,r.QUERY_RESULT),r.deleteQuery(t)}return e/1e6}async waitForQueryAndGetTime(t){return await (0,u.repeatedTry)(()=>this.isTimerResultAvailable(t)),this.getTimerResult(t)}async createAndWaitForFence(){let t=this.createFence(this.gl);
1675return this.pollFence(t)}createFence(t){let e;let r=t,n=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);return t.flush(),e=null===n?()=>!0:()=>{let t=r.clientWaitSync(n,0,0);return t===r.ALREADY_SIGNALED||t===r.CONDITION_SATISFIED},{query:n,isFencePassed:e}}async pollFence(t){return new Promise(e=>{this.addItemToPoll(()=>t.isFencePassed(),()=>e())})}pollItems(){let t=l(this.itemsToPoll.map(t=>t.isDoneFn));for(let e=0;e<=t;++e){let{resolveFn:t}=this.itemsToPoll[e];t()}this.itemsToPoll=this.itemsToPoll.slice(t+1)}async addItemToPoll(t,e){this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),this.itemsToPoll.length>1||await (0,u.repeatedTry)(()=>(this.pollItems(),0===this.itemsToPoll.length))}}},1036:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ExecutionPlan=void 0;let n=r(6231);class i{constructor(t,e){this.op=t,this.node=e}}e.ExecutionPlan=class{constructor(t,e,r){this.graph=t,this.profiler=r,this.initialize(e)}initialize(t){this.profiler.event("session","ExecutionPlan.initialize",()=>{let e=this.graph.getNodes();if(e.length!==t.length)throw Error("The size of nodes and OPs do not match.");this._ops=t.map((t,r)=>new i(t,e[r])),this.reset(),this._starter=[],this._ops.forEach((t,e)=>{let r=!0;for(let e of t.node.inputs)if(!this._values[e]&&-1===this.graph.getInputIndices().indexOf(e)){r=!1;break}r&&this._starter.push(e)})})}reset(){this._values=this.graph.getValues().map(t=>t.tensor)}async execute(t,e){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();let r=t.createInferenceHandler(),i=this.graph.getInputIndices();if(e.length!==i.length)throw Error(`number of input tensors don't match the number of inputs to the model: actual: ${e.length} expected: ${i.length}`);e.forEach((t,e)=>{let r=i[e];this._values[r]=t});let o=this._starter.slice(0),a=this.graph.getValues(),s=this.graph.getNodes(),u=0;for(;u<o.length;){let t=o[u++],e=this._ops[t],i=e.node.inputs.map(t=>this._values[t]);if(-1!==i.indexOf(void 0))throw Error(`unresolved input detected: op: ${e.node}`);let l=i;n.Logger.verbose("ExecPlan",`Runing op:${e.node.name} (${l.map((t,r)=>`'${e.node.inputs[r]}': ${t.type}[${t.dims.join(",")}]`).join(", ")})`);let c=await this.profiler.event("node",e.node.name,async()=>e.op.impl(r,l,e.op.context));if(c.length!==e.node.outputs.length)throw Error("the size of output does not match model definition.");c.forEach((t,r)=>{let n=e.node.outputs[r];if(this._values[n])throw Error(`output [${n}] already has value: op:${e.node.name}`);this._values[n]=t});let p=new Set;c.forEach((t,r)=>{for(let t of a[e.node.outputs[r]].to){let e=s[t],r=!0;for(let t of e.inputs)if(!this._values[t]){r=!1;break}r&&p.add(t)}}),o.push(...p)}let l=[];for(let t=0;t<this.graph.getOutputIndices().length;t++){let e=this.graph.getOutputIndices()[t],r=this._values[e];if(void 0===r)throw Error(`required output [${e}] does not have value`);0===e?await r.getData():r.data,l.push(r)}return n.Logger.verbose("ExecPlan","disposing of inferenceHandler"),r.dispose(),l})}}},7070:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Graph=void 0;let n=r(1446),i=r(7778),o=r(9395),a=r(9162),s=r(2517);var u=o.onnxruntime.experimental.fbs;e.Graph={from:(t,e)=>new p(t,e)};class l{constructor(t){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,t&&(this.t
1675ype=s.ProtoUtil.tensorValueTypeFromProto(t.type.tensorType))}get from(){return this._from}get to(){return this._to}}class c{constructor(t,e){t instanceof n.onnx.NodeProto?(this.name=t.name,this.opType=t.opType,this.attributes=new i.Attribute(t.attribute)):t instanceof u.Node&&(this.name=null!=e?e:t.name(),this.opType=t.opType(),this.attributes=new i.Attribute(s.ProtoUtil.tensorAttributesFromORTFormat(t))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class p{constructor(t,e){if(!t)throw TypeError("graph is empty");this.buildGraph(t),this.transformGraph(e),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(t){if(t instanceof n.onnx.GraphProto)this.buildGraphFromOnnxFormat(t);else{if(!(t instanceof u.Graph))throw TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(t)}}buildGraphFromOnnxFormat(t){let e=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let r=new Map;if(!t.input)throw Error("missing information in graph: input");let n=[];for(let r of t.input){if(e.has(r.name))throw Error(`duplicated input name: ${r.name}`);let t=this._allData.push(new l(r))-1;e.set(r.name,t),n.push(r.name)}if(!t.initializer)throw Error("missing information in graph: initializer");for(let r of t.initializer){let t=e.get(r.name);if(void 0===t){let n=new l;n.type={shape:{dims:s.ProtoUtil.tensorDimsFromProto(r.dims)},tensorType:s.ProtoUtil.tensorDataTypeFromProto(r.dataType)},t=this._allData.push(n)-1,e.set(r.name,t)}this._allData[t]._from=-1,this._allData[t].tensor=a.Tensor.fromProto(r)}for(let t=0;t<this._allData.length;t++)this._allData[t].tensor||(this._allInputIndices.push(t),this._allInputNames.push(n[t]));if(!t.output)throw Error("missing information in graph: output");for(let r of t.output){if(e.has(r.name))throw Error(`duplicated output name: ${r.name}`);let t=this._allData.push(new l(r))-1;e.set(r.name,t),this._allOutputIndices.push(t),this._allOutputNames.push(r.name)}if(!t.node)throw Error("missing information in graph: node");for(let e of t.node){if(!e.name)for(let t=0;;t++){let n=`unnamed_${e.opType}_${t}`;if(!r.has(n)){e.name=n;break}}if(r.has(e.name))throw Error(`duplicated node name: ${e.name}`);let t=this._nodes.push(new c(e))-1;r.set(e.name,t)}for(let r=0;r<this._nodes.length;r++){let n=this._nodes[r],i=t.node[r];if(!i.output)throw Error(`missing output for node: ${i.name}`);for(let t of i.output){let o=e.get(t);if(void 0===o&&(o=this._allData.push(new l)-1,e.set(t,o)),n.outputs.push(o),void 0!==this._allData[o]._from)throw Error(`multiple nodes output to one data value: ${o}`);if(this._allData[o]._from=r,"Constant"===i.opType){if(!i.attribute||1!==i.attribute.length||!i.attribute[0].t)throw Error("missing attributes or missing tensor value in attributes for this Constant operator");if(!i.output||1!==i.output.length)throw Error("missing output or incorrect number of outputs for this Constant operator");n.outputs.pop(),n.executeNode=!1,this._allData[o]._from=-1,this._allData[o].tensor=a.Tensor.fromProto(i.attribute[0].t)}}}for(let r=0;r<this._nodes.length;r++){let n=this._nodes[r],i=t.node[r];if(!i.input)throw Error(`missing input for node: ${i.name}`);for(let t of i.input){let o=e.get(t);if(void 0===o){if(""===t&&3===i.input.length&&"Resize"===i.opType)continue;throw Error(`unrecognized input '${t}' for node: ${i.name}`)}n.inputs.push(o),this._allData[o]._to.push(r)}}return!0}buildGraphFromOrtFormat(t){var e,r,n;let i=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let o=new Map,p=[];for(let o=0;o<t.inputsLength();o++){let a=t.inputs(o);if(i.has(a))throw Error(`duplicated input name: ${a}`);for(let o=0;o<t.nodeArgsLength();o++)if((null===(e=t.nodeArgs(o))||void 0===e?void 0:e.name())===a){let e=new l;if((null===(n=null===(r=t.nodeArgs(o))||void 0===r?void 0:r.type())||void 0===n?void 0:n.valueType())!==u.TypeInfoValue.tensor_type)throw Error("Unexpected value type for the nodeArg.");let c=t.nodeArgs(o).type().value(new u.TensorTypeAndShape),f=s.ProtoUtil.tensorDataTypeFromProto(c.elemType()),d=c.shape(),h=[];for(let t=0;t<d.dimLength();t++)h.push(s.LongUtil.longToNumber(d.dim(t).value().dimValue()));e.type={shape:{dims:h},tensorType:f};let g=this._allData.push(e)-1;i.set(a,g),p.push(a)}}for(let e=0;
1675e<t.initializersLength();e++){let r=t.initializers(e),n=i.get(r.name());if(void 0===n){let t=new l,e=s.ProtoUtil.tensorDimsFromORTFormat(r),o=s.ProtoUtil.tensorDataTypeFromProto(r.dataType());t.type={shape:{dims:e},tensorType:o},n=this._allData.push(t)-1,i.set(r.name(),n)}this._allData[n]._from=-1,this._allData[n].tensor=a.Tensor.fromOrtTensor(r)}for(let t=0;t<this._allData.length;t++)this._allData[t].tensor||(this._allInputIndices.push(t),this._allInputNames.push(p[t]));for(let e=0;e<t.outputsLength();e++){let r=t.outputs(e);if(i.has(r))throw Error(`duplicated output name: ${r}`);let n=this._allData.push(new l)-1;i.set(r,n),this._allOutputIndices.push(n),this._allOutputNames.push(r)}if(!t.nodes)throw Error("missing information in graph: node");for(let e=0;e<t.nodesLength();e++){let r=t.nodes(e),n=r.name();if(!n)for(let t=0;n=`unnamed_${r.opType()}_${t}`,o.has(n);t++);if(o.has(n))throw Error(`duplicated node name: ${n}`);let i=this._nodes.push(new c(r,n))-1;o.set(n,i)}for(let e=0;e<this._nodes.length;e++){let r=this._nodes[e],n=t.nodes(e);if(null==n)throw Error(`No node exists at index ${e}`);if(0===(null==n?void 0:n.outputsLength()))throw Error(`missing output for node: ${n.name}`);for(let t=0;t<(null==n?void 0:n.outputsLength());t++){let o=null==n?void 0:n.outputs(t),s=i.get(o);if(void 0===s&&(s=this._allData.push(new l)-1,i.set(o,s)),r.outputs.push(s),void 0!==this._allData[s]._from)throw Error(`multiple nodes output to one data value: ${s}`);if(this._allData[s]._from=e,"Constant"===n.opType()){if(1!==n.attributesLength()||!n.attributes(0).t())throw Error("missing attributes or missing tensor value in attributes for this Constant operator");if(1!==n.outputsLength())throw Error("missing output or incorrect number of outputs for this Constant operator");r.outputs.pop(),r.executeNode=!1,this._allData[s]._from=-1,this._allData[s].tensor=a.Tensor.fromOrtTensor(n.attributes(0).t())}}}for(let e=0;e<this._nodes.length;e++){let r=this._nodes[e],n=t.nodes(e);if(0===n.inputsLength())throw Error(`missing input for node: ${n.name}`);for(let t=0;t<n.inputsLength();t++){let o=n.inputs(t),a=i.get(o);if(void 0===a)throw Error(`unrecognized input '${o}' for node: ${n.name()}`);r.inputs.push(a),this._allData[a]._to.push(e)}}}checkIsAcyclic(){let t=new Set;this._allInputIndices.forEach(e=>{this._allData[e]._to.forEach(e=>{t.add(e)})});let e=Array.from(t),r=Array(this._nodes.length).fill("white");for(;e.length>0;){let t=e.pop();"gray"===r[t]?r[t]="black":(e.push(t),r[t]="gray",this._nodes[t].outputs.forEach(n=>{let i=this._allData[n];if(void 0!==i.tensor)throw Error("node outputs should not be initialized");if(i._from!==t)throw Error("from property of the Value object doesn't match index of Node being processed");i._to.forEach(t=>{if("gray"===r[t])throw Error("model graph is cyclic");"white"===r[t]&&e.push(t)})}))}}transformGraph(t){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),t&&t.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let t=0;for(let e=0;e<this._nodes.length;e++)this._nodes[e].executeNode?t>0&&(this._nodes[e].inputs.forEach(r=>{let n=this._allData[r]._to.indexOf(e+t);-1!==n&&(this._allData[r]._to[n]=e)}),this._nodes[e].outputs.forEach(r=>{this._allData[r]._from&&this._allData[r]._from===e+t&&(this._allData[r]._from=e)})):(t++,this._nodes[e].outputs.forEach(t=>{this._allData[t]._from=-2}),this._nodes.splice(e,1),e--);t=0;for(let e=0;e<this._allData.length;e++)if(-2!==this._allData[e].from||-1!==this._allOutputIndices.indexOf(e+t)){if(t>0){let r=-1;void 0!==this._allData[e].from&&-1!==this._allData[e].from?-1!==(r=this._nodes[this._allData[e].from].outputs.indexOf(e+t))&&(this._nodes[this._allData[e].from].outputs[r]=e):-1!==(r=this._allInputIndices.indexOf(e+t))&&(this._allInputIndices[r]=e),this._allData[e].to.forEach(n=>{-1!==(r=this._nodes[n].inputs.indexOf(e+t))&&(this._nodes[n].inputs[r]=e)}),0===this._allData[e].to.length&&-1!==(r=this._allOutputIndices.indexOf(e+t))&&(this._allOutputIndices[r]=e)}}else t++,this._allData.splice(e,1),e--}deleteNode(t){let e=this._nodes[t];
1675if(e.outputs.length>1){for(let t=1;t<e.outputs.length;t++)if(this._allData[e.outputs[t]].to.length>0)throw Error("Node deletion with more than one output connected to other nodes is not supported. ")}e.executeNode=!1;let r=e.inputs[0],n=e.outputs[0],i=this._allData[n].to,o=this._allData[r].to.indexOf(t);if(-1===o)throw Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[r].to.splice(o,1),this._allData[n]._to=[];let a=this._allOutputIndices.indexOf(n);if(-1!==a&&(this._allOutputIndices[a]=r),i&&i.length>0)for(let t of i){let e=this._nodes[t].inputs.indexOf(n);if(-1===e)throw Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[t].inputs[e]=r,this._allData[r].to.push(t)}}removeAllDropoutNodes(){let t=0;for(let e of this._nodes){if("Dropout"===e.opType){if(1!==e.inputs.length)throw Error("Dropout nodes should only contain one input. ");if(1!==e.outputs.length&&2!==e.outputs.length)throw Error("Dropout nodes should contain either 1 or 2 output(s)");if(2===e.outputs.length&&0!==this._allData[e.outputs[1]]._to.length)throw Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(t)}t++}}removeAllIdentityNodes(){let t=0;for(let e of this._nodes)"Identity"===e.opType&&this.deleteNode(t),t++}isActivation(t){switch(t.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(let t of this._nodes)if("Conv"===t.opType){let e=this._allData[t.outputs[0]]._to;if(1===e.length&&this.isActivation(this._nodes[e[0]])){let r=this._nodes[e[0]];if("Clip"===r.opType){if(1===r.inputs.length)try{t.attributes.set("activation_params","floats",[r.attributes.getFloat("min"),r.attributes.getFloat("max")])}catch(e){t.attributes.set("activation_params","floats",[s.MIN_CLIP,s.MAX_CLIP])}else{if(!(r.inputs.length>=3&&void 0!==this._allData[r.inputs[1]].tensor&&void 0!==this._allData[r.inputs[2]].tensor))continue;t.attributes.set("activation_params","floats",[this._allData[r.inputs[1]].tensor.floatData[0],this._allData[r.inputs[2]].tensor.floatData[0]])}}t.attributes.set("activation","string",r.opType),this.deleteNode(e[0])}}}}},6231:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.now=e.Profiler=e.Logger=void 0;let r={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},n={none:new class{log(t,e,r){}},console:new class{log(t,e,r){console.log(`${this.color(t)} ${r?"\x1b[35m"+r+"\x1b[0m ":""}${e}`)}color(t){switch(t){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: ${t}`)}}}},i={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1},o={"":i};function a(t,e,r,n){var i;if(void 0===e)return i=t,{verbose:a.verbose.bind(null,i),info:a.info.bind(null,i),warning:a.warning.bind(null,i),error:a.error.bind(null,i),fatal:a.fatal.bind(null,i)};if(void 0===r)s(t,e);else if("number"==typeof r&&void 0===n)s(t,e);else if("string"==typeof r&&void 0===n)s(t,r,0,e);else{if("string"!=typeof r||"number"!=typeof n)throw TypeError("input is valid");s(t,r,0,e)}}function s(t,e,i,a){let s=o[a||""]||o[""];r[t]<r[s.minimalSeverity]||(s.logDateTime&&(e=`${(new Date).toISOString()}|${e}`),s.logSourceLocation,n[s.provider].log(t,e,a))}!function(t){function e(t){o={},r("",t||{})}function r(t,r){if("*"===t)e(r);else{let e=o[t]||i;o[t]={provider:r.provider||e.provider,minimalSeverity:r.minimalSeverity||e.minimalSeverity,logDateTime:void 0===r.logDateTime?e.logDateTime:r.logDateTime,logSourceLocation:void 0===r.logSourceLocation?e.logSourceLocation:r.logSourceLocation}}}t.verbose=function(e,r){t("verbose",e,r)},t.info=function(e,r){t("info",e,r)},t.warning=function(e,r){t("warning",e,r)},t.error=function(e,r){t("error",e,r)},t.fatal=function(e,r){t("fatal",e,r)},t.reset=e,t.set=r,t.setWithEnv=function(t){let e={};t.logLevel&&(e.minimalSeverity=t.logLevel),r("",e)}}(a||(a={})),e.Logger=a;class u{constructor(t,e,r,n,i,o){this.category=t,this.name=e,this.startTime=r,this.endCallback=n,this.timer=i,this.ctx=o}end(){return this.endCallback(this)}async checkTimer(){if(void 0===this.ctx||void 0===this.timer)throw Error("No webgl timer found");return this.ctx.endTimer(),this.ctx.waitForQueryAndGetTime(this.timer)}}class l{constructor(t,e,r,n){this.category=t,this.name=e,this.startTime=r,this.endTime=n}}e.Profiler=class{static create(t){return void 0===t?new this:new this(t.maxNumberEvents,t.flushBatchSize,t.flushIntervalInMilliseconds)}constructor(t,e,r){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=void 0===t?1e4:t,this._flushBatchSize=void 0===e?10:e,this._flushIntervalInMilliseconds=void 0===r?5e3:r}start(){this._started=!0,this._timingEvents=[],this._flushTime=(0,e.now)(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer])}event(t,e,r,n){let i=this._started?this.begin(t,e,n):void 0,o=!1,a=r
1675();if(a&&"function"==typeof a.then)return o=!0,new Promise((t,e)=>{a.then(async e=>{i&&await i.end(),t(e)},async t=>{i&&await i.end(),e(t)})});if(!o&&i){let t=i.end();if(t&&"function"==typeof t.then)return new Promise((e,r)=>{t.then(()=>{e(a)},t=>{r(t)})})}return a}begin(t,r,n){if(!this._started)throw Error("profiler is not started yet");if(void 0===n){let n=(0,e.now)();return this.flush(n),new u(t,r,n,t=>this.endSync(t))}return new u(t,r,0,async t=>this.end(t),n.beginTimer(),n)}async end(t){let e=await t.checkTimer();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new l(t.category,t.name,t.startTime,e)),this.flush(e))}endSync(t){let r=(0,e.now)();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new l(t.category,t.name,t.startTime,r)),this.flush(r))}logOneEvent(t){e.Logger.verbose(`Profiler.${t.category}`,`${(t.endTime-t.startTime).toFixed(2)}ms on event '${t.name}' at ${t.endTime.toFixed(2)}`)}flush(t){if(this._timingEvents.length-this._flushPointer>=this._flushBatchSize||t-this._flushTime>=this._flushIntervalInMilliseconds){for(let t=this._flushPointer;this._flushPointer<t+this._flushBatchSize&&this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer]);this._flushTime=(0,e.now)()}}get started(){return this._started}},e.now="undefined"!=typeof performance&&performance.now?()=>performance.now():Date.now},2644:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Model=void 0;let n=r(5686),i=r(1446),o=r(7070),a=r(9395),s=r(2517);var u=a.onnxruntime.experimental.fbs;e.Model=class{constructor(){}load(t,e,r){if(!r)try{return void this.loadFromOnnxFormat(t,e)}catch(t){if(void 0!==r)throw t}this.loadFromOrtFormat(t,e)}loadFromOnnxFormat(t,e){let r=i.onnx.ModelProto.decode(t);if(3>s.LongUtil.longToNumber(r.irVersion))throw Error("only support ONNX model with IR_VERSION>=3");this._opsets=r.opsetImport.map(t=>({domain:t.domain,version:s.LongUtil.longToNumber(t.version)})),this._graph=o.Graph.from(r.graph,e)}loadFromOrtFormat(t,e){let r=new n.flatbuffers.ByteBuffer(t),i=u.InferenceSession.getRootAsInferenceSession(r).model();if(3>s.LongUtil.longToNumber(i.irVersion()))throw Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let t=0;t<i.opsetImportLength();t++){let e=i.opsetImport(t);this._opsets.push({domain:null==e?void 0:e.domain(),version:s.LongUtil.longToNumber(e.version())})}this._graph=o.Graph.from(i.graph(),e)}get graph(){return this._graph}get opsets(){return this._opsets}}},782:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FLOAT_TYPES=e.INT_TYPES=e.NUMBER_TYPES=void 0,e.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],e.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],e.FLOAT_TYPES=["float32","float64"]},1047:(t,e)=>{"use strict";function r(t,e){if(e.endsWith("+")){let r=Number.parseInt(e.substring(0,e.length-1),10);return!isNaN(r)&&r<=t}if(2===e.split("-").length){let r=e.split("-"),n=Number.parseInt(r[0],10),i=Number.parseInt(r[1],10);return!isNaN(n)&&!isNaN(i)&&n<=t&&t<=i}return Number.parseInt(e,10)===t}Object.defineProperty(e,"__esModule",{value:!0}),e.resolveOperator=void 0,e.resolveOperator=function(t,e,n){for(let i of n){let n=i[0],o=i[1],a=i[2],s=i[3],u=i[4];if(t.opType===n){for(let t of e)if((t.domain===o||"ai.onnx"===t.domain&&""===o)&&r(t.version,a))return{opImpl:s,opInit:u}}}throw TypeError(`cannot resolve operator '${t.opType}' with opsets: ${e.map(t=>`${t.domain||"ai.onnx"} v${t.version}`).join(", ")}`)}},9395:(t,e,r)=>{"use strict";var n,i;Object.defineProperty(e,"__esModule",{value:!0}),e.onnxruntime=void 0;let o=r(5686);(function(t){let e;!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.FLOAT=1]="FLOAT",t[t.INT=2]="INT",t[t.STRING=3]="STRING",t[t.TENSOR=4]="TENSOR",t[t.GRAPH=5]="GRAPH",t[t.FLOATS=6]="FLOATS",t[t.INTS=7]="INTS",t[t.STRINGS=8]="STRINGS",t[t.TENSORS=9]="TENSORS",t[t.GRAPHS=10]="GRAPHS",t[t.SPARSE_TENSOR=11]="SPARSE_TENSOR",t[t.SPARSE_TENSORS=12]="SPARSE_TENSORS"}(e=t.AttributeType||(t.AttributeType={}))})((i=(n=e.onnxruntime||(e.onnxruntime={})).experimental||(n.experimental={})).fbs||(i.fbs={})),function(t){!function(t){!function(t){let e;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.VALUE=1]="VALUE",t[t.PARAM=2]="PARAM"}(e=t.DimensionValueType||(t.DimensionValueType={}))}
vendor: 40,905 bytes, line 1675
1675(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.FLOAT=1]="FLOAT",t[t.UINT8=2]="UINT8",t[t.INT8=3]="INT8",t[t.UINT16=4]="UINT16",t[t.INT16=5]="INT16",t[t.INT32=6]="INT32",t[t.INT64=7]="INT64",t[t.STRING=8]="STRING",t[t.BOOL=9]="BOOL",t[t.FLOAT16=10]="FLOAT16",t[t.DOUBLE=11]="DOUBLE",t[t.UINT32=12]="UINT32",t[t.UINT64=13]="UINT64",t[t.COMPLEX64=14]="COMPLEX64",t[t.COMPLEX128=15]="COMPLEX128",t[t.BFLOAT16=16]="BFLOAT16"}(e=t.TensorDataType||(t.TensorDataType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.Primitive=0]="Primitive",t[t.Fused=1]="Fused"}(e=t.NodeType||(t.NodeType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.NONE=0]="NONE",t[t.tensor_type=1]="tensor_type",t[t.sequence_type=2]="sequence_type",t[t.map_type=3]="map_type"}(e=t.TypeInfoValue||(t.TypeInfoValue={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsShape(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsShape(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}dim(e,r){let n=this.bb.__offset(this.bb_pos,4);return n?(r||new t.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}dimLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}static startShape(t){t.startObject(1)}static addDim(t,e){t.addFieldOffset(0,e,0)}static createDimVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startDimVector(t,e){t.startVector(4,e,4)}static endShape(t){return t.endObject()}static createShape(t,e){return r.startShape(t),r.addDim(t,e),r.endShape(t)}}e.Shape=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimension(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimension(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}value(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}denotation(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimension(t){t.startObject(2)}static addValue(t,e){t.addFieldOffset(0,e,0)}static addDenotation(t,e){t.addFieldOffset(1,e,0)}static endDimension(t){return t.endObject()}static createDimension(t,e,n){return r.startDimension(t),r.addValue(t,e),r.addDenotation(t,n),r.endDimension(t)}}e.Dimension=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimensionValue(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimensionValue(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}dimType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):t.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}dimParam(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimensionValue(t){t.startObject(3)}static addDimType(e,r){e.addFieldInt8(0,r,t.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static addDimParam(t,e){t.addFieldOffset(2,e,0)}static endDimensionValue(t){return t.endObject()}static createDimensionValue(t,e,n,i){return r.startDimensionValue(t),r.addDimType(t,e),r.addDimValue(t,n),r.addDimParam(t,i),r.endDimensionValue(t)}}e.DimensionValue=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensorTypeAndShape(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensorTypeAndShape(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}elemType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}shape(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startTensorTypeAndShape(t){t.startObject(2)}static addElemType(e,r){e.addFieldInt32(0,r,t.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(t,e){t.addFieldOffset(1,e,0)}static endTensorTypeAndShape(t){return t.endObject()}static createTensorTypeAndShape(t,e,n){return r.startTensorTypeAndShape(t),r.addElemType(t,e),r.addShape(t,n),r.endTensorTypeAndShape(t)}}e.TensorTypeAndShape=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMapType(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMapType(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keyType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}valueType(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startMapType(t){t.startObject(2)}static addKeyType(e,r){e.addFieldInt32(0,r,t.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(t,e){t.addFieldOffset(1,e,0)}static endMapType(t){return t.endObject()}static createMapType(t,e,n){return r.startMapType(t),r.addKeyType(t,e),r.addValueType(t,n),r.endMapType(t)}}e.MapType=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSequenceType(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSequenceType(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}elemType(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startSequenceType(t){t.startObject(1)}static addElemType(t,e){t.addFieldOffset(0,e,0)}static endSequenceType(t){return t.endObject()}static createSequenceType(t,e){return r.startSequenceType(t),r.addElemType(t,e),r.endSequenceType(t)}}e.SequenceType=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){(t.fbs||(t.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,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(t,e,r,n){return t.prep(4,12),t.writeInt32(n),t.writeInt32(r),t.writeInt32(e),t.offset()}}}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNodeEdge(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNodeEdge(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}nodeIndex(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb_pos+t):0}inputEdges(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+n)+12*e,this.bb):null}inputEdgesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}outputEdges(e,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+n)+12*e,this.bb):null}outputEdgesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNodeEdge(t){t.startObject(3)}static addNodeIndex(t,e){t.addFieldInt32(0,e,0)}static addInputEdges(t,e){t.addFieldOffset(1,e,0)}static startInputEdgesVector(t,e){t.startVector(12,e,4)}static addOutputEdges(t,e){t.addFieldOffset(2,e,0)}static startOutputEdgesVector(t,e){t.startVector(12,e,4)}static endNodeEdge(t){return t.endObject()}static createNodeEdge(t,e,n,i){return r.startNodeEdge(t),r.addNodeIndex(t,e),r.addInputEdges(t,n),r.addOutputEdges(t,i),r.endNodeEdge(t)}}e.NodeEdge=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNode(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNode(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}sinceVersion(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0}index(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint32(this.bb_pos+t):0}opType(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.NodeType.Primitive}executionProviderType(t){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null}inputs(t,e){let r=this.bb.__offset(this.bb_pos,20);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}attributes(e,r){let n=this.bb.__offset(this.bb_pos,24);return n?(r||new t.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}attributesLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCounts(t){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}inputArgCountsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCountsArray(){let t=this.bb.__offset(this.bb_pos,26);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}implicitInputs(t,e){let r=this.bb.__offset(this.bb_pos,28);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}implicitInputsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNode(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDomain(t,e){t.addFieldOffset(2,e,0)}static addSinceVersion(t,e){t.addFieldInt32(3,e,0)}static addIndex(t,e){t.addFieldInt32(4,e,0)}static addOpType(t,e){t.addFieldOffset(5,e,0)}static addType(e,r){e.addFieldInt32(6,r,t.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(t,e){t.addFieldOffset(7,e,0)}static addInputs(t,e){t.addFieldOffset(8,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(9,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addAttributes(t,e){t.addFieldOffset(10,e,0)}static createAttributesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startAttributesVector(t,e){t.startVector(4,e,4)}static addInputArgCounts(t,e){t.addFieldOffset(11,e,0)}static createInputArgCountsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startInputArgCountsVector(t,e){t.startVector(4,e,4)}static addImplicitInputs(t,e){t.addFieldOffset(12,e,0)}static createImplicitInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startImplicitInputsVector(t,e){t.startVector(4,e,4)}static endNode(t){return t.endObject()}static createNode(t,e,n,i,o,a,s,u,l,c,p,f,d,h){return r.startNode(t),r.addName(t,e),r.addDocString(t,n),r.addDomain(t,i),r.addSinceVersion(t,o),r.addIndex(t,a),r.addOpType(t,s),r.addType(t,u),r.addExecutionProviderType(t,l),r.addInputs(t,c),r.addOutputs(t,p),r.addAttributes(t,f),r.addInputArgCounts(t,d),r.addImplicitInputs(t,h),r.endNode(t)}}e.Node=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsValueInfo(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsValueInfo(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startValueInfo(t){t.startObject(3)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(t,e){t.addFieldOffset(2,e,0)}static endValueInfo(t){return t.endObject()}static createValueInfo(t,e,n,i){return r.startValueInfo(t),r.addName(t,e),r.addDocString(t,n),r.addType(t,i),r.endValueInfo(t)}}e.ValueInfo=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTypeInfo(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTypeInfo(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}denotation(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}valueType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):t.experimental.fbs.TypeInfoValue.NONE}value(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}static startTypeInfo(t){t.startObject(3)}static addDenotation(t,e){t.addFieldOffset(0,e,0)}static addValueType(e,r){e.addFieldInt8(1,r,t.experimental.fbs.TypeInfoValue.NONE)}static addValue(t,e){t.addFieldOffset(2,e,0)}static endTypeInfo(t){return t.endObject()}static createTypeInfo(t,e,n,i){return r.startTypeInfo(t),r.addDenotation(t,e),r.addValueType(t,n),r.addValue(t,i),r.endTypeInfo(t)}}e.TypeInfo=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsOperatorSetId(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsOperatorSetId(t,r){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}domain(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}version(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}static startOperatorSetId(t){t.startObject(2)}static addDomain(t,e){t.addFieldOffset(0,e,0)}static addVersion(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static endOperatorSetId(t){return t.endObject()}static createOperatorSetId(t,r,n){return e.startOperatorSetId(t),e.addDomain(t,r),e.addVersion(t,n),e.endOperatorSetId(t)}}t.OperatorSetId=e}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensor(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensor(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}dataType(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}rawData(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}rawDataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}rawDataArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}stringData(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringDataLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}static startTensor(t){t.startObject(6)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static addDataType(e,r){e.addFieldInt32(3,r,t.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(t,e){t.addFieldOffset(4,e,0)}static createRawDataVector(t,e){t.startVector(1,e.length,1);for(let r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()}static startRawDataVector(t,e){t.startVector(1,e,1)}static addStringData(t,e){t.addFieldOffset(5,e,0)}static createStringDataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringDataVector(t,e){t.startVector(4,e,4)}static endTensor(t){return t.endObject()}static createTensor(t,e,n,i,o,a,s){return r.startTensor(t),r.addName(t,e),r.addDocString(t,n),r.addDims(t,i),r.addDataType(t,o),r.addRawData(t,a),r.addStringData(t,s),r.endTensor(t)}}e.Tensor=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSparseTensor(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSparseTensor(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}values(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}indices(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSparseTensor(t){t.startObject(3)}static addValues(t,e){t.addFieldOffset(0,e,0)}static addIndices(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static endSparseTensor(t){return t.endObject()}static createSparseTensor(t,e,n,i){return r.startSparseTensor(t),r.addValues(t,e),r.addIndices(t,n),r.addDims(t,i),r.endSparseTensor(t)}}e.SparseTensor=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsAttribute(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsAttribute(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.AttributeType.UNDEFINED}f(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0}i(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}s(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}t(e){let r=this.bb.__offset(this.bb_pos,16);return r?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}g(e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}floats(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0}floatsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}floatsArray(){let t=this.bb.__offset(this.bb_pos,20);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}ints(t){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}intsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}strings(t,e){let r=this.bb.__offset(this.bb_pos,24);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringsLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}tensors(e,r){let n=this.bb.__offset(this.bb_pos,26);return n?(r||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}tensorsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}graphs(e,r){let n=this.bb.__offset(this.bb_pos,28);return n?(r||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}graphsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startAttribute(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(e,r){e.addFieldInt32(2,r,t.experimental.fbs.AttributeType.UNDEFINED)}static addF(t,e){t.addFieldFloat32(3,e,0)}static addI(t,e){t.addFieldInt64(4,e,t.createLong(0,0))}static addS(t,e){t.addFieldOffset(5,e,0)}static addT(t,e){t.addFieldOffset(6,e,0)}static addG(t,e){t.addFieldOffset(7,e,0)}static addFloats(t,e){t.addFieldOffset(8,e,0)}static createFloatsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()}static startFloatsVector(t,e){t.startVector(4,e,4)}static addInts(t,e){t.addFieldOffset(9,e,0)}static createIntsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startIntsVector(t,e){t.startVector(8,e,8)}static addStrings(t,e){t.addFieldOffset(10,e,0)}static createStringsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringsVector(t,e){t.startVector(4,e,4)}static addTensors(t,e){t.addFieldOffset(11,e,0)}static createTensorsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startTensorsVector(t,e){t.startVector(4,e,4)}static addGraphs(t,e){t.addFieldOffset(12,e,0)}static createGraphsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startGraphsVector(t,e){t.startVector(4,e,4)}static endAttribute(t){return t.endObject()}static createAttribute(t,e,n,i,o,a,s,u,l,c,p,f,d,h){return r.startAttribute(t),r.addName(t,e),r.addDocString(t,n),r.addType(t,i),r.addF(t,o),r.addI(t,a),r.addS(t,s),r.addT(t,u),r.addG(t,l),r.addFloats(t,c),r.addInts(t,p),r.addStrings(t,f),r.addTensors(t,d),r.addGraphs(t,h),r.endAttribute(t)}}e.Attribute=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsGraph(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGraph(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}initializers(e,r){let n=this.bb.__offset(this.bb_pos,4);return n?(r||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}initializersLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeArgs(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}nodeArgsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}nodes(e,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new t.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}maxNodeIndex(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint32(this.bb_pos+t):0}nodeEdges(e,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new t.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}nodeEdgesLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}inputs(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,16);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}sparseInitializers(e,r){let n=this.bb.__offset(this.bb_pos,18);return n?(r||new t.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}sparseInitializersLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGraph(t){t.startObject(8)}static addInitializers(t,e){t.addFieldOffset(0,e,0)}static createInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInitializersVector(t,e){t.startVector(4,e,4)}static addNodeArgs(t,e){t.addFieldOffset(1,e,0)}static createNodeArgsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeArgsVector(t,e){t.startVector(4,e,4)}static addNodes(t,e){t.addFieldOffset(2,e,0)}static createNodesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodesVector(t,e){t.startVector(4,e,4)}static addMaxNodeIndex(t,e){t.addFieldInt32(3,e,0)}static addNodeEdges(t,e){t.addFieldOffset(4,e,0)}static createNodeEdgesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeEdgesVector(t,e){t.startVector(4,e,4)}static addInputs(t,e){t.addFieldOffset(5,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(6,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addSparseInitializers(t,e){t.addFieldOffset(7,e,0)}static createSparseInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSparseInitializersVector(t,e){t.startVector(4,e,4)}static endGraph(t){return t.endObject()}static createGraph(t,e,n,i,o,a,s,u,l){return r.startGraph(t),r.addInitializers(t,e),r.addNodeArgs(t,n),r.addNodes(t,i),r.addMaxNodeIndex(t,o),r.addNodeEdges(t,a),r.addInputs(t,s),r.addOutputs(t,u),r.addSparseInitializers(t,l),r.endGraph(t)}}e.Graph=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsModel(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsModel(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}irVersion(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}opsetImport(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}opsetImportLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}producerName(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}producerVersion(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}modelVersion(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}docString(t){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__string(this.bb_pos+e,t):null}graph(e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}graphDocString(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__string(this.bb_pos+e,t):null}static startModel(t){t.startObject(9)}static addIrVersion(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addOpsetImport(t,e){t.addFieldOffset(1,e,0)}static createOpsetImportVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOpsetImportVector(t,e){t.startVector(4,e,4)}static addProducerName(t,e){t.addFieldOffset(2,e,0)}static addProducerVersion(t,e){t.addFieldOffset(3,e,0)}static addDomain(t,e){t.addFieldOffset(4,e,0)}static addModelVersion(t,e){t.addFieldInt64(5,e,t.createLong(0,0))}static addDocString(t,e){t.addFieldOffset(6,e,0)}static addGraph(t,e){t.addFieldOffset(7,e,0)}static addGraphDocString(t,e){t.addFieldOffset(8,e,0)}static endModel(t){return t.endObject()}static createModel(t,e,n,i,o,a,s,u,l,c){return r.startModel(t),r.addIrVersion(t,e),r.addOpsetImport(t,n),r.addProducerName(t,i),r.addProducerVersion(t,o),r.addDomain(t,a),r.addModelVersion(t,s),r.addDocString(t,u),r.addGraph(t,l),r.addGraphDocString(t,c),r.endModel(t)}}e.Model=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKernelCreateInfos(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKernelCreateInfos(t,r){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}nodeIndices(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}nodeIndicesLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeIndicesArray(){let t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}kernelDefHashes(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}kernelDefHashesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startKernelCreateInfos(t){t.startObject(2)}static addNodeIndices(t,e){t.addFieldOffset(0,e,0)}static createNodeIndicesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startNodeIndicesVector(t,e){t.startVector(4,e,4)}static addKernelDefHashes(t,e){t.addFieldOffset(1,e,0)}static createKernelDefHashesVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startKernelDefHashesVector(t,e){t.startVector(8,e,8)}static endKernelCreateInfos(t){return t.endObject()}static createKernelCreateInfos(t,r,n){return e.startKernelCreateInfos(t),e.addNodeIndices(t,r),e.addKernelDefHashes(t,n),e.endKernelCreateInfos(t)}}t.KernelCreateInfos=e}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSubGraphSessionState(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSubGraphSessionState(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}graphId(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}sessionState(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startSubGraphSessionState(t){t.startObject(2)}static addGraphId(t,e){t.addFieldOffset(0,e,0)}static addSessionState(t,e){t.addFieldOffset(1,e,0)}static endSubGraphSessionState(t){let e=t.endObject();return t.requiredField(e,4),e}static createSubGraphSessionState(t,e,n){return r.startSubGraphSessionState(t),r.addGraphId(t,e),r.addSessionState(t,n),r.endSubGraphSessionState(t)}}e.SubGraphSessionState=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSessionState(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSessionState(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}kernels(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}subGraphSessionStates(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}subGraphSessionStatesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSessionState(t){t.startObject(2)}static addKernels(t,e){t.addFieldOffset(0,e,0)}static addSubGraphSessionStates(t,e){t.addFieldOffset(1,e,0)}static createSubGraphSessionStatesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSubGraphSessionStatesVector(t,e){t.startVector(4,e,4)}static endSessionState(t){return t.endObject()}static createSessionState(t,e,n){return r.startSessionState(t),r.addKernels(t,e),r.addSubGraphSessionStates(t,n),r.endSessionState(t)}}e.SessionState=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInferenceSession(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInferenceSession(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static bufferHasIdentifier(t){return t.__has_identifier("ORTM")}ortVersion(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}model(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}sessionState(e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startInferenceSession(t){t.startObject(3)}static addOrtVersion(t,e){t.addFieldOffset(0,e,0)}static addModel(t,e){t.addFieldOffset(1,e,0)}static addSessionState(t,e){t.addFieldOffset(2,e,0)}static endInferenceSession(t){return t.endObject()}static finishInferenceSessionBuffer(t,e){t.finish(e,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(t,e){t.finish(e,"ORTM",!0)}static createInferenceSession(t,e,n,i){return r.startInferenceSession(t),r.addOrtVersion(t,e),r.addModel(t,n),r.addSessionState(t,i),r.endInferenceSession(t)}}e.InferenceSession=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={}))},7448:(t,e,r)=>{"use strict";
1675Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxjsSessionHandler=void 0;let n=r(1670),i=r(9162);e.OnnxjsSessionHandler=class{constructor(t){this.session=t,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(t,e,r){let o=new Map;for(let e in t)if(Object.hasOwnProperty.call(t,e)){let r=t[e];o.set(e,new i.Tensor(r.dims,r.type,void 0,void 0,r.data))}let a=await this.session.run(o),s={};return a.forEach((t,e)=>{s[e]=new n.Tensor(t.type,t.data,t.dims)}),s}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Session=void 0;let n=r(7067),i=r(1296),o=r(7091),a=r(1036),s=r(6231),u=r(2644);e.Session=class{constructor(t={}){this._initialized=!1,this.backendHint=t.backendHint,this.profiler=s.Profiler.create(t.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(t,e,r){await this.profiler.event("session","Session.loadModel",async()=>{let a=await (0,o.resolveBackend)(this.backendHint);if(this.sessionHandler=a.createSessionHandler(this.context),this._model=new u.Model,"string"==typeof t){let e=t.endsWith(".ort");if("undefined"==typeof fetch){let r=await (0,i.promisify)(n.readFile)(t);this.initialize(r,e)}else{let r=await fetch(t),n=await r.arrayBuffer();this.initialize(new Uint8Array(n),e)}}else if(ArrayBuffer.isView(t))this.initialize(t);else{let n=new Uint8Array(t,e||0,r||t.byteLength);this.initialize(n)}})}initialize(t,e){if(this._initialized)throw Error("already initialized");this.profiler.event("session","Session.initialize",()=>{let r=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(t,r,e),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new a.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(t){if(!this._initialized)throw Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{let e=this.normalizeAndValidateInputs(t),r=await this._executionPlan.execute(this.sessionHandler,e);return this.createOutput(r)})}normalizeAndValidateInputs(t){let e=this._model.graph.getInputNames();if(Array.isArray(t)){if(t.length!==e.length)throw Error(`incorrect input array length: expected ${e.length} but got ${t.length}`)}else{if(t.size!==e.length)throw Error(`incorrect input map size: expected ${e.length} but got ${t.size}`);let r=Array(t.size),n=0;for(let i=0;i<e.length;++i){let o=t.get(e[i]);if(!o)throw Error(`missing input tensor for: '${name}'`);r[n++]=o}t=r}if(this.context.graphInputTypes&&0!==this.context.graphInputTypes.length&&this.context.graphInputDims&&0!==this.context.graphInputDims.length)this.validateInputTensorDims(this.context.graphInputDims,t,!1);else{let e=this._model.graph.getInputIndices(),r=this._model.graph.getValues(),n=Array(e.length);for(let i=0;i<e.length;++i){let o=r[e[i]];n[i]=o.type.shape.dims,this.context.graphInputTypes.push(o.type.tensorType),this.context.graphInputDims.push(t[i].dims)}this.validateInputTensorDims(n,t,!0)}return this.validateInputTensorTypes(this.context.graphInputTypes,t),t}validateInputTensorTypes(t,e){for(let r=0;r<e.length;r++){let n=t[r],i=e[r].type;if(n!==i)throw Error(`input tensor[${r}] check failed: expected type '${n}' but got ${i}`)}}validateInputTensorDims(t,e,r){for(let n=0;n<e.length;n++){let i=t[n],o=e[n].dims;if(!this.compareTensorDims(i,o,r))throw Error(`input tensor[${n}] check failed: expected shape '[${i.join(",")}]' but got [${o.join(",")}]`)}}compareTensorDims(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n]&&(!r||0!==t[n]))return!1;return!0}createOutput(t){let e=this._model.graph.getOutputNames();if(t.length!==e.length)throw Error("expected number of outputs do not match number of generated outputs");let r=new Map;for(let n=0;n<e.length;++n)r.set(e[n],t[n]);return r}initializeOps(t){let e=t.getNodes();this._ops=Array(e.length);for(let r=0;r<e.length;r++)this._ops[r]=this.sessionHandler.resolve(e[r],this._model.opsets,t)}}},9162:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};
1675Object.defineProperty(e,"__esModule",{value:!0}),e.Tensor=void 0;let i=r(3442),o=n(r(3720)),a=r(1446),s=r(9395),u=r(2517);var l=s.onnxruntime.experimental.fbs;class c{get data(){if(void 0===this.cache){let t=this.dataProvider(this.dataId);if(t.length!==this.size)throw Error("Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.");this.cache=t}return this.cache}get stringData(){if("string"!==this.type)throw TypeError("data type is not string");return this.data}get integerData(){switch(this.type){case"uint8":case"int8":case"uint16":case"int16":case"int32":case"uint32":case"bool":return this.data;default:throw TypeError("data type is not integer (uint8, int8, uint16, int16, int32, uint32, bool)")}}get floatData(){switch(this.type){case"float32":case"float64":return this.data;default:throw TypeError("data type is not float (float32, float64)")}}get numberData(){if("string"!==this.type)return this.data;throw TypeError("type cannot be non-number (string)")}get(t){return this.data[u.ShapeUtil.indicesToOffset(t,this.strides)]}set(t,e){this.data[u.ShapeUtil.indicesToOffset(t,this.strides)]=e}async getData(){return void 0===this.cache&&(this.cache=await this.asyncDataProvider(this.dataId)),this.cache}get strides(){return this._strides||(this._strides=u.ShapeUtil.computeStrides(this.dims)),this._strides}constructor(t,e,r,n,o,a=i.Guid.create()){this.dims=t,this.type=e,this.dataProvider=r,this.asyncDataProvider=n,this.cache=o,this.dataId=a,this.size=u.ShapeUtil.validateDimsAndCalcSize(t);let s=this.size,l=void 0===r&&void 0===n&&void 0===o;if(void 0!==o&&o.length!==s)throw RangeError("Input dims doesn't match data length.");if("string"===e){if(!(void 0===o||Array.isArray(o)&&o.every(t=>"string"==typeof t)))throw TypeError("cache should be a string array");l&&(this.cache=Array(s))}else{if(void 0!==o){let t=f(e);
1675if(!(o instanceof t))throw TypeError(`cache should be type ${t.name}`)}if(l){let t=new ArrayBuffer(s*function(t){switch(t){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 ${t}`)}}(e));this.cache=function(t,e){return new(f(e))(t)}(t,e)}}}static fromProto(t){if(!t)throw Error("cannot construct Value from an empty tensor");let e=u.ProtoUtil.tensorDataTypeFromProto(t.dataType),r=new c(u.ProtoUtil.tensorDimsFromProto(t.dims),e);if("string"===e)t.stringData.forEach((t,e)=>{r.data[e]=(0,u.decodeUtf8String)(t)});else if(t.rawData&&"number"==typeof t.rawData.byteLength&&t.rawData.byteLength>0){let e=r.data,n=new DataView(t.rawData.buffer,t.rawData.byteOffset,t.rawData.byteLength),i=p(t.dataType),o=t.rawData.byteLength/i;if(t.rawData.byteLength%i!=0)throw Error("invalid buffer length");if(e.length!==o)throw Error("buffer length mismatch");for(let r=0;r<o;r++){let o=h(n,t.dataType,r*i);e[r]=o}}else{let e;switch(t.dataType){case a.onnx.TensorProto.DataType.FLOAT:e=t.floatData;break;case a.onnx.TensorProto.DataType.INT32:case a.onnx.TensorProto.DataType.INT16:case a.onnx.TensorProto.DataType.UINT16:case a.onnx.TensorProto.DataType.INT8:case a.onnx.TensorProto.DataType.UINT8:case a.onnx.TensorProto.DataType.BOOL:e=t.int32Data;break;case a.onnx.TensorProto.DataType.INT64:e=t.int64Data;break;case a.onnx.TensorProto.DataType.DOUBLE:e=t.doubleData;break;case a.onnx.TensorProto.DataType.UINT32:case a.onnx.TensorProto.DataType.UINT64:e=t.uint64Data;break;default:throw Error("unspecific error")}if(null==e)throw Error("failed to populate data from a tensorproto value");let n=r.data;if(n.length!==e.length)throw Error("array length mismatch");for(let r=0;r<e.length;r++){let i=e[r];o.default.isLong(i)?n[r]=d(i,t.dataType):n[r]=i}}return r}static fromData(t,e,r){return new c(e,r,void 0,void 0,t)}static fromOrtTensor(t){if(!t)throw Error("cannot construct Value from an empty tensor");let e=u.ProtoUtil.tensorDimsFromORTFormat(t),r=u.ProtoUtil.tensorDataTypeFromProto(t.dataType()),n=new c(e,r);if("string"===r)for(let e=0;e<t.stringDataLength();e++)n.data[e]=t.stringData(e);else if(t.rawDataArray()&&"number"==typeof t.rawDataLength()&&t.rawDataLength()>0){let e=n.data,r=new DataView(t.rawDataArray().buffer,t.rawDataArray().byteOffset,t.rawDataLength()),i=p(t.dataType()),o=t.rawDataLength()/i;if(t.rawDataLength()%i!=0)throw Error("invalid buffer length");if(e.length!==o)throw Error("buffer length mismatch");for(let n=0;n<o;n++){let o=h(r,t.dataType(),n*i);e[n]=o}}return n}}function p(t){switch(t){case a.onnx.TensorProto.DataType.UINT8:case a.onnx.TensorProto.DataType.INT8:case a.onnx.TensorProto.DataType.BOOL:return 1;case a.onnx.TensorProto.DataType.UINT16:case a.onnx.TensorProto.DataType.INT16:return 2;case a.onnx.TensorProto.DataType.FLOAT:case a.onnx.TensorProto.DataType.INT32:case a.onnx.TensorProto.DataType.UINT32:return 4;case a.onnx.TensorProto.DataType.INT64:case a.onnx.TensorProto.DataType.DOUBLE:case a.onnx.TensorProto.DataType.UINT64:return 8;default:throw Error(`cannot calculate sizeof() on type ${a.onnx.TensorProto.DataType[t]}`)}}function f(t){switch(t){case"bool":case"uint8":return Uint8Array;case"int8":return Int8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:throw Error("unspecified error")}}function d(t,e){if(e===a.onnx.TensorProto.DataType.INT64||e===l.TensorDataType.INT64){if(t.greaterThanOrEqual(2147483648)||t.lessThan(-2147483648))throw TypeError("int64 is not supported")}else{if(e!==a.onnx.TensorProto.DataType.UINT32&&e!==l.TensorDataType.UINT32&&e!==a.onnx.TensorProto.DataType.UINT64&&e!==l.TensorDataType.UINT64)throw TypeError(`not a LONG type: ${a.onnx.TensorProto.DataType[e]}`);if(t.greaterThanOrEqual(4294967296)||t.lessThan(0))throw TypeError("uint64 is not supported")}return t.toNumber()}function h(t,e,r){switch(e){case a.onnx.TensorProto.DataType.BOOL:case a.onnx.TensorProto.DataType.UINT8:return t.getUint8(r);case a.onnx.TensorProto.DataType.INT8:return t.getInt8(r);case a.onnx.TensorProto.DataType.UINT16:return t.getUint16(r,!0);case a.onnx.TensorProto.DataType.INT16:return t.getInt16(r,!0);case a.onnx.TensorProto.DataType.FLOAT:return t.getFloat32(r,!0);case a.onnx.TensorProto.DataType.INT32:return t.getInt32(r,!0);case a.onnx.TensorProto.DataType.UINT32:return t.getUint32(r,!0);case a.onnx.TensorProto.DataType.INT64:return d(o.default.fromBits(t.getUint32(r,!0),t.getUint32(r+4,!0),!1),e);case a.onnx.TensorProto.DataType.DOUBLE:return t.getFloat64(r,!0);case a.onnx.TensorProto.DataType.UINT64:return d(o.default.fromBits(t.getUint32(r,!0),t.getUint32(r+4,!0),!0),e);default:throw Error(`cannot read from DataView for type ${a.onnx.TensorProto.DataType[e]}`)}}e.Tensor=c},2517:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};
1675Object.defineProperty(e,"__esModule",{value:!0}),e.decodeUtf8String=e.MAX_CLIP=e.MIN_CLIP=e.PoolConvUtil=e.ReduceUtil=e.SplitUtil=e.MathUtil=e.ShapeUtil=e.LongUtil=e.ProtoUtil=e.GemmUtil=e.arrayCopyHelper=e.BroadcastUtil=e.MatMulUtil=e.ArrayUtil=e.assert=e.checkInputsShape=void 0;let i=r(5686),o=n(r(3720)),a=r(1446),s=r(9162);e.checkInputsShape=function(t,...e){if(!t||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].dims||t[r].dims.length!==e[r])return!1;return!0},e.assert=function(t,e){if(!t)throw Error("string"==typeof e?e:e())},e.ArrayUtil=class{static arraysEqual(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}};class u{static preprocessInputShapes(t,e){return[1===t.length?[1,t[0]]:t,1===e.length?[e[0],1]:e]}static postprocessOutputShape(t,e,r){1===e&&t.splice(t.length-2,1),1===r&&t.pop()}static calcMatMulShape(t,e){return t[1]!==e[0]?void 0:[t[0],e[1]]}}e.MatMulUtil=u;class l{static calcShape(t,e,r=!1){let n=t.length,i=e.length;if(0===n)return e;if(0===i)return t;let o=Math.max(t.length,e.length),a=Array(o);if(r){if(n<2||i<2)return;let r=u.calcMatMulShape([t[n-2],t[n-1]],[e[i-2],e[i-1]]);if(void 0===r)return;[a[o-2],a[o-1]]=r}for(let s=r?3:1;s<=o;s++){let r=n-s<0?1:t[n-s],u=i-s<0?1:e[i-s];if(r!==u&&r>1&&u>1)return;a[o-s]=Math.max(r,u)}return a}static index(t,e){let r=Array(e.length);return l.fillIndex(t,e,r),r}static fillIndex(t,e,r){let n=t.length-e.length;for(let i=0;i<e.length;i++)r[i]=t[n+i]%e[i]}static calc(t,e,r,n,i){let o=l.calcShape(t.dims,e.dims);if(o){if(n&&!f.areEqual(o,t.dims))return;let a=f.size(o),u=n?t:new s.Tensor(o,i||t.type);if(0===o.length)u.set([],r(t.get([]),e.get([])));else{let n=Array(o.length),i=Array(t.dims.length),s=Array(e.dims.length),c,p=0,f=0,d=!1,h=!1;0===t.dims.length&&(p=t.get([]),d=!0),0===e.dims.length&&(f=e.get([]),h=!0);for(let g=0;g<a;g++){c=g;for(let t=o.length-1;t>=0;t--)n[t]=c%o[t],c=Math.floor(c/o[t]);d||(l.fillIndex(n,t.dims,i),p=t.get(i)),h||(l.fillIndex(n,e.dims,s),f=e.get(s)),u.set(n,r(p,f))}}return u}}static isValidBroadcast(t,e){let r=t.length,n=e.length;if(r>n)return!1;for(let i=1;i<=r;i++)if(1!==t[r-i]&&t[r-i]!==e[n-i])return!1;return!0}static getBroadcastDims(t,e){let r=t.length,n=[];for(let i=0;i<r;i++){let o=r-1-i,a=t[o]||1;(e[e.length-1-i]||1)>1&&1===a&&n.unshift(o)}return n}}e.BroadcastUtil=l,e.arrayCopyHelper=function(t,e,r,n,i){if(n<0||n>=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let o=0;o<i;o++)t[r+o]=e[n+o]},e.GemmUtil=class{static getShapeOfGemmResult(t,e,r,n,i){let o,a,s;if(2!==t.length||2!==r.length)throw Error("shape need to be of size 2");e?(o=t[1],a=t[0]):(o=t[0],a=t[1]);let u=-1;if(n?(s=r[0],u=1):(s=r[1],u=0),r[u]!==a)throw Error("dimension mismatch");if(o<=0||s<=0||a<=0)throw Error("invalid shape specified");if(i&&!l.isValidBroadcast(i,[o,s]))throw Error("gemm: invalid bias shape for broadcast");return[o,s,a]}};class c{static tensorDataTypeFromProto(t){switch(t){case a.onnx.TensorProto.DataType.INT8:return"int8";case a.onnx.TensorProto.DataType.UINT8:return"uint8";case a.onnx.TensorProto.DataType.BOOL:return"bool";case a.onnx.TensorProto.DataType.INT16:return"int16";case a.onnx.TensorProto.DataType.UINT16:return"uint16";case a.onnx.TensorProto.DataType.INT32:return"int32";case a.onnx.TensorProto.DataType.UINT32:return"uint32";case a.onnx.TensorProto.DataType.FLOAT:return"float32";case a.onnx.TensorProto.DataType.DOUBLE:return"float64";case a.onnx.TensorProto.DataType.STRING:return"string";case a.onnx.TensorProto.DataType.INT64:return"int32";case a.onnx.TensorProto.DataType.UINT64:return"uint32";default:throw Error(`unsupported data type: ${a.onnx.TensorProto.DataType[t]}`)}}static tensorDataTypeStringToEnum(t){switch(t){case"int8":return a.onnx.TensorProto.DataType.INT8;case"uint8":return a.onnx.TensorProto.DataType.UINT8;case"bool":return a.onnx.TensorProto.DataType.BOOL;case"int16":return a.onnx.TensorProto.DataType.INT16;case"uint16":return a.onnx.TensorProto.DataType.UINT16;case"int32":return a.onnx.TensorProto.DataType.INT32;case"uint32":return a.onnx.TensorProto.DataType.UINT32;case"float32":return a.onnx.TensorProto.DataType.FLOAT;case"float64":return a.onnx.TensorProto.DataType.DOUBLE;case"string":return a.onnx.TensorProto.DataType.STRING;case"int64":return a.onnx.TensorProto.DataType.INT64;case"uint64":return a.onnx.TensorProto.DataType.UINT64;default:throw Error(`unsupported data type: ${t}`)}}static tensorDimsFromProto(t){return t.map(t=>o.default.isLong(t)?t.toNumber():t)}static tensorValueTypeFromProto(t){return{tensorType:c.tensorDataTypeFromProto(t.elemType),shape:{dims:c.tensorDimsFromProto(t.shape.dim.map(t=>t.dimValue))}}}static tensorDimsFromORTFormat(t){let e=[];for(let r=0;r<t.dimsLength();r++)e.push(p.longToNumber(t.dims(r)));return e}static tensorAttributesFromORTFormat(t){let e=[];for(let r=0;r<t.attributesLength();r++)e.push(t.attributes(r));return e}}e.ProtoUtil=c;class p{static longToNumber(t,e){return o.default.isLong(t)?t.toNumber():t instanceof i.flatbuffers.Long?o.default.fromValue({low:t.low,high:t.high,unsigned:null!=e&&e}).toNumber():t}static isLong(t){return o.default.isLong(t)||t instanceof i.flatbuffers.Long}}e.LongUtil=p;class f{static size(t){return f.getSizeFromDimensionRange(t,0,t.length)}static sizeFromDimension(t,e){if(e<0||e>t.length)throw Error(`invalid dimension of ${e} for sizeFromDimension as Tensor has ${t.length} dimensions.`);return f.getSizeFromDimensionRange(t,e,t.length)}static sizeToDimension(t,e){if(e<0||e>t.length)throw Error(`invalid dimension of ${e} for sizeToDimension as Tensor has ${t.length} dimensions.`);return f.getSizeFromDimensionRange(t,0,e)}static getSizeFromDimensionRange(t,e,r){let n=1;for(let i=e;i<r;i++){if(t[i]<=0)throw Error("cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.");n*=t[i]}return n}static computeStrides(t){let e=t.length;if(0===e)return[];if(1===e)return[1];let r=Array(e);r[e-1]=1,r[e-2]=t[e-1];for(let n=e-3;n>=0;--n)r[n]=r[n+1]*t[n+1];return r}static transpose(t){return t.slice().reverse()}static indicesToOffset(t,e,r){void 0===r&&(r=t.length);let n=0;for(let i=0;i<r;++i)n+=e[i]*t[i];return n}static offsetToIndices(t,e){let r=e.length;if(0===r)return[];if(1===r)return[t*e[0]];let n=Array(e.length);for(let r=0;r<n.length-1;++r)n[r]=Math.floor(t/e[r]),t-=n[r]*e[r];return n[n.length-1]=t,n}static normalizeAxis(t,e){if(t<-e&&t>=e)throw Error("unsupported axis for this operation.");return t<0?t+e:t}static normalizeAxes(t,e){return t.map(t=>this.normalizeAxis(t,e))}static incrementIndex(t,e,r){if(0===e.length||0===t.length)throw Error("Index incrementing unsupported for scalar Tensor");if(void 0===r)r=e.length;else if(r<=0||r>e.length)throw Error("Incorrect axis to increment on");for(let n=r-1;n>=0&&(t[n]++,!(t[n]<e[n]));--n)t[n]=0}static calculateReshapedDims(t,e){if(0===e.length){if(0===t.length||1===f.size(t))return[];throw Error("cannot reshape to a scalar Tensor")}let r=e.length,n=Array(r),i=-1,o=1;for(let a=0;a<r;a++){if(e[a]<-1)throw Error("a dimension in shape hints cannot be less than -1");if(-1===e[a]){if(-1!==i)throw Error("at most one dimension in shape hints can be -1");i=a}else{if(0===e[a]){if(a>=t.length)throw Error("the dimension with value zero exceeds the dimension size of the input tensor");n[a]=t[a]}else n[a]=e[a];o*=n[a]}}let a=f.size(t);if(-1!==i){if(a%o!=0)throw Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${t}] Output shape: [${e}]`);n[i]=a/o}else if(o!==a)throw Error("reshapedDims and originalDims don't have matching sizes");return n}static sortBasedOnPerm(t,e){return e?e.map(e=>t[e]):t.slice().reverse()}static padShape(t,e){let r=t.length;return t.map((t,n)=>t+e[n]+e[n+r])}static areEqual(t,e){return t.length===e.length&&t.every((t,r)=>t===e[r])}static validateDimsAndCalcSize(t){if(t.length>6)throw TypeError("Only rank 0 to 6 is supported for tensor shape.");let e=1;for(let r of t){if(!Number.isInteger(r))throw TypeError(`Invalid shape: ${r} is not an integer`);if(r<0||r>2147483647)throw TypeError(`Invalid shape: length ${r} is not allowed`);e*=r}return e}
1675static flattenShape(t,e){e<0&&(e+=t.length);let r=t.reduce((t,e)=>t*e,1),n=t.slice(e).reduce((t,e)=>t*e,1);return[r/n,n]}static squeezeShape(t,e){let r=[];e=f.normalizeAxes(e,t.length);for(let n=0;n<t.length;n++){let i=e.indexOf(n)>=0;if(i&&1!==t[n])throw Error("squeeze an axis of size different than 1");(0===e.length&&t[n]>1||e.length>0&&!i)&&r.push(t[n])}return r}static unsqueezeShape(t,e){let r=Array(t.length+e.length);r.fill(0);for(let t=0;t<e.length;t++){let n=f.normalizeAxis(e[t],r.length);if(n>=r.length)throw Error("'axes' has an out of range axis");if(0!==r[n])throw Error("'axes' has a duplicate axis");r[n]=1}let n=0;for(let e=0;e<r.length;e++)0===r[e]&&(r[e]=t[n++]);if(n!==t.length)throw Error("the unsqueezed dimension could not be established");return r}}e.ShapeUtil=f,e.MathUtil=class{static sqr(t,e,r,n,i){if(n<0||n>=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let o=0;o<i;o++)t[r+o]+=Math.pow(e[n+o],2)}static axpy(t,e,r,n,i,o){if(n<0||n>=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let a=0;a<i;a++)t[r+a]+=o*e[n+a]}static powx(t,e,r,n,i,o){if(n<0||n>=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let a=0;a<i;a++)t[r+a]=Math.pow(e[n+a],o)}static mul(t,e,r,n,i){if(n<0||n>=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let o=0;o<i;o++)t[r+o]=e[n+o]*t[r+o]}};class d{static splitShape(t,e,r,n){if(0===r.length){if(!n)throw Error("need to know number of outputs when the 'split' attribute is not specified");d.determineSplit(t[e],n,r)}let i=[],o=[0];for(let n=0;n<r.length;++n){0!==n&&o.push(o[n-1]+r[n-1]);let a=t.slice();a[e]=r[n],i.push(a)}return[i,o]}static determineSplit(t,e,r){if(t%e!=0)throw Error("cannot split tensor to equal sized parts");for(let n=0;n<e;++n)r.push(t/e)}}e.SplitUtil=d;class h{static calcReduce(t,e,r,n,i){let o=t.dims.slice(0);0===e.length&&o.forEach((t,r)=>e.push(r));let a=h.calcReduceShape(o,e,!0),u=f.size(a),c=new s.Tensor(a,t.type),p=f.computeStrides(a),d=f.computeStrides(o),g=Array(o.length);for(let r=0;r<u;r++){let a=f.offsetToIndices(r,p);l.fillIndex(a,o,g),c.set(a,h.calcReduceByAxis(t.numberData,e,o,0,f.indicesToOffset(g,d),n,i))}return r?c:new s.Tensor(h.calcReduceShape(o,e,r),c.type,void 0,void 0,c.data,c.dataId)}static calcReduceByAxis(t,e,r,n,i,o,a){let s=0;if(n>=e.length)return o(t[i]);let u=e[n],l=u>=r.length?1:f.size(r.slice(u+1));for(let c=0;c<r[u];c++)s=0===c?h.calcReduceByAxis(t,e,r,n+1,i,o,a):a(s,h.calcReduceByAxis(t,e,r,n+1,i,o,a)),i+=l;return s}static calcReduceShape(t,e,r){let n=t.slice();for(let t=0;t<e.length;t++)n[e[t]]=r?1:0;return n.filter(t=>0!==t)}}e.ReduceUtil=h;class g{static adjustPoolAttributes(t,e,r,n,i,o){if(!t&&r.length!==e.length-2)throw Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(t)for(let t=0;t<e.length-2;t++)t>=r.length?r.push(e[t+2]):r[t]=e[t+2];for(let t=0;t<r.length;t++)if(t<n.length){if(n[t]<0)throw Error("strides should be greater than or equal to 1")}else n.push(1);for(let t=0;t<r.length;t++)if(t<i.length){if(i[t]<0)throw Error("dilations should be greater than or equal to 1")}else i.push(1);for(let t=0;t<2*r.length;t++)if(t<o.length){if(o[t]<0)throw Error("pad should be greater than or equal to 1")}else o.push(0);for(let t=0;t<r.length;t++){if(r[t]<=0)throw Error("kernel shapes need to be greater than 0");if(o[t]>=r[t]||o[t+r.length]>=r[t])throw Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(t,e,r,n,i,o){if(o){if(i.length!==2*(t.length-2))throw Error("length of pads should be twice the length of data dimensions");
1675if(e.length!==t.length-2)throw Error("length of strides should be the length of data dimensions");if(n.length!==t.length-2)throw Error("length of kernel shapes should be the length of data dimensions");for(let a=0;a<t.length-2;a++)g.adjustPadAndReturnShape(t[a+2],e[a],r[a],n[a],i,a,a+t.length-2,o)}}static computePoolOutputShape(t,e,r,n,i,o,a){if(e.length<=0)throw Error("input shape must be of size greater than 0");let s=[e[0],e[1]];return g.computeShapeHelper(t,e,s,r,n,i,o,a),s}static computeConvOutputShape(t,e,r,n,i,o,a){if(t.length<=0||e.length<=0)throw Error("invalid input tensor dims or invalid filter tensor dims");let s=[t[0],e[0]];return g.computeShapeHelper(!1,t,s,r,n,i,o,a),s}static computeShapeHelper(t,e,r,n,i,o,a,s){if(t)for(let t=0;t<e.length-2;t++)r.push(1);else for(let t=0;t<e.length-2;t++)r.push(g.adjustPadAndReturnShape(e[t+2],n[t],i[t],o[t],a,t,t+e.length-2,s))}static adjustPadAndReturnShape(t,e,r,n,i,o,a,s){let u=r*(n-1)+1;if(!s||"NOTSET"===s)return Math.floor((t+i[o]+i[a]-u)/e+1);switch(s){case"VALID":return i[o]=0,i[a]=0,Math.floor((t-u)/e+1);case"SAME_LOWER":case"SAME_UPPER":if(1!==r)throw Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{let r=((t+e-1)/e-1)*e+n-t;return i[o]="SAME_LOWER"===s?Math.floor((r+1)/2):Math.floor(r/2),i[a]=r-i[o],Math.floor((t+r-n)/e+1)}default:throw Error("Unsupported AutoPad type")}}}e.PoolConvUtil=g,e.MIN_CLIP=-34028234663852886e22,e.MAX_CLIP=34028234663852886e22,e.decodeUtf8String=function(t){return(new TextDecoder).decode(t)}},7967:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,r,n,i)=>{if("object"==typeof t&&null!==t){if(n.has(t))throw Error("Circular reference in options");n.add(t)}Object.entries(t).forEach(([t,o])=>{let a=r?r+t:t;if("object"==typeof o)(0,e.iterateExtraOptions)(o,a+".",n,i);else if("string"==typeof o||"number"==typeof o)i(a,o.toString());else{if("boolean"!=typeof o)throw Error("Can't handle extra config type: "+typeof o);i(a,o?"1":"0")}})}},2157:function(t,e,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=e.initWasm=void 0;let s=r(1670),u=a(r(349)),l=r(6361),c=()=>!!s.env.wasm.proxy&&"undefined"!=typeof document,p,f,d,h=!1,g=!1,b=!1,m=[],y=[],_=[],v=[],x=[],w=[],T=()=>{if(h||!g||b||!p)throw Error("worker not ready")},S=t=>{switch(t.data.type){case"init-wasm":h=!1,t.data.err?(b=!0,f[1](t.data.err)):(g=!0,f[0]());break;case"init-ort":t.data.err?d[1](t.data.err):d[0]();break;case"create_allocate":t.data.err?m.shift()[1](t.data.err):m.shift()[0](t.data.out);break;case"create_finalize":t.data.err?y.shift()[1](t.data.err):y.shift()[0](t.data.out);break;case"create":t.data.err?_.shift()[1](t.data.err):_.shift()[0](t.data.out);break;case"release":t.data.err?v.shift()[1](t.data.err):v.shift()[0]();break;case"run":t.data.err?x.shift()[1](t.data.err):x.shift()[0](t.data.out);break;case"end-profiling":t.data.err?w.shift()[1](t.data.err):w.shift()[0]()}},O="undefined"!=typeof document?null===(n=null==document?void 0:document.currentScript)||void 0===n?void 0:n.src:void 0;e.initWasm=async()=>{if(c()){if(g)return;if(h)throw Error("multiple calls to 'initWasm()' detected.");if(b)throw Error("previous call to 'initWasm()' failed.");return h=!0,void 0===s.env.wasm.wasmPaths&&O&&0!==O.indexOf("blob:")&&(s.env.wasm.wasmPaths=O.substr(0,+O.lastIndexOf("/")+1)),new Promise((t,e)=>{null==p||p.terminate(),(p=r(9710).Z()).onmessage=S,f=[t,e];let n={type:"init-wasm",in:s.env.wasm};p.postMessage(n)})}return(0,l.initializeWebAssembly)(s.env.wasm)},e.initOrt=async(t,e)=>{if(c())return T(),new Promise((r,n)=>{d=[r,n];let i={type:"init-ort",in:{numThreads:t,loggingLevel:e}};p.postMessage(i)});u.initOrt(t,e)},e.createSessionAllocate=async t=>c()?(T(),new Promise((e,r)=>{m.push([e,r]);let n={type:"create_allocate",in:{model:t}};p.postMessage(n,[t.buffer])})):u.createSessionAllocate(t),e.createSessionFinalize=async(t,e)=>c()?(T(),new Promise((r,n)=>{y.push([r,n]);let i={type:"create_finalize",in:{modeldata:t,options:e}};p.postMessage(i)})):u.createSessionFinalize(t,e),e.createSession=async(t,e)=>c()?(T(),new Promise((r,n)=>{_.push([r,n]);let i={type:"create",in:{model:t,options:e}};p.postMessage(i,[t.buffer])})):u.createSession(t,e),e.releaseSession=async t=>{if(c())return T(),new Promise((e,r)=>{v.push([e,r]);let n={type:"release",in:t};p.postMessage(n)});u.releaseSession(t)},e.run=async(t,e,r,n,i)=>c()?(T(),new Promise((o,a)=>{x.push([o,a]);
1675let s={type:"run",in:{sessionId:t,inputIndices:e,inputs:r,outputIndices:n,options:i}};p.postMessage(s,u.extractTransferableBuffers(r))})):u.run(t,e,r,n,i),e.endProfiling=async t=>{if(c())return T(),new Promise((e,r)=>{w.push([e,r]);let n={type:"end-profiling",in:t};p.postMessage(n)});u.endProfiling(t)}},586:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;let n=r(7967),i=r(4983),o=r(6361);e.setRunOptions=t=>{let e=(0,o.getInstance)(),r=0,a=[],s=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(s.terminate=!1);let o=0;if(void 0!==(null==t?void 0:t.tag)&&(o=(0,i.allocWasmString)(t.tag,a)),r=e._OrtCreateRunOptions(s.logSeverityLevel,s.logVerbosityLevel,!!s.terminate,o),0===r)throw Error("Can't create run options");return void 0!==(null==t?void 0:t.extra)&&(0,n.iterateExtraOptions)(t.extra,"",new WeakSet,(t,n)=>{let o=(0,i.allocWasmString)(t,a),s=(0,i.allocWasmString)(n,a);if(0!==e._OrtAddRunConfigEntry(r,o,s))throw Error(`Can't set a run config entry: ${t} - ${n}`)}),[r,a]}catch(t){throw 0!==r&&e._OrtReleaseRunOptions(r),a.forEach(e._free),t}}},2306:(t,e,r)=>{"use strict";let n;Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxruntimeWebAssemblySessionHandler=void 0;let i=r(2806),o=r(1670),a=r(2850),s=r(2157);e.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(t){let e=await fetch(t),r=await e.arrayBuffer();return(0,s.createSessionAllocate)(new Uint8Array(r))}async loadModel(t,e){if(n||(await (0,s.initOrt)(o.env.wasm.numThreads,(t=>{switch(t){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: ${t}`)}})(o.env.logLevel)),n=!0),"string"==typeof t){if("undefined"==typeof fetch){let r=await (0,a.promisify)(i.readFile)(t);[this.sessionId,this.inputNames,this.outputNames]=await (0,s.createSession)(r,e)}else{let r=await this.createSessionAllocate(t);[this.sessionId,this.inputNames,this.outputNames]=await (0,s.createSessionFinalize)(r,e)}}else[this.sessionId,this.inputNames,this.outputNames]=await (0,s.createSession)(t,e)}async dispose(){return(0,s.releaseSession)(this.sessionId)}async run(t,e,r){let n=[],i=[];Object.entries(t).forEach(t=>{let e=t[0],r=t[1],o=this.inputNames.indexOf(e);if(-1===o)throw Error(`invalid input '${e}'`);n.push(r),i.push(o)});let a=[];Object.entries(e).forEach(t=>{let e=t[0],r=this.outputNames.indexOf(e);if(-1===r)throw Error(`invalid output '${e}'`);a.push(r)});let u=await (0,s.run)(this.sessionId,i,n.map(t=>[t.type,t.dims,t.data]),a,r),l={};for(let t=0;t<u.length;t++)l[this.outputNames[a[t]]]=new o.Tensor(u[t][0],u[t][2],u[t][1]);return l}startProfiling(){}endProfiling(){(0,s.endProfiling)(this.sessionId)}}},4919:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;let n=r(7967),i=r(4983),o=r(6361);e.setSessionOptions=t=>{let e=(0,o.getInstance)(),r=0,a=[],s=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});let e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(s);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(s.graphOptimizationLevel="all");let u=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw Error(`unsupported graph optimization level: ${t}`)}})(s.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(s.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(s.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(s.executionMode="sequential");let l=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw Error(`unsupported execution mode: ${t}`)}})(s.executionMode),c=0;if(void 0!==(null==t?void 0:t.logId)&&(c=(0,i.allocWasmString)(t.logId,a)),void 0===(null==t?void 0:t.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>
16754)throw Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(s.enableProfiling=!1),r=e._OrtCreateSessionOptions(u,!!s.enableCpuMemArena,!!s.enableMemPattern,l,!!s.enableProfiling,0,c,s.logSeverityLevel,s.logVerbosityLevel),0===r)throw Error("Can't create session options");return(null==t?void 0:t.executionProviders)&&((t,e,r)=>{for(let n of e){let e="string"==typeof n?n:n.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw Error(`not supported EP: ${e}`)}let a=(0,i.allocWasmString)(e,r);if(0!==(0,o.getInstance)()._OrtAppendExecutionProvider(t,a))throw Error(`Can't append execution provider: ${e}`)}})(r,t.executionProviders,a),void 0!==(null==t?void 0:t.extra)&&(0,n.iterateExtraOptions)(t.extra,"",new WeakSet,(t,n)=>{let o=(0,i.allocWasmString)(t,a),s=(0,i.allocWasmString)(n,a);if(0!==e._OrtAddSessionConfigEntry(r,o,s))throw Error(`Can't set a session config entry: ${t} - ${n}`)}),[r,a]}catch(t){throw 0!==r&&e._OrtReleaseSessionOptions(r),a.forEach(e._free),t}}},4983:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;let n=r(6361);e.allocWasmString=(t,e)=>{let r=(0,n.getInstance)(),i=r.lengthBytesUTF8(t)+1,o=r._malloc(i);return r.stringToUTF8(t,o,i),e.push(o),o}},349:(t,e,r)=>{"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;let n=r(586),i=r(4919),o=r(4983),a=r(6361);e.initOrt=(t,e)=>{let r=(0,a.getInstance)()._OrtInit(t,e);if(0!==r)throw Error(`Can't initialize onnxruntime. error code = ${r}`)};let s=new Map;e.createSessionAllocate=t=>{let e=(0,a.getInstance)(),r=e._malloc(t.byteLength);return e.HEAPU8.set(t,r),[r,t.byteLength]},e.createSessionFinalize=(t,e)=>{let r=(0,a.getInstance)(),n=0,o=0,u=[];try{if([o,u]=(0,i.setSessionOptions)(e),n=r._OrtCreateSession(t[0],t[1],o),0===n)throw Error("Can't create a session")}finally{r._free(t[0]),r._OrtReleaseSessionOptions(o),u.forEach(r._free)}let l=r._OrtGetInputCount(n),c=r._OrtGetOutputCount(n),p=[],f=[],d=[],h=[];for(let t=0;t<l;t++){let e=r._OrtGetInputName(n,t);if(0===e)throw Error("Can't get an input name");f.push(e),p.push(r.UTF8ToString(e))}for(let t=0;t<c;t++){let e=r._OrtGetOutputName(n,t);if(0===e)throw Error("Can't get an output name");h.push(e),d.push(r.UTF8ToString(e))}return s.set(n,[n,f,h]),[n,p,d]},e.createSession=(t,r)=>{let n=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(n,r)},e.releaseSession=t=>{let e=(0,a.getInstance)(),r=s.get(t);if(!r)throw Error("invalid session id");let n=r[0],i=r[1],o=r[2];i.forEach(e._OrtFree),o.forEach(e._OrtFree),e._OrtReleaseSession(n),s.delete(t)};let u=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 Error(`unsupported data type: ${t}`)}},l=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 Error(`unsupported data type: ${t}`)}},c=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 Error(`unsupported type: ${t}`)}};e.run=(t,e,r,i,p)=>{let f=(0,a.getInstance)(),d=s.get(t);if(!d)throw Error("invalid session id");let h=d[0],g=d[1],b=d[2],m=e.length,y=i.length,_=0,v=[],x=[],w=[];try{[_,v]=(0,n.setRunOptions)(p);for(let t=0;t<m;t++){let e,n;let i=r[t][0],a=r[t][1],s=r[t][2];if(Array.isArray(s)){n=4*s.length,e=f._malloc(n),w.push(e);let t=e/4;for(let e=0;e<s.length;e++){if("string"!=typeof s[e])throw TypeError(`tensor data at index ${e} is not a string`);f.HEAPU32[t++]=(0,o.allocWasmString)(s[e],w)}}else n=s.byteLength,e=f._malloc(n),w.push(e),f.HEAPU8.set(new Uint8Array(s.buffer,s.byteOffset,n),e);let l=f.stackSave(),c=f.stackAlloc(4*a.length);try{let t=c/4;
1675a.forEach(e=>f.HEAP32[t++]=e);let r=f._OrtCreateTensor(u(i),e,n,c,a.length);if(0===r)throw Error("Can't create a tensor");x.push(r)}finally{f.stackRestore(l)}}let t=f.stackSave(),a=f.stackAlloc(4*m),s=f.stackAlloc(4*m),d=f.stackAlloc(4*y),T=f.stackAlloc(4*y);try{let t=a/4,r=s/4,n=d/4,o=T/4;for(let n=0;n<m;n++)f.HEAPU32[t++]=x[n],f.HEAPU32[r++]=g[e[n]];for(let t=0;t<y;t++)f.HEAPU32[n++]=0,f.HEAPU32[o++]=b[i[t]];let u=f._OrtRun(h,s,a,m,T,y,d,_),p=[];if(0===u)for(let t=0;t<y;t++){let e=f.HEAPU32[d/4+t],r=f.stackSave(),n=f.stackAlloc(16),i,o=0;try{if(u=f._OrtGetTensorData(e,n,n+4,n+8,n+12),0!==u)throw Error(`Can't access output tensor data. error code = ${u}`);let t=n/4,r=f.HEAPU32[t++];o=f.HEAPU32[t++];let a=f.HEAPU32[t++],s=f.HEAPU32[t++],d=[];for(let t=0;t<s;t++)d.push(f.HEAPU32[a/4+t]);f._OrtFree(a);let h=0===d.length?1:d.reduce((t,e)=>t*e);if(i=l(r),"string"===i){let t=[],e=o/4;for(let r=0;r<h;r++){let n=f.HEAPU32[e++],i=r===h-1?void 0:f.HEAPU32[e]-n;t.push(f.UTF8ToString(n,i))}p.push([i,d,t])}else{let t=new(c(i))(h);new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(f.HEAPU8.subarray(o,o+t.byteLength)),p.push([i,d,t])}}finally{f.stackRestore(r),"string"===i&&o&&f._free(o),f._OrtReleaseTensor(e)}}if(0===u)return p;throw Error(`failed to call OrtRun(). error code = ${u}.`)}finally{f.stackRestore(t)}}finally{x.forEach(f._OrtReleaseTensor),w.forEach(f._free),f._OrtReleaseRunOptions(_),v.forEach(f._free)}},e.endProfiling=t=>{let e=(0,a.getInstance)(),r=s.get(t);if(!r)throw Error("invalid session id");let n=r[0],i=e._OrtEndProfiling(n);if(0===i)throw Error("Can't get an profile file name");e._OrtFree(i)},e.extractTransferableBuffers=t=>{let e=[];for(let r of t){let t=r[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},6361:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},a=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;let s=o(r(6449)),u=a(r(932)),l=r(3474),c,p=!1,f=!1,d=!1,h=(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(p)return Promise.resolve();if(f)throw Error("multiple calls to 'initializeWebAssembly()' detected.");if(d)throw Error("previous call to 'initializeWebAssembly()' failed.");f=!0;let e=t.initTimeout,n=t.numThreads,i=t.simd,o=n>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}})(),a=i&&(()=>{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}})(),g="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=h(!1,o),m=h(a,o),y="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0,_=!1,v=[];if(e>0&&v.push(new Promise(t=>{setTimeout(()=>{_=!0,t()},e)})),v.push(new Promise((t,e)=>{let n=o?l:u.default,i={locateFile:(t,e)=>o&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([r(4154)],{type:"text/javascript"})):t===b?null!=y?y:(null!=g?g:e)+m:e+t};if(o){if("undefined"==typeof Blob)i.mainScriptUrlOrBlob=s.join("/","ort-wasm-threaded.js");else{let t=`var ortWasmThreaded=(function(){var _scriptDir;return ${n.toString()}})();`;i.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}}n(i).then(e=>{f=!1,p=!0,c=e,t()},t=>{f=!1,d=!0,e(t)})})),await Promise.race(v),_)throw Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(p&&c)return c;throw Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!p||f||d||(f=!0,null===(t=c.PThread)||void 0===t||t.terminateAllThreads(),c=void 0,f=!1,p=!1,d=!0)}},9710:(t,e,r)=>{"use strict";r.d(e,{Z:()=>o});var n=r(477),i=r.n(n
vendor: 74,147 bytes, line 1675
1675);function o(){return i()('/*!\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<process.argv.length&&(m=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof ct))throw t})),process.on("unhandledRejection",(function(t){throw t})),g=(t,e)=>{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<n-e&&t.buffer&&L)return L.decode(t.buffer instanceof SharedArrayBuffer?t.slice(e,n):t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(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<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=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<t.length;++n){var r=t.charCodeAt(n);127>=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<t.length;)t.shift()(u)}function yt(t){var e=Ee();return t=t(),Me(e),t}function bt(t){if(O)return $t(2,0,t);try{pt(t)}catch(t){t instanceof ct||"unwind"==t||g(1,t)}}u.PThread=ht,u.establishStackSpace=function(){var t=he(),e=a()[t+44>>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<o?(i()[n>>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<n;u++){var c=r[2+u];o()[i+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<a.length;++u)e()[o++>>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<n;u++){var c=i()[e>>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l<s;l++)ae(t,r()[c+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.length<e;)t=n[0]+t;return t}function u(t,e){return o(t,e,"0")}function c(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function s(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function l(t){var e=t.Wb;for(t=new Date(new Date(t.Xb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(ue(t.getFullYear())?ce:se)[n];if(!(e>r-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:12<t&&(t-=12),u(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.ec-1;e+=(ue(t.Xb+1900)?ce:se)[n++]);return u(t.jc+e,3)},"%m":function(t){return u(t.ec+1,2)},"%M":function(t){return u(t.Kc,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.dc&&12>t.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;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},l: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;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},h: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;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},t:Tt,M:function(){var t=_t.pop();t||at("no exception to throw");var e=t.Zb;throw t.kc()||(_t.push(t),t.ic(!0),t.hc(!1),Ot++),At=e,e},c:function(t,e,n){throw new St(t).fc(e,n),At=t,Ot++,t},pa:function(){return Ot},Fa:function(t){ge(t,!w,1,!v),ht.pc()},T:function(t){O?postMessage({cmd:"cleanupThread",thread:t}):st(t)},xa:Mt,j:function(t){throw At||(At=t),t},H:Ct,Ma:xt,ua:Rt,wa:jt,oa:kt,Ka:Dt,Ca:Pt,Ja:Ut,V:Ft,va:It,sa:Wt,La:Ht,ta:Lt,Ta:function(){},X:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ua:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},W:function(){return Date.now()},ya:function(){return 2097152},Oa:function(){return!0},za:function(t,e,n,r){if(t==e)setTimeout((()=>zt(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<n!=(c==r)&&(o=Math.max(u,o),e.setTime(e.getTime()+6e4*((0<n?c:o)-r))),a()[t+24>>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<e;r++)Xt[r]=o()[n+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<t)return!1;for(var n=1;4>=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<a;i++)e()[r+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<et))if(O)c(u),O||dt(X),postMessage({cmd:"loaded"});else{if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)K();dt(q),0<et||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),t()}),1)):t())}}if(u.UTF8ToString=Y,u.stringToUTF8=function(t,e,n){return B(t,r(),e,n)},u.lengthBytesUTF8=G,u.keepRuntimeAlive=Q,u.wasmMemory=j,u.stackSave=Ee,u.stackRestore=Me,u.stackAlloc=Ce,u.ExitStatus=ct,u.PThread=ht,rt=function t(){ve||ze(),ve||(rt=t)},u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);0<u.preInit.length;)u.preInit.pop()();return ze(),t.ready});t.exports=r},932:(t,e,n)=>{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<process.argv.length&&(p=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof J))throw t})),process.on("unhandledRejection",(function(t){throw t})),h=(t,e)=>{if(_||0<L)throw process.exitCode=t,e;e instanceof J||w("exiting due to exception: "+e),process.exit(t)},e.inspect=function(){return"[Emscripten Module object]"}):(d||y)&&(y?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),_scriptDir&&(m=_scriptDir),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{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<n-e&&t.buffer&&x)return x.decode(t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(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<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=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<t.length;++n){var r=t.charCodeAt(n);127>=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<t.length;)t.shift()(e)}var Q=[],K=0,tt=0;function et(t){this.Db=t,this.zb=t-24,this.Ub=function(t){M[this.zb+4>>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.length<e;)t=n[0]+t;return t}function i(t,e){return a(t,e,"0")}function o(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function u(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function c(t){var e=t.Bb;for(t=new Date(new Date(t.Cb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(pt(t.getFullYear())?ht:dt)[n];if(!(e>r-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:12<t&&(t-=12),i(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.Hb-1;e+=(pt(t.Cb+1900)?ht:dt)[n++]);return i(t.Kb+e,3)},"%m":function(t){return i(t.Hb+1,2)},"%M":function(t){return i(t.Zb,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.Gb&&12>t.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<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},k: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<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},g: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<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},s:nt,L:function(){var t=Q.pop();t||V("no exception to throw");var e=t.Db;throw t.Lb()||(Q.push(t),t.Jb(!0),t.Ib(!1),K++),tt=e,e},b:function(t,e,n){throw new et(t).Rb(e,n),tt=t,K++,t},la:function(){return K},i:function(t){throw tt||(tt=t),t},H:function(){return 0},Ba:function(){},pa:function(){},ra:function(){},ka:function(){return 0},za:function(){},ua:function(){},ya:function(){},R:function(){},qa:function(){},na:function(){},Aa:function(){},oa:function(){},Ha:function(){},Ja:function(){V("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){V("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},S:function(){return Date.now()},Ca:function(){return!0},Da:function(t,e){t=new Date(1e3*(M[t>>>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<n!=(u==r)&&(i=Math.max(o,i),e.setTime(e.getTime()+6e4*((0<n?u:i)-r))),E[t+24>>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<a?(M[n>>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<r.length;++i)S[a++>>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<L||(_t(),Z(W),wt(0),st[1].length&<(1,10),st[2].length&<(2,10)),_||0<L||(e.onExit&&e.onExit(t),C=!0),h(t,new J(t))},E:function(){return 52},Q:function(){return 52},ca:function(){return 70},P:function(t,e,n,r){for(var a=0,i=0;i<n;i++){var o=M[e>>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c<u;c++)lt(t,T[o+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<r;a++)S[e+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<B)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)z();Z(F),0<B||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),t()}),1)):t())}}if(e.UTF8ToString=j,e.stringToUTF8=function(t,e,n){return k(t,T,e,n)},e.lengthBytesUTF8=D,e.stackSave=At,e.stackRestore=St,e.stackAlloc=Tt,N=function t(){mt||Wt(),mt||(N=t)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return Wt(),t.ready});t.exports=r},967:(t,e)=>{"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<s;t++){const e=n._OrtGetInputName(r,t);if(0===e)throw new Error("Can\'t get an input name");p.push(e),f.push(n.UTF8ToString(e))}for(let t=0;t<l;t++){const e=n._OrtGetOutputName(r,t);if(0===e)throw new Error("Can\'t get an output name");d.push(e),h.push(n.UTF8ToString(e))}return u.set(r,[r,p,d]),[r,f,h]},e.createSession=(t,n)=>{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;t<m;t++){const e=n[t][0],r=n[t][1],a=n[t][2];let o,u;if(Array.isArray(a)){u=4*a.length,o=p._malloc(u),O.push(o);let t=o/4;for(let e=0;e<a.length;e++){if("string"!=typeof a[e])throw new TypeError(`tensor data at index ${e} is not a string`);p.HEAPU32[t++]=(0,i.allocWasmString)(a[e],O)}}else u=a.byteLength,o=p._malloc(u),O.push(o),p.HEAPU8.set(new Uint8Array(a.buffer,a.byteOffset,u),o);const s=p.stackSave(),l=p.stackAlloc(4*r.length);try{let t=l/4;r.forEach((e=>p.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;t<m;t++)p.HEAPU32[n++]=_[t],p.HEAPU32[r++]=y[e[t]];for(let t=0;t<g;t++)p.HEAPU32[i++]=0,p.HEAPU32[c++]=b[a[t]];let f=p._OrtRun(d,u,o,m,A,g,h,v);const w=[];if(0===f)for(let t=0;t<g;t++){const e=p.HEAPU32[h/4+t],n=p.stackSave(),r=p.stackAlloc(16);let a,i=0;try{if(f=p._OrtGetTensorData(e,r,r+4,r+8,r+12),0!==f)throw new Error(`Can\'t access output tensor data. error code = ${f}`);let t=r/4;const o=p.HEAPU32[t++];i=p.HEAPU32[t++];const u=p.HEAPU32[t++],c=p.HEAPU32[t++],h=[];for(let t=0;t<c;t++)h.push(p.HEAPU32[u/4+t]);p._OrtFree(u);const d=0===h.length?1:h.reduce(((t,e)=>t*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n<d;n++){const r=p.HEAPU32[e++],a=n===d-1?void 0:p.HEAPU32[e]-r;t.push(p.UTF8ToString(r,a))}w.push([a,h,t])}else{const t=new(l(a))(d);new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(p.HEAPU8.subarray(i,i+t.byteLength)),w.push([a,h,t])}}finally{p.stackRestore(n),"string"===a&&i&&p._free(i),p._OrtReleaseTensor(e)}}if(0===f)return w;throw new Error(`failed to call OrtRun(). error code = ${f}.`)}finally{p.stackRestore(t)}}finally{_.forEach(p._OrtReleaseTensor),O.forEach(p._free),p._OrtReleaseRunOptions(v),w.forEach(p._free)}},e.endProfiling=t=>{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:t=>{"use strict";t.exports=function(t,e,
vendor: 8,399 bytes, line 1675
1675r,n){var i=self||window;try{try{try{o=new i.Blob([t])}catch(e){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),o=o.getBlob()}var o,a=i.URL||i.webkitURL,s=a.createObjectURL(o),u=new i[e](s,r);return a.revokeObjectURL(s),u}catch(n){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),r)}}catch(t){if(!n)throw Error("Inline worker is not supported");return new i[e](n,r)}}},4154: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'},1670:t=>{"use strict";t.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(t,e,r)=>{"use strict";r.r(e),r.d(e,{flatbuffers:()=>n});var n={};n.Offset,n.Table,n.SIZEOF_SHORT=2,n.SIZEOF_INT=4,n.FILE_IDENTIFIER_LENGTH=4,n.SIZE_PREFIX_LENGTH=4,n.Encoding={UTF8_BYTES:1,UTF16_STRING:2},n.int32=new Int32Array(2),n.float32=new Float32Array(n.int32.buffer),n.float64=new Float64Array(n.int32.buffer),n.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],n.Long=function(t,e){this.low=0|t,this.high=0|e},n.Long.create=function(t,e){return 0==t&&0==e?n.Long.ZERO:new n.Long(t,e)},n.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},n.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},n.Long.ZERO=new n.Long(0,0),n.Builder=function(t){if(t)e=t;else var e=1024;this.bb=n.ByteBuffer.allocate(e),this.space=e,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},n.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},n.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},n.Builder.prototype.dataBuffer=function(){return this.bb},n.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},n.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var r=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<r+t+e;){var i=this.bb.capacity();this.bb=n.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)},n.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},n.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},n.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},n.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},n.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},n.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},n.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},n.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},n.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},n.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},n.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},n.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},n.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},n.Builder.prototype.addFieldInt8=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},n.Builder.prototype.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},n.Builder.prototype.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},n.Builder.prototype.addFieldInt64=function(t,e,r){!this.force_defaults&&e.equals(r)||(this.addInt64(e),this.slot(t))},n.Builder.prototype.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},n.Builder.prototype.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},n.Builder.prototype.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},n.Builder.prototype.addFieldStruct=function(t,e,r){e!=r&&(this.nested(e),this.slot(t))},n.Builder.prototype.nested=function(t){if(t!=this.offset())throw Error("FlatBuffers: struct must be serialized inline.")},n.Builder.prototype.notNested=function(){if(this.isNested)throw Error("FlatBuffers: object serialization must not be nested.")},n.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},n.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},n.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var r=e<<1,i=n.ByteBuffer.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i},n.Builder.prototype.addOffset=function(t){this.prep(n.SIZEOF_INT,0),this.writeInt32(this.offset()-t+n.SIZEOF_INT)},n.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},n.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=(r+2)*n.SIZEOF_SHORT;this.addInt16(i);var o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){var s=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(s)){for(var u=n.SIZEOF_SHORT;u<i;u+=n.SIZEOF_SHORT)if(this.bb.readInt16(a+u)!=this.bb.readInt16(s+u))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},n.Builder.prototype.finish=function(t,e,r){var i=r?n.SIZE_PREFIX_LENGTH:0;
vendor: 5,898 bytes, line 1675
1675if(e){var o=e;if(this.prep(this.minalign,n.SIZEOF_INT+n.FILE_IDENTIFIER_LENGTH+i),o.length!=n.FILE_IDENTIFIER_LENGTH)throw Error("FlatBuffers: file identifier must be length "+n.FILE_IDENTIFIER_LENGTH);for(var a=n.FILE_IDENTIFIER_LENGTH-1;a>=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,n.SIZEOF_INT+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},n.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},n.Builder.prototype.requiredField=function(t,e){var r=this.bb.capacity()-t,n=r-this.bb.readInt32(r);if(0==this.bb.readInt16(n+e))throw Error("FlatBuffers: field "+e+" must be set")},n.Builder.prototype.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(n.SIZEOF_INT,t*e),this.prep(r,t*e)},n.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},n.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var r=0;r<t.length;){var n,i=t.charCodeAt(r++);(n=i<55296||i>=56320?i:(i<<10)+t.charCodeAt(r++)+-56613888)<128?e.push(n):(n<2048?e.push(n>>6&31|192):(n<65536?e.push(n>>12&15|224):e.push(n>>18&7|240,n>>12&63|128),e.push(n>>6&63|128)),e.push(63&n|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),r=0;for(var o=this.space,a=this.bb.bytes();r<e.length;r++)a[o++]=e[r];return this.endVector()},n.Builder.prototype.createLong=function(t,e){return n.Long.create(t,e)},n.ByteBuffer=function(t){this.bytes_=t,this.position_=0},n.ByteBuffer.allocate=function(t){return new n.ByteBuffer(new Uint8Array(t))},n.ByteBuffer.prototype.clear=function(){this.position_=0},n.ByteBuffer.prototype.bytes=function(){return this.bytes_},n.ByteBuffer.prototype.position=function(){return this.position_},n.ByteBuffer.prototype.setPosition=function(t){this.position_=t},n.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},n.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},n.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},n.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},n.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},n.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},n.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},n.ByteBuffer.prototype.readInt64=function(t){return new n.Long(this.readInt32(t),this.readInt32(t+4))},n.ByteBuffer.prototype.readUint64=function(t){return new n.Long(this.readUint32(t),this.readUint32(t+4))},n.ByteBuffer.prototype.readFloat32=function(t){return n.int32[0]=this.readInt32(t),n.float32[0]},n.ByteBuffer.prototype.readFloat64=function(t){return n.int32[n.isLittleEndian?0:1]=this.readInt32(t),n.int32[n.isLittleEndian?1:0]=this.readInt32(t+4),n.float64[0]},n.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},n.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},n.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},n.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},n.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},n.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},n.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},n.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},n.ByteBuffer.prototype.writeFloat32=function(t,e){n.float32[0]=e,this.writeInt32(t,n.int32[0])},n.ByteBuffer.prototype.writeFloat64=function(t,e){n.float64[0]=e,this.writeInt32(t,n.int32[n.isLittleEndian?0:1]),this.writeInt32(t+4,n.int32[n.isLittleEndian?1:0])},n.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+n.SIZEOF_INT+n.FILE_IDENTIFIER_LENGTH)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<n.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+n.SIZEOF_INT+e));return t},n.ByteBuffer.prototype.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},n.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},n.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t),i="",o=0;if(t+=n.SIZEOF_INT,e===n.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+r);for(;o<r;){var a,s=this.readUint8(t+o++);if(s<192)a=s;else{var u=this.readUint8(t+o++);if(s<224)a=(31&s)<<6|63&u;else{var l=this.readUint8(t+o++);a=s<240?(15&s)<<12|(63&u)<<6|63&l:(7&s)<<18|(63&u)<<12|(63&l)<<6|63&this.readUint8(t+o++)}}a<65536?i+=String.fromCharCode(a):(a-=65536,i+=String.fromCharCode(55296+(a>>10),56320+(1023&a)))}return i},n.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},n.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+n.SIZEOF_INT},n.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},n.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=n.FILE_IDENTIFIER_LENGTH)throw Error("FlatBuffers: file identifier must be length "+n.FILE_IDENTIFIER_LENGTH);for(var e=0;e<n.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+n.SIZEOF_INT+e))return!1;return!0},n.ByteBuffer.prototype.createLong=function(t,e){return n.Long.create(t,e)}}},__webpack_module_cache__={};function __nested_webpack_require_546802__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var r=__webpack_module_cache__[t]={exports:{}};
vendor: 1,027 bytes, line 1675
1675return __webpack_modules__[t].call(r.exports,r,r.exports,__nested_webpack_require_546802__),r.exports}__nested_webpack_require_546802__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __nested_webpack_require_546802__.d(e,{a:e}),e},__nested_webpack_require_546802__.d=(t,e)=>{for(var r in e)__nested_webpack_require_546802__.o(e,r)&&!__nested_webpack_require_546802__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},__nested_webpack_require_546802__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__nested_webpack_require_546802__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__nested_webpack_require_546802__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __nested_webpack_exports__=__nested_webpack_require_546802__(6018);return __nested_webpack_exports__})())}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.