PageSourceSearch

https://roar.education/assets/worker.c935b39d-DYStRbPY.js

js roar.education collected 2026-09-28 09:38:58 UTC 573,423 bytes, 1,832 lines download raw bytes

vendor: 4,431 bytes, lines 1-6
1(function(){"use strict";var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var o=function a(){return this instanceof a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};o.prototype=e.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(t).forEach(function(a){var l=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(o,a,l.get?l:{enumerable:!0,get:function(){return t[a]}})}),o}var dist={},bufferPolyfill={},base64Js={};base64Js.byteLength=byteLength,base64Js.toByteArray=toByteArray,base64Js.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup[45]=62,revLookup[95]=63;function getLens(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var o=t.indexOf("=");o===-1&&(o=e);var a=o===e?0:4-o%4;return[o,a]}function byteLength(t){var e=getLens(t),o=e[0],a=e[1];return(o+a)*3/4-a}function _byteLength(t,e,o){return(e+o)*3/4-o}function toByteArray(t){var e,o=getLens(t),a=o[0],l=o[1],f=new Arr(_byteLength(t,a,l)),d=0,p=l>0?a-4:a,h;for(h=0;h<p;h+=4)e=revLookup[t.charCodeAt(h)]<<18|revLookup[t.charCodeAt(h+1)]<<12|revLookup[t.charCodeAt(h+2)]<<6|revLookup[t.charCodeAt(h+3)],f[d++]=e>>16&255,f[d++]=e>>8&255,f[d++]=e&255;return l===2&&(e=revLookup[t.charCodeAt(h)]<<2|revLookup[t.charCodeAt(h+1)]>>4,f[d++]=e&255),l===1&&(e=revLookup[t.charCodeAt(h)]<<10|revLookup[t.charCodeAt(h+1)]<<4|revLookup[t.charCodeAt(h+2)]>>2,f[d++]=e>>8&255,f[d++]=e&255),f}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[t&63]}function encodeChunk(t,e,o){for(var a,l=[],f=e;f<o;f+=3)a=(t[f]<<16&16711680)+(t[f+1]<<8&65280)+(t[f+2]&255),l.push(tripletToBase64(a));return l.join("")}function fromByteArray(t){for(var e,o=t.length,a=o%3,l=[],f=16383,d=0,p=o-a;d<p;d+=f)l.push(encodeChunk(t,d,d+f>p?p:d+f));return a===1?(e=t[o-1],l.push(lookup[e>>2]+lookup[e<<4&63]+"==")):a===2&&(e=(t[o-2]<<8)+t[o-1],l.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),l.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ieee754.read=function(t,e,o,a,l){var f,d,p=l*8-a-1,h=(1<<p)-1,n=h>>1,c=-7,r=o?l-1:0,s=o?-1:1,u=t[e+r];for(r+=s,f=u&(1<<-c)-1,u>>=-c,c+=p;c>0;f=f*256+t[e+r],r+=s,c-=8);for(d=f&(1<<-c)-1,f>>=-c,c+=a;c>0;d=d*256+t[e+r],r+=s,c-=8);if(f===0)f=1-n;else{if(f===h)return d?NaN:(u?-1:1)*(1/0);d=d+Math.pow(2,a),f=f-n}return(u?-1:1)*d*Math.pow(2,f-a)},ieee754.write=function(t,e,o,a,l,f){var d,p,h,n=f*8-l-1,c=(1<<n)-1,r=c>>1,s=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,u=a?0:f-1,g=a?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,d=c):(d=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-d))<1&&(d--,h*=2),d+r>=1?e+=s/h:e+=s*Math.pow(2,1-r),e*h>=2&&(d++,h/=2),d+r>=c?(p=0,d=c):d+r>=1?(p=(e*h-1)*Math.pow(2,l),d=d+r):(p=e*Math.pow(2,r-1)*Math.pow(2,l),d=0));l>=8;t[o+u]=p&255,u+=g,p/=256,l-=8);for(d=d<<l|p,n+=l;n>0;t[o+u]=d&255,u+=g,d/=256,n-=8);t[o+u-g]|=y*128};/*!
2 * The buffer module from node.js, for the browser.
3 *
4 * @author   Feross Aboukhadijeh <https://feross.org>
5 * @license  MIT
6 */(function(t){const e=base64Js,o=ieee754,a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=p,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;const l=2147483647;t.kMaxLength=l,p.TYPED_ARRAY_SUPPORT=f(),!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function f(){try{const x=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(x,m),x.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function d(x){if(x>
vendor: 20,842 bytes, line 6
6l)throw new RangeError('The value "'+x+'" is invalid for option "size"');const m=new Uint8Array(x);return Object.setPrototypeOf(m,p.prototype),m}function p(x,m,b){if(typeof x=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return r(x)}return h(x,m,b)}p.poolSize=8192;function h(x,m,b){if(typeof x=="string")return s(x,m);if(ArrayBuffer.isView(x))return g(x);if(x==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x);if(ie(x,ArrayBuffer)||x&&ie(x.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ie(x,SharedArrayBuffer)||x&&ie(x.buffer,SharedArrayBuffer)))return y(x,m,b);if(typeof x=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const T=x.valueOf&&x.valueOf();if(T!=null&&T!==x)return p.from(T,m,b);const F=S(x);if(F)return F;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof x[Symbol.toPrimitive]=="function")return p.from(x[Symbol.toPrimitive]("string"),m,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x)}p.from=function(x,m,b){return h(x,m,b)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function n(x){if(typeof x!="number")throw new TypeError('"size" argument must be of type number');if(x<0)throw new RangeError('The value "'+x+'" is invalid for option "size"')}function c(x,m,b){return n(x),x<=0?d(x):m!==void 0?typeof b=="string"?d(x).fill(m,b):d(x).fill(m):d(x)}p.alloc=function(x,m,b){return c(x,m,b)};function r(x){return n(x),d(x<0?0:A(x)|0)}p.allocUnsafe=function(x){return r(x)},p.allocUnsafeSlow=function(x){return r(x)};function s(x,m){if((typeof m!="string"||m==="")&&(m="utf8"),!p.isEncoding(m))throw new TypeError("Unknown encoding: "+m);const b=z(x,m)|0;let T=d(b);const F=T.write(x,m);return F!==b&&(T=T.slice(0,F)),T}function u(x){const m=x.length<0?0:A(x.length)|0,b=d(m);for(let T=0;T<m;T+=1)b[T]=x[T]&255;return b}function g(x){if(ie(x,Uint8Array)){const m=new Uint8Array(x);return y(m.buffer,m.byteOffset,m.byteLength)}return u(x)}function y(x,m,b){if(m<0||x.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(x.byteLength<m+(b||0))throw new RangeError('"length" is outside of buffer bounds');let T;return m===void 0&&b===void 0?T=new Uint8Array(x):b===void 0?T=new Uint8Array(x,m):T=new Uint8Array(x,m,b),Object.setPrototypeOf(T,p.prototype),T}function S(x){if(p.isBuffer(x)){const m=A(x.length)|0,b=d(m);return b.length===0||x.copy(b,0,0,m),b}if(x.length!==void 0)return typeof x.length!="number"||Se(x.length)?d(0):u(x);if(x.type==="Buffer"&&Array.isArray(x.data))return u(x.data)}function A(x){if(x>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return x|0}function L(x){return+x!=x&&(x=0),p.alloc(+x)}p.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==p.prototype},p.compare=function(m,b){if(ie(m,Uint8Array)&&(m=p.from(m,m.offset,m.byteLength)),ie(b,Uint8Array)&&(b=p.from(b,b.offset,b.byteLength)),!p.isBuffer(m)||!p.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===b)return 0;let T=m.length,F=b.length;for(let D=0,V=Math.min(T,F);D<V;++D)if(m[D]!==b[D]){T=m[D],F=b[D];break}return T<F?-1:F<T?1:0},p.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(m,b){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return p.alloc(0);let T;if(b===void 0)for(b=0,T=0;T<m.length;++T)b+=m[T].length;const F=p.allocUnsafe(b);let D=0;for(T=0;T<m.length;++T){let V=m[T];if(ie(V,Uint8Array))D+V.length>F.length?(p.isBuffer(V)||(V=p.from(V)),V.copy(F,D)):Uint8Array.prototype.set.call(F,V,D);else if(p.isBuffer(V))V.copy(F,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=V.length}return F};function z(x,m){if(p.isBuffer(x))return x.length;if(ArrayBuffer.isView(x)||ie(x,ArrayBuffer))return x.byteLength;if(typeof x!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof x);const b=x.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&b===0)return 0;let F=!1;for(;;)switch(m){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return ze(x).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b*2;case"hex":return b>>>1;case"base64":return $e(x).length;default:if(F)return T?-1:ze(x).length;m=(""+m).toLowerCase(),F=!0}}p.byteLength=z;function et(x,m,b){let T=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0,m>>>=0,b<=m))return"";for(x||(x="utf8");;)switch(x){case"hex":return Ie(this,m,b);case"utf8":case"utf-8":return Dt(this,m,b);case"ascii":return Mt(this,m,b);case"latin1":case"binary":return Pt(this,m,b);case"base64":return Me(this,m,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ve(this,m,b);default:if(T)throw new TypeError("Unknown encoding: "+x);x=(x+"").toLowerCase(),T=!0}}p.prototype._isBuffer=!0;function Y(x,m,b){const T=x[m];x[m]=x[b],x[b]=T}p.prototype.swap16=function(){const m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;b<m;b+=2)Y(this,b,b+1);return this},p.prototype.swap32=function(){const m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let b=0;b<m;b+=4)Y(this,b,b+3),Y(this,b+1,b+2);return this},p.prototype.swap64=function(){const m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let b=0;b<m;b+=8)Y(this,b,b+7),Y(this,b+1,b+6),Y(this,b+2,b+5),Y(this,b+3,b+4);return this},p.prototype.toString=function(){const m=this.length;return m===0?"":arguments.length===0?Dt(this,0,m):et.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(m){if(!p.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:p.compare(this,m)===0},p.prototype.inspect=function(){let m="";const b=t.INSPECT_MAX_BYTES;return m=this.toString("hex",0,b).replace(/(.{2})/g,"$1 ").trim(),this.length>b&&(m+=" ... "),"<Buffer "+m+">"},a&&(p.prototype[a]=p.prototype.inspect),p.prototype.compare=function(m,b,T,F,D){if(ie(m,Uint8Array)&&(m=p.from(m,m.offset,m.byteLength)),!p.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(b===void 0&&(b=0),T===void 0&&(T=m?m.length:0),F===void 0&&(F=0),D===void 0&&(D=this.length),b<0||T>m.length||F<0||D>this.length)throw new RangeError("out of range index");if(F>=D&&b>=T)return 0;if(F>=D)return-1;if(b>=T)return 1;if(b>>>=0,T>>>=0,F>>>=0,D>>>=0,this===m)return 0;let V=D-F,gt=T-b;const v=Math.min(V,gt),P=this.slice(F,D),N=m.slice(b,T);for(let C=0;C<v;++C)if(P[C]!==N[C]){V=P[C],gt=N[C];break}return V<gt?-1:gt<V?1:0};function X(x,m,b,T,F){if(x.length===0)return-1;if(typeof b=="string"?(T=b,b=0):b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b=+b,Se(b)&&(b=F?0:x.length-1),b<0&&(b=x.length+b),b>=x.length){if(F)return-1;b=x.length-1}else if(b<0)if(F)b=0;else return-1;if(typeof m=="string"&&(m=p.from(m,T)),p.isBuffer(m))return m.length===0?-1:mt(x,m,b,T,F);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?F?Uint8Array.prototype.indexOf.call(x,m,b):Uint8Array.prototype.lastIndexOf.call(x,m,b):mt(x,[m],b,T,F);throw new TypeError("val must be string, number or Buffer")}function mt(x,m,b,T,F){let D=1,V=x.length,gt=m.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(x.length<2||m.length<2)return-1;D=2,V/=2,gt/=2,b/=2}function v(N,C){return D===1?N[C]:N.readUInt16BE(C*D)}let P;if(F){let N=-1;for(P=b;P<V;P++)if(v(x,P)===v(m,N===-1?0:P-N)){if(N===-1&&(N=P),P-N+1===gt)return N*D}else N!==-1&&(P-=P-N),N=-1}else for(b+gt>V&&(b=V-gt),P=b;P>=0;P--){let N=!0;for(let C=0;C<gt;C++)if(v(x,P+C)!==v(m,C)){N=!1;break}if(N)return P}return-1}p.prototype.includes=function(m,b,T){return this.indexOf(m,b,T)!==-1},p.prototype.indexOf=function(m,b,T){return X(this,m,b,T,!0)},p.prototype.lastIndexOf=function(m,b,T){return X(this,m,b,T,!1)};function J(x,m,b,T){b=Number(b)||0;const F=x.length-b;T?(T=Number(T),T>F&&(T=F)):T=F;const D=m.length;T>D/2&&(T=D/2);let V;for(V=0;V<T;++V){const gt=parseInt(m.substr(V*2,2),16);if(Se(gt))return V;x[b+V]=gt}return V}function At(x,m,b,T){return Fe(ze(m,x.length-b),x,b,T)}function Lt(x,m,b,T){return Fe(Ee(m),x,b,T)}function ke(x,m,b,T){return Fe($e(m),x,b,T)}function Be(x,m,b,T){return Fe(He(m,x.length-b),x,b,T)}p.prototype.write=function(m,b,T,F){if(b===void 0)F="utf8",T=this.length,b=0;else if(T===void 0&&typeof b=="string")F=b,T=this.length,b=0;else if(isFinite(b))b=b>>>0,isFinite(T)?(T=T>>>0,F===void 0&&(F="utf8")):(F=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const D=this.length-b;if((T===void 0||T>D)&&(T=D),m.length>0&&(T<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");let V=!1;for(;;)switch(F){case"hex":return J(this,m,b,T);case"utf8":case"utf-8":return At(this,m,b,T);case"ascii":case"latin1":case"binary":return Lt(this,m,b,T);case"base64":return ke(this,m,b,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Be(this,m,b,T);default:if(V)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),V=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Me(x,m,b){return m===0&&b===x.length?e.fromByteArray(x):e.fromByteArray(x.slice(m,b))}function Dt(x,m,b){b=Math.min(x.length,b);const T=[];let F=m;for(;F<b;){const D=x[F];let V=null,gt=D>239?4:D>223?3:D>191?2:1;if(F+gt<=b){let v,P,N,C;switch(gt){case 1:D<128&&(V=D);break;case 2:v=x[F+1],(v&192)===128&&(C=(D&31)<<6|v&63,C>127&&(V=C));break;case 3:v=x[F+1],P=x[F+2],(v&192)===128&&(P&192)===128&&(C=(D&15)<<12|(v&63)<<6|P&63,C>2047&&(C<55296||C>57343)&&(V=C));break;case 4:v=x[F+1],P=x[F+2],N=x[F+3],(v&192)===128&&(P&192)===128&&(N&192)===128&&(C=(D&15)<<18|(v&63)<<12|(P&63)<<6|N&63,C>65535&&C<1114112&&(V=C))}}V===null?(V=65533,gt=1):V>65535&&(V-=65536,T.push(V>>>10&1023|55296),V=56320|V&1023),T.push(V),F+=gt}return bt(T)}const It=4096;function bt(x){const m=x.length;if(m<=It)return String.fromCharCode.apply(String,x);let b="",T=0;for(;T<m;)b+=String.fromCharCode.apply(String,x.slice(T,T+=It));return b}function Mt(x,m,b){let T="";b=Math.min(x.length,b);for(let F=m;F<b;++F)T+=String.fromCharCode(x[F]&127);return T}function Pt(x,m,b){let T="";b=Math.min(x.length,b);for(let F=m;F<b;++F)T+=String.fromCharCode(x[F]);return T}function Ie(x,m,b){const T=x.length;(!m||m<0)&&(m=0),(!b||b<0||b>T)&&(b=T);let F="";for(let D=m;D<b;++D)F+=Ye[x[D]];return F}function ve(x,m,b){const T=x.slice(m,b);let F="";for(let D=0;D<T.length-1;D+=2)F+=String.fromCharCode(T[D]+T[D+1]*256);return F}p.prototype.slice=function(m,b){const T=this.length;m=~~m,b=b===void 0?T:~~b,m<0?(m+=T,m<0&&(m=0)):m>T&&(m=T),b<0?(b+=T,b<0&&(b=0)):b>T&&(b=T),b<m&&(b=m);const F=this.subarray(m,b);return Object.setPrototypeOf(F,p.prototype),F};function _t(x,m,b){if(x%1!==0||x<0)throw new RangeError("offset is not uint");if(x+m>b)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(m,b,T){m=m>>>0,b=b>>>0,T||_t(m,b,this.length);let F=this[m],D=1,V=0;for(;++V<b&&(D*=256);)F+=this[m+V]*D;return F},p.prototype.readUintBE=p.prototype.readUIntBE=function(m,b,T){m=m>>>0,b=b>>>0,T||_t(m,b,this.length);let F=this[m+--b],D=1;for(;b>0&&(D*=256);)F+=this[m+--b]*D;return F},p.prototype.readUint8=p.prototype.readUInt8=function(m,b){return m=m>>>0,b||_t(m,1,this.length),this[m]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(m,b){return m=m>>>0,b||_t(m,2,this.length),this[m]|this[m+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(m,b){return m=m>>>0,b||_t(m,2,this.length),this[m]<<8|this[m+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(m,b){return m=m>>>0,b||_t(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(m,b){return m=m>>>0,b||_t(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},p.prototype.readBigUInt64LE=Te(function(m){m=m>>>0,Gt(m,"offset");const b=this[m],T=this[m+7];(b===void 0||T===void 0)&&Kt(m,this.length-8);const F=b+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,D=this[++m]+this[++m]*2**8+this[++m]*2**16+T*2**24;return BigInt(F)+(BigInt(D)<<BigInt(32))}),p.prototype.readBigUInt64BE=Te(function(m){m=m>>>0,Gt(m,"offset");const b=this[m],T=this[m+7];(b===void 0||T===void 0)&&Kt(m,this.length-8);const F=b*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],D=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+T;return(BigInt(F)<<BigInt(32))+BigInt(D)}),p.prototype.readIntLE=function(m,b,T){m=m>>>0,b=b>>>0,T||_t(m,b,this.length);let F=this[m],D=1,V=0;for(;++V<b&&(D*=256);)F+=this[m+V]*D;return D*=128,F>=D&&(F-=Math.pow(2,8*b)),F},p.prototype.readIntBE=function(m,b,T){m=m>>>0,b=b>>>0,T||_t(m,b,this.length);let F=b,D=1,V=this[m+--F];for(;F>0&&(D*=256);)V+=this[m+--F]*D;return D*=128,V>=D&&(V-=Math.pow(2,8*b)),V},p.prototype.readInt8=function(m,b){return m=m>>>0,b||_t(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},p.prototype.readInt16LE=function(m,b){m=m>>>0,b||_t(m,2,this.length);const T=this[m]|this[m+1]<<8;return T&32768?T|4294901760:T},p.prototype.readInt16BE=function(m,b){m=m>>>0,b||_t(m,2,this.length);const T=this[m+1]|this[m]<<8;return T&32768?T|4294901760:T},p.prototype.readInt32LE=function(m,b){return m=m>>>0,b||_t(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},p.prototype.readInt32BE=function(m,b){return m=m>>>0,b||_t(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},p.prototype.readBigInt64LE=Te(function(m){m=m>>>0,Gt(m,"offset");const b=this[m],T=this[m+7];(b===void 0||T===void 0)&&Kt(m,this.length-8);const F=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(T<<24);return(BigInt(F)<<BigInt(32))+BigInt(b+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24)}),p.prototype.readBigInt64BE=Te(function(m){m=m>>>0,Gt(m,"offset");const b=this[m],T=this[m+7];(b===void 0||T===void 0)&&Kt(m,this.length-8);const F=(b<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(F)<<BigInt(32))+BigInt(this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+T)}),p.prototype.readFloatLE=function(m,b){return m=m>>>0,b||_t(m,4,this.length),o.read(this,m,!0,23,4)},p.prototype.readFloatBE=function(m,b){return m=m>>>0,b||_t(m,4,this.length),o.read(this,m,!1,23,4)},p.prototype.readDoubleLE=function(m,b){return m=m>>>0,b||_t(m,8,this.length),o.read(this,m,!0,52,8)},p.prototype.readDoubleBE=function(m,b){return m=m>>>0,b||_t(m,8,this.length),o.read(this,m,!1,52,8)};function St(x,m,b,T,F,D){if(!p.isBuffer(x))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>F||m<D)throw new RangeError('"value" argument is out of bounds');if(b+T>x.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(m,b,T,F){if(m=+m,b=b>>>0,T=T>>>0,!F){const gt=Math.pow(2,8*T)-1;St(this,m,b,T,gt,0)}let D=1,V=0;for(this[b]=m&255;++V<T&&(D*=256);)this[b+V]=m/D&255;return b+T},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(m,b,T,F){if(m=+m,b=b>>>0,T=T>>>0,!F){const gt=Math.pow(2,8*T)-1;St(this,m,b,T,gt,0)}let D=T-1,V=1;for(this[b+D]=m&255;--D>=0&&(V*=256);)this[b+D]=m/V&255;return b+T},p.prototype.writeUint8=p.prototype.writeUInt8=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,1,255,0),this[b]=m&255,b+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,2,65535,0),this[b]=m&255,this[b+1]=m>>>8,b+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,2,65535,0),this[b]=m>>>8,this[b+1]=m&255,b+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,4,4294967295,0),this[b+3]=m>>>24,this[b+2]=m>>>16,this[b+1]=m>>>8,this[b]=m&255,b+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,4,4294967295,0),this[b]=m>>>24,this[b+1]=m>>>16,this[b+2]=m>>>8,this[b+3]=m&255,b+4};function ue(x,m,b,T,F){Yt(m,T,F,x,b,7);let D=Number(m&BigInt(4294967295));x[b++]=D,D=D>>8,x[b++]=D,D=D>>8,x[b++]=D,D=D>>8,x[b++]=D;let V=Number(m>>BigInt(32)&BigInt(4294967295));return x[b++]=V,V=V>>8,x[b++]=V,V=V>>8,x[b++]=V,V=V>>8,x[b++]=V,b}function ne(x,m,b,T,F){Yt(m,T,F,x,b,7);let D=Number(m&BigInt(4294967295));x[b+7]=D,D=D>>8,x[b+6]=D,D=D>>8,x[b+5]=D,D=D>>8,x[b+4]=D;let V=Number(m>>BigInt(32)&BigInt(4294967295));return x[b+3]=V,V=V>>8,x[b+2]=V,V=V>>8,x[b+1]=V,V=V>>8,x[b]=V,b+8}p.prototype.writeBigUInt64LE=Te(function(m,b=0){return ue(this,m,b,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=Te(function(m,b=0){return ne(this,m,b,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(m,b,T,F){if(m=+m,b=b>>>0,!F){const v=Math.pow(2,8*T-1);St(this,m,b,T,v-1,-v)}let D=0,V=1,gt=0;for(this[b]=m&255;++D<T&&(V*=256);)m<0&&gt===0&&this[b+D-1]!==0&&(gt=1),this[b+D]=(m/V>>0)-gt&255;return b+T},p.prototype.writeIntBE=function(m,b,T,F){if(m=+m,b=b>>>0,!F){const v=Math.pow(2,8*T-1);St(this,m,b,T,v-1,-v)}let D=T-1,V=1,gt=0;for(this[b+D]=m&255;--D>=0&&(V*=256);)m<0&&gt===0&&this[b+D+1]!==0&&(gt=1),this[b+D]=(m/V>>0)-gt&255;return b+T},p.prototype.writeInt8=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,1,127,-128),m<0&&(m=255+m+1),this[b]=m&255,b+1},p.prototype.writeInt16LE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,2,32767,-32768),this[b]=m&255,this[b+1]=m>>>8,b+2},p.prototype.writeInt16BE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,2,32767,-32768),this[b]=m>>>8,this[b+1]=m&255,b+2},p.prototype.writeInt32LE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,4,2147483647,-2147483648),this[b]=m&255,this[b+1]=m>>>8,this[b+2]=m>>>16,this[b+3]=m>>>24,b+4},p.prototype.writeInt32BE=function(m,b,T){return m=+m,b=b>>>0,T||St(this,m,b,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[b]=m>>>24,this[b+1]=m>>>16,this[b+2]=m>>>8,this[b+3]=m&255,b+4},p.prototype.writeBigInt64LE=Te(function(m,b=0){return ue(this,m,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=Te(function(m,b=0){return ne(this,m,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pe(x,m,b,T,F,D){if(b+T>x.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function Pe(x,m,b,T,F){return m=+m,b=b>>>0,F||pe(x,m,b,4),o.write(x,m,b,T,23,4),b+4}p.prototype.writeFloatLE=function(m,b,T){return Pe(this,m,b,!0,T)},p.prototype.writeFloatBE=function(m,b,T){return Pe(this,m,b,!1,T)};function ge(x,m,b,T,F){return m=+m,b=b>>>0,F||pe(x,m,b,8),o.write(x,m,b,T,52,8),b+8}p.prototype.writeDoubleLE=function(m,b,T){return ge(this,m,b,!0,T)},p.prototype.writeDoubleBE=function(m,b,T){return ge(this,m,b,!1,T)},p.prototype.copy=function(m,b,T,F){if(!p.isBuffer(m))throw new TypeError("argument should be a Buffer");if(T||(T=0),!F&&F!==0&&(F=this.length),b>=m.length&&(b=m.length),b||(b=0),F>0&&F<T&&(F=T),F===T||m.length===0||this.length===0)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),m.length-b<F-T&&(F=m.length-b+T);const D=F-T;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(b,T,F):Uint8Array.prototype.set.call(m,this.subarray(T,F),b),D},p.prototype.fill=function(m,b,T,F){if(typeof m=="string"){if(typeof b=="string"?(F=b,b=0,T=this.length):typeof T=="string"&&(F=T,T=this.length),F!==void 0&&typeof F!="string")throw new TypeError("encoding must be a string");if(typeof F=="string"&&!p.isEncoding(F))throw new TypeError("Unknown encoding: "+F);if(m.length===1){const V=m.charCodeAt(0);(F==="utf8"&&V<128||F==="latin1")&&(m=V)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(b<0||this.length<b||this.length<T)throw new RangeError("Out of range index");if(T<=b)return this;b=b>>>0,T=T===void 0?this.length:T>>>0,m||(m=0);let D;if(typeof m=="number")for(D=b;D<T;++D)this[D]=m;else{const V=p.isBuffer(m)?m:p.from(m,F),gt=V.length;
vendor: 2,125 bytes, line 6
6if(gt===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(D=0;D<T-b;++D)this[D+b]=V[D%gt]}return this};const zt={};function de(x,m,b){zt[x]=class extends b{constructor(){super(),Object.defineProperty(this,"message",{value:m.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${x}]`,this.stack,delete this.name}get code(){return x}set code(F){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:F,writable:!0})}toString(){return`${this.name} [${x}]: ${this.message}`}}}de("ERR_BUFFER_OUT_OF_BOUNDS",function(x){return x?`${x} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),de("ERR_INVALID_ARG_TYPE",function(x,m){return`The "${x}" argument must be of type number. Received type ${typeof m}`},TypeError),de("ERR_OUT_OF_RANGE",function(x,m,b){let T=`The value of "${x}" is out of range.`,F=b;return Number.isInteger(b)&&Math.abs(b)>2**32?F=Et(String(b)):typeof b=="bigint"&&(F=String(b),(b>BigInt(2)**BigInt(32)||b<-(BigInt(2)**BigInt(32)))&&(F=Et(F)),F+="n"),T+=` It must be ${m}. Received ${F}`,T},RangeError);function Et(x){let m="",b=x.length;const T=x[0]==="-"?1:0;for(;b>=T+4;b-=3)m=`_${x.slice(b-3,b)}${m}`;return`${x.slice(0,b)}${m}`}function qt(x,m,b){Gt(m,"offset"),(x[m]===void 0||x[m+b]===void 0)&&Kt(m,x.length-(b+1))}function Yt(x,m,b,T,F,D){if(x>b||x<m){const V=typeof m=="bigint"?"n":"";let gt;throw m===0||m===BigInt(0)?gt=`>= 0${V} and < 2${V} ** ${(D+1)*8}${V}`:gt=`>= -(2${V} ** ${(D+1)*8-1}${V}) and < 2 ** ${(D+1)*8-1}${V}`,new zt.ERR_OUT_OF_RANGE("value",gt,x)}qt(T,F,D)}function Gt(x,m){if(typeof x!="number")throw new zt.ERR_INVALID_ARG_TYPE(m,"number",x)}function Kt(x,m,b){throw Math.floor(x)!==x?(Gt(x,b),new zt.ERR_OUT_OF_RANGE("offset","an integer",x)):m<0?new zt.ERR_BUFFER_OUT_OF_BOUNDS:new zt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${m}`,x)}const Ue=/[^+/0-9A-Za-z-_]/g;function qe(x){if(x=x.split("=")[0],x=x.trim().replace(Ue,""),x.length<2)return"";for(;x.length%4!==0;)x=x+"=";return x}function ze(x,m){m=m||1/0;let b;const T=x.length;let F=null;const D=[];for(let V=0;V<T;
vendor: 4,841 bytes, line 6
6++V){if(b=x.charCodeAt(V),b>55295&&b<57344){if(!F){if(b>56319){(m-=3)>-1&&D.push(239,191,189);continue}else if(V+1===T){(m-=3)>-1&&D.push(239,191,189);continue}F=b;continue}if(b<56320){(m-=3)>-1&&D.push(239,191,189),F=b;continue}b=(F-55296<<10|b-56320)+65536}else F&&(m-=3)>-1&&D.push(239,191,189);if(F=null,b<128){if((m-=1)<0)break;D.push(b)}else if(b<2048){if((m-=2)<0)break;D.push(b>>6|192,b&63|128)}else if(b<65536){if((m-=3)<0)break;D.push(b>>12|224,b>>6&63|128,b&63|128)}else if(b<1114112){if((m-=4)<0)break;D.push(b>>18|240,b>>12&63|128,b>>6&63|128,b&63|128)}else throw new Error("Invalid code point")}return D}function Ee(x){const m=[];for(let b=0;b<x.length;++b)m.push(x.charCodeAt(b)&255);return m}function He(x,m){let b,T,F;const D=[];for(let V=0;V<x.length&&!((m-=2)<0);++V)b=x.charCodeAt(V),T=b>>8,F=b%256,D.push(F),D.push(T);return D}function $e(x){return e.toByteArray(qe(x))}function Fe(x,m,b,T){let F;for(F=0;F<T&&!(F+b>=m.length||F>=x.length);++F)m[F+b]=x[F];return F}function ie(x,m){return x instanceof m||x!=null&&x.constructor!=null&&x.constructor.name!=null&&x.constructor.name===m.name}function Se(x){return x!==x}const Ye=function(){const x="0123456789abcdef",m=new Array(256);for(let b=0;b<16;++b){const T=b*16;for(let F=0;F<16;++F)m[T+F]=x[b]+x[F]}return m}();function Te(x){return typeof BigInt>"u"?ot:x}function ot(){throw new Error("BigInt not supported")}})(bufferPolyfill);var browser$1={exports:{}},process=browser$1.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(t){if(cachedSetTimeout===setTimeout)return setTimeout(t,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(t,0);try{return cachedSetTimeout(t,0)}catch{try{return cachedSetTimeout.call(null,t,0)}catch{return cachedSetTimeout.call(this,t,0)}}}function runClearTimeout(t){if(cachedClearTimeout===clearTimeout)return clearTimeout(t);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(t);try{return cachedClearTimeout(t)}catch{try{return cachedClearTimeout.call(null,t)}catch{return cachedClearTimeout.call(this,t)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var t=runTimeout(cleanUpNextTick);draining=!0;for(var e=queue.length;e;){for(currentQueue=queue,queue=[];++queueIndex<e;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,e=queue.length}currentQueue=null,draining=!1,runClearTimeout(t)}}process.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)e[o-1]=arguments[o];queue.push(new Item(t,e)),queue.length===1&&!draining&&runTimeout(drainQueue)};function Item(t,e){this.fun=t,this.array=e}Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={};function noop$1(){}process.on=noop$1,process.addListener=noop$1,process.once=noop$1,process.off=noop$1,process.removeListener=noop$1,process.removeAllListeners=noop$1,process.emit=noop$1,process.prependListener=noop$1,process.prependOnceListener=noop$1,process.listeners=function(t){return[]},process.binding=function(t){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(t){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};function noop(){}var browser=browser$1.exports.browser,emitWarning=noop,binding=browser$1.exports.binding,exit=noop,pid=1,features={},kill=noop,dlopen=noop,uptime=noop,memoryUsage=noop,uvCounters=noop,platform="browser",arch="browser",execPath="browser",execArgv=[],api={nextTick:browser$1.exports.nextTick,title:browser$1.exports.title,browser,env:browser$1.exports.env,argv:browser$1.exports.argv,version:browser$1.exports.version,versions:browser$1.exports.versions,on:browser$1.exports.on,addListener:browser$1.exports.addListener,once:browser$1.exports.once,off:browser$1.exports.off,removeListener:browser$1.exports.removeListener,removeAllListeners:browser$1.exports.removeAllListeners,emit:browser$1.exports.emit,emitWarning,prepe
6ndListener:browser$1.exports.prependListener,prependOnceListener:browser$1.exports.prependOnceListener,listeners:browser$1.exports.listeners,binding,cwd:browser$1.exports.cwd,chdir:browser$1.exports.chdir,umask:browser$1.exports.umask,exit,pid,features,kill,dlopen,uptime,memoryUsage,uvCounters,platform,arch,execPath,execArgv},addListener=browser$1.exports.addListener,argv=browser$1.exports.argv,chdir=browser$1.exports.chdir,cwd=browser$1.exports.cwd,emit=browser$1.exports.emit,env=browser$1.exports.env,listeners=browser$1.exports.listeners,nextTick=browser$1.exports.nextTick,off=browser$1.exports.off,on=browser$1.exports.on,once=browser$1.exports.once,prependListener=browser$1.exports.prependListener,prependOnceListener=browser$1.exports.prependOnceListener,removeAllListeners=browser$1.exports.removeAllListeners,removeListener=browser$1.exports.removeListener,title=browser$1.exports.title,umask=browser$1.exports.umask,version=browser$1.exports.version,versions=browser$1.exports.versions,process$1=Object.freeze({__proto__:null,addListener,arch,argv,binding,browser,chdir,cwd,default:api,dlopen,emit,emitWarning,env,execArgv,execPath,exit,features,kill,listeners,memoryUsage,nextTick,off,on,once,pid,platform,prepe
6ndListener,prependOnceListener,removeAllListeners,removeListener,title,umask,uptime,uvCounters,version,versions}),require$$1=getAugmentedNamespace(process$1);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=bufferPolyfill,o=require$$1,a=d=>d&&d.__esModule?d:{default:d},l=a(o),f=globalThis||void 0||self;Object.defineProperty(t,"Buffer",{enumerable:!0,get:()=>e.Buffer}),Object.defineProperty(t,"process",{enumerable:!0,get:()=>l.default}),t.global=f})(dist),function(){try{var t=typeof window<"u"?window:typeof commonjsGlobal<"u"?commonjsGlobal:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="32be7742-f687-4761-be4c-1abbdad408a4",t._sentryDebugIdIdentifier="sentry-dbid-32be7742-f687-4761-be4c-1abbdad408a4")}catch{}}(),(typeof window<"u"?window:typeof commonjsGlobal<"u"?commonjsGlobal:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{}).SENTRY_RELEASE={id:"4f527a61cdf3b4a4e8a1b309b5b309166bbcdc38"},function(){try{var t=typeof window<"u"?window:typeof dist.global<"u"?dist.global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="fadda329-89ef-463d-9035-b5d42cfc4bc7",t._sentryDebugIdIdentifier="sentry-dbid-fadda329-89ef-463d-9035-b5d42cfc4bc7")}catch{}}();/*!
7* ONNX Runtime Web v1.17.3
8* Copyright (c) Microsoft Corporation. All rights reserved.
9* Licensed under the MIT License.
10*/var Od=Object.create,Dn=Object.defineProperty,Id=Object.getOwnPropertyDescriptor,Sd=Object.getOwnPropertyNames,Ad=Object.getPrototypeOf,Pd=Object.prototype.hasOwnProperty,E=(t,e)=>()=>(t&&(e=t(t=0)),e),me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var o in e)Dn(t,o,{get:e[o],enumerable:!0})},Ha=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Sd(e))!Pd.call(t,l)&&l!==o&&Dn(t,l,{get:()=>e[l],enumerable:!(a=Id(e,l))||a.enumerable});return t},Er=(t,e,o)=>(o=t!=null?Od(Ad(t)):{},Ha(t&&t.__esModule?o:Dn(o,"default",{value:t,enumerable:!0}),t)),or=t=>Ha(Dn({},"__esModule",{value:!0}),t),Ln,ir,Dr,Ed,Fn,Cn=E(()=>{Ln=new Map,ir=[],Dr=(t,e,o)=>{if(e&&typeof e.init=="function"&&typeof e.createInferenceSessionHandler=="function"){let a=Ln.get(t);if(a===void 0)Ln.set(t,{backend:e,priority:o});else{if(a.priority>o)return;if(a.priority===o&&a.backend!==e)throw new Error(`cannot register backend "${t}" using priority ${o}`)}if(o>=0){let l=ir.indexOf(t);l!==-1&&ir.splice(l,1);for(let f=0;f<ir.length;f++)if(Ln.get(ir[f]).priority<=o)return void ir.splice(f,0,t);ir.push(t)}return}throw new TypeError("not a valid backend")},Ed=async t=>{let e=Ln.get(t);if(!e)return"backend not found.";if(e.initialized)return e.backend;if(e.aborted)return e.error;{let o=!!e.initPromise;try{return o||(e.initPromise=e.backend.init(t)),await e.initPromise,e.initialized=!0,e.backend}catch(a){return o||(e.error=`${a}`,e.aborted=!0),e.error}finally{delete e.initPromise}}},Fn=async t=>{let e,o=t.executionProviders||[],a=o.map(h=>typeof h=="string"?h:h.name),l=a.length===0?ir:a,f=[],d=new Set;for(let h of l){let n=await Ed(h);typeof n=="string"?f.push({name:h,err:n}):(e||(e=n),e===n&&d.add(h))}if(!e)throw new Error(`no available backend found. ERR: ${f.map(h=>`[${h.name}] ${h.err}`).join(", ")}`);for(let{name:h,err:n}of f)a.includes(h)&&console.warn(`removing requested execution provider "${h}" from session options because it is not available: ${n}`);let p=o.filter(h=>d.has(typeof h=="string"?h:h.name));return[e,new Proxy(t,{get:(h,n)=>n==="executionProviders"?p:Reflect.get(h,n)})]}}),qa=E(()=>{Cn()}),ja,Ya=E(()=>{ja="1.17.3"}),Xa,it,Ho=E(()=>{Ya(),Xa="warning",it={wasm:{},webgl:{},webgpu:{},versions:{common:ja},set logLevel(t){if(t!==void 0){if(typeof t!="string"||["verbose","info","warning","error","fatal"].indexOf(t)===-1)throw new Error(`Unsupported logging level: ${t}`);Xa=t}},get logLevel(){return Xa}},Object.defineProperty(it,"logLevel",{enumerable:!0})}),Z,Ka=E(()=>{Ho(),Z=it}),Ja,Za,Qa=E(()=>{Ja=(t,e)=>{let o=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);o.width=t.dims[3],o.height=t.dims[2];let a=o.getContext("2d");if(a!=null){let l,f;(e==null?void 0:e.tensorLayout)!==void 0&&e.tensorLayout==="NHWC"?(l=t.dims[2],f=t.dims[3]):(l=t.dims[3],f=t.dims[2]);let d,p,h=(e==null?void 0:e.format)!==void 0?e.format:"RGB",n=e==null?void 0:e.norm;n===void 0||n.mean===void 0?d=[255,255,255,255]:typeof n.mean=="number"?d=[n.mean,n.mean,n.mean,n.mean]:(d=[n.mean[0],n.mean[1],n.mean[2],0],n.mean[3]!==void 0&&(d[3]=n.mean[3])),n===void 0||n.bias===void 0?p=[0,0,0,0]:typeof n.bias=="number"?p=[n.bias,n.bias,n.bias,n.bias]:(p=[n.bias[0],n.bias[1],n.bias[2],0],n.bias[3]!==void 0&&(p[3]=n.bias[3]));let c=f*l,r=0,s=c,u=2*c,g=-1;h==="RGBA"?(r=0,s=c,u=2*c,g=3*c):h==="RGB"?(r=0,s=c,u=2*c):h==="RBG"&&(r=0,u=c,s=2*c);for(let y=0;y<f;y++)for(let S=0;S<l;S++){let A=(t.data[r++]-p[0])*d[0],L=(t.data[s++]-p[1])*d[1],z=(t.data[u++]-p[2])*d[2],et=g===-1?255:(t.data[g++]-p[3])*d[3];a.fillStyle="rgba("+A+","+L+","+z+","+et+")",a.fillRect(S,y,1,1)}if("toDataURL"in o)return o.toDataURL();throw new Error("toDataURL is not supported")}throw new Error("Can not access image data")},Za=(t,e)=>{let o,a=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d");if(a==null)throw new Error("Can not access image data");{let l,f,d;(e==null?void 0:e.tensorLayout)!==void 0&&e.tensorLayout==="NHWC"?(l=t.dims[2],f=t.dims[1],d=t.dims[3]):(l=t.dims[3],f=t.dims[2],d=t.dims[1]);let p,h,n=e!==void 0&&e.format!==void 0?e.format:"RGB",c=e==null?void 0:e.norm;c===void 0||c.mean===void 0?p=[255,255,255,255]:typeof c.mean=="number"?p=[c.mean,c.mean,c.mean,c.mean]:(p=[c.mean[0],c.mean[1],c.mean[2],255],c.mean[3]!==void 0&&(p[3]=c.mean[3])),c===void 0||c.bias===void 0?h=[0,0,0,0]:typeof c.bias=="number"?h=[c.bias,c.bias,c.bias,c.bias]:(h=[c.bias[0],c.bias[1],c.bias[2],0],c.bias[3]!==void 0&&(h[3]=c.bias[3]));let r=f*l;if(e!==void 0&&(e.format!==void 0&&d===4&&e.format!=="RGBA"||d===3&&e.format!=="RGB"&&e.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let s=4,u=0,g=1,y=2,S=3,A=0,L=r,z=2*r,et=-1;n==="RGBA"?(A=0,L=r,z=2*r,et=3*r):n==="RGB"?(A=0,L=r,z=2*r):n==="RBG"&&(A=0,z=r,L=2*r),o=a.createImageData(l,f);for(let Y=0;Y<f*l;u+=s,g+=s,y+=s,S+=s,Y++)o.data[u]=(t.data[A++]-h[0])*p[0],o.data[g]=(t.data[L++]-h[1])*p[1],o.data[y]=(t.data[z++]-h[2])*p[2],o.data[S]=et===-1?255:(t.data[et++]-h[3])*p[3]}return o}}),qo,es,ts,rs,ns,os=E(()=>{$n(),qo=(t,e)=>{if(t===void 0)throw new Error("Image buffer must be defined");if(e.height===void 0||e.width===void 0)throw new Error("Image height and width must be defined");if(e.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let o,a,{height:l,width:f}=e,d=e.norm??{mean:255,bias:0};o=typeof d.mean=="number"?[d.mean,d.mean,d.mean,d.mean]:[d.mean[0],d.mean[1],d.mean[2],d.mean[3]??255],a=typeof d.bias=="number"?[d.bias,d.bias,d.bias,d.bias]:[d.bias[0],d.bias[1],d.bias[2],d.bias[3]??0];let p=e.format!==void 0?e.format:"RGBA",h=e.tensorFormat!==void 0&&e.tensorFormat!==void 0?e.tensorFormat:"RGB",n=l*f,c=h==="RGBA"?new Float32Array(4*n):new Float32Array(3*n),r=4,s=0,u=1,g=2,y=3,S=0,A=n,L=2*n,z=-1;p==="RGB"&&(r=3,s=0,u=1,g=2,y=-1),h==="RGBA"?z=3*n:h==="RBG"?(S=0,L=n,A=2*n):h==="BGR"&&(L=0,A=n,S=2*n);for(let et=0;et<n;et++,s+=r,g+=r,u+=r,y+=r)c[S++]=(t[s]+a[0])/o[0],c[A++]=(t[u]+a[1])/o[1],c[L++]=(t[g]+a[2])/o[2],z!==-1&&y!==-1&&(c[z++]=(t[y]+a[3])/o[3]);return new Xe("float32",c,h==="RGBA"?[1,4,l,f]:[1,3,l,f])},es=async(t,e)=>{let o,a=typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement,l=typeof ImageData<"u"&&t instanceof ImageData,f=typeof ImageBitmap<"u"&&t instanceof ImageBitmap,d=typeof t=="string",p=e??{},h=()=>
10{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},n=c=>c instanceof HTMLCanvasElement||c instanceof OffscreenCanvas?c.getContext("2d"):null;if(a){let c=h();c.width=t.width,c.height=t.height;let r=n(c);if(r==null)throw new Error("Can not access image data");{let s=t.height,u=t.width;if(e!==void 0&&e.resizedHeight!==void 0&&e.resizedWidth!==void 0&&(s=e.resizedHeight,u=e.resizedWidth),e!==void 0){if(p=e,e.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");p.tensorFormat="RGBA",p.height=s,p.width=u}else p.tensorFormat="RGBA",p.height=s,p.width=u;r.drawImage(t,0,0),o=r.getImageData(0,0,u,s).data}}else{if(!l){if(f){if(e===void 0)throw new Error("Please provide image config with format for Imagebitmap");let c=h();c.width=t.width,c.height=t.height;let r=n(c);if(r!=null){let s=t.height,u=t.width;return r.drawImage(t,0,0,u,s),o=r.getImageData(0,0,u,s).data,p.height=s,p.width=u,qo(o,p)}throw new Error("Can not access image data")}if(d)return new Promise((c,r)=>{let s=h(),u=n(s);if(!t||!u)return r();let g=new Image;g.crossOrigin="Anonymous",g.src=t,g.onload=()=>{s.width=g.width,s.height=g.height,u.drawImage(g,0,0,s.width,s.height);let y=u.getImageData(0,0,s.width,s.height);p.height=s.height,p.width=s.width,c(qo(y.data,p))}});throw new Error("Input data provided is not supported - aborted tensor creation")}{let c,r;if(e!==void 0&&e.resizedWidth!==void 0&&e.resizedHeight!==void 0?(c=e.resizedHeight,r=e.resizedWidth):(c=t.height,r=t.width),e!==void 0&&(p=e),p.format="RGBA",p.height=c,p.width=r,e!==void 0){let s=h();s.width=r,s.height=c;let u=n(s);if(u==null)throw new Error("Can not access image data");u.putImageData(t,0,0),o=u.getImageData(0,0,r,c).data}else o=t.data}}if(o!==void 0)return qo(o,p);throw new Error("Input data provided is not supported - aborted tensor creation")},ts=(t,e)=>{let{width:o,height:a,download:l,dispose:f}=e;return new Xe({location:"texture",type:"float32",texture:t,dims:[1,a,o,4],download:l,dispose:f})},rs=(t,e)=>{let{dataType:o,dims:a,download:l,dispose:f}=e;return new Xe({location:"gpu-buffer",type:o??"float32",gpuBuffer:t,dims:a,download:l,dispose:f})},ns=(t,e,o)=>new Xe({location:"cpu-pinned",type:t,data:e,dims:o??[e.length]})}),ar,tn,is,as,ss=E(()=>{ar=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),tn=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),is=!1,as=()=>{if(!is){is=!0;let t=typeof BigInt64Array<"u"&&BigInt64Array.from,e=typeof BigUint64Array<"u"&&BigUint64Array.from,o=typeof Float16Array<"u"&&Float16Array.from;t&&(ar.set("int64",BigInt64Array),tn.set(BigInt64Array,"int64")),e&&(ar.set("uint64",BigUint64Array),tn.set(BigUint64Array,"uint64")),o?(ar.set("float16",Float16Array),tn.set(Float16Array,"float16")):ar.set("float16",Uint16Array)}}}),us,ls,fs=E(()=>{$n(),us=t=>{let e=1;for(let o=0;o<t.length;o++){let a=t[o];if(typeof a!="number"||!Number.isSafeInteger(a))throw new TypeError(`dims[${o}] must be an integer, got: ${a}`);if(a<0)throw new RangeError(`dims[${o}] must be a non-negative integer, got: ${a}`);e*=a}return e},ls=(t,e)=>{switch(t.location){case"cpu":return new Xe(t.type,t.data,e);case"cpu-pinned":return new Xe({location:"cpu-pinned",data:t.data,type:t.type,dims:e});case"texture":return new Xe({location:"texture",texture:t.texture,type:t.type,dims:e});case"gpu-buffer":return new Xe({location:"gpu-buffer",gpuBuffer:t.gpuBuffer,type:t.type,dims:e});default:throw new Error(`tensorReshape: tensor location ${t.location} is not supported`)}}}),Xe,$n=E(()=>{Qa(),os(),ss(),fs(),Xe=class{constructor(t,e,o){let a,l;if(as(),typeof t=="object"&&"location"in t)switch(this.dataLocation=t.location,a=t.type,l=t.dims,t.location){case"cpu-pinned":{let d=ar.get(a);if(!d)throw new TypeError(`unsupported type "${a}" to create tensor from pinned buffer`);if(!(t.data instanceof d))throw new TypeError(`buffer should be of type ${d.name}`);this.cpuData=t.data;break}case"texture":if(a!=="float32")throw new TypeError(`unsupported type "${a}" to create tensor from texture`);this.gpuTextureData=t.texture,this.downloader=t.download,this.disposer=t.dispose;break;case"gpu-buffer":if(a!=="float32"&&a!=="float16"&&a!=="int32"&&a!=="int64"&&a!=="uint32"&&a!=="uint8"&&a!=="bool")throw new TypeError(`unsupported type "${a}" to create tensor from gpu buffer`);this.gpuBufferData=t.gpuBuffer,this.downloader=t.download,this.disposer=t.dispose;break;default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let d,p;
10if(typeof t=="string")if(a=t,p=o,t==="string"){if(!Array.isArray(e))throw new TypeError("A string tensor's data must be a string array.");d=e}else{let h=ar.get(t);if(h===void 0)throw new TypeError(`Unsupported tensor type: ${t}.`);if(Array.isArray(e)){if(t==="float16"&&h===Uint16Array)throw new TypeError("Creating a float16 tensor from number array is not supported. Please use Uint16Array as data.");d=t==="uint64"||t==="int64"?h.from(e,BigInt):h.from(e)}else{if(!(e instanceof h))throw new TypeError(`A ${a} tensor's data must be type of ${h}`);d=e}}else if(p=e,Array.isArray(t)){if(t.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let h=typeof t[0];if(h==="string")a="string",d=t;else{if(h!=="boolean")throw new TypeError(`Invalid element type of data array: ${h}.`);a="bool",d=Uint8Array.from(t)}}else{let h=tn.get(t.constructor);if(h===void 0)throw new TypeError(`Unsupported type for tensor data: ${t.constructor}.`);a=h,d=t}if(p===void 0)p=[d.length];else if(!Array.isArray(p))throw new TypeError("A tensor's dims must be a number array");l=p,this.cpuData=d,this.dataLocation="cpu"}let f=us(l);if(this.cpuData&&f!==this.cpuData.length)throw new Error(`Tensor's size(${f}) does not match data length(${this.cpuData.length}).`);this.type=a,this.dims=l,this.size=f}static async fromImage(t,e){return es(t,e)}static fromTexture(t,e){return ts(t,e)}static fromGpuBuffer(t,e){return rs(t,e)}static fromPinnedBuffer(t,e,o){return ns(t,e,o)}toDataURL(t){return Ja(this,t)}toImageData(t){return Za(this,t)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}async getData(t){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let e=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=e,t&&this.disposer&&(this.disposer(),this.disposer=void 0),e}finally{this.isDownloading=!1}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(t){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return ls(this,t)}}}),Re,kn=E(()=>{$n(),Re=Xe}),cs,ps,sr,ur,jo=E(()=>{Ho(),cs=(t,e)=>{(typeof it.trace>"u"?!it.wasm.trace:!it.trace)||console.timeStamp(`${t}::ORT::${e}`)},ps=(t,e)=>{var l;let o=((l=new Error().stack)==null?void 0:l.split(/\r\n|\r|\n/g))||[],a=!1;for(let f=0;f<o.length;f++){if(a&&!o[f].includes("TRACE_FUNC")){let d=`FUNC_${t}::${o[f].trim().split(" ")[1]}`;return e&&(d+=`::${e}`),void cs("CPU",d)}o[f].includes("TRACE_FUNC")&&(a=!0)}},sr=t=>{(typeof it.trace>"u"?!it.wasm.trace:!it.trace)||ps("BEGIN",t)},ur=t=>{(typeof it.trace>"u"?!it.wasm.trace:!it.trace)||ps("END",t)}}),Bn,ds=E(()=>{Cn(),kn(),jo(),Bn=class Uo{constructor(e){this.handler=e}async run(e,o,a){sr();let l={},f={};if(typeof e!="object"||e===null||e instanceof Re||Array.isArray(e))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let d=!0;if(typeof o=="object"){if(o===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(o instanceof Re)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(o)){if(o.length===0)throw new TypeError("'fetches' cannot be an empty array.");d=!1;
10for(let n of o){if(typeof n!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(n)===-1)throw new RangeError(`'fetches' contains invalid output name: ${n}.`);l[n]=null}if(typeof a=="object"&&a!==null)f=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else{let n=!1,c=Object.getOwnPropertyNames(o);for(let r of this.outputNames)if(c.indexOf(r)!==-1){let s=o[r];(s===null||s instanceof Re)&&(n=!0,d=!1,l[r]=s)}if(n){if(typeof a=="object"&&a!==null)f=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else f=o}}else if(typeof o<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let n of this.inputNames)if(typeof e[n]>"u")throw new Error(`input '${n}' is missing in 'feeds'.`);if(d)for(let n of this.outputNames)l[n]=null;let p=await this.handler.run(e,l,f),h={};for(let n in p)if(Object.hasOwnProperty.call(p,n)){let c=p[n];h[n]=c instanceof Re?c:new Re(c.type,c.data,c.dims)}return ur(),h}async release(){return this.handler.dispose()}static async create(e,o,a,l){sr();let f,d={};if(typeof e=="string"){if(f=e,typeof o=="object"&&o!==null)d=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(e instanceof Uint8Array){if(f=e,typeof o=="object"&&o!==null)d=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else{if(!(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer))throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");{let c=e,r=0,s=e.byteLength;if(typeof o=="object"&&o!==null)d=o;else if(typeof o=="number"){if(r=o,!Number.isSafeInteger(r))throw new RangeError("'byteOffset' must be an integer.");if(r<0||r>=c.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${c.byteLength}).`);if(s=e.byteLength-r,typeof a=="number"){if(s=a,!Number.isSafeInteger(s))throw new RangeError("'byteLength' must be an integer.");if(s<=0||r+s>c.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${c.byteLength-r}].`);if(typeof l=="object"&&l!==null)d=l;else if(typeof l<"u")throw new TypeError("'options' must be an object.")}else if(typeof a<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof o<"u")throw new TypeError("'options' must be an object.");f=new Uint8Array(c,r,s)}}let[p,h]=await Fn(d),n=await p.createInferenceSessionHandler(f,h);return ur(),new Uo(n)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}}),Dd,hs=E(()=>{ds(),Dd=Bn}),ms=E(()=>{}),bs=E(()=>{}),gs=E(()=>{}),ys=E(()=>{}),Ld,Nn,Ts=E(()=>{Cn(),kn(),Ld="Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.",Nn=class Vo{constructor(e,o,a){this.handler=e,this.hasOptimizerModel=o,this.hasEvalModel=a}get trainingInputNames(){return this.handler.inputNames}get trainingOutputNames(){return this.handler.outputNames}get evalInputNames(){if(this.hasEvalModel)return this.handler.evalInputNames;throw new Error("This training session has no evalModel loaded.")}get evalOutputNames(){if(this.hasEvalModel)return this.handler.evalOutputNames;throw new Error("This training session has no evalModel loaded.")}static async create(e,o){let a=e.evalModel||"",l=e.optimizerModel||"",f=o||{},[d,p]=await Fn(f);if(d.createTrainingSessionHandler){let h=await d.createTrainingSessionHandler(e.checkpointState,e.trainModel,a,l,p);return new Vo(h,!!e.optimizerModel,!!e.evalModel)}throw new Error(Ld)}typeNarrowingForRunStep(e,o,a,l,f){let d={},p={};if(typeof a!="object"||a===null||a instanceof Re||Array.isArray(a))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let h=!0;if(typeof l=="object"){if(l===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(l instanceof Re)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(l)){if(l.length===0)throw new TypeError("'fetches' cannot be an empty array.");h=!1;
10for(let n of l){if(typeof n!="string")throw new TypeError("'fetches' must be a string array or an object.");if(o.indexOf(n)===-1)throw new RangeError(`'fetches' contains invalid output name: ${n}.`);d[n]=null}if(typeof f=="object"&&f!==null)p=f;else if(typeof f<"u")throw new TypeError("'options' must be an object.")}else{let n=!1,c=Object.getOwnPropertyNames(l);for(let r of o)if(c.indexOf(r)!==-1){let s=l[r];(s===null||s instanceof Re)&&(n=!0,h=!1,d[r]=s)}if(n){if(typeof f=="object"&&f!==null)p=f;else if(typeof f<"u")throw new TypeError("'options' must be an object.")}else p=l}}else if(typeof l<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let n of e)if(typeof a[n]>"u")throw new Error(`input '${n}' is missing in 'feeds'.`);if(h)for(let n of o)d[n]=null;return[d,p]}convertHandlerReturnTypeToMapOfTensors(e){let o={};for(let a in e)if(Object.hasOwnProperty.call(e,a)){let l=e[a];o[a]=l instanceof Re?l:new Re(l.type,l.data,l.dims)}return o}async lazyResetGrad(){await this.handler.lazyResetGrad()}async runTrainStep(e,o,a){let[l,f]=this.typeNarrowingForRunStep(this.trainingInputNames,this.trainingOutputNames,e,o,a),d=await this.handler.runTrainStep(e,l,f);return this.convertHandlerReturnTypeToMapOfTensors(d)}async runOptimizerStep(e){if(!this.hasOptimizerModel)throw new Error("This TrainingSession has no OptimizerModel loaded.");await this.handler.runOptimizerStep(e||{})}async runEvalStep(e,o,a){if(this.hasEvalModel){let[l,f]=this.typeNarrowingForRunStep(this.evalInputNames,this.evalOutputNames,e,o,a),d=await this.handler.runEvalStep(e,l,f);return this.convertHandlerReturnTypeToMapOfTensors(d)}throw new Error("This TrainingSession has no EvalModel loaded.")}async getParametersSize(e=!0){return this.handler.getParametersSize(e)}async loadParametersBuffer(e,o=!0){let a=await this.getParametersSize(o);if(e.length!==4*a)throw new Error("Size of the buffer passed into loadParametersBuffer must match the number of parameters in the model. Please use getParametersSize method to check.");return this.handler.loadParametersBuffer(e,o)}async getContiguousParameters(e=!0){return this.handler.getContiguousParameters(e)}async release(){return this.handler.dispose()}}}),Fd,xs=E(()=>{Ts(),Fd=Nn}),Yo={};Pr(Yo,{InferenceSession:()=>Dd,TRACE:()=>cs,TRACE_FUNC_BEGIN:()=>sr,TRACE_FUNC_END:()=>ur,Tensor:()=>Re,TrainingSession:()=>Fd,env:()=>Z,registerBackend:()=>Dr});var Tt=E(()=>{qa(),Ka(),hs(),kn(),ms(),bs(),jo(),gs(),ys(),xs()});function jt(t,e,o,a){if(e===void 0)return $d(t);if(o===void 0)Rn(t,e);else if(typeof o=="number"&&a===void 0)Rn(t,e);else if(typeof o=="string"&&a===void 0)Rn(t,o,1,e);else{if(typeof o!="string"||typeof a!="number")throw new TypeError("input is valid");Rn(t,o,a,e)}}function $d(t){return{verbose:jt.verbose.bind(null,t),info:jt.info.bind(null,t),warning:jt.warning.bind(null,t),error:jt.error.bind(null,t),fatal:jt.fatal.bind(null,t)}}function Rn(t,e,o,a){let l=rn[a||""]||rn[""];vs[t]<vs[l.minimalSeverity]||(l.logDateTime&&(e=`${new Date().toISOString()}|${e}`),l.logSourceLocation,Cd[l.provider].log(t,e,a))}var Xo,Ko,vs,Cd,_s,rn,ce,Gn,Un,zn,Mn,at=E(()=>{Xo=class{log(t,e,o){}},Ko=class{log(t,e,o){console.log(`${this.color(t)} ${o?"\x1B[35m"+o+"\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 new Error(`unsupported severity: ${t}`)}}},vs={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},Cd={none:new Xo,console:new Ko},rn={"":_s={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1}},(t=>{function e(a){rn={},o("",a||{})}function o(a,l){if(a==="*")e(l);else{let f=rn[a]||_s;rn[a]={provider:l.provider||f.provider,minimalSeverity:l.minimalSeverity||f.minimalSeverity,logDateTime:l.logDateTime===void 0?f.logDateTime:l.logDateTime,logSourceLocation:l.logSourceLocation===void 0?f.logSourceLocation:l.logSourceLocation}}}t.verbose=function(a,l){t("verbose",a,l)},t.info=function(a,l){t("info",a,l)},t.warning=function(a,l){t("warning",a,l)},t.error=function(a,l){t("error",a,l)},t.fatal=function(a,l){t("fatal",a,l)},t.reset=e,t.set=o,t.setWithEnv=function(a){let l={};a.logLevel&&(l.minimalSeverity=a.logLevel),o("",l)}
10})(jt||(jt={})),ce=jt,Gn=class{constructor(t,e,o,a,l,f){this.category=t,this.name=e,this.startTime=o,this.endCallback=a,this.timer=l,this.ctx=f}async end(){return this.endCallback(this)}async checkTimer(){if(this.ctx===void 0||this.timer===void 0)throw new Error("No webgl timer found");return this.ctx.endTimer(),this.ctx.waitForQueryAndGetTime(this.timer)}},Un=class{constructor(t,e,o,a){this.category=t,this.name=e,this.startTime=o,this.endTime=a}},zn=class{constructor(t,e,o){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=t===void 0?1e4:t,this._flushBatchSize=e===void 0?10:e,this._flushIntervalInMilliseconds=o===void 0?5e3:o}static create(t){return t===void 0?new this:new this(t.maxNumberEvents,t.flushBatchSize,t.flushIntervalInMilliseconds)}start(){this._started=!0,this._timingEvents=[],this._flushTime=Mn(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer])}event(t,e,o,a){let l=this._started?this.begin(t,e,a):void 0,f=!1,d=o();if(d&&typeof d.then=="function")return f=!0,new Promise((p,h)=>{d.then(async n=>{l&&await l.end(),p(n)},async n=>{l&&await l.end(),h(n)})});if(!f&&l){let p=l.end();if(p&&typeof p.then=="function")return new Promise((h,n)=>{p.then(()=>{h(d)},c=>{n(c)})})}return d}begin(t,e,o){if(!this._started)throw new Error("profiler is not started yet");if(o===void 0){let a=Mn();return this.flush(a),new Gn(t,e,a,l=>this.endSync(l))}{let a=o.beginTimer();return new Gn(t,e,0,async l=>this.end(l),a,o)}}async end(t){let e=await t.checkTimer();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new Un(t.category,t.name,t.startTime,e)),this.flush(e))}endSync(t){let e=Mn();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new Un(t.category,t.name,t.startTime,e)),this.flush(e))}logOneEvent(t){ce.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 e=this._flushPointer;this._flushPointer<e+this._flushBatchSize&&this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer]);this._flushTime=Mn()}}get started(){return this._started}},Mn=typeof performance<"u"&&performance.now?()=>performance.now():Date.now});function Os(t,e,o){for(let a of o){let l=a[0],f=a[1],d=a[2],p=a[3],h=a[4];if(t.opType===l){for(let n of e)if((n.domain===f||n.domain==="ai.onnx"&&f==="")&&kd(n.version,d))return{opImpl:p,opInit:h}}}throw new TypeError(`cannot resolve operator '${t.opType}' with opsets: ${e.map(a=>`${a.domain||"ai.onnx"} v${a.version}`).join(", ")}`)}function kd(t,e){if(e.endsWith("+")){let o=Number.parseInt(e.substring(0,e.length-1),10);return!isNaN(o)&&o<=t}if(e.split("-").length===2){let o=e.split("-"),a=Number.parseInt(o[0],10),l=Number.parseInt(o[1],10);return!isNaN(a)&&!isNaN(l)&&a<=t&&t<=l}return Number.parseInt(e,10)===t}var Is=E(()=>{}),Ss=me(t=>{t.__esModule=!0;var e=function(){function o(a){if(!a)throw new TypeError("Invalid argument; `value` has no value.");this.value=o.EMPTY,a&&o.isGuid(a)&&(this.value=a)}return o.isGuid=function(a){var l=a.toString();return a&&(a instanceof o||o.validator.test(l))},o.create=function(){return new o([o.gen(2),o.gen(1),o.gen(1),o.gen(1),o.gen(3)].join("-"))},o.createEmpty=function(){return new o("emptyguid")},o.parse=function(a){return new o(a)},o.raw=function(){return[o.gen(2),o.gen(1),o.gen(1),o.gen(1),o.gen(3)].join("-")},o.gen=function(a){for(var l="",f=0;f<a;f++)l+=(65536*(1+Math.random())|0).toString(16).substring(1);return l},o.prototype.equals=function(a){return o.isGuid(a)&&this.value===a.toString()},o.prototype.isEmpty=function(){return this.value===o.EMPTY},o.prototype.toString=function(){return this.value},o.prototype.toJSON=function(){return{value:this.value}},o.validator=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i"),o.EMPTY="00000000-0000-0000-0000-000000000000",o}();t.Guid=e});function be(t,e,o){this.low=0|t,this.high=0|e,this.unsigned=!!o}function je(t){return(t&&t.__isLong__)===!0}function As(t){var e=Math.clz32(t&-t);return t?31-e:e}function lr(t,e){var o,a,l;return e?(l=0<=(t>>>=0)&&t<256)&&(a=Es[t])?a:(o=le(t,0,!0),l&&(Es[t]=o),o):(l=-128<=(t|=0)&&t<128)&&(a=Ps[t])?a:(o=le(t,t<0?-1:0,!1),l&&(Ps[t]=o),o)}function ut(t,e){if(isNaN(t))return e?Vt:xt;if(e){if(t<0)return Vt;if(t>=Cs)return Bs}
10else{if(t<=-Ls)return tt;if(t+1>=Ls)return ks}return t<0?ut(-t,e).neg():le(t%Fr|0,t/Fr|0,e)}function le(t,e,o){return new be(t,e,o)}function Qo(t,e,o){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(o=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?Vt:xt;if((o=o||10)<2||36<o)throw RangeError("radix");var a;if((a=t.indexOf("-"))>0)throw Error("interior hyphen");if(a===0)return Qo(t.substring(1),e,o).neg();for(var l=ut(Vn(o,8)),f=xt,d=0;d<t.length;d+=8){var p=Math.min(8,t.length-d),h=parseInt(t.substring(d,d+p),o);if(p<8){var n=ut(Vn(o,p));f=f.mul(n).add(ut(h))}else f=(f=f.mul(l)).add(ut(h))}return f.unsigned=e,f}function wt(t,e){return typeof t=="number"?ut(t,e):typeof t=="string"?Qo(t,e):le(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}var st,Ps,Es,Vn,Ds,Fr,Cs,Ls,Fs,xt,Vt,Lr,$s,Zo,ks,Bs,tt,$,Wt,ei=E(()=>{st=null;try{st=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{}be.prototype.__isLong__,Object.defineProperty(be.prototype,"__isLong__",{value:!0}),be.isLong=je,Ps={},Es={},be.fromInt=lr,be.fromNumber=ut,be.fromBits=le,Vn=Math.pow,be.fromString=Qo,be.fromValue=wt,Ls=(Cs=(Fr=(Ds=65536)*Ds)*Fr)/2,Fs=lr(1<<24),xt=lr(0),be.ZERO=xt,Vt=lr(0,!0),be.UZERO=Vt,Lr=lr(1),be.ONE=Lr,$s=lr(1,!0),be.UONE=$s,Zo=lr(-1),be.NEG_ONE=Zo,ks=le(-1,2147483647,!1),be.MAX_VALUE=ks,Bs=le(-1,-1,!0),be.MAX_UNSIGNED_VALUE=Bs,tt=le(0,-2147483648,!1),be.MIN_VALUE=tt,($=be.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},$.toNumber=function(){return this.unsigned?(this.high>>>0)*Fr+(this.low>>>0):this.high*Fr+(this.low>>>0)},$.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(tt)){var e=ut(t),o=this.div(e),a=o.mul(e).sub(this);return o.toString(t)+a.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var l=ut(Vn(t,6),this.unsigned),f=this,d="";;){var p=f.div(l),h=(f.sub(p.mul(l)).toInt()>>>0).toString(t);if((f=p).isZero())return h+d;for(;h.length<6;)h="0"+h;d=""+h+d}},$.getHighBits=function(){return this.high},$.getHighBitsUnsigned=function(){return this.high>>>0},$.getLowBits=function(){return this.low},$.getLowBitsUnsigned=function(){return this.low>>>0},$.getNumBitsAbs=function(){if(this.isNegative())return this.eq(tt)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,e=31;e>0&&!(t&1<<e);e--);return this.high!=0?e+33:e+1},$.isZero=function(){return this.high===0&&this.low===0},$.eqz=$.isZero,$.isNegative=function(){return!this.unsigned&&this.high<0},$.isPositive=function(){return this.unsigned||this.high>=0},$.isOdd=function(){return!(1&~this.low)},$.isEven=function(){return!(1&this.low)},$.equals=function(t){return je(t)||(t=wt(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},$.eq=$.equals,$.notEquals=function(t){return!this.eq(t)},$.neq=$.notEquals,$.ne=$.notEquals,$.lessThan=function(t){return this.comp(t)<0},$.lt=$.lessThan,$.lessThanOrEqual=function(t){return this.comp(t)<=0},$.lte=$.lessThanOrEqual,$.le=$.lessThanOrEqual,$.greaterThan=function(t){return this.comp(t)>0},$.gt=$.greaterThan,$.greaterThanOrEqual=function(t){return this.comp(t)>=0},$.gte=$.greaterThanOrEqual,$.ge=$.greaterThanOrEqual,$.compare=function(t){if(je(t)||(t=wt(t)),this.eq(t))return 0;var e=this.isNegative(),o=t.isNegative();return e&&!o?-1:!e&&o?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},$.comp=$.compare,$.negate=function(){return!this.unsigned&&this.eq(tt)?tt:this.not().add(Lr)},$.neg=$.negate,$.add=function(t){je(t)||(t=wt(t));var e=this.high>>>16,o=65535&this.high,a=this.low>>>16,l=65535&this.low,f=t.high>
10>>16,d=65535&t.high,p=t.low>>>16,h=0,n=0,c=0,r=0;return c+=(r+=l+(65535&t.low))>>>16,n+=(c+=a+p)>>>16,h+=(n+=o+d)>>>16,h+=e+f,le((c&=65535)<<16|(r&=65535),(h&=65535)<<16|(n&=65535),this.unsigned)},$.subtract=function(t){return je(t)||(t=wt(t)),this.add(t.neg())},$.sub=$.subtract,$.multiply=function(t){if(this.isZero())return this;if(je(t)||(t=wt(t)),st)return le(st.mul(this.low,this.high,t.low,t.high),st.get_high(),this.unsigned);if(t.isZero())return this.unsigned?Vt:xt;if(this.eq(tt))return t.isOdd()?tt:xt;if(t.eq(tt))return this.isOdd()?tt:xt;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(Fs)&&t.lt(Fs))return ut(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,o=65535&this.high,a=this.low>>>16,l=65535&this.low,f=t.high>>>16,d=65535&t.high,p=t.low>>>16,h=65535&t.low,n=0,c=0,r=0,s=0;return r+=(s+=l*h)>>>16,c+=(r+=a*h)>>>16,r&=65535,c+=(r+=l*p)>>>16,n+=(c+=o*h)>>>16,c&=65535,n+=(c+=a*p)>>>16,c&=65535,n+=(c+=l*d)>>>16,n+=e*h+o*p+a*d+l*f,le((r&=65535)<<16|(s&=65535),(n&=65535)<<16|(c&=65535),this.unsigned)},$.mul=$.multiply,$.divide=function(t){if(je(t)||(t=wt(t)),t.isZero())throw Error("division by zero");var e,o,a;if(st)return this.unsigned||this.high!==-2147483648||t.low!==-1||t.high!==-1?le((this.unsigned?st.div_u:st.div_s)(this.low,this.high,t.low,t.high),st.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Vt:xt;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Vt;if(t.gt(this.shru(1)))return $s;a=Vt}else{if(this.eq(tt))return t.eq(Lr)||t.eq(Zo)?tt:t.eq(tt)?Lr:(e=this.shr(1).div(t).shl(1)).eq(xt)?t.isNegative()?Lr:Zo:(o=this.sub(t.mul(e)),a=e.add(o.div(t)));if(t.eq(tt))return this.unsigned?Vt:xt;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();a=xt}for(o=this;o.gte(t);){e=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var l=Math.ceil(Math.log(e)/Math.LN2),f=l<=48?1:Vn(2,l-48),d=ut(e),p=d.mul(t);p.isNegative()||p.gt(o);)p=(d=ut(e-=f,this.unsigned)).mul(t);d.isZero()&&(d=Lr),a=a.add(d),o=o.sub(p)}return a},$.div=$.divide,$.modulo=function(t){return je(t)||(t=wt(t)),st?le((this.unsigned?st.rem_u:st.rem_s)(this.low,this.high,t.low,t.high),st.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},$.mod=$.modulo,$.rem=$.modulo,$.not=function(){return le(~this.low,~this.high,this.unsigned)},$.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},$.clz=$.countLeadingZeros,$.countTrailingZeros=function(){return this.low?As(this.low):As(this.high)+32},$.ctz=$.countTrailingZeros,$.and=function(t){return je(t)||(t=wt(t)),le(this.low&t.low,this.high&t.high,this.unsigned)},$.or=function(t){return je(t)||(t=wt(t)),le(this.low|t.low,this.high|t.high,this.unsigned)},$.xor=function(t){return je(t)||(t=wt(t)),le(this.low^t.low,this.high^t.high,this.unsigned)},$.shiftLeft=function(t){return je(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?le(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):le(0,this.low<<t-32,this.unsigned)},$.shl=$.shiftLeft,$.shiftRight=function(t){return je(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?le(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):le(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},$.shr=$.shiftRight,$.shiftRightUnsigned=function(t){return je(t)&&(t=t.toInt()),(t&=63)==0?this:t<32?le(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):le(t===32?this.high:this.high>>>t-32,0,this.unsigned)},$.shru=$.shiftRightUnsigned,$.shr_u=$.shiftRightUnsigned,$.rotateLeft=function(t){var e;return je(t)&&(t=t.toInt()),(t&=63)==0?this:t===32?le(this.high,this.low,this.unsigned):t<32?(e=32-t,le(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned)):(e=32-(t-=32),le(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned))},$.rotl=$.rotateLeft,$.rotateRight=function(t){var e;return je(t)&&(t=t.toInt()),(t&=63)==0?this:t===32?le(this.high,this.low,this.unsigned):t<32?(e=32-t,le(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned)):(e=32-(t-=32),le(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned))},$.rotr=$.rotateRight,$.toSigned=function(){return this.unsigned?le(this.low,this.high,!1):this},$.toUnsigned=function(){return this.unsigned?this:le(this.low,this.high,!0)},$.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},$.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]},$.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]},be.fromBytes=function(t,e,o){return o?be.fromBytesLE(t,e):be.fromBytesBE(t,e)},be.fromBytesLE=function(t,e){return new be(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},be.fromBytesBE=function(t,e){return new be(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)},Wt=be}),O,Wn=E(()=>{O={},O.Table,O.SIZEOF_SHORT=2,O.SIZEOF_INT=4,O.FILE_IDENTIFIER_LENGTH=4,O.SIZE_PREFIX_LENGTH=4,O.Encoding={UTF8_BYTES:1,UTF16_STRING:2},O.int32=new Int32Array(2),O.float32=new Float32Array(O.int32.buffer),O.float64=new Float64Array(O.int32.buffer),O.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,O.Long=function(t,e){this.low=0|t,this.high=0|e},O.Long.create=function(t,e){return t==0&&e==0?O.Long.ZERO:new O.Long(t,e)},O.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},O.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},O.Long.ZERO=new O.Long(0,0),O.Builder=function(t){if(t)var e=t;else e=1024;this.bb=O.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},O.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},O.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},O.Builder.prototype.dataBuffer=function(){return this.bb},O.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},O.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var o=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<o+t+e;){var a=this.bb.capacity();this.bb=O.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-a}this.pad(o)},O.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},O.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},O.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},O.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},O.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},O.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},O.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},O.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},O.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},O.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},O.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},O.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},O.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},O.Builder.prototype.addFieldInt8=function(t,e,o){(this.force_defaults||e!=o)&&(this.addInt8(e),this.slot(t))},O.Builder.prototype.addFieldInt16=function(t,e,o){(this.force_defaults||e!=o)&&(this.addInt16(e),this.slot(t))},O.Builder.prototype.addFieldInt32=function(t,e,o){(this.force_defaults||e!=o)&&(this.addInt32(e),this.slot(t))},O.Builder.prototype.addFieldInt64=function(t,e,o){(this.force_defaults||!e.equals(o))&&(this.addInt64(e),this.slot(t))},O.Builder.prototype.addFieldFloat32=function(t,e,o){(this.force_defaults||e!=o)&&(this.addFloat32(e),this.slot(t))},O.Builder.prototype.addFieldFloat64=function(t,e,o){(this.force_defaults||e!=o)&&(this.addFloat64(e),this.slot(t))},O.Builder.prototype.addFieldOffset=function(t,e,o){(this.force_defaults||e!=o)&&(this.addOffset(e),this.slot(t))},O.Builder.prototype.addFieldStruct=function(t,e,o){e!=o&&(this.nested(e),this.slot(t))},O.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},O.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},O.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},O.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},O.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var o=e<<1,a=O.ByteBuffer.allocate(o);return a.setPosition(o-e),a.bytes().set(t.bytes(),o-e),a},O.Builder.prototype.addOffset=function(t){this.prep(O.SIZEOF_INT,0),this.writeInt32(this.offset()-t+O.SIZEOF_INT)},O.Builder.prototype.startObject=function(t){this.notNested(),this.vtable==null&&(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()},O.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&this.vtable[e]==0;e--);for(var o=e+1;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var a=(o+2)*O.SIZEOF_SHORT;this.addInt16(a);var l=0,f=this.space;t:for(e=0;e<this.vtables.length;e++){var d=this.bb.capacity()-this.vtables[e];if(a==this.bb.readInt16(d)){for(var p=O.SIZEOF_SHORT;p<a;p+=O.SIZEOF_SHORT)if(this.bb.readInt16(f+p)!=this.bb.readInt16(d+p))continue t;l=this.vtables[e];break}}return l?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,l-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},O.Builder.prototype.finish=function(t,e,o){var a=o?O.SIZE_PREFIX_LENGTH:0;
vendor: 4,671 bytes, line 10
10if(e){var l=e;if(this.prep(this.minalign,O.SIZEOF_INT+O.FILE_IDENTIFIER_LENGTH+a),l.length!=O.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+O.FILE_IDENTIFIER_LENGTH);for(var f=O.FILE_IDENTIFIER_LENGTH-1;f>=0;f--)this.writeInt8(l.charCodeAt(f))}this.prep(this.minalign,O.SIZEOF_INT+a),this.addOffset(t),a&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},O.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},O.Builder.prototype.requiredField=function(t,e){var o=this.bb.capacity()-t,a=o-this.bb.readInt32(o);if(this.bb.readInt16(a+e)==0)throw new Error("FlatBuffers: field "+e+" must be set")},O.Builder.prototype.startVector=function(t,e,o){this.notNested(),this.vector_num_elems=e,this.prep(O.SIZEOF_INT,t*e),this.prep(o,t*e)},O.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},O.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var o=0;o<t.length;){var a,l=t.charCodeAt(o++);l<55296||l>=56320?a=l:a=(l<<10)+t.charCodeAt(o++)+-56613888,a<128?e.push(a):(a<2048?e.push(a>>6&31|192):(a<65536?e.push(a>>12&15|224):e.push(a>>18&7|240,a>>12&63|128),e.push(a>>6&63|128)),e.push(63&a|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),o=0;for(var f=this.space,d=this.bb.bytes();o<e.length;o++)d[f++]=e[o];return this.endVector()},O.Builder.prototype.createLong=function(t,e){return O.Long.create(t,e)},O.ByteBuffer=function(t){this.bytes_=t,this.position_=0},O.ByteBuffer.allocate=function(t){return new O.ByteBuffer(new Uint8Array(t))},O.ByteBuffer.prototype.clear=function(){this.position_=0},O.ByteBuffer.prototype.bytes=function(){return this.bytes_},O.ByteBuffer.prototype.position=function(){return this.position_},O.ByteBuffer.prototype.setPosition=function(t){this.position_=t},O.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},O.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},O.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},O.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},O.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},O.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},O.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},O.ByteBuffer.prototype.readInt64=function(t){return new O.Long(this.readInt32(t),this.readInt32(t+4))},O.ByteBuffer.prototype.readUint64=function(t){return new O.Long(this.readUint32(t),this.readUint32(t+4))},O.ByteBuffer.prototype.readFloat32=function(t){return O.int32[0]=this.readInt32(t),O.float32[0]},O.ByteBuffer.prototype.readFloat64=function(t){return O.int32[O.isLittleEndian?0:1]=this.readInt32(t),O.int32[O.isLittleEndian?1:0]=this.readInt32(t+4),O.float64[0]},O.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},O.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},O.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},O.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},O.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},O.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},O.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},O.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},O.ByteBuffer.prototype.writeFloat32=function(t,e){O.float32[0]=e,this.writeInt32(t,O.int32[0])},O.ByteBuffer.prototype.writeFloat64=function(t,e){O.float64[0]=e,this.writeInt32(t,O.int32[O.isLittleEndian?0:1]),this.writeInt32(t+4,O.int32[O.isLittleEndian?1:0])},O.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+O.SIZEOF_INT+O.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<O.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+O.SIZEOF_INT+e));return t},O.ByteBuffer.prototype.__offset=function(t,e){var o=t-this.readInt32(t);return e<this.readInt16(o)?this.readInt16(o+e):0},O.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},O.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var o=this.readInt32(t),a="",l=0;
10if(t+=O.SIZEOF_INT,e===O.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+o);for(;l<o;){var f,d=this.readUint8(t+l++);if(d<192)f=d;else{var p=this.readUint8(t+l++);if(d<224)f=(31&d)<<6|63&p;else{var h=this.readUint8(t+l++);d<240?f=(15&d)<<12|(63&p)<<6|63&h:f=(7&d)<<18|(63&p)<<12|(63&h)<<6|63&this.readUint8(t+l++)}}f<65536?a+=String.fromCharCode(f):(f-=65536,a+=String.fromCharCode(55296+(f>>10),56320+(1023&f)))}return a},O.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},O.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+O.SIZEOF_INT},O.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},O.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=O.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+O.FILE_IDENTIFIER_LENGTH);for(var e=0;e<O.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+O.SIZEOF_INT+e))return!1;return!0},O.ByteBuffer.prototype.createLong=function(t,e){return O.Long.create(t,e)}}),W,nn=E(()=>{var t,e,o,a;Wn(),t=W||(W={}),e=t.experimental||(t.experimental={}),o=e.fbs||(e.fbs={}),(a=o.AttributeType||(o.AttributeType={}))[a.UNDEFINED=0]="UNDEFINED",a[a.FLOAT=1]="FLOAT",a[a.INT=2]="INT",a[a.STRING=3]="STRING",a[a.TENSOR=4]="TENSOR",a[a.GRAPH=5]="GRAPH",a[a.FLOATS=6]="FLOATS",a[a.INTS=7]="INTS",a[a.STRINGS=8]="STRINGS",a[a.TENSORS=9]="TENSORS",a[a.GRAPHS=10]="GRAPHS",a[a.SPARSE_TENSOR=11]="SPARSE_TENSOR",a[a.SPARSE_TENSORS=12]="SPARSE_TENSORS",(l=>{(f=>{(d=>{var p;(p=d.DimensionValueType||(d.DimensionValueType={}))[p.UNKNOWN=0]="UNKNOWN",p[p.VALUE=1]="VALUE",p[p.PARAM=2]="PARAM"})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{var p;(p=d.TensorDataType||(d.TensorDataType={}))[p.UNDEFINED=0]="UNDEFINED",p[p.FLOAT=1]="FLOAT",p[p.UINT8=2]="UINT8",p[p.INT8=3]="INT8",p[p.UINT16=4]="UINT16",p[p.INT16=5]="INT16",p[p.INT32=6]="INT32",p[p.INT64=7]="INT64",p[p.STRING=8]="STRING",p[p.BOOL=9]="BOOL",p[p.FLOAT16=10]="FLOAT16",p[p.DOUBLE=11]="DOUBLE",p[p.UINT32=12]="UINT32",p[p.UINT64=13]="UINT64",p[p.COMPLEX64=14]="COMPLEX64",p[p.COMPLEX128=15]="COMPLEX128",p[p.BFLOAT16=16]="BFLOAT16",p[p.FLOAT8E4M3FN=17]="FLOAT8E4M3FN",p[p.FLOAT8E4M3FNUZ=18]="FLOAT8E4M3FNUZ",p[p.FLOAT8E5M2=19]="FLOAT8E5M2",p[p.FLOAT8E5M2FNUZ=20]="FLOAT8E5M2FNUZ"})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{var p;(p=d.NodeType||(d.NodeType={}))[p.Primitive=0]="Primitive",p[p.Fused=1]="Fused"})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{var p;(p=d.TypeInfoValue||(d.TypeInfoValue={}))[p.NONE=0]="NONE",p[p.tensor_type=1]="tensor_type",p[p.sequence_type=2]="sequence_type",p[p.map_type=3]="map_type"})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsShape(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsShape(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}dim(n,c){let r=this.bb.__offset(this.bb_pos,4);return r?(c||new l.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}dimLength(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__vector_len(this.bb_pos+n):0}static startShape(n){n.startObject(1)}static addDim(n,c){n.addFieldOffset(0,c,0)}static createDimVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startDimVector(n,c){n.startVector(4,c,4)}static endShape(n){return n.endObject()}static createShape(n,c){return p.startShape(n),p.addDim(n,c),p.endShape(n)}}d.Shape=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsDimension(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimension(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}value(n){let c=this.bb.__offset(this.bb_pos,4);return c?(n||new l.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}denotation(n){let c=this.bb.__offset(this.bb_pos,6);return c?this.bb.__string(this.bb_pos+c,n):null}static startDimension(n){n.startObject(2)}static addValue(n,c){n.addFieldOffset(0,c,0)}static addDenotation(n,c){n.addFieldOffset(1,c,0)}static endDimension(n){return n.endObject()}static createDimension(n,c,r){return p.startDimension(n),p.addValue(n,c),p.addDenotation(n,r),p.endDimension(n)}}d.Dimension=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsDimensionValue(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimensionValue(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}dimType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt8(this.bb_pos+n):0}dimValue(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}dimParam(n){let c=this.bb.__offset(this.bb_pos,8);return c?this.bb.__string(this.bb_pos+c,n):null}static startDimensionValue(n){n.startObject(3)}static addDimType(n,c){n.addFieldInt8(0,c,0)}static addDimValue(n,c){n.addFieldInt64(1,c,n.createLong(0,0))}static addDimParam(n,c){n.addFieldOffset(2,c,0)}static endDimensionValue(n){return n.endObject()}static createDimensionValue(n,c,r,s){return p.startDimensionValue(n),p.addDimType(n,c),p.addDimValue(n,r),p.addDimParam(n,s),p.endDimensionValue(n)}}d.DimensionValue=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsTensorTypeAndShape(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensorTypeAndShape(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}elemType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt32(this.bb_pos+n):0}shape(n){let c=this.bb.__offset(this.bb_pos,6);return c?(n||new l.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}static startTensorTypeAndShape(n){n.startObject(2)}static addElemType(n,c){n.addFieldInt32(0,c,0)}static addShape(n,c){n.addFieldOffset(1,c,0)}static endTensorTypeAndShape(n){return n.endObject()}static createTensorTypeAndShape(n,c,r){return p.startTensorTypeAndShape(n),p.addElemType(n,c),p.addShape(n,r),p.endTensorTypeAndShape(n)}}d.TensorTypeAndShape=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsMapType(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsMapType(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}keyType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt32(this.bb_pos+n):0}valueType(n){let c=this.bb.__offset(this.bb_pos,6);return c?(n||new l.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}static startMapType(n){n.startObject(2)}static addKeyType(n,c){n.addFieldInt32(0,c,0)}static addValueType(n,c){n.addFieldOffset(1,c,0)}static endMapType(n){return n.endObject()}static createMapType(n,c,r){return p.startMapType(n),p.addKeyType(n,c),p.addValueType(n,r),p.endMapType(n)}}d.MapType=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsSequenceType(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSequenceType(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}elemType(n){let c=this.bb.__offset(this.bb_pos,4);return c?(n||new l.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}static startSequenceType(n){n.startObject(1)}static addElemType(n,c){n.addFieldOffset(0,c,0)}static endSequenceType(n){return n.endObject()}static createSequenceType(n,c){return p.startSequenceType(n),p.addElemType(n,c),p.endSequenceType(n)}}d.SequenceType=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{d.EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(p,h){return this.bb_pos=p,this.bb=h,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(p,h,n,c){return p.prep(4,12),p.writeInt32(c),p.writeInt32(n),p.writeInt32(h),p.offset()}}})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsNodeEdge(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNodeEdge(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}nodeIndex(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readUint32(this.bb_pos+n):0}inputEdges(n,c){let r=this.bb.__offset(this.bb_pos,6);return r?(c||new l.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*n,this.bb):null}inputEdgesLength(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__vector_len(this.bb_pos+n):0}outputEdges(n,c){let r=this.bb.__offset(this.bb_pos,8);return r?(c||new l.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*n,this.bb):null}outputEdgesLength(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__vector_len(this.bb_pos+n):0}static startNodeEdge(n){n.startObject(3)}static addNodeIndex(n,c){n.addFieldInt32(0,c,0)}static addInputEdges(n,c){n.addFieldOffset(1,c,0)}static startInputEdgesVector(n,c){n.startVector(12,c,4)}
10static addOutputEdges(n,c){n.addFieldOffset(2,c,0)}static startOutputEdgesVector(n,c){n.startVector(12,c,4)}static endNodeEdge(n){return n.endObject()}static createNodeEdge(n,c,r,s){return p.startNodeEdge(n),p.addNodeIndex(n,c),p.addInputEdges(n,r),p.addOutputEdges(n,s),p.endNodeEdge(n)}}d.NodeEdge=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsNode(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNode(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}name(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}docString(n){let c=this.bb.__offset(this.bb_pos,6);return c?this.bb.__string(this.bb_pos+c,n):null}domain(n){let c=this.bb.__offset(this.bb_pos,8);return c?this.bb.__string(this.bb_pos+c,n):null}sinceVersion(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt32(this.bb_pos+n):0}index(){let n=this.bb.__offset(this.bb_pos,12);return n?this.bb.readUint32(this.bb_pos+n):0}opType(n){let c=this.bb.__offset(this.bb_pos,14);return c?this.bb.__string(this.bb_pos+c,n):null}type(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.readInt32(this.bb_pos+n):0}executionProviderType(n){let c=this.bb.__offset(this.bb_pos,18);return c?this.bb.__string(this.bb_pos+c,n):null}inputs(n,c){let r=this.bb.__offset(this.bb_pos,20);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*n,c):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,20);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,c){let r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*n,c):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,22);return n?this.bb.__vector_len(this.bb_pos+n):0}attributes(n,c){let r=this.bb.__offset(this.bb_pos,24);return r?(c||new l.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}attributesLength(){let n=this.bb.__offset(this.bb_pos,24);return n?this.bb.__vector_len(this.bb_pos+n):0}inputArgCounts(n){let c=this.bb.__offset(this.bb_pos,26);return c?this.bb.readInt32(this.bb.__vector(this.bb_pos+c)+4*n):0}inputArgCountsLength(){let n=this.bb.__offset(this.bb_pos,26);return n?this.bb.__vector_len(this.bb_pos+n):0}inputArgCountsArray(){let n=this.bb.__offset(this.bb_pos,26);return n?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+n),this.bb.__vector_len(this.bb_pos+n)):null}implicitInputs(n,c){let r=this.bb.__offset(this.bb_pos,28);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*n,c):null}implicitInputsLength(){let n=this.bb.__offset(this.bb_pos,28);return n?this.bb.__vector_len(this.bb_pos+n):0}static startNode(n){n.startObject(13)}static addName(n,c){n.addFieldOffset(0,c,0)}static addDocString(n,c){n.addFieldOffset(1,c,0)}static addDomain(n,c){n.addFieldOffset(2,c,0)}static addSinceVersion(n,c){n.addFieldInt32(3,c,0)}static addIndex(n,c){n.addFieldInt32(4,c,0)}static addOpType(n,c){n.addFieldOffset(5,c,0)}static addType(n,c){n.addFieldInt32(6,c,0)}static addExecutionProviderType(n,c){n.addFieldOffset(7,c,0)}static addInputs(n,c){n.addFieldOffset(8,c,0)}static createInputsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startInputsVector(n,c){n.startVector(4,c,4)}static addOutputs(n,c){n.addFieldOffset(9,c,0)}static createOutputsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startOutputsVector(n,c){n.startVector(4,c,4)}static addAttributes(n,c){n.addFieldOffset(10,c,0)}static createAttributesVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startAttributesVector(n,c){n.startVector(4,c,4)}static addInputArgCounts(n,c){n.addFieldOffset(11,c,0)}static createInputArgCountsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addInt32(c[r]);return n.endVector()}static startInputArgCountsVector(n,c){n.startVector(4,c,4)}
vendor: 11,686 bytes, line 10
10static addImplicitInputs(n,c){n.addFieldOffset(12,c,0)}static createImplicitInputsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startImplicitInputsVector(n,c){n.startVector(4,c,4)}static endNode(n){return n.endObject()}static createNode(n,c,r,s,u,g,y,S,A,L,z,et,Y,X){return p.startNode(n),p.addName(n,c),p.addDocString(n,r),p.addDomain(n,s),p.addSinceVersion(n,u),p.addIndex(n,g),p.addOpType(n,y),p.addType(n,S),p.addExecutionProviderType(n,A),p.addInputs(n,L),p.addOutputs(n,z),p.addAttributes(n,et),p.addInputArgCounts(n,Y),p.addImplicitInputs(n,X),p.endNode(n)}}d.Node=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsValueInfo(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsValueInfo(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}name(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}docString(n){let c=this.bb.__offset(this.bb_pos,6);return c?this.bb.__string(this.bb_pos+c,n):null}type(n){let c=this.bb.__offset(this.bb_pos,8);return c?(n||new l.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}static startValueInfo(n){n.startObject(3)}static addName(n,c){n.addFieldOffset(0,c,0)}static addDocString(n,c){n.addFieldOffset(1,c,0)}static addType(n,c){n.addFieldOffset(2,c,0)}static endValueInfo(n){return n.endObject()}static createValueInfo(n,c,r,s){return p.startValueInfo(n),p.addName(n,c),p.addDocString(n,r),p.addType(n,s),p.endValueInfo(n)}}d.ValueInfo=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsTypeInfo(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTypeInfo(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}denotation(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}valueType(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readUint8(this.bb_pos+n):0}value(n){let c=this.bb.__offset(this.bb_pos,8);return c?this.bb.__union(n,this.bb_pos+c):null}static startTypeInfo(n){n.startObject(3)}static addDenotation(n,c){n.addFieldOffset(0,c,0)}static addValueType(n,c){n.addFieldInt8(1,c,0)}static addValue(n,c){n.addFieldOffset(2,c,0)}static endTypeInfo(n){return n.endObject()}static createTypeInfo(n,c,r,s){return p.startTypeInfo(n),p.addDenotation(n,c),p.addValueType(n,r),p.addValue(n,s),p.endTypeInfo(n)}}d.TypeInfo=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsOperatorSetId(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsOperatorSetId(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}domain(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}version(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}static startOperatorSetId(n){n.startObject(2)}static addDomain(n,c){n.addFieldOffset(0,c,0)}static addVersion(n,c){n.addFieldInt64(1,c,n.createLong(0,0))}static endOperatorSetId(n){return n.endObject()}static createOperatorSetId(n,c,r){return p.startOperatorSetId(n),p.addDomain(n,c),p.addVersion(n,r),p.endOperatorSetId(n)}}d.OperatorSetId=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsTensor(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensor(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}name(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}docString(n){let c=this.bb.__offset(this.bb_pos,6);return c?this.bb.__string(this.bb_pos+c,n):null}dims(n){let c=this.bb.__offset(this.bb_pos,8);return c?this.bb.readInt64(this.bb.__vector(this.bb_pos+c)+8*n):this.bb.createLong(0,0)}dimsLength(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__vector_len(this.bb_pos+n):0}dataType(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt32(this.bb_pos+n):0}rawData(n){let c=this.bb.__offset(this.bb_pos,12);return c?this.bb.readUint8(this.bb.__vector(this.bb_pos+c)+n):0}rawDataLength(){let n=this.bb.__offset(this.bb_pos,12);return n?this.bb.__vector_len(this.bb_pos+n):0}rawDataArray(){let n=this.bb.__offset(this.bb_pos,12);return n?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+n),this.bb.__vector_len(this.bb_pos+n)):null}stringData(n,c){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*n,c):null}stringDataLength(){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__vector_len(this.bb_pos+n):0}static startTensor(n){n.startObject(6)}static addName(n,c){n.addFieldOffset(0,c,0)}static addDocString(n,c){n.addFieldOffset(1,c,0)}static addDims(n,c){n.addFieldOffset(2,c,0)}static createDimsVector(n,c){n.startVector(8,c.length,8);for(let r=c.length-1;r>=0;r--)n.addInt64(c[r]);return n.endVector()}static startDimsVector(n,c){n.startVector(8,c,8)}static addDataType(n,c){n.addFieldInt32(3,c,0)}static addRawData(n,c){n.addFieldOffset(4,c,0)}static createRawDataVector(n,c){n.startVector(1,c.length,1);for(let r=c.length-1;r>=0;r--)n.addInt8(c[r]);return n.endVector()}static startRawDataVector(n,c){n.startVector(1,c,1)}static addStringData(n,c){n.addFieldOffset(5,c,0)}static createStringDataVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startStringDataVector(n,c){n.startVector(4,c,4)}static endTensor(n){return n.endObject()}static createTensor(n,c,r,s,u,g,y){return p.startTensor(n),p.addName(n,c),p.addDocString(n,r),p.addDims(n,s),p.addDataType(n,u),p.addRawData(n,g),p.addStringData(n,y),p.endTensor(n)}}d.Tensor=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsSparseTensor(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSparseTensor(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}values(n){let c=this.bb.__offset(this.bb_pos,4);return c?(n||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}indices(n){let c=this.bb.__offset(this.bb_pos,6);return c?(n||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}dims(n){let c=this.bb.__offset(this.bb_pos,8);return c?this.bb.readInt64(this.bb.__vector(this.bb_pos+c)+8*n):this.bb.createLong(0,0)}dimsLength(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__vector_len(this.bb_pos+n):0}static startSparseTensor(n){n.startObject(3)}static addValues(n,c){n.addFieldOffset(0,c,0)}static addIndices(n,c){n.addFieldOffset(1,c,0)}static addDims(n,c){n.addFieldOffset(2,c,0)}static createDimsVector(n,c){n.startVector(8,c.length,8);for(let r=c.length-1;r>=0;r--)n.addInt64(c[r]);return n.endVector()}static startDimsVector(n,c){n.startVector(8,c,8)}static endSparseTensor(n){return n.endObject()}static createSparseTensor(n,c,r,s){return p.startSparseTensor(n),p.addValues(n,c),p.addIndices(n,r),p.addDims(n,s),p.endSparseTensor(n)}}d.SparseTensor=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsAttribute(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsAttribute(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}name(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}docString(n){let c=this.bb.__offset(this.bb_pos,6);return c?this.bb.__string(this.bb_pos+c,n):null}type(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.readInt32(this.bb_pos+n):0}f(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readFloat32(this.bb_pos+n):0}i(){let n=this.bb.__offset(this.bb_pos,12);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}s(n){let c=this.bb.__offset(this.bb_pos,14);return c?this.bb.__string(this.bb_pos+c,n):null}t(n){let c=this.bb.__offset(this.bb_pos,16);return c?(n||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}g(n){let c=this.bb.__offset(this.bb_pos,18);return c?(n||new l.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}floats(n){let c=this.bb.__offset(this.bb_pos,20);return c?this.bb.readFloat32(this.bb.__vector(this.bb_pos+c)+4*n):0}floatsLength(){let n=this.bb.__offset(this.bb_pos,20);return n?this.bb.__vector_len(this.bb_pos+n):0}floatsArray(){let n=this.bb.__offset(this.bb_pos,20);return n?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+n),this.bb.__vector_len(this.bb_pos+n)):null}ints(n){let c=this.bb.__offset(this.bb_pos,22);return c?this.bb.readInt64(this.bb.__vector(this.bb_pos+c)+8*n):this.bb.createLong(0,0)}intsLength(){let n=this.bb.__offset(this.bb_pos,22);return n?this.bb.__vector_len(this.bb_pos+n):0}strings(n,c){let r=this.bb.__offset(this.bb_pos,24);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*n,c):null}stringsLength(){let n=this.bb.__offset(this.bb_pos,24);return n?this.bb.__vector_len(this.bb_pos+n):0}tensors(n,c){let r=this.bb.__offset(this.bb_pos,26);return r?(c||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}tensorsLength(){let n=this.bb.__offset(this.bb_pos,26);return n?this.bb.__vector_len(this.bb_pos+n):0}graphs(n,c){let r=this.bb.__offset(this.bb_pos,28);return r?(c||new l.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}graphsLength(){let n=this.bb.__offset(this.bb_pos,28);return n?this.bb.__vector_len(this.bb_pos+n):0}static startAttribute(n){n.startObject(13)}static addName(n,c){n.addFieldOffset(0,c,0)}static addDocString(n,c){n.addFieldOffset(1,c,0)}static addType(n,c){n.addFieldInt32(2,c,0)}static addF(n,c){n.addFieldFloat32(3,c,0)}static addI(n,c){n.addFieldInt64(4,c,n.createLong(0,0))}static addS(n,c){n.addFieldOffset(5,c,0)}static addT(n,c){n.addFieldOffset(6,c,0)}static addG(n,c){n.addFieldOffset(7,c,0)}static addFloats(n,c){n.addFieldOffset(8,c,0)}static createFloatsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addFloat32(c[r]);return n.endVector()}static startFloatsVector(n,c){n.startVector(4,c,4)}static addInts(n,c){n.addFieldOffset(9,c,0)}static createIntsVector(n,c){n.startVector(8,c.length,8);for(let r=c.length-1;r>=0;r--)n.addInt64(c[r]);return n.endVector()}static startIntsVector(n,c){n.startVector(8,c,8)}
10static addStrings(n,c){n.addFieldOffset(10,c,0)}static createStringsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startStringsVector(n,c){n.startVector(4,c,4)}static addTensors(n,c){n.addFieldOffset(11,c,0)}static createTensorsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startTensorsVector(n,c){n.startVector(4,c,4)}static addGraphs(n,c){n.addFieldOffset(12,c,0)}static createGraphsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startGraphsVector(n,c){n.startVector(4,c,4)}static endAttribute(n){return n.endObject()}static createAttribute(n,c,r,s,u,g,y,S,A,L,z,et,Y,X){return p.startAttribute(n),p.addName(n,c),p.addDocString(n,r),p.addType(n,s),p.addF(n,u),p.addI(n,g),p.addS(n,y),p.addT(n,S),p.addG(n,A),p.addFloats(n,L),p.addInts(n,z),p.addStrings(n,et),p.addTensors(n,Y),p.addGraphs(n,X),p.endAttribute(n)}}d.Attribute=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsGraph(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsGraph(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}initializers(n,c){let r=this.bb.__offset(this.bb_pos,4);return r?(c||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}initializersLength(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__vector_len(this.bb_pos+n):0}nodeArgs(n,c){let r=this.bb.__offset(this.bb_pos,6);return r?(c||new l.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}nodeArgsLength(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__vector_len(this.bb_pos+n):0}nodes(n,c){let r=this.bb.__offset(this.bb_pos,8);return r?(c||new l.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}nodesLength(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__vector_len(this.bb_pos+n):0}maxNodeIndex(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readUint32(this.bb_pos+n):0}nodeEdges(n,c){let r=this.bb.__offset(this.bb_pos,12);return r?(c||new l.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}nodeEdgesLength(){let n=this.bb.__offset(this.bb_pos,12);return n?this.bb.__vector_len(this.bb_pos+n):0}inputs(n,c){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*n,c):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,c){let r=this.bb.__offset(this.bb_pos,16);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*n,c):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.__vector_len(this.bb_pos+n):0}sparseInitializers(n,c){let r=this.bb.__offset(this.bb_pos,18);return r?(c||new l.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}sparseInitializersLength(){let n=this.bb.__offset(this.bb_pos,18);return n?this.bb.__vector_len(this.bb_pos+n):0}static startGraph(n){n.startObject(8)}static addInitializers(n,c){n.addFieldOffset(0,c,0)}static createInitializersVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startInitializersVector(n,c){n.startVector(4,c,4)}static addNodeArgs(n,c){n.addFieldOffset(1,c,0)}static createNodeArgsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startNodeArgsVector(n,c){n.startVector(4,c,4)}static addNodes(n,c){n.addFieldOffset(2,c,0)}static createNodesVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startNodesVector(n,c){n.startVector(4,c,4)}static addMaxNodeIndex(n,c){n.addFieldInt32(3,c,0)}
10static addNodeEdges(n,c){n.addFieldOffset(4,c,0)}static createNodeEdgesVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startNodeEdgesVector(n,c){n.startVector(4,c,4)}static addInputs(n,c){n.addFieldOffset(5,c,0)}static createInputsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startInputsVector(n,c){n.startVector(4,c,4)}static addOutputs(n,c){n.addFieldOffset(6,c,0)}static createOutputsVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startOutputsVector(n,c){n.startVector(4,c,4)}static addSparseInitializers(n,c){n.addFieldOffset(7,c,0)}static createSparseInitializersVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startSparseInitializersVector(n,c){n.startVector(4,c,4)}static endGraph(n){return n.endObject()}static createGraph(n,c,r,s,u,g,y,S,A){return p.startGraph(n),p.addInitializers(n,c),p.addNodeArgs(n,r),p.addNodes(n,s),p.addMaxNodeIndex(n,u),p.addNodeEdges(n,g),p.addInputs(n,y),p.addOutputs(n,S),p.addSparseInitializers(n,A),p.endGraph(n)}}d.Graph=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsModel(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsModel(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}irVersion(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}opsetImport(n,c){let r=this.bb.__offset(this.bb_pos,6);return r?(c||new l.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}opsetImportLength(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__vector_len(this.bb_pos+n):0}producerName(n){let c=this.bb.__offset(this.bb_pos,8);return c?this.bb.__string(this.bb_pos+c,n):null}producerVersion(n){let c=this.bb.__offset(this.bb_pos,10);return c?this.bb.__string(this.bb_pos+c,n):null}domain(n){let c=this.bb.__offset(this.bb_pos,12);return c?this.bb.__string(this.bb_pos+c,n):null}modelVersion(){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}docString(n){let c=this.bb.__offset(this.bb_pos,16);return c?this.bb.__string(this.bb_pos+c,n):null}graph(n){let c=this.bb.__offset(this.bb_pos,18);return c?(n||new l.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}graphDocString(n){let c=this.bb.__offset(this.bb_pos,20);return c?this.bb.__string(this.bb_pos+c,n):null}static startModel(n){n.startObject(9)}static addIrVersion(n,c){n.addFieldInt64(0,c,n.createLong(0,0))}static addOpsetImport(n,c){n.addFieldOffset(1,c,0)}static createOpsetImportVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startOpsetImportVector(n,c){n.startVector(4,c,4)}static addProducerName(n,c){n.addFieldOffset(2,c,0)}static addProducerVersion(n,c){n.addFieldOffset(3,c,0)}static addDomain(n,c){n.addFieldOffset(4,c,0)}static addModelVersion(n,c){n.addFieldInt64(5,c,n.createLong(0,0))}static addDocString(n,c){n.addFieldOffset(6,c,0)}static addGraph(n,c){n.addFieldOffset(7,c,0)}static addGraphDocString(n,c){n.addFieldOffset(8,c,0)}static endModel(n){return n.endObject()}static createModel(n,c,r,s,u,g,y,S,A,L){return p.startModel(n),p.addIrVersion(n,c),p.addOpsetImport(n,r),p.addProducerName(n,s),p.addProducerVersion(n,u),p.addDomain(n,g),p.addModelVersion(n,y),p.addDocString(n,S),p.addGraph(n,A),p.addGraphDocString(n,L),p.endModel(n)}}d.Model=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsKernelCreateInfos(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsKernelCreateInfos(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}nodeIndices(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.readUint32(this.bb.__vector(this.bb_pos+c)+4*n):0}nodeIndicesLength(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__vector_len(this.bb_pos+n):0}nodeIndicesArray(){let n=this.bb.__offset(this.bb_pos,4);return n?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+n),this.bb.__vector_len(this.bb_pos+n)):null}kernelDefHashes(n){let c=this.bb.__offset(this.bb_pos,6);return c?this.bb.readUint64(this.bb.__vector(this.bb_pos+c)+8*n):this.bb.createLong(0,0)}kernelDefHashesLength(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__vector_len(this.bb_pos+n):0}static startKernelCreateInfos(n){n.startObject(2)}static addNodeIndices(n,c){n.addFieldOffset(0,c,0)}static createNodeIndicesVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addInt32(c[r]);return n.endVector()}static startNodeIndicesVector(n,c){n.startVector(4,c,4)}static addKernelDefHashes(n,c){n.addFieldOffset(1,c,0)}static createKernelDefHashesVector(n,c){n.startVector(8,c.length,8);for(let r=c.length-1;r>=0;r--)n.addInt64(c[r]);return n.endVector()}static startKernelDefHashesVector(n,c){n.startVector(8,c,8)}static endKernelCreateInfos(n){return n.endObject()}static createKernelCreateInfos(n,c,r){return p.startKernelCreateInfos(n),p.addNodeIndices(n,c),p.addKernelDefHashes(n,r),p.endKernelCreateInfos(n)}}d.KernelCreateInfos=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsSubGraphSessionState(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSubGraphSessionState(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}graphId(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}sessionState(n){let c=this.bb.__offset(this.bb_pos,6);return c?(n||new l.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}static startSubGraphSessionState(n){n.startObject(2)}static addGraphId(n,c){n.addFieldOffset(0,c,0)}static addSessionState(n,c){n.addFieldOffset(1,c,0)}static endSubGraphSessionState(n){let c=n.endObject();return n.requiredField(c,4),c}static createSubGraphSessionState(n,c,r){return p.startSubGraphSessionState(n),p.addGraphId(n,c),p.addSessionState(n,r),p.endSubGraphSessionState(n)}}d.SubGraphSessionState=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsSessionState(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSessionState(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}kernels(n){let c=this.bb.__offset(this.bb_pos,4);return c?(n||new l.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}subGraphSessionStates(n,c){let r=this.bb.__offset(this.bb_pos,6);return r?(c||new l.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*n),this.bb):null}subGraphSessionStatesLength(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__vector_len(this.bb_pos+n):0}static startSessionState(n){n.startObject(2)}static addKernels(n,c){n.addFieldOffset(0,c,0)}static addSubGraphSessionStates(n,c){n.addFieldOffset(1,c,0)}static createSubGraphSessionStatesVector(n,c){n.startVector(4,c.length,4);for(let r=c.length-1;r>=0;r--)n.addOffset(c[r]);return n.endVector()}static startSubGraphSessionStatesVector(n,c){n.startVector(4,c,4)}static endSessionState(n){return n.endObject()}static createSessionState(n,c,r){return p.startSessionState(n),p.addKernels(n,c),p.addSubGraphSessionStates(n,r),p.endSessionState(n)}}d.SessionState=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={})),(l=>{(f=>{(d=>{class p{constructor(){this.bb=null,this.bb_pos=0}__init(n,c){return this.bb_pos=n,this.bb=c,this}static getRootAsInferenceSession(n,c){return(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsInferenceSession(n,c){return n.setPosition(n.position()+O.SIZE_PREFIX_LENGTH),(c||new p).__init(n.readInt32(n.position())+n.position(),n)}static bufferHasIdentifier(n){return n.__has_identifier("ORTM")}ortVersion(n){let c=this.bb.__offset(this.bb_pos,4);return c?this.bb.__string(this.bb_pos+c,n):null}model(n){let c=this.bb.__offset(this.bb_pos,6);return c?(n||new l.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}sessionState(n){let c=this.bb.__offset(this.bb_pos,8);return c?(n||new l.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+c),this.bb):null}static startInferenceSession(n){n.startObject(3)}static addOrtVersion(n,c){n.addFieldOffset(0,c,0)}static addModel(n,c){n.addFieldOffset(1,c,0)}static addSessionState(n,c){n.addFieldOffset(2,c,0)}static endInferenceSession(n){return n.endObject()}static finishInferenceSessionBuffer(n,c){n.finish(c,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(n,c){n.finish(c,"ORTM",!0)}static createInferenceSession(n,c,r,s){return p.startInferenceSession(n),p.addOrtVersion(n,c),p.addModel(n,r),p.addSessionState(n,s),p.endInferenceSession(n)}}d.InferenceSession=p})(f.fbs||(f.fbs={}))})(l.experimental||(l.experimental={}))})(W||(W={}))}),Rs=me((t,e)=>{e.exports=function(o,a){for(var l=new Array(arguments.length-1),f=0,d=2,p=!0;d<arguments.length;)l[f++]=arguments[d++];return new Promise(function(h,n){l[f]=function(c){if(p)if(p=!1,c)n(c);else{for(var r=new Array(arguments.length-1),s=0;s<r.length;)r[s++]=arguments[s];h.apply(null,r)}};try{o.apply(a||null,l)}catch(c){p&&(p=!1,n(c))}})}}),zs=me(t=>{var e=t;e.length=function(d){var p=d.length;if(!p)return 0;for(var h=0;--p%4>1&&d.charAt(p)==="=";)++h;return Math.ceil(3*d.length)/4-h};var o,a=new Array(64),l=new Array(123);for(o=0;o<64;)l[a[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;e.encode=function(d,p,h){for(var n,c=null,r=[],s=0,u=0;p<h;){var g=d[p++];switch(u){case 0:r[s++]=a[g>>2],n=(3&g)<<4,u=1;break;case 1:r[s++]=a[n|g>>4],n=(15&g)<<2,u=2;break;case 2:r[s++]=a[n|g>>6],r[s++]=a[63&g],u=0}s>8191&&((c||(c=[])).push(String.fromCharCode.apply(String,r)),s=0)}return u&&(r[s++]=a[n],r[s++]=61,u===1&&(r[s++]=61)),c?(s&&c.push(String.fromCharCode.apply(String,r.slice(0,s))),c.join("")):String.fromCharCode.apply(String,r.slice(0,s))};var f="invalid encoding";e.decode=function(d,p,h){for(var n,c=h,r=0,s=0;s<d.length;
vendor: 18,786 bytes, line 10
10){var u=d.charCodeAt(s++);if(u===61&&r>1)break;if((u=l[u])===void 0)throw Error(f);switch(r){case 0:n=u,r=1;break;case 1:p[h++]=n<<2|(48&u)>>4,n=u,r=2;break;case 2:p[h++]=(15&n)<<4|(60&u)>>2,n=u,r=3;break;case 3:p[h++]=(3&n)<<6|u,r=0}}if(r===1)throw Error(f);return h-c},e.test=function(d){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(d)}}),Ws=me((t,e)=>{function o(){this._listeners={}}e.exports=o,o.prototype.on=function(a,l,f){return(this._listeners[a]||(this._listeners[a]=[])).push({fn:l,ctx:f||this}),this},o.prototype.off=function(a,l){if(a===void 0)this._listeners={};else if(l===void 0)this._listeners[a]=[];else for(var f=this._listeners[a],d=0;d<f.length;)f[d].fn===l?f.splice(d,1):++d;return this},o.prototype.emit=function(a){var l=this._listeners[a];if(l){for(var f=[],d=1;d<arguments.length;)f.push(arguments[d++]);for(d=0;d<l.length;)l[d].fn.apply(l[d++].ctx,f)}return this}}),Js=me((t,e)=>{function o(p){return typeof Float32Array<"u"?function(){var h=new Float32Array([-0]),n=new Uint8Array(h.buffer),c=n[3]===128;function r(y,S,A){h[0]=y,S[A]=n[0],S[A+1]=n[1],S[A+2]=n[2],S[A+3]=n[3]}function s(y,S,A){h[0]=y,S[A]=n[3],S[A+1]=n[2],S[A+2]=n[1],S[A+3]=n[0]}function u(y,S){return n[0]=y[S],n[1]=y[S+1],n[2]=y[S+2],n[3]=y[S+3],h[0]}function g(y,S){return n[3]=y[S],n[2]=y[S+1],n[1]=y[S+2],n[0]=y[S+3],h[0]}p.writeFloatLE=c?r:s,p.writeFloatBE=c?s:r,p.readFloatLE=c?u:g,p.readFloatBE=c?g:u}():function(){function h(c,r,s,u){var g=r<0?1:0;if(g&&(r=-r),r===0)c(1/r>0?0:2147483648,s,u);else if(isNaN(r))c(2143289344,s,u);else if(r>34028234663852886e22)c((g<<31|2139095040)>>>0,s,u);else if(r<11754943508222875e-54)c((g<<31|Math.round(r/1401298464324817e-60))>>>0,s,u);else{var y=Math.floor(Math.log(r)/Math.LN2);c((g<<31|y+127<<23|8388607&Math.round(r*Math.pow(2,-y)*8388608))>>>0,s,u)}}function n(c,r,s){var u=c(r,s),g=2*(u>>31)+1,y=u>>>23&255,S=8388607&u;return y===255?S?NaN:g*(1/0):y===0?1401298464324817e-60*g*S:g*Math.pow(2,y-150)*(S+8388608)}p.writeFloatLE=h.bind(null,a),p.writeFloatBE=h.bind(null,l),p.readFloatLE=n.bind(null,f),p.readFloatBE=n.bind(null,d)}(),typeof Float64Array<"u"?function(){var h=new Float64Array([-0]),n=new Uint8Array(h.buffer),c=n[7]===128;function r(y,S,A){h[0]=y,S[A]=n[0],S[A+1]=n[1],S[A+2]=n[2],S[A+3]=n[3],S[A+4]=n[4],S[A+5]=n[5],S[A+6]=n[6],S[A+7]=n[7]}function s(y,S,A){h[0]=y,S[A]=n[7],S[A+1]=n[6],S[A+2]=n[5],S[A+3]=n[4],S[A+4]=n[3],S[A+5]=n[2],S[A+6]=n[1],S[A+7]=n[0]}function u(y,S){return n[0]=y[S],n[1]=y[S+1],n[2]=y[S+2],n[3]=y[S+3],n[4]=y[S+4],n[5]=y[S+5],n[6]=y[S+6],n[7]=y[S+7],h[0]}function g(y,S){return n[7]=y[S],n[6]=y[S+1],n[5]=y[S+2],n[4]=y[S+3],n[3]=y[S+4],n[2]=y[S+5],n[1]=y[S+6],n[0]=y[S+7],h[0]}p.writeDoubleLE=c?r:s,p.writeDoubleBE=c?s:r,p.readDoubleLE=c?u:g,p.readDoubleBE=c?g:u}():function(){function h(c,r,s,u,g,y){var S=u<0?1:0;if(S&&(u=-u),u===0)c(0,g,y+r),c(1/u>0?0:2147483648,g,y+s);else if(isNaN(u))c(0,g,y+r),c(2146959360,g,y+s);else if(u>17976931348623157e292)c(0,g,y+r),c((S<<31|2146435072)>>>0,g,y+s);else{var A;if(u<22250738585072014e-324)c((A=u/5e-324)>>>0,g,y+r),c((S<<31|A/4294967296)>>>0,g,y+s);else{var L=Math.floor(Math.log(u)/Math.LN2);L===1024&&(L=1023),c(4503599627370496*(A=u*Math.pow(2,-L))>>>0,g,y+r),c((S<<31|L+1023<<20|1048576*A&1048575)>>>0,g,y+s)}}}function n(c,r,s,u,g){var y=c(u,g+r),S=c(u,g+s),A=2*(S>>31)+1,L=S>>>20&2047,z=4294967296*(1048575&S)+y;return L===2047?z?NaN:A*(1/0):L===0?5e-324*A*z:A*Math.pow(2,L-1075)*(z+4503599627370496)}p.writeDoubleLE=h.bind(null,a,0,4),p.writeDoubleBE=h.bind(null,l,4,0),p.readDoubleLE=n.bind(null,f,0,4),p.readDoubleBE=n.bind(null,d,4,0)}(),p}function a(p,h,n){h[n]=255&p,h[n+1]=p>>>8&255,h[n+2]=p>>>16&255,h[n+3]=p>>>24}function l(p,h,n){h[n]=p>>>24,h[n+1]=p>>>16&255,h[n+2]=p>>>8&255,h[n+3]=255&p}function f(p,h){return(p[h]|p[h+1]<<8|p[h+2]<<16|p[h+3]<<24)>>>0}function d(p,h){return(p[h]<<24|p[h+1]<<16|p[h+2]<<8|p[h+3])>>>0}e.exports=o(o)}),Zs=me((exports,module)=>{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}),eu=me(t=>{var e=t;e.length=function(o){for(var a=0,l=0,f=0;f<o.length;++f)(l=o.charCodeAt(f))<128?a+=1:l<2048?a+=2:(64512&l)==55296&&(64512&o.charCodeAt(f+1))==56320?(++f,a+=4):a+=3;return a},e.read=function(o,a,l){if(l-a<1)return"";for(var f,d=null,p=[],h=0;a<l;)(f=o[a++])<128?p[h++]=f:f>191&&f<224?p[h++]=(31&f)<<6|63&o[a++]:f>239&&f<365?(f=((7&f)<<18|(63&o[a++])<<12|(63&o[a++])<<6|63&o[a++])-65536,p[h++]=55296+(f>>10),p[h++]=56320+(1023&f)):p[h++]=(15&f)<<12|(63&o[a++])<<6|63&o[a++],h>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,p)),h=0);return d?(h&&d.push(String.fromCharCode.apply(String,p.slice(0,h))),d.join("")):String.fromCharCode.apply(String,p.slice(0,h))},e.write=function(o,a,l){for(var f,d,p=l,h=0;h<o.length;++h)(f=o.charCodeAt(h))<128?a[l++]=f:f<2048?(a[l++]=f>>6|192,a[l++]=63&f|128):(64512&f)==55296&&(64512&(d=o.charCodeAt(h+1)))==56320?(f=65536+((1023&f)<<10)+(1023&d),++h,a[l++]=f>>18|240,a[l++]=f>>12&63|128,a[l++]=f>>6&63|128,a[l++]=63&f|128):(a[l++]=f>>12|224,a[l++]=f>>6&63|128,a[l++]=63&f|128);return l-p}}),ru=me((t,e)=>{e.exports=function(o,a,l){var f=l||8192,d=f>>>1,p=null,h=f;return function(n){if(n<1||n>d)return o(n);h+n>f&&(p=o(f),h=0);var c=a.call(p,h,h+=n);return 7&h&&(h=1+(7|h)),c}}}),ou=me((t,e)=>{e.exports=a;var o=Xt();function a(p,h){this.lo=p>>>0,this.hi=h>>>0}var l=a.zero=new a(0,0);l.toNumber=function(){return 0},l.zzEncode=l.zzDecode=function(){return this},l.length=function(){return 1};var f=a.zeroHash="\0\0\0\0\0\0\0\0";a.fromNumber=function(p){if(p===0)return l;var h=p<0;h&&(p=-p);var n=p>>>0,c=(p-n)/4294967296>>>0;return h&&(c=~c>>>0,n=~n>>>0,++n>4294967295&&(n=0,++c>4294967295&&(c=0))),new a(n,c)},a.from=function(p){if(typeof p=="number")return a.fromNumber(p);if(o.isString(p)){if(!o.Long)return a.fromNumber(parseInt(p,10));p=o.Long.fromString(p)}return p.low||p.high?new a(p.low>>>0,p.high>>>0):l},a.prototype.toNumber=function(p){if(!p&&this.hi>>>31){var h=1+~this.lo>>>0,n=~this.hi>>>0;return h||(n=n+1>>>0),-(h+4294967296*n)}return this.lo+4294967296*this.hi},a.prototype.toLong=function(p){return o.Long?new o.Long(0|this.lo,0|this.hi,!!p):{low:0|this.lo,high:0|this.hi,unsigned:!!p}};var d=String.prototype.charCodeAt;a.fromHash=function(p){return p===f?l:new a((d.call(p,0)|d.call(p,1)<<8|d.call(p,2)<<16|d.call(p,3)<<24)>>>0,(d.call(p,4)|d.call(p,5)<<8|d.call(p,6)<<16|d.call(p,7)<<24)>>>0)},a.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)},a.prototype.zzEncode=function(){var p=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^p)>>>0,this.lo=(this.lo<<1^p)>>>0,this},a.prototype.zzDecode=function(){var p=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^p)>>>0,this.hi=(this.hi>>>1^p)>>>0,this},a.prototype.length=function(){var p=this.lo,h=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?h===0?p<16384?p<128?1:2:p<2097152?3:4:h<16384?h<128?5:6:h<2097152?7:8:n<128?9:10}}),Xt=me(t=>{var e=t;function o(l,f,d){for(var p=Object.keys(f),h=0;h<p.length;++h)(l[p[h]]===void 0||!d)&&(l[p[h]]=f[p[h]]);return l}function a(l){function f(d,p){if(!(this instanceof f))return new f(d,p);Object.defineProperty(this,"message",{get:function(){return d}}),Error.captureStackTrace?Error.captureStackTrace(this,f):Object.defineProperty(this,"stack",{value:new Error().stack||""}),p&&o(this,p)}return f.prototype=Object.create(Error.prototype,{constructor:{value:f,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return l},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),f}e.asPromise=Rs(),e.base64=zs(),e.EventEmitter=Ws(),e.float=Js(),e.inquire=Zs(),e.utf8=eu(),e.pool=ru(),e.LongBits=ou(),e.isNode=!!(typeof dist.global<"u"&&dist.global&&dist.global.process&&dist.global.process.versions&&dist.global.process.versions.node),e.global=e.isNode&&dist.global||typeof window<"u"&&window||typeof self<"u"&&self||t,e.emptyArray=Object.freeze?Object.freeze([]):[],e.emptyObject=Object.freeze?Object.freeze({}):{},e.isInteger=Number.isInteger||function(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l},e.isString=function(l){return typeof l=="string"||l instanceof String},e.isObject=function(l){return l&&typeof l=="object"},e.isset=e.isSet=function(l,f){var d=l[f];return!(d==null||!l.hasOwnProperty(f))&&(typeof d!="object"||(Array.isArray(d)?d.length:Object.keys(d).length)>0)},e.Buffer=function(){try{var l=e.inquire("buffer").Buffer;return l.prototype.utf8Write?l:null}catch{return null}}(),e._Buffer_from=null,e._Buffer_allocUnsafe=null,e.newBuffer=function(l){return typeof l=="number"?e.Buffer?e._Buffer_allocUnsafe(l):new e.Array(l):e.Buffer?e._Buffer_from(l):typeof Uint8Array>"u"?l:new Uint8Array(l)},e.Array=typeof Uint8Array<"u"?Uint8Array:Array,e.Long=e.global.dcodeIO&&e.global.dcodeIO.Long||e.global.Long||e.inquire("long"),e.key2Re=/^true|false|0|1$/,e.key32Re=/^-?(?:0|[1-9][0-9]*)$/,e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,e.longToHash=function(l){return l?e.LongBits.from(l).toHash():e.LongBits.zeroHash},e.longFromHash=function(l,f){var d=e.LongBits.fromHash(l);return e.Long?e.Long.fromBits(d.lo,d.hi,f):d.toNumber(!!f)},e.merge=o,e.lcFirst=function(l){return l.charAt(0).toLowerCase()+l.substring(1)},e.newError=a,e.ProtocolError=a("ProtocolError"),e.oneOfGetter=function(l){for(var f={},d=0;d<l.length;++d)f[l[d]]=1;return function(){for(var p=Object.keys(this),h=p.length-1;h>-1;--h)if(f[p[h]]===1&&this[p[h]]!==void 0&&this[p[h]]!==null)return p[h]}},e.oneOfSetter=function(l){return function(f){for(var d=0;d<l.length;++d)l[d]!==f&&delete this[l[d]]}},e.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},e._configure=function(){var l=e.Buffer;l?(e._Buffer_from=l.from!==Uint8Array.from&&l.from||function(f,d){return new l(f,d)},e._Buffer_allocUnsafe=l.allocUnsafe||function(f){return new l(f)}):e._Buffer_from=e._Buffer_allocUnsafe=null}}),li=me((t,e)=>{e.exports=c;var o,a=Xt(),l=a.LongBits,f=a.base64,d=a.utf8;function p(A,L,z){this.fn=A,this.len=L,this.next=void 0,this.val=z}function h(){}function n(A){this.head=A.head,this.tail=A.tail,this.len=A.len,this.next=A.states}function c(){this.len=0,this.head=new p(h,0,0),this.tail=this.head,this.states=null}var r=function(){return a.Buffer?function(){return(c.create=function(){return new o})()}:function(){return new c}};function s(A,L,z){L[z]=255&A}function u(A,L){this.len=A,this.next=void 0,this.val=L}function g(A,L,z){for(;A.hi;)L[z++]=127&A.lo|128,A.lo=(A.lo>>>7|A.hi<<25)>>>0,A.hi>>>=7;for(;A.lo>127;)L[z++]=127&A.lo|128,A.lo=A.lo>>>7;L[z++]=A.lo}function y(A,L,z){L[z]=255&A,L[z+1]=A>>>8&255,L[z+2]=A>>>16&255,L[z+3]=A>>>24}c.create=r(),c.alloc=function(A){return new a.Array(A)},a.Array!==Array&&(c.alloc=a.pool(c.alloc,a.Array.prototype.subarray)),c.prototype._push=function(A,L,z){return this.tail=this.tail.next=new p(A,L,z),this.len+=L,this},u.prototype=Object.create(p.prototype),u.prototype.fn=function(A,L,z){for(;A>127;)L[z++]=127&A|128,A>>>=7;L[z]=A},c.prototype.uint32=function(A){return this.len+=(this.tail=this.tail.next=new u((A>>>=0)<128?1:A<16384?2:A<2097152?3:A<268435456?4:5,A)).len,this},c.prototype.int32=function(A){return A<0?this._push(g,10,l.fromNumber(A)):this.uint32(A)},c.prototype.sint32=function(A){return this.uint32((A<<1^A>>31)>>>0)},c.prototype.uint64=function(A){var L=l.from(A);return this._push(g,L.length(),L)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(A){var L=l.from(A).zzEncode();return this._push(g,L.length(),L)},c.prototype.bool=function(A){return this._push(s,1,A?1:0)},c.prototype.fixed32=function(A){return this._push(y,4,A>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(A){var L=l.from(A);return this._push(y,4,L.lo)._push(y,4,L.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(A){return this._push(a.float.writeFloatLE,4,A)},c.prototype.double=function(A){return this._push(a.float.writeDoubleLE,8,A)};var S=a.Array.prototype.set?function(A,L,z){L.set(A,z)}:function(A,L,z){for(var et=0;et<A.length;++et)L[z+et]=A[et]};c.prototype.bytes=function(A){var L=A.length>>>0;if(!L)return this._push(s,1,0);if(a.isString(A)){var z=c.alloc(L=f.length(A));f.decode(A,z,0),A=z}return this.uint32(L)._push(S,L,A)},c.prototype.string=function(A){var L=d.length(A);return L?this.uint32(L)._push(d.write,L,A):this._push(s,1,0)},c.prototype.fork=function(){return this.states=new n(this),this.head=this.tail=new p(h,0,0),this.len=0,this},c.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 p(h,0,0),this.len=0),this},c.prototype.ldelim=function(){var A=this.head,L=this.tail,z=this.len;return this.reset().uint32(z),z&&(this.tail.next=A.next,this.tail=L,this.len+=z),this},c.prototype.finish=function(){for(var A=this.head.next,L=this.constructor.alloc(this.len),z=0;A;)A.fn(A.val,L,z),z+=A.len,A=A.next;return L},c._configure=function(A){o=A,c.create=r(),o._configure()}}),du=me((t,e)=>{e.exports=l;var o=li();(l.prototype=Object.create(o.prototype)).constructor=l;var a=Xt();function l(){o.call(this)}function f(d,p,h){d.length<40?a.utf8.write(d,p,h):p.utf8Write?p.utf8Write(d,h):p.write(d,h)}l._configure=function(){l.alloc=a._Buffer_allocUnsafe,l.writeBytesBuffer=a.Buffer&&a.Buffer.prototype instanceof Uint8Array&&a.Buffer.prototype.set.name==="set"?function(d,p,h){p.set(d,h)}:function(d,p,h){if(d.copy)d.copy(p,h,0,d.length);else for(var n=0;n<d.length;)p[h++]=d[n++]}},l.prototype.bytes=function(d){a.isString(d)&&(d=a._Buffer_from(d,"base64"));var p=d.length>>>0;return this.uint32(p),p&&this._push(l.writeBytesBuffer,p,d),this},l.prototype.string=function(d){var p=a.Buffer.byteLength(d);return this.uint32(p),p&&this._push(f,p,d),this},l._configure()}),pi=me((t,e)=>{e.exports=p;var o,a=Xt(),l=a.LongBits,f=a.utf8;function d(g,y){return RangeError("index out of range: "+g.pos+" + "+(y||1)+" > "+g.len)}function p(g){this.buf=g,this.pos=0,this.len=g.length}var h,n=typeof Uint8Array<"u"?function(g){if(g instanceof Uint8Array||Array.isArray(g))return new p(g);throw Error("illegal buffer")}:function(g){if(Array.isArray(g))return new p(g);throw Error("illegal buffer")},c=function(){return a.Buffer?function(g){return(p.create=function(y){return a.Buffer.isBuffer(y)?new o(y):n(y)})(g)}:n};function r(){var g=new l(0,0),y=0;if(!(this.len-this.pos>4)){for(;y<3;++y){if(this.pos>=this.len)throw d(this);if(g.lo=(g.lo|(127&this.buf[this.pos])<<7*y)>>>0,this.buf[this.pos++]<128)return g}return g.lo=(g.lo|(127&this.buf[this.pos++])<<7*y)>>>0,g}for(;y<4;++y)if(g.lo=(g.lo|(127&this.buf[this.pos])<<7*y)>>>0,this.buf[this.pos++]<128)return g;if(g.lo=(g.lo|(127&this.buf[this.pos])<<28)>>>0,g.hi=(g.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return g;if(y=0,this.len-this.pos>4){for(;y<5;++y)if(g.hi=(g.hi|(127&this.buf[this.pos])<<7*y+3)>>>0,this.buf[this.pos++]<128)return g}else for(;y<5;++y){if(this.pos>=this.len)throw d(this);if(g.hi=(g.hi|(127&this.buf[this.pos])<<7*y+3)>>>0,this.buf[this.pos++]<128)return g}throw Error("invalid varint encoding")}function s(g,y){return(g[y-4]|g[y-3]<<8|g[y-2]<<16|g[y-1]<<24)>>>0}function u(){if(this.pos+8>this.len)throw d(this,8);return new l(s(this.buf,this.pos+=4),s(this.buf,this.pos+=4))}p.create=c(),p.prototype._slice=a.Array.prototype.subarray||a.Array.prototype.slice,p.prototype.uint32=(h=4294967295,function(){if(h=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(h=(h|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(h=(h|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(h=(h|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(h=(h|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return h;if((this.pos+=5)>this.len)throw this.pos=this.len,d(this,10);return h}),p.prototype.int32=function(){return 0|this.uint32()},p.prototype.sint32=function(){var g=this.uint32();return g>>>1^-(1&g)},p.prototype.bool=function(){return this.uint32()!==0},p.prototype.fixed32=function(){if(this.pos+4>this.len)throw d(this,4);return s(this.buf,this.pos+=4)},p.prototype.sfixed32=function(){if(this.pos+4>this.len)throw d(this,4);return 0|s(this.buf,this.pos+=4)},p.prototype.float=function(){if(this.pos+4>this.len)throw d(this,4);var g=a.float.readFloatLE(this.buf,this.pos);return this.pos+=4,g},p.prototype.double=function(){if(this.pos+8>this.len)throw d(this,4);var g=a.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,g},p.prototype.bytes=function(){var g=this.uint32(),y=this.pos,S=this.pos+g;if(S>this.len)throw d(this,g);return this.pos+=g,Array.isArray(this.buf)?this.buf.slice(y,S):y===S?new this.buf.constructor(0):this._slice.call(this.buf,y,S)},p.prototype.string=function(){var g=this.bytes();return f.read(g,0,g.length)},p.prototype.skip=function(g){if(typeof g=="number"){if(this.pos+g>this.len)throw d(this,g);this.pos+=g}else do if(this.pos>=this.len)throw d(this);while(128&this.buf[this.pos++]);return this},p.prototype.skipType=function(g){switch(g){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(g=7&this.uint32())!=4;)this.skipType(g);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+g+" at offset "+this.pos)}return this},p._configure=function(g){o=g,p.create=c(),o._configure();var y=a.Long?"toLong":"toNumber";a.merge(p.prototype,{int64:function(){return r.call(this)[y](!1)},uint64:function(){return r.call(this)[y](!0)},sint64:function(){return r.call(this).zzDecode()[y](!1)},fixed64:function(){return u.call(this)[y](!0)},sfixed64:function(){return u.call(this)[y](!1)}})}}),vu=me((t,e)=>{e.exports=l;var o=pi();(l.prototype=Object.create(o.prototype)).constructor=l;var a=Xt();function l(f){o.call(this,f)}l._configure=function(){a.Buffer&&(l.prototype._slice=a.Buffer.prototype.slice)},l.prototype.string=function(){var f=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+f,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+f,this.len))},l._configure()}),Ou=me((t,e)=>{e.exports=a;var o=Xt();function a(l,f,d){if(typeof l!="function")throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=l,this.requestDelimited=!!f,this.responseDelimited=!!d}(a.prototype=Object.create(o.EventEmitter.prototype)).constructor=a,a.prototype.rpcCall=function l(f,d,p,h,n){if(!h)throw TypeError("request must be specified");var c=this;
10if(!n)return o.asPromise(l,c,f,d,p,h);if(c.rpcImpl)try{return c.rpcImpl(f,d[c.requestDelimited?"encodeDelimited":"encode"](h).finish(),function(r,s){if(r)return c.emit("error",r,f),n(r);if(s!==null){if(!(s instanceof p))try{s=p[c.responseDelimited?"decodeDelimited":"decode"](s)}catch(u){return c.emit("error",u,f),n(u)}return c.emit("data",s,f),n(null,s)}c.end(!0)})}catch(r){return c.emit("error",r,f),void setTimeout(function(){n(r)},0)}else setTimeout(function(){n(Error("already ended"))},0)},a.prototype.end=function(l){return this.rpcImpl&&(l||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}}),Su=me(t=>{t.Service=Ou()}),Pu=me((t,e)=>{e.exports={}}),Lu=me(t=>{var e=t;function o(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=li(),e.BufferWriter=du(),e.Reader=pi(),e.BufferReader=vu(),e.util=Xt(),e.rpc=Su(),e.roots=Pu(),e.configure=o,o()}),Cu=me((t,e)=>{e.exports=Lu()}),$r=me((t,e)=>{var o,a,l,f=Cu(),d=f.Reader,p=f.Writer,h=f.util,n=f.roots.default||(f.roots.default={});n.onnx=((l={}).Version=(o={},(a=Object.create(o))[o[0]="_START_VERSION"]=0,a[o[1]="IR_VERSION_2017_10_10"]=1,a[o[2]="IR_VERSION_2017_10_30"]=2,a[o[3]="IR_VERSION_2017_11_3"]=3,a[o[4]="IR_VERSION_2019_1_22"]=4,a[o[5]="IR_VERSION_2019_3_18"]=5,a[o[6]="IR_VERSION_2019_9_19"]=6,a[o[7]="IR_VERSION_2020_5_8"]=7,a[o[8]="IR_VERSION_2021_7_30"]=8,a[o[9]="IR_VERSION"]=9,a),l.AttributeProto=function(){function c(r){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],this.sparseTensors=[],this.typeProtos=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.name="",c.prototype.refAttrName="",c.prototype.docString="",c.prototype.type=0,c.prototype.f=0,c.prototype.i=h.Long?h.Long.fromBits(0,0,!1):0,c.prototype.s=h.newBuffer([]),c.prototype.t=null,c.prototype.g=null,c.prototype.sparseTensor=null,c.prototype.tp=null,c.prototype.floats=h.emptyArray,c.prototype.ints=h.emptyArray,c.prototype.strings=h.emptyArray,c.prototype.tensors=h.emptyArray,c.prototype.graphs=h.emptyArray,c.prototype.sparseTensors=h.emptyArray,c.prototype.typeProtos=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.name!=null&&Object.hasOwnProperty.call(r,"name")&&s.uint32(10).string(r.name),r.f!=null&&Object.hasOwnProperty.call(r,"f")&&s.uint32(21).float(r.f),r.i!=null&&Object.hasOwnProperty.call(r,"i")&&s.uint32(24).int64(r.i),r.s!=null&&Object.hasOwnProperty.call(r,"s")&&s.uint32(34).bytes(r.s),r.t!=null&&Object.hasOwnProperty.call(r,"t")&&n.onnx.TensorProto.encode(r.t,s.uint32(42).fork()).ldelim(),r.g!=null&&Object.hasOwnProperty.call(r,"g")&&n.onnx.GraphProto.encode(r.g,s.uint32(50).fork()).ldelim(),r.floats!=null&&r.floats.length){s.uint32(58).fork();for(var u=0;u<r.floats.length;++u)s.float(r.floats[u]);s.ldelim()}if(r.ints!=null&&r.ints.length){for(s.uint32(66).fork(),u=0;u<r.ints.length;++u)s.int64(r.ints[u]);s.ldelim()}if(r.strings!=null&&r.strings.length)for(u=0;u<r.strings.length;++u)s.uint32(74).bytes(r.strings[u]);if(r.tensors!=null&&r.tensors.length)for(u=0;u<r.tensors.length;++u)n.onnx.TensorProto.encode(r.tensors[u],s.uint32(82).fork()).ldelim();if(r.graphs!=null&&r.graphs.length)for(u=0;u<r.graphs.length;++u)n.onnx.GraphProto.encode(r.graphs[u],s.uint32(90).fork()).ldelim();if(r.docString!=null&&Object.hasOwnProperty.call(r,"docString")&&s.uint32(106).string(r.docString),r.tp!=null&&Object.hasOwnProperty.call(r,"tp")&&n.onnx.TypeProto.encode(r.tp,s.uint32(114).fork()).ldelim(),r.typeProtos!=null&&r.typeProtos.length)for(u=0;u<r.typeProtos.length;++u)n.onnx.TypeProto.encode(r.typeProtos[u],s.uint32(122).fork()).ldelim();if(r.type!=null&&Object.hasOwnProperty.call(r,"type")&&s.uint32(160).int32(r.type),r.refAttrName!=null&&Object.hasOwnProperty.call(r,"refAttrName")&&s.uint32(170).string(r.refAttrName),r.sparseTensor!=null&&Object.hasOwnProperty.call(r,"sparseTensor")&&n.onnx.SparseTensorProto.encode(r.sparseTensor,s.uint32(178).fork()).ldelim(),r.sparseTensors!=null&&r.sparseTensors.length)for(u=0;
10u<r.sparseTensors.length;++u)n.onnx.SparseTensorProto.encode(r.sparseTensors[u],s.uint32(186).fork()).ldelim();return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.AttributeProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.name=r.string();break;case 21:g.refAttrName=r.string();break;case 13:g.docString=r.string();break;case 20:g.type=r.int32();break;case 2:g.f=r.float();break;case 3:g.i=r.int64();break;case 4:g.s=r.bytes();break;case 5:g.t=n.onnx.TensorProto.decode(r,r.uint32());break;case 6:g.g=n.onnx.GraphProto.decode(r,r.uint32());break;case 22:g.sparseTensor=n.onnx.SparseTensorProto.decode(r,r.uint32());break;case 14:g.tp=n.onnx.TypeProto.decode(r,r.uint32());break;case 7:if(g.floats&&g.floats.length||(g.floats=[]),(7&y)==2)for(var S=r.uint32()+r.pos;r.pos<S;)g.floats.push(r.float());else g.floats.push(r.float());break;case 8:if(g.ints&&g.ints.length||(g.ints=[]),(7&y)==2)for(S=r.uint32()+r.pos;r.pos<S;)g.ints.push(r.int64());else g.ints.push(r.int64());break;case 9:g.strings&&g.strings.length||(g.strings=[]),g.strings.push(r.bytes());break;case 10:g.tensors&&g.tensors.length||(g.tensors=[]),g.tensors.push(n.onnx.TensorProto.decode(r,r.uint32()));break;case 11:g.graphs&&g.graphs.length||(g.graphs=[]),g.graphs.push(n.onnx.GraphProto.decode(r,r.uint32()));break;case 23:g.sparseTensors&&g.sparseTensors.length||(g.sparseTensors=[]),g.sparseTensors.push(n.onnx.SparseTensorProto.decode(r,r.uint32()));break;case 15:g.typeProtos&&g.typeProtos.length||(g.typeProtos=[]),g.typeProtos.push(n.onnx.TypeProto.decode(r,r.uint32()));break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.name!=null&&r.hasOwnProperty("name")&&!h.isString(r.name))return"name: string expected";if(r.refAttrName!=null&&r.hasOwnProperty("refAttrName")&&!h.isString(r.refAttrName))return"refAttrName: string expected";if(r.docString!=null&&r.hasOwnProperty("docString")&&!h.isString(r.docString))return"docString: string expected";if(r.type!=null&&r.hasOwnProperty("type"))switch(r.type){default:return"type: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 11:case 13:case 6:case 7:case 8:case 9:case 10:case 12:case 14:}if(r.f!=null&&r.hasOwnProperty("f")&&typeof r.f!="number")return"f: number expected";if(r.i!=null&&r.hasOwnProperty("i")&&!h.isInteger(r.i)&&!(r.i&&h.isInteger(r.i.low)&&h.isInteger(r.i.high)))return"i: integer|Long expected";if(r.s!=null&&r.hasOwnProperty("s")&&!(r.s&&typeof r.s.length=="number"||h.isString(r.s)))return"s: buffer expected";if(r.t!=null&&r.hasOwnProperty("t")&&(u=n.onnx.TensorProto.verify(r.t)))return"t."+u;if(r.g!=null&&r.hasOwnProperty("g")&&(u=n.onnx.GraphProto.verify(r.g)))return"g."+u;if(r.sparseTensor!=null&&r.hasOwnProperty("sparseTensor")&&(u=n.onnx.SparseTensorProto.verify(r.sparseTensor)))return"sparseTensor."+u;if(r.tp!=null&&r.hasOwnProperty("tp")&&(u=n.onnx.TypeProto.verify(r.tp)))return"tp."+u;if(r.floats!=null&&r.hasOwnProperty("floats")){if(!Array.isArray(r.floats))return"floats: array expected";for(var s=0;s<r.floats.length;++s)if(typeof r.floats[s]!="number")return"floats: number[] expected"}if(r.ints!=null&&r.hasOwnProperty("ints")){if(!Array.isArray(r.ints))return"ints: array expected";for(s=0;s<r.ints.length;++s)if(!(h.isInteger(r.ints[s])||r.ints[s]&&h.isInteger(r.ints[s].low)&&h.isInteger(r.ints[s].high)))return"ints: integer|Long[] expected"}if(r.strings!=null&&r.hasOwnProperty("strings")){if(!Array.isArray(r.strings))return"strings: array expected";for(s=0;s<r.strings.length;++s)if(!(r.strings[s]&&typeof r.strings[s].length=="number"||h.isString(r.strings[s])))return"strings: buffer[] expected"}if(r.tensors!=null&&r.hasOwnProperty("tensors")){if(!Array.isArray(r.tensors))return"tensors: array expected";for(s=0;s<r.tensors.length;++s)if(u=n.onnx.TensorProto.verify(r.tensors[s]))return"tensors."+u}if(r.graphs!=null&&r.hasOwnProperty("graphs")){if(!Array.isArray(r.graphs))return"graphs: array expected";for(s=0;s<r.graphs.length;++s)if(u=n.onnx.GraphProto.verify(r.graphs[s]))return"graphs."+u}if(r.sparseTensors!=null&&r.hasOwnProperty("sparseTensors")){if(!Array.isArray(r.sparseTensors))return"sparseTensors: array expected";for(s=0;s<r.sparseTensors.length;++s)if(u=n.onnx.SparseTensorProto.verify(r.sparseTensors[s]))return"sparseTensors."+u}if(r.typeProtos!=null&&r.hasOwnProperty("typeProtos")){if(!Array.isArray(r.typeProtos))return"typeProtos: array expected";for(s=0;s<r.typeProtos.length;++s){var u;if(u=n.onnx.TypeProto.verify(r.typeProtos[s]))return"typeProtos."+u}}return null},c.fromObject=function(r){if(r instanceof n.onnx.AttributeProto)return r;var s=new n.onnx.AttributeProto;switch(r.name!=null&&(s.name=String(r.name)),r.refAttrName!=null&&(s.refAttrName=String(r.refAttrName)),r.docString!=null&&(s.docString=String(r.docString)),r.type){default:if(typeof r.type=="number"){s.type=r.type;break}break;case"UNDEFINED":case 0:s.type=0;break;case"FLOAT":case 1:s.type=1;break;case"INT":case 2:s.type=2;break;case"STRING":case 3:s.type=3;break;case"TENSOR":case 4:s.type=4;break;case"GRAPH":case 5:s.type=5;break;case"SPARSE_TENSOR":case 11:s.type=11;break;
vendor: 3,678 bytes, line 10
10case"TYPE_PROTO":case 13:s.type=13;break;case"FLOATS":case 6:s.type=6;break;case"INTS":case 7:s.type=7;break;case"STRINGS":case 8:s.type=8;break;case"TENSORS":case 9:s.type=9;break;case"GRAPHS":case 10:s.type=10;break;case"SPARSE_TENSORS":case 12:s.type=12;break;case"TYPE_PROTOS":case 14:s.type=14}if(r.f!=null&&(s.f=Number(r.f)),r.i!=null&&(h.Long?(s.i=h.Long.fromValue(r.i)).unsigned=!1:typeof r.i=="string"?s.i=parseInt(r.i,10):typeof r.i=="number"?s.i=r.i:typeof r.i=="object"&&(s.i=new h.LongBits(r.i.low>>>0,r.i.high>>>0).toNumber())),r.s!=null&&(typeof r.s=="string"?h.base64.decode(r.s,s.s=h.newBuffer(h.base64.length(r.s)),0):r.s.length>=0&&(s.s=r.s)),r.t!=null){if(typeof r.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");s.t=n.onnx.TensorProto.fromObject(r.t)}if(r.g!=null){if(typeof r.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");s.g=n.onnx.GraphProto.fromObject(r.g)}if(r.sparseTensor!=null){if(typeof r.sparseTensor!="object")throw TypeError(".onnx.AttributeProto.sparseTensor: object expected");s.sparseTensor=n.onnx.SparseTensorProto.fromObject(r.sparseTensor)}if(r.tp!=null){if(typeof r.tp!="object")throw TypeError(".onnx.AttributeProto.tp: object expected");s.tp=n.onnx.TypeProto.fromObject(r.tp)}if(r.floats){if(!Array.isArray(r.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");s.floats=[];for(var u=0;u<r.floats.length;++u)s.floats[u]=Number(r.floats[u])}if(r.ints){if(!Array.isArray(r.ints))throw TypeError(".onnx.AttributeProto.ints: array expected");for(s.ints=[],u=0;u<r.ints.length;++u)h.Long?(s.ints[u]=h.Long.fromValue(r.ints[u])).unsigned=!1:typeof r.ints[u]=="string"?s.ints[u]=parseInt(r.ints[u],10):typeof r.ints[u]=="number"?s.ints[u]=r.ints[u]:typeof r.ints[u]=="object"&&(s.ints[u]=new h.LongBits(r.ints[u].low>>>0,r.ints[u].high>>>0).toNumber())}if(r.strings){if(!Array.isArray(r.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(s.strings=[],u=0;u<r.strings.length;++u)typeof r.strings[u]=="string"?h.base64.decode(r.strings[u],s.strings[u]=h.newBuffer(h.base64.length(r.strings[u])),0):r.strings[u].length>=0&&(s.strings[u]=r.strings[u])}if(r.tensors){if(!Array.isArray(r.tensors))throw TypeError(".onnx.AttributeProto.tensors: array expected");for(s.tensors=[],u=0;u<r.tensors.length;++u){if(typeof r.tensors[u]!="object")throw TypeError(".onnx.AttributeProto.tensors: object expected");s.tensors[u]=n.onnx.TensorProto.fromObject(r.tensors[u])}}if(r.graphs){if(!Array.isArray(r.graphs))throw TypeError(".onnx.AttributeProto.graphs: array expected");for(s.graphs=[],u=0;u<r.graphs.length;++u){if(typeof r.graphs[u]!="object")throw TypeError(".onnx.AttributeProto.graphs: object expected");s.graphs[u]=n.onnx.GraphProto.fromObject(r.graphs[u])}}if(r.sparseTensors){if(!Array.isArray(r.sparseTensors))throw TypeError(".onnx.AttributeProto.sparseTensors: array expected");for(s.sparseTensors=[],u=0;u<r.sparseTensors.length;++u){if(typeof r.sparseTensors[u]!="object")throw TypeError(".onnx.AttributeProto.sparseTensors: object expected");s.sparseTensors[u]=n.onnx.SparseTensorProto.fromObject(r.sparseTensors[u])}}if(r.typeProtos){if(!Array.isArray(r.typeProtos))throw TypeError(".onnx.AttributeProto.typeProtos: array expected");for(s.typeProtos=[],u=0;u<r.typeProtos.length;++u){if(typeof r.typeProtos[u]!="object")throw TypeError(".onnx.AttributeProto.typeProtos: object expected");s.typeProtos[u]=n.onnx.TypeProto.fromObject(r.typeProtos[u])}}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.floats=[],u.ints=[],u.strings=[],u.tensors=[],u.graphs=[],u.typeProtos=[],u.sparseTensors=[]),s.defaults){if(u.n
10ame="",u.f=0,h.Long){var g=new h.Long(0,0,!1);u.i=s.longs===String?g.toString():s.longs===Number?g.toNumber():g}else u.i=s.longs===String?"0":0;s.bytes===String?u.s="":(u.s=[],s.bytes!==Array&&(u.s=h.newBuffer(u.s))),u.t=null,u.g=null,u.docString="",u.tp=null,u.type=s.enums===String?"UNDEFINED":0,u.refAttrName="",u.sparseTensor=null}if(r.name!=null&&r.hasOwnProperty("name")&&(u.name=r.name),r.f!=null&&r.hasOwnProperty("f")&&(u.f=s.json&&!isFinite(r.f)?String(r.f):r.f),r.i!=null&&r.hasOwnProperty("i")&&(typeof r.i=="number"?u.i=s.longs===String?String(r.i):r.i:u.i=s.longs===String?h.Long.prototype.toString.call(r.i):s.longs===Number?new h.LongBits(r.i.low>>>0,r.i.high>>>0).toNumber():r.i),r.s!=null&&r.hasOwnProperty("s")&&(u.s=s.bytes===String?h.base64.encode(r.s,0,r.s.length):s.bytes===Array?Array.prototype.slice.call(r.s):r.s),r.t!=null&&r.hasOwnProperty("t")&&(u.t=n.onnx.TensorProto.toObject(r.t,s)),r.g!=null&&r.hasOwnProperty("g")&&(u.g=n.onnx.GraphProto.toObject(r.g,s)),r.floats&&r.floats.length){u.floats=[];for(var y=0;y<r.floats.length;++y)u.floats[y]=s.json&&!isFinite(r.floats[y])?String(r.floats[y]):r.floats[y]}if(r.ints&&r.ints.length)for(u.ints=[],y=0;y<r.ints.length;++y)typeof r.ints[y]=="number"?u.ints[y]=s.longs===String?String(r.ints[y]):r.ints[y]:u.ints[y]=s.longs===String?h.Long.prototype.toString.call(r.ints[y]):s.longs===Number?new h.LongBits(r.ints[y].low>>>0,r.ints[y].high>>>0).toNumber():r.ints[y];if(r.strings&&r.strings.length)for(u.strings=[],y=0;y<r.strings.length;++y)u.strings[y]=s.bytes===String?h.base64.encode(r.strings[y],0,r.strings[y].length):s.bytes===Array?Array.prototype.slice.call(r.strings[y]):r.strings[y];if(r.tensors&&r.tensors.length)for(u.tensors=[],y=0;y<r.tensors.length;++y)u.tensors[y]=n.onnx.TensorProto.toObject(r.tensors[y],s);if(r.graphs&&r.graphs.length)for(u.graphs=[],y=0;y<r.graphs.length;++y)u.graphs[y]=n.onnx.GraphProto.toObject(r.graphs[y],s);if(r.docString!=null&&r.hasOwnProperty("docString")&&(u.docString=r.docString),r.tp!=null&&r.hasOwnProperty("tp")&&(u.tp=n.onnx.TypeProto.toObject(r.tp,s)),r.typeProtos&&r.typeProtos.length)for(u.typeProtos=[],y=0;y<r.typeProtos.length;++y)u.typeProtos[y]=n.onnx.TypeProto.toObject(r.typeProtos[y],s);if(r.type!=null&&r.hasOwnProperty("type")&&(u.type=s.enums===String?n.onnx.AttributeProto.AttributeType[r.type]===void 0?r.type:n.onnx.AttributeProto.AttributeType[r.type]:r.type),r.refAttrName!=null&&r.hasOwnProperty("refAttrName")&&(u.refAttrName=r.refAttrName),r.sparseTensor!=null&&r.hasOwnProperty("sparseTensor")&&(u.sparseTensor=n.onnx.SparseTensorProto.toObject(r.sparseTensor,s)),r.sparseTensors&&r.sparseTensors.length)for(u.sparseTensors=[],y=0;y<r.sparseTensors.length;++y)u.sparseTensors[y]=n.onnx.SparseTensorProto.toObject(r.sparseTensors[y],s);return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.AttributeProto"},c.AttributeType=function(){var r={},s=Object.create(r);return s[r[0]="UNDEFINED"]=0,s[r[1]="FLOAT"]=1,s[r[2]="INT"]=2,s[r[3]="STRING"]=3,s[r[4]="TENSOR"]=4,s[r[5]="GRAPH"]=5,s[r[11]="SPARSE_TENSOR"]=11,s[r[13]="TYPE_PROTO"]=13,s[r[6]="FLOATS"]=6,s[r[7]="INTS"]=7,s[r[8]="STRINGS"]=8,s[r[9]="TENSORS"]=9,s[r[10]="GRAPHS"]=10,s[r[12]="SPARSE_TENSORS"]=12,s[r[14]="TYPE_PROTOS"]=14,s}(),c}(),l.ValueInfoProto=function(){function c(r){if(r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.name="",c.prototype.type=null,c.prototype.docString="",c.create=function(r){return new c(r)},c.encode=function(r,s){return s||(s=p.create()),r.name!=null&&Object.hasOwnProperty.call(r,"name")&&s.uint32(10).string(r.name),r.type!=null&&Object.hasOwnProperty.call(r,"type")&&n.onnx.TypeProto.encode(r.type,s.uint32(18).fork()).ldelim(),r.docString!=null&&Object.hasOwnProperty.call(r,"docString")&&s.uint32(26).string(r.docString),s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.ValueInfoProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.name=r.string();break;case 2:g.type=n.onnx.TypeProto.decode(r,r.uint32());break;case 3:g.docString=r.string();break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.name!=null&&r.hasOwnProperty("name")&&!h.isString(r.name))return"name: string expected";if(r.type!=null&&r.hasOwnProperty("type")){var s=n.onnx.TypeProto.verify(r.type);if(s)return"type."+s}return r.docString!=null&&r.hasOwnProperty("docString")&&!h.isString(r.docString)?"docString: string expected":null},c.fromObject=function(r){if(r instanceof n.onnx.ValueInfoProto)return r;var s=new n.onnx.ValueInfoProto;if(r.name!=null&&(s.name=String(r.name)),r.type!=null){if(typeof r.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");s.type=n.onnx.TypeProto.fromObject(r.type)}return r.docString!=null&&(s.docString=String(r.docString)),s},c.toObject=function(r,s){s||(s={});var u={};
10return s.defaults&&(u.name="",u.type=null,u.docString=""),r.name!=null&&r.hasOwnProperty("name")&&(u.name=r.name),r.type!=null&&r.hasOwnProperty("type")&&(u.type=n.onnx.TypeProto.toObject(r.type,s)),r.docString!=null&&r.hasOwnProperty("docString")&&(u.docString=r.docString),u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.ValueInfoProto"},c}(),l.NodeProto=function(){function c(r){if(this.input=[],this.output=[],this.attribute=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.input=h.emptyArray,c.prototype.output=h.emptyArray,c.prototype.name="",c.prototype.opType="",c.prototype.domain="",c.prototype.attribute=h.emptyArray,c.prototype.docString="",c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.input!=null&&r.input.length)for(var u=0;u<r.input.length;++u)s.uint32(10).string(r.input[u]);if(r.output!=null&&r.output.length)for(u=0;u<r.output.length;++u)s.uint32(18).string(r.output[u]);if(r.name!=null&&Object.hasOwnProperty.call(r,"name")&&s.uint32(26).string(r.name),r.opType!=null&&Object.hasOwnProperty.call(r,"opType")&&s.uint32(34).string(r.opType),r.attribute!=null&&r.attribute.length)for(u=0;u<r.attribute.length;++u)n.onnx.AttributeProto.encode(r.attribute[u],s.uint32(42).fork()).ldelim();return r.docString!=null&&Object.hasOwnProperty.call(r,"docString")&&s.uint32(50).string(r.docString),r.domain!=null&&Object.hasOwnProperty.call(r,"domain")&&s.uint32(58).string(r.domain),s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.NodeProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.input&&g.input.length||(g.input=[]),g.input.push(r.string());break;case 2:g.output&&g.output.length||(g.output=[]),g.output.push(r.string());break;case 3:g.name=r.string();break;case 4:g.opType=r.string();break;case 7:g.domain=r.string();break;case 5:g.attribute&&g.attribute.length||(g.attribute=[]),g.attribute.push(n.onnx.AttributeProto.decode(r,r.uint32()));break;case 6:g.docString=r.string();break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.input!=null&&r.hasOwnProperty("input")){if(!Array.isArray(r.input))return"input: array expected";for(var s=0;s<r.input.length;++s)if(!h.isString(r.input[s]))return"input: string[] expected"}if(r.output!=null&&r.hasOwnProperty("output")){if(!Array.isArray(r.output))return"output: array expected";for(s=0;s<r.output.length;++s)if(!h.isString(r.output[s]))return"output: string[] expected"}if(r.name!=null&&r.hasOwnProperty("name")&&!h.isString(r.name))return"name: string expected";if(r.opType!=null&&r.hasOwnProperty("opType")&&!h.isString(r.opType))return"opType: string expected";if(r.domain!=null&&r.hasOwnProperty("domain")&&!h.isString(r.domain))return"domain: string expected";if(r.attribute!=null&&r.hasOwnProperty("attribute")){if(!Array.isArray(r.attribute))return"attribute: array expected";for(s=0;s<r.attribute.length;++s){var u=n.onnx.AttributeProto.verify(r.attribute[s]);if(u)return"attribute."+u}}return r.docString!=null&&r.hasOwnProperty("docString")&&!h.isString(r.docString)?"docString: string expected":null},c.fromObject=function(r){if(r instanceof n.onnx.NodeProto)return r;var s=new n.onnx.NodeProto;if(r.input){if(!Array.isArray(r.input))throw TypeError(".onnx.NodeProto.input: array expected");s.input=[];for(var u=0;u<r.input.length;++u)s.input[u]=String(r.input[u])}if(r.output){if(!Array.isArray(r.output))throw TypeError(".onnx.NodeProto.output: array expected");for(s.output=[],u=0;u<r.output.length;++u)s.output[u]=String(r.output[u])}if(r.name!=null&&(s.name=String(r.name)),r.opType!=null&&(s.opType=String(r.opType)),r.domain!=null&&(s.domain=String(r.domain)),r.attribute){if(!Array.isArray(r.attribute))throw TypeError(".onnx.NodeProto.attribute: array expected");for(s.attribute=[],u=0;u<r.attribute.length;++u){if(typeof r.attribute[u]!="object")throw TypeError(".onnx.NodeProto.attribute: object expected");s.attribute[u]=n.onnx.AttributeProto.fromObject(r.attribute[u])}}return r.docString!=null&&(s.docString=String(r.docString)),s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.input=[],u.output=[],u.attribute=[]),s.defaults&&(u.n
10ame="",u.opType="",u.docString="",u.domain=""),r.input&&r.input.length){u.input=[];for(var g=0;g<r.input.length;++g)u.input[g]=r.input[g]}if(r.output&&r.output.length)for(u.output=[],g=0;g<r.output.length;++g)u.output[g]=r.output[g];if(r.name!=null&&r.hasOwnProperty("name")&&(u.name=r.name),r.opType!=null&&r.hasOwnProperty("opType")&&(u.opType=r.opType),r.attribute&&r.attribute.length)for(u.attribute=[],g=0;g<r.attribute.length;++g)u.attribute[g]=n.onnx.AttributeProto.toObject(r.attribute[g],s);return r.docString!=null&&r.hasOwnProperty("docString")&&(u.docString=r.docString),r.domain!=null&&r.hasOwnProperty("domain")&&(u.domain=r.domain),u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.NodeProto"},c}(),l.TrainingInfoProto=function(){function c(r){if(this.initializationBinding=[],this.updateBinding=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.initialization=null,c.prototype.algorithm=null,c.prototype.initializationBinding=h.emptyArray,c.prototype.updateBinding=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.initialization!=null&&Object.hasOwnProperty.call(r,"initialization")&&n.onnx.GraphProto.encode(r.initialization,s.uint32(10).fork()).ldelim(),r.algorithm!=null&&Object.hasOwnProperty.call(r,"algorithm")&&n.onnx.GraphProto.encode(r.algorithm,s.uint32(18).fork()).ldelim(),r.initializationBinding!=null&&r.initializationBinding.length)for(var u=0;u<r.initializationBinding.length;++u)n.onnx.StringStringEntryProto.encode(r.initializationBinding[u],s.uint32(26).fork()).ldelim();if(r.updateBinding!=null&&r.updateBinding.length)for(u=0;u<r.updateBinding.length;++u)n.onnx.StringStringEntryProto.encode(r.updateBinding[u],s.uint32(34).fork()).ldelim();return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.TrainingInfoProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.initialization=n.onnx.GraphProto.decode(r,r.uint32());break;case 2:g.algorithm=n.onnx.GraphProto.decode(r,r.uint32());break;case 3:g.initializationBinding&&g.initializationBinding.length||(g.initializationBinding=[]),g.initializationBinding.push(n.onnx.StringStringEntryProto.decode(r,r.uint32()));break;case 4:g.updateBinding&&g.updateBinding.length||(g.updateBinding=[]),g.updateBinding.push(n.onnx.StringStringEntryProto.decode(r,r.uint32()));break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.initialization!=null&&r.hasOwnProperty("initialization")&&(u=n.onnx.GraphProto.verify(r.initialization)))return"initialization."+u;if(r.algorithm!=null&&r.hasOwnProperty("algorithm")&&(u=n.onnx.GraphProto.verify(r.algorithm)))return"algorithm."+u;if(r.initializationBinding!=null&&r.hasOwnProperty("initializationBinding")){if(!Array.isArray(r.initializationBinding))return"initializationBinding: array expected";for(var s=0;s<r.initializationBinding.length;++s)if(u=n.onnx.StringStringEntryProto.verify(r.initializationBinding[s]))return"initializationBinding."+u}if(r.updateBinding!=null&&r.hasOwnProperty("updateBinding")){if(!Array.isArray(r.updateBinding))return"updateBinding: array expected";for(s=0;s<r.updateBinding.length;++s){var u;if(u=n.onnx.StringStringEntryProto.verify(r.updateBinding[s]))return"updateBinding."+u}}return null},c.fromObject=function(r){if(r instanceof n.onnx.TrainingInfoProto)return r;var s=new n.onnx.TrainingInfoProto;if(r.initialization!=null){if(typeof r.initialization!="object")throw TypeError(".onnx.TrainingInfoProto.initialization: object expected");s.initialization=n.onnx.GraphProto.fromObject(r.initialization)}if(r.algorithm!=null){if(typeof r.algorithm!="object")throw TypeError(".onnx.TrainingInfoProto.algorithm: object expected");s.algorithm=n.onnx.GraphProto.fromObject(r.algorithm)}if(r.initializationBinding){if(!Array.isArray(r.initializationBinding))throw TypeError(".onnx.TrainingInfoProto.initializationBinding: array expected");s.initializationBinding=[];for(var u=0;u<r.initializationBinding.length;++u){if(typeof r.initializationBinding[u]!="object")throw TypeError(".onnx.TrainingInfoProto.initializationBinding: object expected");s.initializationBinding[u]=n.onnx.StringStringEntryProto.fromObject(r.initializationBinding[u])}}if(r.updateBinding){if(!Array.isArray(r.updateBinding))throw TypeError(".onnx.TrainingInfoProto.updateBinding: array expected");for(s.updateBinding=[],u=0;u<r.updateBinding.length;++u){if(typeof r.updateBinding[u]!="object")throw TypeError(".onnx.TrainingInfoProto.updateBinding: object expected");s.updateBinding[u]=n.onnx.StringStringEntryProto.fromObject(r.updateBinding[u])}}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.initializationBinding=[],u.updateBinding=[]),s.defaults&&(u.initialization=null,u.algorithm=null),r.initialization!=null&&r.hasOwnProperty("initialization")&&(u.initialization=n.onnx.GraphProto.toObject(r.initialization,s)),r.algorithm!=null&&r.hasOwnProperty("algorithm")&&(u.algorithm=n.onnx.GraphProto.toObject(r.algorithm,s)),r.initializationBinding&&r.initializationBinding.length){u.initializationBinding=[];for(var g=0;g<r.initializationBinding.length;++g)u.initializationBinding[g]=n.onnx.StringStringEntryProto.toObject(r.initializationBinding[g],s)}if(r.updateBinding&&r.updateBinding.length)for(u.updateBinding=[],g=0;g<r.updateBinding.length;++g)u.updateBinding[g]=n.onnx.StringStringEntryProto.toObject(r.updateBinding[g],s);return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TrainingInfoProto"},c}(),l.ModelProto=function(){function c(r){if(this.opsetImport=[],this.metadataProps=[],this.trainingInfo=[],this.functions=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.irVersion=h.Long?h.Long.fromBits(0,0,!1):0,c.prototype.opsetImport=h.emptyArray,c.prototype.producerName="",c.prototype.producerVersion="",c.prototype.domain="",c.prototype.modelVersion=h.Long?h.Long.fromBits(0,0,!1):0,c.prototype.docString="",c.prototype.graph=null,c.prototype.metadataProps=h.emptyArray,c.prototype.trainingInfo=h.emptyArray,c.prototype.functions=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.irVersion!=null&&Object.hasOwnProperty.call(r,"irVersion")&&s.uint32(8).int64(r.irVersion),r.producerName!=null&&Object.hasOwnProperty.call(r,"producerName")&&s.uint32(18).string(r.producerName),r.producerVersion!=null&&Object.hasOwnProperty.call(r,"producerVersion")&&s.uint32(26).string(r.producerVersion),r.domain!=null&&Object.hasOwnProperty.call(r,"domain")&&s.uint32(34).string(r.domain),r.modelVersion!=null&&Object.hasOwnProperty.call(r,"modelVersion")&&s.uint32(40).int64(r.modelVersion),r.docString!=null&&Object.hasOwnProperty.call(r,"docString")&&s.uint32(50).string(r.docString),r.graph!=null&&Object.hasOwnProperty.call(r,"graph")&&n.onnx.GraphProto.encode(r.graph,s.uint32(58).fork()).ldelim(),r.opsetImport!=null&&r.opsetImport.length)for(var u=0;u<r.opsetImport.length;
10++u)n.onnx.OperatorSetIdProto.encode(r.opsetImport[u],s.uint32(66).fork()).ldelim();if(r.metadataProps!=null&&r.metadataProps.length)for(u=0;u<r.metadataProps.length;++u)n.onnx.StringStringEntryProto.encode(r.metadataProps[u],s.uint32(114).fork()).ldelim();if(r.trainingInfo!=null&&r.trainingInfo.length)for(u=0;u<r.trainingInfo.length;++u)n.onnx.TrainingInfoProto.encode(r.trainingInfo[u],s.uint32(162).fork()).ldelim();if(r.functions!=null&&r.functions.length)for(u=0;u<r.functions.length;++u)n.onnx.FunctionProto.encode(r.functions[u],s.uint32(202).fork()).ldelim();return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.ModelProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.irVersion=r.int64();break;case 8:g.opsetImport&&g.opsetImport.length||(g.opsetImport=[]),g.opsetImport.push(n.onnx.OperatorSetIdProto.decode(r,r.uint32()));break;case 2:g.producerName=r.string();break;case 3:g.producerVersion=r.string();break;case 4:g.domain=r.string();break;case 5:g.modelVersion=r.int64();break;case 6:g.docString=r.string();break;case 7:g.graph=n.onnx.GraphProto.decode(r,r.uint32());break;case 14:g.metadataProps&&g.metadataProps.length||(g.metadataProps=[]),g.metadataProps.push(n.onnx.StringStringEntryProto.decode(r,r.uint32()));break;case 20:g.trainingInfo&&g.trainingInfo.length||(g.trainingInfo=[]),g.trainingInfo.push(n.onnx.TrainingInfoProto.decode(r,r.uint32()));break;case 25:g.functions&&g.functions.length||(g.functions=[]),g.functions.push(n.onnx.FunctionProto.decode(r,r.uint32()));break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.irVersion!=null&&r.hasOwnProperty("irVersion")&&!h.isInteger(r.irVersion)&&!(r.irVersion&&h.isInteger(r.irVersion.low)&&h.isInteger(r.irVersion.high)))return"irVersion: integer|Long expected";if(r.opsetImport!=null&&r.hasOwnProperty("opsetImport")){if(!Array.isArray(r.opsetImport))return"opsetImport: array expected";for(var s=0;s<r.opsetImport.length;++s)if(u=n.onnx.OperatorSetIdProto.verify(r.opsetImport[s]))return"opsetImport."+u}if(r.producerName!=null&&r.hasOwnProperty("producerName")&&!h.isString(r.producerName))return"producerName: string expected";if(r.producerVersion!=null&&r.hasOwnProperty("producerVersion")&&!h.isString(r.producerVersion))return"producerVersion: string expected";if(r.domain!=null&&r.hasOwnProperty("domain")&&!h.isString(r.domain))return"domain: string expected";if(r.modelVersion!=null&&r.hasOwnProperty("modelVersion")&&!h.isInteger(r.modelVersion)&&!(r.modelVersion&&h.isInteger(r.modelVersion.low)&&h.isInteger(r.modelVersion.high)))return"modelVersion: integer|Long expected";if(r.docString!=null&&r.hasOwnProperty("docString")&&!h.isString(r.docString))return"docString: string expected";if(r.graph!=null&&r.hasOwnProperty("graph")&&(u=n.onnx.GraphProto.verify(r.graph)))return"graph."+u;if(r.metadataProps!=null&&r.hasOwnProperty("metadataProps")){if(!Array.isArray(r.metadataProps))return"metadataProps: array expected";for(s=0;s<r.metadataProps.length;++s)if(u=n.onnx.StringStringEntryProto.verify(r.metadataProps[s]))return"metadataProps."+u}if(r.trainingInfo!=null&&r.hasOwnProperty("trainingInfo")){if(!Array.isArray(r.trainingInfo))return"trainingInfo: array expected";for(s=0;s<r.trainingInfo.length;++s)if(u=n.onnx.TrainingInfoProto.verify(r.trainingInfo[s]))return"trainingInfo."+u}if(r.functions!=null&&r.hasOwnProperty("functions")){if(!Array.isArray(r.functions))return"functions: array expected";for(s=0;s<r.functions.length;++s){var u;if(u=n.onnx.FunctionProto.verify(r.functions[s]))return"functions."+u}}return null},c.fromObject=function(r){if(r instanceof n.onnx.ModelProto)return r;var s=new n.onnx.ModelProto;if(r.irVersion!=null&&(h.Long?(s.irVersion=h.Long.fromValue(r.irVersion)).unsigned=!1:typeof r.irVersion=="string"?s.irVersion=parseInt(r.irVersion,10):typeof r.irVersion=="number"?s.irVersion=r.irVersion:typeof r.irVersion=="object"&&(s.irVersion=new h.LongBits(r.irVersion.low>>>0,r.irVersion.high>>>0).toNumber())),r.opsetImport){if(!Array.isArray(r.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");s.opsetImport=[];for(var u=0;u<r.opsetImport.length;++u){if(typeof r.opsetImport[u]!="object")throw TypeError(".onnx.ModelProto.opsetImport: object expected");s.opsetImport[u]=n.onnx.OperatorSetIdProto.fromObject(r.opsetImport[u])}}if(r.producerName!=null&&(s.producerName=String(r.producerName)),r.producerVersion!=null&&(s.producerVersion=String(r.producerVersion)),r.domain!=null&&(s.domain=String(r.domain)),r.modelVersion!=null&&(h.Long?(s.modelVersion=h.Long.fromValue(r.modelVersion)).unsigned=!1:typeof r.modelVersion=="str
10ing"?s.modelVersion=parseInt(r.modelVersion,10):typeof r.modelVersion=="number"?s.modelVersion=r.modelVersion:typeof r.modelVersion=="object"&&(s.modelVersion=new h.LongBits(r.modelVersion.low>>>0,r.modelVersion.high>>>0).toNumber())),r.docString!=null&&(s.docString=String(r.docString)),r.graph!=null){if(typeof r.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");s.graph=n.onnx.GraphProto.fromObject(r.graph)}if(r.metadataProps){if(!Array.isArray(r.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(s.metadataProps=[],u=0;u<r.metadataProps.length;++u){if(typeof r.metadataProps[u]!="object")throw TypeError(".onnx.ModelProto.metadataProps: object expected");s.metadataProps[u]=n.onnx.StringStringEntryProto.fromObject(r.metadataProps[u])}}if(r.trainingInfo){if(!Array.isArray(r.trainingInfo))throw TypeError(".onnx.ModelProto.trainingInfo: array expected");for(s.trainingInfo=[],u=0;u<r.trainingInfo.length;++u){if(typeof r.trainingInfo[u]!="object")throw TypeError(".onnx.ModelProto.trainingInfo: object expected");s.trainingInfo[u]=n.onnx.TrainingInfoProto.fromObject(r.trainingInfo[u])}}if(r.functions){if(!Array.isArray(r.functions))throw TypeError(".onnx.ModelProto.functions: array expected");for(s.functions=[],u=0;u<r.functions.length;++u){if(typeof r.functions[u]!="object")throw TypeError(".onnx.ModelProto.functions: object expected");s.functions[u]=n.onnx.FunctionProto.fromObject(r.functions[u])}}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.opsetImport=[],u.metadataProps=[],u.trainingInfo=[],u.functions=[]),s.defaults){if(h.Long){var g=new h.Long(0,0,!1);u.irVersion=s.longs===String?g.toString():s.longs===Number?g.toNumber():g}else u.irVersion=s.longs===String?"0":0;u.producerName="",u.producerVersion="",u.domain="",h.Long?(g=new h.Long(0,0,!1),u.modelVersion=s.longs===String?g.toString():s.longs===Number?g.toNumber():g):u.modelVersion=s.longs===String?"0":0,u.docString="",u.graph=null}if(r.irVersion!=null&&r.hasOwnProperty("irVersion")&&(typeof r.irVersion=="number"?u.irVersion=s.longs===String?String(r.irVersion):r.irVersion:u.irVersion=s.longs===String?h.Long.prototype.toString.call(r.irVersion):s.longs===Number?new h.LongBits(r.irVersion.low>>>0,r.irVersion.high>>>0).toNumber():r.irVersion),r.producerName!=null&&r.hasOwnProperty("producerName")&&(u.producerName=r.producerName),r.producerVersion!=null&&r.hasOwnProperty("producerVersion")&&(u.producerVersion=r.producerVersion),r.domain!=null&&r.hasOwnProperty("domain")&&(u.domain=r.domain),r.modelVersion!=null&&r.hasOwnProperty("modelVersion")&&(typeof r.modelVersion=="number"?u.modelVersion=s.longs===String?String(r.modelVersion):r.modelVersion:u.modelVersion=s.longs===String?h.Long.prototype.toString.call(r.modelVersion):s.longs===Number?new h.LongBits(r.modelVersion.low>>>0,r.modelVersion.high>>>0).toNumber():r.modelVersion),r.docString!=null&&r.hasOwnProperty("docString")&&(u.docString=r.docString),r.graph!=null&&r.hasOwnProperty("graph")&&(u.graph=n.onnx.GraphProto.toObject(r.graph,s)),r.opsetImport&&r.opsetImport.length){u.opsetImport=[];for(var y=0;y<r.opsetImport.length;++y)u.opsetImport[y]=n.onnx.OperatorSetIdProto.toObject(r.opsetImport[y],s)}if(r.metadataProps&&r.metadataProps.length)for(u.metadataProps=[],y=0;y<r.metadataProps.length;++y)u.metadataProps[y]=n.onnx.StringStringEntryProto.toObject(r.metadataProps[y],s);if(r.trainingInfo&&r.trainingInfo.length)for(u.trainingInfo=[],y=0;y<r.trainingInfo.length;++y)u.trainingInfo[y]=n.onnx.TrainingInfoProto.toObject(r.trainingInfo[y],s);if(r.functions&&r.functions.length)for(u.functions=[],y=0;y<r.functions.length;++y)u.functions[y]=n.onnx.FunctionProto.toObject(r.functions[y],s);return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.ModelProto"},c}(),l.StringStringEntryProto=function(){function c(r){if(r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.key="",c.prototype.value="",c.create=function(r){return new c(r)},c.encode=function(r,s){return s||(s=p.create()),r.key!=null&&Object.hasOwnProperty.call(r,"key")&&s.uint32(10).string(r.key),r.value!=null&&Object.hasOwnProperty.call(r,"value")&&s.uint32(18).string(r.value),s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.StringStringEntryProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.key=r.string();break;case 2:g.value=r.string();break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){return typeof r!="object"||r===null?"object expected":r.key!=null&&r.hasOwnProperty("key")&&!h.isString(r.key)?"key: string expected":r.value!=null&&r.hasOwnProperty("value")&&!h.isString(r.value)?"value: string expected":null},c.fromObject=function(r){if(r instanceof n.onnx.StringStringEntryProto)return r;var s=new n.onnx.StringStringEntryProto;return r.key!=null&&(s.key=String(r.key)),r.value!=null&&(s.value=String(r.value)),s},c.toObject=function(r,s){s||(s={});var u={};return s.defaults&&(u.key="",u.value=""),r.key!=null&&r.hasOwnProperty("key")&&(u.key=r.key),r.value!=null&&r.hasOwnProperty("value")&&(u.value=r.value),u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.StringStringEntryProto"},c}(),l.TensorAnnotation=function(){function c(r){if(this.quantParameterTensorNames=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.tensorName="",c.prototype.quantParameterTensorNames=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.tensorName!=null&&Object.hasOwnProperty.call(r,"tensorName")&&s.uint32(10).string(r.tensorName),r.quantParameterTensorNames!=null&&r.quantParameterTensorNames.length)for(var u=0;u<r.quantParameterTensorNames.length;++u)n.onnx.StringStringEntryProto.encode(r.quantParameterTensorNames[u],s.uint32(18).fork()).ldelim();return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.TensorAnnotation;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.tensorName=r.string();break;case 2:g.quantParameterTensorNames&&g.quantParameterTensorNames.length||(g.quantParameterTensorNames=[]),g.quantParameterTensorNames.push(n.onnx.StringStringEntryProto.decode(r,r.uint32()));break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.tensorName!=null&&r.hasOwnProperty("tensorName")&&!h.isString(r.tensorName))return"tensorName: string expected";if(r.quantParameterTensorNames!=null&&r.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(r.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var s=0;s<r.quantParameterTensorNames.length;++s){var u=n.onnx.StringStringEntryProto.verify(r.quantParameterTensorNames[s]);if(u)return"quantParameterTensorNames."+u}}return null},c.fromObject=function(r){if(r instanceof n.onnx.TensorAnnotation)return r;var s=new n.onnx.TensorAnnotation;if(r.tensorName!=null&&(s.tensorName=String(r.tensorName)),r.quantParameterTensorNames){if
10(!Array.isArray(r.quantParameterTensorNames))throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: array expected");s.quantParameterTensorNames=[];for(var u=0;u<r.quantParameterTensorNames.length;++u){if(typeof r.quantParameterTensorNames[u]!="object")throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: object expected");s.quantParameterTensorNames[u]=n.onnx.StringStringEntryProto.fromObject(r.quantParameterTensorNames[u])}}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.quantParameterTensorNames=[]),s.defaults&&(u.tensorName=""),r.tensorName!=null&&r.hasOwnProperty("tensorName")&&(u.tensorName=r.tensorName),r.quantParameterTensorNames&&r.quantParameterTensorNames.length){u.quantParameterTensorNames=[];for(var g=0;g<r.quantParameterTensorNames.length;++g)u.quantParameterTensorNames[g]=n.onnx.StringStringEntryProto.toObject(r.quantParameterTensorNames[g],s)}return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TensorAnnotation"},c}(),l.GraphProto=function(){function c(r){if(this.node=[],this.initializer=[],this.sparseInitializer=[],this.input=[],this.output=[],this.valueInfo=[],this.quantizationAnnotation=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.node=h.emptyArray,c.prototype.name="",c.prototype.initializer=h.emptyArray,c.prototype.sparseInitializer=h.emptyArray,c.prototype.docString="",c.prototype.input=h.emptyArray,c.prototype.output=h.emptyArray,c.prototype.valueInfo=h.emptyArray,c.prototype.quantizationAnnotation=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.node!=null&&r.node.length)for(var u=0;u<r.node.length;++u)n.onnx.NodeProto.encode(r.node[u],s.uint32(10).fork()).ldelim();if(r.name!=null&&Object.hasOwnProperty.call(r,"name")&&s.uint32(18).string(r.name),r.initializer!=null&&r.initializer.length)for(u=0;u<r.initializer.length;++u)n.onnx.TensorProto.encode(r.initializer[u],s.uint32(42).fork()).ldelim();if(r.docString!=null&&Object.hasOwnProperty.call(r,"docString")&&s.uint32(82).string(r.docString),r.input!=null&&r.input.length)for(u=0;u<r.input.length;++u)n.onnx.ValueInfoProto.encode(r.input[u],s.uint32(90).fork()).ldelim();if(r.output!=null&&r.output.length)for(u=0;u<r.output.length;++u)n.onnx.ValueInfoProto.encode(r.output[u],s.uint32(98).fork()).ldelim();if(r.valueInfo!=null&&r.valueInfo.length)for(u=0;u<r.valueInfo.length;++u)n.onnx.ValueInfoProto.encode(r.valueInfo[u],s.uint32(106).fork()).ldelim();if(r.quantizationAnnotation!=null&&r.quantizationAnnotation.length)for(u=0;u<r.quantizationAnnotation.length;++u)n.onnx.TensorAnnotation.encode(r.quantizationAnnotation[u],s.uint32(114).fork()).ldelim();if(r.sparseInitializer!=null&&r.sparseInitializer.length)for(u=0;u<r.sparseInitializer.length;++u)n.onnx.SparseTensorProto.encode(r.sparseInitializer[u],s.uint32(122).fork()).ldelim();return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.GraphProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.node&&g.node.length||(g.node=[]),g.node.push(n.onnx.NodeProto.decode(r,r.uint32()));break;case 2:g.name=r.string();break;case 5:g.initializer&&g.initializer.length||(g.initializer=[]),g.initializer.push(n.onnx.TensorProto.decode(r,r.uint32()));break;case 15:g.sparseInitializer&&g.sparseInitializer.length||(g.sparseInitializer=[]),g.sparseInitializer.push(n.onnx.SparseTensorProto.decode(r,r.uint32()));break;case 10:g.docString=r.string();break;case 11:g.input&&g.input.length||(g.input=[]),g.input.push(n.onnx.ValueInfoProto.decode(r,r.uint32()));break;case 12:g.output&&g.output.length||(g.output=[]),g.output.push(n.onnx.ValueInfoProto.decode(r,r.uint32()));break;case 13:g.valueInfo&&g.valueInfo.length||(g.valueInfo=[]),g.valueInfo.push(n.onnx.ValueInfoProto.decode(r,r.uint32()));break;case 14:g.quantizationAnnotation&&g.quantizationAnnotation.length||(g.quantizationAnnotation=[]),g.quantizationAnnotation.push(n.onnx.TensorAnnotation.decode(r,r.uint32()));break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.node!=null&&r.hasOwnProperty("node")){if(!Array.isArray(r.no
10de))return"node: array expected";for(var s=0;s<r.node.length;++s)if(u=n.onnx.NodeProto.verify(r.node[s]))return"node."+u}if(r.name!=null&&r.hasOwnProperty("name")&&!h.isString(r.name))return"name: string expected";if(r.initializer!=null&&r.hasOwnProperty("initializer")){if(!Array.isArray(r.initializer))return"initializer: array expected";for(s=0;s<r.initializer.length;++s)if(u=n.onnx.TensorProto.verify(r.initializer[s]))return"initializer."+u}if(r.sparseInitializer!=null&&r.hasOwnProperty("sparseInitializer")){if(!Array.isArray(r.sparseInitializer))return"sparseInitializer: array expected";for(s=0;s<r.sparseInitializer.length;++s)if(u=n.onnx.SparseTensorProto.verify(r.sparseInitializer[s]))return"sparseInitializer."+u}if(r.docString!=null&&r.hasOwnProperty("docString")&&!h.isString(r.docString))return"docString: string expected";if(r.input!=null&&r.hasOwnProperty("input")){if(!Array.isArray(r.input))return"input: array expected";for(s=0;s<r.input.length;++s)if(u=n.onnx.ValueInfoProto.verify(r.input[s]))return"input."+u}if(r.output!=null&&r.hasOwnProperty("output")){if(!Array.isArray(r.output))return"output: array expected";for(s=0;s<r.output.length;++s)if(u=n.onnx.ValueInfoProto.verify(r.output[s]))return"output."+u}if(r.valueInfo!=null&&r.hasOwnProperty("valueInfo")){if(!Array.isArray(r.valueInfo))return"valueInfo: array expected";for(s=0;s<r.valueInfo.length;++s)if(u=n.onnx.ValueInfoProto.verify(r.valueInfo[s]))return"valueInfo."+u}if(r.quantizationAnnotation!=null&&r.hasOwnProperty("quantizationAnnotation")){if(!Array.isArray(r.quantizationAnnotation))return"quantizationAnnotation: array expected";for(s=0;s<r.quantizationAnnotation.length;++s){var u;if(u=n.onnx.TensorAnnotation.verify(r.quantizationAnnotation[s]))return"quantizationAnnotation."+u}}return null},c.fromObject=function(r){if(r instanceof n.onnx.GraphProto)return r;var s=new n.onnx.GraphProto;if(r.node){if(!Array.isArray(r.node))throw TypeError(".onnx.GraphProto.node: array expected");s.node=[];for(var u=0;u<r.node.length;++u){if(typeof r.node[u]!="object")throw TypeError(".onnx.GraphProto.node: object expected");s.node[u]=n.onnx.NodeProto.fromObject(r.node[u])}}if(r.name!=null&&(s.name=String(r.name)),r.initializer){if(!Array.isArray(r.initializer))throw TypeError(".onnx.GraphProto.initializer: array expected");for(s.initializer=[],u=0;u<r.initializer.length;++u){if(typeof r.initializer[u]!="object")throw TypeError(".onnx.GraphProto.initializer: object expected");s.initializer[u]=n.onnx.TensorProto.fromObject(r.initializer[u])}}if(r.sparseInitializer){if(!Array.isArray(r.sparseInitializer))throw TypeError(".onnx.GraphProto.sparseInitializer: array expected");for(s.sparseInitializer=[],u=0;u<r.sparseInitializer.length;++u){if(typeof r.sparseInitializer[u]!="object")throw TypeError(".onnx.GraphProto.sparseInitializer: object expected");s.sparseInitializer[u]=n.onnx.SparseTensorProto.fromObject(r.sparseInitializer[u])}}if(r.docString!=null&&(s.docString=String(r.docString)),r.input){if(!Array.isArray(r.input))throw TypeError(".onnx.GraphProto.input: array expected");for(s.input=[],u=0;u<r.input.length;++u){if(typeof r.input[u]!="object")throw TypeError(".onnx.GraphProto.input: object expected");s.input[u]=n.onnx.ValueInfoProto.fromObject(r.input[u])}}if(r.output){if(!Array.isArray(r.output))throw TypeError(".onnx.GraphProto.output: array expected");for(s.output=[],u=0;u<r.output.length;++u){if(typeof r.output[u]!="object")throw TypeError(".onnx.GraphProto.output: object expected");s.output[u]=n.onnx.ValueInfoProto.fromObject(r.output[u])}}if(r.valueInfo){if(!Array.isArray(r.valueInfo))throw TypeError(".onnx.GraphProto.valueInfo: array expected");for(s.valueInfo=[],u=0;u<r.valueInfo.length;++u){if(typeof r.valueInfo[u]!="object")throw TypeError(".onnx.GraphProto.valueInfo: object expected");s.valueInfo[u]=n.onnx.ValueInfoProto.fromObject(r.valueInfo[u])}}if(r.quantizationAnnotation){if(!Array.isArray(r.quantizationAnnotation))throw TypeError(".onnx.GraphProto.quantizationAnnotation: array expected");for(s.quantizationAnnotation=[],u=0;u<r.quantizationAnnotation.length;++u){if(typeof r.quantizationAnnotation[u]!="object")throw TypeError(".onnx.GraphProto.quantizationAnnotation: object expected");s.quantizationAnnotation[u]=n.onnx.TensorAnnotation.fromObject(r.quantizationAnnotation[u])}}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.node=[],u.initializer=[],u.input=[],u.output=[],u.valueInfo=[],u.quantizationAnnotation=[],u.sparseInitializer=[]),s.defaults&&(u.n
10ame="",u.docString=""),r.node&&r.node.length){u.node=[];for(var g=0;g<r.node.length;++g)u.node[g]=n.onnx.NodeProto.toObject(r.node[g],s)}if(r.name!=null&&r.hasOwnProperty("name")&&(u.name=r.name),r.initializer&&r.initializer.length)for(u.initializer=[],g=0;g<r.initializer.length;++g)u.initializer[g]=n.onnx.TensorProto.toObject(r.initializer[g],s);if(r.docString!=null&&r.hasOwnProperty("docString")&&(u.docString=r.docString),r.input&&r.input.length)for(u.input=[],g=0;g<r.input.length;++g)u.input[g]=n.onnx.ValueInfoProto.toObject(r.input[g],s);if(r.output&&r.output.length)for(u.output=[],g=0;g<r.output.length;++g)u.output[g]=n.onnx.ValueInfoProto.toObject(r.output[g],s);if(r.valueInfo&&r.valueInfo.length)for(u.valueInfo=[],g=0;g<r.valueInfo.length;++g)u.valueInfo[g]=n.onnx.ValueInfoProto.toObject(r.valueInfo[g],s);if(r.quantizationAnnotation&&r.quantizationAnnotation.length)for(u.quantizationAnnotation=[],g=0;g<r.quantizationAnnotation.length;++g)u.quantizationAnnotation[g]=n.onnx.TensorAnnotation.toObject(r.quantizationAnnotation[g],s);if(r.sparseInitializer&&r.sparseInitializer.length)for(u.sparseInitializer=[],g=0;g<r.sparseInitializer.length;++g)u.sparseInitializer[g]=n.onnx.SparseTensorProto.toObject(r.sparseInitializer[g],s);return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.GraphProto"},c}(),l.TensorProto=function(){function c(r){if(this.dims=[],this.floatData=[],this.int32Data=[],this.stringData=[],this.int64Data=[],this.externalData=[],this.doubleData=[],this.uint64Data=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.dims=h.emptyArray,c.prototype.dataType=0,c.prototype.segment=null,c.prototype.floatData=h.emptyArray,c.prototype.int32Data=h.emptyArray,c.prototype.stringData=h.emptyArray,c.prototype.int64Data=h.emptyArray,c.prototype.name="",c.prototype.docString="",c.prototype.rawData=h.newBuffer([]),c.prototype.externalData=h.emptyArray,c.prototype.dataLocation=0,c.prototype.doubleData=h.emptyArray,c.prototype.uint64Data=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.dims!=null&&r.dims.length){s.uint32(10).fork();for(var u=0;u<r.dims.length;++u)s.int64(r.dims[u]);s.ldelim()}if(r.dataType!=null&&Object.hasOwnProperty.call(r,"dataType")&&s.uint32(16).int32(r.dataType),r.segment!=null&&Object.hasOwnProperty.call(r,"segment")&&n.onnx.TensorProto.Segment.encode(r.segment,s.uint32(26).fork()).ldelim(),r.floatData!=null&&r.floatData.length){for(s.uint32(34).fork(),u=0;u<r.floatData.length;++u)s.float(r.floatData[u]);s.ldelim()}if(r.int32Data!=null&&r.int32Data.length){for(s.uint32(42).fork(),u=0;u<r.int32Data.length;++u)s.int32(r.int32Data[u]);s.ldelim()}if(r.stringData!=null&&r.stringData.length)for(u=0;u<r.stringData.length;++u)s.uint32(50).bytes(r.stringData[u]);if(r.int64Data!=null&&r.int64Data.length){for(s.uint32(58).fork(),u=0;u<r.int64Data.length;++u)s.int64(r.int64Data[u]);s.ldelim()}if(r.name!=null&&Object.hasOwnProperty.call(r,"name")&&s.uint32(66).string(r.name),r.rawData!=null&&Object.hasOwnProperty.call(r,"rawData")&&s.uint32(74).bytes(r.rawData),r.doubleData!=null&&r.doubleData.length){for(s.uint32(82).fork(),u=0;u<r.doubleData.length;++u)s.double(r.doubleData[u]);s.ldelim()}if(r.uint64Data!=null&&r.uint64Data.length){for(s.uint32(90).fork(),u=0;u<r.uint64Data.length;++u)s.uint64(r.uint64Data[u]);s.ldelim()}if(r.docString!=null&&Object.hasOwnProperty.call(r,"docString")&&s.uint32(98).string(r.docString),r.externalData!=null&&r.externalData.length)for(u=0;u<r.externalData.length;++u)n.onnx.StringStringEntryProto.encode(r.externalData[u],s.uint32(106).fork()).ldelim();return r.dataLocation!=null&&Object.hasOwnProperty.call(r,"dataLocation")&&s.uint32(112).int32(r.dataLocation),s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.TensorProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:if(g.dims&&g.dims.length||(g.dims=[]),(7&y)==2)for(var S=r.uint32()+r.pos;r.pos<S;)g.dims.push(r.int64());else g.dims.push(r.int64());break;case 2:g.dataType=r.int32();break;case 3:g.segment=n.onnx.TensorProto.Segment.decode(r,r.uint32());break;case 4:if(g.floatData&&g.floatData.length||(g.floatData=[]),(7&y)==2)for(S=r.uint32()+r.pos;r.pos<S;)g.floatData.push(r.float());else g.floatData.push(r.float());break;case 5:if(g.int32Data&&g.int32Data.length||(g.int32Data=[]),(7&y)==2)for(S=r.uint32()+r.pos;r.pos<S;)g.int32Data.push(r.int32());else g.int32Data.push(r.int32());break;case 6:g.stringData&&g.stringData.length||(g.stringData=[]),g.stringData.push(r.bytes());break;case 7:if(g.int64Data&&g.int64Data.length||(g.int64Data=[]),(7&y)==2)for(S=r.uint32()+r.pos;r.pos<S;)g.int64Data.push(r.int64());else g.int64Data.push(r.int64());break;case 8:g.name=r.string();break;case 12:g.docString=r.string();break;case 9:g.rawData=r.bytes();break;case 13:g.externalData&&g.externalData.length||(g.externalData=[]),g.externalData.push(n.onnx.StringStringEntryProto.decode(r,r.uint32()));break;case 14:g.dataLocation=r.int32();break;case 10:if(g.doubleData&&g.doubleData.length||(g.doubleData=[]),(7&y)==2)for(S=r.uint32()+r.pos;r.pos<S;)g.doubleData.push(r.double());else g.doubleData.push(r.double());break;case 11:if(g.uint64Data&&g.uint64Data.length||(g.uint64Data=[]),(7&y)==2)for(S=r.uint32()+r.pos;r.pos<S;)g.uint64Data.push(r.uint64());else g.uint64Data.push(r.uint64());break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.dims!=null&&r.hasOwnProperty("dims")){if(!Array.isArray(r.dims))return"dims: array expected";for(var s=0;s<r.dims.length;++s)if(!(h.isInteger(r.dims[s])||r.dims[s]&&h.isInteger(r.dims[s].low)&&h.isInteger(r.dims[s].high)))return"dims: integer|Long[] expected"}if(r.dataType!=null&&r.hasOwnProperty("dataType")&&!h.isInteger(r.dataType))return"dataType: integer expected";if(r.segment!=null&&r.hasOwnProperty("segment")&&(u=n.onnx.TensorProto.Segment.verify(r.segment)))return"segment."+u;if(r.floatData!=null&&r.hasOwnProperty("floatData")){if(!Array.isArray(r.floatData))return"floatData: array expected";for(s=0;s<r.floatData.length;++s)if(typeof r.floatData[s]!="number")return"floatData: number[] expected"}if(r.int32Data!=null&&r.hasOwnProperty("int32Data")){if(!Array.isArray(r.int32Data))return"int32Data: array expected";for(s=0;s<r.int32Data.length;++s)if(!h.isInteger(r.int32Data[s]))return"int32Data: integer[] expected"}
10if(r.stringData!=null&&r.hasOwnProperty("stringData")){if(!Array.isArray(r.stringData))return"stringData: array expected";for(s=0;s<r.stringData.length;++s)if(!(r.stringData[s]&&typeof r.stringData[s].length=="number"||h.isString(r.stringData[s])))return"stringData: buffer[] expected"}if(r.int64Data!=null&&r.hasOwnProperty("int64Data")){if(!Array.isArray(r.int64Data))return"int64Data: array expected";for(s=0;s<r.int64Data.length;++s)if(!(h.isInteger(r.int64Data[s])||r.int64Data[s]&&h.isInteger(r.int64Data[s].low)&&h.isInteger(r.int64Data[s].high)))return"int64Data: integer|Long[] expected"}if(r.name!=null&&r.hasOwnProperty("name")&&!h.isString(r.name))return"name: string expected";if(r.docString!=null&&r.hasOwnProperty("docString")&&!h.isString(r.docString))return"docString: string expected";if(r.rawData!=null&&r.hasOwnProperty("rawData")&&!(r.rawData&&typeof r.rawData.length=="number"||h.isString(r.rawData)))return"rawData: buffer expected";if(r.externalData!=null&&r.hasOwnProperty("externalData")){if(!Array.isArray(r.externalData))return"externalData: array expected";for(s=0;s<r.externalData.length;++s){var u;if(u=n.onnx.StringStringEntryProto.verify(r.externalData[s]))return"externalData."+u}}if(r.dataLocation!=null&&r.hasOwnProperty("dataLocation"))switch(r.dataLocation){default:return"dataLocation: enum value expected";case 0:case 1:}if(r.doubleData!=null&&r.hasOwnProperty("doubleData")){if(!Array.isArray(r.doubleData))return"doubleData: array expected";for(s=0;s<r.doubleData.length;++s)if(typeof r.doubleData[s]!="number")return"doubleData: number[] expected"}if(r.uint64Data!=null&&r.hasOwnProperty("uint64Data")){if(!Array.isArray(r.uint64Data))return"uint64Data: array expected";for(s=0;s<r.uint64Data.length;++s)if(!(h.isInteger(r.uint64Data[s])||r.uint64Data[s]&&h.isInteger(r.uint64Data[s].low)&&h.isInteger(r.uint64Data[s].high)))return"uint64Data: integer|Long[] expected"}return null},c.fromObject=function(r){if(r instanceof n.onnx.TensorProto)return r;var s=new n.onnx.TensorProto;if(r.dims){if(!Array.isArray(r.dims))throw TypeError(".onnx.TensorProto.dims: array expected");s.dims=[];for(var u=0;u<r.dims.length;++u)h.Long?(s.dims[u]=h.Long.fromValue(r.dims[u])).unsigned=!1:typeof r.dims[u]=="string"?s.dims[u]=parseInt(r.dims[u],10):typeof r.dims[u]=="number"?s.dims[u]=r.dims[u]:typeof r.dims[u]=="object"&&(s.dims[u]=new h.LongBits(r.dims[u].low>>>0,r.dims[u].high>>>0).toNumber())}if(r.dataType!=null&&(s.dataType=0|r.dataType),r.segment!=null){if(typeof r.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");s.segment=n.onnx.TensorProto.Segment.fromObject(r.segment)}if(r.floatData){if(!Array.isArray(r.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(s.floatData=[],u=0;u<r.floatData.length;++u)s.floatData[u]=Number(r.floatData[u])}if(r.int32Data){if(!Array.isArray(r.int32Data))throw TypeError(".onnx.TensorProto.int32Data: array expected");for(s.int32Data=[],u=0;u<r.int32Data.length;++u)s.int32Data[u]=0|r.int32Data[u]}if(r.stringData){if(!Array.isArray(r.stringData))throw TypeError(".onnx.TensorProto.stringData: array expected");for(s.stringData=[],u=0;u<r.stringData.length;++u)typeof r.stringData[u]=="string"?h.base64.decode(r.stringData[u],s.stringData[u]=h.newBuffer(h.base64.length(r.stringData[u])),0):r.stringData[u].length>=0&&(s.stringData[u]=r.stringData[u])}if(r.int64Data){if(!Array.isArray(r.int64Data))throw TypeError(".onnx.TensorProto.int64Data: array expected");for(s.int64Data=[],u=0;u<r.int64Data.length;++u)h.Long?(s.int64Data[u]=h.Long.fromValue(r.int64Data[u])).unsigned=!1:typeof r.int64Data[u]=="string"?s.int64Data[u]=parseInt(r.int64Data[u],10):typeof r.int64Data[u]=="number"?s.int64Data[u]=r.int64Data[u]:typeof r.int64Data[u]=="object"&&(s.int64Data[u]=new h.LongBits(r.int64Data[u].low>>>0,r.int64Data[u].high>>>0).toNumber())}if(r.name!=null&&(s.name=String(r.name)),r.docString!=null&&(s.docString=String(r.docString)),r.rawData!=null&&(typeof r.rawData=="string"?h.base64.decode(r.rawData,s.rawData=h.newBuffer(h.base64.length(r.rawData)),0):r.rawData.length>=0&&(s.rawData=r.rawData)),r.externalData){if(!Array.isArray(r.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(s.externalData=[],u=0;u<r.externalData.length;++u){if(typeof r.externalData[u]!="object")throw TypeError(".onnx.TensorProto.externalData: object expected");s.externalData[u]=n.onnx.StringStringEntryProto.fromObject(r.externalData[u])}}switch(r.dataLocation){default:if(typeof r.dataLocation=="number"){s.dataLocation=r.dataLocation;break}break;case"DEFAULT":case 0:s.dataLocation=0;break;case"EXTERNAL":case 1:s.dataLocation=1}if(r.doubleData){if(!Array.isArray(r.doubleData))throw TypeError(".onnx.TensorProto.doubleData: array expected");for(s.doubleData=[],u=0;u<r.doubleData.length;++u)s.doubleData[u]=Number(r.doubleData[u])}if(r.uint64Data){if(!Array.isArray(r.uint64Data))throw TypeError(".onnx.TensorProto.uint64Data: array expected");for(s.uint64Data=[],u=0;u<r.uint64Data.length;++u)h.Long?(s.uint64Data[u]=h.Long.fromValue(r.uint64Data[u])).unsigned=!0:typeof r.uint64Data[u]=="string"?s.uint64Data[u]=
10parseInt(r.uint64Data[u],10):typeof r.uint64Data[u]=="number"?s.uint64Data[u]=r.uint64Data[u]:typeof r.uint64Data[u]=="object"&&(s.uint64Data[u]=new h.LongBits(r.uint64Data[u].low>>>0,r.uint64Data[u].high>>>0).toNumber(!0))}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.dims=[],u.floatData=[],u.int32Data=[],u.stringData=[],u.int64Data=[],u.doubleData=[],u.uint64Data=[],u.externalData=[]),s.defaults&&(u.dataType=0,u.segment=null,u.name="",s.bytes===String?u.rawData="":(u.rawData=[],s.bytes!==Array&&(u.rawData=h.newBuffer(u.rawData))),u.docString="",u.dataLocation=s.enums===String?"DEFAULT":0),r.dims&&r.dims.length){u.dims=[];for(var g=0;g<r.dims.length;++g)typeof r.dims[g]=="number"?u.dims[g]=s.longs===String?String(r.dims[g]):r.dims[g]:u.dims[g]=s.longs===String?h.Long.prototype.toString.call(r.dims[g]):s.longs===Number?new h.LongBits(r.dims[g].low>>>0,r.dims[g].high>>>0).toNumber():r.dims[g]}if(r.dataType!=null&&r.hasOwnProperty("dataType")&&(u.dataType=r.dataType),r.segment!=null&&r.hasOwnProperty("segment")&&(u.segment=n.onnx.TensorProto.Segment.toObject(r.segment,s)),r.floatData&&r.floatData.length)for(u.floatData=[],g=0;g<r.floatData.length;++g)u.floatData[g]=s.json&&!isFinite(r.floatData[g])?String(r.floatData[g]):r.floatData[g];if(r.int32Data&&r.int32Data.length)for(u.int32Data=[],g=0;g<r.int32Data.length;++g)u.int32Data[g]=r.int32Data[g];if(r.stringData&&r.stringData.length)for(u.stringData=[],g=0;g<r.stringData.length;++g)u.stringData[g]=s.bytes===String?h.base64.encode(r.stringData[g],0,r.stringData[g].length):s.bytes===Array?Array.prototype.slice.call(r.stringData[g]):r.stringData[g];if(r.int64Data&&r.int64Data.length)for(u.int64Data=[],g=0;g<r.int64Data.length;++g)typeof r.int64Data[g]=="number"?u.int64Data[g]=s.longs===String?String(r.int64Data[g]):r.int64Data[g]:u.int64Data[g]=s.longs===String?h.Long.prototype.toString.call(r.int64Data[g]):s.longs===Number?new h.LongBits(r.int64Data[g].low>>>0,r.int64Data[g].high>>>0).toNumber():r.int64Data[g];if(r.name!=null&&r.hasOwnProperty("name")&&(u.name=r.name),r.rawData!=null&&r.hasOwnProperty("rawData")&&(u.rawData=s.bytes===String?h.base64.encode(r.rawData,0,r.rawData.length):s.bytes===Array?Array.prototype.slice.call(r.rawData):r.rawData),r.doubleData&&r.doubleData.length)for(u.doubleData=[],g=0;g<r.doubleData.length;++g)u.doubleData[g]=s.json&&!isFinite(r.doubleData[g])?String(r.doubleData[g]):r.doubleData[g];if(r.uint64Data&&r.uint64Data.length)for(u.uint64Data=[],g=0;g<r.uint64Data.length;++g)typeof r.uint64Data[g]=="number"?u.uint64Data[g]=s.longs===String?String(r.uint64Data[g]):r.uint64Data[g]:u.uint64Data[g]=s.longs===String?h.Long.prototype.toString.call(r.uint64Data[g]):s.longs===Number?new h.LongBits(r.uint64Data[g].low>>>0,r.uint64Data[g].high>>>0).toNumber(!0):r.uint64Data[g];if(r.docString!=null&&r.hasOwnProperty("docString")&&(u.docString=r.docString),r.externalData&&r.externalData.length)for(u.externalData=[],g=0;g<r.externalData.length;++g)u.externalData[g]=n.onnx.StringStringEntryProto.toObject(r.externalData[g],s);return r.dataLocation!=null&&r.hasOwnProperty("dataLocation")&&(u.dataLocation=s.enums===String?n.onnx.TensorProto.DataLocation[r.dataLocation]===void 0?r.dataLocation:n.onnx.TensorProto.DataLocation[r.dataLocation]:r.dataLocation),u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TensorProto"},c.DataType=function(){var r={},s=Object.create(r);return s[r[0]="UNDEFINED"]=0,s[r[1]="FLOAT"]=1,s[r[2]="UINT8"]=2,s[r[3]="INT8"]=3,s[r[4]="UINT16"]=4,s[r[5]="INT16"]=5,s[r[6]="INT32"]=6,s[r[7]="INT64"]=7,s[r[8]="STRING"]=8,s[r[9]="BOOL"]=9,s[r[10]="FLOAT16"]=10,s[r[11]="DOUBLE"]=11,s[r[12]="UINT32"]=12,s[r[13]="UINT64"]=13,s[r[14]="COMPLEX64"]=14,s[r[15]="COMPLEX128"]=15,s[r[16]="BFLOAT16"]=16,s[r[17]="FLOAT8E4M3FN"]=17,s[r[18]="FLOAT8E4M3FNUZ"]=18,s[r[19]="FLOAT8E5M2"]=19,s[r[20]="FLOAT8E5M2FNUZ"]=20,s}(),c.Segment=function(){function r(s){if(s)for(var u=Object.keys(s),g=0;g<u.length;++g)s[u[g]]!=null&&(this[u[g]]=s[u[g]])}return r.prototype.begin=h.Long?h.Long.fromBits(0,0,!1):0,r.prototype.end=h.Long?h.Long.fromBits(0,0,!1):0,r.create=function(s){return new r(s)},r.encode=function(s,u){return u||(u=p.create()),s.begin!=null&&Object.hasOwnProperty.call(s,"begin")&&u.uint32(8).int64(s.begin),s.end!=null&&Object.hasOwnProperty.call(s,"end")&&u.uint32(16).int64(s.end),u},r.encodeDelimited=function(s,u){return this.encode(s,u).ldelim()},r.decode=function(s,u){s instanceof d||(s=d.create(s));for(var g=u===void 0?s.len:s.pos+u,y=new n.onnx.TensorProto.Segment;s.pos<g;){var S=s.uint32();switch(S>>>3){case 1:y.begin=s.int64();break;case 2:y.end=s.int64();break;default:s.skipType(7&S)}}return y},r.decodeDelimited=function(s){return s instanceof d||(s=new d(s)),this.decode(s,s.uint32())},r.verify=function(s){return typeof s!="object"||s===null?"object expected":s.begin==null||!s.hasOwnProperty("begin")||h.isInteger(s.begin)||s.begin&&h.isInteger(s.begin.low)&&h.isInteger(s.begin.high)?s.end==null||!s.hasOwnProperty("end")||h.isInteger(s.end)||s.end&&h.isInteger(s.end.low)&&h.isInteger(s.end.high)?null:"end: integer|Long expected":"begin: integer|Long expected"},r.fromObject=function(s){if(s instanceof n.onnx.TensorProto.Segment)return s;var u=new n.onnx.TensorProto.Segment;return s.begin!=null&&(h.Long?(u.begin=h.Long.fromValue(s.begin)).unsigned=!1:typeof s.begin=="str
10ing"?u.begin=parseInt(s.begin,10):typeof s.begin=="number"?u.begin=s.begin:typeof s.begin=="object"&&(u.begin=new h.LongBits(s.begin.low>>>0,s.begin.high>>>0).toNumber())),s.end!=null&&(h.Long?(u.end=h.Long.fromValue(s.end)).unsigned=!1:typeof s.end=="string"?u.end=parseInt(s.end,10):typeof s.end=="number"?u.end=s.end:typeof s.end=="object"&&(u.end=new h.LongBits(s.end.low>>>0,s.end.high>>>0).toNumber())),u},r.toObject=function(s,u){u||(u={});var g={};if(u.defaults){if(h.Long){var y=new h.Long(0,0,!1);g.begin=u.longs===String?y.toString():u.longs===Number?y.toNumber():y}else g.begin=u.longs===String?"0":0;h.Long?(y=new h.Long(0,0,!1),g.end=u.longs===String?y.toString():u.longs===Number?y.toNumber():y):g.end=u.longs===String?"0":0}return s.begin!=null&&s.hasOwnProperty("begin")&&(typeof s.begin=="number"?g.begin=u.longs===String?String(s.begin):s.begin:g.begin=u.longs===String?h.Long.prototype.toString.call(s.begin):u.longs===Number?new h.LongBits(s.begin.low>>>0,s.begin.high>>>0).toNumber():s.begin),s.end!=null&&s.hasOwnProperty("end")&&(typeof s.end=="number"?g.end=u.longs===String?String(s.end):s.end:g.end=u.longs===String?h.Long.prototype.toString.call(s.end):u.longs===Number?new h.LongBits(s.end.low>>>0,s.end.high>>>0).toNumber():s.end),g},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TensorProto.Segment"},r}(),c.DataLocation=function(){var r={},s=Object.create(r);return s[r[0]="DEFAULT"]=0,s[r[1]="EXTERNAL"]=1,s}(),c}(),l.SparseTensorProto=function(){function c(r){if(this.dims=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.values=null,c.prototype.indices=null,c.prototype.dims=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.values!=null&&Object.hasOwnProperty.call(r,"values")&&n.onnx.TensorProto.encode(r.values,s.uint32(10).fork()).ldelim(),r.indices!=null&&Object.hasOwnProperty.call(r,"indices")&&n.onnx.TensorProto.encode(r.indices,s.uint32(18).fork()).ldelim(),r.dims!=null&&r.dims.length){s.uint32(26).fork();for(var u=0;u<r.dims.length;++u)s.int64(r.dims[u]);s.ldelim()}return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.SparseTensorProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.values=n.onnx.TensorProto.decode(r,r.uint32());break;case 2:g.indices=n.onnx.TensorProto.decode(r,r.uint32());break;case 3:if(g.dims&&g.dims.length||(g.dims=[]),(7&y)==2)for(var S=r.uint32()+r.pos;r.pos<S;)g.dims.push(r.int64());else g.dims.push(r.int64());break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";var s;if(r.values!=null&&r.hasOwnProperty("values")&&(s=n.onnx.TensorProto.verify(r.values)))return"values."+s;if(r.indices!=null&&r.hasOwnProperty("indices")&&(s=n.onnx.TensorProto.verify(r.indices)))return"indices."+s;if(r.dims!=null&&r.hasOwnProperty("dims")){if(!Array.isArray(r.dims))return"dims: array expected";for(var u=0;u<r.dims.length;++u)if(!(h.isInteger(r.dims[u])||r.dims[u]&&h.isInteger(r.dims[u].low)&&h.isInteger(r.dims[u].high)))return"dims: integer|Long[] expected"}return null},c.fromObject=function(r){if(r instanceof n.onnx.SparseTensorProto)return r;var s=new n.onnx.SparseTensorProto;if(r.values!=null){if(typeof r.values!="object")throw TypeError(".onnx.SparseTensorProto.values: object expected");s.values=n.onnx.TensorProto.fromObject(r.values)}if(r.indices!=null){if(typeof r.indices!="object")throw TypeError(".onnx.SparseTensorProto.indices: object expected");s.indices=n.onnx.TensorProto.fromObject(r.indices)}if(r.dims){if(!Array.isArray(r.dims))throw TypeError(".onnx.SparseTensorProto.dims: array expected");s.dims=[];for(var u=0;u<r.dims.length;++u)h.Long?(s.dims[u]=h.Long.fromValue(r.dims[u])).unsigned=!1:typeof r.dims[u]=="string"?s.dims[u]=parseInt(r.dims[u],10):typeof r.dims[u]=="number"?s.dims[u]=r.dims[u]:typeof r.dims[u]=="object"&&(s.dims[u]=new h.LongBits(r.dims[u].low>>>0,r.dims[u].high>>>0).toNumber())}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.dims=[]),s.defaults&&(u.values=null,u.indices=null),r.values!=null&&r.hasOwnProperty("values")&&(u.values=n.onnx.TensorProto.toObject(r.values,s)),r.indices!=null&&r.hasOwnProperty("indices")&&(u.indices=n.onnx.TensorProto.toObject(r.indices,s)),r.dims&&r.dims.length){u.dims=[];for(var g=0;g<r.dims.length;++g)typeof r.dims[g]=="number"?u.dims[g]=s.longs===String?String(r.dims[g]):r.dims[g]:u.dims[g]=s.longs===String?h.Long.prototype.toString.call(r.dims[g]):s.longs===Number?new h.LongBits(r.dims[g].low>>>0,r.dims[g].high>>>0).toNumber():r.dims[g]}return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.SparseTensorProto"},c}(),l.TensorShapeProto=function(){function c(r){if(this.dim=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.dim=h.emptyArray,c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.dim!=null&&r.dim.length)for(var u=0;u<r.dim.length;++u)n.onnx.TensorShapeProto.Dimension.encode(r.dim[u],s.uint32(10).fork()).ldelim();return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.TensorShapeProto;r.pos<u;){var y=r.uint32();y>>>3==1?(g.dim&&g.dim.length||(g.dim=[]),g.dim.push(n.onnx.TensorShapeProto.Dimension.decode(r,r.uint32()))):r.skipType(7&y)}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.dim!=null&&r.hasOwnProperty("dim")){if(!Array.isArray(r.dim))return"dim: array expected";for(var s=0;s<r.dim.length;++s){var u=n.onnx.TensorShapeProto.Dimension.verify(r.dim[s]);if(u)return"dim."+u}}return null},c.fromObject=function(r){if(r instanceof n.onnx.TensorShapeProto)return r;var s=new n.onnx.TensorShapeProto;if(r.dim){if(!Array.isArray(r.dim))throw TypeError(".onnx.TensorShapeProto.dim: array expected");s.dim=[];for(var u=0;u<r.dim.length;++u){if(typeof r.dim[u]!="object")throw TypeError(".onnx.TensorShapeProto.dim: object expected");s.dim[u]=n.onnx.TensorShapeProto.Dimension.fromObject(r.dim[u])}}return s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.dim=[]),r.dim&&r.dim.length){u.dim=[];for(var g=0;g<r.dim.length;++g)u.dim[g]=n.onnx.TensorShapeProto.Dimension.toObject(r.dim[g],s)}return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TensorShapeProto"},c.Dimension=function(){function r(u){if(u)for(var g=Object.keys(u),y=0;y<g.length;++y)u[g[y]]!=null&&(this[g[y]]=u[g[y]])}var s;return r.prototype.dimValue=null,r.prototype.dimParam=null,r.prototype.denotation="",Object.defineProperty(r.prototype,"value",{get:h.oneOfGetter(s=["dimValue","dimParam"]),set:h.oneOfSetter(s)}),r.create=function(u){return new r(u)},r.encode=function(u,g){return g||(g=p.create()),u.dimValue!=null&&Object.hasOwnProperty.call(u,"dimValue")&&g.uint32(8).int64(u.dimValue),u.dimParam!=null&&Object.hasOwnProperty.call(u,"dimParam")&&g.uint32(18).string(u.dimParam),u.denotation!=null&&Object.hasOwnProperty.call(u,"denotation")&&g.uint32(26).string(u.denotation),g},r.encodeDelimited=function(u,g){return this.encode(u,g).ldelim()},r.decode=function(u,g){u instanceof d||(u=d.create(u));for(var y=g===void 0?u.len:u.pos+g,S=new n.onnx.TensorShapeProto.Dimension;u.pos<y;){var A=u.uint32();switch(A>>>3){case 1:S.dimValue=u.int64();break;case 2:S.dimParam=u.string();break;case 3:S.denotation=u.string();break;default:u.skipType(7&A)}}return S},r.decodeDelimited=function(u){return u instanceof d||(u=new d(u)),this.decode(u,u.uint32())},r.verify=function(u){if(typeof u!="object"||u===null)return"object expected";var g={};if(u.dimValue!=null&&u.hasOwnProperty("dimValue")&&(g.value=1,!(h.isInteger(u.dimValue)||u.dimValue&&h.isInteger(u.dimValue.low)&&h.isInteger(u.dimValue.high))))return"dimValue: integer|Long expected";if(u.dimParam!=null&&u.hasOwnProperty("dimParam")){if(g.value===1)return"value: multiple values";if(g.value=1,!h.isString(u.dimParam))return"dimParam: string expected"}return u.denotation!=null&&u.hasOwnProperty("denotation")&&!h.isString(u.denotation)?"denotation: string expected":null},r.fromObject=function(u){if(u instanceof n.onnx.TensorShapeProto.Dimension)return u;var g=new n.onnx.TensorShapeProto.Dimension;return u.dimValue!=null&&(h.Long?(g.dimValue=h.Long.fromValue(u.dimValue)).unsigned=!1:typeof u.dimValue=="string"?g.dimValue=parseInt(u.dimValue,10):typeof u.dimValue=="number"?g.dimValue=u.dimValue:typeof u.dimValue=="object"&&(g.dimValue=new h.LongBits(u.dimValue.low>>>0,u.dimValue.high>>>0).toNumber())),u.dimParam!=null&&(g.dimParam=String(u.dimParam)),u.denotation!=null&&(g.denotation=String(u.denotation)),g},r.toObject=function(u,g){g||(g={});var y={};return g.defaults&&(y.denotation=""),u.dimValue!=null&&u.hasOwnProperty("dimValue")&&(typeof u.dimValue=="number"?y.dimValue=g.longs===String?String(u.dimValue):u.dimValue:y.dimValue=g.longs===String?h.Long.prototype.toString.call(u.dimValue):g.longs===Number?new h.LongBits(u.dimValue.low>>>0,u.dimValue.high>>>0).toNumber():u.dimValue,g.oneofs&&(y.value="dimValue")),u.dimParam!=null&&u.hasOwnProperty("dimParam")&&(y.dimParam=u.dimParam,g.oneofs&&(y.value="dimParam")),u.denotation!=null&&u.hasOwnProperty("denotation")&&(y.denotation=u.denotation),y},r.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},r.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/onnx.TensorShapeProto.Dimension"},r}(),c}(),l.TypeProto=function(){function c(s){if(s)for(var u=Object.keys(s),g=0;g<u.length;++g)s[u[g]]!=null&&(this[u[g]]=s[u[g]])}var r;return c.prototype.tensorType=null,c.prototype.sequenceType=null,c.prototype.mapType=null,c.prototype.optionalType=null,c.prototype.sparseTensorType=null,c.prototype.denotation="",Object.defineProperty(c.prototype,"value",{get:h.oneOfGetter(r=["tensorType","sequenceType","mapType","optionalType","sparseTensorType"]),set:h.oneOfSetter(r)}),c.create=function(s){return new c(s)},c.encode=function(s,u){return u||(u=p.create()),s.tensorType!=null&&Object.hasOwnProperty.call(s,"tensorType")&&n.onnx.TypeProto.Tensor.encode(s.tensorType,u.uint32(10).fork()).ldelim(),s.sequenceType!=null&&Object.hasOwnProperty.call(s,"sequenceType")&&n.onnx.TypeProto.Sequence.encode(s.sequenceType,u.uint32(34).fork()).ldelim(),s.mapType!=null&&Object.hasOwnProperty.call(s,"mapType")&&n.onnx.TypeProto.Map.encode(s.mapType,u.uint32(42).fork()).ldelim(),s.denotation!=null&&Object.hasOwnProperty.call(s,"denotation")&&u.uint32(50).string(s.denotation),s.sparseTensorType!=null&&Object.hasOwnProperty.call(s,"sparseTensorType")&&n.onnx.TypeProto.SparseTensor.encode(s.sparseTensorType,u.uint32(66).fork()).ldelim(),s.optionalType!=null&&Object.hasOwnProperty.call(s,"optionalType")&&n.onnx.TypeProto.Optional.encode(s.optionalType,u.uint32(74).fork()).ldelim(),u},c.encodeDelimited=function(s,u){return this.encode(s,u).ldelim()},c.decode=function(s,u){s instanceof d||(s=d.create(s));for(var g=u===void 0?s.len:s.pos+u,y=new n.onnx.TypeProto;s.pos<g;){var S=s.uint32();switch(S>>>3){case 1:y.tensorType=n.onnx.TypeProto.Tensor.decode(s,s.uint32());break;case 4:y.sequenceType=n.onnx.TypeProto.Sequence.decode(s,s.uint32());break;case 5:y.mapType=n.onnx.TypeProto.Map.decode(s,s.uint32());break;case 9:y.optionalType=n.onnx.TypeProto.Optional.decode(s,s.uint32());break;case 8:y.sparseTensorType=n.onnx.TypeProto.SparseTensor.decode(s,s.uint32());break;case 6:y.denotation=s.string();break;default:s.skipType(7&S)}}return y},c.decodeDelimited=function(s){return s instanceof d||(s=new d(s)),this.decode(s,s.uint32())},c.verify=function(s){if(typeof s!="object"||s===null)return"object expected";var u={};if(s.tensorType!=null&&s.hasOwnProperty("tensorType")&&(u.value=1,g=n.onnx.TypeProto.Tensor.verify(s.tensorType)))return"tensorType."+g;if(s.sequenceType!=null&&s.hasOwnProperty("sequenceType")){if(u.value===1)return"value: multiple values";if(u.value=1,g=n.onnx.TypeProto.Sequence.verify(s.sequenceType))return"sequenceType."+g}if(s.mapType!=null&&s.hasOwnProperty("mapType")){if(u.value===1)return"value: multiple values";if(u.value=1,g=n.onnx.TypeProto.Map.verify(s.mapType))return"mapType."+g}if(s.optionalType!=null&&s.hasOwnProperty("optionalType")){if(u.value===1)return"value: multiple values";if(u.value=1,g=n.onnx.TypeProto.Optional.verify(s.optionalType))return"optionalType."+g}if(s.sparseTensorType!=null&&s.hasOwnProperty("sparseTensorType")){if(u.value===1)return"value: multiple values";var g;if(u.value=1,g=n.onnx.TypeProto.SparseTensor.verify(s.sparseTensorType))return"sparseTensorType."+g}return s.denotation!=null&&s.hasOwnProperty("denotation")&&!h.isString(s.denotation)?"denotation: string expected":null},c.fromObject=function(s){if(s instanceof n.onnx.TypeProto)return s;var u=new n.onnx.TypeProto;if(s.tensorType!=null){if(typeof s.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");u.tensorType=n.onnx.TypeProto.Tensor.fromObject(s.tensorType)}if(s.sequenceType!=null){if(typeof s.sequenceType!="object")throw TypeError(".onnx.TypeProto.sequenceType: object expected");u.sequenceType=n.onnx.TypeProto.Sequence.fromObject(s.sequenceType)}if(s.mapType!=null){if(typeof s.mapType!="object")throw TypeError(".onnx.TypeProto.mapType: object expected");
10u.mapType=n.onnx.TypeProto.Map.fromObject(s.mapType)}if(s.optionalType!=null){if(typeof s.optionalType!="object")throw TypeError(".onnx.TypeProto.optionalType: object expected");u.optionalType=n.onnx.TypeProto.Optional.fromObject(s.optionalType)}if(s.sparseTensorType!=null){if(typeof s.sparseTensorType!="object")throw TypeError(".onnx.TypeProto.sparseTensorType: object expected");u.sparseTensorType=n.onnx.TypeProto.SparseTensor.fromObject(s.sparseTensorType)}return s.denotation!=null&&(u.denotation=String(s.denotation)),u},c.toObject=function(s,u){u||(u={});var g={};return u.defaults&&(g.denotation=""),s.tensorType!=null&&s.hasOwnProperty("tensorType")&&(g.tensorType=n.onnx.TypeProto.Tensor.toObject(s.tensorType,u),u.oneofs&&(g.value="tensorType")),s.sequenceType!=null&&s.hasOwnProperty("sequenceType")&&(g.sequenceType=n.onnx.TypeProto.Sequence.toObject(s.sequenceType,u),u.oneofs&&(g.value="sequenceType")),s.mapType!=null&&s.hasOwnProperty("mapType")&&(g.mapType=n.onnx.TypeProto.Map.toObject(s.mapType,u),u.oneofs&&(g.value="mapType")),s.denotation!=null&&s.hasOwnProperty("denotation")&&(g.denotation=s.denotation),s.sparseTensorType!=null&&s.hasOwnProperty("sparseTensorType")&&(g.sparseTensorType=n.onnx.TypeProto.SparseTensor.toObject(s.sparseTensorType,u),u.oneofs&&(g.value="sparseTensorType")),s.optionalType!=null&&s.hasOwnProperty("optionalType")&&(g.optionalType=n.onnx.TypeProto.Optional.toObject(s.optionalType,u),u.oneofs&&(g.value="optionalType")),g},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto"},c.Tensor=function(){function s(u){if(u)for(var g=Object.keys(u),y=0;y<g.length;++y)u[g[y]]!=null&&(this[g[y]]=u[g[y]])}return s.prototype.elemType=0,s.prototype.shape=null,s.create=function(u){return new s(u)},s.encode=function(u,g){return g||(g=p.create()),u.elemType!=null&&Object.hasOwnProperty.call(u,"elemType")&&g.uint32(8).int32(u.elemType),u.shape!=null&&Object.hasOwnProperty.call(u,"shape")&&n.onnx.TensorShapeProto.encode(u.shape,g.uint32(18).fork()).ldelim(),g},s.encodeDelimited=function(u,g){return this.encode(u,g).ldelim()},s.decode=function(u,g){u instanceof d||(u=d.create(u));for(var y=g===void 0?u.len:u.pos+g,S=new n.onnx.TypeProto.Tensor;u.pos<y;){var A=u.uint32();switch(A>>>3){case 1:S.elemType=u.int32();break;case 2:S.shape=n.onnx.TensorShapeProto.decode(u,u.uint32());break;default:u.skipType(7&A)}}return S},s.decodeDelimited=function(u){return u instanceof d||(u=new d(u)),this.decode(u,u.uint32())},s.verify=function(u){if(typeof u!="object"||u===null)return"object expected";if(u.elemType!=null&&u.hasOwnProperty("elemType")&&!h.isInteger(u.elemType))return"elemType: integer expected";if(u.shape!=null&&u.hasOwnProperty("shape")){var g=n.onnx.TensorShapeProto.verify(u.shape);if(g)return"shape."+g}return null},s.fromObject=function(u){if(u instanceof n.onnx.TypeProto.Tensor)return u;var g=new n.onnx.TypeProto.Tensor;if(u.elemType!=null&&(g.elemType=0|u.elemType),u.shape!=null){if(typeof u.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");g.shape=n.onnx.TensorShapeProto.fromObject(u.shape)}return g},s.toObject=function(u,g){g||(g={});var y={};return g.defaults&&(y.elemType=0,y.shape=null),u.elemType!=null&&u.hasOwnProperty("elemType")&&(y.elemType=u.elemType),u.shape!=null&&u.hasOwnProperty("shape")&&(y.shape=n.onnx.TensorShapeProto.toObject(u.shape,g)),y},s.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},s.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/onnx.TypeProto.Tensor"},s}(),c.Sequence=function(){function s(u){if(u)for(var g=Object.keys(u),y=0;y<g.length;++y)u[g[y]]!=null&&(this[g[y]]=u[g[y]])}return s.prototype.elemType=null,s.create=function(u){return new s(u)},s.encode=function(u,g){return g||(g=p.create()),u.elemType!=null&&Object.hasOwnProperty.call(u,"elemType")&&n.onnx.TypeProto.encode(u.elemType,g.uint32(10).fork()).ldelim(),g},s.encodeDelimited=function(u,g){return this.encode(u,g).ldelim()},s.decode=function(u,g){u instanceof d||(u=d.create(u));for(var y=g===void 0?u.len:u.pos+g,S=new n.onnx.TypeProto.Sequence;u.pos<y;){var A=u.uint32();A>>>3==1?S.elemType=n.onnx.TypeProto.decode(u,u.uint32()):u.skipType(7&A)}return S},s.decodeDelimited=function(u){return u instanceof d||(u=new d(u)),this.decode(u,u.uint32())},s.verify=function(u){if(typeof u!="object"||u===null)return"object expected";if(u.elemType!=null&&u.hasOwnProperty("elemType")){var g=n.onnx.TypeProto.verify(u.elemType);if(g)return"elemType."+g}return null},s.fromObject=function(u){if(u instanceof n.onnx.TypeProto.Sequence)return u;var g=new n.onnx.TypeProto.Sequence;if(u.elemType!=null){if(typeof u.elemType!="object")throw TypeError(".onnx.TypeProto.Sequence.elemType: object expected");g.elemType=n.onnx.TypeProto.fromObject(u.elemType)}return g},s.toObject=function(u,g){g||(g={});var y={};return g.defaults&&(y.elemType=null),u.elemType!=null&&u.hasOwnProperty("elemType")&&(y.elemType=n.onnx.TypeProto.toObject(u.elemType,g)),y},s.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},s.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/onnx.TypeProto.Sequence"},s}(),c.Map=function(){function s(u){if(u)for(var g=Object.keys(u),y=0;y<g.length;++y)u[g[y]]!=null&&(this[g[y]]=u[g[y]])}return s.prototype.keyType=0,s.prototype.valueType=null,s.create=function(u){return new s(u)},s.encode=function(u,g){return g||(g=p.create()),u.keyType!=null&&Object.hasOwnProperty.call(u,"keyType")&&g.uint32(8).int32(u.keyType),u.valueType!=null&&Object.hasOwnProperty.call(u,"valueType")&&n.onnx.TypeProto.encode(u.valueType,g.uint32(18).fork()).ldelim(),g},s.encodeDelimited=function(u,g){return this.encode(u,g).ldelim()},s.decode=function(u,g){u instanceof d||(u=d.create(u));for(var y=g===void 0?u.len:u.pos+g,S=new n.onnx.TypeProto.Map;u.pos<y;){var A=u.uint32();switch(A>>>3){case 1:S.keyType=u.int32();break;case 2:S.valueType=n.onnx.TypeProto.decode(u,u.uint32());break;default:u.skipType(7&A)}}return S},s.decodeDelimited=function(u){return u instanceof d||(u=new d(u)),this.decode(u,u.uint32())},s.verify=function(u){if(typeof u!="object"||u===null)return"object expected";if(u.keyType!=null&&u.hasOwnProperty("keyType")&&!h.isInteger(u.keyType))return"keyType: integer expected";if(u.valueType!=null&&u.hasOwnProperty("valueType")){var g=n.onnx.TypeProto.verify(u.valueType);if(g)return"valueType."+g}return null},s.fromObject=function(u){if(u instanceof n.onnx.TypeProto.Map)return u;var g=new n.onnx.TypeProto.Map;if(u.keyType!=null&&(g.keyType=0|u.keyType),u.valueType!=null){if(typeof u.valueType!="object")throw TypeError(".onnx.TypeProto.Map.valueType: object expected");g.valueType=n.onnx.TypeProto.fromObject(u.valueType)}return g},s.toObject=function(u,g){g||(g={});var y={};return g.defaults&&(y.keyType=0,y.valueType=null),u.keyType!=null&&u.hasOwnProperty("keyType")&&(y.keyType=u.keyType),u.valueType!=null&&u.hasOwnProperty("valueType")&&(y.valueType=n.onnx.TypeProto.toObject(u.valueType,g)),y},s.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},s.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/onnx.TypeProto.Map"},s}(),c.Optional=function(){function s(u){if(u)for(var g=Object.keys(u),y=0;y<g.length;++y)u[g[y]]!=null&&(this[g[y]]=u[g[y]])}return s.prototype.elemType=null,s.create=function(u){return new s(u)},s.encode=function(u,g){return g||(g=p.create()),u.elemType!=null&&Object.hasOwnProperty.call(u,"elemType")&&n.onnx.TypeProto.encode(u.elemType,g.uint32(10).fork()).ldelim(),g},s.encodeDelimited=function(u,g){return this.encode(u,g).ldelim()},s.decode=function(u,g){u instanceof d||(u=d.create(u));for(var y=g===void 0?u.len:u.pos+g,S=new n.onnx.TypeProto.Optional;u.pos<y;){var A=u.uint32();A>>>3==1?S.elemType=n.onnx.TypeProto.decode(u,u.uint32()):u.skipType(7&A)}return S},s.decodeDelimited=function(u){return u instanceof d||(u=new d(u)),this.decode(u,u.uint32())},s.verify=function(u){if(typeof u!="object"||u===null)return"object expected";if(u.elemType!=null&&u.hasOwnProperty("elemType")){var g=n.onnx.TypeProto.verify(u.elemType);if(g)return"elemType."+g}return null},s.fromObject=function(u){if(u instanceof n.onnx.TypeProto.Optional)return u;var g=new n.onnx.TypeProto.Optional;if(u.elemType!=null){if(typeof u.elemType!="object")throw TypeError(".onnx.TypeProto.Optional.elemType: object expected");g.elemType=n.onnx.TypeProto.fromObject(u.elemType)}return g},s.toObject=function(u,g){g||(g={});var y={};return g.defaults&&(y.elemType=null),u.elemType!=null&&u.hasOwnProperty("elemType")&&(y.elemType=n.onnx.TypeProto.toObject(u.elemType,g)),y},s.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},s.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/onnx.TypeProto.Optional"},s}(),c.SparseTensor=function(){function s(u){if(u)for(var g=Object.keys(u),y=0;y<g.length;++y)u[g[y]]!=null&&(this[g[y]]=u[g[y]])}return s.prototype.elemType=0,s.prototype.shape=null,s.create=function(u){return new s(u)},s.encode=function(u,g){return g||(g=p.create()),u.elemType!=null&&Object.hasOwnProperty.call(u,"elemType")&&g.uint32(8).int32(u.elemType),u.shape!=null&&Object.hasOwnProperty.call(u,"shape")&&n.onnx.TensorShapeProto.encode(u.shape,g.uint32(18).fork()).ldelim(),g},s.encodeDelimited=function(u,g){return this.encode(u,g).ldelim()},s.decode=function(u,g){u instanceof d||(u=d.create(u));for(var y=g===void 0?u.len:u.pos+g,S=new n.onnx.TypeProto.SparseTensor;u.pos<y;){var A=u.uint32();switch(A>>>3){case 1:S.elemType=u.int32();break;case 2:S.shape=n.onnx.TensorShapeProto.decode(u,u.uint32());break;default:u.skipType(7&A)}}return S},s.decodeDelimited=function(u){return u instanceof d||(u=new d(u)),this.decode(u,u.uint32())},s.verify=function(u){if(typeof u!="object"||u===null)return"object expected";if(u.elemType!=null&&u.hasOwnProperty("elemType")&&!h.isInteger(u.elemType))return"elemType: integer expected";if(u.shape!=null&&u.hasOwnProperty("shape")){var g=n.onnx.TensorShapeProto.verify(u.shape);if(g)return"shape."+g}return null},s.fromObject=function(u){if(u instanceof n.onnx.TypeProto.SparseTensor)return u;var g=new n.onnx.TypeProto.SparseTensor;if(u.elemType!=null&&(g.elemType=0|u.elemType),u.shape!=null){if(typeof u.shape!="object")throw TypeError(".onnx.TypeProto.SparseTensor.shape: object expected");g.shape=n.onnx.TensorShapeProto.fromObject(u.shape)}return g},s.toObject=function(u,g){g||(g={});var y={};return g.defaults&&(y.elemType=0,y.shape=null),u.elemType!=null&&u.hasOwnProperty("elemType")&&(y.elemType=u.elemType),u.shape!=null&&u.hasOwnProperty("shape")&&(y.shape=n.onnx.TensorShapeProto.toObject(u.shape,g)),y},s.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},s.getTypeUrl=function(u){return u===void 0&&(u="type.googleapis.com"),u+"/onnx.TypeProto.SparseTensor"},s}(),c}(),l.OperatorSetIdProto=function(){function c(r){if(r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.domain="",c.prototype.version=h.Long?h.Long.fromBits(0,0,!1):0,c.create=function(r){return new c(r)},c.encode=function(r,s){return s||(s=p.create()),r.domain!=null&&Object.hasOwnProperty.call(r,"domain")&&s.uint32(10).string(r.domain),r.version!=null&&Object.hasOwnProperty.call(r,"version")&&s.uint32(16).int64(r.version),s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.OperatorSetIdProto;r.pos<u;){var y=r.uint32();switch(y>>>
103){case 1:g.domain=r.string();break;case 2:g.version=r.int64();break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){return typeof r!="object"||r===null?"object expected":r.domain!=null&&r.hasOwnProperty("domain")&&!h.isString(r.domain)?"domain: string expected":r.version==null||!r.hasOwnProperty("version")||h.isInteger(r.version)||r.version&&h.isInteger(r.version.low)&&h.isInteger(r.version.high)?null:"version: integer|Long expected"},c.fromObject=function(r){if(r instanceof n.onnx.OperatorSetIdProto)return r;var s=new n.onnx.OperatorSetIdProto;return r.domain!=null&&(s.domain=String(r.domain)),r.version!=null&&(h.Long?(s.version=h.Long.fromValue(r.version)).unsigned=!1:typeof r.version=="string"?s.version=parseInt(r.version,10):typeof r.version=="number"?s.version=r.version:typeof r.version=="object"&&(s.version=new h.LongBits(r.version.low>>>0,r.version.high>>>0).toNumber())),s},c.toObject=function(r,s){s||(s={});var u={};if(s.defaults)if(u.domain="",h.Long){var g=new h.Long(0,0,!1);u.version=s.longs===String?g.toString():s.longs===Number?g.toNumber():g}else u.version=s.longs===String?"0":0;return r.domain!=null&&r.hasOwnProperty("domain")&&(u.domain=r.domain),r.version!=null&&r.hasOwnProperty("version")&&(typeof r.version=="number"?u.version=s.longs===String?String(r.version):r.version:u.version=s.longs===String?h.Long.prototype.toString.call(r.version):s.longs===Number?new h.LongBits(r.version.low>>>0,r.version.high>>>0).toNumber():r.version),u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.OperatorSetIdProto"},c}(),l.OperatorStatus=function(){var c={},r=Object.create(c);return r[c[0]="EXPERIMENTAL"]=0,r[c[1]="STABLE"]=1,r}(),l.FunctionProto=function(){function c(r){if(this.input=[],this.output=[],this.attribute=[],this.attributeProto=[],this.node=[],this.opsetImport=[],r)for(var s=Object.keys(r),u=0;u<s.length;++u)r[s[u]]!=null&&(this[s[u]]=r[s[u]])}return c.prototype.name="",c.prototype.input=h.emptyArray,c.prototype.output=h.emptyArray,c.prototype.attribute=h.emptyArray,c.prototype.attributeProto=h.emptyArray,c.prototype.node=h.emptyArray,c.prototype.docString="",c.prototype.opsetImport=h.emptyArray,c.prototype.domain="",c.create=function(r){return new c(r)},c.encode=function(r,s){if(s||(s=p.create()),r.name!=null&&Object.hasOwnProperty.call(r,"name")&&s.uint32(10).string(r.name),r.input!=null&&r.input.length)for(var u=0;u<r.input.length;++u)s.uint32(34).string(r.input[u]);if(r.output!=null&&r.output.length)for(u=0;u<r.output.length;++u)s.uint32(42).string(r.output[u]);if(r.attribute!=null&&r.attribute.length)for(u=0;u<r.attribute.length;++u)s.uint32(50).string(r.attribute[u]);if(r.node!=null&&r.node.length)for(u=0;u<r.node.length;++u)n.onnx.NodeProto.encode(r.node[u],s.uint32(58).fork()).ldelim();if(r.docString!=null&&Object.hasOwnProperty.call(r,"docString")&&s.uint32(66).string(r.docString),r.opsetImport!=null&&r.opsetImport.length)for(u=0;u<r.opsetImport.length;++u)n.onnx.OperatorSetIdProto.encode(r.opsetImport[u],s.uint32(74).fork()).ldelim();if(r.domain!=null&&Object.hasOwnProperty.call(r,"domain")&&s.uint32(82).string(r.domain),r.attributeProto!=null&&r.attributeProto.length)for(u=0;u<r.attributeProto.length;++u)n.onnx.AttributeProto.encode(r.attributeProto[u],s.uint32(90).fork()).ldelim();return s},c.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},c.decode=function(r,s){r instanceof d||(r=d.create(r));for(var u=s===void 0?r.len:r.pos+s,g=new n.onnx.FunctionProto;r.pos<u;){var y=r.uint32();switch(y>>>3){case 1:g.name=r.string();break;case 4:g.input&&g.input.length||(g.input=[]),g.input.push(r.string());break;case 5:g.output&&g.output.length||(g.output=[]),g.output.push(r.string());break;case 6:g.attribute&&g.attribute.length||(g.attribute=[]),g.attribute.push(r.string());break;case 11:g.attributeProto&&g.attributeProto.length||(g.attributeProto=[]),g.attributeProto.push(n.onnx.AttributeProto.decode(r,r.uint32()));break;case 7:g.node&&g.node.length||(g.node=[]),g.node.push(n.onnx.NodeProto.decode(r,r.uint32()));break;case 8:g.docString=r.string();break;case 9:g.opsetImport&&g.opsetImport.length||(g.opsetImport=[]),g.opsetImport.push(n.onnx.OperatorSetIdProto.decode(r,r.uint32()));break;
10case 10:g.domain=r.string();break;default:r.skipType(7&y)}}return g},c.decodeDelimited=function(r){return r instanceof d||(r=new d(r)),this.decode(r,r.uint32())},c.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.name!=null&&r.hasOwnProperty("name")&&!h.isString(r.name))return"name: string expected";if(r.input!=null&&r.hasOwnProperty("input")){if(!Array.isArray(r.input))return"input: array expected";for(var s=0;s<r.input.length;++s)if(!h.isString(r.input[s]))return"input: string[] expected"}if(r.output!=null&&r.hasOwnProperty("output")){if(!Array.isArray(r.output))return"output: array expected";for(s=0;s<r.output.length;++s)if(!h.isString(r.output[s]))return"output: string[] expected"}if(r.attribute!=null&&r.hasOwnProperty("attribute")){if(!Array.isArray(r.attribute))return"attribute: array expected";for(s=0;s<r.attribute.length;++s)if(!h.isString(r.attribute[s]))return"attribute: string[] expected"}if(r.attributeProto!=null&&r.hasOwnProperty("attributeProto")){if(!Array.isArray(r.attributeProto))return"attributeProto: array expected";for(s=0;s<r.attributeProto.length;++s)if(u=n.onnx.AttributeProto.verify(r.attributeProto[s]))return"attributeProto."+u}if(r.node!=null&&r.hasOwnProperty("node")){if(!Array.isArray(r.node))return"node: array expected";for(s=0;s<r.node.length;++s)if(u=n.onnx.NodeProto.verify(r.node[s]))return"node."+u}if(r.docString!=null&&r.hasOwnProperty("docString")&&!h.isString(r.docString))return"docString: string expected";if(r.opsetImport!=null&&r.hasOwnProperty("opsetImport")){if(!Array.isArray(r.opsetImport))return"opsetImport: array expected";for(s=0;s<r.opsetImport.length;++s){var u;if(u=n.onnx.OperatorSetIdProto.verify(r.opsetImport[s]))return"opsetImport."+u}}return r.domain!=null&&r.hasOwnProperty("domain")&&!h.isString(r.domain)?"domain: string expected":null},c.fromObject=function(r){if(r instanceof n.onnx.FunctionProto)return r;var s=new n.onnx.FunctionProto;if(r.name!=null&&(s.name=String(r.name)),r.input){if(!Array.isArray(r.input))throw TypeError(".onnx.FunctionProto.input: array expected");s.input=[];for(var u=0;u<r.input.length;++u)s.input[u]=String(r.input[u])}if(r.output){if(!Array.isArray(r.output))throw TypeError(".onnx.FunctionProto.output: array expected");for(s.output=[],u=0;u<r.output.length;++u)s.output[u]=String(r.output[u])}if(r.attribute){if(!Array.isArray(r.attribute))throw TypeError(".onnx.FunctionProto.attribute: array expected");for(s.attribute=[],u=0;u<r.attribute.length;++u)s.attribute[u]=String(r.attribute[u])}if(r.attributeProto){if(!Array.isArray(r.attributeProto))throw TypeError(".onnx.FunctionProto.attributeProto: array expected");for(s.attributeProto=[],u=0;u<r.attributeProto.length;++u){if(typeof r.attributeProto[u]!="object")throw TypeError(".onnx.FunctionProto.attributeProto: object expected");s.attributeProto[u]=n.onnx.AttributeProto.fromObject(r.attributeProto[u])}}if(r.node){if(!Array.isArray(r.node))throw TypeError(".onnx.FunctionProto.node: array expected");for(s.node=[],u=0;u<r.node.length;++u){if(typeof r.node[u]!="object")throw TypeError(".onnx.FunctionProto.node: object expected");s.node[u]=n.onnx.NodeProto.fromObject(r.node[u])}}if(r.docString!=null&&(s.docString=String(r.docString)),r.opsetImport){if(!Array.isArray(r.opsetImport))throw TypeError(".onnx.FunctionProto.opsetImport: array expected");for(s.opsetImport=[],u=0;u<r.opsetImport.length;++u){if(typeof r.opsetImport[u]!="object")throw TypeError(".onnx.FunctionProto.opsetImport: object expected");s.opsetImport[u]=n.onnx.OperatorSetIdProto.fromObject(r.opsetImport[u])}}return r.domain!=null&&(s.domain=String(r.domain)),s},c.toObject=function(r,s){s||(s={});var u={};if((s.arrays||s.defaults)&&(u.input=[],u.output=[],u.attribute=[],u.node=[],u.opsetImport=[],u.attributeProto=[]),s.defaults&&(u.name="",u.docString="",u.domain=""),r.name!=null&&r.hasOwnProperty("name")&&(u.name=r.name),r.input&&r.input.length){u.input=[];for(var g=0;g<r.input.length;++g)u.input[g]=r.input[g]}if(r.output&&r.output.length)for(u.output=[],g=0;g<r.output.length;++g)u.output[g]=r.output[g];if(r.attribute&&r.attribute.length)for(u.attribute=[],g=0;g<r.attribute.length;++g)u.attribute[g]=r.attribute[g];if(r.node&&r.node.length)for(u.node=[],g=0;g<r.node.length;++g)u.node[g]=n.onnx.NodeProto.toObject(r.node[g],s);if(r.docString!=null&&r.hasOwnProperty("docString")&&(u.docString=r.docString),r.opsetImport&&r.opsetImport.length)for(u.opsetImport=[],g=0;g<r.opsetImport.length;++g)u.opsetImport[g]=n.onnx.OperatorSetIdProto.toObject(r.opsetImport[g],s);if(r.domain!=null&&r.hasOwnProperty("domain")&&(u.domain=r.domain),r.attributeProto&&r.attributeProto.length)for(u.attributeProto=[],g=0;g<r.attributeProto.length;++g)u.attributeProto[g]=n.onnx.AttributeProto.toObject(r.attributeProto[g],s);return u},c.prototype.toJSON=function(){return this.constructor.toObject(this,f.util.toJSONOptions)},c.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.FunctionProto"},c}(),l),e.exports=n});function kr(t,e){if(!t)throw new Error(typeof e=="string"?e:e())}function ln(t){return new TextDecoder().decode(t)}var ye,pr,hi,Ke,Xn,Ve,nt,U,un,dr,hr,mr,fe=E(()=>{Wn(),ei(),ye=Er($r()),br(),pr=class{static arraysEqual(t,e){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}},hi=class{static preprocessInputShapes(t,e){return[t.length===1?[1,t[0]]:t,e.length===1?[e[0],1]:e]}static postprocessOutputShape(t,e,o){e===1&&t.splice(t.length-2,1),o===1&&t.pop()}static calcMatMulShape(t,e){return t[1]!==e[0]?void 0:[t[0],e[1]]}},Ke=class nr{static calcShape(e,o,a=!1){let l=e.length,f=o.length;if(l===0)return o;if(f===0)return e;let d=Math.max(e.length,o.length),p=new Array(d);if(a){if(l<2||f<2)return;let h=hi.calcMatMulShape([e[l-2],e[l-1]],[o[f-2],o[f-1]]);if(h===void 0)return;[p[d-2],p[d-1]]=h}for(let h=a?3:1;h<=d;h++){let n=l-h<0?1:e[l-h],c=f-h<0?1:o[f-h];if(n!==c&&n>1&&c>1)return;p[d-h]=Math.max(n,c)}return p}static index(e,o){let a=new Array(o.length);return nr.fillIndex(e,o,a),a}static fillIndex(e,o,a){let l=e.length-o.length;for(let f=0;f<o.length;f++)a[f]=e[l+f]%o[f]}static calc(e,o,a,l,f){let d=nr.calcShape(e.dims,o.dims);if(d){if(l&&!U.areEqual(d,e.dims))return;let p=U.size(d),h=l?e:new Ce(d,f||e.type);
vendor: 6,435 bytes, line 10
10if(d.length===0)h.set([],a(e.get([]),o.get([])));else{let n,c=new Array(d.length),r=new Array(e.dims.length),s=new Array(o.dims.length),u=0,g=0,y=!1,S=!1;e.dims.length===0&&(u=e.get([]),y=!0),o.dims.length===0&&(g=o.get([]),S=!0);for(let A=0;A<p;A++){n=A;for(let L=d.length-1;L>=0;L--)c[L]=n%d[L],n=Math.floor(n/d[L]);y||(nr.fillIndex(c,e.dims,r),u=e.get(r)),S||(nr.fillIndex(c,o.dims,s),g=o.get(s)),h.set(c,a(u,g))}}return h}}static isValidBroadcast(e,o){let a=e.length,l=o.length;if(a>l)return!1;for(let f=1;f<=a;f++)if(e[a-f]!==1&&e[a-f]!==o[l-f])return!1;return!0}static getBroadcastDims(e,o){let a=e.length,l=[];for(let f=0;f<a;f++){let d=a-1-f,p=e[d]||1;(o[o.length-1-f]||1)>1&&p===1&&l.unshift(d)}return l}},Xn=class{static getShapeOfGemmResult(t,e,o,a,l){if(t.length!==2||o.length!==2)throw new Error("shape need to be of size 2");let f,d,p;e?(f=t[1],d=t[0]):(f=t[0],d=t[1]);let h=-1;if(a?(p=o[0],h=1):(p=o[1],h=0),o[h]!==d)throw new Error("dimension mismatch");if(f<=0||p<=0||d<=0)throw new Error("invalid shape specified");if(l&&!Ke.isValidBroadcast(l,[f,p]))throw new Error("gemm: invalid bias shape for broadcast");return[f,p,d]}},Ve=class an{static tensorDataTypeFromProto(e){switch(e){case ye.onnx.TensorProto.DataType.INT8:return"int8";case ye.onnx.TensorProto.DataType.UINT8:return"uint8";case ye.onnx.TensorProto.DataType.BOOL:return"bool";case ye.onnx.TensorProto.DataType.INT16:return"int16";case ye.onnx.TensorProto.DataType.UINT16:return"uint16";case ye.onnx.TensorProto.DataType.INT32:return"int32";case ye.onnx.TensorProto.DataType.UINT32:return"uint32";case ye.onnx.TensorProto.DataType.FLOAT:return"float32";case ye.onnx.TensorProto.DataType.DOUBLE:return"float64";case ye.onnx.TensorProto.DataType.STRING:return"string";case ye.onnx.TensorProto.DataType.INT64:return"int32";case ye.onnx.TensorProto.DataType.UINT64:return"uint32";default:throw new Error(`unsupported data type: ${ye.onnx.TensorProto.DataType[e]}`)}}static tensorDataTypeStringToEnum(e){switch(e){case"int8":return ye.onnx.TensorProto.DataType.INT8;case"uint8":return ye.onnx.TensorProto.DataType.UINT8;case"bool":return ye.onnx.TensorProto.DataType.BOOL;case"int16":return ye.onnx.TensorProto.DataType.INT16;case"uint16":return ye.onnx.TensorProto.DataType.UINT16;case"int32":return ye.onnx.TensorProto.DataType.INT32;case"uint32":return ye.onnx.TensorProto.DataType.UINT32;case"float32":return ye.onnx.TensorProto.DataType.FLOAT;case"float64":return ye.onnx.TensorProto.DataType.DOUBLE;case"string":return ye.onnx.TensorProto.DataType.STRING;case"int64":return ye.onnx.TensorProto.DataType.INT64;case"uint64":return ye.onnx.TensorProto.DataType.UINT64;default:throw new Error(`unsupported data type: ${e}`)}}static tensorDimsFromProto(e){return e.map(o=>Wt.isLong(o)?o.toNumber():o)}static tensorValueTypeFromProto(e){return{tensorType:an.tensorDataTypeFromProto(e.elemType),shape:{dims:an.tensorDimsFromProto(e.shape.dim.map(o=>o.dimValue))}}}static tensorDimsFromORTFormat(e){let o=[];for(let a=0;a<e.dimsLength();a++)o.push(nt.longToNumber(e.dims(a)));return o}static tensorAttributesFromORTFormat(e){let o=[];for(let a=0;a<e.attributesLength();a++)o.push(e.attributes(a));return o}},nt=class{static longToNumber(t,e){return Wt.isLong(t)?t.toNumber():t instanceof O.Long?Wt.fromValue({low:t.low,high:t.high,unsigned:e??!1}).toNumber():t}static isLong(t){return Wt.isLong(t)||t instanceof O.Long}},U=class We{static size(e){return We.getSizeFromDimensionRange(e,0,e.length)}static sizeFromDimension(e,o){if(o<0||o>e.length)throw new Error(`invalid dimension of ${o} for sizeFromDimension as Tensor has ${e.length} dimensions.`);return We.getSizeFromDimensionRange(e,o,e.length)}static sizeToDimension(e,o){if(o<0||o>e.length)throw new Error(`invalid dimension of ${o} for sizeToDimension as Tensor has ${e.length} dimensions.`);return We.getSizeFromDimensionRange(e,0,o)}static getSizeFromDimensionRange(e,o,a){let l=1;for(let f=o;f<a;f++){if(e[f]<=0)throw new Error("cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.");l*=e[f]}return l}static computeStrides(e){let o=e.length;if(o===0)return[];if(o===1)return[1];let a=new Array(o);a[o-1]=1,a[o-2]=e[o-1];for(let l=o-3;l>=0;--l)a[l]=a[l+1]*e[l+1];return a}static transpose(e){return e.slice().reverse()}static indicesToOffset(e,o,a){a===void 0&&(a=e.length);let l=0;for(let f=0;f<a;++f)l+=o[f]*e[f];return l}static offsetToIndices(e,o){let a=o.length;if(a===0)return[];if(a===1)return[e*o[0]];let l=new Array(o.length);for(let f=0;f<l.length-1;++f)l[f]=Math.floor(e/o[f]),e-=l[f]*o[f];return l[l.length-1]=e,l}static normalizeAxis(e,o){if(e<-o&&e>=o)throw new Error("unsupported axis for this operation.");return e<0?e+o:e}static normalizeAxes(e,o){return e.map(a=>this.normalizeAxis(a,o))}static incrementIndex(e,o,a){if(o.length===0||e.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(a===void 0)a=o.length;else if(a<=0||a>o.length)throw new Error("Incorrect axis to increment on");for(let l=a-1;l>=0&&(e[l]++,!(e[l]<o[l]));--l)e[l]=0}static calculateReshapedDims(e,o){if(o.length===0){if(e.length===0||We.size(e)===1)return[];throw new Error("cannot reshape to a scalar Tensor")}let a=o.length,l=new Array(a),f=-1,d=1;for(let h=0;h<a;h++){if(o[h]<-1)throw new Error("a dimension in shape hints cannot be less than -1");if(o[h]===-1){if(f!==-1)throw new Error("at most one dimension in shape hints can be -1");f=h}else{if(o[h]===0){if(h>=e.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");l[h]=e[h]}else l[h]=o[h];d*=l[h]}}let p=We.size(e);if(f!==-1){if(p%d!==0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${e}] Output shape: [${o}]`);l[f]=p/d}else if(d!==p)throw new Error("reshapedDims and originalDims don't have matching sizes");return l}static sortBasedOnPerm(e,o){return o?o.map(a=>e[a]):e.slice().reverse()}static padShape(e,o){let a=e.length;return e.map((l,f)=>l+o[f]+o[f+a])}static areEqual(e,o){return e.length===o.length&&e.every((a,l)=>a===o[l])}static validateDimsAndCalcSize(e){if(e.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let o=1;for(let a of e){if(!Number.isInteger(a))throw new TypeError(`Invalid shape: ${a} is not an integer`);if(a<0||a>2147483647)throw new TypeError(`Invalid shape: length ${a} is not allowed`);o*=a}return o}
10static flattenShape(e,o){o<0&&(o+=e.length);let a=e.reduce((f,d)=>f*d,1),l=e.slice(o).reduce((f,d)=>f*d,1);return[a/l,l]}static squeezeShape(e,o){let a=new Array;o=We.normalizeAxes(o,e.length);for(let l=0;l<e.length;l++){let f=o.indexOf(l)>=0;if(f&&e[l]!==1)throw new Error("squeeze an axis of size different than 1");(o.length===0&&e[l]>1||o.length>0&&!f)&&a.push(e[l])}return a}static unsqueezeShape(e,o){let a=new Array(e.length+o.length);a.fill(0);for(let f=0;f<o.length;f++){let d=We.normalizeAxis(o[f],a.length);if(d>=a.length)throw new Error("'axes' has an out of range axis");if(a[d]!==0)throw new Error("'axes' has a duplicate axis");a[d]=1}let l=0;for(let f=0;f<a.length;f++)a[f]===0&&(a[f]=e[l++]);if(l!==e.length)throw new Error("the unsqueezed dimension could not be established");return a}},un=class zo{static splitShape(e,o,a,l){if(a.length===0){if(!l)throw new Error("need to know number of outputs when the 'split' attribute is not specified");zo.determineSplit(e[o],l,a)}let f=[],d=[0];for(let p=0;p<a.length;++p){p!==0&&d.push(d[p-1]+a[p-1]);let h=e.slice();h[o]=a[p],f.push(h)}return[f,d]}static determineSplit(e,o,a){if(e%o!==0)throw new Error("cannot split tensor to equal sized parts");for(let l=0;l<o;++l)a.push(e/o)}},dr=class cr{static adjustPoolAttributes(e,o,a,l,f,d){if(!e&&a.length!==o.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(e)for(let p=0;p<o.length-2;p++)p>=a.length?a.push(o[p+2]):a[p]=o[p+2];for(let p=0;p<a.length;p++)if(p<l.length){if(l[p]<0)throw new Error("strides should be greater than or equal to 1")}else l.push(1);for(let p=0;p<a.length;p++)if(p<f.length){if(f[p]<0)throw new Error("dilations should be greater than or equal to 1")}else f.push(1);for(let p=0;p<2*a.length;p++)if(p<d.length){if(d[p]<0)throw new Error("pad should be greater than or equal to 1")}else d.push(0);for(let p=0;p<a.length;p++){if(a[p]<=0)throw new Error("kernel shapes need to be greater than 0");if(d[p]>=a[p]||d[p+a.length]>=a[p])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(e,o,a,l,f,d){if(d){if(f.length!==2*(e.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(o.length!==e.length-2)throw new Error("length of strides should be the length of data dimensions");if(l.length!==e.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let p=0;p<e.length-2;p++)cr.adjustPadAndReturnShape(e[p+2],o[p],a[p],l[p],f,p,p+e.length-2,d)}}static computePoolOutputShape(e,o,a,l,f,d,p){if(o.length<=0)throw new Error("input shape must be of size greater than 0");let h=[o[0],o[1]];return cr.computeShapeHelper(e,o,h,a,l,f,d,p),h}static computeConvOutputShape(e,o,a,l,f,d,p){if(e.length<=0||o.length<=0)throw new Error("invalid input tensor dims or invalid filter tensor dims");let h=[e[0],o[0]];return cr.computeShapeHelper(!1,e,h,a,l,f,d,p),h}static computeShapeHelper(e,o,a,l,f,d,p,h){if(e)for(let n=0;n<o.length-2;n++)a.push(1);else for(let n=0;n<o.length-2;n++)a.push(cr.adjustPadAndReturnShape(o[n+2],l[n],f[n],d[n],p,n,n+o.length-2,h))}static adjustPadAndReturnShape(e,o,a,l,f,d,p,h){let n=a*(l-1)+1;if(!h||h==="NOTSET")return Math.floor((e+f[d]+f[p]-n)/o+1);switch(h){case"VALID":return f[d]=0,f[p]=0,Math.floor((e-n)/o+1);case"SAME_LOWER":case"SAME_UPPER":if(a!==1)throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{let c=((e+o-1)/o-1)*o+l-e;return f[d]=Math.floor(h==="SAME_LOWER"?(c+1)/2:c/2),f[p]=c-f[d],Math.floor((e+c-l)/o+1)}default:throw new Error("Unsupported AutoPad type")}}},hr=-34028234663852886e22,mr=34028234663852886e22});
10function jd(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 new Error(`cannot calculate sizeof() on type ${t}`)}}function ku(t){switch(t){case re.onnx.TensorProto.DataType.UINT8:case re.onnx.TensorProto.DataType.INT8:case re.onnx.TensorProto.DataType.BOOL:return 1;case re.onnx.TensorProto.DataType.UINT16:case re.onnx.TensorProto.DataType.INT16:return 2;case re.onnx.TensorProto.DataType.FLOAT:case re.onnx.TensorProto.DataType.INT32:case re.onnx.TensorProto.DataType.UINT32:return 4;case re.onnx.TensorProto.DataType.INT64:case re.onnx.TensorProto.DataType.DOUBLE:case re.onnx.TensorProto.DataType.UINT64:return 8;default:throw new Error(`cannot calculate sizeof() on type ${re.onnx.TensorProto.DataType[t]}`)}}function Yd(t,e){return new(Ru(e))(t)}function Ru(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"int64":return BigInt64Array;case"float32":return Float32Array;case"float64":return Float64Array;default:throw new Error("unspecified error")}}function bi(t,e){if(e===re.onnx.TensorProto.DataType.INT64||e===mi.TensorDataType.INT64){if(t.greaterThanOrEqual(2147483648)||t.lessThan(-2147483648))throw new TypeError("int64 is not supported")}else{if(e!==re.onnx.TensorProto.DataType.UINT32&&e!==mi.TensorDataType.UINT32&&e!==re.onnx.TensorProto.DataType.UINT64&&e!==mi.TensorDataType.UINT64)throw new TypeError(`not a LONG type: ${re.onnx.TensorProto.DataType[e]}`);if(t.greaterThanOrEqual(4294967296)||t.lessThan(0))throw new TypeError("uint64 is not supported")}return t.toNumber()}function Bu(t,e,o){switch(e){case re.onnx.TensorProto.DataType.BOOL:case re.onnx.TensorProto.DataType.UINT8:return t.getUint8(o);case re.onnx.TensorProto.DataType.INT8:return t.getInt8(o);case re.onnx.TensorProto.DataType.UINT16:return t.getUint16(o,!0);case re.onnx.TensorProto.DataType.INT16:return t.getInt16(o,!0);case re.onnx.TensorProto.DataType.FLOAT:return t.getFloat32(o,!0);case re.onnx.TensorProto.DataType.INT32:return t.getInt32(o,!0);case re.onnx.TensorProto.DataType.UINT32:return t.getUint32(o,!0);case re.onnx.TensorProto.DataType.INT64:return bi(Wt.fromBits(t.getUint32(o,!0),t.getUint32(o+4,!0),!1),e);case re.onnx.TensorProto.DataType.DOUBLE:return t.getFloat64(o,!0);case re.onnx.TensorProto.DataType.UINT64:return bi(Wt.fromBits(t.getUint32(o,!0),t.getUint32(o+4,!0),!0),e);default:throw new Error(`cannot read from DataView for type ${re.onnx.TensorProto.DataType[e]}`)}}var Nu,re,mi,Ce,br=E(()=>{Nu=Er(Ss()),ei(),nn(),re=Er($r()),fe(),mi=W.experimental.fbs,Ce=class Ir{constructor(e,o,a,l,f,d=Nu.Guid.create()){this.dims=e,this.type=o,this.dataProvider=a,this.asyncDataProvider=l,this.cache=f,this.dataId=d,this.size=U.validateDimsAndCalcSize(e);let p=this.size,h=a===void 0&&l===void 0&&f===void 0;if(f!==void 0&&f.length!==p)throw new RangeError("Input dims doesn't match data length.");if(o==="string"){if(!(f===void 0||Array.isArray(f)&&f.every(n=>typeof n=="string")))throw new TypeError("cache should be a string array");h&&(this.cache=new Array(p))}else{if(f!==void 0){let n=Ru(o);if(!(f instanceof n))throw new TypeError(`cache should be type ${n.name}`)}if(h){let n=new ArrayBuffer(p*jd(o));this.cache=Yd(n,o)}}}get data(){if(this.cache===void 0){let e=this.dataProvider(this.dataId);if(e.length!==this.size)throw new Error("Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.");this.cache=e}return this.cache}get stringData(){if(this.type!=="string")throw new 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 new 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 new TypeError("data type is not float (float32, float64)")}}
vendor: 4,193 bytes, lines 10-60
10get numberData(){if(this.type!=="string")return this.data;throw new TypeError("type cannot be non-number (string)")}get(e){return this.data[U.indicesToOffset(e,this.strides)]}set(e,o){this.data[U.indicesToOffset(e,this.strides)]=o}async getData(){return this.cache===void 0&&(this.cache=await this.asyncDataProvider(this.dataId)),this.cache}get strides(){return this._strides||(this._strides=U.computeStrides(this.dims)),this._strides}static fromProto(e){if(!e)throw new Error("cannot construct Value from an empty tensor");let o=Ve.tensorDataTypeFromProto(e.dataType),a=Ve.tensorDimsFromProto(e.dims),l=new Ir(a,o);if(o==="string")e.stringData.forEach((f,d)=>{l.data[d]=ln(f)});else if(e.rawData&&typeof e.rawData.byteLength=="number"&&e.rawData.byteLength>0){let f=l.data,d=new DataView(e.rawData.buffer,e.rawData.byteOffset,e.rawData.byteLength),p=ku(e.dataType),h=e.rawData.byteLength/p;if(e.rawData.byteLength%p!==0)throw new Error("invalid buffer length");if(f.length!==h)throw new Error("buffer length mismatch");for(let n=0;n<h;n++){let c=Bu(d,e.dataType,n*p);f[n]=c}}else{let f;switch(e.dataType){case re.onnx.TensorProto.DataType.FLOAT:f=e.floatData;break;case re.onnx.TensorProto.DataType.INT32:case re.onnx.TensorProto.DataType.INT16:case re.onnx.TensorProto.DataType.UINT16:case re.onnx.TensorProto.DataType.INT8:case re.onnx.TensorProto.DataType.UINT8:case re.onnx.TensorProto.DataType.BOOL:f=e.int32Data;break;case re.onnx.TensorProto.DataType.INT64:f=e.int64Data;break;case re.onnx.TensorProto.DataType.DOUBLE:f=e.doubleData;break;case re.onnx.TensorProto.DataType.UINT32:case re.onnx.TensorProto.DataType.UINT64:f=e.uint64Data;break;default:throw new Error("unspecific error")}if(f==null)throw new Error("failed to populate data from a tensorproto value");let d=l.data;if(d.length!==f.length)throw new Error("array length mismatch");for(let p=0;p<f.length;p++){let h=f[p];Wt.isLong(h)?d[p]=bi(h,e.dataType):d[p]=h}}return l}static fromData(e,o,a){return new Ir(o,a,void 0,void 0,e)}static fromOrtTensor(e){if(!e)throw new Error("cannot construct Value from an empty tensor");let o=Ve.tensorDimsFromORTFormat(e),a=Ve.tensorDataTypeFromProto(e.dataType()),l=new Ir(o,a);if(a==="string")for(let f=0;f<e.stringDataLength();f++)l.data[f]=e.stringData(f);else if(e.rawDataArray()&&typeof e.rawDataLength()=="number"&&e.rawDataLength()>0){let f=l.data,d=new DataView(e.rawDataArray().buffer,e.rawDataArray().byteOffset,e.rawDataLength()),p=ku(e.dataType()),h=e.rawDataLength()/p;if(e.rawDataLength()%p!==0)throw new Error("invalid buffer length");if(f.length!==h)throw new Error("buffer length mismatch");for(let n=0;n<h;n++){let c=Bu(d,e.dataType(),n*p);f[n]=c}}return l}}});function q(t){return t===1?Xd:Kd}function Mu(t){let e=q(t);return`${e.version}
11      precision highp float;
12      ${e.attribute} vec3 position;
13      ${e.attribute} vec2 textureCoord;
14
15      ${e.varyingVertex} vec2 TexCoords;
16
17      void main()
18      {
19          gl_Position = vec4(position, 1.0);
20          TexCoords = textureCoord;
21      }`}function Gu(t){let e=q(t);return`${e.version}
22    precision highp float;
23    precision highp int;
24    precision highp sampler2D;
25    ${e.varyingFrag} vec2 TexCoords;
26    ${e.outputDeclaration}
27    const vec2 halfCR = vec2(0.5, 0.5);
28
29    // Custom vector types to handle higher dimenalities.
30    struct ivec5
31    {
32      int x;
33      int y;
34      int z;
35      int w;
36      int u;
37    };
38
39    struct ivec6
40    {
41      int x;
42      int y;
43      int z;
44      int w;
45      int u;
46      int v;
47    };
48
49    int imod(int x, int y) {
50      return x - y * (x / y);
51    }
52
53    `}function Uu(t,e){return`
54  void main() {
55    int indices[${e}];
56    toVec(TexCoords, indices);
57    vec4 result = vec4(process(indices));
58    ${q(t).output} = result;
59  }
60  `}var Xd,Kd,xe=E(()=>{Xd={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},Kd={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"}}),ae=E(()=>{});async function gi(t,e=a=>0,o){return new Promise((a,l)=>{let f=0,d=()=>
60{if(t())return void a();f++;let p=e(f);setTimeout(d,p)};d()})}function Kn(t){return kr(typeof t<"u"&&t.length!==0,()=>"empty string found for sampler name"),"get"+t.charAt(0).toUpperCase()+t.slice(1)}function zu(t){return kr(typeof t<"u"&&t.length!==0,()=>"empty string found for sampler name"),"get"+t.charAt(0).toUpperCase()+t.slice(1)+"AtOutCoords"}function Br(t,e){let o=JSON.parse(JSON.stringify(t));return o=e,o}function Nr(t,e){return e.map(o=>t[o]).join(", ")}function Je(t){if(t<=1)return"int";if(t===2)return"ivec2";if(t===3)return"ivec3";if(t===4)return"ivec4";if(t===5)return"ivec5";if(t===6)return"ivec6";throw Error(`GPU for rank ${t} is not yet supported`)}function Ot(t=6){return["x","y","z","w","u","v"].slice(0,t)}var kt=E(()=>{fe()});function Jd(t,e){return Ot(e).map(o=>`${t}.${o}`)}function Rr(t,e){return e===1?[t]:Jd(t,e)}function Bt(){return`
61    float getChannel(vec4 frag, int dim) {
62      int modCoord = imod(dim, 2);
63      return modCoord == 0 ? frag.r : frag.g;
64    }
65
66    float getChannel(vec4 frag, vec2 innerDims) {
67      vec2 modCoord = mod(innerDims, 2.);
68      return modCoord.x == 0. ?
69        (modCoord.y == 0. ? frag.r : frag.g) :
70        (modCoord.y == 0. ? frag.b : frag.a);
71    }
72  `}var gr=E(()=>{kt()});function Qd(t,e,o){if(t===0)return"false";if(t===1)return`rc > ${e[0]}`;let a="";for(let l=t-2;l<t;l++)a+=`${o[l]} >= ${e[l-t+2]}`,l<t-1&&(a+="||");return a}function eh(t,e){let o=t.length;if(o===0)return"getA(), 0, 0, 0";if(o===1)return`getA(rc),
73            rc + 1 >= ${t[0]} ? 0. : getA(rc + 1),
74            0, 0`;let a="";if(o>2)for(let l=0;l<o-2;++l)a+=`${e[l]},`;return`getA(${a}r, c),
75          rEdge ? 0. : getA(${a}rp1, c),
76          cEdge ? 0. : getA(${a}r, cp1),
77          rEdge || cEdge ? 0. : getA(${a}rp1, cp1)`}function th(t,e,o,a){return t===0||t===1?"":`
78    int r = ${e[t-2]};
79    int c = ${e[t-1]};
80    int rp1 = ${e[t-2]} + 1;
81    int cp1 = ${e[t-1]} + 1;
82    bool rEdge = rp1 >= ${a};
83    bool cEdge = cp1 >= ${o};
84    `}var Vu,Zd,Wu,Hu=E(()=>{xe(),ae(),kt(),gr(),Vu={name:"pack",inputNames:["A"],inputTypes:[1]},Zd=(t,e)=>{let o,a=q(t.session.backend.glContext.version),l=e.dims,f=l.length,d=e.dims.length,p=Je(d),h=Rr("rc",d),n=th(d,h,l[l.length-2],l[l.length-1]);o=f===0?[1,1]:f===1?[l[0],1]:[l[d-1],l[d-2]];let c=Qd(d,o,h),r=eh(l,h),s=`
85        void main() {
86          ${p} rc = getOutputCoords();
87
88          if(${c}) {
89            ${a.output} = vec4(0);
90          } else {
91            ${n}
92
93            ${a.output} = vec4(${r});
94          }
95        }
96      `;return{...Vu,hasMain:!0,output:{dims:e.dims,type:e.type,textureType:2},shaderSource:s}},Wu=(t,e)=>({...Vu,get:()=>Zd(t,e)})});function yi(t){if(t.length===0)return[1,1,1];let e=1;for(let o=0;o<t.length-2;++o)e*=t[o];return[e,t.length>1?t[t.length-2]:1,t[t.length-1]]}function ju(t,e){let o=!1;return o=t.length===0||e.length===0||(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]),o}function oh(t){let e=U.computeStrides(t),o=["b","r","c"],a="index";return`
97    ivec3 inputCoordsFromReshapedOutCoords(int index) {
98      ${e.map((l,f)=>`${`int ${o[f]} = ${a} / ${l}`}; ${f===e.length-1?`int ${o[f+1]} = ${a} - ${o[f]} * ${l}`:`index -= ${o[f]} * ${l}`};`).join("")}
99      return ivec3(b, r, c);
100    }
101  `}function ih(t){let e=U.computeStrides(t);return`
102  int getFlattenedIndex(ivec3 coords) {
103    // reverse y, z order
104    return coords.x * ${e[0]} + coords.z * ${e[1]} + coords.y;
105  }
106`}var rh,nh,qu,Yu=E(()=>{fe(),xe(),ae(),gr(),rh=t=>({name:"Reshape (packed)",inputTypes:[2],inputNames:["A"],cacheHint:`${t}`}),nh=(t,e,o,a)=>{let l=e.dims,f=a,d="";for(let n=0;n<4;n++){let c="";switch(n){case 0:c="outputCoords = rc;";break;case 1:c="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:c="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:c="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}d+=`
107        ${c}
108        ${n>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""}
109          int flattenedIndex = getFlattenedIndex(outputCoords);
110
111          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex);
112          vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z));
113
114          result[${n}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims);
115
116        ${n>0?"}":""}
117      `}let p=q(t.session.backend.glContext.version),h=`
118      ${oh(l)}
119      ${ih(f)}
120      ${Bt()}
121
122      void main() {
123        ivec3 rc = getOutputCoords();
124
125        vec4 result = vec4(0.0);
126
127        ivec3 outputCoords;
128        int rows = ${f[2]};
129        int cols = ${f[1]};
130
131        ${d}
132        ${p.output} = result;
133      }
134    `;return{...o,output:{dims:f,type:e.type,textureType:2},shaderSource:h,hasMain:!0}},qu=(t,e,o)=>{let a=rh(o);return{...a,get:()=>nh(t,e,a,o)}}}),Ti,Xu=E(()=>{xe(),ae(),Ti=(t,e)=>{let o=e.shape,a=q(t.session.backend.glContext.version),l=`
135    const float FLOAT_MAX = 1.70141184e38;
136    const float FLOAT_MIN = 1.17549435e-38;
137
138    bool isNaN(float val) {
139      return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true;
140    }
141
142    highp vec4 encodeAsUint8(highp float v) {
143      if (isNaN(v)) {
144        return vec4(255, 255, 255, 255);
145      }
146
147      highp float av = abs(v);
148
149      if(av < FLOAT_MIN) {
150        return vec4(0.0, 0.0, 0.0, 0.0);
151      } else if(v > FLOAT_MAX) {
152        return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;
153      } else if(v < -FLOAT_MAX) {
154        return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;
155      }
156
157      highp vec4 c = vec4(0,0,0,0);
158
159      highp float e = floor(log2(av));
160      highp float m = exp2(fract(log2(av))) - 1.0;
161
162      c[2] = floor(128.0 * m);
163      m -= c[2] / 128.0;
164      c[1] = floor(32768.0 * m);
165      m -= c[1] / 32768.0;
166      c[0] = floor(8388608.0 * m);
167
168      highp float ebias = e + 127.0;
169      c[3] = floor(ebias / 2.0);
170      ebias -= c[3] * 2.0;
171      c[2] += floor(ebias) * 128.0;
172
173      c[3] += 128.0 * step(0.0, -v);
174
175      return c / 255.0;
176    }
177
178    void main() {
179      float value = ${a.texture2D}(X,TexCoords).r;
180      ${a.output} = encodeAsUint8(value);
181    }`,f={name:"Uint8Encode",inputTypes:[0],inputNames:["X"],output:{dims:o,type:e.tensor.type,textureType:3},shaderSource:l,hasMain:!0};return t.executeProgram(f,[e.tensor])}});function sh(t,e){if(t===1)return"rc";let o="";for(let a=0;a<t;a++)o+=e[a],a<t-1&&(o+=",");return o}var Ku,ah,Ju,Zu=E(()=>{xe(),ae(),kt(),gr(),Ku={name:"unpack",inputNames:["A"],inputTypes:[2]},ah=(t,e)=>{let o=e.dims.length,a=Rr("rc",o),l=a.slice(-2),f=Je(o),d=Bt(),p=e.dims.length===0?"":sh(o,a),h=o<=1?"rc":`vec2(${l.join(",")})`,n=`
182    ${d}
183    void main() {
184      ${f} rc = getOutputCoords();
185
186       // Sample the texture with the coords to get the rgba channel value.
187       vec4 packedInput = getA(${p});
188
189       ${q(t.session.backend.glContext.version).output} = vec4(getChannel(packedInput, ${h}), 0, 0, 0);
190     }
191   `;return{...Ku,hasMain:!0,output:{dims:e.dims,type:e.type,textureType:0},shaderSource:n}},Ju=(t,e)=>({...Ku,get:()=>ah(t,e)})}),Jn,fn,Zn,cn=E(()=>{at(),Jn=class{constructor(t,e=1){if(e===1)this.internalFormat=t.R32F,this.format=t.RED,this.textureType=t.FLOAT,this.channelSize=e;else{if(e!==4)throw new 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 o,a;return t.constructor!==Float32Array&&(ce.warning("Encoder","data was not of type Float32; creating new Float32Array"),a=new Float32Array(t)),e*this.channelSize>t.length?(ce.warning("Encoder","Source data too small. Allocating larger array"),a=t,o=this.allocate(e*this.channelSize),a.forEach((l,f)=>o[f]=l)):(a=t,o=a),o}allocate(t){return new Float32Array(4*t)}decode(t,e){return this.channelSize===1?t.filter((o,a)=>a%4==0).subarray(0,e):t.subarray(0,e)}},fn=class{constructor(t,e=1,o){if(e!==1&&e!==4)throw new Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA,this.format=t.RGBA,this.channelSize=e,this.textureType=o||t.FLOAT}encode(t,e){let o=t;return this.channelSize===1&&(ce.verbose("Encoder","Exploding into a larger array"),o=this.allocate(e),t.forEach((a,l)=>o[4*l]=a)),o}allocate(t){return new Float32Array(4*t)}decode(t,e){return this.channelSize===1?t.filter((o,a)=>a%4==0).subarray(0,e):t.subarray(0,e)}},Zn=class{constructor(t,e=1){if(this.channelSize=4,e===1)this.internalFormat=t.ALPHA,this.format=t.ALPHA,this.textureType=t.UNSIGNED_BYTE,this.channelSize=e;else{if(e!==4)throw new 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)}
vendor: 15,544 bytes, lines 191-353
191decode(t,e){if(t instanceof Uint8Array)return t.subarray(0,e);throw new Error(`Invalid array type: ${t.constructor}`)}}}),pn,Qu,xi,el=E(()=>{fe(),ae(),pn=(t,e,o)=>{let a=o===0||o===1?1:4,l=o===2,f=o===1||o===2,d=o===4?e.length-1:void 0,p=o===4?e.map((h,n)=>n===e.length-1?4*h:h):void 0;return xi(t,e,a,p,{isPacked:l,reverseWH:f,breakAxis:d})},Qu=(t,e,o)=>{let a=pn(t,e,o);return[a.width,a.height]},xi=(t,e,o=1,a,l)=>{let f=!(!l||!l.isPacked),[d,p]=t.computeTextureWH(f&&a||e,l),h=e.length,n=e.slice(0);if(h===0&&(n=[1]),o===1)a=e;else if(f){if(o!==4)throw new Error("a packed texture must be 4-channel");a=e,h>0&&(n[h-1]=Math.ceil(n[h-1]/2)),h>1&&(n[h-2]=Math.ceil(n[h-2]/2))}else if(!a)throw new Error("Unpacked shape is needed when using channels > 1");return{width:d,height:p,channels:o,isPacked:f,shape:n,strides:U.computeStrides(n),unpackedShape:a,reversedWH:l&&l.reverseWH}}}),lh,Qn,rl=E(()=>{at(),br(),fe(),Hu(),Yu(),Xu(),Zu(),cn(),el(),ae(),lh=(t,e)=>{let o=e.map(l=>`${l.unpackedShape.join(",")};${l.width}x${l.height}`).join("_"),a=t.name;return t.cacheHint&&(a+="["+t.cacheHint+"]"),a+=":"+o,a},Qn=class{constructor(t){this.session=t,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(t,e){return Qu(this.session.layoutStrategy,t,e)}executeProgram(t,e){if(e.length<t.inputNames.length)throw new Error(`Input size mustn't be less than ${t.inputNames.length}.`);if(t.inputNames.length!==t.inputTypes.length)throw new Error("input names size does not match input types");let o=[];for(let h=0;h<t.inputNames.length;++h)o[h]=this.getOrCreateTextureData(e[h],t.inputTypes[h]);let a=lh(t,o),l=this.session.programManager.getArtifact(a),f=l?l.programInfo:typeof t.get=="function"?t.get():t,d=pn(this.session.layoutStrategy,f.output.dims,f.output.textureType),p=this.createTextureData(d,f.output.type);return l||(l=this.session.programManager.build(f,o,p),this.session.programManager.setArtifact(a,l)),this.runProgram(l,o,p),p}run(t,e){return this.executeProgram(t,e).tensor}runProgram(t,e,o){for(let a=0;a<e.length;++a)if(!!e[a].isPacked!=(t.programInfo.inputTypes[a]===2))throw new Error(`input[${a}] property packed inconsistent`);if(!!o.isPacked!=(t.programInfo.output.textureType===2))throw new Error("output property packed inconsistent");this.session.programManager.run(t,e,o)}getOrCreateTextureData(t,e){let o=this.getTextureData(t.dataId,e===2);if(!o&&(o=this.getTextureData(t.dataId,e!==2),o))return e===2?this.pack(o):this.unpack(o);if(!o){let a=pn(this.session.layoutStrategy,t.dims,e);if(e===4){let l=t.dims;if(l.length===4){let f=[l[0],Math.ceil(l[1]*l[2]*l[3]/4)],d=pn(this.session.layoutStrategy,f,e),p=t.numberData;if(l[1]*l[2]*l[3]%4!=0){let h=l[0],n=l[1]*l[2]*l[3],c=4*Math.ceil(1*n/4);p=new Float32Array(h*c);for(let r=0;r<h;++r){let s=r*n,u=r*c+r%1*n;p.set(t.numberData.subarray(s,s+n),u)}}return this.createTextureData(d,t.type,p,t,1)}}if(e===2){let l=xi(this.session.layoutStrategy,t.dims,1,[],{reverseWH:!0}),f=this.createTextureData(l,t.type,t.numberData,t,1);o=this.pack(f)}else o=this.createTextureData(a,t.type,t.numberData,t,1)}return o}createTextureDataFromLayoutBindTensor(t,e,o,a){return this.createTextureData(t,e,o,a,1)}createTextureData(t,e,o,a,l){ce.verbose("InferenceHandler",`Creating TextureData: layout:[${JSON.stringify(t)}]`);let f=this.session.textureManager.createTextureFromLayout(e,t,o,l);return this.createTextureDataFromTexture(t,e,f,a)}reshapeUnpacked(t,e){let o=this.getOrCreateTextureData(t,0),a={channels:o.channels,height:o.height,width:o.width,shape:e.length!==0?e:[1],strides:U.computeStrides(e),unpackedShape:e};return this.createTextureDataFromTexture(a,t.type,o.texture).tensor}reshapePacked(t,e){let o=this.getOrCreateTextureData(t,2);if(ju(t.dims,e)){let p={channels:o.channels,height:o.height,width:o.width,shape:e.length!==0?e:[1],strides:U.computeStrides(e),unpackedShape:e,isPacked:!0};return this.createTextureDataFromTexture(p,t.type,o.texture).tensor}let a=yi(t.dims),l=yi(e),f=this.reshapePacked(t,a),d=this.run(qu(this,f,l),[f]);return this.reshapePacked(d,e)}cast(t,e){let o=this.getOrCreateTextureData(t,0);return this.createTextureDataFromTexture(o,e,o.texture).tensor}createTextureDataFromTexture(t,e,o,a,l){let f={...t,tensor:a||new Ce(t.unpackedShape,e,d=>this.readTexture(f),async d=>this.readTextureAsync(f),void 0,l),texture:o};return this.setTextureData(f.tensor.dataId,f,t.isPacked),f}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,o=!1){this.session.isInitializer(t)?this.session.setTextureData(t,e,o):(o?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(Ti(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(Ti(this,t))}pack(t){return this.executeProgram(Wu(this,t.tensor),[t.tensor])}unpack(t){return this.executeProgram(Ju(this,t.tensor),[t.tensor])}}}),wi,ee,Ge=E(()=>{wi=class{constructor(t){Object.assign(this,t)}get cacheKey(){return this.key||(this.key=Object.getOwnPropertyNames(this).sort().map(t=>`${this[t]}`).join(";")),this.key}},ee=t=>new wi(t)}),nl,ol,il,fh,ch,al=E(()=>{Ge(),xe(),ae(),nl={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[0,0,0,0,0]},ol=(t,e,o)=>(ch(e),[t.run({...nl,cacheHint:o.cacheKey,get:()=>fh(t,e,o)},e)]),il=t=>{let e=t.attributes.getFloat("epsilon",1e-5),o=t.attributes.getFloat("momentum",.9),a=t.attributes.getInt("spatial",1);return ee({epsilon:e,momentum:o,spatial:a})},fh=(t,e,o)=>{let a=q(t.session.backend.glContext.version),l=e[0].dims.length,[f,d]=t.calculateTextureWidthAndHeight(e[1].dims,0),p=`
192  float process(int[${l}] indices) {
193    vec2 position = offsetToCoords(indices[1], ${f}, ${d});
194    float scale = getColorAsFloat(${a.texture2D}(Scale, position));
195    float mean = getColorAsFloat(${a.texture2D}(Mean, position));
196    float variance = getColorAsFloat(${a.texture2D}(Variance, position));
197    float b = getColorAsFloat(${a.texture2D}(B, position));
198
199    return scale * ( (_A(indices) - mean) / sqrt(variance + float(${o.epsilon})) ) + b;
200  }`;return{...nl,output:{dims:e[0].dims,type:e[0].type,textureType:0},shaderSource:p}},ch=t=>{if(!t||t.length!==5)throw new Error("BatchNormalization requires 5 inputs.");let e=t[0],o=t[1],a=t[2],l=t[3],f=t[4];if(e.dims.length<3||o.dims.length!==1||a.dims.length!==1||l.dims.length!==1||f.dims.length!==1)throw new Error("invalid input shape.");if(o.dims[0]!==e.dims[1]||a.dims[0]!==e.dims[1]||l.dims[0]!==e.dims[1]||f.dims[0]!==e.dims[1])throw new Error("invalid input shape.");if(e.type!=="float32"&&e.type!=="float64"||o.type!=="float32"&&o.type!=="float64"||a.type!=="float32"&&a.type!=="float64"||l.type!=="float32"&&l.type!=="float64"||f.type!=="float32"&&f.type!=="float64")throw new Error("invalid input tensor types.")}}),eo,ft,R,dn,to,Ht=E(()=>{eo=class{constructor(t,e,o,a){this.glContext=t,this.programInfo=e,this.inputTextureLayouts=o,this.outputTextureLayout=a}},ft=class{constructor(t){this.context=t}},R=class{constructor(t,e){this.routineBody=t,this.dependencies=e}},dn=class{constructor(t,e,o){this.name=t,this.dependencies=o||[],e&&(this.routineBody=e)}addDependency(t){t&&this.dependencies.push(t)}},to=class{static returnOrderedNodes(t){if(!t||t.length===0)return[];if(t.length===1)return t;let e=new Set,o=new Set,a=new Array;return this.createOrderedNodes(t,e,o,a),a}static createOrderedNodes(t,e,o,a){for(let l=0;l<t.length;++l)this.dfsTraverse(t[l],e,o,a)}static dfsTraverse(t,e,o,a){if(!t||o.has(t.name))return;if(e.has(t.name))throw new Error("Cyclic dependency detected. Can't topologically sort routines needed for shader.");e.add(t.name);let l=t.dependencies;if(l&&l.length>0)for(let f=0;f<l.length;++f)this.dfsTraverse(l[f],e,o,a);a.push(t),o.add(t.name),e.delete(t.name)}}});function dh(){let t="add_";return{body:`
201  float ${t}(float a, float b) {
202    return a + b;
203  }
204  vec4 ${t}(vec4 v1, vec4 v2) {
205    return v1 + v2;
206  }
207  `,name:t,type:0}}function hh(){let t="div_";return{body:`
208  float ${t}(float a, float b) {
209    return a / b;
210  }
211  vec4 ${t}(vec4 v1, vec4 v2) {
212    return v1 / v2;
213  }
214  `,name:t,type:0}}function mh(){let t="mul_";return{body:`
215  float ${t}(float a, float b) {
216    return a * b;
217  }
218  vec4 ${t}(vec4 v1, vec4 v2) {
219    return v1 * v2;
220  }
221  `,name:t,type:0}}function bh(){let t="sub_";return{body:`
222  float ${t}(float a, float b) {
223    return a - b;
224  }
225  vec4 ${t}(vec4 v1, vec4 v2) {
226    return v1 - v2;
227  }
228  `,name:t,type:0}}function gh(){let t="equal_";return{body:`
229  float ${t}(float a, float b) {
230    return float(a == b);
231  }
232  vec4 ${t}(vec4 v1, vec4 v2) {
233    return vec4(equal(v1, v2));
234  }
235  `,name:t,type:0}}function yh(){let t="greater_";return{body:`
236  float ${t}(float a, float b) {
237    return float(a > b);
238  }
239  vec4 ${t}(vec4 v1, vec4 v2) {
240    return vec4( v1.r > v2.r ,
241      v1.g > v2.g,
242      v1.b > v2.b,
243      v1.a > v2.a );
244  }
245  `,name:t,type:0}}function Th(){let t="less_";return{body:`
246  float ${t}(float a, float b) {
247    return float(a < b);
248  }
249  vec4 ${t}(vec4 v1, vec4 v2) {
250    return vec4( v1.r < v2.r ,
251                v1.g < v2.g,
252                v1.b < v2.b,
253                v1.a < v2.a );
254  }
255  `,name:t,type:0}}function xh(){let t="and_";return{body:`
256  float ${t}(float a, float b) {
257    return float( bool(a) && bool(b) );
258  }
259  vec4 ${t}(vec4 v1, vec4 v2) {
260    bvec4 b1 = bvec4(v1);
261    bvec4 b2 = bvec4(v2);
262    return vec4( b1.r && b2.r ,
263                b1.g && b2.g,
264                b1.b && b2.b,
265                b1.a && b2.a );
266  }
267  `,name:t,type:0}}function wh(){let t="or_";return{body:`
268  float ${t}(float a, float b) {
269    return float( bool(a) || bool(b) );
270  }
271  vec4 ${t}(vec4 v1, vec4 v2) {
272    bvec4 b1 = bvec4(v1);
273    bvec4 b2 = bvec4(v2);
274    return vec4( b1.r || b2.r ,
275                b1.g || b2.g,
276                b1.b || b2.b,
277                b1.a || b2.a );
278  }
279  `,name:t,type:0}}function vh(){let t="xor_";return{body:`
280  float ${t}(float a, float b) {
281    return float( bool(a) ^^ bool(b) );
282  }
283  vec4 ${t}(vec4 v1, vec4 v2) {
284    bvec4 b1 = bvec4(v1);
285    bvec4 b2 = bvec4(v2);
286    return vec4( b1.r ^^ b2.r ,
287                b1.g ^^ b2.g,
288                b1.b ^^ b2.b,
289                b1.a ^^ b2.a );
290  }
291  `,name:t,type:0}}function _h(){return Ih("pow")}function Oh(){let t="prelu_";return{body:`
292  float ${t}(float a, float b) {
293    return a < 0.0 ? a * b: a;
294  }
295  vec4 ${t}(vec4 v1, vec4 v2) {
296    return vec4(
297      v1.r < 0.0 ? v1.r * v2.r: v1.r,
298      v1.g < 0.0 ? v1.g * v2.g: v1.g,
299      v1.b < 0.0 ? v1.b * v2.b: v1.b,
300      v1.a < 0.0 ? v1.a * v2.a: v1.a
301      );
302  }
303  `,name:t,type:0}}function Ih(t){let e=`${t}_`;return{body:`
304  float ${e}(float a, float b) {
305    return ${t}(a, b);
306  }
307  vec4 ${e}(vec4 v1, vec4 v2) {
308    return ${t}(v1, v2);
309  }
310  `,name:e,type:0}}var ct,Sh,sl,ul,ll,fl,cl,pl,dl,hl,ml,bl,gl,yl,Tl=E(()=>{fe(),Ht(),xe(),ae(),ct=(t,e,o,a=e[0].type,l)=>{let f=t.session.pack?2:0;return{name:o.name,inputNames:["A","B"],inputTypes:[f,f],cacheHint:l,get:()=>Sh(t,e,o,a)}},Sh=(t,e,o,a=e[0].type)=>{let l=t.session.pack?2:0,f=!U.areEqual(e[0].dims,e[1].dims),d=e[0].dims,p=t.session.pack;if(f){let c=Ke.calcShape(e[0].dims,e[1].dims,!1);if(!c)throw new Error("Can't perform binary op on the given tensors");d=c;let r=d.length,s=e[0].dims.length!==0?e[0].dims.length:1,u=e[1].dims.length!==0?e[1].dims.length:1,g=e[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",y=e[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",S=q(t.session.backend.glContext.version),A=p?`
311      ${o.body}
312      void main() {
313        vec4 a = getAAtOutCoords();
314        vec4 b = getBAtOutCoords();
315        vec4 result = ${o.name}(a, b);
316        ${S.output} = result;
317      }`:`
318      ${o.body}
319      float process(int indices[${r}]) {
320        int aindices[${s}];
321        int bindices[${u}];
322        ${g}
323        ${y}
324        return ${o.name}(_A(aindices), _B(bindices));
325      }`;return{name:o.name,inputNames:["A","B"],inputTypes:[l,l],output:{dims:d,type:a,textureType:l},shaderSource:A,hasMain:p}}let h=q(t.session.backend.glContext.version),n=`
326    ${o.body}
327    void main() {
328      vec4 v1 = ${h.texture2D}(A, TexCoords);
329      vec4 v2 = ${h.texture2D}(B, TexCoords);
330      vec4 result = ${o.name}(v1, v2);
331      ${h.output} = result;
332    }
333    `;return{name:o.name,inputNames:["A","B"],inputTypes:[l,l],output:{dims:e[0].dims,type:a,textureType:l},shaderSource:n,hasMain:!0}},sl=(t,e)=>[t.run(ct(t,e,dh()),e)],ul=(t,e)=>[t.run(ct(t,e,xh(),"bool"),e)],ll=(t,e)=>[t.run(ct(t,e,hh()),e)],fl=(t,e)=>[t.run(ct(t,e,gh(),"bool"),e)],cl=(t,e)=>[t.run(ct(t,e,yh(),"bool"),e)],pl=(t,e)=>[t.run(ct(t,e,Th(),"bool"),e)],dl=(t,e)=>[t.run(ct(t,e,mh()),e)],hl=(t,e)=>[t.run(ct(t,e,wh(),"bool"),e)],ml=(t,e)=>[t.run(ct(t,e,_h()),e)],bl=(t,e)=>[t.run(ct(t,e,Oh()),e)],gl=(t,e)=>[t.run(ct(t,e,bh()),e)],yl=(t,e)=>[t.run(ct(t,e,vh(),"bool"),e)]}),xl,wl,Ph,vl=E(()=>{fe(),xl=(t,e,o)=>(Ph(e),[t.cast(e[0],o)]),wl=t=>Ve.tensorDataTypeFromProto(t.attributes.getInt("to")),Ph=t=>{if(!t||t.length!==1)throw new Error("Cast requires 1 input.");if(t[0].type==="string")throw new Error("Invalid input type.")}}),Eh,Dh,_l,ro,Ol=E(()=>{xe(),ae(),kt(),gr(),Eh=(t,e)=>({name:"Concat (packed)",inputNames:Array.from({length:t},(o,a)=>`X${a}`),inputTypes:Array(t).fill(2),cacheHint:e}),Dh=(t,e,o,a)=>{let l=o[0].dims.slice();if(a>=l.length||a<-1*l.length)throw new Error("axis specified for concat doesn't match input dimensionality");a<0&&(a=l.length+a);let f=l.slice(0);for(let Y=1;Y<o.length;Y++){let X=o[Y].dims.slice();for(let mt=0;mt<l.length;mt++)if(mt===a)f[a]+=X[mt];else if(l[mt]!==X[mt])throw new Error("non concat dimensions must match")}let d=f.length,p=Rr("coords",d),h=Je(d),n=Bt(),c=o.map(Y=>Y.dims),r=Ot(d),s=new Array(c.length-1);s[0]=c[0][a];for(let Y=1;Y<s.length;Y++)s[Y]=s[Y-1]+c[Y][a];let u=r[a],g=r.slice(-2),y=r.join(),S=`if (${u} < ${s[0]}) {
334        return getChannel(
335            getX0(${y}), vec2(${g.join()}));
336        }`;for(let Y=1;Y<s.length;Y++){let X=s[Y-1];S+=`
337            if (${u} < ${s[Y]}  && ${u} >= ${s[Y-1]}) {
338              return getChannel(
339                getX${Y}(${ro(r,u,X)}),
340                vec2(${ro(g,u,X)}));
341            }`}let A=s.length,L=s[s.length-1];S+=`
342            return getChannel(
343              getX${A}(${ro(r,u,L)}),
344              vec2(${ro(g,u,L)}));`;let z=q(t.session.backend.glContext.version),et=`
345          ${n}
346          float getValue(${r.map(Y=>"int "+Y)}) {
347            ${S}
348          }
349
350          void main() {
351            ${h} coords = getOutputCoords();
352            int lastDim = coords.${r[d-1]};
353            coords.${r[d-1]}
353 = coords.${r[d-2]};
354            coords.${r[d-2]} = lastDim;
355
356            vec4 result = vec4(getValue(${p}), 0., 0., 0.);
357
358            ${p[d-1]} = ${p[d-1]} + 1;
359            if (${p[d-1]} < ${f[d-1]}) {
360              result.g = getValue(${p});
361            }
362
363            ${p[d-2]} = ${p[d-2]} + 1;
364            if (${p[d-2]} < ${f[d-2]}) {
365              result.a = getValue(${p});
366            }
367
368            ${p[d-1]} = ${p[d-1]} - 1;
369            if (${p[d-2]} < ${f[d-2]} &&
370                ${p[d-1]} < ${f[d-1]}) {
371              result.b = getValue(${p});
372            }
373            ${z.output} = result;
374          }
375        `;return{...e,output:{dims:f,type:o[0].type,textureType:2},shaderSource:et,hasMain:!0}},_l=(t,e,o)=>{let a=Eh(e.length,o.cacheKey);return{...a,get:()=>Dh(t,a,e,o.axis)}},ro=(t,e,o)=>{let a=t.indexOf(e);return t.map((l,f)=>f===a?`${l} - ${o}`:l).join()}}),Il,Lh,Fh,Ch,Sl,$h,kh,Bh,Al,Nh,Pl=E(()=>{Ge(),ae(),Ol(),Il=(t,e,o)=>(Nh(e),t.session.pack&&e[0].dims.length>1?[t.run(_l(t,e,o),e)]:[t.run(Ch(t,e,o),e)]),Lh=(t,e)=>({name:"Concat",inputNames:Array.from({length:t},(o,a)=>`X${a}`),inputTypes:Array(t).fill(0),cacheHint:e}),Fh=(t,e,o,a)=>{let l=o[0].dims.slice();if(a>=l.length||a<-1*l.length)throw new Error("axis specified for concat doesn't match input dimensionality");a<0&&(a=l.length+a);let f=l.slice(0);for(let r=1;r<o.length;r++){let s=o[r].dims.slice();for(let u=0;u<l.length;u++)if(u===a)f[a]+=s[u];else if(l[u]!==s[u])throw new Error("non concat dimensions must match")}let d=f.length,p=new Array(o.length),h=0;for(let r=0;r<p.length;++r)h+=o[r].dims[a],p[r]=h;let n="";n=o.length<5?Sl(p):$h(p);let c=`
376        ${kh(o.length,d)}
377        ${Bh(p)}
378        ${n}
379        float process(int indices[${d}]) {
380          int textureIndex = getTextureWhereDataResides (indices[${a}]);
381
382          if(textureIndex != 0) {
383            indices[${a}] = indices[${a}] - int(getSizeInConcatAxisValueFromIndex(textureIndex-int(1)));
384          }
385
386          return fetchDataFromCorrectTexture(textureIndex, indices);
387        }`;return{...e,output:{dims:f,type:o[0].type,textureType:0},shaderSource:c}},Ch=(t,e,o)=>{let a=Lh(e.length,o.cacheKey);return{...a,get:()=>Fh(t,a,e,o.axis)}},Sl=t=>`int getTextureWhereDataResides(int index) {
388      ${t.map((e,o)=>`if(index<${e}) {return ${o};}
389`).join("")}
390    }`,$h=t=>Sl(t),kh=(t,e)=>{let o=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${e}]) {`];for(let a=0;a<t;++a)a===0?o.push(`	if (textureIndex == ${a}) { return _X${a}(indices); }`):a===t-1?o.push(`	else { return _X${a}(indices); }`):o.push(`	else if (textureIndex == ${a}) { return _X${a}(indices); }`);return o.push("	}"),o.join(`
391`)},Bh=t=>{let e=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let o=0;o<t.length;++o)o===0?e.push(`	if (index == ${o}) { return ${t[o]}; }`):o===t.length-1?e.push(`	else { return ${t[o]}; }`):e.push(`	else if (index == ${o}) { return ${t[o]}; }`);return e.push("	}"),e.join(`
392`)},Al=t=>ee({axis:t.attributes.getInt("axis")}),Nh=t=>{if(!t||t.length<1)throw new Error("too few inputs");let e=t[0].type,o=t[0].dims.length;if(e==="string")throw new Error("string tensor is not supported yet");for(let a of t){if(a.type!==e)throw new Error("input tensors should be one type");if(a.dims.length!==o)throw new Error("input tensors should have the same shape")}}});function Rh(){return pt("abs")}function Mh(){return pt("acos")}function Gh(){return pt("asin")}function Uh(){return pt("atan")}function zh(){return pt("ceil")}function Vh(){return pt("cos")}function Wh(t){let e="elu";return{body:`
393  const float alpha = float(${t});
394
395  float ${e}_(float a) {
396    return a >= 0.0 ? a: (exp(a) - 1.0) * alpha;
397  }
398  vec4 ${e}_(vec4 v) {
399    return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w));
400  }
401  `,name:e,type:0}}function Hh(){return pt("exp")}function qh(){return pt("floor")}function vi(t,e){let o="clip";return{body:`
402  const float min = float(${t});
403  const float max = float(${e});
404
405  float ${o}_(float a) {
406    return clamp(a, min, max);
407  }
408  vec4 ${o}_(vec4 v) {
409    return clamp(v, min, max);
410  }
411  `,name:o,type:0}}function jh(){let t="indentity";return{body:`
412  float ${t}_(float a) {
413    return a;
414  }
415  vec4 ${t}_(vec4 v) {
416    return v;
417  }
418  `,name:t,type:0}}function Yh(t){let e="leakyRelu";return{body:`
419  const float alpha = float(${t});
420
421  float ${e}_(float a) {
422    return a < 0.0 ? a * alpha : a;
423  }
424  vec4 ${e}_(vec4 v) {
425    return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w));
426  }
427  `,name:e,type:0}}function Xh(){return pt("log")}function Kh(){let t="neg";return{body:`
428  float ${t}_(float a) {
429    return -a;
430  }
431  vec4 ${t}_(vec4 v) {
432    return -v;
433  }
434  `,name:t,type:0}}function Jh(){let t="not";return{body:`
435  float ${t}_(float a) {
436    return float( ! bool(a) );
437  }
438  bool ${t}_(bool a) {
439    return !a;
440  }
441  vec4 ${t}_(vec4 v) {
442    return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w));
443  }
444  bvec4 ${t}_(bvec4 v) {
445    return bvec4(!v.x, !v.y, !v.z, !v.w);
446  }
447  `,name:t,type:0}}function Zh(){return pt("sin")}function _i(){let t="relu";return{body:`
448  float ${t}_(float a) {
449    return max( a, 0.0 );
450  }
451  vec4 ${t}_(vec4 v) {
452    return max( v, 0.0 );
453  }
454  `,name:t,type:0}}function Oi(){let t="sigmoid";return{body:`
455  float ${t}_(float a) {
456    return 1.0 / (1.0 + exp(-a));
457  }
458  vec4 ${t}_(vec4 v) {
459    return 1.0 / (1.0 + exp(-v));
460  }
461  `,name:t,type:0}}function Qh(){return pt("sqrt")}function em(){return pt("tan")}function tm(){let t="tanh";return{body:`
462  float ${t}_(float a) {
463    a = clamp(a, -10., 10.);
464    a = exp(2.*a);
465    return (a - 1.) / (a + 1.);
466  }
467  vec4 ${t}_(vec4 v) {
468    v = clamp(v, -10., 10.);
469    v = exp(2.*v);
470    return (v - 1.) / (v + 1.);
471  }
472  `,name:t,type:0}}function pt(t){return{body:`
473  float ${t}_(float a) {
474    return ${t}(a);
475  }
476  vec4 ${t}_(vec4 v) {
477    return ${t}(v);
478  }
479  `,name:t,type:0}}var rm,De,El,Dl,Ll,Fl,Ii,Cl,$l,nm,kl,Bl,Nl,Rl,Ml,Gl,Si,Ul,zl,Vl,Wl,Hl,ql,jl,Yl,Xl,Kl,Jl,Ai=E(()=>{Ge(),fe(),Ht(),xe(),ae(),rm=(t,e,o,a)=>{let l=t.session.pack?2:0,f=q(t.session.backend.glContext.version);return{...e,output:{dims:o.dims,type:o.type,textureType:l},shaderSource:`
480     ${a.body}
481     void main() {
482       vec4 v = ${f.texture2D}(A, TexCoords);
483       v = ${a.name}_(v);
484       ${f.output} = v;
485     }
486     `,hasMain:!0}},De=(t,e,o,a)=>{let l=t.session.pack?2:0,f={name:o.name,inputTypes:[l],inputNames:["A"],cacheHint:a};return{...f,get:()=>rm(t,f,e,o)}},El=(t,e)=>[t.run(De(t,e[0],Rh()),e)],Dl=(t,e)=>[t.run(De(t,e[0],Mh()),e)],Ll=(t,e)=>[t.run(De(t,e[0],Gh()),e)],Fl=(t,e)=>[t.run(De(t,e[0],Uh()),e)],Ii=(t,e,o)=>[t.run(De(t,e[0],vi(o.min,o.max),o.cacheKey),e)],Cl=t=>ee({min:t.attributes.getFloat("min",hr),max:t.attributes.getFloat("max",mr)}),$l=(t,e)=>{let o=nm(t,e);return Ii(t,[e[0]],o)},nm=(t,e)=>{if(e.length>=3&&(!t.session.isInitializer(e[1].dataId)||!t.session.isInitializer(e[2].dataId)))throw new Error("dynamic clip attributes are not allowed");let o=e.length>=3?e[1].numberData[0]:hr,a=e.length>=3?e[2].numberData[0]:mr;return ee({min:o,max:a})},kl=(t,e)=>[t.run(De(t,e[0],zh()),e)],Bl=(t,e)=>[t.run(De(t,e[0],Vh()),e)],Nl=(t,e,o)=>[t.run(De(t,e[0],Wh(o.alpha),o.cacheKey),e)],Rl=t=>ee({alpha:t.attributes.getFloat("alpha",1)}),Ml=(t,e)=>[t.run(De(t,e[0],Hh()),e)],Gl=(t,e)=>[t.run(De(t,e[0],qh()),e)],Si=(t,e)=>[t.run(De(t,e[0],jh()),e)],Ul=(t,e,o)=>[t.run(De(t,e[0],Yh(o.alpha),o.cacheKey),e)],zl=t=>ee({alpha:t.attributes.getFloat("alpha",.01)}),Vl=(t,e)=>[t.run(De(t,e[0],Xh()),e)],Wl=(t,e)=>[t.run(De(t,e[0],Kh()),e)],Hl=(t,e)=>[t.run(De(t,e[0],Jh()),e)],ql=(t,e)=>[t.run(De(t,e[0],_i()),e)],jl=(t,e)=>[t.run(De(t,e[0],Oi()),e)],Yl=(t,e)=>[t.run(De(t,e[0],Zh()),e)],Xl=(t,e)=>[t.run(De(t,e[0],Qh()),e)],Kl=(t,e)=>[t.run(De(t,e[0],em()),e)],Jl=(t,e)=>[t.run(De(t,e[0],tm()),e)]});function Nt(t){let e;switch(t.activation){case"Relu":e=_i();break;case"Sigmoid":e=Oi();break;case"Clip":e=vi(t.clipMin,t.clipMax);break;default:return{activationFunction:"",applyActivation:""}}let o=e.name;return{activationFunction:e.body,applyActivation:`value = ${o}_(value);`}}var Mr,yr=E(()=>{fe(),Ai(),Mr=t=>{let e=t.getString("activation","");if(e==="Clip"){let[o,a]=t.getFloats("activation_params",[hr,mr]);return{activation:e,clipMax:a,clipMin:o,activationCacheKey:`${e}:${o},${a}`}}return{activation:e,activationCacheKey:e}}}),im,am,Zl,Ql=E(()=>{at(),xe(),ae(),no(),yr(),im=(t,e)=>({name:"GroupedConv",inputNames:t?["X","W","Bias"]:["X","W"],inputTypes:t?[0,0,0]:[0,0],cacheHint:e}),am=(t,e,o,a)=>{let l=e.length>2?"value += getBias(output_channel);":"",f=e[0].dims.slice(),d=e[1].dims.slice(),p=d[0]/a.group;ce.verbose("GroupedConv",`autpPad:${a.autoPad}, dilations:${a.dilations}, group:${a.group}, kernelShape:${a.kernelShape}, pads:${a.pads}, strides:${a.strides}`);let h=Gr(f,d,a.dilations,a.pads,a.strides),n=q(t.session.backend.glContext.version),{activationFunction:c,applyActivation:r}=Nt(a),s=`
487  const ivec2 strides = ivec2(${a.strides[0]}, ${a.strides[1]});
488  const ivec2 pads = ivec2(${a.pads[0]}, ${a.pads[1]});
489  ${c}
490  void main() {
491    ivec4 coords = getOutputCoords();
492    int batch = coords.x;
493    int output_channel = coords.y;
494    ivec2 xRCCorner = coords.zw * strides - pads;
495    int group_id = output_channel / ${p};
496
497    float value = 0.0;
498    for (int wInChannel = 0; wInChannel < ${d[1]}; wInChannel++) {
499      int input_channel = group_id * ${d[1]} + wInChannel;
500      for (int wHeight = 0; wHeight < ${d[2]}; wHeight++) {
501        int xHeight = xRCCorner.x + wHeight * ${a.dilations[0]};
502
503        if (xHeight < 0 || xHeight >= ${f[2]}) {
504          continue;
505        }
506
507        for (int wWidth = 0; wWidth < ${d[3]}; wWidth++) {
508          int xWidth = xRCCorner.y + wWidth * ${a.dilations[1]};
509          if (xWidth < 0 || xWidth >= ${f[3]}) {
510            continue;
511          }
512
513          float xVal = getX(batch, input_channel, xWidth, xHeight);
514          float wVal = getW(output_channel, wInChannel, wWidth, wHeight);
515          value += xVal*wVal;
516        }
517      }
518    }
519    ${l}
520    ${r}
521    ${n.output} = vec4(value, .0, .0, .0);
522  }
523`;return{...o,output:{dims:h,type:e[0].type,textureType:0},shaderSource:s,hasMain:!0}},Zl=(t,e,o)=>{let a=im(e.length>2,o.cacheKey);return{...a,get:()=>am(t,e,a,o)}}}),sm,um,ef,tf=E(()=>{xe(),ae(),gr(),sm=t=>({name:"Im2Col (packed)",inputNames:["A"],inputTypes:[2],cacheHint:t}),um=(t,e,o,a,l,f)=>{let d=o.dims,p=a.dims,h=l.length,n=[p[1]*p[2]*p[3],l[2]*l[3]],c=p[2]*p[3],r=Bt(),s=q(t.session.backend.glContext.version),u="";for(let y=0;y<=1;y++)for(let S=0;S<=1;S++)u+=`
524            blockIndex = rc.x + ${S};
525            pos = rc.y + ${y};
526
527            if(blockIndex < ${n[1]} && pos < ${n[0]}) {
528              offsetY = int(blockIndex / (${l[h-1]})) * ${f.strides[0]} -
529                ${f.pads[0]};
530              d0 = offsetY + ${f.dilations[0]} * (imod(pos, ${c}) / ${p[2]});
531
532              if(d0 < ${d[2]} && d0 >= 0) {
533                offsetX = imod(blockIndex, ${l[h-1]}) * ${f.strides[1]} -
534                  ${f.pads[1]};
535                d1 = offsetX + ${f.dilations[1]} * imod(imod(pos, ${c}), ${p[2]});
536
537                if(d1 < ${d[3]} && d1 >= 0) {
538
539                  ch = int(float(pos)/ ${c}.);
540                    innerDims = vec2(d0, d1);
541                    result[${2*y+S}] = getChannel(
542                      getA(0, ch, int(innerDims.x),
543                      int(innerDims.y)), innerDims);
544                }
545              }
546            }
547
548          `;let g=`
549      ${r}
550
551      void main() {
552        ivec2 rc = getOutputCoords();
553          vec4 result = vec4(0.0);
554          int blockIndex, pos, offsetY, d0, offsetX, d1, ch;
555          vec2 innerDims;
556          ${u}
557          ${s.output} = result;
558      }
559            `;return{...e,output:{dims:n,type:o.type,textureType:2},shaderSource:g,hasMain:!0}},ef=(t,e,o,a,l)=>{let f=sm(l.cacheKey);return{...f,get:()=>um(t,f,e,o,a,l)}}});
559function fm(t,e,o){let a=e[0].dims,l=e[1].dims,f=Ke.calcShape(a,l,!0);if(!f)throw new Error("Can't use matmul on the given tensors");let d=Je(f.length),p=Ot(),{activationFunction:h,applyActivation:n}=Nt(o),c=e.length>2,r=c?"value += getBiasForMatmul();":"",s=c?`${Ei(d,p,e[2].dims,f,!1)}`:"",u=f.length,g=a.length,y=l.length,S=`
560    ${h}
561    ${s}
562    float process(int indices[${u}]) {
563        int a[${g}];
564        int b[${y}];
565        bcastMatmulIndices_A(indices, a);
566        bcastMatmulIndices_B(indices, b);
567
568        float value;
569        for (int k=0; k<${a[a.length-1]}; ++k) {
570            a[${g-1}] = k;
571            b[${y-2}] = k;
572            value += _A(a) * _B(b);
573        }
574        ${r}
575        ${n}
576        return value;
577    }`;return{...t,output:{dims:f,type:e[0].type,textureType:0},shaderSource:S}}function Pi(t,e){let o=lm(t.length>2,e.activationCacheKey);return{...o,get:()=>fm(o,t,e)}}function Ei(t,e,o,a,l){let f="",d=o.length,p=a.length,h=p-d;f=p<2&&d>0?"coords":o.map((r,s)=>`coords.${e[s+h]}`).join(", ");let n=Ke.getBroadcastDims(o,a).map(r=>`coords.${e[r+h]} = 0;`).join(`
578`),c="vec4(outputValue.xx, outputValue.yy)";return U.size(o)===1&&(c="vec4(outputValue.x)"),l?`
579vec4 getBiasForMatmul() {
580  ${t} coords = getOutputCoords();
581  ${n}
582  vec4 outputValue = getBias(${f});
583  return ${c};
584}`:`
585float getBiasForMatmul() {
586  ${t} coords = getOutputCoords();
587  ${n}
588  return getBias(coords.x);
589}`}var rf,nf,lm,cm,oo=E(()=>{fe(),ae(),kt(),yr(),Di(),rf=(t,e,o)=>(cm(e),t.session.pack?[t.run(io(t,e,o),e)]:[t.run(Pi(e,o),e)]),nf=t=>Mr(t.attributes),lm=(t,e)=>({name:"MatMul",inputNames:t?["A","B","Bias"]:["A","B"],inputTypes:t?[0,0,0]:[0,0],cacheHint:e}),cm=t=>{if(!t||t.length!==2)throw new Error("MatMul requires 2 inputs.");if(t[0].dims[t[0].dims.length-1]!==t[1].dims[t[1].dims.length-2])throw new Error("shared dimension does not match.");if(t[0].type!=="float32"&&t[0].type!=="float64"||t[1].type!=="float32"&&t[1].type!=="float64")throw new Error("inputs should be float type");if(t[0].type!==t[1].type)throw new Error("inputs types should match")}});function hm(t,e,o,a){let l=[],f=[],d=o[0].dims,p=o[1].dims,h=d.length,n=p.length,c=a.length,r=c-h,s=c-n;l=d.map((L,z)=>`coords.${e[z+r]}`),l[h-1]="i*2",l.join(", "),f=p.map((L,z)=>`coords.${e[z+s]}`),f[n-2]="i*2",f.join(", ");let u=Ke.getBroadcastDims(d,a),g=Ke.getBroadcastDims(p,a),y=u.map(L=>`coords.${e[L+r]} = 0;`).join(`
590`),S=g.map(L=>`coords.${e[L+s]} = 0;`).join(`
591`),A=`int lastDim = coords.${e[c-1]};
592  coords.${e[c-1]} = coords.${e[c-2]};
593  coords.${e[c-2]} = lastDim;`;return`
594vec4 getAAtOutCoordsMatmul(int i) {
595  ${t} coords = getOutputCoords();
596  ${A}
597  ${y}
598  vec4 outputValue = getA(${l});
599  return outputValue;
600}
601
602vec4 getBAtOutCoordsMatmul(int i) {
603  ${t} coords = getOutputCoords();
604  ${A}
605  ${S}
606  vec4 outputValue = getB(${f});
607  return outputValue;
608}`}function mm(t,e){let o="";for(let a=0;a<e-2;a++)o+=`rc.${t[a]}, `;return o+=`rc.${t[e-2]}, i*2`,o}function bm(t,e){let o="";for(let a=0;a<e-2;a++)o+=`rc.${t[a]}, `;return o+=`i*2, rc.${t[e-1]}`,o}var pm,dm,io,Di=E(()=>{fe(),xe(),ae(),kt(),yr(),oo(),pm=(t,e)=>({name:"MatMul (packed)",inputNames:t?["A","B","Bias"]:["A","B"],inputTypes:t?[2,2,2]:[2,2],cacheHint:e}),dm=(t,e,o,a)=>{let l=o.length>2,f=l?"value += getBiasForMatmul();":"",d=o[0].dims,p=o[1].dims,h=Ke.calcShape(d,p,!0),n=!U.areEqual(o[0].dims,o[1].dims);if(!h)throw new Error("Can't use matmul on the given tensors");let c=d[d.length-1],r=Math.ceil(c/2),s=d.length,u=p.length,g=q(t.session.backend.glContext.version),y=Je(h.length),S=h.length,A=Ot(),{activationFunction:L,applyActivation:z}=Nt(a),et=l?`${Ei(y,A,o[2].dims,h,!0)}`:"",Y=n?`${hm(y,A,o,h)}`:"",X=n?"getAAtOutCoordsMatmul(i)":`getA(${mm(A,s)})`,mt=n?"getBAtOutCoordsMatmul(i)":`getB(${bm(A,u)})`,J=`
609            ${Y}
610            ${et}
611            ${L}
612            void main() {
613              ${n?"":`${y} rc =
614          getOutputCoords(); int lastDim = rc.${A[S-1]}; rc.${A[S-1]} =
615          rc.${A[S-2]}; rc.${A[S-2]} = lastDim;
616      `}
617
618              vec4 value = vec4(0);
619              for (int i = 0; i < ${r}; i++) {
620                vec4 a = ${X};
621                vec4 b = ${mt};
622
623                value += (a.rrbb * b.rgrg);
624                value += (a.ggaa * b.baba);
625              }
626              ${f}
627              ${z}
628              ${g.output} = value;
629            }`;return{...e,output:{dims:h,type:o[0].type,textureType:2},shaderSource:J,hasMain:!0}},io=(t,e,o)=>{let a=pm(e.length>2,o.activationCacheKey);return{...a,get:()=>dm(t,a,e,o)}}}),of,af=E(()=>{no(),tf(),Di(),of=(t,e,o)=>{let a=e[0].dims,l=e[1].dims,f=Gr(a,l,o.dilations,o.pads,o.strides),d=t.run(ef(t,e[0],e[1],f,o),[e[0]]),p=t.reshapePacked(e[1],[l[0],l[1]*l[2]*l[3]]),h=e.length===3?[p,d,e[2]]:[p,d],n=t.run(io(t,h,o),h);return t.reshapePacked(n,f)}}),gm,ym,sf,Li,Fi=E(()=>{ae(),gm=t=>
vendor: 30,019 bytes, lines 629-952
629({name:"Im2Col",inputNames:["X"],inputTypes:[0],cacheHint:t}),ym=(t,e,o,a,l,f)=>{let d=o.dims,p=a.dims,h=l.length,n=Li(d,p,l,4),c=`
630        const int XC = ${d[1]};
631        const int XH = ${d[2]};
632        const int XW = ${d[3]};
633        const int KH = ${f.kernelShape[0]};
634        const int KW = ${f.kernelShape[1]};
635        const int dilationH = ${f.dilations[0]};
636        const int dilationW = ${f.dilations[1]};
637        const int strideH = ${f.strides[0]};
638        const int strideW = ${f.strides[1]};
639        const int padH = ${f.pads[0]};
640        const int padW = ${f.pads[1]};
641        const int KHKW = KH*KW;
642        const int XCKHKW = XC * KHKW;
643        const int outputChannels = 4;
644        vec4 process(int indices[${h}]) {
645          int b  = indices[0]; // batch size
646          int oh = indices[1] * strideH - padH; //output height
647          int ow = indices[2] * strideW - padW; //output width
648          int p = indices[3] * outputChannels; //patch
649          vec4 value = vec4(0.0);
650          for(int i=0; i < outputChannels; ++i) {
651            if(p < XCKHKW) {
652              int patchC = p / KHKW;
653              int patchH = (p - patchC*KHKW) / KW;
654              int patchW = (p - patchC*KHKW) - patchH * KW;
655              int xh2 = oh + patchH * dilationH;
656              int xw2 = ow + patchW * dilationW;
657              int x[${d.length}];
658              x[0] = b;
659              x[1] = patchC;
660              x[2] = xh2;
661              x[3] = xw2;
662              if(xh2 >= 0 &&
663                  xh2 < XH &&
664                  xw2 >= 0 &&
665                  xw2 < XW) {
666                value[i] = _X(x);
667              }
668            }
669            ++p;
670          }
671          return value;
672        }
673        `;return{...e,output:{dims:n,type:o.type,textureType:4},shaderSource:c}},sf=(t,e,o,a,l)=>{let f=gm(l.cacheKey);return{...f,get:()=>ym(t,f,e,o,a,l)}},Li=(t,e,o,a=4)=>[o[0],o[2],o[3],Math.ceil(t[1]*e[2]*e[3]/a)]}),Tm,xm,uf,lf=E(()=>{fe(),xe(),ae(),yr(),Fi(),Tm=(t,e)=>({name:"ConvDotProduct",inputNames:t?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:t?[0,4,0]:[0,4],cacheKey:e.activationCacheKey}),xm=(t,e,o,a,l)=>{let f=o[0].dims,d=o[1].dims,p=[d[0],Math.ceil(f[1]*d[2]*d[3]/4)],h=Li(f,d,a),[n,c]=t.calculateTextureWidthAndHeight(p,4),r=U.computeStrides(h),[s,u]=t.calculateTextureWidthAndHeight(h,4),g=a.length,y=o.length<3?"0.0":"_B(b)",S=Math.ceil(f[1]*d[2]*d[3]/4),{activationFunction:A,applyActivation:L}=Nt(l),z=q(t.session.backend.glContext.version),et=`
674${A}
675float process(int indices[${g}]) {
676  int b[1];
677  b[0] = indices[1];
678  int im2col[4];
679  im2col[0] = indices[0];
680  im2col[1] = indices[2];
681  im2col[2] = indices[3];
682  int im2colOffset = im2col[0] * ${r[0]} + im2col[1] * ${r[1]} + im2col[2] * ${r[2]};
683  int kernelOffset = indices[1] * ${p[1]};
684  float value = ${y};
685  for (int i = 0; i < ${S}; ++i) {
686    vec2 im2colCoords = offsetToCoords(im2colOffset, ${s}, ${u});
687    vec2 kernelCoords = offsetToCoords(kernelOffset, ${n}, ${c});
688    value += dot(${z.texture2D}(Im2Col, im2colCoords), ${z.texture2D}(K, kernelCoords));
689    ++im2colOffset;
690    ++kernelOffset;
691  }
692  ${L}
693  return value;
694}`;return{...e,output:{dims:a,type:o[0].type,textureType:0},shaderSource:et}},uf=(t,e,o,a)=>{let l=Tm(e.length>2,a);return{...l,get:()=>xm(t,l,e,o,a)}}}),Gr,Ci,wm,vm,_m,Om,$i,Im,no=E(()=>{Ge(),fe(),Ql(),af(),lf(),yr(),Fi(),oo(),Gr=(t,e,o,a,l)=>{let f=t[0],d=t.slice(2),p=d.length,h=e[0],n=e.slice(2).map((r,s)=>r+(r-1)*(o[s]-1)),c=d.map((r,s)=>r+a[s]+a[s+p]).map((r,s)=>Math.floor((r-n[s]+l[s])/l[s]));return[f,h].concat(...c)},Ci=(t,e,o)=>(Im(e,o),wm(t,e,o)),wm=(t,e,o)=>{let a=Om(o,e),l=t.session.pack,f=a.kernelShape[0]===1&&a.kernelShape[1]===1;return a.group>1?[t.run(Zl(t,e,a),e)]:f&&l?[vm(t,e,a)]:l&&e[0].dims.length===4&&e[0].dims[0]===1&&!f?[of(t,e,a)]:[_m(t,e,a)]},vm=(t,e,o)=>{let a=e[0].dims,l=e[1].dims,f=Gr(a,l,o.dilations,o.pads,o.strides),d=t.reshapeUnpacked(e[0],[a[1],a[2]*a[3]]),p=t.reshapeUnpacked(e[1],[l[0],l[1]]),h=e.length>2?[p,d,e[2]]:[p,d],n=t.run(Pi(h,o),h);return t.reshapeUnpacked(n,f)},_m=(t,e,o)=>{let a=e[0].dims,l=e[1].dims,f=Gr(a,l,o.dilations,o.pads,o.strides),d=t.run(sf(t,e[0],e[1],f,o),[e[0]]),p=e.length===3?[d,e[1],e[2]]:[d,e[1]];return t.run(uf(t,e,f,o),p)},Om=(t,e)=>{let o=t.kernelShape.slice();if(t.kernelShape.length===0)for(let f=2;f<e[1].dims.length;++f)o.push(e[1].dims[f]);let a=t.pads.slice();dr.adjustPadsBasedOnAutoPad(e[0].dims,t.strides,t.dilations,o,a,t.autoPad);let l=Object.assign({},t);return Object.assign(l,{kernelShape:o,pads:a,cacheKey:t.cacheKey}),l},$i=t=>{let e=t.attributes,o=Mr(e),a=e.getString("auto_pad","NOTSET"),l=e.getInts("dilations",[1,1]),f=e.getInt("group",1),d=e.getInts("kernel_shape",[]),p=e.getInts("pads",[0,0,0,0]),h=e.getInts("strides",[1,1]);return ee({autoPad:a,dilations:l,group:f,kernelShape:d,pads:p,strides:h,...o})},Im=(t,e)=>{if(!t||t.length!==2&&t.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(t[0].dims.length!==4||t[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[1]*e.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(t.length===3&&(t[2].dims.length!==1||t[1].dims[0]!==t[2].dims[0]))throw new Error("invalid bias");let o=t[0].dims.length-2;if(e.dilations.length!==o)throw new Error(`dilations should be ${o}D`);if(e.strides.length!==o)throw new Error(`strides should be ${o}D`);if(e.pads.length!==2*o)throw new Error(`pads should be ${2*o}D`);if(e.kernelShape.length!==0&&e.kernelShape.length!==t[1].dims.length-2)throw new Error("invalid kernel shape");if(t[0].type!=="float32"||t[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(t.length===3&&t[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}}),Sm,Am,Pm,ff,Em,Dm,Lm,Fm,Cm,$m,cf,km,pf=E(()=>{Ge(),xe(),ae(),yr(),Sm=(t,e,o,a,l,f)=>(t-1)*e+o+(a-1)*l+1-f,Am=(t,e,o,a,l)=>{let f=Math.floor(t/2);e==="SAME_UPPER"?(o[a]=f,o[l]=t-f):e==="SAME_LOWER"&&(o[a]=t-f,o[l]=f)},Pm=(t,e,o,a,l,f,d,p)=>{let h=t.length-2,n=p.length===0;for(let c=0;c<h;++c){let r=n?t[c+2]*f[c]:p[c],s=Sm(t[c+2],f[c],l[c],e[c],o[c],r);Am(s,a,l,c,c+h),n&&p.push(f[c]*(t[c+2]-1)+d[c]+(e[c]-1)*o[c]+1-l[c]-l[c+h])}},ff=(t,e,o)=>(km(e,o),Em(t,e,o)),Em=(t,e,o)=>{let a=$m(o,e);return[Cm(t,e,a)]},Dm=(t,e)=>({name:"ConvTranspose",inputNames:t?["X","W","B"]:["X","W"],inputTypes:t?[0,0,0]:[0,0],cacheHint:e}),Lm=(t,e,o,a)=>{let l=e.length>2?"getB(output_channel)":"0.0",f=e[0].dims,d=e[1].dims,p=d[1],h=d[0]/a.group,n=[e[0].dims[0],e[1].dims[1]*a.group,...a.outputShape],c=q(t.session.backend.glContext.version),{activationFunction:r,applyActivation:s}=Nt(a),u=`
695  const ivec2 strides = ivec2(${a.strides[0]}, ${a.strides[1]});
696  const ivec2 pads = ivec2(${a.pads[0]}, ${a.pads[1]});
697  ${r}
698  void main() {
699    ivec4 coords = getOutputCoords();
700    int batch = coords.x;
701    int output_channel = coords.y;
702
703    ivec2 loc = coords.zw + pads;
704
705    int group_id = output_channel / ${p};
706    int wOutChannel = output_channel - group_id * ${p};
707
708    float value = ${l};
709    for (int inChannelOffset = 0; inChannelOffset < ${h}; inChannelOffset++) {
710      int input_channel = group_id * ${h} + inChannelOffset;
711      for (int wWOff = 0; wWOff < ${d[2]}; wWOff++) {
712        for (int wHOff = 0; wHOff < ${d[3]}; wHOff++) {
713          ivec2 wOff = ivec2(wWOff * ${a.dilations[0]}, wHOff * ${a.dilations[1]});
714          ivec2 wLoc = loc - wOff;
715          ivec2 wLocIn = wLoc / strides;
716          if (
717            wLocIn * strides == wLoc &&
718            wLocIn.x >= 0 && wLocIn.x < ${f[2]} &&
719            wLocIn.y >= 0 && wLocIn.y < ${f[3]}
720          ) {
721            float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x);
722            float wVal = getW(input_channel, wOutChannel, wHOff, wWOff);
723            value += xVal * wVal;
724          }
725        }
726      }
727    }
728    ${s}
729    ${c.output} = vec4(value, .0, .0, .0);
730  }
731`;return{...o,output:{dims:n,type:e[0].type,textureType:0},shaderSource:u,hasMain:!0}},Fm=(t,e,o)=>{let a=Dm(e.length>2,o.cacheKey);return{...a,get:()=>Lm(t,e,a,o)}},Cm=(t,e,o)=>t.run(Fm(t,e,o),e),$m=(t,e)=>{let o=t.kernelShape.slice();if(t.kernelShape.length===0)for(let p=2;p<e[1].dims.length;++p)o.push(e[1].dims[p]);let a=t.pads.slice(),l=t.outputShape.slice(),f=e[0].dims;Pm(f,o,t.dilations,t.autoPad,a,t.strides,t.outputPadding,l);let d=Object.assign({},t);return Object.assign(d,{kernelShape:o,pads:a,outputShape:l,cacheKey:t.cacheKey}),d},cf=t=>{let e=t.attributes,o=Mr(e),a=e.getString("auto_pad","NOTSET"),l=e.getInts("dilations",[1,1]),f=e.getInt("group",1),d=e.getInts("kernel_shape",[]),p=e.getInts("output_padding",[0,0]),h=e.getInts("output_shape",[]),n=e.getInts("pads",[0,0,0,0]),c=e.getInts("strides",[1,1]);return ee({autoPad:a,dilations:l,group:f,kernelShape:d,outputPadding:p,outputShape:h,pads:n,strides:c,...o})},km=(t,e)=>{if(!t||t.length!==2&&t.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(t[0].dims.length!==4||t[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let o=t[1].dims[1]*e.group;if(t.length===3&&(t[2].dims.length!==1||t[2].dims[0]!==o))throw new Error("invalid bias");let a=t[0].dims.length-2;if(e.dilations.length!==a)throw new Error(`dilations should be ${a}D`);if(e.strides.length!==a)throw new Error(`strides should be ${a}D`);if(e.pads.length!==2*a)throw new Error(`pads should be ${2*a}D`);if(e.outputPadding.length!==a)throw new Error(`output_padding should be ${a}D`);if(e.kernelShape.length!==0&&e.kernelShape.length!==t[1].dims.length-2)throw new Error("invalid kernel shape");if(e.outputShape.length!==0&&e.outputShape.length!==t[0].dims.length-2)throw new Error("invalid output shape");if(t[0].type!=="float32"||t[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(t.length===3&&t[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}}),df,Tr,hf,Bm,mf,Nm,Rm,Mm,ao=E(()=>{Ge(),fe(),ae(),df={name:"Transpose",inputNames:["A"],inputTypes:[0]},Tr=(t,e,o)=>(Mm(e),[t.run({...df,cacheHint:o.cacheKey,get:()=>Bm(t,e[0],o.perm)},e)]),hf=t=>ee({perm:t.attributes.getInts("perm",[])}),Bm=(t,e,o)=>{let a=e.dims;o=mf(a,o);let l=Nm(a,o),f=a.length,d=`
732      ${Rm("perm",o,f)}
733      float process(int indices[${f}]) {
734        int a[${f}];
735        perm(a, indices);
736        return _A(a);
737      }`;return{...df,output:{dims:l,type:e.type,textureType:0},shaderSource:d}},mf=(t,e)=>(e&&e.length!==t.length&&(e=[...t.keys()].reverse()),e),Nm=(t,e)=>(e=mf(t,e),U.sortBasedOnPerm(t,e)),Rm=(t,e,o)=>{let a=[];a.push(`void ${t}(out int a[${o}], int src[${o}]) {`);for(let l=0;l<o;++l)a.push(`	a[${e[l]}]=src[${l}];`);return a.push("	}"),a.join(`
738`)},Mm=t=>{if(!t||t.length!==1)throw new Error("Transpose requires 1 input.");if(t[0].type!=="float32"&&t[0].type!=="float64")throw new Error("input should be float tensor")}}),bf,gf,Gm,yf=E(()=>{ao(),bf=(t,e,o)=>{Gm(e);let a=o.blocksize,l=a*a,f=o.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],d=o.mode==="DCR"?[e[0].dims[0],a,a,e[0].dims[1]/l,e[0].dims[2],e[0].dims[3]]:[e[0].dims[0],e[0].dims[1]/l,a,a,e[0].dims[2],e[0].dims[3]],p=t.reshapeUnpacked(e[0],d),h={perm:f,cacheKey:`${f}`},[n]=Tr(t,[p],h),c=[e[0].dims[0],e[0].dims[1]/l,e[0].dims[2]*a,e[0].dims[3]*a];return[t.reshapeUnpacked(n,c)]},gf=t=>{let e=t.attributes.getInt("blocksize");if(e<1)throw new Error(`blocksize must be >= 1, but got : ${e} for DepthToSpace`);let o=t.attributes.getString("mode","DCR");if(o!=="DCR"&&o!=="CRD")throw new Error(`unrecognized mode: ${o} for DepthToSpace`);return{mode:o,blocksize:e}},Gm=t=>{if(t.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${t.length}`);if(t[0].type==="string"||t[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}}),Tf,xf,Um,wf=E(()=>{fe(),Tf=(t,e,o)=>{Um(e,o);let a=U.flattenShape(e[0].dims,o);return[t.reshapeUnpacked(e[0],a)]},xf=t=>t.attributes.getInt("axis",1),Um=(t,e)=>{if(!t||t.length!==1)throw new Error("Flatten requires 1 input.");let o=t[0].dims.length;if(o===0)throw new Error("scalar tensor is not supported.");if(e<-o||e>o)throw new Error("Invalid axis");if(t[0].type==="string")throw new Error("string tensor is not supported.")}}),Jt,hn=E(()=>{Jt=["float32","float64","int32","int16","int8","uint16","uint32","uint8"]}),vf,_f,zm,Vm,Wm,Hm,Of=E(()=>{Ge(),hn(),fe(),ae(),vf=(t,e,o)=>(Hm(e,o.axis),[t.run(Wm(t,e,o),e)]),_f=t=>ee({axis:t.attributes.getInt("axis",0)}),zm={name:"Gather",inputNames:["A","B"],inputTypes:[0,0]},Vm=(t,e,o,a)=>{let l=o[0].dims.slice(),f=o[1].dims.slice(),d=new Array(l.length+f.length-1);a=U.normalizeAxis(a,l.length);let p=[];for(let n=0;n<d.length;n++)n<a?(d[n]=l[n],p.push(`inputIdx[${n}] = outputIdx[${n}];`)):n<a+f.length?(d[n]=f[n-a],p.push(`indexDataIdx[${n-a}] = outputIdx[${n}];`)):(d[n]=l[n-f.length+1],p.push(`inputIdx[${n-f.length+1}] = outputIdx[${n}];`));let h=`
739      float process(int outputIdx[${d.length||1}]) {
740        int inputIdx[${l.length}];
741        int indexDataIdx[${f.length||1}];
742        indexDataIdx[0] = 0;
743        ${p.join(`
744        `)}
745        int idx = int(_B(indexDataIdx));
746        inputIdx[${a}] = idx < 0 ? idx + ${l[a]} : idx;
747        return _A(inputIdx);
748      }`;return{...e,output:{dims:d,type:o[0].type,textureType:0},shaderSource:h}},Wm=(t,e,o)=>{let a={...zm,cacheHint:o.cacheKey};return{...a,get:()=>Vm(t,a,e,o.axis)}},Hm=(t,e)=>{if(!t||t.length!==2)throw new Error("Gather requires 2 inputs.");let o=t[0].dims.length;if(o<1)throw new Error("Invalid input shape.");if(e<-o||e>o-1)throw new Error("Invalid axis.");if(Jt.indexOf(t[0].type)===-1)throw new Error("Invaid input type.");if(t[1].type!=="int32"&&t[1].type!=="int16")throw new Error("Invaid input type.")}}),ki,If,Sf,Af,qm,jm,Ym,Pf=E(()=>{Ge(),fe(),ae(),ki=(t,e,o)=>(Ym(e,o),[t.run(qm(e,o),e)]),If=(t,e)=>{let o=t.attributes.getInt("transA",0)!==0,a=t.attributes.getInt("transB",0)!==0,l=t.attributes.getFloat("alpha",1),f=t.attributes.getFloat("beta",1);return ee({transA:o,transB:a,alpha:l,beta:f,isOptionalC:e})},Sf=t=>If(t,!1),Af=t=>If(t,!0),qm=(t,e)=>{let o={name:"Gemm",inputNames:t.length===3?["A","B","C"]:["A","B"],inputTypes:t.length===3?[0,0,0]:[0,0],key:e.cacheKey};return{...o,get:()=>jm(o,t,e)}},jm=(t,e,o)=>{let a=e[0].dims.slice(),l=e[1].dims.slice(),[f,d]=Xn.getShapeOfGemmResult(a,o.transA,l,o.transB,e.length===3?e[2].dims:void 0),p=[f,d];if(!p)throw new Error("Can't use gemm on the given tensors");let h=a[a.length-1],n="";o.transA&&(h=a[0]),o.transA&&o.transB?n="value += _A_T(a) * _B_T(b);":o.transA&&!o.transB?n="value += _A_T(a) * _B(b);":!o.transA&&o.transB?n="value += _A(a) * _B_T(b);":!o.transA&&!o.transB&&(n="value += _A(a) * _B(b);");let c=p.length,r=`
749      float process(int indices[${c}]) {
750          int a[${c}];
751          int b[${c}];
752          ${e.length===3?`int c[${e[2].dims.length}];`:""}
753
754          copyVec(indices, a);
755          copyVec(indices, b);
756          ${e.length===3?"bcastIndices_C(indices, c);":""}
757
758          float value = 0.0;
759          for (int k=0; k<${h}; ++k) {
760              a[${c-1}] = k;
761              b[${c-2}] = k;
762              ${n}
763          }
764
765          value = value * alpha;
766          ${e.length===3?"value += beta * _C(c);":""}
767          return value;
768      }`;return{...t,output:{dims:p,type:e[0].type,textureType:0},variables:[{name:"alpha",type:"float",data:o.alpha},{name:"beta",type:"float",data:o.beta}],shaderSource:r}},Ym=(t,e)=>{if(!t)throw new Error("Input is missing");if(e.isOptionalC&&(t.length<2||t.length>3))throw new Error("Invaid input shape.");if(!e.isOptionalC&&t.length!==3)throw new Error("Gemm requires 3 inputs");if(t.length===3&&t[2].dims.length!==1&&t[2].dims.length!==2)throw new Error("Invalid input shape of C");if(t[0].type!=="float32"&&t[0].type!=="float64"||t[1].type!=="float32"&&t[1].type!=="float64"||t.length===3&&t[2].type!=="float32"&&t[2].type!=="float64")throw new Error("Invalid input type.");if(t[0].type!==t[1].type||t.length===3&&t[0].type!==t[2].type)throw new Error("Input types are mismatched")}}),Ef,Df,Xm,Km,Jm,Zm,Qm,Lf=E(()=>{Ge(),ae(),Ef=(t,e,o)=>(Qm(e),[t.run(Jm(t,e,o),e)]),Df=t=>{let e=t.attributes.getFloat("scale"),o=t.attributes.getFloats("bias");return ee({scale:e,bias:o})},Xm={name:"ImageScaler",inputNames:["X"],inputTypes:[0]},Km=(t,e,o,a)=>{let l=o[0].dims.slice(),f=l.length,d=`
769      ${Zm(a.bias.length)}
770      float process(int indices[${f}]) {
771        return _X(indices) * scale + getBias(bias, indices[1]);
772      }`;return{...e,output:{dims:l,type:o[0].type,textureType:0},variables:[{name:"bias",type:"float",arrayLength:a.bias.length,data:a.bias},{name:"scale",type:"float",data:a.scale}],shaderSource:d}},Jm=(t,e,o)=>{let a={...Xm,cacheHint:o.cacheKey};return{...a,get:()=>Km(t,a,e,o)}},Zm=t=>{let e=[`float getBias(float bias[${t}], int channel) {`];for(let o=0;o<t;++o)o===0?e.push(`	if (channel == ${o}) { return bias[${o}]; }`):o===t-1?e.push(`	else { return bias[${o}]; }`):e.push(`	else if (channel == ${o}) { return bias[${o}]; }`);return e.push("	}"),e.join(`
773`)},Qm=t=>{if(!t||t.length!==1)throw new Error("ImageScaler requires 1 input.");if(t[0].dims.length!==4)throw new Error("Invalid input shape.");if(t[0].type!=="float32"&&t[0].type!=="float64")throw new Error("Invalid input type.")}}),Cf,$f,Ff,eb,tb,rb,nb,ob,ib,kf=E(()=>{xe(),ae(),Cf=(t,e,o)=>{ib(e);let a=t.run(tb(e[0]),e);return[t.run(ob(t,e[0],o,a.dims),[e[0],a,e[1],e[2]])]},$f=t=>t.attributes.getFloat("epsilon",1e-5),Ff={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[0]},eb=(t,e)=>{let o=e.dims.slice(),a=o[1],l=o[2]*o[3],f=[o[0],a],d=`
774      vec4 process(int[2] indices) {
775        vec4 v = vec4(0.0);
776        int a[4];
777        a[0] = indices[0];
778        a[1] = indices[1];
779        float temp = 0.0;
780        for(int a2=0; a2<${o[2]}; a2++) {
781          a[2] = a2;
782          for(int a3=0; a3<${o[3]}; a3++) {
783            a[3] = a3;
784            float x = _X(a);
785            temp += x;
786          }
787        }
788        float mean = temp / float(${l});
789        temp = 0.0;
790        for(int a2=0; a2<${o[2]}; a2++) {
791          a[2] = a2;
792          for(int a3=0; a3<${o[3]}; a3++) {
793            a[3] = a3;
794            float x = _X(a);
795            temp += (x - mean) * (x - mean);
796          }
797        }
798        v.r = mean;
799        v.g = temp / float(${l});
800
801        return v;
802      }`;return{...t,output:{dims:f,type:e.type,textureType:4},shaderSource:d}},tb=t=>({...Ff,get:()=>eb(Ff,t)}),rb={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[0,4,0,0]},nb=(t,e,o,a,l)=>{let f=q(t.session.backend.glContext.version),[d,p]=t.calculateTextureWidthAndHeight(l,4),[h,n]=[d/4,p],c=`
803      vec4 get_MeanAndVariance(int[2] mv) {
804        int offset = indicesToOffset_MeanAndVariance(mv);
805        vec2 coords = offsetToCoords(offset, ${h}, ${n});
806        return ${f.texture2D}(MeanAndVariance, coords);
807      }
808
809      float process(int[4] indices) {
810        int mv[2];
811        mv[0] = indices[0];
812        mv[1] = indices[1];
813        vec4 mean_and_variance = get_MeanAndVariance(mv);
814        float mean = mean_and_variance.r;
815        float variance = mean_and_variance.g;
816
817        int sb[1];
818        sb[0] = indices[1];
819        float scale = _Scale(sb);
820        float b = _B(sb);
821
822        return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b;
823      }`;return{...e,output:{dims:o.dims,type:o.type,textureType:0},variables:[{name:"epsilon",type:"float",data:a}],shaderSource:c}},ob=(t,e,o,a)=>{let l={...rb,cacheHint:`${o}`};return{...l,get:()=>nb(t,l,e,o,a)}},ib=t=>{if(!t||t.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");let e=t[0],o=t[1],a=t[2];if(e.dims.length<3||o.dims.length!==1||a.dims.length!==1)throw new Error("Invalid input shape.");if(o.dims[0]!==e.dims[1]||a.dims[0]!==e.dims[1])throw new Error("Input shapes are mismatched.");if(e.type!=="float32"&&e.type!=="float64"||o.type!=="float32"&&o.type!=="float64"||a.type!=="float32"&&a.type!=="float64")throw new Error("Invalid input type.");if(t[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}});function ab(t,e){let o=t[0].dims[1],a=t[0].dims.length,l=-Math.floor((e.size-1)/2),f=Math.ceil((e.size-1)/2),d=`float(${e.alpha}) / float(${e.size})`,p=`
824    float process(int indices[${a}]) {
825        int c = indices[1];
826        float x = _X(indices);
827        float square_sum = 0.0;
828
829        for (int i = ${l}; i <= ${f}; i++) {
830          int idx = c + i;
831          if (c >= 0 && c < ${o}) {
832            indices[1] = idx;
833            float j = _X(indices);
834            square_sum += j * j;
835          }
836        }
837        return x / pow(${`float(${e.bias})`} + ${d} * square_sum, ${`float(${e.beta})`});
838    }`;return{...Rf,cacheHint:e.cacheKey,output:{dims:t[0].dims,type:t[0].type,textureType:0},shaderSource:p}}function sb(t,e){return{...Rf,cacheHint:e.cacheKey,get:()=>ab(t,e)}}var Bf,Nf,Rf,ub,Mf=E(()=>{Ge(),ae(),Bf=(t,e,o)=>(ub(e),[t.run(sb(e,o),e)]),Nf=t=>{let e=t.attributes.getFloat("alpha",1e-4),o=t.attributes.getFloat("beta",.75),a=t.attributes.getFloat("bias",1),l=t.attributes.getInt("size");return ee({alpha:e,beta:o,bias:a,size:l})},Rf={name:"LRN",inputNames:["X"],inputTypes:[0]},ub=t=>{if(!t||t.length!==1)throw new Error("LRN requires 1 input.");if(t[0].dims.length!==4)throw new Error('currently only support LRN for input with "NCHW" format');if(t[0].type!=="float32")throw new Error("input should be float type")}}),lb,Bi,Gf,Uf,zf,fb,cb,pb,db,hb,mb,bb,gb,Vf=E(()=>{Ge(),fe(),xe(),ae(),lb={name:"Pad",inputNames:["A"],inputTypes:[0]},Bi=(t,e,o)=>(pb(e),[t.run({...lb,cacheHint:o.cacheKey,get:()=>cb(t,e[0],o)},e)]),Gf=t=>{let e=t.attributes.getString("mode","constant"),o=t.attributes.getFloat("value",0),a=t.attributes.getInts("pads");return ee({mode:e,value:o,pads:a})},Uf=(t,e,o)=>{db(e);let a=fb(t,e,o);return Bi(t,[e[0]],a)},zf=t=>t.attributes.getString("mode","constant"),fb=(t,e,o)=>{if(!t.session.isInitializer(e[1].dataId)||e.length>=3&&!t.session.isInitializer(e[2].dataId))throw new Error("dynamic pad attributes are not allowed");let a=Array.from(e[1].integerData),l=e.length>=3?e[2].floatData[0]:0;return ee({mode:o,pads:a,value:l})},cb=(t,e,o)=>{let a=U.padShape(e.dims.slice(),o.pads),l=a.length,f=`
839      ${hb(t,e,o)}
840      float process(int[${l}] indices) {
841          return padA(indices);
842      }`;return{name:"Pad",inputNames:["A"],inputTypes:[0],output:{dims:a,type:e.type,textureType:0},shaderSource:f}},pb=t=>{if(!t||t.length!==1)throw new Error("Pad requires 1 input");if(t[0].type!=="float32"&&t[0].type!=="float64")throw new Error("Invalid input type.")},db=t=>{if(!t||t.length!==2&&t.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(t[1].type!=="int32")throw new Error("Invalid input type.");if(t.length>=3&&t[2].type==="string")throw new Error("Invalid input type.")},hb=(t,e,o)=>{let a=q(t.session.backend.glContext.version),[l,f]=t.calculateTextureWidthAndHeight(e.dims,0),d=U.computeStrides(e.dims);switch(o.mode){case"constant":return mb(a,e.dims,d,l,f,o.pads,o.value);case"reflect":return bb(a,e.dims,d,l,f,o.pads);case"edge":return gb(a,e.dims,d,l,f,o.pads);default:throw new Error("Invalid mode")}},mb=(t,e,o,a,l,f,d)=>{let p=e.length,h="";for(let n=p-1;n>=0;--n)h+=`
843        k = m[${n}] - ${f[n]};
844        if (k < 0)  return constant;
845        if (k >= ${e[n]}) return constant;
846        offset += k * ${o[n]};
847        `;return`
848      float padA(int m[${p}]) {
849        const float constant = float(${d});
850        int offset = 0;
851        int k = 0;
852        ${h}
853        vec2 coords = offsetToCoords(offset, ${a}, ${l});
854        float value = getColorAsFloat(${t.texture2D}(A, coords));
855        return value;
856      }
857      `},bb=(t,e,o,a,l,f)=>{let d=e.length,p="";for(let h=d-1;h>=0;--h)p+=`
858        k = m[${h}] - ${f[h]};
859        if (k < 0) { k = -k; }
860        {
861          const int _2n_1 = ${2*(e[h]-1)};
862          k = int( mod( float(k), float(_2n_1) ) ) ;
863          if(k >= ${e[h]}) { k = _2n_1 - k; }
864        }
865        offset += k * ${o[h]};
866        `;return`
867      float padA(int m[${d}]) {
868        int offset = 0;
869        int k = 0;
870        ${p}
871        vec2 coords = offsetToCoords(offset, ${a}, ${l});
872        float value = getColorAsFloat(${t.texture2D}(A, coords));
873        return value;
874      }
875      `},gb=(t,e,o,a,l,f)=>{let d=e.length,p="";for(let h=d-1;h>=0;--h)p+=`
876        k = m[${h}] - ${f[h]};
877        if (k < 0)  k = 0;
878        if (k >= ${e[h]}) k = ${e[h]-1};
879        offset += k * ${o[h]};
880      `;return`
881      float padA(int m[${d}]) {
882        int offset = 0;
883        int k = 0;
884        ${p}
885        vec2 coords = offsetToCoords(offset, ${a}, ${l});
886        float value = getColorAsFloat(${t.texture2D}(A, coords));
887        return value;
888      }
889      `}}),Hf,qf,jf,Yf,Xf,Kf,Jf,Zf,Qf,yb,Wf,ec,uo,tc,so,Tb,rc=E(()=>{Ge(),fe(),ae(),Hf=(t,e,o)=>{uo(e);let a={name:"AveragePool",inputNames:["X"],inputTypes:[0],cacheHint:o.cacheKey};return[t.run({...a,get:()=>jf(e,a,!1,o)},e)]},qf=t=>{let e=t.attributes.getString("auto_pad","NOTSET"),o=t.attributes.getInt("ceil_mode",0),a=t.attributes.getInt("count_include_pad",0)!==0,l=t.attributes.getInts("kernel_shape"),f=t.attributes.getInts("strides",[]),d=t.attributes.getInts("pads",[]);if(o!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return ee({autoPad:e,ceilMode:o,countIncludePad:a,kernelShape:l,strides:f,pads:d})},jf=(t,e,o,a)=>{let[l,f]=Qf(t,a,o),d=U.size(l.kernelShape),p="";l.countIncludePad?p+=`value /= float(${d});`:p+=`value /= float(${d} - pad);`;let h=`
890        ${tc(t[0].dims,l,"value += _X(x);",p,"0.0")}
891      `;return{...e,output:{dims:f,type:t[0].type,textureType:0},shaderSource:h}},Yf=(t,e,o)=>{uo(e);let a={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[0],cacheHint:`${o.countIncludePad}`};return[t.run({...a,get:()=>jf(e,a,!0,o)},e)]},Xf=t=>{let e=t.attributes.getInt("count_include_pad",0)!==0;return ee({autoPad:"",ceilMode:0,countIncludePad:e,kernelShape:[],strides:[],pads:[]})},Kf=(t,e,o)=>{uo(e);let a={name:"MaxPool",inputNames:["X"],inputTypes:[0],cacheHint:o.cacheKey};return[t.run({...a,get:()=>Zf(e,a,!1,o)},e)]},Jf=t=>{let e=t.attributes.getString("auto_pad","NOTSET"),o=t.attributes.getInt("ceil_mode",0),a=t.attributes.getInts("kernel_shape"),l=t.attributes.getInts("strides",[]),f=t.attributes.getInts("pads",[]),d=t.attributes.getInt("storage_order",0),p=t.attributes.getInts("dilations",[]);if(d!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(o!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return ee({autoPad:e,ceilMode:o,countIncludePad:!1,kernelShape:a,strides:l,pads:f,storageOrder:d,dilations:p})},Zf=(t,e,o,a)=>{let[l,f]=Qf(t,a,o),d=`
892      ${tc(t[0].dims,l,`
893      value = max(_X(x), value);
894    `,"","-1e5")}
895    `;return{...e,output:{dims:f,type:t[0].type,textureType:0},shaderSource:d}},Qf=(t,e,o)=>{let a=t[0].dims.slice(),l=Object.hasOwnProperty.call(e,"dilations"),f=e.kernelShape.slice(),d=e.strides.slice(),p=l?e.dilations.slice():[],h=e.pads.slice();dr.adjustPoolAttributes(o,a,f,d,p,h);let n=dr.computePoolOutputShape(o,a,d,p,f,h,e.autoPad),c=Object.assign({},e);return l?Object.assign(c,{kernelShape:f,strides:d,pads:h,dilations:p,cacheKey:e.cacheKey}):Object.assign(c,{kernelShape:f,strides:d,pads:h,cacheKey:e.cacheKey}),[c,n]},yb={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},Wf={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[0]},ec=(t,e)=>(uo(e),[t.run({...Wf,get:()=>Zf(e,Wf,!0,yb)},e)]),uo=t=>{if(!t||t.length!==1)throw new Error("Pool ops requires 1 input.");if(t[0].type!=="float32"&&t[0].type!=="float64")throw new Error("Invalid input type.")},tc=(t,e,o,a,l)=>{let f=t.length;if(e.kernelShape.length<=2){let d=e.kernelShape[e.kernelShape.length-1],p=e.strides[e.strides.length-1],h=e.pads[e.pads.length/2-1],n=e.pads[e.pads.length-1],c=t[f-1],r="",s="",u="";if(r=h+n!==0?`
896          for (int i = 0; i < ${d}; i++) {
897            x[${f} - 1] = indices[${f} - 1] * ${p} - ${h} + i;
898            if (x[${f} - 1] < 0 || x[${f} - 1] >= ${c}) {
899              pad++;
900              continue;
901            }
902            ${o}
903          }`:`
904          for (int i = 0; i < ${d}; i++) {
905            x[${f} - 1] = indices[${f} - 1] * ${p} - ${h} + i;
906            ${o}
907          }`,e.kernelShape.length===2){let g=e.kernelShape[e.kernelShape.length-2],y=e.strides[e.strides.length-2],S=e.pads[e.pads.length/2-2],A=e.pads[e.pads.length-2],L=t[f-2];s=S+A!==0?`
908            for (int j = 0; j < ${g}; j++) {
909              x[${f} - 2] = indices[${f} - 2] * ${y} - ${S} + j;
910              if (x[${f} - 2] < 0 || x[${f} - 2] >= ${L}) {
911                pad+= ${d};
912                continue;
913              }
914          `:`
915            for (int j = 0; j < ${g}; j++) {
916              x[${f} - 2] = indices[${f} - 2] * ${y} - ${S} + j;
917            `,u=`
918          }
919        `}return`
920        float process(int indices[${f}]) {
921          int x[${f}];
922          copyVec(indices, x);
923
924          float value = ${l};
925          int pad = 0;
926          ${s}
927          ${r}
928          ${u}
929          ${a}
930          return value;
931        }
932      `}{let d=U.size(e.kernelShape),p=U.computeStrides(e.kernelShape),h=p.length,n=e.pads.length,c=Tb(h),r=so(t,"inputDims"),s=so(e.pads,"pads"),u=so(p,"kernelStrides"),g=so(e.strides,"strides"),y="";return y=e.pads.reduce((S,A)=>S+A)?`
933            if (x[j] >= inputDims[j] || x[j] < 0) {
934              pad++;
935              isPad = true;
936              break;
937            }
938          }
939          if (!isPad) {
940            ${o}
941          }`:`
942          }
943          ${o}
944        `,`
945        ${c}
946        float process(int indices[${f}]) {
947          int x[${f}];
948          copyVec(indices, x);
949          int offset[${h}];
950          int pads[${n}];
951          int inputDims[${f}];
952          int kernelStrides[${h}];
953          int strides[${h}];
954          ${s}
955          ${r}
956          ${g}
957          ${u}
958
959          float value = ${l};
960          int pad = 0;
961          bool isPad = false;
962          for (int i = 0; i < ${d}; i++) {
963            offsetToIndices(i, kernelStrides, offset);
964            isPad = false;
965            for (int j = ${f} - ${h}; j < ${f}; j++) {
966              x[j] = indices[j] * strides[j - ${f} + ${h}]
967                + offset[j - ${f} + ${h}] - pads[j - 2];
968              ${y}
969          }
970          ${a}
971
972          return value;
973        }
974      `}},so=(t,e)=>{let o="";for(let a=0;a<t.length;a++)o+=`
975      ${e}[${a}] = ${t[a]};
976    `;return o},Tb=t=>`
977  void offsetToIndices(int offset, int[${t}] strides, out int[${t}] indices) {
978    if (${t} == 0) {
979      return;
980    }
981    for (int i = 0; i < ${t} - 1; ++i) {
982      indices[i] = offset / strides[i];
983      offset -= indices[i] * strides[i];
984    }
985    indices[${t} - 1] = offset;
986  }`}),xr,Zt,xb,wb,nc,oc,ic,ac,sc,uc,lc,fc=E(()=>{Ge(),hn(),fe(),ae(),xr=(t,e,o,a,l)=>{wb(e);let f={name:a,inputNames:["A"],inputTypes:[0]};return[t.run({...f,cacheHint:o.cacheKey,get:()=>xb(t,e,o,a,l,f)},e)]},Zt=t=>{let e=t.attributes.getInts("axes",[]),o=t.attributes.getInt("keepdims",1)===1;return ee({axes:e,keepDims:o})},xb=(t,e,o,a,l,f)=>{let d=[],p=e[0].dims.length||1,h=[],n=U.normalizeAxes(o.axes,e[0].dims.length),c=l(e,n),r=c[1];for(let u=0;u<e[0].dims.length;u++)n.indexOf(u)>=0||n.length===0?(o.keepDims&&d.push(1),r=`
987          for(int j${u} = 0; j${u} < ${e[0].dims[u]}; j${u}++) {
988            inputIdx[${u}] = j${u};
989            ${r}
990          }`):(h.push(`inputIdx[${u}] = outputIdx[${d.length}];`),d.push(e[0].dims[u]));let s=`
991      float process(int outputIdx[${d.length||1}]) {
992        float value;                 // final result
993        int inputIdx[${p}];      // addressing input data
994        ${h.join(`
995`)}
996        ${c[0]}       // init ops for reduce max/min
997        ${r}
998        ${c[2]}       // final computation for reduce mean
999        return value;
1000      }`;return{...f,output:{dims:d,type:e[0].type,textureType:0},shaderSource:s}},wb=t=>{if(!t||t.length!==1)throw new Error("Reduce op requires 1 input.");if(Jt.indexOf(t[0].type)===-1)throw new Error("Invalid input type.")},nc=(t,e,o)=>xr(t,e,o,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),oc=(t,e,o)=>xr(t,e,o,"ReduceMean",(a,l)=>{let f=1;for(let d=0;d<a[0].dims.length;d++)(l.indexOf(d)>=0||l.length===0)&&(f*=a[0].dims[d]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${f}.;`]}),ic=(t,e,o)=>xr(t,e,o,"ReduceMax",(a,l)=>{let f=[];for(let d=0;d<a[0].dims.length;d++)(l.indexOf(d)>=0||l.length===0)&&f.push(`inputIdx[${d}] = 0;`);return[`${f.join(`
1001`)}
1002value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),ac=(t,e,o)=>xr(t,e,o,"ReduceMin",(a,l)=>{let f=[];for(let d=0;d<a[0].dims.length;d++)(l.indexOf(d)>=0||l.length===0)&&f.push(`inputIdx[${d}] = 0;`);return[`${f.join(`
1003`)}
1004value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),sc=(t,e,o)=>xr(t,e,o,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),uc=(t,e,o)=>xr(t,e,o,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),lc=(t,e,o)=>xr(t,e,o,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])}),cc,pc=E(()=>{fe(),cc=(t,e)=>{let o=U.calculateReshapedDims(e[0].dims,e[1].integerData);return t.session.pack?[t.reshapePacked(e[0],o)]:[t.reshapeUnpacked(e[0],o)]}}),dc,Ni,hc,mc,mn,vb,Ri,lo,Mi=E(()=>{Ge(),xe(),ae(),dc={name:"Upsample",inputNames:["X"],inputTypes:[0]},Ni=(t,e,o)=>(Ri(e,o),[t.run({...dc,cacheHint:o.cacheKey,get:()=>vb(t,e,o)}
vendor: 5,522 bytes, lines 1004-1118
1004,e)]),hc=t=>mn(t,7),mc=t=>mn(t,9),mn=(t,e)=>{let o=e>=10,a=t.attributes.getString("mode","nearest");if(a!=="nearest"&&a!=="linear"&&(e<11||a!=="cubic"))throw new Error(`unrecognized mode: ${a}`);let l=[];e<9&&(l=t.attributes.getFloats("scales"),lo(l,a,o));let f=t.attributes.getFloat("extrapolation_value",0),d=e>10?t.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(d)===-1)throw new Error(`coordinate_transform_mode '${d}' is not supported`);let p=d==="tf_crop_and_resize",h=p,n=a==="nearest"&&e>=11?t.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(n)===-1)throw new Error(`nearest_mode '${n}' is not supported`);let c=t.attributes.getFloat("cubic_coeff_a",-.75),r=t.attributes.getInt("exclude_outside",0)!==0;if(r&&a!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");let s=e<11||a==="nearest"&&d==="asymmetric"&&n==="floor",u=0,g=0,y=0;return e>10?t.inputs.length>2?(u=1,g=2,y=3):(g=1,y=2):e===9&&(g=1),ee({opset:e,isResize:o,mode:a,scales:l,extrapolationValue:f,coordinateTransformMode:d,useExtrapolation:h,needRoiInput:p,nearestMode:n,cubicCoefficientA:c,excludeOutside:r,useNearest2xOptimization:s,roiInputIdx:u,scalesInputIdx:g,sizesInputIdx:y})},vb=(t,e,o)=>{let a=q(t.session.backend.glContext.version),[l,f]=t.calculateTextureWidthAndHeight(e[0].dims,0),d=e[0].dims.map((y,S)=>Math.floor(y*o.scales[S])),[p,h]=t.calculateTextureWidthAndHeight(d,0),n=d.length,c=new Array(n),r=new Array(n),s=`
1005      int output_pitches[${n}];
1006      int input_pitches[${n}];
1007      `;for(let y=n-1;y>=0;y--)c[y]=y===n-1?1:c[y+1]*d[y+1],r[y]=y===n-1?1:r[y+1]*e[0].dims[y+1],s+=`
1008        output_pitches[${y}] = ${c[y]};
1009        input_pitches[${y}] = ${r[y]};
1010        `;let u=`
1011      float getInputFloat(int index) {
1012        vec2 coords = offsetToCoords(index, ${l}, ${f});
1013        float value = getColorAsFloat(${a.texture2D}(X, coords));
1014        return value;
1015      }
1016      `,g=o.mode==="nearest"?`
1017    ${u}
1018    float process(int indices[${n}]) {
1019      int input_index = 0;
1020      int output_index = coordsToOffset(TexCoords, ${p}, ${h});
1021
1022      ${s}
1023
1024      int d, m;
1025      for (int dim = 0; dim < ${n}; ++dim) {
1026        d = output_index / output_pitches[dim];
1027        m = output_index - d * output_pitches[dim];
1028        output_index = m;
1029
1030        if (scales[dim] != 1 && d > 0) {
1031          int d2 = d / scales[dim];
1032          m = d - d2 * scales[dim];
1033          d = d2;
1034        }
1035        input_index += input_pitches[dim] * d;
1036      }
1037
1038      return getInputFloat(input_index);
1039    }`:n===4?`
1040    ${u}
1041    float process(int indices[4]) {
1042      int input_index = 0;
1043      int output_index = coordsToOffset(TexCoords, ${p}, ${h});
1044
1045      ${s}
1046
1047      int m;
1048      int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3;
1049      index_of_dim0 = output_index / output_pitches[0];
1050      m = output_index - index_of_dim0 * output_pitches[0];
1051      index_of_dim1 = m / output_pitches[1];
1052      m = m - index_of_dim1 * output_pitches[1];
1053      index_of_dim2 = m / output_pitches[2];
1054      m = m - index_of_dim2 * output_pitches[2];
1055      index_of_dim3 = m;
1056
1057      int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset;
1058      index_of_input_dim2 = index_of_dim2 / scales[2];
1059      y_offset = index_of_dim2 - index_of_input_dim2 * scales[2];
1060      index_of_input_dim3 = index_of_dim3 / scales[3];
1061      x_offset = index_of_dim3 - index_of_input_dim3 * scales[3];
1062
1063      input_index = index_of_dim0 * input_pitches[0] +
1064            index_of_dim1 * input_pitches[1] +
1065            index_of_input_dim2 * input_pitches[2] +
1066            index_of_input_dim3;
1067
1068      float x00 = getInputFloat(input_index);
1069      float x10, x01, x11;
1070
1071      bool end_of_dim2 = false;
1072      if (index_of_input_dim2 == (${e[0].dims[2]} - 1)) {
1073        // It's the end in dimension 2
1074        x01 = x00;
1075        end_of_dim2 = true;
1076      } else {
1077        x01 = getInputFloat(input_index + input_pitches[2]);
1078      }
1079
1080      if (index_of_input_dim3 == (input_pitches[2] - 1)) {
1081        // It's the end in dimension 3
1082        x10 = x00;
1083        x11 = x01;
1084      }
1085      else {
1086        x10 = getInputFloat(input_index + 1);
1087        x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1);
1088      }
1089
1090      float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]);
1091      float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]);
1092      return y0 + float(x_offset) * (y1 - y0) / float(scales[3]);
1093    }`:`
1094    ${u}
1095    float process(int indices[2]) {
1096      int input_index = 0;
1097      int output_index = coordsToOffset(TexCoords, ${p}, ${h});
1098
1099      ${s}
1100
1101      int m;
1102      int index_of_dim0, index_of_dim1;
1103      index_of_dim0 = output_index / output_pitches[0];
1104      m = output_index - index_of_dim0 * output_pitches[0];
1105      index_of_dim1 = m;
1106
1107      int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset;
1108      index_of_input_dim0 = index_of_dim0 / scales[0];
1109      y_offset = index_of_dim0 - index_of_input_dim0 * scales[0];
1110      index_of_input_dim1 = index_of_dim1 / scales[1];
1111      x_offset = index_of_dim1 - index_of_input_dim1 * scales[1];
1112
1113      input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1;
1114
1115      float x00 = getInputFloat(input_index);
1116      float x10, x01, x11;
1117
1118      bool end_of_dim0 = false;
1119      if (index_of_input_dim0 == (${e[0].dims[0]} - 1)) {
1120        // It's the end in dimension 0
1121        x01 = x00;
1122        end_of_dim0 = true;
1123      } else {
1124        x01 = getInputFloat(input_index + input_pitches[0]);
1125      }
1126
1127      if (index_of_input_dim1 == (input_pitches[0] - 1)) {
1128        // It's the end in dimension 1
1129        x10 = x00;
1130        x11 = x01;
1131      }
1132      else {
1133        x10 = getInputFloat(input_index + 1);
1134        x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1);
1135      }
1136
1137      float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]);
1138      float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]);
1139      return y0 + float(x_offset) * (y1 - y0) / float(scales[1]);
1140    }`;return{...dc,output:{dims:d,type:e[0].type,textureType:0},shaderSource:g,variables:[{name:"scales",type:"int",arrayLength:o.scales.length,data:o.scales.map(y=>Math.ceil(y))}]}},Ri=(t,e)=>{if(!t||e.opset<9&&t.length!==1||e.opset>=9&&e.opset<11&&t.length!==2||e.opset>=11&&t.length<2)throw new Error("invalid inputs.");if(e.scales.length>0&&t[0].dims.length!==e.scales.length)throw new Error("Invalid input shape.");if(t[0].type==="string")throw new Error("Invalid input tensor types.")},lo=(t,e,o)=>{if(o){for(let a of t)if(a<=0)throw new Error("Scale value should be greater than 0.")}else for(let a of t)if(a<1)throw new Error("Scale value should be greater than or equal to 1.");if(!(e!=="linear"&&e!=="cubic"||t.length===2||t.length===4&&t[0]===1&&t[1]===1))throw new 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 ${o?"Resize":"Upsample"} opeartor.`)}}),Gi,Ui,bc,gc,_b,Ob,Ib,Sb,yc=E(()=>{xe(),ae(),kt(),gr(),Mi(),Gi={name:"Resize",inputNames:["A"],inputTypes:[2]},Ui=(t,e,o)=>(Ri(e,o),[t.run({...Gi,cacheHint:o.cacheKey,get:()=>_b(t,e,o)}
vendor: 4,376 bytes, lines 1140-1207
1140,e)]),bc=t=>mn(t,10),gc=t=>mn(t,11),_b=(t,e,o)=>{let a=q(t.session.backend.glContext.version),[l,f]=Ob(e,o);if(l.every(A=>A===1)&&o.coordinateTransformMode!=="tf_crop_and_resize")return{...Gi,output:{dims:f,type:e[0].type,textureType:2},hasMain:!0,shaderSource:`void main() {
1141                    vec4 v = ${a.texture2D}(X, TexCoords);
1142                    ${a.output} = v;
1143                }`};let d=f.length;if(d<2)throw new Error(`output dimension should be at least 2, but got ${d}`);let p=f[d-2],h=f[d-1],n=e[0].dims;if(d!==n.length)throw new Error(`output dimension should match input ${n.length}, but got ${d}`);let c=n[d-2],r=n[d-1],s=l[d-2],u=l[d-1],g="";if(o.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${o.mode}'`);switch(o.coordinateTransformMode){case"asymmetric":g=`
1144                    vec4 getSourceFracIndex(ivec4 coords) {
1145                        return vec4(coords) / scaleWHWH;
1146                    }
1147                `;break;case"half_pixel":g=`
1148                    vec4 getSourceFracIndex(ivec4 coords) {
1149                        return (vec4(coords) + 0.5) / scaleWHWH - 0.5;
1150                    }
1151                `;break;case"pytorch_half_pixel":g=`
1152                    vec4 getSourceFracIndex(ivec4 coords) {
1153                        vec4 fcoords = vec4(coords);
1154                        return vec4(
1155                            ${h}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0,
1156                            ${p}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0,
1157                            ${h}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0,
1158                            ${p}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0
1159                          );
1160                    }
1161                `;break;case"align_corners":g=`
1162                    vec4 getSourceFracIndex(ivec4 coords) {
1163                        vec4 resized = vec4(${h}.0 - 1.0, ${p}.0 - 1.0, ${h}.0 - 1.0,
1164                            ${p}.0 - 1.0);
1165                        vec4 original = vec4(${r}.0 - 1.0, ${c}.0 - 1.0, ${r}.0 - 1.0,
1166                            ${c}.0 - 1.0);
1167                        vec4 new_scale = original / resized;
1168                        return vec4(coords) * new_scale;
1169                    }
1170                `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode:                                 '${o.coordinateTransformMode}'`)}let y=Je(d),S=`
1171            const vec2 inputWH = vec2(${c}.0, ${r}.0);
1172            const vec4 scaleWHWH = vec4(float(${s}), float(${u}), float(${s}), float(${u}));
1173            ${Bt()}
1174            ${g}
1175            float getAValue(int x10, int r, int c, int d) {
1176                return getChannel(getA(x10, r, c, d), vec2(c, d));
1177            }
1178            void main() {
1179                ${y} rc = getOutputCoords();
1180
1181                int batch = rc[0];
1182                int depth = rc[1];
1183
1184                // retrieve the 4 coordinates that is used in the 4 packed output values.
1185                ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1);
1186
1187                // calculate the source index in fraction
1188                vec4 sourceFrac = getSourceFracIndex(coords);
1189
1190                // get the lower and upper bound of the 4 values that will be packed into one texel.
1191                ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy)));
1192                ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw)));
1193                ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy)));
1194                ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw)));
1195
1196                bool hasNextRow = rc.w < ${p-1};
1197                bool hasNextCol = rc.z < ${h-1};
1198
1199                // pack x00, x01, x10, x11's top-left corner into one vec4 structure
1200                vec4 topLeft = vec4(
1201                    getAValue(batch, depth, x00.x, x00.y),
1202                    hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0,
1203                    hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0,
1204                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0);
1205
1206                // pack x00, x01, x10, x11's top-right corner into one vec4 structure
1207                vec4 topRight = vec4(
1208                    getAValue(batch, depth, x00.x, x00.w),
1209                    hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0,
1210                    hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0,
1211                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0);
1212
1213                // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure
1214                vec4 bottomLeft = vec4(
1215                    getAValue(batch, depth, x00.z, x00.y),
1216                    hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0,
1217                    hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0,
1218                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0);
1219
1220                // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure
1221                vec4 bottomRight = vec4(
1222                    getAValue(batch, depth, x00.z, x00.w),
1223                    hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0,
1224                    hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0,
1225                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0);
1226
1227                // calculate the interpolation fraction on u and v direction
1228                vec4 frac = vec4(sourceFrac) - floor(sourceFrac);
1229                vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0));
1230
1231                vec4 top = mix(topLeft, topRight, clampFrac.ywyw);
1232                vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw);
1233                vec4 newValue = mix(top, bottom, clampFrac.xxzz);
1234
1235                ${a.output} = vec4(newValue);
1236            }
1237        `;return{...Gi,output:{dims:f,type:e[0].type,textureType:2},hasMain:!0,shaderSource:S}},Ob=(t,e)=>{let o,a=t[0].dims,l=e.scales;if(l.length===0){let d=t[e.scalesInputIdx];if(d&&d.size!==0){if(t[e.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");l=Ib(d,e.mode,e.isResize)}else{let p=t[e.sizesInputIdx];if(!p||p.size===0)throw new Error("Either scales or sizes MUST be provided as input.");o=Array.from(p.integerData),l=Sb(o,a,e.mode,e.isResize)}}else if(t[e.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");let f=o||a.map((d,p)=>Math.floor(d*l[p]));return[l,f]},Ib=(t,e,o)=>{let a=Array.from(t.floatData);return lo(a,e,o),a},Sb=(t,e,o,a)=>{let l=e.length,f=new Array(l);for(let d=0,p=l;d<p;d++)if(e[d]===0){if(t[d]!==0)throw new Error("Input dim is zero but required output dim is non-zero.");f[d]=1}else f[d]=t[d]/e[d];return lo(f,o,a),f}}),Tc,Ab,xc=E(()=>{br(),Tc=(t,e)=>(Ab(e),[new Ce([e[0].dims.length],"int32",void 0,void 0,new Int32Array(e[0].dims))]),Ab=t=>{if(!t||t.length!==1)throw new Error("Shape requires 1 input.")}}),zi,wc,vc,_c,Pb,Oc,Eb,Db,Ic=E(()=>{Ge(),hn(),fe(),ae(),zi={name:"Slice",inputNames:["A"],inputTypes:[0]},wc=(t,e,o)=>(Pb(e),[t.run({...zi,cacheHint:o.cacheKey,get:()=>_c(t,e[0],o)},e)]),vc=t=>{let e=t.attributes.getInts("starts"),o=t.attributes.getInts("ends"),a=t.attributes.getInts("axes",[]);return ee({starts:e,ends:o,axes:a})},_c=(t,e,o)=>{let a=o.axes.length===0?e.dims.slice(0).map((c,r)=>r):o.axes,l=U.normalizeAxes(a,e.dims.length),f=o.starts.map((c,r)=>c>e.dims[l[r]]-1?e.dims[l[r]]:U.normalizeAxis(c,e.dims[l[r]])),d=o.ends.map((c,r)=>c>e.dims[l[r]]-1?e.dims[l[r]]:U.normalizeAxis(c,e.dims[l[r]])),p=e.dims.slice(),h=[];for(let c=0;c<l.length;c++)p[l[c]]=d[c]-f[c],f[c]>0&&h.push(`outputIdx[${l[c]}] += ${f[c]};`);let n=`
1238      float process(int outputIdx[${p.length}]) {
1239        ${h.join(`
1240      `)}
1241        return _A(outputIdx);
1242      }`;return{...zi,output:{dims:p,type:e.type,textureType:0},shaderSource:n}},Pb=t=>{if(!t||t.length!==1)throw new Error("Slice requires 1 input.");if(Jt.indexOf(t[0].type)===-1)throw new Error("Invalid input type.")},Oc=(t,e)=>{Db(e);let o=Eb(t,e);return[t.run({...zi,cacheHint:o.cacheKey,get:()=>_c(t,e[0],o)},[e[0]])]},Eb=(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 new Error("dynamic slice attributes are not allowed");if(e.length>=5&&e[4].integerData.some(f=>f!==1))throw new Error("currently non-1 steps is not supported for Slice");let o=Array.from(e[1].integerData),a=Array.from(e[2].integerData),l=e.length>=4?Array.from(e[3].integerData):[];return{starts:o,ends:a,axes:l,cacheKey:`${l};${o};${a}`}},Db=t=>{if(!t||t.length<3||t.length>5)throw new Error("Invalid input number.");if(t[1].type!=="int32"||t[1].dims.length!==1)throw new Error("Invalid input type.");if(t[2].type!=="int32"||t[2].dims.length!==1)throw new Error("Invalid input type.");if(t.length>=4&&(t[3].type!=="int32"||t[3].dims.length!==1))throw new Error("Invalid input type.");if(t.length>=5&&(t[4].type!=="int32"||t[4].dims.length!==1))throw new Error("Invalid input type.")}}),Sc,Ac,Pc,Ec,Dc,Lc,Fc,Cc,Lb,Fb,Cb,$c,kc=E(()=>{Ge(),fe(),xe(),ae(),ao(),Sc={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[0]},Ac={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[0,0]},Pc={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[0,0,0]},Ec=(t,e,o)=>{$c(e);let a=e[0].dims.slice(),l=U.normalizeAxis(o.axis,a.length),f=U.sizeToDimension(a,l),d=U.sizeFromDimension(a,l);return Cc(t,e,o,f,d)},Dc=t=>ee({axis:t.attributes.getInt("axis",1)}),Lc=t=>ee({axis:t.attributes.getInt("axis",-1)}),Fc=(t,e,o)=>{$c(e);let a,l=e[0].dims.slice(),f=U.normalizeAxis(o.axis,l.length),d=l.length,p=f!==d-1,h=[],n=[],c=[];p&&(n=Array.from({length:d}).map((g,y)=>y),n[f]=d-1,n[d-1]=f,n.map(g=>h.push(l[g])),a=ee({perm:n}),c=Tr(t,e,a));let r=p?U.sizeToDimension(h,d-1):U.sizeToDimension(l,d-1),s=p?U.sizeFromDimension(h,d-1):U.sizeFromDimension(l,d-1),u=Cc(t,p?c:e,o,r,s);return p?Tr(t,u,a):u},Cc=(t,e,o,a,l)=>{let f=Lb(t,e[0],a,l,[a]),d=t.run({...Sc,cacheHint:o.cacheKey,get:()=>f},e),p=Fb(t,e[0],a,l,f.output.dims,[a]),h=t.run({...Ac,cacheHint:o.cacheKey,get:()=>p},[e[0],d]),n=Cb(t,e[0],a,l,f.output.dims,p.output.dims);return[t.run({...Pc,cacheHint:o.cacheKey,get:()=>n},[e[0],d,h])]},Lb=(t,e,o,a,l)=>{let[f,d]=t.calculateTextureWidthAndHeight(e.dims,0),p=l.length;if(o<1||a<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(l.length!==1)throw new Error("Dimensionality of the output should be 1");if(l[0]!==o)throw new Error("Shape of the output should be equal to logical row count");let h=q(t.session.backend.glContext.version),n=`
1243      float process(int[${p}] indices) {
1244        int logical_row_start_offset = indices[0] * ${a};
1245
1246        float max = getColorAsFloat(${h.texture2D}(A, offsetToCoords(logical_row_start_offset, ${f},
1247        ${d} )));
1248        for(int i=1; i<${a}; ++i)
1249        {
1250          float current = getColorAsFloat(${h.texture2D}(A, offsetToCoords(logical_row_start_offset + i,
1251            ${f}, ${d})));
1252          if(current > max)
1253          max = current;
1254        }
1255
1256        return max;
1257      }`;return{...Sc,output:{dims:l,type:e.type,textureType:0},shaderSource:n}},Fb=(t,e,o,a,l,f)=>{let[d,p]=t.calculateTextureWidthAndHeight(e.dims,0),h=f.length;if(o<1||a<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(f.length!==1)throw new Error("Dimensionality of the output should be 1");if(f[0]!==o)throw new Error("Shape of the output should be equal to logical row count");if(l.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(l[0]!==o)throw new Error("Shape of the intermediate results should be equal to logical row count");let n=`
1258      float process(int[${h}] indices) {
1259        int logical_row_start_offset = indices[0] * ${a};
1260
1261        float norm_factor = 0.0;
1262        float max = _Max(indices);
1263        for(int i=0; i<${a}; ++i)
1264        {
1265          norm_factor += exp(getColorAsFloat(${q(t.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i,
1266            ${d}, ${p}))) - max);
1267        }
1268
1269        return norm_factor;
1270      }`;return{...Ac,output:{dims:f,type:e.type,textureType:0},shaderSource:n}},Cb=(t,e,o,a,l,f)=>{let[d,p]=t.calculateTextureWidthAndHeight(e.dims,0),h=e.dims.length;if(o<1||a<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(l.length!==1||f.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(l[0]!==o||f[0]!==o)throw new Error("Shape of the intermediate results should be equal to logical row count");let n=`
1271      float process(int[${h}] indices) {
1272
1273      // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords)
1274      int offset = coordsToOffset(TexCoords, ${d}, ${p});
1275
1276      //determine the logical row for this index
1277      int logical_row_index[1];
1278      logical_row_index[0] = offset / ${a};
1279
1280      float norm_factor = _Norm(logical_row_index);
1281
1282      // avoid possible division by 0
1283      // if norm_facor is 0, all elements are zero
1284      // if so, return 0
1285      if(norm_factor == 0.0)
1286        return 0.0;
1287
1288      return exp(_A(indices) - _Max(logical_row_index)) / norm_factor;
1289    }`;return{...Pc,output:{dims:e.dims,type:e.type,textureType:0},shaderSource:n}},$c=t=>{if(!t||t.length!==1)throw new Error("Softmax requires 1 input.");if(t[0].type!=="float32"&&t[0].type!=="float64")throw new Error("Invalid input type")}}),Bc,Nc,Rc,$b,kb,Bb,Mc=E(()=>{Ge(),fe(),ae(),Bc={name:"Split",inputNames:["A"],inputTypes:[0]},Nc=(t,e,o)=>{Bb(e);let a=U.normalizeAxis(o.axis,e[0].dims.length),l=$b(t,e,a,o),f=[];for(let d=0;d<l;++d)f.push(t.run({...Bc,cacheHint:`${o.cacheKey};${d}`,get:()=>kb(t,e[0],o,a,d)},e));return f},Rc=t=>{let e=t.attributes.getInt("axis",0),o=t.attributes.getInts("split",[]),a=t.outputs.length;return ee({axis:e,split:o,numOutputs:a})},$b=(t,e,o,a)=>{let[,l]=un.splitShape(e[0].dims,o,a.split,a.numOutputs);return l.length},kb=(t,e,o,a,l)=>{let[f,d]=un.splitShape(e.dims,a,o.split,o.numOutputs),p=d[l],h=f[l],n=`
1290      float process(int indices[${h.length}]) {
1291        indices[${a}] += ${p};
1292        return _A(indices);
1293      }
1294    `;return{...Bc,cacheHint:`${o.cacheKey}:${l}`,output:{dims:h,type:e.type,textureType:0},shaderSource:n}},Bb=t=>{if(!t||t.length!==1)throw new Error("Split requires one input.");if(t[0].type!=="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")throw new Error("Invalid input type.")}}),Vi,Gc,Uc,Nb,Rb,zc=E(()=>{fe(),Vi=(t,e,o)=>{Nb(e);let a=U.squeezeShape(e[0].dims,o);return[t.reshapeUnpacked(e[0],a)]},Gc=(t,e)=>(Rb(e),Vi(t,[e[0]],Array.from(e[1].integerData))),Uc=t=>t.attributes.getInts("axes"),Nb=t=>{if(!t||t.length!==1)throw new Error("Squeeze requires 1 input.");if(t[0].type==="string")throw new Error("invalid input tensor types.")},Rb=t=>{if(!t||t.length!==2)throw new Error("Squeeze requires 2 inputs.");if(t[1].type!=="int32")throw new Error("Invalid input type.")}}),Vc,Mb,Gb,Wc=E(()=>{xe(),ae(),Vc=(t,e)=>{Gb(e);let o={name:"Sum",inputNames:e.map((a,l)=>`X${l}`),inputTypes:new Array(e.length).fill(0)};return[t.run({...o,get:()=>Mb(t,e,o)},e)]},Mb=(t,e,o)=>{let a=q(t.session.backend.glContext.version),l=e[0].dims.slice(),f=`
1295      void main() {
1296        vec4 result = ${e.map((d,p)=>`${a.texture2D}(X${p},TexCoords)`).join(" + ")};
1297        ${a.output} = result;
1298      }
1299    `;return{...o,output:{dims:l,type:e[0].type,textureType:0},hasMain:!0,shaderSource:f}},Gb=t=>{if(!t||t.length===0)throw new Error("Sum requires inputs.");let e=t[0].dims.length;for(let o=1;o<t.length;o++){if(e!==t[o].dims.length)throw new Error("Input shapes are mismatched.");for(let a=0;a<e;a++)if(t[0].dims[a]!==t[o].dims[a])throw new Error("Input shapes are not matched.")}if(t[0].type!=="float32"&&t[0].type!=="float64")throw new Error("Invalid input type.");for(let o=1;o<t.length;o++)if(t[0].type!==t[o].type)throw new Error("Input types are not matched.")}}),Hc,Ub,zb,qc=E(()=>{hn(),ae(),Hc=(t,e)=>{zb(e);let o={name:"Tile",inputNames:["A"],inputTypes:[0]};return[t.run({...o,get:()=>Ub(t,e,o)},e)]},Ub=(t,e,o)=>{let a=e[0].dims.slice(),l=new Array(a.length),f=[];for(let h=0;h<a.length;
1299h++)l[h]=a[h]*e[1].numberData[h],f.push(`inputIdx[${h}] = int(mod(float(outputIdx[${h}]), ${a[h]}.));`);let d=l.length,p=`
1300      float process(int outputIdx[${d}]) {
1301        int inputIdx[${d}];
1302        ${f.join(`
1303`)}
1304        return _A(inputIdx);
1305      }
1306    `;return{...o,output:{dims:l,type:e[0].type,textureType:0},shaderSource:p}},zb=t=>{if(!t||t.length!==2)throw new Error("Tile requires 2 input.");if(t[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(t[1].dims[0]!==t[0].dims.length)throw new Error("Invalid input shape.");if(Jt.indexOf(t[0].type)===-1)throw new Error("Invalid input type.");if(t[1].type!=="int32"&&t[1].type!=="int16")throw new Error("Invalid repeat type.")}}),Wi,jc,Yc,Vb,Wb,Xc=E(()=>{fe(),Wi=(t,e,o)=>{Vb(e);let a=U.unsqueezeShape(e[0].dims,o);return[t.reshapeUnpacked(e[0],a)]},jc=(t,e)=>(Wb(e),Wi(t,[e[0]],Array.from(e[1].integerData))),Yc=t=>t.attributes.getInts("axes"),Vb=t=>{if(!t||t.length!==1)throw new Error("Unsqueeze requires 1 input.");if(t[0].type==="string")throw new Error("invalid input tensor types.")},Wb=t=>{if(!t||t.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(t[1].type!=="int32")throw new Error("Invalid input type.")}}),Kc,Jc=E(()=>{al(),Tl(),vl(),Pl(),no(),pf(),yf(),wf(),Of(),Pf(),Lf(),kf(),Mf(),oo(),Vf(),rc(),fc(),pc(),yc(),xc(),Ic(),kc(),Mc(),zc(),Wc(),qc(),ao(),Ai(),Xc(),Mi(),Kc=[["Abs","","6+",El],["Acos","","7+",Dl],["Add","","7+",sl],["And","","7+",ul],["Asin","","7+",Ll],["Atan","","7+",Fl],["AveragePool","","7+",Hf,qf],["BatchNormalization","","7+",ol,il],["Cast","","6+",xl,wl],["Ceil","","6+",kl],["Clip","","6-10",Ii,Cl],["Clip","","11+",$l],["Concat","","4+",Il,Al],["Conv","","1+",Ci,$i],["ConvTranspose","","1+",ff,cf],["Cos","","7+",Bl],["Div","","7+",ll],["Dropout","","7+",Si],["DepthToSpace","","1+",bf,gf],["Equal","","7+",fl],["Elu","","6+",Nl,Rl],["Exp","","6+",Ml],["Flatten","","1+",Tf,xf],["Floor","","6+",Gl],["FusedConv","com.microsoft","1+",Ci,$i],["Gather","","1+",vf,_f],["Gemm","","7-10",ki,Sf],["Gemm","","11+",ki,Af],["GlobalAveragePool","","1+",Yf,Xf],["GlobalMaxPool","","1+",ec],["Greater","","7+",cl],["Identity","","1+",Si],["ImageScaler","","1+",Ef,Df],["InstanceNormalization","","6+",Cf,$f],["LeakyRelu","","6+",Ul,zl],["Less","","7+",pl],["LRN","","1+",Bf,Nf],["Log","","6+",Vl],["MatMul","","1+",rf,nf],["MaxPool","","1+",Kf,Jf],["Mul","","7+",dl],["Neg","","6+",Wl],["Not","","1+",Hl],["Or","","7+",hl],["Pad","","2-10",Bi,Gf],["Pad","","11+",Uf,zf],["Pow","","7+",ml],["PRelu","","7+",bl],["ReduceLogSum","","1+",uc,Zt],["ReduceMax","","1+",ic,Zt],["ReduceMean","","1+",oc,Zt],["ReduceMin","","1+",ac,Zt],["ReduceProd","","1+",sc,Zt],["ReduceSum","","1-12",nc,Zt],["ReduceSumSquare","","1+",lc,Zt],["Relu","","6+",ql],["Reshape","","5+",cc],["Resize","","10",Ui,bc],["Resize","","11+",Ui,gc],["Shape","","1+",Tc],["Sigmoid","","6+",jl],["Sin","","7+",Yl],["Slice","","10+",Oc],["Slice","","1-9",wc,vc],["Softmax","","1-12",Ec,Dc],["Softmax","","13+",Fc,Lc],["Split","","2-12",Nc,Rc],["Sqrt","","6+",Xl],["Squeeze","","1-12",Vi,Uc],["Squeeze","","13+",Gc],["Sub","","7+",gl],["Sum","","6+",Vc],["Tan","","7+",Kl],["Tanh","","6+",Jl],["Tile","","6+",Hc],["Transpose","","1+",Tr,hf],["Upsample","","7-8",Ni,hc],["Upsample","","9",Ni,mc],["Unsqueeze","","1-12",Wi,Yc],["Unsqueeze","","13+",jc],["Xor","","7+",yl]]});function Qc(t){let e,o={};for(;(e=Zc.exec(t))!==null;){let a=e[3].split(",").map(l=>{let f=l.trim().split(" ");return f&&f.length===2?{type:f[0],name:f[1]}:null}).filter(l=>l!==null);o[e[2]]={params:a,body:e[4]}}for(let a in o){let l=Hb.replace("__FUNC__",a),f=new RegExp(l,"gm");for(;(e=f.exec(t))!==null;){let d=e[1],p=e[2],h=e[3].split(","),n=d?`${d} ${p};`:"",c=o[a].body,r="";o[a].params.forEach((u,g)=>{u&&(r+=`${u.type} ${u.name} = ${h[g]};
1307`)}),c=`${r}
1308 ${c}`,c=c.replace("return",`${p} = `);let s=`
1309      ${n}
1310      {
1311        ${c}
1312      }
1313      `;t=t.replace(e[0],s)}}return t=t.replace(Zc,"")}var Zc,Hb,ep=E(()=>
1313{Zc=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm,Hb="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;"});function Ur(t,e){let o=[],a=[];for(let l=0;l<t.length;++l)t[l]!==1&&(o.push(t[l]),a.push(l));return{newShape:o,keptDims:a}}function Yb(t){if(t.length===0)return 1;let e=t[0];for(let o=1;o<t.length;o++)e*=t[o];return e}function tp(t){let e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}var fo,Hi=E(()=>{at(),fe(),fo=class{constructor(t){this.maxTextureSize=t}computeTextureWH(t,e){let o=this.computeTexture(t,e);return e&&e.isPacked&&(o[0]/=2,o[1]/=2),e&&e.reverseWH?[o[1],o[0]]:o}computeTexture(t,e){let o=e&&e.isPacked;if(t.length===0)return o?[2,2]:[1,1];let a=this.maxTextureSize;if(e&&e.breakAxis!==void 0){let d=e.breakAxis>=t.length?1:t.slice(e.breakAxis).reduce((h,n)=>h*n),p=e.breakAxis<=0?1:t.slice(0,e.breakAxis).reduce((h,n)=>h*n);if(!(d>a||p>a))return[d,p];ce.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${t}, breakAxis:${e.breakAxis}`)}let l=t.slice(0);o&&(a*=2,l=l.map((d,p)=>p>=l.length-2?l[p]%2==0?l[p]:l[p]+1:l[p]),l.length===1&&(l=[2,l[0]])),l.length!==2&&(l=Ur(l).newShape);let f=Yb(l);return l.length<=1&&f<=a?[1,f]:l.length===2&&l[0]<=a&&l[1]<=a?l:l.length===3&&l[0]*l[1]<=a&&l[2]<=a?[l[0]*l[1],l[2]]:l.length===3&&l[0]<=a&&l[1]*l[2]<=a?[l[0],l[1]*l[2]]:l.length===4&&l[0]*l[1]*l[2]<=a&&l[3]<=a?[l[0]*l[1]*l[2],l[3]]:l.length===4&&l[0]<=a&&l[1]*l[2]*l[3]<=a?[l[0],l[1]*l[2]*l[3]]:o?tp(f/4).map(d=>2*d):tp(f)}}}),co,rp=E(()=>{fe(),Ht(),xe(),Hi(),kt(),co=class extends ft{constructor(t){super(t)}getFunctions(){return{...this.offsetToCoords(),...this.coordsToOffset(),...this.toVec(),...this.valueFrom(),...this.getCommonUtilFuncs(),...this.getInputsSampl
vendor: 4,212 bytes, lines 1313-1389
1313ingSnippets(),...this.getOutputSamplingSnippet()}}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new R(`
1314      vec2 offsetToCoords(int offset, int width, int height) {
1315        int t = offset / width;
1316        int s = offset - t*width;
1317        vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height);
1318        return coords;
1319      }
1320      `)}}coordsToOffset(){return{coordsToOffset:new R(`
1321      int coordsToOffset(vec2 coords, int width, int height) {
1322        float s = coords.s * float(width);
1323        float t = coords.t * float(height);
1324        int offset = int(t) * width + int(s);
1325        return offset;
1326      }
1327      `)}}getOutputSamplingSnippet(){let t=this.context.outputTextureLayout;return t.isPacked?this.getPackedOutputSamplingSnippet(t):this.getUnpackedOutputSamplingSnippet(t)}getPackedOutputSamplingSnippet(t){let e=t.unpackedShape,o=[t.width,t.height],a={},l="getOutputCoords";switch(e.length){case 0:a[l]=this.getOutputScalarCoords();break;case 1:a[l]=this.getOutputPacked1DCoords(e,o);break;case 2:a[l]=this.getOutputPacked2DCoords(e,o);break;case 3:a[l]=this.getOutputPacked3DCoords(e,o);break;default:a[l]=this.getOutputPackedNDCoords(e,o)}let f=`
1328      void setOutput(vec4 val) {
1329        ${q(this.context.glContext.version).output} = val;
1330      }
1331    `;return a.floatTextureSetRGBA=new R(f),a}getUnpackedOutputSamplingSnippet(t){let e=t.unpackedShape,o=[t.width,t.height],a={},l="getOutputCoords";switch(e.length){case 0:a[l]=this.getOutputScalarCoords();break;case 1:a[l]=this.getOutputUnpacked1DCoords(e,o);break;case 2:a[l]=this.getOutputUnpacked2DCoords(e,o);break;case 3:a[l]=this.getOutputUnpacked3DCoords(e,o);break;case 4:a[l]=this.getOutputUnpacked4DCoords(e,o);break;case 5:a[l]=this.getOutputUnpacked5DCoords(e,o);break;case 6:a[l]=this.getOutputUnpacked6DCoords(e,o);break;default:throw new Error(`Unsupported output dimensionality: ${e.length}`)}let f=`
1332        void setOutput(float val) {
1333          ${q(this.context.glContext.version).output} = vec4(val, 0, 0, 0);
1334        }
1335    `;return a.floatTextureSetR=new R(f),a}getOutputScalarCoords(){return new R(`
1336      int getOutputCoords() {
1337        return 0;
1338      }
1339    `)}getOutputPacked1DCoords(t,e){let o=e,a="";return o[0]===1?(a=`
1340          int getOutputCoords() {
1341            return 2 * int(TexCoords.y * ${o[1]}.0);
1342          }
1343        `,new R(a)):o[1]===1?(a=`
1344          int getOutputCoords() {
1345            return 2 * int(TexCoords.x * ${o[0]}.0);
1346          }
1347        `,new R(a)):(a=`
1348        int getOutputCoords() {
1349          ivec2 resTexRC = ivec2(TexCoords.xy *
1350                                 vec2(${o[0]}, ${o[1]}));
1351          return 2 * (resTexRC.y * ${o[0]} + resTexRC.x);
1352        }
1353      `,new R(a))}getOutputPacked2DCoords(t,e){let o="";if(pr.arraysEqual(t,e))return o=`
1354        ivec2 getOutputCoords() {
1355          return 2 * ivec2(TexCoords.xy * vec2(${e[0]}, ${e[1]}));
1356        }
1357      `,new R(o);let a=e,l=Math.ceil(t[1]/2);return o=`
1358        ivec2 getOutputCoords() {
1359          ivec2 resTexRC = ivec2(TexCoords.xy *
1360                                vec2(${a[0]}, ${a[1]}));
1361
1362          int index = resTexRC.y * ${a[0]} + resTexRC.x;
1363
1364          // reverse r and c order for packed texture
1365          int r = imod(index, ${l}) * 2;
1366          int c = 2 * (index / ${l});
1367
1368          return ivec2(r, c);
1369        }
1370      `,new R(o)}getOutputPacked3DCoords(t,e){let o=[e[0],e[1]],a=Math.ceil(t[2]/2),l=a*Math.ceil(t[1]/2);return new R(`
1371        ivec3 getOutputCoords() {
1372          ivec2 resTexRC = ivec2(TexCoords.xy *
1373                                vec2(${o[0]}, ${o[1]}));
1374          int index = resTexRC.y * ${o[0]} + resTexRC.x;
1375
1376          int b = index / ${l};
1377          index -= b * ${l};
1378
1379          // reverse r and c order for packed texture
1380          int r = imod(index, ${a}) * 2;
1381          int c = 2 * (index / ${a});
1382
1383          return ivec3(b, r, c);
1384        }
1385      `)}getOutputPackedNDCoords(t,e){let o=[e[0],e[1]],a=Math.ceil(t[t.length-1]/2),l=a*Math.ceil(t[t.length-2]/2),f=l,d="",p="b, r, c";for(let n=2;n<t.length-1;n++)f*=t[t.length-n-1],d=`
1386      int b${n} = index / ${f};
1387      index -= b${n} * ${f};
1388    `+d,p=`b${n}, `+p;let h=`
1389      ivec${t.length} getOutputCoords() {
1390        ivec2 resTexRC = ivec2(TexCoords.xy *
1391                              vec2(${o[0]}, ${o[1]}));
1392        int index = resTexRC.y * ${o[0]} + resTexRC.x;
1393
1394        ${d}
1395
1396        int b = index / ${l};
1397        index -= b * ${l};
1398
1399        // reverse r and c order for packed texture
1400        int r = imod(index, ${a}) * 2;
1401        int c = 2 * (index / ${a});
1402
1403        return ivec${t.length}(${p});
1404      }
1405    `;return new R(h)}getOutputUnpacked1DCoords(t,e){let o=`
1406        int getOutputCoords() {
1407          ivec2 resTexRC = ivec2(TexCoords.xy *
1408                                vec2(${e[0]}, ${e[1]}));
1409          return resTexRC.y * ${e[0]} + resTexRC.x;
1410        }
1411      `;return new R(o)}getOutputUnpacked2DCoords(t,e){let o=`
1412        ivec2 getOutputCoords() {
1413          ivec2 resTexRC = ivec2(TexCoords.xy *
1414                                vec2(${e[0]}, ${e[1]}));
1415          int index = resTexRC.y * ${e[0]} + resTexRC.x;
1416          int r = index / ${t[1]};
1417          int c = index - r * ${t[1]};
1418          return ivec2(r, c);
1419        }
1420      `;return new R(o)}getOutputUnpacked3DCoords(t,e){let o="",a=t.length,l=null;a<2&&(l=[]),l=new Array(a-1),l[a-2]=t[a-1];for(let p=a-3;p>=0;--p)l[p]=l[p+1]*t[p+1];let f=["r","c","d"],d=l.map((p,h)=>`${`int ${f[h]} = index / ${p}`}; ${h===l.length-1?`int ${f[h+1]} = index - ${f[h]} * ${p}`:`index -= ${f[h]} * ${p}`};`).join("");return o=`
1421        ivec3 getOutputCoords() {
1422          ivec2 resTexRC = ivec2(TexCoords.xy *
1423                                vec2(${e[0]}, ${e[1]}));
1424          int index = resTexRC.y * ${e[0]} + resTexRC.x;
1425          ${d}
1426          return ivec3(r, c, d);
1427        }
1428      `,new R(o)}getOutputUnpacked4DCoords(t,e){let o="",a=t.length,l=null;a<2&&(l=[]),l=new Array(a-1),l[a-2]=t[a-1];for(let p=a-3;p>=0;--p)l[p]=l[p+1]*t[p+1];let f=["r","c","d","d2"],d=l.map((p,h)=>`${`int ${f[h]} = index / ${p}`}; ${h===l.length-1?`int ${f[h+1]} = index - ${f[h]} * ${p}`:`index -= ${f[h]} * ${p}`};`).join("");return o=`
1429      ivec4 getOutputCoords() {
1430          ivec2 resTexRC = ivec2(TexCoords.xy *
1431                                vec2(${e[0]}, ${e[1]}));
1432          int index = resTexRC.y * ${e[0]} + resTexRC.x;
1433          ${d}
1434          return ivec4(r, c, d, d2);
1435        }
1436      `,new R(o)}getOutputUnpacked5DCoords(t,e){let o="",a=t.length,l=null;a<2&&(l=[]),l=new Array(a-1),l[a-2]=t[a-1];for(let p=a-3;p>=0;--p)l[p]=l[p+1]*t[p+1];let f=["r","c","d","d2","d3"],d=l.map((p,h)=>`${`int ${f[h]} = index / ${p}`}; ${h===l.length-1?`int ${f[h+1]} = index - ${f[h]} * ${p}`:`index -= ${f[h]} * ${p}`};`).join("");return o=`
1437      ivec5 getOutputCoords() {
1438          ivec2 resTexRC = ivec2(TexCoords.xy *
1439                                vec2(${e[0]}, ${e[1]}));
1440          int index = resTexRC.y * ${e[0]} + resTexRC.x;
1441          ${d}
1442          return ivec5(r, c, d, d2, d3);
1443        }
1444      `,new R(o)}getOutputUnpacked6DCoords(t,e){let o="",a=t.length,l=null;a<2&&(l=[]),l=new Array(a-1),l[a-2]=t[a-1];for(let p=a-3;p>=0;--p)l[p]=l[p+1]*t[p+1];let f=["r","c","d","d2","d3","d4"],d=l.map((p,h)=>`${`int ${f[h]} = index / ${p}`}; ${h===l.length-1?`int ${f[h+1]} = index - ${f[h]} * ${p}`:`index -= ${f[h]} * ${p}`};`).join("");return o=`
1445     ivec6 getOutputCoords() {
1446         ivec2 resTexRC = ivec2(TexCoords.xy *
1447                               vec2(${e[0]}, ${e[1]}));
1448         int index = resTexRC.y * ${e[0]} + resTexRC.x;
1449         ${d}
1450         return ivec6(r, c, d, d2, d3, d4);
1451       }
1452     `,new R(o)}getCommonUtilFuncs(){let t={},e="uvFromFlat";t[e]=new R(`
1453    vec2 uvFromFlat(int texNumR, int texNumC, int index) {
1454      int texC = index / texNumR;
1455      int texR = index - texC * texNumR;
1456      // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to
1457      //       v.
1458      return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC);
1459    }
1460    `),e="packedUVfrom1D",t[e]=new R(`
1461      vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {
1462        int texelIndex = index / 2;
1463        int texR = texelIndex / texNumC;
1464        int texC = texelIndex - texR * texNumC;
1465        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
1466      }
1467      `),e="packedUVfrom2D",t[e]=new R(`
1468      vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) {
1469        int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);
1470        int texR = texelIndex / texNumC;
1471        int texC = texelIndex - texR * texNumC;
1472        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
1473      }
1474      `),e="packedUVfrom3D",t[e]=new R(`
1475      vec2 packedUVfrom3D(int texNumR, int texNumC,
1476          int texelsInBatch, int texelsInLogicalRow, int b,
1477          int row, int col) {
1478        int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);
1479        int texR = index / texNumC;
1480        int texC = index - texR * texNumC;
1481        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
1482      }
1483      `),e="sampleTexture";let o=q(this.context.glContext.version);return t[e]=new R(`
1484        float sampleTexture(sampler2D textureSampler, vec2 uv) {
1485            return ${o.texture2D}(textureSampler, uv).r;
1486        }`),t}
1486getInputsSamplingSnippets(){let t={},e=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((o,a)=>{let l=this.context.inputTextureLayouts[a],f=Kn(o);l.isPacked?t[f]=this.getPackedSamplerFromInput(f,o,l):t[f]=this.getUnpackedSamplerFromInput(f,o,l);let d=zu(o);l.unpackedShape.length<=e.unpackedShape.length&&(l.isPacked?t[d]=this.getPackedSamplerAtOutputCoords(d,l,e,o):t[d]=this.getUnpackedSamplerAtOutputCoords(d,l,e,o))}),t}getPackedSamplerAtOutputCoords(t,e,o,a){let l,f=e.unpackedShape,d=o.unpackedShape,p=Kn(a),h=f.length,n=d.length,c=Ke.getBroadcastDims(f,d),r=Je(n),s=n-h,u=Ot();l=h===0?"":n<2&&c.length>=1?"coords = 0;":c.map(z=>`coords.${u[z+s]} = 0;`).join(`
1487`);let g="";g=n<2&&h>0?"coords":f.map((z,et)=>`coords.${u[et+s]}`).join(", ");let y="return outputValue;",S=U.size(f)===1,A=U.size(d)===1;if(h!==1||S||A){if(S&&!A)y=n===1?`
1488          return vec4(outputValue.x, outputValue.x, 0., 0.);
1489        `:`
1490          return vec4(outputValue.x);
1491        `;else if(c.length){let z=h-2,et=h-1;c.indexOf(z)>-1&&c.indexOf(et)>-1?y="return vec4(outputValue.x);":c.indexOf(z)>-1?y="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":c.indexOf(et)>-1&&(y="return vec4(outputValue.xx, outputValue.zz);")}}else y=`
1492        return vec4(outputValue.xy, outputValue.xy);
1493      `;let L=`
1494        int lastDim = coords.${u[n-1]};
1495        coords.${u[n-1]} = coords.${u[n-2]};
1496        coords.${u[n-2]} = lastDim;
1497      `;return new R(`
1498      vec4 ${t}() {
1499        ${r} coords = getOutputCoords();
1500        ${L}
1501        ${l}
1502        vec4 outputValue = ${p}(${g});
1503        ${y}
1504      }
1505    `,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(t,e,o,a){let l=[o.width,o.height],f=[e.width,e.height],d=e.unpackedShape.length,p=o.unpackedShape.length,h=e.unpackedShape,n=o.unpackedShape,c=Kn(a);if(d===p&&pr.arraysEqual(f,l))return new R(`
1506          float ${t}() {
1507            return sampleTexture(${a}, TexCoords);
1508          }
1509        `,["coordinates.sampleTexture"]);let r,s=Je(p),u=Ke.getBroadcastDims(h,n),g=p-d,y=Ot();r=d===0?"":p<2&&u.length>=1?"coords = 0;":u.map(A=>`coords.${y[A+g]} = 0;`).join(`
1510`);let S="";return S=p<2&&d>0?"coords":e.unpackedShape.map((A,L)=>`coords.${y[L+g]}`).join(", "),new R(`
1511        float ${t}() {
1512          ${s} coords = getOutputCoords();
1513          ${r}
1514          return ${c}(${S});
1515        }
1516      `,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(t,e,o){switch(o.unpackedShape.length){case 0:return this.getPackedSamplerScalar(t,e);case 1:return this.getPackedSampler1D(t,e,o);case 2:return this.getPackedSampler2D(t,e,o);case 3:return this.getPackedSampler3D(t,e,o);default:return this.getPackedSamplerND(t,e,o)}}getUnpackedSamplerFromInput(t,e,o){let a=o.unpackedShape;switch(a.length){case 0:return this.getUnpackedSamplerScalar(t,e,o);case 1:return this.getUnpackedSampler1D(t,e,o);case 2:return this.getUnpackedSampler2D(t,e,o);case 3:return this.getUnpackedSampler3D(t,e,o);case 4:return this.getUnpackedSampler4D(t,e,o);case 5:return this.getUnpackedSampler5D(t,e,o);case 6:return this.getUnpackedSampler6D(t,e,o);default:throw new Error(`Unsupported dimension ${a.length}-D`)}}getPackedSamplerScalar(t,e){let o=`
1517          vec4 ${t}() {
1518            return ${q(this.context.glContext.version).texture2D}(${e}, halfCR);
1519          }
1520        `;return new R(o)}getPackedSampler1D(t,e,o){let a=[o.width,o.height],l=[a[1],a[0]],f=q(this.context.glContext.version),d=`vec4 ${t}(int index) {
1521      vec2 uv = packedUVfrom1D(
1522      ${l[0]}, ${l[1]}, index);
1523      return ${f.texture2D}(${e}, uv);
1524    }`;return new R(d,["coordinates.packedUVfrom1D"])}getPackedSampler2D(t,e,o){let a=o.unpackedShape,l=[o.width,o.height],f=q(this.context.glContext.version),d=l[0],p=l[1];if(l!=null&&pr.arraysEqual(a,l)){let r=`vec4 ${t}(int row, int col) {
1525        vec2 uv = (vec2(col, row) + halfCR) / vec2(${p}.0, ${d}.0);
1526        return ${f.texture2D}(${e}, uv);
1527      }`;return new R(r)}let h=l,n=Math.ceil(a[1]/2),c=`vec4 ${t}(int row, int col) {
1528      vec2 uv = packedUVfrom2D(${h[1]}, ${h[0]}, ${n}
1528, row, col);
1529      return ${f.texture2D}(${e}, uv);
1530    }`;return new R(c,["coordinates.packedUVfrom2D"])}getPackedSampler3D(t,e,o){let a=o.unpackedShape,l=[o.width,o.height],f=[l[0],l[1]],d=q(this.context.glContext.version);if(a[0]===1){let r=a.slice(1),s=[1,2],u=Br(a,r),g=["b","row","col"],y=JSON.parse(JSON.stringify(o));y.unpackedShape=u;let S=this.getPackedSamplerFromInput(t,e,y),A=`${S.routineBody}
1531      vec4 ${t}(int b, int row, int col) {
1532        return ${t}(${Nr(g,s)});
1533      } `;return new R(A,S.dependencies)}let p=f[0],h=f[1],n=Math.ceil(a[2]/2),c=`vec4 ${t}(int b, int row, int col) {
1534      vec2 uv = packedUVfrom3D(
1535        ${h}, ${p}, ${n*Math.ceil(a[1]/2)}, ${n}, b, row, col);
1536      return ${d.texture2D}(${e}, uv);}`;return new R(c,["coordinates.packedUVfrom3D"])}getPackedSamplerND(t,e,o){let a=o.unpackedShape,l=a.length,f=[o.width,o.height],d=q(this.context.glContext.version),p=[f[0],f[1]],h=p[1],n=p[0],c=Math.ceil(a[l-1]/2),r=c*Math.ceil(a[l-2]/2),s="int b, int row, int col",u=`b * ${r} + (row / 2) * ${c} + (col / 2)`;for(let y=2;y<l-1;y++)s=`int b${y}, `+s,r*=a[l-y-1],u=`b${y} * ${r} + `+u;let g=`vec4 ${t}(${s}) {
1537      int index = ${u};
1538      int texR = index / ${n};
1539      int texC = index - texR * ${n};
1540      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${n}, ${h});
1541      return ${d.texture2D}(${e}, uv);
1542    }`;return new R(g)}getUnpackedSamplerScalar(t,e,o){let[a,l]=[o.width,o.height];return a===1&&l===1?new R(`
1543          float ${t}() {
1544            return sampleTexture(${e}, halfCR);
1545          }
1546        `,["coordinates.sampleTexture"]):new R(`
1547        float ${t}() {
1548          int offset_${e} = coordsToOffset(TexCoords, ${a}, ${l});
1549          vec2 uv = uvFromFlat(${a}, ${l}, offset_${e});
1550          return sampleTexture(${e}, uv);
1551        }
1552      `,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler1D(t,e,o){let a=o.width,l=o.height;return l===1&&a===1?new R(`
1553        float ${t}(int index) {
1554          return sampleTexture(${e}, halfCR);
1555        }
1556      `,["coordinates.sampleTexture"]):l===1?new R(`
1557          float ${t}(int index) {
1558            vec2 uv = vec2((float(index) + 0.5) / ${a}.0, 0.5);
1559            return sampleTexture(${e}, uv);
1560          }
1561        `,["coordinates.sampleTexture"]):a===1?new R(`
1562          float ${t}(int index) {
1563            vec2 uv = vec2(0.5, (float(index) + 0.5) / ${l}.0);
1564            return sampleTexture(${e}, uv);
1565          }
1566        `,["coordinates.sampleTexture"]):new R(`
1567        float ${t}(int index) {
1568          vec2 uv = uvFromFlat(${a}, ${l}, index);
1569          return sampleTexture(${e}, uv);
1570        }
1571      `,["coordinates.uvFromFlat","coordinates.sampleTexture"])}getUnpackedSampler2D(t,e,o){let a=o.unpackedShape,l=[o.height,o.width];if(l!=null&&pr.arraysEqual(a,l))return new R(`
1572          float ${t}(int row, int col) {
1573            vec2 uv = (vec2(row, col) + halfCR) / vec2(${l[1]}.0, ${l[0]}.0);
1574            return sampleTexture(${e}, uv);
1575          }
1576        `,["coordinates.sampleTexture"]);let{newShape:f,keptDims:d}=Ur(a),p=f;if(p.length<a.length){let r=Br(a,p),s=JSON.parse(JSON.stringify(o));s.unpackedShape=r;let u=["col","row"],g=`
1577          ${this.getUnpackedSamplerFromInput(t,e,s).routineBody}
1578          float ${t}(int row, int col) {
1579            return ${t}(${Nr(u,d)});
1580          }
1581        `;return new R(g,["coordinates.sampleTexture"])}let h=l[1],n=l[0];if(n===1){let r=`
1582          float ${t}(int row, int col) {
1583            int offset_${e} = coordsToOffset(TexCoords, ${h}, ${n});
1584            float index = dot(vec3(row, col, offset_${e}), vec3(${a[1]}, 1, 1));
1585            vec2 uv = vec2(0.5, (index + 0.5) / ${h}.0);
1586            return sampleTexture(${e}, uv);
1587          }
1588        `;return new R(r,["coordinates.sampleTexture","coordinates.coordsToOffset"])}if(h===1){let r=`
1589          float ${t}(int row, int col) {
1590            int offset_${e} = coordsToOffset(TexCoords, ${h}, ${n});
1591            float index = dot(vec3(row, col, offset_${e}), vec3(${a[1]}, 1, 1));
1592            vec2 uv = vec2((index + 0.5) / ${n}.0, 0.5);
1593            return sampleTexture(${e}, uv);
1594          }
1595        `;return new R(r,["coordinates.sampleTexture","coordinates.coordsToOffset"])}let c=`
1596        float ${t}(int row, int col) {
1597          int index = col * ${a[1]} + row;
1598          vec2 uv = uvFromFlat(${h}, ${n}, index);
1599          return sampleTexture(${e}, uv);
1600        }
1601      `;return new R(c,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler3D(t,e,o){let a=o.unpackedShape,l=a[1]*a[2],f=a[2],{newShape:d,keptDims:p}=Ur(a),h=d;if(h.length<a.length){let r=Br(a,h),s=["batch","col","row"],u=JSON.parse(JSON.stringify(o));u.unpackedShape=r;let g=this.getUnpackedSamplerFromInput(t,e,u),y=p.reverse(),S=`
1602          ${g.routineBody}
1603          float ${t}(int batch, int row, int col) {
1604            return ${t}(${Nr(s,y)});
1605          }
1606        `;
1606return new R(S,g.dependencies)}let n=o.width,c=o.height;return new R(`
1607          float ${t}(int depth, int row, int col) {
1608            // Explicitly use integer operations as dot() only works on floats.
1609            int index = depth * ${l} + col * ${f} + row;
1610            vec2 uv = uvFromFlat(${n}, ${c}, index);
1611            return sampleTexture(${e}, uv);
1612          }
1613      `,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler4D(t,e,o){let a=o.unpackedShape,l=a[3],f=a[2]*l,d=a[1]*f,p=o.width,h=o.height;return new R(`
1614        float ${t}(int row, int col, int depth, int depth2) {
1615          int index = row * ${d} + col * ${f} +
1616              depth2 * ${l} + depth;
1617          vec2 uv = uvFromFlat(${p}, ${h}, index);
1618          return sampleTexture(${e}, uv);
1619        }
1620      `,["coordinates.uvFromFlat","coordinates.sampleTexture"])}getUnpackedSampler5D(t,e,o){let a=o.unpackedShape,l=a[4],f=a[3]*l,d=a[2]*f,p=a[1]*d,{newShape:h,keptDims:n}=Ur(a);if(h.length<a.length){let s=Br(a,h),u=["row","col","depth","depth2","depth3"],g=JSON.parse(JSON.stringify(o));g.unpackedShape=s;let y=`
1621          ${this.getUnpackedSamplerFromInput(t,e,g).routineBody}
1622          float ${t}(int row, int col, int depth, int depth2, int depth3) {
1623            return ${t}(${Nr(u,n)});
1624          }
1625        `;return new R(y,["coordinates.sampleTexture","coordinates.uvFromFlat"])}let c=o.width,r=o.height;return new R(`
1626        float ${t}(int row, int col, int depth, int depth2, int depth3) {
1627          int index = row * ${p} + col * ${d} + depth * ${f} +
1628          depth3 * ${l} + depth2;
1629          vec2 uv = uvFromFlat(${c}, ${r}, index);
1630          return sampleTexture(${e}, uv);
1631        }
1632      `,["coordinates.sampleTexture","coordinates.uvFromFlat"])}getUnpackedSampler6D(t,e,o){let a=o.unpackedShape,l=a[5],f=a[4]*l,d=a[3]*f,p=a[2]*d,h=a[1]*p,{newShape:n,keptDims:c}=Ur(a);if(n.length<a.length){let u=Br(a,n),g=["row","col","depth","depth2","depth3","depth4"],y=JSON.parse(JSON.stringify(o));y.unpackedShape=u;let S=`
1633            ${this.getUnpackedSamplerFromInput(t,e,y).routineBody}
1634            float ${t}(int row, int col, int depth,
1635              int depth2, int depth3, int depth4) {
1636              return ${t}(${Nr(g,c)});
1637            }
1638          `;return new R(S,["coordinates.sampleTexture","coordinates.uvFromFlat"])}let r=o.width,s=o.height;return new R(`
1639          float ${t}(int row, int col, int depth,
1640            int depth2, int depth3, int depth4) {
1641            int index = row * ${h} + col * ${p} + depth * ${d} +
1642            depth2 * ${f} + depth3 * ${l} + depth4;
1643            vec2 uv = uvFromFlat(${r}, ${s}, index);
1644            return sampleTexture(${e}, uv);
1645          }
1646        `,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}
1646toVec(){let t=this.context.outputTextureLayout,e=t.shape.length,o=t.strides,a=t.width,l=t.height,f=[];for(let p=0;p<e-1;++p)f.push(`
1647        c[${p}] = offset / ${o[p]};`),f.push(`
1648        offset -= c[${p}] * ${o[p]};`);f.push(`
1649        c[${e-1}] = offset;`);let d=`
1650      void toVec(vec2 texCoords, out int c[${e}]) {
1651        int offset = coordsToOffset(texCoords, ${a}, ${l});
1652        ${f.join("")}
1653      }
1654      void toVec(int offset, out int c[${e}]) {
1655        ${f.join("")}
1656      }
1657    `;return{toVec:new R(d,["coordinates.coordsToOffset"])}}valueFrom(){let t={};return this.context.programInfo.inputNames.forEach((e,o)=>{let a=this.context.inputTextureLayouts[o],l=(a.unpackedShape.length>0?a.unpackedShape:a.shape).length,f=`_${e}`;t[f]=new R(this.getValueFromSingle(e,l,a.width,a.height,!1),[`shapeUtils.indicesToOffset${f}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),f+="_T",t[f]=new R(this.getValueFromSingle(e,l,a.width,a.height,!0),[`shapeUtils.indicesToOffset${f}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),t}getValueFromSingle(t,e,o,a,l){let f=`_${t}`;return l&&(f+="_T"),`
1658        float ${f}(int m[${e}]) {
1659          int offset = indicesToOffset${f}(m);
1660          vec2 coords = offsetToCoords(offset, ${o}, ${a});
1661          float value = getColorAsFloat(${q(this.context.glContext.version).texture2D}(${t}, coords));
1662          return value;
1663        }
1664        `}getPackedValueFrom(t,e,o,a,l){let f=`_${t}_Pack`;return l&&(f+="_T"),`
1665        vec4 ${f}(int m[${e}]) {
1666          int offset = indicesToOffset_${t}(m);
1667          vec2 coords = offsetToCoords(offset, ${o}, ${a});
1668          return ${q(this.context.glContext.version).texture2D}(${t}, coords);
1669        }
1670        `}}}),po,np=E(()=>{Ht(),po=class sn extends ft{constructor(e){super(e)}getFunctions(){return{...this.encodeFloat32(),...this.decodeFloat32()}}getCustomTypes(){return{}}encodeFloat32(){return{encode:new R(`highp vec4 encode(highp float f) {
1671        return vec4(f, 0.0, 0.0, 0.0);
1672      }
1673        `)}}decodeFloat32(){return{decode:new R(`highp float decode(highp vec4 rgba) {
1674        return rgba.r;
1675      }
1676        `)}}encodeUint8(){let e=sn.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new R(`
1677      highp vec4 encode(highp float f) {
1678        highp float F = abs(f);
1679        highp float Sign = step(0.0,-f);
1680        highp float Exponent = floor(log2(F));
1681        highp float Mantissa = (exp2(- Exponent) * F);
1682        Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa));
1683        highp vec4 rgba;
1684        rgba[0] = 128.0 * Sign  + floor(Exponent*exp2(-1.0));
1685        rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0);
1686        rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0)));
1687        rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0)));
1688        ${e}
1689        rgba = rgba / 255.0; // values need to be normalized to [0,1]
1690        return rgba;
1691    }
1692        `)}}decodeUint8(){let e=sn.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new R(`
1693        highp float decode(highp vec4 rgba) {
1694          rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255]
1695          ${e}
1696          highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;
1697          highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) 
1697- 127.0;
1698          highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);
1699          highp float Result =  Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));
1700          return Result;
1701      }
1702        `)}}static isLittleEndian(){let e=new ArrayBuffer(4),o=new Uint32Array(e),a=new Uint8Array(e);if(o[0]=3735928559,a[0]===239)return!0;if(a[0]===222)return!1;throw new Error("unknown endianness")}}}),ho,op=E(()=>{Ht(),xe(),ho=class extends ft{constructor(t){super(t)}getFunctions(){return{...this.setFragColor(),...this.getColorAsFloat()}}getCustomTypes(){return{}}setFragColor(){let t=q(this.context.glContext.version);return{setFragColor:new R(`
1703        void setFragColor(float value) {
1704            ${t.output} = encode(value);
1705        }
1706        `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new R(`
1707        float getColorAsFloat(vec4 color) {
1708            return decode(color);
1709        }
1710        `,["encoding.decode"])}}}}),mo,ip=E(()=>{Ht(),mo=class fr extends ft{constructor(e){super(e)}getFunctions(){return{...this.bcastIndex(),...this.bcastMatmulIndex(),...this.offsetToIndices(),...this.indicesToOffset(),...this.incrementIndices()}}getCustomTypes(){return{}}bcastIndex(){let e=this.context.outputTextureLayout.shape.length,o={};return this.context.programInfo.inputNames.forEach((a,l)=>{let f=this.context.inputTextureLayouts[l].unpackedShape;if(f.length<=e){let d=f.length,p=e-d,h=`bcastIndices_${a}`,n="";for(let r=0;r<d;++r)n+=`
1711          realIndices[${r}] = int( mod(float(bcastedIndices[${p+r}]), ${f[r]}.0) );
1712          `;let c=`
1713        void ${h} (int bcastedIndices[${e}], out int realIndices[${d}]) {
1714          ${n}
1715        }
1716        `;o[h]=new R(c)}}),o}bcastMatmulIndex(){let e=this.context.outputTextureLayout.shape.length,o={};return this.context.programInfo.inputNames.forEach((a,l)=>{let f=this.context.inputTextureLayouts[l].shape;if(!(f.length<2||f.length>e)){let d=f.length,p=e-d,h=`bcastMatmulIndices_${a}`,n="";for(let r=0;r<d-2;++r)n+=`
1717          realIndices[${r}] = int( mod(float(bcastedIndices[${p+r}]), ${f[r]}.0) );
1718          `;let c=`
1719        void ${h}(int bcastedIndices[${e}], out int realIndices[${d}]) {
1720          ${n}
1721          realIndices[${d-1}] = bcastedIndices[${e-1}];
1722          realIndices[${d-2}] = bcastedIndices[${e-2}];
1723        }
1724        `;o[h]=new R(c)}}),o}indicesToOffset(){let e={};return this.context.programInfo.inputNames.forEach((o,a)=>{let l=this.context.inputTextureLayouts[a].shape,f=this.context.inputTextureLayouts[a].strides,d=l.length,p=`indicesToOffset_${o}`;e[p]=new R(fr.indexToOffsetSingle(p,d,f)),p=`indicesToOffset_${o}_T`,e[p]=new R(fr.indexToOffsetSingle(p,d,f.slice().reverse()))}),e}static indexToOffsetSingle(e,o,a){let l="";for(let f=o-1;f>=0;--f)l+=`
1725        offset += indices[${f}] * ${a[f]};
1726        `;return`
1727      int ${e}(int indices[${o}]) {
1728        int offset = 0;
1729        ${l}
1730        return offset;
1731      }
1732      `}offsetToIndices(){let e={};return this.context.programInfo.inputNames.forEach((o,a)=>{let l=this.context.inputTextureLayouts[a].shape,f=this.context.inputTextureLayouts[a].strides,d=l.length,p=`offsetToIndices_${o}`;e[p]=new R(fr.offsetToIndicesSingle(p,d,f)),p=`offsetToIndices_${o}_T`,e[p]=new R(fr.offsetToIndicesSingle(p,d,f.slice().reverse()))}),e}static offsetToIndicesSingle(e,o,a){let l=[];for(let f=0;f<o-1;++f)l.push(`
1733      indices[${f}] = offset / ${a[f]};`),l.push(`
1734        offset -= indices[${f}] * ${a[f]};`);return l.push(`
1735      indices[${o-1}] = offset;`),`
1736      void ${e}(int offset, out int indices[${o}]) {
1737        ${l.join("")}
1738      }
1739      `}incrementIndices(){let e={};return this.context.programInfo.inputNames.forEach((o,a)=>{let l=this.context.inputTextureLayouts[a].shape,f=l.length,d=`incrementIndices_${o}`,p="";for(let n=0;n<f;++n)p+=`
1740        shape[${n}] = ${l[n]};`;let h=`
1741        void ${d}(int axis, out int indices[${f}]) {
1742          int shape[${f}];
1743          ${p};
1744          for(int i = ${f} -1 ; i >= 0; --i) {
1745            if(i > axis) continue;
1746            indices[i] += 1;
1747            if(indices[i] < shape[i]) {
1748              break;
1749            }
1750            indices[i] = 0;
1751          }
1752        }
1753        `;e[d]=new R(h)}),e}}}),bo,ap=E(()=>{Ht(),bo=class extends ft{constructor(t){super(t)}getCustomTypes(){return{}}getFunctions(){return{...this.binaryVecFunctions(),...this.copyVec(),...this.setVecItem(),...this.getVecItem()}}binaryVecFunctions(){let t=this.context.outputTextureLayout.shape.length,e={add:"+=",
1753sub:"-=",mul:"*=",div:"/="},o={};for(let a in e){let l=`${a}Vec`,f="";for(let p=0;p<t;++p)f+=`
1754          dest[${p}] ${e[a]} src[${p}];
1755          `;let d=`
1756        void ${l}(int src[${t}], out int dest[${t}]) {
1757          ${f}
1758        }
1759        `;o[l]=new R(d)}return o}copyVec(){let t=this.context.outputTextureLayout.shape.length,e="";for(let o=0;o<t;++o)e+=`
1760        dest[${o}] = src[${o}];
1761        `;return{copyVec:new R(`
1762      void copyVec(int src[${t}], out int dest[${t}]) {
1763        ${e}
1764      }
1765      `)}}setVecItem(){let t=this.context.outputTextureLayout.shape.length,e=`
1766        if(index < 0)
1767            index =${t} + index;
1768        if (index == 0)
1769            m[0] = value;
1770        `;for(let o=1;o<t-1;++o)e+=`
1771        else if (index == ${o})
1772            m[${o}] = value;
1773            `;return e+=`
1774        else
1775            m[${t-1}] = value;
1776        `,{setVecItem:new R(`
1777      void setVecItem(out int m[${t}], int index, int value) {
1778        ${e}
1779      }
1780        `)}}getVecItem(){let t=this.context.outputTextureLayout.shape.length,e=`
1781        if(index < 0)
1782            index = ${t} + index;
1783        if (index == 0)
1784            return m[0];
1785      `;for(let o=1;o<t-1;++o)e+=`
1786        else if (index == ${o})
1787            return m[${o}];
1788      `;return e+=`
1789        else
1790            return m[${t-1}];
1791        `,{getVecItem:new R(`
1792      int getVecItem(int m[${t}], int index) {
1793        ${e}
1794      }
1795    `)}}}}),qi,sp=E(()=>{rp(),np(),op(),ip(),ap(),qi={encoding:po,fragcolor:ho,vec:bo,shapeUtils:mo,coordinates:co}}),go,up=E(()=>{Ht(),ep(),sp(),xe(),go=class{constructor(t,e,o,a){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new eo(t,e,o,a),Object.keys(qi).forEach(f=>{let d=new qi[f](this.context);this.libs[f]=d});let l=this.glslLibRoutineDependencyGraph;for(let f in this.libs){let d=this.libs[f].getFunctions();for(let p in d){let h,n=f+"."+p;l[n]?(h=l[n],h.routineBody=d[p].routineBody):(h=new dn(n,d[p].routineBody),l[n]=h);let c=d[p].dependencies;if(c)for(let r=0;r<c.length;++r)if(l[c[r]])h.addDependency(l[c[r]]);else{let s=new dn(c[r]);l[c[r]]=s,h.addDependency(s)}}}}preprocess(){let t=this.context.programInfo,e=t.shaderSource;return this.context.programInfo.hasMain||(e=`${e}
1796      ${Uu(this.context.glContext.version,this.context.outputTextureLayout.shape.length)}`),e=Qc(e),`${Gu(this.context.glContext.version)}
1797    ${this.getUniforms(t.inputNames,t.variables)}
1798    ${this.getImports(e)}
1799    ${e}`}getImports(t){let e=this.selectGlslLibRoutinesToBeIncluded(t);if(e.length===0)return"";let o="";for(let a=0;a<e.length;++a){if(!e[a].routineBody)throw new Error(`Missing body for the Glsl Library routine: ${e[a].name}`);o+=e[a].routineBody+`
1800`}return o}selectGlslLibRoutinesToBeIncluded(t){let e=[];return Object.keys(this.glslLibRoutineDependencyGraph).forEach(o=>{let a=o.split(".")[1];t.indexOf(a)!==-1&&e.push(this.glslLibRoutineDependencyGraph[o])}),to.returnOrderedNodes(e)}getUniforms(t,e){let o=[];if(t)for(let a of t)o.push(`uniform sampler2D ${a};`);if(e)for(let a of e)o.push(`uniform ${a.type} ${a.name}${a.arrayLength?`[${a.arrayLength}]`:""};`);return o.join(`
1801`)}}}),yo,lp=E(()=>{Tt(),at(),up(),xe(),yo=class{constructor(t,e,o){this.profiler=t,this.glContext=e,this.textureLayoutStrategy=o,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,o){this.profiler.event("op",`ProgramManager.run ${t.programInfo.name??"unknown kernel"}`,()=>{let a=this.glContext.gl,l=t.program;a.useProgram(l);try{this.bindOutput(o),this.attributesBound||this.bindAttributes(t.attribLocations),this.bindUniforms(t.uniformLocations,t.programInfo.variables??[],e)}catch(f){throw ce.error("ProgramManager",t.programInfo.shaderSource),f}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEac
1801h(t=>this.glContext.deleteProgram(t.program))}build(t,e,o){return this.profiler.event("backend","ProgramManager.build",()=>{let a=new go(this.glContext,t,e,o),l=a.preprocess(),f=this.compile(l);return{programInfo:t,program:f,uniformLocations:this.getUniformLocations(f,a.context.programInfo.inputNames,a.context.programInfo.variables),attribLocations:this.getAttribLocations(f)}})}compile(t){if(!this.vertexShader){ce.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");let a=Mu(this.glContext.version);this.vertexShader=this.glContext.compileShader(a,this.glContext.gl.VERTEX_SHADER)}Z.debug&&ce.verbose("ProrgramManager",`FragShader:
1802${t}
1803`);let e=this.glContext.compileShader(t,this.glContext.gl.FRAGMENT_SHADER),o=this.glContext.createProgram(this.vertexShader,e);return this.glContext.deleteShader(e),o}bindOutput(t){let e=t.width,o=t.height;ce.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${e}/${o}, shape=${t.shape}, type=${t.tensor.type}`),this.glContext.attachFramebuffer(t.texture,e,o)}bindAttributes(t){let e=t.position,o=t.textureCoord;this.glContext.setVertexAttributes(e,o),this.attributesBound=!0}bindUniforms(t,e,o){var f;let a=this.glContext.gl,l=0;for(let{name:d,type:p,location:h,arrayLength:n}of t){let c=(f=e.find(r=>r.name===d))==null?void 0:f.data;if(p!=="sampler2D"&&!c)throw new Error(`variable '${d}' does not have data defined in program info`);switch(p){case"sampler2D":this.bindTexture(o[l],h,l),l++;break;case"float":n?a.uniform1fv(h,c):a.uniform1f(h,c);break;case"int":n?a.uniform1iv(h,c):a.uniform1i(h,c);break;default:throw new Error(`Uniform not implemented: ${p}`)}}}bindTexture(t,e,o){this.glContext.bindTextureToUniform(t.texture,o,e)}getAttribLocations(t){return{position:this.getAttribLocation(t,"position"),textureCoord:this.getAttribLocation(t,"textureCoord")}}getUniformLocations(t,e,o){let a=[];if(e)for(let l of e)a.push({name:l,type:"sampler2D",location:this.getUniformLocation(t,l)});if(o)for(let l of o)a.push({...l,location:this.getUniformLocation(t,l.name)});return a}getUniformLocation(t,e){let o=this.glContext.gl.getUniformLocation(t,e);if(o===null)throw new Error(`Uniform ${e} not found.`);return o}getAttribLocation(t,e){return this.glContext.gl.getAttribLocation(t,e)}}}),To,fp=E(()=>{at(),cn(),To=class{constructor(t,e,o,a){this.glContext=t,this.layoutStrategy=e,this.profiler=o,this.config=a,this.pendingRead=new Map,a.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(t,e,o,a){let l=this.toEncoderType(t),f=this.glContext.getEncoder(l,e.channels||1,a);if(e.isPacked&&a===1)throw new Error("not implemented");let d,p,h=e.width,n=e.height;if(this.config.reuseTextures){d=`${h}x${n}_${f.format}_${f.internalFormat}_${f.textureType}`,p=this.inUseTextures.get(d),p||(p=[],this.inUseTextures.set(d,p));let r=this.idleTextures.get(d);if(r&&r.length>0){let s=r.pop();return p.push(s),a===1&&this.glContext.updateTexture(s,h,n,f,this.toTextureData(t,o)),s}}ce.verbose("TextureManager",`Creating new texture of size ${e.width}x${e.height}`);let c=this.glContext.allocateTexture(h,n,f,this.toTextureData(t,o));return this.config.reuseTextures&&(p.push(c),this.textureLookup.set(c,d)),c}readTexture(t,e,o){return o||(o=1),this.profiler.event("backend","TextureManager.readTexture",()=>{let a=t.shape.reduce((f,d)=>f*d)*o,l=this.glContext.readTexture(t.texture,t.width,t.height,a,this.toEncoderType(e),o);return this.toTensorData(e,l)})}async readTextureAsync(t,e,o){let a=t.tensor.dataId;if(o||(o=1),this.pendingRead.has(a)){let l=this.pendingRead.get(a);return new Promise(f=>l==null?void 0:l.push(f))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(a,[]);let l=t.shape.reduce((h,n)=>h*n)*o;await this.glContext.createAndWaitForFence();let f=this.glContext.readTexture(t.texture,t.width,t.height,l,this.toEncoderType(e),o),d=this.toTensorData(e,f),p=this.pendingRead.get(a);return this.pendingRead.delete(a),p==null||p.forEach(h=>h(d)),d})}
vendor: 6,115 bytes, lines 1803-1805
1803readUint8TextureAsFloat(t){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{let e=t.shape.reduce((a,l)=>a*l),o=this.glContext.readTexture(t.texture,t.width,t.height,4*e,"byte",4);return new Float32Array(o.buffer,o.byteOffset,e)})}releaseTexture(t,e){let o;if(this.config.reuseTextures&&(o=this.textureLookup.get(t.texture),o)){e&&this.textureLookup.delete(o);let a=this.inUseTextures.get(o);if(a){let l=a.indexOf(t.texture);if(l!==-1){a.splice(l,1);let f=this.idleTextures.get(o);f||(f=[],this.idleTextures.set(o,f)),f.push(t.texture)}}}(!o||e)&&(ce.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 new 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()}}}),xo,cp=E(()=>{at(),Is(),rl(),Jc(),lp(),Hi(),fp(),xo=class{constructor(t,e){this.backend=t,this.context=e,this.layoutStrategy=new fo(t.glContext.maxTextureSize),this.programManager=new yo(this.context.profiler,t.glContext,this.layoutStrategy),this.textureManager=new To(t.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:t.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=t.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new Qn(this)}onGraphInitialized(t){let e=t.getValues().filter(o=>o.from===-1&&o.tensor).map(o=>o.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,o=!1){ce.verbose("WebGLSessionHandler","Storing Texture data in cache"),o?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,o){let a=Os(t,e,Kc);return{impl:a.opImpl,context:a.opInit?a.opInit(t,o):t}}}});function Xb(t){let e=0;for(;e<t.length&&t[e]();++e);return e-1}var bn,pp=E(()=>{Tt(),cn(),cn(),kt(),bn=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,o,a){let l=this.gl,f=l.createTexture();l.bindTexture(l.TEXTURE_2D,f),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE);let d=a?o.encode(a,t*e):null;return l.texImage2D(l.TEXTURE_2D,0,o.internalFormat,t,e,0,o.format,o.textureType,d),this.checkError(),f}updateTexture(t,e,o,a,l){let f=this.gl;f.bindTexture(f.TEXTURE_2D,t);let d=a.encode(l,e*o);f.texSubImage2D(f.TEXTURE_2D,0,0,0,e,o,a.format,a.textureType,d),this.checkError()}attachFramebuffer(t,e,o){let a=this.gl;a.bindTexture(a.TEXTURE_2D,t),a.bindFramebuffer(a.FRAMEBUFFER,this.framebuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,t,0),this.checkError(),a.viewport(0,0,e,o),a.scissor(0,0,e,o)}readTexture(t,e,o,a,l,f){let d=this.gl;f||(f=1),this.frameBufferBound||this.attachFramebuffer(t,e,o);let p=this.getEncoder(l,f),h=p.allocate(e*o);return d.bindTexture(d.TEXTURE_2D,t),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,t,0),d.readPixels(0,0,e,o,d.RGBA,p.textureType,h),this.checkError(),p.decode(h,a)}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 o=this.gl;o.vertexAttribPointer(t,3,o.FLOAT,!1,20,0),o.enableVertexAttribArray(t),e!==-1&&(o.vertexAttribPointer(e,2,o.FLOAT,!1,20,12),o.enableVertexAttribArray(e)),this.checkError()}createProgram(t,e){let o=this.gl,a=o.createProgram();return o.attachShader(a,t),o.attachShader(a,e),o.linkProgram(a),a}compileShader(t,e){let o=this.gl,a=o.createShader(e);if(!a)throw new Error(`createShader() returned null with type ${e}`);if(o.shaderSource(a,t),o.compileShader(a),o.getShaderParameter(a,o.COMPILE_STATUS)===!1)throw new Error(`Failed to compile shader: ${o.getShaderInfoLog(a)}
1804Shader source:
1805${t}`);return a}deleteShader(t){this.gl.deleteShader(t)}bindTextureToUniform(t,e,o){let a=this.gl;a.activeTexture(a.TEXTURE0+e),this.checkError(),a.bindTexture(a.TEXTURE_2D,t),this.checkError(),a.uniform1i(o,e),this.checkError()}draw(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.checkError()}checkError(){if(Z.debug){let t=this.gl,e=t.getError(),o="";switch(e){case t.NO_ERROR:return;case t.INVALID_ENUM:o="INVALID_ENUM";break;case t.INVALID_VALUE:o="INVALID_VALUE";break;case t.INVALID_OPERATION:o="INVALID_OPERATION";break;case t.INVALID_FRAMEBUFFER_OPERATION:o="INVALID_FRAMEBUFFER_OPERATION";break;case t.OUT_OF_MEMORY:o="OUT_OF_MEMORY";break;
1805case t.CONTEXT_LOST_WEBGL:o="CONTEXT_LOST_WEBGL";break;default:o=`Unknown WebGL Error: ${e.toString(16)}`}throw new Error(o)}}deleteTexture(t){this.gl.deleteTexture(t)}deleteProgram(t){this.gl.deleteProgram(t)}getEncoder(t,e,o=0){if(this.version===2)return new Jn(this.gl,e);switch(t){case"float":return o===1||this.isRenderFloat32Supported?new fn(this.gl,e):new fn(this.gl,e,this.textureHalfFloatExtension.HALF_FLOAT_OES);case"int":throw new Error("not implemented");case"byte":return new Zn(this.gl,e);default:throw new 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 new Error("createBuffer() returned null");let o=this.createDefaultGeometry();return t.bindBuffer(t.ARRAY_BUFFER,e),t.bufferData(t.ARRAY_BUFFER,o,t.STATIC_DRAW),this.checkError(),e}createFramebuffer(){let t=this.gl.createFramebuffer();if(!t)throw new Error("createFramebuffer returned null");return t}queryVitalParameters(){let t=this.gl;if(this.isFloatTextureAttachableToFrameBuffer=this.checkFloatTextureAttachableToFrameBuffer(),this.isRenderFloat32Supported=this.checkRenderFloat32(),this.isFloat32DownloadSupported=this.checkFloat32Download(),this.version===1&&!this.textureHalfFloatExtension&&!this.isRenderFloat32Supported)throw new 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(){this.version===2?(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 o=this.version===2?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,o,1,1,0,t.RGBA,t.FLOAT,null);let a=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,a),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0);let l=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(e),t.deleteFramebuffer(a),l}checkRenderFloat32(){if(this.version===2){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension)return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Download(){if(this.version===2){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,o,a,l,f=this.gl;try{t=f.createTexture(),e=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,t);let d=this.version===2?f.RGBA32F:f.RGBA;return f.texImage2D(f.TEXTURE_2D,0,d,1,1,0,f.RGBA,f.FLOAT,null),f.bindFramebuffer(f.FRAMEBUFFER,e),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,t,0),f.enable(f.BLEND),o=f.createShader(f.VERTEX_SHADER),!!(o&&(f.shaderSource(o,"void main(){}"),f.compileShader(o),a=f.createShader(f.FRAGMENT_SHADER),a)&&(f.shaderSource(a,"precision highp float;void main(){gl_FragColor=vec4(0.5);}"),f.compileShader(a),l=f.createProgram(),l))&&(f.attachShader(l,o),f.attachShader(l,a),f.linkProgram(l),f.useProgram(l),f.drawArrays(f.POINTS,0,1),f.getError()===f.NO_ERROR)}finally{f.disable(f.BLEND),l&&f.deleteProgram(l),o&&f.deleteShader(o),a&&f.deleteShader(a),e&&(f.bindFramebuffer(f.FRAMEBUFFER,null),f.deleteFramebuffer(e)),t&&(f.bindTexture(f.TEXTURE_2D,null),f.deleteTexture(t))}}beginTimer(){if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let t=this.gl,e=this.disjointTimerQueryWebgl2Extension,o=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,o),o}throw new Error("WebGL1 profiling currently not supported.")}endTimer(){if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let t=this.gl,e=this.disjointTimerQueryWebgl2Extension;return void t.endQuery(e.TIME_ELAPSED_EXT)}throw new Error("WebGL1 profiling currently not supported")}isTimerResultAvailable(t){let e=!1,o=!1;if(this.version!==2||!this.disjointTimerQueryWebgl2Extension)throw new Error("WebGL1 profiling currently not supported");{let a=this.gl,l=this.disjointTimerQueryWebgl2Extension;e=a.getQueryParameter(t,a.QUERY_RESULT_AVAILABLE),o=a.getParameter(l.GPU_DISJOINT_EXT)}return e&&!o}getTimerResult(t){let e=0;if(this.version!==2)throw new Error("WebGL1 profiling currently not supported");{let o=this.gl;e=o.getQueryParameter(t,o.QUERY_RESULT),o.deleteQuery(t)}return e/1e6}async waitForQueryAndGetTime(t){return await gi(()=>this.isTimerResultAvailable(t)),this.getTimerResult(t)}async createAndWaitForFence(){let t=this.createFence(this.gl);
1805return this.pollFence(t)}createFence(t){let e,o=t,a=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);return t.flush(),e=a===null?()=>!0:()=>{let l=o.clientWaitSync(a,0,0);return l===o.ALREADY_SIGNALED||l===o.CONDITION_SATISFIED},{query:a,isFencePassed:e}}async pollFence(t){return new Promise(e=>{this.addItemToPoll(()=>t.isFencePassed(),()=>e())})}pollItems(){let t=Xb(this.itemsToPoll.map(e=>e.isDoneFn));for(let e=0;e<=t;++e){let{resolveFn:o}=this.itemsToPoll[e];o()}this.itemsToPoll=this.itemsToPoll.slice(t+1)}async addItemToPoll(t,e){this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),!(this.itemsToPoll.length>1)&&await gi(()=>(this.pollItems(),this.itemsToPoll.length===0))}}});function ji(t){let e;if(t&&t!=="webgl2"||!("webgl2"in zr)?(!t||t==="webgl")&&"webgl"in zr&&(e=zr.webgl):e=zr.webgl2,!e)try{e=dp(Jb(),t)}catch{e=dp(Kb(),t)}t=t||e.version===1?"webgl":"webgl2";let o=e.gl;return zr[t]=e,o.isContextLost()?(delete zr[t],ji(t)):(o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.disable(o.BLEND),o.disable(o.DITHER),o.disable(o.POLYGON_OFFSET_FILL),o.disable(o.SAMPLE_COVERAGE),o.enable(o.SCISSOR_TEST),o.enable(o.CULL_FACE),o.cullFace(o.BACK),e)}function dp(t,e){let o,a={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!e||e==="webgl2")&&(o=t.getContext("webgl2",a),o))try{return new bn(o,2)}catch(l){ce.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${l}`)}if((!e||e==="webgl")&&(o=t.getContext("webgl",a)||t.getContext("experimental-webgl",a),o))try{return new bn(o,1)}catch(l){ce.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${l}`)}throw new Error("WebGL is not supported")}function Kb(){if(typeof document>"u")throw new TypeError("failed to create canvas: document is not supported");let t=document.createElement("canvas");return t.width=1,t.height=1,t}function Jb(){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create offscreen canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}var zr,hp=E(()=>{at(),pp(),zr={}}),wo,mp=E(()=>{Tt(),at(),cp(),hp(),wo=class{get contextId(){return Z.webgl.contextId}set contextId(t){Z.webgl.contextId=t}get matmulMaxBatchSize(){return Z.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(t){Z.webgl.matmulMaxBatchSize=t}get textureCacheMode(){return Z.webgl.textureCacheMode}set textureCacheMode(t){Z.webgl.textureCacheMode=t}get pack(){return Z.webgl.pack}set pack(t){Z.webgl.pack=t}get async(){return Z.webgl.async}set async(t){Z.webgl.async=t}initialize(){try{return this.glContext=ji(this.contextId),typeof this.matmulMaxBatchSize!="number"&&(this.matmulMaxBatchSize=16),typeof this.textureCacheMode!="string"&&(this.textureCacheMode="full"),typeof this.pack!="boolean"&&(this.pack=!1),typeof this.async!="boolean"&&(this.async=!1),ce.setWithEnv(Z),Z.webgl.context||Object.defineProperty(Z.webgl,"context",{value:this.glContext.gl}),ce.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(t){return ce.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${t}`),!1}}createSessionHandler(t){return new xo(this,t)}dispose(){this.glContext.dispose()}}});async function Yi(t){if(!t)return Yi(["webgl"]);{let e=typeof t=="string"?[t]:t;for(let o of e){let a=bp.get(o);if(a)return a;let l=await Qb(o);if(l)return l}}throw new Error("no available backend to use")}async function Qb(t){let e=Zb;if(typeof e[t]<"u"&&eg(e[t])){let o=e[t],a=o.initialize();if(typeof a=="object"&&"then"in a&&(a=await a),a)return bp.set(t,o),o}}function eg(t){let e=t;return"initialize"in e&&typeof e.initialize=="function"&&"createSessionHandler"in e&&typeof e.createSessionHandler=="function"&&"dispose"in e&&typeof e.dispose=="function"}var bp,Zb,gp=E(()=>{mp(),bp=new Map,Zb={webgl:new wo}}),Xi,vo,yp=E(()=>{at(),Xi=class{constructor(t,e){this.op=t,this.node=e}},vo=class{constructor(t,e,o){this.graph=t,this.profiler=o,this.initialize(e)}
vendor: 6,287 bytes, line 1805
1805initialize(t){this.profiler.event("session","ExecutionPlan.initialize",()=>{let e=this.graph.getNodes();if(e.length!==t.length)throw new Error("The size of nodes and OPs do not match.");this._ops=t.map((o,a)=>new Xi(o,e[a])),this.reset(),this._starter=[],this._ops.forEach((o,a)=>{let l=!0;for(let f of o.node.inputs)if(!this._values[f]&&this.graph.getInputIndices().indexOf(f)===-1){l=!1;break}l&&this._starter.push(a)})})}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 o=t.createInferenceHandler(),a=this.graph.getInputIndices();if(e.length!==a.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${e.length} expected: ${a.length}`);e.forEach((n,c)=>{let r=a[c];this._values[r]=n});let l=this._starter.slice(0),f=this.graph.getValues(),d=this.graph.getNodes(),p=0;for(;p<l.length;){let n=l[p++],c=this._ops[n],r=c.node.inputs.map(y=>this._values[y]);if(r.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${c.node}`);let s=r;ce.verbose("ExecPlan",`Runing op:${c.node.name} (${s.map((y,S)=>`'${c.node.inputs[S]}': ${y.type}[${y.dims.join(",")}]`).join(", ")})`);let u=await this.profiler.event("node",c.node.name,async()=>c.op.impl(o,s,c.op.context));if(u.length!==c.node.outputs.length)throw new Error("the size of output does not match model definition.");u.forEach((y,S)=>{let A=c.node.outputs[S];if(this._values[A])throw new Error(`output [${A}] already has value: op:${c.node.name}`);this._values[A]=y});let g=new Set;u.forEach((y,S)=>{let A=c.node.outputs[S];for(let L of f[A].to){let z=d[L],et=!0;for(let Y of z.inputs)if(!this._values[Y]){et=!1;break}et&&g.add(L)}}),l.push(...g)}let h=[];for(let n=0;n<this.graph.getOutputIndices().length;n++){let c=this.graph.getOutputIndices()[n],r=this._values[c];if(r===void 0)throw new Error(`required output [${c}] does not have value`);c===0?await r.getData():r.data,h.push(r)}return ce.verbose("ExecPlan","disposing of inferenceHandler"),o.dispose(),h})}}}),oe,dt,gn,Tp=E(()=>{nn(),oe=Er($r()),br(),fe(),dt=W.experimental.fbs,gn=class vr{constructor(e){if(this._attributes=new Map,e!=null){for(let o of e)o instanceof oe.onnx.AttributeProto?this._attributes.set(o.name,[vr.getValue(o),vr.getType(o)]):o instanceof dt.Attribute&&this._attributes.set(o.name(),[vr.getValue(o),vr.getType(o)]);if(this._attributes.size<e.length)throw new Error("duplicated attribute names")}}set(e,o,a){this._attributes.set(e,[a,o])}delete(e){this._attributes.delete(e)}getFloat(e,o){return this.get(e,"float",o)}getInt(e,o){return this.get(e,"int",o)}getString(e,o){return this.get(e,"string",o)}getTensor(e,o){return this.get(e,"tensor",o)}getFloats(e,o){return this.get(e,"floats",o)}getInts(e,o){return this.get(e,"ints",o)}getStrings(e,o){return this.get(e,"strings",o)}getTensors(e,o){return this.get(e,"tensors",o)}get(e,o,a){let l=this._attributes.get(e);if(l===void 0){if(a!==void 0)return a;throw new Error(`required attribute not found: ${e}`)}if(l[1]!==o)throw new Error(`type mismatch: expected ${o} but got ${l[1]}`);return l[0]}static getType(e){let o=e instanceof oe.onnx.AttributeProto?e.type:e.type();switch(o){case oe.onnx.AttributeProto.AttributeType.FLOAT:return"float";case oe.onnx.AttributeProto.AttributeType.INT:return"int";case oe.onnx.AttributeProto.AttributeType.STRING:return"string";case oe.onnx.AttributeProto.AttributeType.TENSOR:return"tensor";case oe.onnx.AttributeProto.AttributeType.FLOATS:return"floats";case oe.onnx.AttributeProto.AttributeType.INTS:return"ints";case oe.onnx.AttributeProto.AttributeType.STRINGS:return"strings";case oe.onnx.AttributeProto.AttributeType.TENSORS:return"tensors";default:throw new Error(`attribute type is not supported yet: ${oe.onnx.AttributeProto.AttributeType[o]}`)}}static getValue(e){let o=e instanceof oe.onnx.AttributeProto?e.type:e.type();if(o===oe.onnx.AttributeProto.AttributeType.GRAPH||o===oe.onnx.AttributeProto.AttributeType.GRAPHS)throw new Error("graph attribute is not supported yet");let a=this.getValueNoCheck(e);if(o===oe.onnx.AttributeProto.AttributeType.INT&&nt.isLong(a))return nt.longToNumber(a);if(o===oe.onnx.AttributeProto.AttributeType.INTS){let l=a,f=new Array(l.length);for(let d=0;d<l.length;d++){let p=l[d];f[d]=nt.longToNumber(p)}return f}if(o===oe.onnx.AttributeProto.AttributeType.TENSOR)return e instanceof oe.onnx.AttributeProto?Ce.fromProto(a):Ce.fromOrtTensor(a);if(o===oe.onnx.AttributeProto.AttributeType.TENSORS){if(e instanceof oe.onnx.AttributeProto)return a.map(l=>Ce.fromProto(l));if(e instanceof dt.Attribute)return a.map(l=>Ce.fromOrtTensor(l))}return o===oe.onnx.AttributeProto.AttributeType.STRING&&e instanceof oe.onnx.AttributeProto?ln(a):o===oe.onnx.AttributeProto.AttributeType.STRINGS&&e instanceof oe.onnx.AttributeProto?a.map(ln):a}static getValueNoCheck(e){return e instanceof oe.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(e):this.getValueNoCheckFromOrtFormat(e)}static getValueNoCheckFromOnnxFormat(e){switch(e.type){case oe.onnx.AttributeProto.AttributeType.FLOAT:return e.f;case oe.onnx.AttributeProto.AttributeType.INT:return e.i;case oe.onnx.AttributeProto.AttributeType.STRING:return e.s;case oe.onnx.AttributeProto.AttributeType.TENSOR:return e.t;case oe.onnx.AttributeProto.AttributeType.GRAPH:return e.g;case oe.onnx.AttributeProto.AttributeType.FLOATS:return e.floats;case oe.onnx.AttributeProto.AttributeType.INTS:return e.ints;case oe.onnx.AttributeProto.AttributeType.STRINGS:return e.strings;case oe.onnx.AttributeProto.AttributeType.TENSORS:return e.tensors;case oe.onnx.AttributeProto.AttributeType.GRAPHS:return e.graphs;default:throw new Error(`unsupported attribute type: ${oe.onnx.AttributeProto.AttributeType[e.type]}`)}}static getValueNoCheckFromOrtFormat(e){switch(e.type()){case dt.AttributeType.FLOAT:return e.f();case dt.AttributeType.INT:return e.i();case dt.AttributeType.STRING:return e.s();case dt.AttributeType.TENSOR:return e.t();case dt.AttributeType.GRAPH:return e.g();case dt.AttributeType.FLOATS:return e.floatsArray();case dt.AttributeType.INTS:{let o=[];for(let a=0;a<e.intsLength();a++)o.push(e.ints(a));return o}case dt.AttributeType.STRINGS:{let o=[];for(let a=0;a<e.stringsLength();
1805a++)o.push(e.strings(a));return o}case dt.AttributeType.TENSORS:{let o=[];for(let a=0;a<e.tensorsLength();a++)o.push(e.tensors(a));return o}default:throw new Error(`unsupported attribute type: ${dt.AttributeType[e.type()]}`)}}}}),Ji,_o,Zi,Rt,Oo,Ki,xp=E(()=>{Tp(),nn(),Ji=Er($r()),br(),fe(),_o=W.experimental.fbs,Zi={from:(t,e)=>new Ki(t,e)},Rt=class{constructor(t){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,t&&(this.type=Ve.tensorValueTypeFromProto(t.type.tensorType))}get from(){return this._from}get to(){return this._to}},Oo=class{constructor(t,e){t instanceof Ji.onnx.NodeProto?(this.name=t.name,this.opType=t.opType,this.attributes=new gn(t.attribute)):t instanceof _o.Node&&(this.name=e??t.name(),this.opType=t.opType(),this.attributes=new gn(Ve.tensorAttributesFromORTFormat(t))),this.inputs=[],this.outputs=[],this.executeNode=!0}},Ki=class{constructor(t,e){if(!t)throw new 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 Ji.onnx.GraphProto)this.buildGraphFromOnnxFormat(t);else{if(!(t instanceof _o.Graph))throw new 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 o=new Map;if(!t.input)throw new Error("missing information in graph: input");let a=[];for(let l of t.input){if(e.has(l.name))throw new Error(`duplicated input name: ${l.name}`);let f=this._allData.push(new Rt(l))-1;e.set(l.name,f),a.push(l.name)}if(!t.initializer)throw new Error("missing information in graph: initializer");for(let l of t.initializer){let f=e.get(l.name);if(f===void 0){let d=new Rt;d.type={shape:{dims:Ve.tensorDimsFromProto(l.dims)},tensorType:Ve.tensorDataTypeFromProto(l.dataType)},f=this._allData.push(d)-1,e.set(l.name,f)}this._allData[f]._from=-1,this._allData[f].tensor=Ce.fromProto(l)}for(let l=0;l<this._allData.length;l++)this._allData[l].tensor||(this._allInputIndices.push(l),this._allInputNames.push(a[l]));if(!t.output)throw new Error("missing information in graph: output");for(let l of t.output){if(e.has(l.name))throw new Error(`duplicated output name: ${l.name}`);let f=this._allData.push(new Rt(l))-1;e.set(l.name,f),this._allOutputIndices.push(f),this._allOutputNames.push(l.name)}if(!t.node)throw new Error("missing information in graph: node");for(let l of t.node){if(!l.name)for(let d=0;;d++){let p=`unnamed_${l.opType}_${d}`;if(!o.has(p)){l.name=p;break}}if(o.has(l.name))throw new Error(`duplicated node name: ${l.name}`);let f=this._nodes.push(new Oo(l))-1;o.set(l.name,f)}for(let l=0;l<this._nodes.length;l++){let f=this._nodes[l],d=t.node[l];if(!d.output)throw new Error(`missing output for node: ${d.name}`);for(let p of d.output){let h=e.get(p);if(typeof h>"u"&&(h=this._allData.push(new Rt)-1,e.set(p,h)),f.outputs.push(h),this._allData[h]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${h}`);
1805if(this._allData[h]._from=l,d.opType==="Constant"){if(!d.attribute||d.attribute.length!==1||!d.attribute[0].t)throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(!d.output||d.output.length!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");f.outputs.pop(),f.executeNode=!1,this._allData[h]._from=-1,this._allData[h].tensor=Ce.fromProto(d.attribute[0].t)}}}for(let l=0;l<this._nodes.length;l++){let f=this._nodes[l],d=t.node[l];if(!d.input)throw new Error(`missing input for node: ${d.name}`);for(let p of d.input){let h=e.get(p);if(typeof h>"u"){if(p===""&&(d.input.length===3||d.input.length===4)&&d.opType==="Resize")continue;throw new Error(`unrecognized input '${p}' for node: ${d.name}`)}f.inputs.push(h),this._allData[h]._to.push(l)}}return!0}buildGraphFromOrtFormat(t){var l,f,d;let e=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let o=new Map,a=[];for(let p=0;p<t.inputsLength();p++){let h=t.inputs(p);if(e.has(h))throw new Error(`duplicated input name: ${h}`);for(let n=0;n<t.nodeArgsLength();n++)if(((l=t.nodeArgs(n))==null?void 0:l.name())===h){let c=new Rt;if(((d=(f=t.nodeArgs(n))==null?void 0:f.type())==null?void 0:d.valueType())!==_o.TypeInfoValue.tensor_type)throw new Error("Unexpected value type for the nodeArg.");let r=t.nodeArgs(n).type().value(new _o.TensorTypeAndShape),s=Ve.tensorDataTypeFromProto(r.elemType()),u=r.shape(),g=[];for(let S=0;S<u.dimLength();S++)g.push(nt.longToNumber(u.dim(S).value().dimValue()));c.type={shape:{dims:g},tensorType:s};let y=this._allData.push(c)-1;e.set(h,y),a.push(h)}}for(let p=0;p<t.initializersLength();p++){let h=t.initializers(p),n=e.get(h.name());if(n===void 0){let c=new Rt,r=Ve.tensorDimsFromORTFormat(h),s=Ve.tensorDataTypeFromProto(h.dataType());c.type={shape:{dims:r},tensorType:s},n=this._allData.push(c)-1,e.set(h.name(),n)}this._allData[n]._from=-1,this._allData[n].tensor=Ce.fromOrtTensor(h)}for(let p=0;p<this._allData.length;p++)this._allData[p].tensor||(this._allInputIndices.push(p),this._allInputNames.push(a[p]));for(let p=0;p<t.outputsLength();p++){let h=t.outputs(p);if(e.has(h))throw new Error(`duplicated output name: ${h}`);let n=this._allData.push(new Rt)-1;e.set(h,n),this._allOutputIndices.push(n),this._allOutputNames.push(h)}if(!t.nodes)throw new Error("missing information in graph: node");for(let p=0;p<t.nodesLength();p++){let h=t.nodes(p),n=h.name();if(!n)for(let r=0;n=`unnamed_${h.opType()}_${r}`,o.has(n);r++);if(o.has(n))throw new Error(`duplicated node name: ${n}`);let c=this._nodes.push(new Oo(h,n))-1;o.set(n,c)}for(let p=0;p<this._nodes.length;p++){let h=this._nodes[p],n=t.nodes(p);if(n==null)throw new Error(`No node exists at index ${p}`);if((n==null?void 0:n.outputsLength())===0)throw new Error(`missing output for node: ${n.name}`);for(let c=0;c<(n==null?void 0:n.outputsLength());c++){let r=n==null?void 0:n.outputs(c),s=e.get(r);if(typeof s>"u"&&(s=this._allData.push(new Rt)-1,e.set(r,s)),h.outputs.push(s),this._allData[s]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${s}`);if(this._allData[s]._from=p,n.opType()==="Constant"){if(n.attributesLength()!==1||!n.attributes(0).t())throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(n.outputsLength()!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");h.outputs.pop(),h.executeNode=!1,this._allData[s]._from=-1,this._allData[s].tensor=Ce.fromOrtTensor(n.attributes(0).t())}}}for(let p=0;p<this._nodes.length;p++){let h=this._nodes[p],n=t.nodes(p);if(n.inputsLength()===0)throw new Error(`missing input for node: ${n.name}`);for(let c=0;c<n.inputsLength();c++){let r=n.inputs(c),s=e.get(r);if(typeof s>"u")throw new Error(`unrecognized input '${r}' for node: ${n.name()}`);h.inputs.push(s),this._allData[s]._to.push(p)}}}checkIsAcyclic(){let t=new Set;this._allInputIndices.forEach(a=>{this._allData[a]._to.forEach(l=>{t.add(l)})});let e=Array.from(t),o=new Array(this._nodes.length).fill("white");for(;e.length>0;){let a=e.pop();o[a]==="gray"?o[a]="black":(e.push(a),o[a]="gray",this._nodes[a].outputs.forEac
1805h(l=>{let f=this._allData[l];if(typeof f.tensor<"u")throw new Error("node outputs should not be initialized");if(f._from!==a)throw new Error("from property of the Value object doesn't match index of Node being processed");f._to.forEach(d=>{if(o[d]==="gray")throw new Error("model graph is cyclic");o[d]==="white"&&e.push(d)})}))}}transformGraph(t){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),t&&t.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let t=0,e=new Array(this._nodes.length,0),o=0;for(let a=0;a<this._nodes.length;a++)e[a]=o,this._nodes[a].executeNode?(o!==a&&(this._nodes[o]=this._nodes[a]),o++):this._nodes[a].outputs.forEach(l=>{this._allData[l]._from=-2});this._nodes.splice(o,this._nodes.length-o);for(let a=0;a<this._allData.length;a++){let l=this._allData[a];l._from!==void 0&&l._from!==-1&&l._from!==-2&&(l._from=e[l._from]);for(let f=0;f<l._to.length;f++){if(!(l._to[f]>=0))throw new Error("Trying to update a removed node");l._to[f]=e[l._to[f]]}}t=0;for(let a=0;a<this._allData.length;a++)if(this._allData[a].from!==-2||this._allOutputIndices.indexOf(a+t)!==-1){if(t>0){let l=-1;this._allData[a].from!==void 0&&this._allData[a].from!==-1?(l=this._nodes[this._allData[a].from].outputs.indexOf(a+t),l!==-1&&(this._nodes[this._allData[a].from].outputs[l]=a)):(l=this._allInputIndices.indexOf(a+t),l!==-1&&(this._allInputIndices[l]=a)),this._allData[a].to.forEach(f=>{l=this._nodes[f].inputs.indexOf(a+t),l!==-1&&(this._nodes[f].inputs[l]=a)}),this._allData[a].to.length===0&&(l=this._allOutputIndices.indexOf(a+t),l!==-1&&(this._allOutputIndices[l]=a))}}else t++,this._allData.splice(a,1),a--}deleteNode(t){let e=this._nodes[t];if(e.outputs.length>1){for(let d=1;d<e.outputs.length;d++)if(this._allData[e.outputs[d]].to.length>0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}e.executeNode=!1;let o=e.inputs[0],a=e.outputs[0],l=this._allData[a].to;for(let d=0;d<e.inputs.length;d++){let p=this._allData[e.inputs[d]].to.indexOf(t);if(p===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[e.inputs[d]].to.splice(p,1)}this._allData[a]._to=[];let f=this._allOutputIndices.indexOf(a);if(f!==-1&&(this._allOutputIndices[f]=o),l&&l.length>0)for(let d of l){let p=this._nodes[d].inputs.indexOf(a);if(p===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[d].inputs[p]=o,this._allData[o].to.push(d)}}removeAllDropoutNodes(){let t=0;for(let e of this._nodes){if(e.opType==="Dropout"){if(e.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(e.outputs.length!==1&&e.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(e.outputs.length===2&&this._allData[e.outputs[1]]._to.length!==0)throw new 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)e.opType==="Identity"&&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(t.opType==="Conv"){let e=this._allData[t.outputs[0]]._to;if(e.length===1&&this.isActivation(this._nodes[e[0]])){let o=this._nodes[e[0]];if(o.opType==="Clip")if(o.inputs.length===1)try{t.attributes.set("activation_params","floats",[o.attributes.getFloat("min"),o.attributes.getFloat("max")])}catch{t.attributes.set("activation_params","floats",[hr,mr])}else{if(!(o.inputs.length>=3&&this._allData[o.inputs[1]].tensor!==void 0&&this._allData[o.inputs[2]].tensor!==void 0))continue;t.attributes.set("activation_params","floats",[this._allData[o.inputs[1]].tensor.floatData[0],this._allData[o.inputs[2]].tensor.floatData[0]])}t.attributes.set("activation","string",o.opType),this.deleteNode(e[0])}}}}}),wp,tg,Io,vp=E(()=>{Wn(),xp(),nn(),wp=Er($r()),fe(),tg=W.experimental.fbs,Io=class{constructor(){}load(t,e,o){if(!o)try{return void this.loadFromOnnxFormat(t,e)}catch(a){if(o!==void 0)throw a}this.loadFromOrtFormat(t,e)}loadFromOnnxFormat(t,e){let o=wp.onnx.ModelProto.decode(t);if(nt.longToNumber(o.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=o.opsetImport.map(a=>({domain:a.domain,version:nt.longToNumber(a.version)})),this._graph=Zi.from(o.graph,e)}loadFromOrtFormat(t,e){let o=new O.ByteBuffer(t),a=tg.InferenceSession.getRootAsInferenceSession(o).model();if(nt.longToNumber(a.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let l=0;l<a.opsetImportLength();l++){let f=a.opsetImport(l);this._opsets.push({domain:f==null?void 0:f.domain(),version:nt.longToNumber(f.version())})}this._graph=Zi.from(a.graph(),e)}get graph(){return this._graph}get opsets(){return this._opsets}}}),So,_p=E(()=>{gp(),yp(),at(),vp(),So=class{constructor(t={}){this._initialized=!1,this.backendHint=t.backendHint,this.profiler=zn.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()}
1805async loadModel(t,e,o){await this.profiler.event("session","Session.loadModel",async()=>{let a=await Yi(this.backendHint);if(this.sessionHandler=a.createSessionHandler(this.context),this._model=new Io,typeof t=="string"){let l=t.endsWith(".ort");if(typeof dist.process<"u"&&dist.process.versions&&dist.process.versions.node){let f=await(void 0)(t);this.initialize(f,l)}else{let f=await(await fetch(t)).arrayBuffer();this.initialize(new Uint8Array(f),l)}}else if(ArrayBuffer.isView(t))this.initialize(t);else{let l=new Uint8Array(t,e||0,o||t.byteLength);this.initialize(l)}})}initialize(t,e){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{let o=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(t,o,e),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new vo(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(t){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{let e=this.normalizeAndValidateInputs(t),o=await this._executionPlan.execute(this.sessionHandler,e);return this.createOutput(o)})}normalizeAndValidateInputs(t){let e=this._model.graph.getInputNames();if(Array.isArray(t)){if(t.length!==e.length)throw new Error(`incorrect input array length: expected ${e.length} but got ${t.length}`)}else{if(t.size!==e.length)throw new Error(`incorrect input map size: expected ${e.length} but got ${t.size}`);let o=new Array(t.size),a=0;for(let l=0;l<e.length;++l){let f=t.get(e[l]);if(!f)throw new Error(`missing input tensor for: '${name}'`);o[a++]=f}t=o}if(this.context.graphInputTypes&&this.context.graphInputTypes.length!==0&&this.context.graphInputDims&&this.context.graphInputDims.length!==0)this.validateInputTensorDims(this.context.graphInputDims,t,!1);else{let o=this._model.graph.getInputIndices(),a=this._model.graph.getValues(),l=new Array(o.length);for(let f=0;f<o.length;++f){let d=a[o[f]];l[f]=d.type.shape.dims,this.context.graphInputTypes.push(d.type.tensorType),this.context.graphInputDims.push(t[f].dims)}this.validateInputTensorDims(l,t,!0)}return this.validateInputTensorTypes(this.context.graphInputTypes,t),t}validateInputTensorTypes(t,e){for(let o=0;o<e.length;o++){let a=t[o],l=e[o].type;if(a!==l)throw new Error(`input tensor[${o}] check failed: expected type '${a}' but got ${l}`)}}validateInputTensorDims(t,e,o){for(let a=0;a<e.length;a++){let l=t[a],f=e[a].dims;if(!this.compareTensorDims(l,f,o))throw new Error(`input tensor[${a}] check failed: expected shape '[${l.join(",")}]' but got [${f.join(",")}]`)}}
1805compareTensorDims(t,e,o){if(t.length!==e.length)return!1;for(let a=0;a<t.length;++a)if(t[a]!==e[a]&&(!o||t[a]!==0))return!1;return!0}createOutput(t){let e=this._model.graph.getOutputNames();if(t.length!==e.length)throw new Error("expected number of outputs do not match number of generated outputs");let o=new Map;for(let a=0;a<e.length;++a)o.set(e[a],t[a]);return o}initializeOps(t){let e=t.getNodes();this._ops=new Array(e.length);for(let o=0;o<e.length;o++)this._ops[o]=this.sessionHandler.resolve(e[o],this._model.opsets,t)}}}),Ao,Op=E(()=>{Tt(),br(),Ao=class{constructor(t){this.session=t,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(t,e,o){let a=new Map;for(let d in t)if(Object.hasOwnProperty.call(t,d)){let p=t[d];a.set(d,new Ce(p.dims,p.type,void 0,void 0,p.data))}let l=await this.session.run(a),f={};return l.forEach((d,p)=>{f[p]=new Re(d.type,d.data,d.dims)}),f}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}}),Ip={};Pr(Ip,{onnxjsBackend:()=>ng});var ng,Sp=E(()=>{_p(),Op(),ng=new class{async init(){}async createInferenceSessionHandler(t,e){let o=new So(e);return await o.loadModel(t),new Ao(o)}}}),ea={};Pr(ea,{createReadStream:()=>Ap,readFile:()=>og,readFileSync:()=>ig});var og,ig,Ap,ta=E(()=>{og=void 0,ig=void 0,Ap=void 0}),ra={};Pr(ra,{join:()=>ag});var ag,na=E(()=>{ag=void 0}),Dp=me((t,e)=>{var o,a=(o=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(o=o||__filename),function(l={}){var f,d,p=l;p.ready=new Promise((v,P)=>{f=v,d=P});var h,n,c,r=Object.assign({},p),s="./this.program",u=typeof window=="object",g=typeof importScripts=="function",y=typeof dist.process=="object"&&typeof dist.process.versions=="object"&&typeof dist.process.versions.node=="string",S="";if(y){var A=(ta(),or(ea)),L=(na(),or(ra));S=g?L.dirname(S)+"/":__dirname+"/",h=(v,P)=>(v=_t(v)?new URL(v):L.normalize(v),A.readFileSync(v,P?void 0:"utf8")),c=v=>((v=h(v,!0)).buffer||(v=new Uint8Array(v)),v),n=(v,P,N,C=!0)=>{v=_t(v)?new URL(v):L.normalize(v),A.readFile(v,C?void 0:"utf8",(H,K)=>{H?N(H):P(C?K.buffer:K)})},!p.thisProgram&&1<dist.process.argv.length&&(s=dist.process.argv[1].replace(/\\/g,"/")),dist.process.argv.slice(2),p.inspect=()=>"[Emscripten Module object]"}else(u||g)&&(g?S=self.location.href:typeof document<"u"&&document.currentScript&&(S=document.currentScript.src),o&&(S=o),S=S.indexOf("blob:")!==0?S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1):"",h=v=>{var P=new XMLHttpRequest;return P.open("GET",v,!1),P.send(null),P.responseText},g&&(c=v=>{var P=new XMLHttpRequest;return P.open("GET",v,!1),P.responseType="arraybuffer",P.send(null),new Uint8Array(P.response)}),n=(v,P,N)=>{var C=new XMLHttpRequest;C.open("GET",v,!0),C.responseType="arraybuffer",C.onload=()=>{C.status==200||C.status==0&&C.response?P(C.response):N()},C.onerror=N,C.send(null)});var z=console.log.bind(console),et=console.error.bind(console);Object.assign(p,r),r=null,typeof WebAssembly!="object"&&Pt("no native wasm support detected");var Y,X,mt,J,At,Lt,ke=!1;function Be(){var v=Y.buffer;p.HEAP8=X=new Int8Array(v),p.HEAP16=new Int16Array(v),p.HEAPU8=mt=new Uint8Array(v),p.HEAPU16=new Uint16Array(v),p.HEAP32=J=new Int32Array(v),p.HEAPU32=At=new Uint32Array(v),p.HEAPF32=new Float32Array(v),p.HEAPF64=Lt=new Float64Array(v)}var Me=[],Dt=[],It=[],bt=0,Mt=null;function Pt(v){throw et(v="Aborted("+v+")"),ke=!0,v=new WebAssembly.RuntimeError(v+". Build with -sASSERTIONS for more info."),d(v),v}var Ie,ve=v=>v.startsWith("data:application/octet-stream;base64,"),_t=v=>v.startsWith("file://");if(!ve(Ie="ort-wasm.wasm")){var St=Ie;Ie=p.locateFile?p.locateFile(St,S):S+St}function ue(v){if(c)return c(v);throw"both async and sync fetching of the wasm failed"}function ne(v,P,N){return function(C){if(u||g){if(typeof fetch=="function"&&!_t(C))return fetch(C,{credentials:"same-origin"}).then(H=>{if(!H.ok)throw"failed to load wasm binary file at '"+C+"'";return H.arrayBuffer()}).catch(()=>ue(C));if(n)return new Promise((H,K)=>{n(C,lt=>H(new Uint8Array(lt)),K)})}return Promise.resolve().then(()=>ue(C))}(v).then(C=>WebAssembly.instantiate(C,P)).then(C=>C).then(N,C=>{et(`failed to asynchronously prepare wasm: ${C}`),Pt(C)})}var pe,Pe={920016:(v,P,N,C)=>{if(typeof p>"u"||!p.za)return 1;if((v=qt(v>>>0)).startsWith("./")&&(v=v.substring(2)),!(v=p.za.get(v)))return 2;if((P>>>=0)+(N>>>=0)>v.byteLength)return 3;try{return mt.set(v.subarray(P,P+N),C>>>0>>>0),0}catch{return 4}}};function ge(v){this.xa=v-24,this.Ha=function(P){At[this.xa+4>>>2>>>0]=P},this.Ga=function(P){At[this.xa+8>>>2>>>0]=P},this.Aa=function(P,N){this.Fa(),this.Ha(P),this.Ga(N)},this.Fa=function(){At[this.xa+16>>>2>>>0]=0}}var zt,de=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Et=(v,P,N)=>{var C=(P>>>=0)+N;for(N=P;v[N]&&!(N>=C);)++N;if(16<N-P&&v.buffer&&de)return de.decode(v.subarray(P,N));for(C="";P<N;){var H=v[P++];if(128&H){var K=63&v[P++];if((224&H)==192)C+=String.fromCharCode((31&H)<<6|K);else{var lt=63&v[P++];65536>(H=(240&H)==224?(15&H)<<12|K<<6|lt:(7&H)<<18|K<<12|lt<<6|63&v[P++])?C+=String.fromCharCode(H):(H-=65536,C+=String.fromCharCode(55296|H>>10,56320|1023&H))}}else C+=String.fromCharCode(H)}return C},qt=(v,P)=>(v>>>=0)?Et(mt,v,P):"",Yt=v=>{for(var P=0,N=0;N<v.length;++N){var C=v.charCodeAt(N);127>=C?P++:2047>=C?P+=2:55296<=C&&57343>=C?(P+=4,++N):P+=3}return P},Gt=(v,P,N,C)=>{if(!(0<C))return 0;var H=N>>>=0;C=N+C-1;for(var K=0;K<v.length;++K){var lt=v.charCodeAt(K);if(55296<=lt&&57343>=lt&&(lt=65536+((1023&lt)<<10)|1023&v.charCodeAt(++K)),127>=lt){if(N>=C)break;P[N++>>>0]=lt}else{if(2047>=lt){if(N+1>=C)break;P[N++>>>0]=192|lt>>6}else{if(65535>=lt){if(N+2>=C)break;P[N++>>>0]=224|lt>>12}else{if(N+3>=C)break;P[N++>>>0]=240|lt>>18,P[N++>>>0]=128|lt>>12&63}P[N++>>>0]=128|lt>>6&63}P[N++>>>0]=128|63&lt}}return P[N>>>0]=0,N-H},Kt=v=>v%4==0&&(v%100!=0||v%400==0),Ue=[0,31,60,91,121,152,182,213,244,274,305,335],qe=[0,31,59,90,120,151,181,212,243,273,304,334],ze=v=>{var P=Yt(v)+1,N=m(P);return N&&Gt(v,mt,N,P),N},Ee=[],He={},$e=()=>{if(!zt){var v,P={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(v in He)He[v]===void 0?delete P[v]:P[v]=He[v];var N=[];for(v in P)N.push(`${v}=${P[v]}`);zt=N}return zt},Fe=[null,[],[]],ie=[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];
1805function Ye(v,P,N,C){function H(M,yt,$t){for(M=typeof M=="number"?M.toString():M||"";M.length<yt;)M=$t[0]+M;return M}function K(M,yt){return H(M,yt,"0")}function lt(M,yt){function $t(rr){return 0>rr?-1:0<rr?1:0}var Ne;return(Ne=$t(M.getFullYear()-yt.getFullYear()))===0&&(Ne=$t(M.getMonth()-yt.getMonth()))===0&&(Ne=$t(M.getDate()-yt.getDate())),Ne}function Ut(M){switch(M.getDay()){case 0:return new Date(M.getFullYear()-1,11,29);case 1:return M;case 2:return new Date(M.getFullYear(),0,3);case 3:return new Date(M.getFullYear(),0,2);case 4:return new Date(M.getFullYear(),0,1);case 5:return new Date(M.getFullYear()-1,11,31);case 6:return new Date(M.getFullYear()-1,11,30)}}function he(M){var yt=M.ta;for(M=new Date(new Date(M.ua+1900,0,1).getTime());0<yt;){var $t=M.getMonth(),Ne=(Kt(M.getFullYear())?ie:Se)[$t];if(!(yt>Ne-M.getDate())){M.setDate(M.getDate()+yt);break}yt-=Ne-M.getDate()+1,M.setDate(1),11>$t?M.setMonth($t+1):(M.setMonth(0),M.setFullYear(M.getFullYear()+1))}return $t=new Date(M.getFullYear()+1,0,4),yt=Ut(new Date(M.getFullYear(),0,4)),$t=Ut($t),0>=lt(yt,M)?0>=lt($t,M)?M.getFullYear()+1:M.getFullYear():M.getFullYear()-1}v>>>=0,P>>>=0,N>>>=0;var se=At[(C>>>=0)+40>>>2>>>0];for(var Qt in C={Da:J[C>>>2>>>0],Ca:J[C+4>>>2>>>0],va:J[C+8>>>2>>>0],ya:J[C+12>>>2>>>0],wa:J[C+16>>>2>>>0],ua:J[C+20>>>2>>>0],oa:J[C+24>>>2>>>0],ta:J[C+28>>>2>>>0],Ia:J[C+32>>>2>>>0],Ba:J[C+36>>>2>>>0],Ea:se?qt(se):""},N=qt(N),se={"%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(Qt,"g"),se[Qt]);var tr="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),er="January February March April May June July August September October November December".split(" ");for(Qt in se={"%a":M=>tr[M.oa].substring(0,3),"%A":M=>tr[M.oa],"%b":M=>er[M.wa].substring(0,3),"%B":M=>er[M.wa],"%C":M=>K((M.ua+1900)/100|0,2),"%d":M=>K(M.ya,2),"%e":M=>H(M.ya,2," "),"%g":M=>he(M).toString().substring(2),"%G":M=>he(M),"%H":M=>K(M.va,2),"%I":M=>((M=M.va)==0?M=12:12<M&&(M-=12),K(M,2)),"%j":M=>{for(var yt=0,$t=0;$t<=M.wa-1;yt+=(Kt(M.ua+1900)?ie:Se)[$t++]);return K(M.ya+yt,3)},"%m":M=>K(M.wa+1,2),"%M":M=>K(M.Ca,2),"%n":()=>`
1806`,"%p":M=>0<=M.va&&12>M.va?"AM":"PM","%S":M=>K(M.Da,2),"%t":()=>"	","%u":M=>M.oa||7,"%U":M=>K(Math.floor((M.ta+7-M.oa)/7),2),"%V":M=>{var yt=Math.floor((M.ta+7-(M.oa+6)%7)/7);if(2>=(M.oa+371-M.ta-2)%7&&yt++,yt)yt==53&&(($t=(M.oa+371-M.ta)%7)==4||$t==3&&Kt(M.ua)||(yt=1));else{yt=52;var $t=(M.oa+7-M.ta-1)%7;($t==4||$t==5&&Kt(M.ua%400-1))&&yt++}return K(yt,2)},"%w":M=>M.oa,"%W":M=>K(Math.floor((M.ta+7-(M.oa+6)%7)/7),2),"%y":M=>(M.ua+1900).toString().substring(2),"%Y":M=>M.ua+1900,"%z":M=>(0<=(M=M.Ba)?"+":"-")+("0000"+((M=Math.abs(M)/60)/60*100+M%60)).slice(-4),"%Z":M=>M.Ea,"%%":()=>"%"},N=N.replace(/%%/g,"\0\0"),se)N.includes(Qt)&&(N=N.replace(new RegExp(Qt,"g"),se[Qt](C)));return Qt=function(M){var yt=Array(Yt(M)+1);return Gt(M,yt,0,yt.length),yt}(N=N.replace(/\0\0/g,"%")),Qt.length>P?0:(X.set(Qt,v>>>0),Qt.length-1)}var Te={a:function(v,P,N){throw new ge(v>>>=0).Aa(P>>>0,N>>>0),v},e:function(){return 0},H:function(){},x:function(){},z:function(){},J:function(){return 0},F:function(){},A:function(){},E:function(){},g:function(){},y:function(){},v:function(){},G:function(){},w:function(){},k:()=>1,n:function(v,P,N){v=P+2097152>>>0<4194305-!!v?(v>>>0)+4294967296*P:NaN,N>>>=0,v=new Date(1e3*v),J[N>>>2>>>0]=v.getUTCSeconds(),J[N+4>>>2>>>0]=v.getUTCMinutes(),J[N+8>>>2>>>0]=v.getUTCHours(),J[N+12>>>2>>>0]=v.getUTCDate(),J[N+16>>>2>>>0]=v.getUTCMonth(),J[N+20>>>2>>>0]=v.getUTCFullYear()-1900,J[N+24>>>2>>>0]=v.getUTCDay(),J[N+28>>>2>>>0]=(v.getTime()-Date.UTC(v.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},o:function(v,P,N){v=P+2097152>>>0<4194305-!!v?(v>>>0)+4294967296*P:NaN,N>>>=0,v=new Date(1e3*v),J[N>>>2>>>0]=v.getSeconds(),J[N+4>>>2>>>0]=v.getMinutes(),J[N+8>>>2>>>0]=v.getHours(),J[N+12>>>2>>>0]=v.getDate(),J[N+16>>>2>>>0]=v.getMonth(),J[N+20>>>2>>>0]=v.getFullYear()-1900,J[N+24>>>2>>>0]=v.getDay(),J[N+28>>>2>>>0]=(Kt(v.getFullYear())?Ue:qe)[v.getMonth()]+v.getDate()-1|0,J[N+36>>>2>>>0]=-60*v.getTimezoneOffset(),P=new Date(v.getFullYear(),6,1).getTimezoneOffset();var C=new Date(v.getFullYear(),0,1).getTimezoneOffset();J[N+32>>>2>>>0]=0|(P!=C&&v.getTimezoneOffset()==Math.min(C,P))},p:function(v){v>>>=0;var P=new Date(J[v+20>>>2>>>0]+1900,J[v+16>>>2>>>0],J[v+12>>>2>>>0],J[v+8>>>2>>>0],J[v+4>>>2>>>0],J[v>>>2>>>0],0),N=J[v+32>>>2>>>0],C=P.getTimezoneOffset(),H=new Date(P.getFullYear(),6,1).getTimezoneOffset(),K=new Date(P.getFullYear(),0,1).getTimezoneOffset(),lt=Math.min(K,H);return 0>N?J[v+32>>>2>>>0]=+(H!=K&&lt==C):0<N!=(lt==C)&&(H=Math.max(K,H),P.setTime(P.getTime()+6e4*((0<N?lt:H)-C))),J[v+24>>>2>>>0]=P.getDay(),J[v+28>>>2>>>0]=(Kt(P.getFullYear())?Ue:qe)[P.getMonth()]+P.getDate()-1|0,J[v>>>2>>>0]=P.getSeconds(),J[v+4>>>2>>>0]=P.getMinutes(),J[v+8>>>2>>>0]=P.getHours(),J[v+12>>>2>>>0]=P.getDate(),J[v+16>>>2>>>0]=P.getMonth(),J[v+20>>>2>>>0]=P.getYear(),v=P.getTime(),isNaN(v)?(J[x()>>>2>>>0]=61,v=-1):v/=1e3,T((pe=v,1<=+Math.abs(pe)?0<pe?+Math.floor(pe/4294967296)>>>0:~~+Math.ceil((pe-+(~~pe>>>0))/4294967296)>>>0:0)),v>>>0},l:function(){return-52},m:function(){}
1806,t:function(v,P,N){function C(he){return(he=he.toTimeString().match(/\(([A-Za-z ]+)\)$/))?he[1]:"GMT"}N>>>=0;var H=new Date().getFullYear(),K=new Date(H,0,1),lt=new Date(H,6,1);H=K.getTimezoneOffset();var Ut=lt.getTimezoneOffset();At[v>>>0>>>2>>>0]=60*Math.max(H,Ut),J[P>>>0>>>2>>>0]=+(H!=Ut),v=C(K),P=C(lt),v=ze(v),P=ze(P),Ut<H?(At[N>>>2>>>0]=v,At[N+4>>>2>>>0]=P):(At[N>>>2>>>0]=P,At[N+4>>>2>>>0]=v)},d:()=>{Pt("")},B:function(v,P,N){v>>>=0,P>>>=0,N>>>=0,Ee.length=0;for(var C;C=mt[P++>>>0];){var H=C!=105;N+=(H&=C!=112)&&N%8?4:0,Ee.push(C==112?At[N>>>2>>>0]:C==105?J[N>>>2>>>0]:Lt[N>>>3>>>0]),N+=H?8:4}return Pe[v].apply(null,Ee)},h:()=>Date.now(),u:function(){return 4294901760},b:()=>performance.now(),I:function(v,P,N){return P>>>=0,mt.copyWithin(v>>>0>>>0,P>>>0,P+(N>>>0)>>>0)},s:function(v){v>>>=0;var P=mt.length;if(4294901760<v)return!1;for(var N=1;4>=N;N*=2){var C=P*(1+.2/N);C=Math.min(C,v+100663296);var H=Math;C=Math.max(v,C);t:{H=(H.min.call(H,4294901760,C+(65536-C%65536)%65536)-Y.buffer.byteLength+65535)/65536;try{Y.grow(H),Be();var K=1;break t}catch{}K=void 0}if(K)return!0}return!1},C:function(v,P){v>>>=0,P>>>=0;var N=0;return $e().forEach((C,H)=>{var K=P+N;for(H=At[v+4*H>>>2>>>0]=K,K=0;K<C.length;++K)X[H++>>>0>>>0]=C.charCodeAt(K);X[H>>>0>>>0]=0,N+=C.length+1}),0},D:function(v,P){v>>>=0,P>>>=0;var N=$e();At[v>>>2>>>0]=N.length;var C=0;return N.forEach(H=>C+=H.length+1),At[P>>>2>>>0]=C,0},f:()=>52,j:function(){return 52},q:function(){return 70},i:function(v,P,N,C){P>>>=0,N>>>=0,C>>>=0;for(var H=0,K=0;K<N;K++){var lt=At[P>>>2>>>0],Ut=At[P+4>>>2>>>0];P+=8;for(var he=0;he<Ut;he++){var se=mt[lt+he>>>0],Qt=Fe[v];se===0||se===10?((v===1?z:et)(Et(Qt,0)),Qt.length=0):Qt.push(se)}H+=Ut}return At[C>>>2>>>0]=H,0},r:Ye,c:function(v,P,N,C){return Ye(v>>>0,P>>>0,N>>>0,C>>>0)}},ot=function(){function v(N){return ot=N.exports,ot=function(){var C=ot;C=Object.assign({},C);var H=lt=>()=>lt()>>>0,K=lt=>Ut=>lt(Ut)>>>0;return C.la=H(C.la),C.ma=K(C.ma),C.qa=H(C.qa),C.sa=K(C.sa),C}(),Y=ot.K,Be(),Dt.unshift(ot.L),--bt==0&&Mt&&(N=Mt,Mt=null,N()),ot}var P={a:Te};if(bt++,p.instantiateWasm)try{return p.instantiateWasm(P,v)}catch(N){et(`Module.instantiateWasm callback failed with error: ${N}`),d(N)}return function(N,C){var H=Ie;return typeof WebAssembly.instantiateStreaming!="function"||ve(H)||_t(H)||y||typeof fetch!="function"?ne(H,N,C):fetch(H,{credentials:"same-origin"}).then(K=>WebAssembly.instantiateStreaming(K,N).then(C,function(lt){return et(`wasm streaming compile failed: ${lt}`),et("falling back to ArrayBuffer instantiation"),ne(H,N,C)}))}(P,function(N){v(N.instance)}).catch(d),{}}();p._OrtInit=(v,P)=>(p._OrtInit=ot.M)(v,P),p._OrtGetLastError=(v,P)=>(p._OrtGetLastError=ot.N)(v,P),p._OrtCreateSessionOptions=(v,P,N,C,H,K,lt,Ut,he,se)=>(p._OrtCreateSessionOptions=ot.O)(v,P,N,C,H,K,lt,Ut,he,se),p._OrtAppendExecutionProvider=(v,P)=>(p._OrtAppendExecutionProvider=ot.P)(v,P),p._OrtAddFreeDimensionOverride=(v,P,N)=>(p._OrtAddFreeDimensionOverride=ot.Q)(v,P,N),p._OrtAddSessionConfigEntry=(v,P,N)=>(p._OrtAddSessionConfigEntry=ot.R)(v,P,N),p._OrtReleaseSessionOptions=v=>(p._OrtReleaseSessionOptions=ot.S)(v),p._OrtCreateSession=(v,P,N)=>(p._OrtCreateSession=ot.T)(v,P,N),p._OrtReleaseSession=v=>(p._OrtReleaseSession=ot.U)(v),p._OrtGetInputOutputCount=(v,P,N)=>(p._OrtGetInputOutputCount=ot.V)(v,P,N),p._OrtGetInputName=(v,P)=>(p._OrtGetInputName=ot.W)(v,P),p._OrtGetOutputName=(v,P)=>(p._OrtGetOutputName=ot.X)(v,P),p._OrtFree=v=>(p._OrtFree=ot.Y)(v),p._OrtCreateTensor=(v,P,N,C,H,K)=>(p._OrtCreateTensor=ot.Z)(v,P,N,C,H,K),p._OrtGetTensorData=(v,P,N,C,H)=>(p._OrtGetTensorData=ot._)(v,P,N,C,H),p._OrtReleaseTensor=v=>(p._OrtReleaseTensor=ot.$)(v),p._OrtCreateRunOptions=(v,P,N,C)=>(p._OrtCreateRunOptions=ot.aa)(v,P,N,C),p._OrtAddRunConfigEntry=(v,P,N)=>(p._OrtAddRunConfigEntry=ot.ba)(v,P,N),p._OrtReleaseRunOptions=v=>(p._OrtReleaseRunOptions=ot.ca)(v),p._OrtCreateBinding=v=>(p._OrtCreateBinding=ot.da)(v),p._OrtBindInput=(v,P,N)=>(p._OrtBindInput=ot.ea)(v,P,N),p._OrtBindOutput=(v,P,N,C)=>(p._OrtBindOutput=ot.fa)(v,P,N,C),p._OrtClearBoundOutputs=v=>(p._OrtClearBoundOutputs=ot.ga)(v),p._OrtReleaseBinding=v=>(p._OrtReleaseBinding=ot.ha)(v),p._OrtRunWithBinding=(v,P,N,C,H)=>(p._OrtRunWithBinding=ot.ia)(v,P,N,C,H),p._OrtRun=(v,P,N,C,H,K,lt,Ut)=>(p._OrtRun=ot.ja)(v,P,N,C,H,K,lt,Ut),p._OrtEndProfiling=v=>(p._OrtEndProfiling=ot.ka)(v);var x=()=>(x=ot.la)(),m=p._malloc=v=>(m=p._malloc=ot.ma)(v);p._free=v=>(p._free=ot.na)(v);var b,T=v=>(T=ot.pa)(v),F=()=>(F=ot.qa)(),D=v=>(D=ot.ra)(v),V=v=>(V=ot.sa)(v);function gt(){if(!(0<bt)){if(p.preRun)for(typeof p.preRun=="function"&&(p.preRun=[p.preRun]);p.preRun.length;){var v=p.preRun.shift();Me.unshift(v)}for(;0<Me.length;)Me.shift()(p);if(!(0<bt||b||(b=!0,p.calledRun=!0,ke))){for(;0<Dt.length;)Dt.shift()(p);for(f(p);0<It.length;)It.shift()(p)}}}return p.stackAlloc=V,p.stackSave=F,p.stackRestore=D,p.UTF8ToString=qt,p.stringToUTF8=(v,P,N)=>Gt(v,mt,P,N),p.lengthBytesUTF8=Yt,Mt=function v(){b||gt(),b||(Mt=v)},gt(),l.ready});typeof t=="object"&&typeof e=="object"?e.exports=a:typeof define=="function"&&define.amd&&define([],()=>a)}),Lp=me(()=>{}),Fp=me(()=>{}),Cp={};Pr(Cp,{cpus:()=>sg});var sg,$p=E(()=>{sg=void 0}),Np=me((t,e)=>{var o,a=(o=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(o=o||__filename),function(l={}){function f(){return It.buffer!=Pt.buffer&&ne(),Pt}function d(){return It.buffer!=Pt.buffer&&ne(),Ie}function p(){return It.buffer!=Pt.buffer&&ne(),ve}function h(){return It.buffer!=Pt.buffer&&ne(),_t}function n(){return It.buffer!=Pt.buffer&&ne(),St}var c,r,s=l;s.ready=new Promise((w,_)=>{c=w,r=_});var u,g,y,S=Object.assign({},s),A="./this.program",L=(w,_)=>{throw _},z=typeof window=="object",et=typeof importScripts=="function",Y=typeof dist.process=="object"&&typeof dist.process.versions=="object"&&typeof dist.process.versions.node=="string",X=s.ENVIRONMENT_IS_PTHREAD||!1,mt="";function J(w){return s.locateFile?s.locateFile(w,mt):mt+w}if(Y){var At=(ta(),or(ea)),Lt=(na(),or(ra));let w;mt=et?Lt.dirname(mt)+"/":__dirname+"/",u=(_,I)=>(_=Ue(_)?new URL(_):Lt.normalize(_),At.readFileSync(_,I?void 0:"utf8")),y=_=>((_=u(_,!0)).buffer||(_=new Uint8Array(_)),_),g=(_,I,k,B=!0)=>{_=Ue(_)?new URL(_):Lt.normalize(_),At.readFile(_,B?void 0:"utf8",(G,Q)=>{G?k(G):I(B?Q.buffer:Q)})},!s.thisProgram&&1<dist.process.argv.length&&(A=dist.process.argv[1].replace(/\\/g,"/")),dist.process.argv.slice(2),L=(_,I)=>{throw dist.process.exitCode=_,I},s.inspect=()=>"[Emscripten Module object]";try{w=Lp()}catch(_){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),_}dist.global.Worker=w.Worker}else(z||et)&&(et?mt=self.location.href:typeof document<"u"&&document.currentScript&&(mt=document.currentScript.src),typeof o<"u"&&o&&(mt=o),mt=mt.indexOf("blob:")!==0?mt.substr(0,mt.replace(/[?#].*/,"").lastIndexOf("/")+1):"",Y||(u=w=>{var _=new XMLHttpRequest;return _.open("GET",w,!1),_.send(null),_.responseText},et&&(y=w=>{var _=new XMLHttpRequest;return _.open("GET",w,!1),_.responseType="arraybuffer",_.send(null),new Uint8Array(_.response)}),g=(w,_,I)=>{var k=new XMLHttpRequest;k.open("GET",w,!0),k.responseType="arraybuffer",k.onload=()=>{k.status==200||k.status==0&&k.response?_(k.response):I()},k.onerror=I,k.send(null)}));Y&&typeof performance>"u"&&(dist.global.performance=Fp().performance);var ke=console.log.bind(console),Be=console.error.bind(console);Y&&(ke=(...w)=>At.writeSync(1,w.join(" ")+`
1807`),Be=(...w)=>At.writeSync(2,w.join(" ")+`
1808`));var Me=ke,Dt=Be;Object.assign(s,S),S=null,typeof WebAssembly!="object"&&Yt("no native wasm support detected");var It,bt,Mt,Pt,Ie,ve,_t,St,ue=!1;function ne(){var w=It.buffer;s.HEAP8=Pt=new Int8Array(w),s.HEAP16=new Int16Array(w),s.HEAPU8=Ie=new Uint8Array(w),s.HEAPU16=new Uint16Array(w),s.HEAP32=ve=new Int32Array(w),s.HEAPU32=_t=new 
1808Uint32Array(w),s.HEAPF32=new Float32Array(w),s.HEAPF64=St=new Float64Array(w)}var pe=16777216;if(X)It=s.wasmMemory;else if(s.wasmMemory)It=s.wasmMemory;else if(!((It=new WebAssembly.Memory({initial:pe/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw Dt("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"),Y&&Dt("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");ne(),pe=It.buffer.byteLength;var Pe=[],ge=[],zt=[],de=0,Et=null;function qt(){if(--de==0&&Et){var w=Et;Et=null,w()}}function Yt(w){throw Dt(w="Aborted("+w+")"),ue=!0,Mt=1,w=new WebAssembly.RuntimeError(w+". Build with -sASSERTIONS for more info."),r(w),w}var Gt,Kt=w=>w.startsWith("data:application/octet-stream;base64,"),Ue=w=>w.startsWith("file://");function qe(w){if(y)return y(w);throw"both async and sync fetching of the wasm failed"}function ze(w,_,I){return function(k){if(z||et){if(typeof fetch=="function"&&!Ue(k))return fetch(k,{credentials:"same-origin"}).then(B=>{if(!B.ok)throw"failed to load wasm binary file at '"+k+"'";return B.arrayBuffer()}).catch(()=>qe(k));if(g)return new Promise((B,G)=>{g(k,Q=>B(new Uint8Array(Q)),G)})}return Promise.resolve().then(()=>qe(k))}(w).then(k=>WebAssembly.instantiate(k,_)).then(k=>k).then(I,k=>{Dt(`failed to asynchronously prepare wasm: ${k}`),Yt(k)})}Kt(Gt="ort-wasm-threaded.wasm")||(Gt=J(Gt));var Ee,He={921388:(w,_,I,k)=>{if(typeof s>"u"||!s.cb)return 1;if((w=ot(w>>>0)).startsWith("./")&&(w=w.substring(2)),!(w=s.cb.get(w)))return 2;if(k>>>=0,(_>>>=0)+(I>>>=0)>w.byteLength)return 3;try{return d().set(w.subarray(_,_+I),k>>>0),0}catch{return 4}}};function $e(w){this.name="ExitStatus",this.message=`Program terminated with exit(${w})`,this.status=w}var Fe=w=>{w.terminate(),w.onmessage=()=>{}},ie=w=>{D.Pa.length==0&&(F(),D.Ya(D.Pa[0]));var _=D.Pa.pop();if(!_)return 6;D.Qa.push(_),D.Ma[w.Oa]=_,_.Oa=w.Oa;var I={cmd:"run",start_routine:w.kb,arg:w.hb,pthread_ptr:w.Oa};return Y&&_.unref(),_.postMessage(I,w.qb),0},Se=0,Ye=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Te=(w,_,I)=>{var k=(_>>>=0)+I;for(I=_;w[I]&&!(I>=k);)++I;if(16<I-_&&w.buffer&&Ye)return Ye.decode(w.buffer instanceof SharedArrayBuffer?w.slice(_,I):w.subarray(_,I));for(k="";_<I;){var B=w[_++];if(128&B){var G=63&w[_++];if((224&B)==192)k+=String.fromCharCode((31&B)<<6|G);else{var Q=63&w[_++];65536>(B=(240&B)==224?(15&B)<<12|G<<6|Q:(7&B)<<18|G<<12|Q<<6|63&w[_++])?k+=String.fromCharCode(B):(B-=65536,k+=String.fromCharCode(55296|B>>10,56320|1023&B))}}else k+=String.fromCharCode(B)}return k},ot=(w,_)=>(w>>>=0)?Te(d(),w,_):"";function x(w,_){var I=arguments.length-2,k=arguments;return(B=>{var G=Qr();return B=B(),Ar(G),B})(()=>{for(var B=en(8*I),G=B>>>3,Q=0;Q<I;Q++){var Ft=k[2+Q];n()[G+Q>>>0]=Ft}return ci(w,I,B,_)})}function m(w){var _;if(X)return x(0,1,w);Mt=w,0<Se||(D.lb(),(_=s.onExit)==null||_.call(s,w),ue=!0),L(w,new $e(w))}var b=w=>{if(Mt=w,X)throw gt(w),"unwind";m(w)};function T(){for(var w=s.numThreads;w--;)F();Pe.unshift(()=>{de++,function(_){X?_():Promise.all(D.Pa.map(D.Ya)).then(_)}(()=>qt())})}function F(){var w=J("ort-wasm-threaded.worker.js");w=new Worker(w),D.Pa.push(w)}var D={Pa:[],Qa:[],bb:[],Ma:{},Wa(){X?(D.receiveObjectTransfer=D.jb,D.threadInitTLS=D.ab,D.setExitStatus=D.$a):T()},$a:w=>Mt=w,tb:["$terminateWorker"],lb:()=>{for(var w of D.Qa)Fe(w);for(w of D.Pa)Fe(w);D.Pa=[],D.Qa=[],D.Ma=[]},Za:w=>{var _=w.Oa;delete D.Ma[_],D.Pa.push(w),D.Qa.splice(D.Qa.indexOf(w),1),w.Oa=0,Jr(_)},jb(){},ab(){D.bb.forEach(w=>w())},Ya:w=>new Promise(_=>{w.onmessage=B=>{var G=(B=B.data).cmd;if(B.targetThread&&B.targetThread!=Or()){var Q=D.Ma[B.targetThread];Q?Q.postMessage(B,B.transferList):Dt(`Internal error! Worker sent a message "${G}" to target pthread ${B.targetThread}, but that thread no longer exists!`)}else G==="checkMailbox"?_r():G==="spawnThread"?ie(B):G==="cleanupThread"?D.Za(D.Ma[B.thread]):G==="killThread"?(B=B.thread,G=D.Ma[B],delete D.Ma[B],Fe(G),Jr(B),D.Qa.splice(D.Qa.indexOf(G),1),G.Oa=0):G==="cancelThread"?D.Ma[B.thread].postMessage({cmd:"cancel"}):G==="loaded"?(w.loaded=!0,Y&&!w.Oa&&w.unref(),_(w)):G==="alert"?alert(`Thread ${B.threadId}: ${B.text}`):B.target==="setimmediate"?w.postMessage(B):G==="callHandler"?s[B.handler](...B.args):G&&Dt(`worker sent an unknown command ${G}`)},w.onerror=B=>{throw Dt(`worker sent an error! ${B.filename}:${B.lineno}: ${B.message}`),B},Y&&(w.on("message",B=>w.onmessage({data:B})),w.on("error",B=>
1808w.onerror(B)));var I,k=[];for(I of["onExit"])s.hasOwnProperty(I)&&k.push(I);w.postMessage({cmd:"load",handlers:k,urlOrBlob:s.mainScriptUrlOrBlob||o,wasmMemory:It,wasmModule:bt})})};s.PThread=D;var V=w=>{for(;0<w.length;)w.shift()(s)};function gt(w){if(X)return x(1,0,w);b(w)}s.establishStackSpace=()=>{var w=Or(),_=h()[w+52>>>2>>>0];w=h()[w+56>>>2>>>0],Qi(_,_-w),Ar(_)};var v,P=[];function N(w){this.Va=w-24,this.gb=function(_){h()[this.Va+4>>>2>>>0]=_},this.fb=function(_){h()[this.Va+8>>>2>>>0]=_},this.Wa=function(_,I){this.eb(),this.gb(_),this.fb(I)},this.eb=function(){h()[this.Va+16>>>2>>>0]=0}}function C(w,_,I,k){return X?x(2,1,w,_,I,k):H(w,_,I,k)}function H(w,_,I,k){if(w>>>=0,_>>>=0,I>>>=0,k>>>=0,typeof SharedArrayBuffer>"u")return Dt("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var B=[];return X&&B.length===0?C(w,_,I,k):(w={kb:I,Oa:w,hb:k,qb:B},X?(w.sb="spawnThread",postMessage(w,B),0):ie(w))}function K(w,_,I){return X?x(3,1,w,_,I):0}function lt(w,_){if(X)return x(4,1,w,_)}s.invokeEntryPoint=(w,_)=>{var I=P[w];I||(w>=P.length&&(P.length=w+1),P[w]=I=v.get(w)),w=I(_),0<Se?D.$a(w):Kr(w)};var Ut=w=>{for(var _=0,I=0;I<w.length;++I){var k=w.charCodeAt(I);127>=k?_++:2047>=k?_+=2:55296<=k&&57343>=k?(_+=4,++I):_+=3}return _},he=(w,_,I,k)=>{if(!(0<k))return 0;var B=I>>>=0;k=I+k-1;for(var G=0;G<w.length;++G){var Q=w.charCodeAt(G);if(55296<=Q&&57343>=Q&&(Q=65536+((1023&Q)<<10)|1023&w.charCodeAt(++G)),127>=Q){if(I>=k)break;_[I++>>>0]=Q}else{if(2047>=Q){if(I+1>=k)break;_[I++>>>0]=192|Q>>6}else{if(65535>=Q){if(I+2>=k)break;_[I++>>>0]=224|Q>>12}else{if(I+3>=k)break;_[I++>>>0]=240|Q>>18,_[I++>>>0]=128|Q>>12&63}_[I++>>>0]=128|Q>>6&63}_[I++>>>0]=128|63&Q}}return _[I>>>0]=0,I-B},se=(w,_,I)=>he(w,d(),_,I);function Qt(w,_){if(X)return x(5,1,w,_)}function tr(w,_,I){if(X)return x(6,1,w,_,I)}function er(w,_,I){return X?x(7,1,w,_,I):0}function M(w,_){if(X)return x(8,1,w,_)}function yt(w,_,I){if(X)return x(9,1,w,_,I)}function $t(w,_,I,k){if(X)return x(10,1,w,_,I,k)}function Ne(w,_,I,k){if(X)return x(11,1,w,_,I,k)}function rr(w,_,I,k){if(X)return x(12,1,w,_,I,k)}function wn(w){if(X)return x(13,1,w)}function vn(w,_){if(X)return x(14,1,w,_)}function _n(w,_,I){if(X)return x(15,1,w,_,I)}function Cr(w){w>>>=0,typeof Atomics.rb=="function"&&(Atomics.rb(p(),w>>>2,w).value.then(_r),w+=128,Atomics.store(p(),w>>>2,1))}s.__emscripten_thread_mailbox_await=Cr;var _r=()=>{var w=Or();if(w&&(Cr(w),w=fi,!ue))try{if(w(),!(0<Se))try{X?Kr(Mt):b(Mt)}catch(_){_ instanceof $e||_=="unwind"||L(1,_)}}catch(_){_ instanceof $e||_=="unwind"||L(1,_)}};s.checkMailbox=_r;var jr=[],Qe=w=>w%4==0&&(w%100!=0||w%400==0),On=[0,31,60,91,121,152,182,213,244,274,305,335],En=[0,31,59,90,120,151,181,212,243,273,304,334];function Sn(w,_,I,k,B,G,Q,Ft){return X?x(16,1,w,_,I,k,B,G,Q,Ft):-52}function An(w,_,I,k,B,G,Q){if(X)return x(17,1,w,_,I,k,B,G,Q)}var Xr,In=w=>{var _=Ut(w)+1,I=si(_);return I&&se(w,I,_),I},Yr=[],Zr={},Pn=()=>{if(!Xr){var w,_={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:A||"./this.program"};for(w in Zr)Zr[w]===void 0?delete _[w]:_[w]=Zr[w];var I=[];for(w in _)I.push(`${w}=${_[w]}`);Xr=I}return Xr};function jn(w,_){if(X)return x(18,1,w,_);w>>>=0,_>>>=0;var I=0;return Pn().forEach((k,B)=>{var G=_+I;for(B=h()[w+4*B>>>2>>>0]=G,G=0;G<k.length;++G)f()[B++>>>0>>>0]=k.charCodeAt(G);f()[B>>>0>>>0]=0,I+=k.length+1}),0}function Hn(w,_){if(X)return x(19,1,w,_);w>>>=0,_>>>=0;var I=Pn();h()[w>>>2>>>0]=I.length;var k=0;return I.forEach(B=>k+=B.length+1),h()[_>>>2>>>0]=k,0}function qn(w){return X?x(20,1,w):52}function Yn(w,_,I,k){return X?x(21,1,w,_,I,k):52}function ti(w,_,I,k,B){return X?x(22,1,w,_,I,k,B):70}var Go=[null,[],[]];function ri(w,_,I,k){if(X)return x(23,1,w,_,I,k);_>>>=0,I>>>=0,k>>>=0;for(var B=0,G=0;G<I;G++){var Q=h()[_>>>2>>>0],Ft=h()[_+4>>>2>>>0];_+=8;for(var Ae=0;Ae<Ft;Ae++){var te=d()[Q+Ae>>>0],we=Go[w];te===0||te===10?((w===1?Me:Dt)(Te(we,0)),we.length=0):we.push(te)}B+=Ft}return h()[k>>>2>>>0]=B,0}var ni=[31,29,31,30,31,30,31,31,30,31,30,31],ii=[31,28,31,30,31,30,31,31,30,31,30,31];
1808function oi(w,_,I,k){function B(j,vt,Ct){for(j=typeof j=="number"?j.toString():j||"";j.length<vt;)j=Ct[0]+j;return j}function G(j,vt){return B(j,vt,"0")}function Q(j,vt){function Ct(Mo){return 0>Mo?-1:0<Mo?1:0}var Ze;return(Ze=Ct(j.getFullYear()-vt.getFullYear()))===0&&(Ze=Ct(j.getMonth()-vt.getMonth()))===0&&(Ze=Ct(j.getDate()-vt.getDate())),Ze}function Ft(j){switch(j.getDay()){case 0:return new Date(j.getFullYear()-1,11,29);case 1:return j;case 2:return new Date(j.getFullYear(),0,3);case 3:return new Date(j.getFullYear(),0,2);case 4:return new Date(j.getFullYear(),0,1);case 5:return new Date(j.getFullYear()-1,11,31);case 6:return new Date(j.getFullYear()-1,11,30)}}function Ae(j){var vt=j.Ra;for(j=new Date(new Date(j.Sa+1900,0,1).getTime());0<vt;){var Ct=j.getMonth(),Ze=(Qe(j.getFullYear())?ni:ii)[Ct];if(!(vt>Ze-j.getDate())){j.setDate(j.getDate()+vt);break}vt-=Ze-j.getDate()+1,j.setDate(1),11>Ct?j.setMonth(Ct+1):(j.setMonth(0),j.setFullYear(j.getFullYear()+1))}return Ct=new Date(j.getFullYear()+1,0,4),vt=Ft(new Date(j.getFullYear(),0,4)),Ct=Ft(Ct),0>=Q(vt,j)?0>=Q(Ct,j)?j.getFullYear()+1:j.getFullYear():j.getFullYear()-1}w>>>=0,_>>>=0,I>>>=0,k>>>=0;var te=h()[k+40>>>2>>>0];for(var we in k={ob:p()[k>>>2>>>0],nb:p()[k+4>>>2>>>0],Ta:p()[k+8>>>2>>>0],Xa:p()[k+12>>>2>>>0],Ua:p()[k+16>>>2>>>0],Sa:p()[k+20>>>2>>>0],Na:p()[k+24>>>2>>>0],Ra:p()[k+28>>>2>>>0],ub:p()[k+32>>>2>>>0],mb:p()[k+36>>>2>>>0],pb:te?ot(te):""},I=ot(I),te={"%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"})I=I.replace(new RegExp(we,"g"),te[we]);var Ro="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Bo="January February March April May June July August September October November December".split(" ");for(we in te={"%a":j=>Ro[j.Na].substring(0,3),"%A":j=>Ro[j.Na],"%b":j=>Bo[j.Ua].substring(0,3),"%B":j=>Bo[j.Ua],"%C":j=>G((j.Sa+1900)/100|0,2),"%d":j=>G(j.Xa,2),"%e":j=>B(j.Xa,2," "),"%g":j=>Ae(j).toString().substring(2),"%G":j=>Ae(j),"%H":j=>G(j.Ta,2),"%I":j=>((j=j.Ta)==0?j=12:12<j&&(j-=12),G(j,2)),"%j":j=>{for(var vt=0,Ct=0;Ct<=j.Ua-1;vt+=(Qe(j.Sa+1900)?ni:ii)[Ct++]);return G(j.Xa+vt,3)},"%m":j=>G(j.Ua+1,2),"%M":j=>G(j.nb,2),"%n":()=>`
1809`,"%p":j=>0<=j.Ta&&12>j.Ta?"AM":"PM","%S":j=>G(j.ob,2),"%t":()=>"	","%u":j=>j.Na||7,"%U":j=>G(Math.floor((j.Ra+7-j.Na)/7),2),"%V":j=>{var vt=Math.floor((j.Ra+7-(j.Na+6)%7)/7);if(2>=(j.Na+371-j.Ra-2)%7&&vt++,vt)vt==53&&((Ct=(j.Na+371-j.Ra)%7)==4||Ct==3&&Qe(j.Sa)||(vt=1));else{vt=52;var Ct=(j.Na+7-j.Ra-1)%7;(Ct==4||Ct==5&&Qe(j.Sa%400-1))&&vt++}return G(vt,2)},"%w":j=>j.Na,"%W":j=>G(Math.floor((j.Ra+7-(j.Na+6)%7)/7),2),"%y":j=>(j.Sa+1900).toString().substring(2),"%Y":j=>j.Sa+1900,"%z":j=>(0<=(j=j.mb)?"+":"-")+("0000"+((j=Math.abs(j)/60)/60*100+j%60)).slice(-4),"%Z":j=>j.pb,"%%":()=>"%"},I=I.replace(/%%/g,"\0\0"),te)I.includes(we)&&(I=I.replace(new RegExp(we,"g"),te[we](k)));return we=function(j){var vt=Array(Ut(j)+1);return he(j,vt,0,vt.length),vt}(I=I.replace(/\0\0/g,"%")),we.length>_?0:(((j,vt)=>{f().set(j,vt>>>0)})(we,w),we.length-1)}D.Wa();var Wo=[m,gt,C,K,lt,Qt,tr,er,M,yt,$t,Ne,rr,wn,vn,_n,Sn,An,jn,Hn,qn,Yn,ti,ri],Jo={b:function(w,_,I){throw new N(w>>>=0).Wa(_>>>0,I>>>0),w},L:function(w){ui(w>>>0,!et,1,!z,131072,!1),D.ab()},j:function(w){w>>>=0,X?postMessage({cmd:"cleanupThread",thread:w}):D.Za(D.Ma[w])},H,h:K,S:lt,D:Qt,F:tr,T:er,Q:M,J:yt,P:$t,n:Ne,E:rr,B:wn,R:vn,C:_n,p:()=>1,z:function(w,_){(w>>>=0)==_>>>0?setTimeout(()=>_r()):X?postMessage({targetThread:w,cmd:"checkMailbox"}):(w=D.Ma[w])&&w.postMessage({cmd:"checkMailbox"})},I:function(w,_,I,k){_>>>=0,jr.length=I,k=k>>>0>>>3;for(var B=0;B<I;B++)jr[B]=n()[k+B>>>0];return w=0>w?He[-w-1]:Wo[w],D.ib=_,_=w.apply(null,jr),D.ib=0,_},K:Cr,o:function(w){Y&&D.Ma[w>>>0].ref()},s:function(w,_,I){w=_+2097152>>>0<4194305-!!w?(w>>>0)+4294967296*_:NaN,I>>>=0,w=new Date(1e3*w),p()[I>>>2>>>0]=w.getUTCSeconds(),p()[I+4>>>2>>>0]=w.getUTCMinutes(),p()[I+8>>>2>>>0]=w.getUTCHours(),p()[I+12>>>2>>>0]=w.getUTCDate(),p()[I+16>>>2>>>0]=w.getUTCMonth(),p()[I+20>>>2>>>0]=w.getUTCFullYear()-1900,p()[I+24>>>2>>>0]=w.getUTCDay(),w=(w.getTime()-Date.UTC(w.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,p()[I+28>>>2>>>0]=w},t:function(w,_,I){w=_+2097152>>>0<4194305-!!w?(w>>>0)+4294967296*_:NaN,I>>>=0,w=new Date(1e3*w),p()[I>>>2>>>0]=w.getSeconds(),p()[I+4>>>2>>>0]=w.getMinutes(),p()[I+8>>>2>>>0]=w.getHours(),p()[I+12>>>2>>>0]=w.getDate(),p()[I+16>>>2>>>0]=w.getMonth(),p()[I+20>>>2>>>0]=w.getFullYear()-1900,p()[I+24>>>2>>>0]=w.getDay(),_=(Qe(w.getFullYear())?On:En)[w.getMonth()]+w.getDate()-1|0,p()[I+28>>>2>>>0]=_,p()[I+36>>>2>>>0]=-60*w.getTimezoneOffset(),_=new Date(w.getFullYear(),6,1).getTimezoneOffset();var k=new Date(w.getFullYear(),0,1).getTimezoneOffset();w=0|(_!=k&&w.getTimezoneOffset()==Math.min(k,_)),p()[I+32>>>2>>>0]=w}
1809,u:function(w){w>>>=0;var _=new Date(p()[w+20>>>2>>>0]+1900,p()[w+16>>>2>>>0],p()[w+12>>>2>>>0],p()[w+8>>>2>>>0],p()[w+4>>>2>>>0],p()[w>>>2>>>0],0),I=p()[w+32>>>2>>>0],k=_.getTimezoneOffset(),B=new Date(_.getFullYear(),6,1).getTimezoneOffset(),G=new Date(_.getFullYear(),0,1).getTimezoneOffset(),Q=Math.min(G,B);return 0>I?p()[w+32>>>2>>>0]=+(B!=G&&Q==k):0<I!=(Q==k)&&(B=Math.max(G,B),_.setTime(_.getTime()+6e4*((0<I?Q:B)-k))),p()[w+24>>>2>>>0]=_.getDay(),I=(Qe(_.getFullYear())?On:En)[_.getMonth()]+_.getDate()-1|0,p()[w+28>>>2>>>0]=I,p()[w>>>2>>>0]=_.getSeconds(),p()[w+4>>>2>>>0]=_.getMinutes(),p()[w+8>>>2>>>0]=_.getHours(),p()[w+12>>>2>>>0]=_.getDate(),p()[w+16>>>2>>>0]=_.getMonth(),p()[w+20>>>2>>>0]=_.getYear(),w=_.getTime(),isNaN(w)?(p()[ai()>>>2>>>0]=61,w=-1):w/=1e3,di((Ee=w,1<=+Math.abs(Ee)?0<Ee?+Math.floor(Ee/4294967296)>>>0:~~+Math.ceil((Ee-+(~~Ee>>>0))/4294967296)>>>0:0)),w>>>0},q:Sn,r:An,y:function(w,_,I){function k(te){return(te=te.toTimeString().match(/\(([A-Za-z ]+)\)$/))?te[1]:"GMT"}w>>>=0,_>>>=0,I>>>=0;var B=new Date().getFullYear(),G=new Date(B,0,1),Q=new Date(B,6,1);B=G.getTimezoneOffset();var Ft=Q.getTimezoneOffset(),Ae=Math.max(B,Ft);h()[w>>>2>>>0]=60*Ae,p()[_>>>2>>>0]=+(B!=Ft),w=k(G),_=k(Q),w=In(w),_=In(_),Ft<B?(h()[I>>>2>>>0]=w,h()[I+4>>>2>>>0]=_):(h()[I>>>2>>>0]=_,h()[I+4>>>2>>>0]=w)},c:()=>{Yt("")},O:function(w,_,I){w>>>=0,_>>>=0,I>>>=0,Yr.length=0;for(var k;k=d()[_++>>>0];){var B=k!=105;I+=(B&=k!=112)&&I%8?4:0,Yr.push(k==112?h()[I>>>2>>>0]:k==105?p()[I>>>2>>>0]:n()[I>>>3>>>0]),I+=B?8:4}return He[w].apply(null,Yr)},k:()=>{},i:()=>Date.now(),U:()=>{throw Se+=1,"unwind"},A:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:()=>Y?($p(),or(Cp)).cpus().length:navigator.hardwareConcurrency,x:function(w){w>>>=0;var _=d().length;if(w<=_||4294901760<w)return!1;for(var I=1;4>=I;I*=2){var k=_*(1+.2/I);k=Math.min(k,w+100663296);var B=Math;k=Math.max(w,k);t:{B=(B.min.call(B,4294901760,k+(65536-k%65536)%65536)-It.buffer.byteLength+65535)/65536;try{It.grow(B),ne();var G=1;break t}catch{}G=void 0}if(G)return!0}return!1},M:jn,N:Hn,G:b,g:qn,m:Yn,v:ti,l:ri,a:It||s.wasmMemory,w:oi,d:function(w,_,I,k){return oi(w>>>0,_>>>0,I>>>0,k>>>0)}},rt=function(){function w(I,k){return rt=I.exports,rt=function(){var B=rt;B=Object.assign({},B);var G=Ft=>()=>Ft()>>>0,Q=Ft=>Ae=>Ft(Ae)>>>0;return B.va=G(B.va),B.wa=G(B.wa),B.xa=Q(B.xa),B.emscripten_main_runtime_thread_id=G(B.emscripten_main_runtime_thread_id),B.Ja=G(B.Ja),B.La=Q(B.La),B}(),D.bb.push(rt.za),v=rt.Aa,ge.unshift(rt.V),bt=k,qt(),rt}var _={a:Jo};if(de++,s.instantiateWasm)try{return s.instantiateWasm(_,w)}catch(I){Dt(`Module.instantiateWasm callback failed with error: ${I}`),r(I)}return function(I,k){var B=Gt;return typeof WebAssembly.instantiateStreaming!="function"||Kt(B)||Ue(B)||Y||typeof fetch!="function"?ze(B,I,k):fetch(B,{credentials:"same-origin"}).then(G=>WebAssembly.instantiateStreaming(G,I).then(k,function(Q){return Dt(`wasm streaming compile failed: ${Q}`),Dt("falling back to ArrayBuffer instantiation"),ze(B,I,k)}))}(_,function(I){w(I.instance,I.module)}).catch(r),{}}();s._OrtInit=(w,_)=>(s._OrtInit=rt.W)(w,_),s._OrtGetLastError=(w,_)=>(s._OrtGetLastError=rt.X)(w,_),s._OrtCreateSessionOptions=(w,_,I,k,B,G,Q,Ft,Ae,te)=>(s._OrtCreateSessionOptions=rt.Y)(w,_,I,k,B,G,Q,Ft,Ae,te),s._OrtAppendExecutionProvider=(w,_)=>(s._OrtAppendExecutionProvider=rt.Z)(w,_),s._OrtAddFreeDimensionOverride=(w,_,I)=>(s._OrtAddFreeDimensionOverride=rt._)(w,_,I),s._OrtAddSessionConfigEntry=(w,_,I)=>(s._OrtAddSessionConfigEntry=rt.$)(w,_,I),s._OrtReleaseSessionOptions=w=>(s._OrtReleaseSessionOptions=rt.aa)(w),s._OrtCreateSession=(w,_,I)=>(s._OrtCreateSession=rt.ba)(w,_,I),s._OrtReleaseSession=w=>(s._OrtReleaseSession=rt.ca)(w),s._OrtGetInputOutputCount=(w,_,I)=>(s._OrtGetInputOutputCount=rt.da)(w,_,I),s._OrtGetInputName=(w,_)=>(s._OrtGetInputName=rt.ea)(w,_),s._OrtGetOutputName=(w,_)=>(s._OrtGetOutputName=rt.fa)(w,_),s._OrtFree=w=>(s._OrtFree=rt.ga)(w),s._OrtCreateTensor=(w,_,I,k,B,G)=>(s._OrtCreateTensor=rt.ha)(w,_,I,k,B,G),s._OrtGetTensorData=(w,_,I,k,B)=>(s._OrtGetTensorData=rt.ia)(w,_,I,k,B),s._OrtReleaseTensor=w=>
1809(s._OrtReleaseTensor=rt.ja)(w),s._OrtCreateRunOptions=(w,_,I,k)=>(s._OrtCreateRunOptions=rt.ka)(w,_,I,k),s._OrtAddRunConfigEntry=(w,_,I)=>(s._OrtAddRunConfigEntry=rt.la)(w,_,I),s._OrtReleaseRunOptions=w=>(s._OrtReleaseRunOptions=rt.ma)(w),s._OrtCreateBinding=w=>(s._OrtCreateBinding=rt.na)(w),s._OrtBindInput=(w,_,I)=>(s._OrtBindInput=rt.oa)(w,_,I),s._OrtBindOutput=(w,_,I,k)=>(s._OrtBindOutput=rt.pa)(w,_,I,k),s._OrtClearBoundOutputs=w=>(s._OrtClearBoundOutputs=rt.qa)(w),s._OrtReleaseBinding=w=>(s._OrtReleaseBinding=rt.ra)(w),s._OrtRunWithBinding=(w,_,I,k,B)=>(s._OrtRunWithBinding=rt.sa)(w,_,I,k,B),s._OrtRun=(w,_,I,k,B,G,Q,Ft)=>(s._OrtRun=rt.ta)(w,_,I,k,B,G,Q,Ft),s._OrtEndProfiling=w=>(s._OrtEndProfiling=rt.ua)(w);var ai=()=>(ai=rt.va)(),Or=s._pthread_self=()=>(Or=s._pthread_self=rt.wa)(),si=s._malloc=w=>(si=s._malloc=rt.xa)(w);s._free=w=>(s._free=rt.ya)(w),s.__emscripten_tls_init=()=>(s.__emscripten_tls_init=rt.za)();var ui=s.__emscripten_thread_init=(w,_,I,k,B,G)=>(ui=s.__emscripten_thread_init=rt.Ba)(w,_,I,k,B,G);s.__emscripten_thread_crashed=()=>(s.__emscripten_thread_crashed=rt.Ca)();var Sr,ci=(w,_,I,k)=>(ci=rt.Da)(w,_,I,k),Jr=w=>(Jr=rt.Ea)(w),Kr=s.__emscripten_thread_exit=w=>(Kr=s.__emscripten_thread_exit=rt.Fa)(w),fi=()=>(fi=rt.Ga)(),di=w=>(di=rt.Ha)(w),Qi=(w,_)=>(Qi=rt.Ia)(w,_),Qr=()=>(Qr=rt.Ja)(),Ar=w=>(Ar=rt.Ka)(w),en=w=>(en=rt.La)(w);function No(){if(!(0<de))if(X)c(s),X||V(ge),startWorker(s);else{if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)Pe.unshift(s.preRun.shift());V(Pe),0<de||Sr||(Sr=!0,s.calledRun=!0,ue||(X||V(ge),c(s),X||V(zt)))}}return s.wasmMemory=It,s.stackAlloc=en,s.stackSave=Qr,s.stackRestore=Ar,s.keepRuntimeAlive=()=>0<Se,s.UTF8ToString=ot,s.stringToUTF8=se,s.lengthBytesUTF8=Ut,s.ExitStatus=$e,s.PThread=D,Et=function w(){Sr||No(),Sr||(Et=w)},No(),l.ready});typeof t=="object"&&typeof e=="object"?e.exports=a:typeof define=="function"&&define.amd&&define([],()=>a)}),Rp=me((t,e)=>{e.exports='"use strict";var Module={},ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads"),parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",e=>onmessage({data:e}));var fs=require("fs"),vm=require("vm");Object.assign(global,{self:global,require,Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:e=>vm.runInThisContext(fs.readFileSync(e,"utf8"),{filename:e}),postMessage:e=>parentPort.postMessage(e),performance:global.performance||{now:Date.now}})}var initializedJS=!1;function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,e+`\n`);return}console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var a=Module.wasmModule;Module.wasmModule=null;var r=new WebAssembly.Instance(a,e);return t(r)},self.onunhandledrejection=e=>{throw e.reason||e};function handleMessage(e){try{if(e.data.cmd==="load"){let a=[];self.onmessage=r=>a.push(r),self.startWorker=r=>{Module=r,postMessage({cmd:"loaded"});for(let s of a)handleMessage(s);self.onmessage=handleMessage},Module.wasmModule=e.data.wasmModule;for(const r of e.data.handlers)Module[r]=(...s)=>{postMessage({cmd:"callHandler",handler:r,args:s})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,typeof e.data.urlOrBlob=="string")importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(Module)}else if(e.data.cmd==="run"){Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.__emscripten_thread_mailbox_await(e.data.pthread_ptr),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(a){if(a!="unwind")throw a}}else e.data.cmd==="cancel"?Module._pthread_self()&&Module.__emscripten_thread_exit(-1):e.data.target==="setimmediate"||(e.data.cmd==="checkMailbox"?initializedJS&&Module.checkMailbox():e.data.cmd&&(err(`worker.js received unknown command ${e.data.cmd}`),err(e.data)))}catch(a){throw Module.__emscripten_thread_crashed?.(),a}}self.onmessage=handleMessage;\n'}),Gp,lg,aa,sa,Po,Mp,fg,cg,pg,Up,Le,Vr=E(()=>{Gp=Dp(),lg=Np(),sa=!1,Po=!1,Mp=!1,fg=t=>{if(t===1)return!1;if(typeof SharedArrayBuffer>"u")return typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+t+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),!1;typeof dist.process<"u"&&dist.process.versions&&dist.process.versions.node&&console.warn("env.wasm.numThreads is set to "+t+", however, currently onnxruntime-web does not support multi-threads in Node.js. Please consider using onnxruntime-node for performance critical scenarios.");try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},cg=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},pg=(t,e)=>t?e?"ort-wasm-simd-threaded.wasm":"ort-wasm-simd.wasm":e?"ort-wasm-threaded.wasm":"ort-wasm.wasm",Up=async t=>{if(sa)return Promise.resolve();if(Po)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");
1809if(Mp)throw new Error("previous call to 'initializeWebAssembly()' failed.");Po=!0;let e=t.initTimeout,o=t.numThreads,a=t.simd,l=fg(o),f=a&&cg(),d=t.wasmPaths,p=typeof d=="string"?d:void 0,h=pg(f,l),n=typeof d=="object"?d[h]:void 0,c=!1,r=[];if(e>0&&r.push(new Promise(s=>{setTimeout(()=>{c=!0,s()},e)})),r.push(new Promise((s,u)=>{let g=l?lg:Gp,y={locateFile:(S,A)=>l&&S.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([Rp()],{type:"text/javascript"})):S.endsWith(".wasm")?n||(p??A)+h:A+S};if(l)if(y.numThreads=o,typeof Blob>"u")y.mainScriptUrlOrBlob=(void 0)(__dirname,"ort-wasm-threaded.js");else{let S=`var ortWasmThreaded=${g.toString()};`;y.mainScriptUrlOrBlob=new Blob([S],{type:"text/javascript"})}g(y).then(S=>{Po=!1,sa=!0,aa=S,s()},S=>{Po=!1,Mp=!0,u(S)})})),await Promise.race(r),c)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},Le=()=>{if(sa&&aa)return aa;throw new Error("WebAssembly is not initialized yet.")}}),_e,yn,Oe,Eo=E(()=>{Vr(),_e=(t,e)=>{let o=Le(),a=o.lengthBytesUTF8(t)+1,l=o._malloc(a);return o.stringToUTF8(t,l,a),e.push(l),l},yn=(t,e,o,a)=>{if(typeof t=="object"&&t!==null){if(o.has(t))throw new Error("Circular reference in options");o.add(t)}Object.entries(t).forEach(([l,f])=>{let d=e?e+l:l;if(typeof f=="object")yn(f,d+".",o,a);else if(typeof f=="string"||typeof f=="number")a(d,f.toString());else{if(typeof f!="boolean")throw new Error("Can't handle extra config type: "+typeof f);a(d,f?"1":"0")}})},Oe=t=>{let e=Le(),o=e.stackSave();try{let a=e.stackAlloc(8);e._OrtGetLastError(a,a+4);let l=e.HEAP32[a/4],f=e.HEAPU32[a/4+1],d=f?e.UTF8ToString(f):"";throw new Error(`${t} ERROR_CODE: ${l}, ERROR_MESSAGE: ${d}`)}finally{e.stackRestore(o)}}}),zp,Vp=E(()=>{Vr(),Eo(),zp=t=>{let e=Le(),o=0,a=[],l=t||{};try{if((t==null?void 0:t.logSeverityLevel)===void 0)l.logSeverityLevel=2;else if(typeof t.logSeverityLevel!="number"||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if((t==null?void 0:t.logVerbosityLevel)===void 0)l.logVerbosityLevel=0;else if(typeof t.logVerbosityLevel!="number"||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);(t==null?void 0:t.terminate)===void 0&&(l.terminate=!1);let f=0;return(t==null?void 0:t.tag)!==void 0&&(f=_e(t.tag,a)),o=e._OrtCreateRunOptions(l.logSeverityLevel,l.logVerbosityLevel,!!l.terminate,f),o===0&&Oe("Can't create run options."),(t==null?void 0:t.extra)!==void 0&&yn(t.extra,"",new WeakSet,(d,p)=>{let h=_e(d,a),n=_e(p,a);e._OrtAddRunConfigEntry(o,h,n)!==0&&Oe(`Can't set a run config entry: ${d} - ${p}.`)}),[o,a]}catch(f){throw o!==0&&e._OrtReleaseRunOptions(o),a.forEach(d=>e._free(d)),f}}}),dg,hg,mg,bg,Wp,Hp=E(()=>{Vr(),Eo(),dg=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}`)}},hg=t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}},mg=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"),t.executionProviders&&t.executionProviders.some(o=>(typeof o=="string"?o:o.name)==="webgpu")&&(t.enableMemPattern=!1)},bg=(t,e,o)=>{for(let a of e){let l=typeof a=="string"?a:a.name;switch(l){case"webnn":if(l="WEBNN",typeof a!="string"){let d=a;if(d!=null&&d.deviceType){let p=_e("deviceType",o),h=_e(d.deviceType,o);Le()._OrtAddSessionConfigEntry(t,p,h)!==0&&Oe(`Can't set a session config entry: 'deviceType' - ${d.deviceType}.`)}if(d!=null&&d.numThreads){let p=d.numThreads;(typeof p!="number"||!Number.isInteger(p)||p<0)&&(p=0);let h=_e("numThreads",o),n=_e(p.toString(),o);Le()._OrtAddSessionConfigEntry(t,h,n)!==0&&Oe(`Can't set a session config entry: 'numThreads' - ${d.numThreads}.`)}if(d!=null&&d.powerPreference){let p=_e("powerPreference",o),h=_e(d.powerPreference,o);Le()._OrtAddSessionConfigEntry(t,p,h)!==0&&Oe(`Can't set a session config entry: 'powerPreference' - ${d.powerPreference}.`)}}break;case"webgpu":if(l="JS",typeof a!="string"){let d=a;if(d!=null&&d.preferredLayout){if(d.preferredLayout!=="NCHW"&&d.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${d.preferredLayout}`);let p=_e("preferredLayout",o),h=_e(d.preferredLayout,o);Le()._OrtAddSessionConfigEntry(t,p,h)!==0&&Oe(`Can't set a session config entry: 'preferredLayout' - ${d.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${l}`)}let f=_e(l,o);Le()._OrtAppendExecutionProvider(t,f)!==0&&Oe(`Can't append execution provider: ${l}.`)}},Wp=t=>{let e=Le(),o=0,a=[],l=t||{};mg(l);try{let f=dg(l.graphOptimizationLevel??"all"),d=hg(l.executionMode??"sequential"),p=typeof l.logId=="string"?_e(l.logId,a):0,h=l.logSeverityLevel??2;if(!Number.isInteger(h)||h<0||h>
18094)throw new Error(`log serverity level is not valid: ${h}`);let n=l.logVerbosityLevel??0;if(!Number.isInteger(n)||n<0||n>4)throw new Error(`log verbosity level is not valid: ${n}`);let c=typeof l.optimizedModelFilePath=="string"?_e(l.optimizedModelFilePath,a):0;if(o=e._OrtCreateSessionOptions(f,!!l.enableCpuMemArena,!!l.enableMemPattern,d,!!l.enableProfiling,0,p,h,n,c),o===0&&Oe("Can't create session options."),l.executionProviders&&bg(o,l.executionProviders,a),l.enableGraphCapture!==void 0){if(typeof l.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${l.enableGraphCapture}`);let r=_e("enableGraphCapture",a),s=_e(l.enableGraphCapture.toString(),a);e._OrtAddSessionConfigEntry(o,r,s)!==0&&Oe(`Can't set a session config entry: 'enableGraphCapture' - ${l.enableGraphCapture}.`)}if(l.freeDimensionOverrides)for(let[r,s]of Object.entries(l.freeDimensionOverrides)){if(typeof r!="string")throw new Error(`free dimension override name must be a string: ${r}`);if(typeof s!="number"||!Number.isInteger(s)||s<0)throw new Error(`free dimension override value must be a non-negative integer: ${s}`);let u=_e(r,a);e._OrtAddFreeDimensionOverride(o,u,s)!==0&&Oe(`Can't set a free dimension override: ${r} - ${s}.`)}return l.extra!==void 0&&yn(l.extra,"",new WeakSet,(r,s)=>{let u=_e(r,a),g=_e(s,a);e._OrtAddSessionConfigEntry(o,u,g)!==0&&Oe(`Can't set a session config entry: ${r} - ${s}.`)}),[o,a]}catch(f){throw o!==0&&e._OrtReleaseSessionOptions(o),a.forEach(d=>e._free(d)),f}}}),ua,qp,la,jp,Yp,Do,Xp,fa=E(()=>{ua=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"float16":return 10;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}`)}},qp=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 10:return"float16";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}`)}},la=t=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][t],jp=t=>{switch(t){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;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}`)}},Yp=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 new Error(`unsupported logging level: ${t}`)}},Do=t=>t==="float32"||t==="float16"||t==="int32"||t==="int64"||t==="uint32"||t==="uint8"||t==="bool",Xp=t=>{switch(t){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;default:throw new Error(`unsupported data location: ${t}`)}}}),Tn,ca=E(()=>{Tn=async t=>{if(typeof t!="string")return t instanceof Blob?new Uint8Array(await t.arrayBuffer()):t instanceof Uint8Array?t:new Uint8Array(t);if(!(typeof dist.process<"u"&&dist.process.versions&&dist.process.versions.node)){let e=await fetch(t);if(!e.ok)throw new Error(`failed to load external data file: ${t}`);let o=e.headers.get("Content-Length"),a=o?parseInt(o,10):0;if(a<1073741824)return new Uint8Array(await e.arrayBuffer());{if(!e.body)throw new Error(`failed to load external data file: ${t}, no response body.`);let l,f=e.body.getReader();try{l=new ArrayBuffer(a)}catch(p){if(!(p instanceof RangeError))throw p;{let h=Math.ceil(a/65536);l=new WebAssembly.Memory({initial:h,maximum:h}).buffer}}let d=0;for(;;){let{done:p,value:h}=await f.read();if(p)break;let n=h.byteLength;new Uint8Array(l,d,n).set(h),d+=n}return new Uint8Array(l,0,a)}}try{return new Uint8Array(await(void 0)(t))}catch(e){if(e.code==="ERR_FS_FILE_TOO_LARGE"){let o=(void 0)(t),a=[];for await(let l of o)a.push(l);return new Uint8Array(dist.Buffer.concat(a))}throw e}}}),gg,Jp,Zp,Wr,yg,pa,Qp,ed,Kp,td,rd,nd,od=E(()=>{Vp(),Hp(),fa(),Vr(),Eo(),ca(),gg=(t,e)=>
1809{Le()._OrtInit(t,e)!==0&&Oe("Can't initialize onnxruntime.")},Jp=async t=>{gg(t.wasm.numThreads,Yp(t.logLevel))},Zp=async(t,e)=>{},Wr=new Map,yg=t=>{let e=Le(),o=e.stackSave();try{let a=e.stackAlloc(8);return e._OrtGetInputOutputCount(t,a,a+4)!==0&&Oe("Can't get session input/output count."),[e.HEAP32[a/4],e.HEAP32[a/4+1]]}finally{e.stackRestore(o)}},pa=t=>{let e=Le(),o=e._malloc(t.byteLength);if(o===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${t.byteLength}.`);return e.HEAPU8.set(t,o),[o,t.byteLength]},Qp=async(t,e)=>{var c;let o,a,l=Le();Array.isArray(t)?[o,a]=t:t.buffer===l.HEAPU8.buffer?[o,a]=[t.byteOffset,t.byteLength]:[o,a]=pa(t);let f=0,d=0,p=[],h=[],n=[];try{if([d,p]=Wp(e),(e==null?void 0:e.externalData)&&l.mountExternalData){let A=[];for(let L of e.externalData){let z=typeof L=="string"?L:L.path;A.push(Tn(typeof L=="string"?L:L.data).then(et=>{l.mountExternalData(z,et)}))}await Promise.all(A)}f=await l._OrtCreateSession(o,a,d),f===0&&Oe("Can't create a session.");let[r,s]=yg(f),u=!!(e!=null&&e.enableGraphCapture),g=[],y=[];for(let A=0;A<r;A++){let L=l._OrtGetInputName(f,A);L===0&&Oe("Can't get an input name."),h.push(L),g.push(l.UTF8ToString(L))}for(let A=0;A<s;A++){let L=l._OrtGetOutputName(f,A);L===0&&Oe("Can't get an output name."),n.push(L);let z=l.UTF8ToString(L);y.push(z)}return Wr.set(f,[f,h,n,null,u,!1]),[f,g,y]}catch(r){throw h.forEach(s=>l._OrtFree(s)),n.forEach(s=>l._OrtFree(s)),f!==0&&l._OrtReleaseSession(f),r}finally{l._free(o),d!==0&&l._OrtReleaseSessionOptions(d),p.forEach(r=>l._free(r)),(c=l.unmountExternalData)==null||c.call(l)}},ed=t=>{var h;let e=Le(),o=Wr.get(t);if(!o)throw new Error(`cannot release session. invalid session id: ${t}`);let[a,l,f,d,p]=o;d&&(p&&e._OrtClearBoundOutputs(d.handle),e._OrtReleaseBinding(d.handle)),(h=e.jsepOnReleaseSession)==null||h.call(e,t),l.forEach(n=>e._OrtFree(n)),f.forEach(n=>e._OrtFree(n)),e._OrtReleaseSession(a),Wr.delete(t)},Kp=(t,e,o,a,l,f=!1)=>{if(!t)return void e.push(0);let d,p,h=Le(),n=t[0],c=t[1],r=t[3];if(n==="string"&&r==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");if(f&&r!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${l} when enableGraphCapture is true.`);if(r==="gpu-buffer"){let g=t[2].gpuBuffer,y=la(ua(n));p=c.reduce((A,L)=>A*L,1)*y;let S=h.jsepRegisterBuffer;if(!S)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');d=S(a,l,g,p)}else{let g=t[2];if(Array.isArray(g)){p=4*g.length,d=h._malloc(p),o.push(d);let y=d/4;for(let S=0;S<g.length;S++){if(typeof g[S]!="string")throw new TypeError(`tensor data at index ${S} is not a string`);h.HEAPU32[y++]=_e(g[S],o)}}else p=g.byteLength,d=h._malloc(p),o.push(d),h.HEAPU8.set(new Uint8Array(g.buffer,g.byteOffset,p),d)}let s=h.stackSave(),u=h.stackAlloc(4*c.length);try{let g=u/4;c.forEach(S=>h.HEAP32[g++]=S);let y=h._OrtCreateTensor(ua(n),d,p,u,c.length,Xp(r));y===0&&Oe(`Can't create tensor for input/output. session=${a}, index=${l}.`),e.push(y)}finally{h.stackRestore(s)}},td=async(t,e,o,a,l,f)=>{var At;let d=Le(),p=Wr.get(t);if(!p)throw new Error(`cannot run inference. invalid session id: ${t}`);let h=p[0],n=p[1],c=p[2],r=p[3],s=p[4];p[5];let u=e.length,g=a.length,y=0,S=[],A=[],L=[],z=[],et=d.stackSave(),Y=d.stackAlloc(4*u),X=d.stackAlloc(4*u),mt=d.stackAlloc(4*g),J=d.stackAlloc(4*g);try{[y,S]=zp(f);for(let bt=0;bt<u;bt++)Kp(o[bt],A,z,t,e[bt],s);for(let bt=0;bt<g;bt++)Kp(l[bt],L,z,t,u+a[bt],s);let Lt,ke=Y/4,Be=X/4,Me=mt/4,Dt=J/4;for(let bt=0;bt<u;bt++)d.HEAPU32[ke++]=A[bt],d.HEAPU32[Be++]=n[e[bt]];for(let bt=0;bt<g;bt++)d.HEAPU32[Me++]=L[bt],d.HEAPU32[Dt++]=c[a[bt]];(At=d.jsepOnRunStart)==null||At.call(d,h),Lt=await d._OrtRun(h,X,Y,u,J,g,mt,y),Lt!==0&&Oe("failed to call OrtRun().");let It=[];for(let bt=0;bt<g;bt++){let Mt=d.HEAPU32[mt/4+bt];if(Mt===L[bt]){It.push(l[bt]);continue}let Pt,Ie=d.stackSave(),ve=d.stackAlloc(16),_t=!1,St=0;try{d._OrtGetTensorData(Mt,ve,ve+4,ve+8,ve+12)!==0&&Oe(`Can't access output tensor data on index ${bt}.`);let ue=ve/4,ne=d.HEAPU32[ue++];St=d.HEAPU32[ue++];let pe=d.HEAPU32[ue++],Pe=d.HEAPU32[ue++],ge=[];for(let Et=0;Et<Pe;Et++)ge.push(d.HEAPU32[pe/4+Et]);d._OrtFree(pe);let zt=ge.reduce((Et,qt)=>Et*qt,1);Pt=qp(ne);let de=r==null?void 0:r.outputPreferredLocations[a[bt]];if(Pt==="string"){if(de==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");let Et=[],qt=St/4;for(let Yt=0;Yt<zt;Yt++){let Gt=d.HEAPU32[qt++],Kt=Yt===zt-1?void 0:d.HEAPU32[qt]-Gt;Et.push(d.UTF8ToString(Gt,Kt))}It.push([Pt,ge,Et,"cpu"])}else if(de==="gpu-buffer"&&zt>0){let Et=d.jsepGetBuffer;if(!Et)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let qt=Et(St),Yt=la(ne);if(Yt===void 0||!Do(Pt))throw new Error(`Unsupported data type: ${Pt}`);_t=!0,It.push([Pt,ge,{gpuBuffer:qt,download:d.jsepCreateDownloader(qt,zt*Yt,Pt),dispose:()=>{d._OrtReleaseTensor(Mt)}},"gpu-buffer"])}else{let Et=new(jp(Pt))(zt);new Uint8Array(Et.buffer,Et.byteOffset,Et.byteLength).set(d.HEAPU8.subarray(St,St+Et.byteLength)),It.push([Pt,ge,Et,"cpu"])}}finally{d.stackRestore(Ie),Pt==="string"&&St&&d._free(St),_t||d._OrtReleaseTensor(Mt)}}return r&&!s&&(d._OrtClearBoundOutputs(r.handle),Wr.set(t,[h,n,c,r,s,!1])),It}finally{d.stackRestore(et),A.forEach(Lt=>
vendor: 5,340 bytes, line 1809
1809d._OrtReleaseTensor(Lt)),L.forEach(Lt=>d._OrtReleaseTensor(Lt)),z.forEach(Lt=>d._free(Lt)),y!==0&&d._OrtReleaseRunOptions(y),S.forEach(Lt=>d._free(Lt))}},rd=t=>{let e=Le(),o=Wr.get(t);if(!o)throw new Error("invalid session id");let a=o[0],l=e._OrtEndProfiling(a);l===0&&Oe("Can't get an profile file name."),e._OrtFree(l)},nd=t=>{let e=[];for(let o of t){let a=o[2];!Array.isArray(a)&&"buffer"in a&&e.push(a.buffer)}return e}}),id=me((t,e)=>{e.exports='/*!\n * ONNX Runtime Web v1.17.3\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n"use strict";(()=>{var Et=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var Xr=Object.getOwnPropertyNames;var Qr=Object.prototype.hasOwnProperty;var St=(u,c)=>()=>(u&&(c=u(u=0)),c);var tt=(u,c)=>()=>(c||u((c={exports:{}}).exports,c),c.exports),At=(u,c)=>{for(var a in c)Et(u,a,{get:c[a],enumerable:!0})},Zr=(u,c,a,h)=>{if(c&&typeof c=="object"||typeof c=="function")for(let f of Xr(c))!Qr.call(u,f)&&f!==a&&Et(u,f,{get:()=>c[f],enumerable:!(h=Jr(c,f))||h.enumerable});return u};var rt=u=>Zr(Et({},"__esModule",{value:!0}),u);var Tt={};At(Tt,{createReadStream:()=>dr,readFile:()=>Kr,readFileSync:()=>en});var Kr,en,dr,Mt=St(()=>{Kr=void 0,en=void 0,dr=void 0});var Ct={};At(Ct,{join:()=>tn});var tn,Dt=St(()=>{tn=void 0});var gr=tt((mr,Ft)=>{"use strict";var pr=(()=>{var u=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(u=u||__filename),function(c={}){var a=c,h,f;a.ready=new Promise((r,o)=>{h=r,f=o});var w=Object.assign({},a),g="./this.program",i=typeof window=="object",E=typeof importScripts=="function",P=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",U="",D,x,K;if(P){var R=(Mt(),rt(Tt)),I=(Dt(),rt(Ct));U=E?I.dirname(U)+"/":__dirname+"/",D=(r,o)=>(r=ve(r)?new URL(r):I.normalize(r),R.readFileSync(r,o?void 0:"utf8")),K=r=>(r=D(r,!0),r.buffer||(r=new Uint8Array(r)),r),x=(r,o,s,m=!0)=>{r=ve(r)?new URL(r):I.normalize(r),R.readFile(r,m?void 0:"utf8",(O,A)=>{O?s(O):o(m?A.buffer:A)})},!a.thisProgram&&1<process.argv.length&&(g=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),a.inspect=()=>"[Emscripten Module object]"}else(i||E)&&(E?U=self.location.href:typeof document<"u"&&document.currentScript&&(U=document.currentScript.src),u&&(U=u),U.indexOf("blob:")!==0?U=U.substr(0,U.replace(/[?#].*/,"").lastIndexOf("/")+1):U="",D=r=>{var o=new XMLHttpRequest;return o.open("GET",r,!1),o.send(null),o.responseText},E&&(K=r=>{var o=new XMLHttpRequest;return o.open("GET",r,!1),o.responseType="arraybuffer",o.send(null),new Uint8Array(o.response)}),x=(r,o,s)=>{var m=new XMLHttpRequest;m.open("GET",r,!0),m.responseType="arraybuffer",m.onload=()=>{m.status==200||m.status==0&&m.response?o(m.response):s()},m.onerror=s,m.send(null)});var v=console.log.bind(console),k=console.error.bind(console);Object.assign(a,w),w=null,typeof WebAssembly!="object"&&F("no native wasm support detected");var W,H=!1,se,ee,S,j,Ce;function Ue(){var r=W.buffer;a.HEAP8=se=new Int8Array(r),a.HEAP16=new Int16Array(r),a.HEAPU8=ee=new Uint8Array(r),a.HEAPU16=new Uint16Array(r),a.HEAP32=S=new Int32Array(r),a.HEAPU32=j=new Uint32Array(r),a.HEAPF32=new Float32Array(r),a.HEAPF64=Ce=new Float64Array(r)}var ce=[],ne=[],Q=[],Oe=0,he=null,ae=null;function F(r){throw r="Aborted("+r+")",k(r),H=!0,r=new WebAssembly.RuntimeError(r+". Build with -sASSERTIONS for more info."),f(r),r}var ye=r=>r.startsWith("data:application/octet-stream;base64,"),ve=r=>r.startsWith("file://"),fe;if(fe="ort-wasm.wasm",!ye(fe)){var _e=fe;fe=a.locateFile?a.locateFile(_e,U):U+_e}function Y(r){if(K)return K(r);throw"both async and sync fetching of the wasm failed"}function pe(r){if(i||E){if(typeof fetch=="function"&&!ve(r))return fetch(r,{credentials:"same-origin"}).then(o=>{if(!o.ok)throw"failed to load wasm binary file at \'"+r+"\'";return o.arrayBuffer()}).catch(()=>Y(r));if(x)return new Promise((o,s)=>{x(r,m=>o(new Uint8Array(m)),s)})}return Promise.resolve().then(()=>Y(r))}function Ie(r,o,s){return pe(r).then(m=>WebAssembly.instantiate(m,o)).then(m=>m).then(s,m=>{k(`failed to asynchronously prepare wasm: ${m}`),F(m)})}function Ee(r,o){var s=fe;return typeof WebAssembly.instantiateStreaming!="function"||ye(s)||ve(s)||P||typeof fetch!="function"?Ie(s,r,o):fetch(s,{credentials:"same-origin"}).then(m=>WebAssembly.instantiateStreaming(m,r).then(o,function(O){return k(`wasm streaming compile failed: ${O}`),k("falling back to ArrayBuffer instantiation"),Ie(s,r,o)}))}var be,we={920016:(r,o,s,m)=>{if(typeof a>"u"||!a.za)return 1;if(r=z(r>>>0),r.startsWith("./")&&(r=r.substring(2)),r=a.za.get(r),!r)return 2;if(o>>>=0,s>>>=0,o+s>r.byteLength)return 3;try{return ee.set(r.subarray(o,o+s),m>>>0>>>0),0}catch{return 4}}};function Le(r){this.xa=r-24,this.Ha=function(o){j[this.xa+4>>>2>>>0]=o},this.Ga=function(o){j[this.xa+8>>>2>>>0]=o},this.Aa=function(o,s){this.Fa(),this.Ha(o),this.Ga(s)},this.Fa=function(){j[this.xa+16>>>2>>>0]=0}}var me=0,Se=0,De=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,te=(r,o,s)=>{o>>>=0;var m=o+s;for(s=o;r[s]&&!(s>=m);)++s;if(16<s-o&&r.buffer&&De)return De.decode(r.subarray(o,s));for(m="";o<s;){var O=r[o++];if(O&128){var A=r[o++]&63;if((O&224)==192)m+=String.fromCharCode((O&31)<<6|A);else{var L=r[o++]&63;
1809O=(O&240)==224?(O&15)<<12|A<<6|L:(O&7)<<18|A<<12|L<<6|r[o++]&63,65536>O?m+=String.fromCharCode(O):(O-=65536,m+=String.fromCharCode(55296|O>>10,56320|O&1023))}}else m+=String.fromCharCode(O)}return m},z=(r,o)=>(r>>>=0)?te(ee,r,o):"",le=r=>{for(var o=0,s=0;s<r.length;++s){var m=r.charCodeAt(s);127>=m?o++:2047>=m?o+=2:55296<=m&&57343>=m?(o+=4,++s):o+=3}return o},Fe=(r,o,s,m)=>{if(s>>>=0,!(0<m))return 0;var O=s;m=s+m-1;for(var A=0;A<r.length;++A){var L=r.charCodeAt(A);if(55296<=L&&57343>=L){var re=r.charCodeAt(++A);L=65536+((L&1023)<<10)|re&1023}if(127>=L){if(s>=m)break;o[s++>>>0]=L}else{if(2047>=L){if(s+1>=m)break;o[s++>>>0]=192|L>>6}else{if(65535>=L){if(s+2>=m)break;o[s++>>>0]=224|L>>12}else{if(s+3>=m)break;o[s++>>>0]=240|L>>18,o[s++>>>0]=128|L>>12&63}o[s++>>>0]=128|L>>6&63}o[s++>>>0]=128|L&63}}return o[s>>>0]=0,s-O},Ae=r=>r%4===0&&(r%100!==0||r%400===0),qe=[0,31,60,91,121,152,182,213,244,274,305,335],at=[0,31,59,90,120,151,181,212,243,273,304,334],xe=r=>{var o=le(r)+1,s=st(o);return s&&Fe(r,ee,s,o),s},Ne=[],Re={},He=()=>{if(!Ge){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"},o;for(o in Re)Re[o]===void 0?delete r[o]:r[o]=Re[o];var s=[];for(o in r)s.push(`${o}=${r[o]}`);Ge=s}return Ge},Ge,Be=[null,[],[]],Ve=[31,29,31,30,31,30,31,31,30,31,30,31],Je=[31,28,31,30,31,30,31,31,30,31,30,31];function $e(r){var o=Array(le(r)+1);return Fe(r,o,0,o.length),o}function ot(r,o,s,m){function O(d,B,$){for(d=typeof d=="number"?d.toString():d||"";d.length<B;)d=$[0]+d;return d}function A(d,B){return O(d,B,"0")}function L(d,B){function $(et){return 0>et?-1:0<et?1:0}var Te;return(Te=$(d.getFullYear()-B.getFullYear()))===0&&(Te=$(d.getMonth()-B.getMonth()))===0&&(Te=$(d.getDate()-B.getDate())),Te}function re(d){switch(d.getDay()){case 0:return new Date(d.getFullYear()-1,11,29);case 1:return d;case 2:return new Date(d.getFullYear(),0,3);case 3:return new Date(d.getFullYear(),0,2);case 4:return new Date(d.getFullYear(),0,1);case 5:return new Date(d.getFullYear()-1,11,31);case 6:return new Date(d.getFullYear()-1,11,30)}}function de(d){var B=d.ta;for(d=new Date(new Date(d.ua+1900,0,1).getTime());0<B;){var $=d.getMonth(),Te=(Ae(d.getFullYear())?Ve:Je)[$];if(B>Te-d.getDate())B-=Te-d.getDate()+1,d.setDate(1),11>$?d.setMonth($+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else{d.setDate(d.getDate()+B);break}}return $=new Date(d.getFullYear()+1,0,4),B=re(new Date(d.getFullYear(),0,4)),$=re($),0>=L(B,d)?0>=L($,d)?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}r>>>=0,o>>>=0,s>>>=0,m>>>=0;var ie=j[m+40>>>2>>>0];m={Da:S[m>>>2>>>0],Ca:S[m+4>>>2>>>0],va:S[m+8>>>2>>>0],ya:S[m+12>>>2>>>0],wa:S[m+16>>>2>>>0],ua:S[m+20>>>2>>>0],oa:S[m+24>>>2>>>0],ta:S[m+28>>>2>>>0],Ia:S[m+32>>>2>>>0],Ba:S[m+36>>>2>>>0],Ea:ie?z(ie):""},s=z(s),ie={"%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"};for(var ue in ie)s=s.replace(new RegExp(ue,"g"),ie[ue]);var Ze="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Ke="January February March April May June July August September October November December".split(" ");ie={"%a":d=>Ze[d.oa].substring(0,3),"%A":d=>Ze[d.oa],"%b":d=>Ke[d.wa].substring(0,3),"%B":d=>Ke[d.wa],"%C":d=>A((d.ua+1900)/100|0,2),"%d":d=>A(d.ya,2),"%e":d=>O(d.ya,2," "),"%g":d=>de(d).toString().substring(2),"%G":d=>de(d),"%H":d=>A(d.va,2),"%I":d=>(d=d.va,d==0?d=12:12<d&&(d-=12),A(d,2)),"%j":d=>{for(var B=0,$=0;$<=d.wa-1;B+=(Ae(d.ua+1900)?Ve:Je)[$++]);return A(d.ya+B,3)},"%m":d=>A(d.wa+1,2),"%M":d=>A(d.Ca,2),"%n":()=>`\n`,"%p":d=>0<=d.va&&12>d.va?"AM":"PM","%S":d=>A(d.Da,2),"%t":()=>"	","%u":d=>d.oa||7,"%U":d=>A(Math.floor((d.ta+7-d.oa)/7),2),"%V":d=>{var B=Math.floor((d.ta+7-(d.oa+6)%7)/7);if(2>=(d.oa+371-d.ta-2)%7&&B++,B)B==53&&($=(d.oa+371-d.ta)%7,$==4||$==3&&Ae(d.ua)||(B=1));else{B=52;var $=(d.oa+7-d.ta-1)%7;($==4||$==5&&Ae(d.ua%400-1))&&B++}return A(B,2)},"%w":d=>d.oa,"%W":d=>A(Math.floor((d.ta+7-(d.oa+6)%7)/7),2),"%y":d=>(d.ua+1900).toString().substring(2),"%Y":d=>d.ua+1900,"%z":d=>{d=d.Ba;var B=0<=d;return d=Math.abs(d)/60,(B?"+":"-")+("0000"+(d/60*100+d%60)).slice(-4)},"%Z":d=>d.Ea,"%%":()=>"%"},s=s.replace(/%%/g,"\\0\\0");for(ue in ie)s.includes(ue)&&(s=s.replace(new RegExp(ue,"g"),ie[ue](m)));return s=s.replace(/\\0\\0/g,"%"),ue=$e(s),ue.length>
1809o?0:(se.set(ue,r>>>0),ue.length-1)}var G={a:function(r,o,s){throw r>>>=0,new Le(r).Aa(o>>>0,s>>>0),me=r,Se++,me},e:function(){return 0},H:function(){},x:function(){},z:function(){},J:function(){return 0},F:function(){},A:function(){},E:function(){},g:function(){},y:function(){},v:function(){},G:function(){},w:function(){},k:()=>1,n:function(r,o,s){r=o+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*o:NaN,s>>>=0,r=new Date(1e3*r),S[s>>>2>>>0]=r.getUTCSeconds(),S[s+4>>>2>>>0]=r.getUTCMinutes(),S[s+8>>>2>>>0]=r.getUTCHours(),S[s+12>>>2>>>0]=r.getUTCDate(),S[s+16>>>2>>>0]=r.getUTCMonth(),S[s+20>>>2>>>0]=r.getUTCFullYear()-1900,S[s+24>>>2>>>0]=r.getUTCDay(),S[s+28>>>2>>>0]=(r.getTime()-Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},o:function(r,o,s){r=o+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*o:NaN,s>>>=0,r=new Date(1e3*r),S[s>>>2>>>0]=r.getSeconds(),S[s+4>>>2>>>0]=r.getMinutes(),S[s+8>>>2>>>0]=r.getHours(),S[s+12>>>2>>>0]=r.getDate(),S[s+16>>>2>>>0]=r.getMonth(),S[s+20>>>2>>>0]=r.getFullYear()-1900,S[s+24>>>2>>>0]=r.getDay(),S[s+28>>>2>>>0]=(Ae(r.getFullYear())?qe:at)[r.getMonth()]+r.getDate()-1|0,S[s+36>>>2>>>0]=-(60*r.getTimezoneOffset()),o=new Date(r.getFullYear(),6,1).getTimezoneOffset();var m=new Date(r.getFullYear(),0,1).getTimezoneOffset();S[s+32>>>2>>>0]=(o!=m&&r.getTimezoneOffset()==Math.min(m,o))|0},p:function(r){r>>>=0;var o=new Date(S[r+20>>>2>>>0]+1900,S[r+16>>>2>>>0],S[r+12>>>2>>>0],S[r+8>>>2>>>0],S[r+4>>>2>>>0],S[r>>>2>>>0],0),s=S[r+32>>>2>>>0],m=o.getTimezoneOffset(),O=new Date(o.getFullYear(),6,1).getTimezoneOffset(),A=new Date(o.getFullYear(),0,1).getTimezoneOffset(),L=Math.min(A,O);return 0>s?S[r+32>>>2>>>0]=+(O!=A&&L==m):0<s!=(L==m)&&(O=Math.max(A,O),o.setTime(o.getTime()+6e4*((0<s?L:O)-m))),S[r+24>>>2>>>0]=o.getDay(),S[r+28>>>2>>>0]=(Ae(o.getFullYear())?qe:at)[o.getMonth()]+o.getDate()-1|0,S[r>>>2>>>0]=o.getSeconds(),S[r+4>>>2>>>0]=o.getMinutes(),S[r+8>>>2>>>0]=o.getHours(),S[r+12>>>2>>>0]=o.getDate(),S[r+16>>>2>>>0]=o.getMonth(),S[r+20>>>2>>>0]=o.getYear(),r=o.getTime(),isNaN(r)?(S[je()>>>2>>>0]=61,r=-1):r/=1e3,Xe((be=r,1<=+Math.abs(be)?0<be?+Math.floor(be/4294967296)>>>0:~~+Math.ceil((be-+(~~be>>>0))/4294967296)>>>0:0)),r>>>0},l:function(){return-52},m:function(){},t:function(r,o,s){function m(de){return(de=de.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?de[1]:"GMT"}s>>>=0;var O=new Date().getFullYear(),A=new Date(O,0,1),L=new Date(O,6,1);O=A.getTimezoneOffset();var re=L.getTimezoneOffset();j[r>>>0>>>2>>>0]=60*Math.max(O,re),S[o>>>0>>>2>>>0]=+(O!=re),r=m(A),o=m(L),r=xe(r),o=xe(o),re<O?(j[s>>>2>>>0]=r,j[s+4>>>2>>>0]=o):(j[s>>>2>>>0]=o,j[s+4>>>2>>>0]=r)},d:()=>{F("")},B:function(r,o,s){r>>>=0,o>>>=0,s>>>=0,Ne.length=0;for(var m;m=ee[o++>>>0];){var O=m!=105;O&=m!=112,s+=O&&s%8?4:0,Ne.push(m==112?j[s>>>2>>>0]:m==105?S[s>>>2>>>0]:Ce[s>>>3>>>0]),s+=O?8:4}return we[r].apply(null,Ne)},h:()=>Date.now(),u:function(){return 4294901760},b:()=>performance.now(),I:function(r,o,s){return o>>>=0,ee.copyWithin(r>>>0>>>0,o>>>0,o+(s>>>0)>>>0)},s:function(r){r>>>=0;var o=ee.length;if(4294901760<r)return!1;for(var s=1;4>=s;s*=2){var m=o*(1+.2/s);m=Math.min(m,r+100663296);var O=Math;m=Math.max(r,m);e:{O=(O.min.call(O,4294901760,m+(65536-m%65536)%65536)-W.buffer.byteLength+65535)/65536;try{W.grow(O),Ue();var A=1;break e}catch{}A=void 0}if(A)return!0}return!1},C:function(r,o){r>>>=0,o>>>=0;var s=0;return He().forEach((m,O)=>{var A=o+s;for(O=j[r+4*O>>>2>>>0]=A,A=0;A<m.length;++A)se[O++>>>0>>>0]=m.charCodeAt(A);se[O>>>0>>>0]=0,s+=m.length+1}),0},D:function(r,o){r>>>=0,o>>>=0;var s=He();j[r>>>2>>>0]=s.length;var m=0;return s.forEach(O=>m+=O.length+1),j[o>>>2>>>0]=m,0},f:()=>52,j:function(){return 52},q:function(){return 70},i:function(r,o,s,m){o>>>=0,s>>>=0,m>>>=0;for(var O=0,A=0;A<s;A++){var L=j[o>>>2>>>0],re=j[o+4>>>2>>>0];o+=8;for(var de=0;de<re;de++){var ie=ee[L+de>>>0],ue=Be[r];ie===0||ie===10?((r===1?v:k)(te(ue,0)),ue.length=0):ue.push(ie)}O+=re}return j[m>>>2>>>0]=O,0},r:ot,c:function(r,o,s,m){return ot(r>>>0,o>>>0,s>>>0,m>>>0)}},C=function(){function r(s){return C=s.exports,C=ut(),W=C.K,Ue(),ne.unshift(C.L),Oe--,Oe==0&&(he!==null&&(clearInterval(he),he=null),ae&&(s=ae,ae=null,s())),C}var o={a:G};if(Oe++,a.instantiateWasm)try{return a.instantiateWasm(o,r)}catch(s){k(`Module.instantiateWasm callback failed with error: ${s}`),f(s)}return Ee(o,function(s){r(s.instance)}).catch(f),{}}();a._OrtInit=(r,o)=>(a._OrtInit=C.M)(r,o),a._OrtGetLastError=(r,o)=>(a._OrtGetLastError=C.N)(r,o),a._OrtCreateSessionOptions=(r,o,s,m,O,A,L,re,de,ie)=>(a._OrtCreateSessionOptions=C.O)(r,o,s,m,O,A,L,re,de,ie),a._OrtAppendExecutionProvider=(r,o)=>(a._OrtAppendExecutionProvider=C.P)(r,o),a._OrtAddFreeDimensionOverride=(r,o,s)=>(a._OrtAddFreeDimensionOverride=C.Q)(r,o,s),a._OrtAddSessionConfigEntry=(r,o,s)=>(a._OrtAddSessionConfigEntry=C.R)(r,o,s),a._OrtReleaseSessionOptions=r=>(a._OrtReleaseSessionOptions=C.S)(r),a._OrtCreateSession=(r,o,s)=>(a._OrtCreateSession=C.T)(r,o,s),a._OrtReleaseSession=r=>(a._OrtReleaseSession=C.U)(r),a._OrtGetInputOutputCount=(r,o,s)=>(a._OrtGetInputOutputCount=C.V)(r,o,s),a._OrtGetInputName=(r,o)=>(a._OrtGetInputName=C.W)(r,o),a._OrtGetOutputName=(r,o)=>
1809(a._OrtGetOutputName=C.X)(r,o),a._OrtFree=r=>(a._OrtFree=C.Y)(r),a._OrtCreateTensor=(r,o,s,m,O,A)=>(a._OrtCreateTensor=C.Z)(r,o,s,m,O,A),a._OrtGetTensorData=(r,o,s,m,O)=>(a._OrtGetTensorData=C._)(r,o,s,m,O),a._OrtReleaseTensor=r=>(a._OrtReleaseTensor=C.$)(r),a._OrtCreateRunOptions=(r,o,s,m)=>(a._OrtCreateRunOptions=C.aa)(r,o,s,m),a._OrtAddRunConfigEntry=(r,o,s)=>(a._OrtAddRunConfigEntry=C.ba)(r,o,s),a._OrtReleaseRunOptions=r=>(a._OrtReleaseRunOptions=C.ca)(r),a._OrtCreateBinding=r=>(a._OrtCreateBinding=C.da)(r),a._OrtBindInput=(r,o,s)=>(a._OrtBindInput=C.ea)(r,o,s),a._OrtBindOutput=(r,o,s,m)=>(a._OrtBindOutput=C.fa)(r,o,s,m),a._OrtClearBoundOutputs=r=>(a._OrtClearBoundOutputs=C.ga)(r),a._OrtReleaseBinding=r=>(a._OrtReleaseBinding=C.ha)(r),a._OrtRunWithBinding=(r,o,s,m,O)=>(a._OrtRunWithBinding=C.ia)(r,o,s,m,O),a._OrtRun=(r,o,s,m,O,A,L,re)=>(a._OrtRun=C.ja)(r,o,s,m,O,A,L,re),a._OrtEndProfiling=r=>(a._OrtEndProfiling=C.ka)(r);var je=()=>(je=C.la)(),st=a._malloc=r=>(st=a._malloc=C.ma)(r);a._free=r=>(a._free=C.na)(r);var Xe=r=>(Xe=C.pa)(r),it=()=>(it=C.qa)(),M=r=>(M=C.ra)(r),ke=r=>(ke=C.sa)(r);function ut(){var r=C;r=Object.assign({},r);var o=m=>()=>m()>>>0,s=m=>O=>m(O)>>>0;return r.la=o(r.la),r.ma=s(r.ma),r.qa=o(r.qa),r.sa=s(r.sa),r}a.stackAlloc=ke,a.stackSave=it,a.stackRestore=M,a.UTF8ToString=z,a.stringToUTF8=(r,o,s)=>Fe(r,ee,o,s),a.lengthBytesUTF8=le;var Pe;ae=function r(){Pe||Qe(),Pe||(ae=r)};function Qe(){if(!(0<Oe)){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;){var r=a.preRun.shift();ce.unshift(r)}for(;0<ce.length;)ce.shift()(a);if(!(0<Oe||Pe||(Pe=!0,a.calledRun=!0,H))){for(;0<ne.length;)ne.shift()(a);for(h(a);0<Q.length;)Q.shift()(a)}}}return Qe(),c.ready}})();typeof mr=="object"&&typeof Ft=="object"?Ft.exports=pr:typeof define=="function"&&define.amd&&define([],()=>pr)});var hr=tt(()=>{});var yr=tt(()=>{});var br={};At(br,{cpus:()=>rn});var rn,wr=St(()=>{rn=void 0});var _r=tt((vr,xt)=>{"use strict";var Or=(()=>{var u=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(u=u||__filename),function(c={}){function a(){return Q.buffer!=F.buffer&&Y(),F}function h(){return Q.buffer!=F.buffer&&Y(),ye}function f(){return Q.buffer!=F.buffer&&Y(),ve}function w(){return Q.buffer!=F.buffer&&Y(),fe}function g(){return Q.buffer!=F.buffer&&Y(),_e}var i=c,E,P;i.ready=new Promise((e,t)=>{E=e,P=t});var U=Object.assign({},i),D="./this.program",x=(e,t)=>{throw t},K=typeof window=="object",R=typeof importScripts=="function",I=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",v=i.ENVIRONMENT_IS_PTHREAD||!1,k="";function W(e){return i.locateFile?i.locateFile(e,k):k+e}var H,se,ee;if(I){var S=(Mt(),rt(Tt)),j=(Dt(),rt(Ct));k=R?j.dirname(k)+"/":__dirname+"/",H=(t,n)=>(t=z(t)?new URL(t):j.normalize(t),S.readFileSync(t,n?void 0:"utf8")),ee=t=>(t=H(t,!0),t.buffer||(t=new Uint8Array(t)),t),se=(t,n,l,y=!0)=>{t=z(t)?new URL(t):j.normalize(t),S.readFile(t,y?void 0:"utf8",(b,_)=>{b?l(b):n(y?_.buffer:_)})},!i.thisProgram&&1<process.argv.length&&(D=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),x=(t,n)=>{throw process.exitCode=t,n},i.inspect=()=>"[Emscripten Module object]";let e;try{e=hr()}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}global.Worker=e.Worker}else(K||R)&&(R?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),typeof u<"u"&&u&&(k=u),k.indexOf("blob:")!==0?k=k.substr(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1):k="",I||(H=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},R&&(ee=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),se=(e,t,n)=>{var l=new XMLHttpRequest;l.open("GET",e,!0),l.responseType="arraybuffer",l.onload=()=>{l.status==200||l.status==0&&l.response?t(l.response):n()},l.onerror=n,l.send(null)}));I&&typeof performance>"u"&&(global.performance=yr().performance);var Ce=console.log.bind(console),Ue=console.error.bind(console);I&&(Ce=(...e)=>S.writeSync(1,e.join(" ")+`\n`),Ue=(...e)=>S.writeSync(2,e.join(" ")+`\n`));var ce=Ce,ne=Ue;Object.assign(i,U),U=null,typeof WebAssembly!="object"&&De("no native wasm support detected");var Q,Oe,he=!1,ae,F,ye,ve,fe,_e;function Y(){var e=Q.buffer;i.HEAP8=F=new Int8Array(e),i.HEAP16=new Int16Array(e),i.HEAPU8=ye=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAP32=ve=new Int32Array(e),i.HEAPU32=fe=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=_e=new Float64Array(e)}var pe=16777216;if(v)Q=i.wasmMemory;else if(i.wasmMemory)Q=i.wasmMemory;else if(Q=new WebAssembly.Memory({initial:pe/65536,maximum:65536,shared:!0}),!(Q.buffer instanceof SharedArrayBuffer))throw ne("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 
1809need to set a flag"),I&&ne("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");Y(),pe=Q.buffer.byteLength;var Ie=[],Ee=[],be=[],we=0,Le=null,me=null;function Se(){if(we--,we==0&&(Le!==null&&(clearInterval(Le),Le=null),me)){var e=me;me=null,e()}}function De(e){throw e="Aborted("+e+")",ne(e),he=!0,ae=1,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),P(e),e}var te=e=>e.startsWith("data:application/octet-stream;base64,"),z=e=>e.startsWith("file://"),le;le="ort-wasm-threaded.wasm",te(le)||(le=W(le));function Fe(e){if(ee)return ee(e);throw"both async and sync fetching of the wasm failed"}function Ae(e){if(K||R){if(typeof fetch=="function"&&!z(e))return fetch(e,{credentials:"same-origin"}).then(t=>{if(!t.ok)throw"failed to load wasm binary file at \'"+e+"\'";return t.arrayBuffer()}).catch(()=>Fe(e));if(se)return new Promise((t,n)=>{se(e,l=>t(new Uint8Array(l)),n)})}return Promise.resolve().then(()=>Fe(e))}function qe(e,t,n){return Ae(e).then(l=>WebAssembly.instantiate(l,t)).then(l=>l).then(n,l=>{ne(`failed to asynchronously prepare wasm: ${l}`),De(l)})}function at(e,t){var n=le;return typeof WebAssembly.instantiateStreaming!="function"||te(n)||z(n)||I||typeof fetch!="function"?qe(n,e,t):fetch(n,{credentials:"same-origin"}).then(l=>WebAssembly.instantiateStreaming(l,e).then(t,function(y){return ne(`wasm streaming compile failed: ${y}`),ne("falling back to ArrayBuffer instantiation"),qe(n,e,t)}))}var xe,Ne={921388:(e,t,n,l)=>{if(typeof i>"u"||!i.cb)return 1;if(e=$e(e>>>0),e.startsWith("./")&&(e=e.substring(2)),e=i.cb.get(e),!e)return 2;if(t>>>=0,n>>>=0,l>>>=0,t+n>e.byteLength)return 3;try{return h().set(e.subarray(t,t+n),l>>>0),0}catch{return 4}}};function Re(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var He=e=>{e.terminate(),e.onmessage=()=>{}},Ge=e=>{M.Pa.length==0&&(Xe(),M.Ya(M.Pa[0]));var t=M.Pa.pop();if(!t)return 6;M.Qa.push(t),M.Ma[e.Oa]=t,t.Oa=e.Oa;var n={cmd:"run",start_routine:e.kb,arg:e.hb,pthread_ptr:e.Oa};return I&&t.unref(),t.postMessage(n,e.qb),0},Be=0,Ve=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Je=(e,t,n)=>{t>>>=0;var l=t+n;for(n=t;e[n]&&!(n>=l);)++n;if(16<n-t&&e.buffer&&Ve)return Ve.decode(e.buffer instanceof SharedArrayBuffer?e.slice(t,n):e.subarray(t,n));for(l="";t<n;){var y=e[t++];if(y&128){var b=e[t++]&63;if((y&224)==192)l+=String.fromCharCode((y&31)<<6|b);else{var _=e[t++]&63;y=(y&240)==224?(y&15)<<12|b<<6|_:(y&7)<<18|b<<12|_<<6|e[t++]&63,65536>y?l+=String.fromCharCode(y):(y-=65536,l+=String.fromCharCode(55296|y>>10,56320|y&1023))}}else l+=String.fromCharCode(y)}return l},$e=(e,t)=>(e>>>=0)?Je(h(),e,t):"",ot=e=>{var t=vt();return e=e(),ct(t),e};function G(e,t){var n=arguments.length-2,l=arguments;return ot(()=>{for(var y=_t(8*n),b=y>>>3,_=0;_<n;_++){var J=l[2+_];g()[b+_>>>0]=J}return ar(e,n,y,t)})}function C(e){if(v)return G(0,1,e);ae=e,0<Be||(M.lb(),i.onExit?.(e),he=!0),x(e,new Re(e))}var je=e=>{if(ae=e,v)throw ut(e),"unwind";C(e)};function st(){for(var e=i.numThreads;e--;)Xe();Ie.unshift(()=>{we++,it(()=>Se())})}function Xe(){var e=W("ort-wasm-threaded.worker.js");e=new Worker(e),M.Pa.push(e)}function it(e){v?e():Promise.all(M.Pa.map(M.Ya)).then(e)}var M={Pa:[],Qa:[],bb:[],Ma:{},Wa(){v?(M.receiveObjectTransfer=M.jb,M.threadInitTLS=M.ab,M.setExitStatus=M.$a):st()},$a:e=>ae=e,tb:["$terminateWorker"],lb:()=>{for(var e of M.Qa)He(e);for(e of M.Pa)He(e);M.Pa=[],M.Qa=[],M.Ma=[]},Za:e=>{var t=e.Oa;delete M.Ma[t],M.Pa.push(e),M.Qa.splice(M.Qa.indexOf(e),1),e.Oa=0,wt(t)},jb(){},ab(){M.bb.forEach(e=>e())},Ya:e=>new Promise(t=>{e.onmessage=b=>{b=b.data;var _=b.cmd;if(b.targetThread&&b.targetThread!=lt()){var J=M.Ma[b.targetThread];J?J.postMessage(b,b.transferList):ne(`Internal error! Worker sent a message "${_}" to target pthread ${b.targetThread}, but that thread no longer exists!`)}else _==="checkMailbox"?ft():_==="spawnThread"?Ge(b):_==="cleanupThread"?M.Za(M.Ma[b.thread]):_==="killThread"?(b=b.thread,_=M.Ma[b],delete M.Ma[b],He(_),wt(b),M.Qa.splice(M.Qa.indexOf(_),1),_.Oa=0):_==="cancelThread"?M.Ma[b.thread].postMessage({cmd:"cancel"}):_==="loaded"?(e.loaded=!0,I&&!e.Oa&&e.unref(),t(e)):_==="alert"?alert(`Thread ${b.threadId}: ${b.text}`):b.target==="setimmediate"?e.postMessage(b):_==="callHandler"?i[b.handler](...b.args):_&&ne(`worker sent an unknown command ${_}`)},e.onerror=b=>{throw ne(`worker sent an error! ${b.filename}:${b.lineno}: ${b.message}`),b},I&&(e.on("message",b=>e.onmessage({data:b})),e.on("error",b=>e.onerror(b)));var n=[],l=["onExit"],y;for(y of l)i.hasOwnProperty(y)&&n.push(y);e.postMessage({cmd:"load",handlers:n,urlOrBlob:i.mainScriptUrlOrBlob||u,wasmMemory:Q,wasmModule:Oe})})};i.PThread=M;var ke=e=>{for(;0<e.length;)e.shift()(i)};i.establishStackSpace=()=>{var e=lt(),t=w()[e+52>>>2>>>0];e=w()[e+56>>>2>>>0],ir(t,t-e),ct(t)};function ut(e){if(v)return G(1,0,e);je(e)}var Pe=[],Qe;i.invokeEntryPoint=(e,t)=>
1809{var n=Pe[e];n||(e>=Pe.length&&(Pe.length=e+1),Pe[e]=n=Qe.get(e)),e=n(t),0<Be?M.$a(e):Ot(e)};function r(e){this.Va=e-24,this.gb=function(t){w()[this.Va+4>>>2>>>0]=t},this.fb=function(t){w()[this.Va+8>>>2>>>0]=t},this.Wa=function(t,n){this.eb(),this.gb(t),this.fb(n)},this.eb=function(){w()[this.Va+16>>>2>>>0]=0}}var o=0,s=0;function m(e,t,n,l){return v?G(2,1,e,t,n,l):O(e,t,n,l)}function O(e,t,n,l){if(e>>>=0,t>>>=0,n>>>=0,l>>>=0,typeof SharedArrayBuffer>"u")return ne("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var y=[];return v&&y.length===0?m(e,t,n,l):(e={kb:n,Oa:e,hb:l,qb:y},v?(e.sb="spawnThread",postMessage(e,y),0):Ge(e))}function A(e,t,n){return v?G(3,1,e,t,n):0}function L(e,t){if(v)return G(4,1,e,t)}var re=e=>{for(var t=0,n=0;n<e.length;++n){var l=e.charCodeAt(n);127>=l?t++:2047>=l?t+=2:55296<=l&&57343>=l?(t+=4,++n):t+=3}return t},de=(e,t,n,l)=>{if(n>>>=0,!(0<l))return 0;var y=n;l=n+l-1;for(var b=0;b<e.length;++b){var _=e.charCodeAt(b);if(55296<=_&&57343>=_){var J=e.charCodeAt(++b);_=65536+((_&1023)<<10)|J&1023}if(127>=_){if(n>=l)break;t[n++>>>0]=_}else{if(2047>=_){if(n+1>=l)break;t[n++>>>0]=192|_>>6}else{if(65535>=_){if(n+2>=l)break;t[n++>>>0]=224|_>>12}else{if(n+3>=l)break;t[n++>>>0]=240|_>>18,t[n++>>>0]=128|_>>12&63}t[n++>>>0]=128|_>>6&63}t[n++>>>0]=128|_&63}}return t[n>>>0]=0,n-y},ie=(e,t,n)=>de(e,h(),t,n);function ue(e,t){if(v)return G(5,1,e,t)}function Ze(e,t,n){if(v)return G(6,1,e,t,n)}function Ke(e,t,n){return v?G(7,1,e,t,n):0}function d(e,t){if(v)return G(8,1,e,t)}function B(e,t,n){if(v)return G(9,1,e,t,n)}function $(e,t,n,l){if(v)return G(10,1,e,t,n,l)}function Te(e,t,n,l){if(v)return G(11,1,e,t,n,l)}function et(e,t,n,l){if(v)return G(12,1,e,t,n,l)}function Bt(e){if(v)return G(13,1,e)}function kt(e,t){if(v)return G(14,1,e,t)}function Wt(e,t,n){if(v)return G(15,1,e,t,n)}function mt(e){e>>>=0,typeof Atomics.rb=="function"&&(Atomics.rb(f(),e>>>2,e).value.then(ft),e+=128,Atomics.store(f(),e>>>2,1))}i.__emscripten_thread_mailbox_await=mt;var ft=()=>{var e=lt();if(e&&(mt(e),e=or,!he))try{if(e(),!(0<Be))try{v?Ot(ae):je(ae)}catch(t){t instanceof Re||t=="unwind"||x(1,t)}}catch(t){t instanceof Re||t=="unwind"||x(1,t)}};i.checkMailbox=ft;var gt=[],Ye=e=>e%4===0&&(e%100!==0||e%400===0),Nt=[0,31,60,91,121,152,182,213,244,274,305,335],Ht=[0,31,59,90,120,151,181,212,243,273,304,334];function Gt(e,t,n,l,y,b,_,J){return v?G(16,1,e,t,n,l,y,b,_,J):-52}function $t(e,t,n,l,y,b,_){if(v)return G(17,1,e,t,n,l,y,b,_)}var jt=e=>{var t=re(e)+1,n=rr(t);return n&&ie(e,n,t),n},ht=[],yt={},Yt=()=>{if(!bt){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:D||"./this.program"},t;for(t in yt)yt[t]===void 0?delete e[t]:e[t]=yt[t];var n=[];for(t in e)n.push(`${t}=${e[t]}`);bt=n}return bt},bt;function zt(e,t){if(v)return G(18,1,e,t);e>>>=0,t>>>=0;var n=0;return Yt().forEach((l,y)=>{var b=t+n;for(y=w()[e+4*y>>>2>>>0]=b,b=0;b<l.length;++b)a()[y++>>>0>>>0]=l.charCodeAt(b);a()[y>>>0>>>0]=0,n+=l.length+1}),0}function qt(e,t){if(v)return G(19,1,e,t);e>>>=0,t>>>=0;var n=Yt();w()[e>>>2>>>0]=n.length;var l=0;return n.forEach(y=>l+=y.length+1),w()[t>>>2>>>0]=l,0}function Vt(e){return v?G(20,1,e):52}function Jt(e,t,n,l){return v?G(21,1,e,t,n,l):52}function Xt(e,t,n,l,y){return v?G(22,1,e,t,n,l,y):70}var $r=[null,[],[]];function Qt(e,t,n,l){if(v)return G(23,1,e,t,n,l);t>>>=0,n>>>=0,l>>>=0;for(var y=0,b=0;b<n;b++){var _=w()[t>>>2>>>0],J=w()[t+4>>>2>>>0];t+=8;for(var Me=0;Me<J;Me++){var oe=h()[_+Me>>>0],ge=$r[e];oe===0||oe===10?((e===1?ce:ne)(Je(ge,0)),ge.length=0):ge.push(oe)}y+=J}return w()[l>>>2>>>0]=y,0}var Zt=[31,29,31,30,31,30,31,31,30,31,30,31],Kt=[31,28,31,30,31,30,31,31,30,31,30,31];function jr(e){var t=Array(re(e)+1);return de(e,t,0,t.length),t}var Yr=(e,t)=>{a().set(e,t>>>0)};function er(e,t,n,l){function y(p,N,X){for(p=typeof p=="number"?p.toString():p||"";p.length<N;)p=X[0]+p;return p}function b(p,N){return y(p,N,"0")}function _(p,N){function X(cr){return 0>cr?-1:0<cr?1:0}var We;return(We=X(p.getFullYear()-N.getFullYear()))===0&&(We=X(p.getMonth()-N.getMonth()))===0&&(We=X(p.getDate()-N.getDate())),We}function J(p){switch(p.getDay()){case 0:return new Date(p.getFullYear()-1,11,29);case 1:return p;case 2:return new Date(p.getFullYear(),0,3);case 3:return new Date(p.getFullYear(),0,2);case 4:return new Date(p.getFullYear(),0,1);case 5:return new Date(p.getFullYear()-1,11,31);case 6:return new Date(p.getFullYear()-1,11,30)}}function Me(p){var N=p.Ra;for(p=new Date(new Date(p.Sa+1900,0,1).getTime());0<N;){var X=p.getMonth(),We=(Ye(p.getFullYear())?Zt:Kt)[X];if(N>We-p.getDate())N-=We-p.getDate()+1,p.setDate(1),11>X?p.setMonth(X+1):(p.setMonth(0),p.setFullYear(p.getFullYear()+1));else{p.setDate(p.getDate()+N);break}}return X=new Date(p.getFullYear()+1,0,4),N=J(new Date(p.getFullYear(),0,4)),X=J(X),0>=_(N,p)?0>=_(X,p)?p.getFullYear()+1:p.getFullYear():p.getFullYear()-1}e>>>=0,t>>>=0,n>>>=0,l>>>=0;var oe=w()[l+40>>>2>>>0];l={ob:f()[l>>>2>>>0],nb:f()[l+4>>>2>>>0],Ta:f()[l+8>>>2>>>0],Xa:f()[l+12>>>2>>>0],Ua:f()[l+16>>>2>>>0],Sa:f()[l+20>>>2>>>0],Na:f()[l+24>>>2>>>0],Ra:f()[l+28>>>2>>>0],ub:f()[l+32>>>2>>>0],mb:f()[l+36>>>2>>>0],pb:oe?$e(oe):""},n=$e(n),oe={"%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"};for(var ge in oe)n=n.replace(new RegExp(ge,"g"),oe[ge]);var fr="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),lr
1809="January February March April May June July August September October November December".split(" ");oe={"%a":p=>fr[p.Na].substring(0,3),"%A":p=>fr[p.Na],"%b":p=>lr[p.Ua].substring(0,3),"%B":p=>lr[p.Ua],"%C":p=>b((p.Sa+1900)/100|0,2),"%d":p=>b(p.Xa,2),"%e":p=>y(p.Xa,2," "),"%g":p=>Me(p).toString().substring(2),"%G":p=>Me(p),"%H":p=>b(p.Ta,2),"%I":p=>(p=p.Ta,p==0?p=12:12<p&&(p-=12),b(p,2)),"%j":p=>{for(var N=0,X=0;X<=p.Ua-1;N+=(Ye(p.Sa+1900)?Zt:Kt)[X++]);return b(p.Xa+N,3)},"%m":p=>b(p.Ua+1,2),"%M":p=>b(p.nb,2),"%n":()=>`\n`,"%p":p=>0<=p.Ta&&12>p.Ta?"AM":"PM","%S":p=>b(p.ob,2),"%t":()=>"	","%u":p=>p.Na||7,"%U":p=>b(Math.floor((p.Ra+7-p.Na)/7),2),"%V":p=>{var N=Math.floor((p.Ra+7-(p.Na+6)%7)/7);if(2>=(p.Na+371-p.Ra-2)%7&&N++,N)N==53&&(X=(p.Na+371-p.Ra)%7,X==4||X==3&&Ye(p.Sa)||(N=1));else{N=52;var X=(p.Na+7-p.Ra-1)%7;(X==4||X==5&&Ye(p.Sa%400-1))&&N++}return b(N,2)},"%w":p=>p.Na,"%W":p=>b(Math.floor((p.Ra+7-(p.Na+6)%7)/7),2),"%y":p=>(p.Sa+1900).toString().substring(2),"%Y":p=>p.Sa+1900,"%z":p=>{p=p.mb;var N=0<=p;return p=Math.abs(p)/60,(N?"+":"-")+("0000"+(p/60*100+p%60)).slice(-4)},"%Z":p=>p.pb,"%%":()=>"%"},n=n.replace(/%%/g,"\\0\\0");for(ge in oe)n.includes(ge)&&(n=n.replace(new RegExp(ge,"g"),oe[ge](l)));return n=n.replace(/\\0\\0/g,"%"),ge=jr(n),ge.length>t?0:(Yr(ge,e),ge.length-1)}M.Wa();var zr=[C,ut,m,A,L,ue,Ze,Ke,d,B,$,Te,et,Bt,kt,Wt,Gt,$t,zt,qt,Vt,Jt,Xt,Qt],qr={b:function(e,t,n){throw e>>>=0,new r(e).Wa(t>>>0,n>>>0),o=e,s++,o},L:function(e){nr(e>>>0,!R,1,!K,131072,!1),M.ab()},j:function(e){e>>>=0,v?postMessage({cmd:"cleanupThread",thread:e}):M.Za(M.Ma[e])},H:O,h:A,S:L,D:ue,F:Ze,T:Ke,Q:d,J:B,P:$,n:Te,E:et,B:Bt,R:kt,C:Wt,p:()=>1,z:function(e,t){e>>>=0,e==t>>>0?setTimeout(()=>ft()):v?postMessage({targetThread:e,cmd:"checkMailbox"}):(e=M.Ma[e])&&e.postMessage({cmd:"checkMailbox"})},I:function(e,t,n,l){t>>>=0,gt.length=n,l=l>>>0>>>3;for(var y=0;y<n;y++)gt[y]=g()[l+y>>>0];return e=0>e?Ne[-e-1]:zr[e],M.ib=t,t=e.apply(null,gt),M.ib=0,t},K:mt,o:function(e){I&&M.Ma[e>>>0].ref()},s:function(e,t,n){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,n>>>=0,e=new Date(1e3*e),f()[n>>>2>>>0]=e.getUTCSeconds(),f()[n+4>>>2>>>0]=e.getUTCMinutes(),f()[n+8>>>2>>>0]=e.getUTCHours(),f()[n+12>>>2>>>0]=e.getUTCDate(),f()[n+16>>>2>>>0]=e.getUTCMonth(),f()[n+20>>>2>>>0]=e.getUTCFullYear()-1900,f()[n+24>>>2>>>0]=e.getUTCDay(),e=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,f()[n+28>>>2>>>0]=e},t:function(e,t,n){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,n>>>=0,e=new Date(1e3*e),f()[n>>>2>>>0]=e.getSeconds(),f()[n+4>>>2>>>0]=e.getMinutes(),f()[n+8>>>2>>>0]=e.getHours(),f()[n+12>>>2>>>0]=e.getDate(),f()[n+16>>>2>>>0]=e.getMonth(),f()[n+20>>>2>>>0]=e.getFullYear()-1900,f()[n+24>>>2>>>0]=e.getDay(),t=(Ye(e.getFullYear())?Nt:Ht)[e.getMonth()]+e.getDate()-1|0,f()[n+28>>>2>>>0]=t,f()[n+36>>>2>>>0]=-(60*e.getTimezoneOffset()),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var l=new Date(e.getFullYear(),0,1).getTimezoneOffset();e=(t!=l&&e.getTimezoneOffset()==Math.min(l,t))|0,f()[n+32>>>2>>>0]=e},u:function(e){e>>>=0;var t=new Date(f()[e+20>>>2>>>0]+1900,f()[e+16>>>2>>>0],f()[e+12>>>2>>>0],f()[e+8>>>2>>>0],f()[e+4>>>2>>>0],f()[e>>>2>>>0],0),n=f()[e+32>>>2>>>0],l=t.getTimezoneOffset(),y=new Date(t.getFullYear(),6,1).getTimezoneOffset(),b=new Date(t.getFullYear(),0,1).getTimezoneOffset(),_=Math.min(b,y);return 0>n?f()[e+32>>>2>>>0]=+(y!=b&&_==l):0<n!=(_==l)&&(y=Math.max(b,y),t.setTime(t.getTime()+6e4*((0<n?_:y)-l))),f()[e+24>>>2>>>0]=t.getDay(),n=(Ye(t.getFullYear())?Nt:Ht)[t.getMonth()]+t.getDate()-1|0,f()[e+28>>>2>>>0]=n,f()[e>>>2>>>0]=t.getSeconds(),f()[e+4>>>2>>>0]=t.getMinutes(),f()[e+8>>>2>>>0]=t.getHours(),f()[e+12>>>2>>>0]=t.getDate(),f()[e+16>>>2>>>0]=t.getMonth(),f()[e+20>>>2>>>0]=t.getYear(),e=t.getTime(),isNaN(e)?(f()[tr()>>>2>>>0]=61,e=-1):e/=1e3,sr((xe=e,1<=+Math.abs(xe)?0<xe?+Math.floor(xe/4294967296)>>>0:~~+Math.ceil((xe-+(~~xe>>>0))/4294967296)>>>0:0)),e>>>0},q:Gt,r:$t,y:function(e,t,n){function l(oe){return(oe=oe.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?oe[1]:"GMT"}e>>>=0,t>>>=0,n>>>=0;var y=new Date().getFullYear(),b=new Date(y,0,1),_=new Date(y,6,1);y=b.getTimezoneOffset();var J=_.getTimezoneOffset(),Me=Math.max(y,J);w()[e>>>2>>>0]=60*Me,f()[t>>>2>>>0]=+(y!=J),e=l(b),t=l(_),e=jt(e),t=jt(t),J<y?(w()[n>>>2>>>0]=e,w()[n+4>>>2>>>0]=t):(w()[n>>>2>>>0]=t,w()[n+4>>>2>>>0]=e)},c:()=>{De("")},O:function(e,t,n){e>>>=0,t>>>=0,n>>>=0,ht.length=0;for(var l;l=h()[t++>>>0];){var y=l!=105;y&=l!=112,n+=y&&n%8?4:0,ht.push(l==112?w()[n>>>2>>>0]:l==105?f()[n>>>2>>>0]:g()[n>>>3>>>0]),n+=y?8:4}return Ne[e].apply(null,ht)},k:()=>{},i:()=>Date.now(),U:()=>{throw Be+=1,"unwind"},A:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:()=>I?(wr(),rt(br)).cpus().length:navigator.hardwareConcurrency,x:function(e){e>>>=0;var t=h().length;if(e<=t||4294901760<e)return!1;for(var n=1;4>=n;n*=2){var l=t*(1+.2/n);l=Math.min(l,e+100663296);var y=Math;l=Math.max(e,l);e:{y=(y.min.call(y,4294901760,l+(65536-l%65536)%65536)-Q.buffer.byteLength+65535)/65536;try{Q.grow(y),Y();var b=1;break e}catch{}b=void 0}if(b)return!0}return!1},M:zt,N:qt,G:je,g:Vt,m:Jt,v:Xt,l:Qt,a:Q||i.wasmMemory,w:er,d:function(e,t,n,l){return er(e>>>0,t>>>0,n>>>0,l>>>0)}},T=function(){function e(n,l){return T=n.exports,T=Vr(),M.bb.push(T.za),Qe=T.Aa,Ee.unshift(T.V),Oe=l,Se(),T}var t={a:qr};if(we++,i.instantiateWasm)try{return i.instantiateWasm(t,e)}catch(n){ne(`Module.instantiateWasm callback failed with error: ${n}`),P(n)}return at(t,function(n){e(n.instance,n.module)}
1809).catch(P),{}}();i._OrtInit=(e,t)=>(i._OrtInit=T.W)(e,t),i._OrtGetLastError=(e,t)=>(i._OrtGetLastError=T.X)(e,t),i._OrtCreateSessionOptions=(e,t,n,l,y,b,_,J,Me,oe)=>(i._OrtCreateSessionOptions=T.Y)(e,t,n,l,y,b,_,J,Me,oe),i._OrtAppendExecutionProvider=(e,t)=>(i._OrtAppendExecutionProvider=T.Z)(e,t),i._OrtAddFreeDimensionOverride=(e,t,n)=>(i._OrtAddFreeDimensionOverride=T._)(e,t,n),i._OrtAddSessionConfigEntry=(e,t,n)=>(i._OrtAddSessionConfigEntry=T.$)(e,t,n),i._OrtReleaseSessionOptions=e=>(i._OrtReleaseSessionOptions=T.aa)(e),i._OrtCreateSession=(e,t,n)=>(i._OrtCreateSession=T.ba)(e,t,n),i._OrtReleaseSession=e=>(i._OrtReleaseSession=T.ca)(e),i._OrtGetInputOutputCount=(e,t,n)=>(i._OrtGetInputOutputCount=T.da)(e,t,n),i._OrtGetInputName=(e,t)=>(i._OrtGetInputName=T.ea)(e,t),i._OrtGetOutputName=(e,t)=>(i._OrtGetOutputName=T.fa)(e,t),i._OrtFree=e=>(i._OrtFree=T.ga)(e),i._OrtCreateTensor=(e,t,n,l,y,b)=>(i._OrtCreateTensor=T.ha)(e,t,n,l,y,b),i._OrtGetTensorData=(e,t,n,l,y)=>(i._OrtGetTensorData=T.ia)(e,t,n,l,y),i._OrtReleaseTensor=e=>(i._OrtReleaseTensor=T.ja)(e),i._OrtCreateRunOptions=(e,t,n,l)=>(i._OrtCreateRunOptions=T.ka)(e,t,n,l),i._OrtAddRunConfigEntry=(e,t,n)=>(i._OrtAddRunConfigEntry=T.la)(e,t,n),i._OrtReleaseRunOptions=e=>(i._OrtReleaseRunOptions=T.ma)(e),i._OrtCreateBinding=e=>(i._OrtCreateBinding=T.na)(e),i._OrtBindInput=(e,t,n)=>(i._OrtBindInput=T.oa)(e,t,n),i._OrtBindOutput=(e,t,n,l)=>(i._OrtBindOutput=T.pa)(e,t,n,l),i._OrtClearBoundOutputs=e=>(i._OrtClearBoundOutputs=T.qa)(e),i._OrtReleaseBinding=e=>(i._OrtReleaseBinding=T.ra)(e),i._OrtRunWithBinding=(e,t,n,l,y)=>(i._OrtRunWithBinding=T.sa)(e,t,n,l,y),i._OrtRun=(e,t,n,l,y,b,_,J)=>(i._OrtRun=T.ta)(e,t,n,l,y,b,_,J),i._OrtEndProfiling=e=>(i._OrtEndProfiling=T.ua)(e);var tr=()=>(tr=T.va)(),lt=i._pthread_self=()=>(lt=i._pthread_self=T.wa)(),rr=i._malloc=e=>(rr=i._malloc=T.xa)(e);i._free=e=>(i._free=T.ya)(e),i.__emscripten_tls_init=()=>(i.__emscripten_tls_init=T.za)();var nr=i.__emscripten_thread_init=(e,t,n,l,y,b)=>(nr=i.__emscripten_thread_init=T.Ba)(e,t,n,l,y,b);i.__emscripten_thread_crashed=()=>(i.__emscripten_thread_crashed=T.Ca)();var ar=(e,t,n,l)=>(ar=T.Da)(e,t,n,l),wt=e=>(wt=T.Ea)(e),Ot=i.__emscripten_thread_exit=e=>(Ot=i.__emscripten_thread_exit=T.Fa)(e),or=()=>(or=T.Ga)(),sr=e=>(sr=T.Ha)(e),ir=(e,t)=>(ir=T.Ia)(e,t),vt=()=>(vt=T.Ja)(),ct=e=>(ct=T.Ka)(e),_t=e=>(_t=T.La)(e);function Vr(){var e=T;e=Object.assign({},e);var t=l=>()=>l()>>>0,n=l=>y=>l(y)>>>0;return e.va=t(e.va),e.wa=t(e.wa),e.xa=n(e.xa),e.emscripten_main_runtime_thread_id=t(e.emscripten_main_runtime_thread_id),e.Ja=t(e.Ja),e.La=n(e.La),e}i.wasmMemory=Q,i.stackAlloc=_t,i.stackSave=vt,i.stackRestore=ct,i.keepRuntimeAlive=()=>0<Be,i.UTF8ToString=$e,i.stringToUTF8=ie,i.lengthBytesUTF8=re,i.ExitStatus=Re,i.PThread=M;var dt;me=function e(){dt||ur(),dt||(me=e)};function ur(){if(!(0<we))if(v)E(i),v||ke(Ee),startWorker(i);else{if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ie.unshift(i.preRun.shift());ke(Ie),0<we||dt||(dt=!0,i.calledRun=!0,he||(v||ke(Ee),E(i),v||ke(be)))}}return ur(),c.ready}})();typeof vr=="object"&&typeof xt=="object"?xt.exports=Or:typeof define=="function"&&define.amd&&define([],()=>Or)});var Er=tt((On,nn)=>{nn.exports=\'"use strict";var Module={},ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads"),parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",e=>onmessage({data:e}));var fs=require("fs"),vm=require("vm");Object.assign(global,{self:global,require,Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:e=>vm.runInThisContext(fs.readFileSync(e,"utf8"),{filename:e}),postMessage:e=>parentPort.postMessage(e),performance:global.performance||{now:Date.now}})}var initializedJS=!1;function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,e+`\\n`);return}console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var a=Module.wasmModule;Module.wasmModule=null;var r=new WebAssembly.Instance(a,e);return t(r)},self.onunhandledrejection=e=>{throw e.reason||e};function handleMessage(e){try{if(e.data.cmd==="load"){let a=[];self.onmessage=r=>a.push(r),self.startWorker=r=>{Module=r,postMessage({cmd:"loaded"});for(let s of a)handleMessage(s);self.onmessage=handleMessage},Module.wasmModule=e.data.wasmModule;for(const r of e.data.handlers)Module[r]=(...s)=>{postMessage({cmd:"callHandler",handler:r,args:s})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.
1809ENVIRONMENT_IS_PTHREAD=!0,typeof e.data.urlOrBlob=="string")importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(Module)}else if(e.data.cmd==="run"){Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.__emscripten_thread_mailbox_await(e.data.pthread_ptr),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(a){if(a!="unwind")throw a}}else e.data.cmd==="cancel"?Module._pthread_self()&&Module.__emscripten_thread_exit(-1):e.data.target==="setimmediate"||(e.data.cmd==="checkMailbox"?initializedJS&&Module.checkMailbox():e.data.cmd&&(err(`worker.js received unknown command ${e.data.cmd}`),err(e.data)))}catch(a){throw Module.__emscripten_thread_crashed?.(),a}}self.onmessage=handleMessage;\\n\'});var Ar;Ar=gr();var an=_r(),Pt,Ut=!1,pt=!1,Sr=!1,on=u=>{if(u===1)return!1;if(typeof SharedArrayBuffer>"u")return typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+u+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),!1;typeof process<"u"&&process.versions&&process.versions.node&&console.warn("env.wasm.numThreads is set to "+u+", however, currently onnxruntime-web does not support multi-threads in Node.js. Please consider using onnxruntime-node for performance critical scenarios.");try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},sn=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},un=(u,c)=>u?c?"ort-wasm-simd-threaded.wasm":"ort-wasm-simd.wasm":c?"ort-wasm-threaded.wasm":"ort-wasm.wasm",Tr=async u=>{if(Ut)return Promise.resolve();if(pt)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(Sr)throw new Error("previous call to \'initializeWebAssembly()\' failed.");pt=!0;let c=u.initTimeout,a=u.numThreads,h=u.simd,f=on(a),w=h&&sn(),g=u.wasmPaths,i=typeof g=="string"?g:void 0,E=un(w,f),P=typeof g=="object"?g[E]:void 0,U=!1,D=[];if(c>0&&D.push(new Promise(x=>{setTimeout(()=>{U=!0,x()},c)})),D.push(new Promise((x,K)=>{let R=f?an:Ar,I={locateFile:(v,k)=>f&&v.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([Er()],{type:"text/javascript"})):v.endsWith(".wasm")?P||(i??k)+E:k+v};if(f)if(I.numThreads=a,typeof Blob>"u")I.mainScriptUrlOrBlob=(void 0)(__dirname,"ort-wasm-threaded.js");else{let v=`var ortWasmThreaded=${R.toString()};`;I.mainScriptUrlOrBlob=new Blob([v],{type:"text/javascript"})}R(I).then(v=>{pt=!1,Ut=!0,Pt=v,x()},v=>{pt=!1,Sr=!0,K(v)})})),await Promise.race(D),U)throw new Error(`WebAssembly backend initializing failed due to timeout: ${c}ms`)},Z=()=>{if(Ut&&Pt)return Pt;throw new Error("WebAssembly is not initialized yet.")};var q=(u,c)=>{let a=Z(),h=a.lengthBytesUTF8(u)+1,f=a._malloc(h);return a.stringToUTF8(u,f,h),c.push(f),f},nt=(u,c,a,h)=>{if(typeof u=="object"&&u!==null){if(a.has(u))throw new Error("Circular reference in options");a.add(u)}Object.entries(u).forEach(([f,w])=>{let g=c?c+f:f;if(typeof w=="object")nt(w,g+".",a,h);else if(typeof w=="string"||typeof w=="number")h(g,w.toString());else if(typeof w=="boolean")h(g,w?"1":"0");else throw new Error(`Can\'t handle extra config type: ${typeof w}`)})},V=u=>{let c=Z(),a=c.stackSave();try{let h=c.stackAlloc(8);c._OrtGetLastError(h,h+4);let f=c.HEAP32[h/4],w=c.HEAPU32[h/4+1],g=w?c.UTF8ToString(w):"";throw new Error(`${u} ERROR_CODE: ${f}, ERROR_MESSAGE: ${g}`)}finally{c.stackRestore(a)}};var Mr=u=>{let c=Z(),a=0,h=[],f=u||{};try{if(u?.logSeverityLevel===void 0)f.logSeverityLevel=2;else if(typeof u.logSeverityLevel!="number"||!Number.isInteger(u.logSeverityLevel)||u.logSeverityLevel<0||u.logSeverityLevel>
18094)throw new Error(`log serverity level is not valid: ${u.logSeverityLevel}`);if(u?.logVerbosityLevel===void 0)f.logVerbosityLevel=0;else if(typeof u.logVerbosityLevel!="number"||!Number.isInteger(u.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${u.logVerbosityLevel}`);u?.terminate===void 0&&(f.terminate=!1);let w=0;return u?.tag!==void 0&&(w=q(u.tag,h)),a=c._OrtCreateRunOptions(f.logSeverityLevel,f.logVerbosityLevel,!!f.terminate,w),a===0&&V("Can\'t create run options."),u?.extra!==void 0&&nt(u.extra,"",new WeakSet,(g,i)=>{let E=q(g,h),P=q(i,h);c._OrtAddRunConfigEntry(a,E,P)!==0&&V(`Can\'t set a run config entry: ${g} - ${i}.`)}),[a,h]}catch(w){throw a!==0&&c._OrtReleaseRunOptions(a),h.forEach(g=>c._free(g)),w}};var fn=u=>{switch(u){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${u}`)}},ln=u=>{switch(u){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${u}`)}},cn=u=>{u.extra||(u.extra={}),u.extra.session||(u.extra.session={});let c=u.extra.session;c.use_ort_model_bytes_directly||(c.use_ort_model_bytes_directly="1"),u.executionProviders&&u.executionProviders.some(a=>(typeof a=="string"?a:a.name)==="webgpu")&&(u.enableMemPattern=!1)},dn=(u,c,a)=>{for(let h of c){let f=typeof h=="string"?h:h.name;switch(f){case"webnn":if(f="WEBNN",typeof h!="string"){let g=h;if(g?.deviceType){let i=q("deviceType",a),E=q(g.deviceType,a);Z()._OrtAddSessionConfigEntry(u,i,E)!==0&&V(`Can\'t set a session config entry: \'deviceType\' - ${g.deviceType}.`)}if(g?.numThreads){let i=g.numThreads;(typeof i!="number"||!Number.isInteger(i)||i<0)&&(i=0);let E=q("numThreads",a),P=q(i.toString(),a);Z()._OrtAddSessionConfigEntry(u,E,P)!==0&&V(`Can\'t set a session config entry: \'numThreads\' - ${g.numThreads}.`)}if(g?.powerPreference){let i=q("powerPreference",a),E=q(g.powerPreference,a);Z()._OrtAddSessionConfigEntry(u,i,E)!==0&&V(`Can\'t set a session config entry: \'powerPreference\' - ${g.powerPreference}.`)}}break;case"webgpu":if(f="JS",typeof h!="string"){let g=h;if(g?.preferredLayout){if(g.preferredLayout!=="NCHW"&&g.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either \'NCHW\' or \'NHWC\': ${g.preferredLayout}`);let i=q("preferredLayout",a),E=q(g.preferredLayout,a);Z()._OrtAddSessionConfigEntry(u,i,E)!==0&&V(`Can\'t set a session config entry: \'preferredLayout\' - ${g.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${f}`)}let w=q(f,a);Z()._OrtAppendExecutionProvider(u,w)!==0&&V(`Can\'t append execution provider: ${f}.`)}},Cr=u=>{let c=Z(),a=0,h=[],f=u||{};cn(f);try{let w=fn(f.graphOptimizationLevel??"all"),g=ln(f.executionMode??"sequential"),i=typeof f.logId=="string"?q(f.logId,h):0,E=f.logSeverityLevel??2;if(!Number.isInteger(E)||E<0||E>4)throw new Error(`log serverity level is not valid: ${E}`);let P=f.logVerbosityLevel??0;if(!Number.isInteger(P)||P<0||P>4)throw new Error(`log verbosity level is not valid: ${P}`);let U=typeof f.optimizedModelFilePath=="string"?q(f.optimizedModelFilePath,h):0;if(a=c._OrtCreateSessionOptions(w,!!f.enableCpuMemArena,!!f.enableMemPattern,g,!!f.enableProfiling,0,i,E,P,U),a===0&&V("Can\'t create session options."),f.executionProviders&&dn(a,f.executionProviders,h),f.enableGraphCapture!==void 0){if(typeof f.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${f.enableGraphCapture}`);let D=q("enableGraphCapture",h),x=q(f.enableGraphCapture.toString(),h);c._OrtAddSessionConfigEntry(a,D,x)!==0&&V(`Can\'t set a session config entry: \'enableGraphCapture\' - ${f.enableGraphCapture}.`)}if(f.freeDimensionOverrides)for(let[D,x]of Object.entries(f.freeDimensionOverrides)){if(typeof D!="string")throw new Error(`free dimension override name must be a string: ${D}`);if(typeof x!="number"||!Number.isInteger(x)||x<0)throw new Error(`free dimension override value must be a non-negative integer: ${x}`);let K=q(D,h);c._OrtAddFreeDimensionOverride(a,K,x)!==0&&V(`Can\'t set a free dimension override: ${D} - ${x}.`)}return f.extra!==void 0&&nt(f.extra,"",new WeakSet,(D,x)=>{let K=q(D,h),R=q(x,h);c._OrtAddSessionConfigEntry(a,K,R)!==0&&V(`Can\'t set a session config entry: ${D} - ${x}.`)}),[a,h]}catch(w){throw a!==0&&c._OrtReleaseSessionOptions(a),h.forEach(g=>c._free(g)),w}};var Rt=u=>{switch(u){case"int8":return 3;case"uint8":return 2;case"bool":return 9;
1809case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${u}`)}},Dr=u=>{switch(u){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${u}`)}},It=u=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][u],Fr=u=>{switch(u){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${u}`)}},xr=u=>{switch(u){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${u}`)}},Pr=u=>u==="float32"||u==="float16"||u==="int32"||u==="int64"||u==="uint32"||u==="uint8"||u==="bool",Ur=u=>{switch(u){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;default:throw new Error(`unsupported data location: ${u}`)}};var Rr=async u=>{if(typeof u=="string")if(typeof process<"u"&&process.versions&&process.versions.node)try{return new Uint8Array(await(void 0)(u))}catch(c){if(c.code==="ERR_FS_FILE_TOO_LARGE"){let a=(void 0)(u),h=[];for await(let f of a)h.push(f);return new Uint8Array(Buffer.concat(h))}throw c}else{let c=await fetch(u);if(!c.ok)throw new Error(`failed to load external data file: ${u}`);let a=c.headers.get("Content-Length"),h=a?parseInt(a,10):0;if(h<1073741824)return new Uint8Array(await c.arrayBuffer());{if(!c.body)throw new Error(`failed to load external data file: ${u}, no response body.`);let f=c.body.getReader(),w;try{w=new ArrayBuffer(h)}catch(i){if(i instanceof RangeError){let E=Math.ceil(h/65536);w=new WebAssembly.Memory({initial:E,maximum:E}).buffer}else throw i}let g=0;for(;;){let{done:i,value:E}=await f.read();if(i)break;let P=E.byteLength;new Uint8Array(w,g,P).set(E),g+=P}return new Uint8Array(w,0,h)}}else return u instanceof Blob?new Uint8Array(await u.arrayBuffer()):u instanceof Uint8Array?u:new Uint8Array(u)};var pn=(u,c)=>{Z()._OrtInit(u,c)!==0&&V("Can\'t initialize onnxruntime.")},Lr=async u=>{pn(u.wasm.numThreads,xr(u.logLevel))},Br=async(u,c)=>{},ze=new Map,mn=u=>{let c=Z(),a=c.stackSave();try{let h=c.stackAlloc(8);return c._OrtGetInputOutputCount(u,h,h+4)!==0&&V("Can\'t get session input/output count."),[c.HEAP32[h/4],c.HEAP32[h/4+1]]}finally{c.stackRestore(a)}},Lt=u=>{let c=Z(),a=c._malloc(u.byteLength);if(a===0)throw new Error(`Can\'t create a session. failed to allocate a buffer of size ${u.byteLength}.`);return c.HEAPU8.set(u,a),[a,u.byteLength]},kr=async(u,c)=>{let a,h,f=Z();Array.isArray(u)?[a,h]=u:u.buffer===f.HEAPU8.buffer?[a,h]=[u.byteOffset,u.byteLength]:[a,h]=Lt(u);let w=0,g=0,i=0,E=[],P=[],U=[];try{if([g,E]=Cr(c),c?.externalData&&f.mountExternalData){let W=[];for(let H of c.externalData){let se=typeof H=="string"?H:H.path;W.push(Rr(typeof H=="string"?H:H.data).then(ee=>{f.mountExternalData(se,ee)}))}await Promise.all(W)}w=await f._OrtCreateSession(a,h,g),w===0&&V("Can\'t create a session.");let[D,x]=mn(w),K=!!c?.enableGraphCapture,R=[],I=[],v=[];for(let W=0;W<D;W++){let H=f._OrtGetInputName(w,W);H===0&&V("Can\'t get an input name."),P.push(H),R.push(f.UTF8ToString(H))}for(let W=0;W<x;W++){let H=f._OrtGetOutputName(w,W);H===0&&V("Can\'t get an output name."),U.push(H);let se=f.UTF8ToString(H);I.push(se)}let k=null;return ze.set(w,[w,P,U,k,K,!1]),[w,R,I]}catch(D){throw P.forEach(x=>
1809f._OrtFree(x)),U.forEach(x=>f._OrtFree(x)),i!==0&&f._OrtReleaseBinding(i),w!==0&&f._OrtReleaseSession(w),D}finally{f._free(a),g!==0&&f._OrtReleaseSessionOptions(g),E.forEach(D=>f._free(D)),f.unmountExternalData?.()}},Wr=u=>{let c=Z(),a=ze.get(u);if(!a)throw new Error(`cannot release session. invalid session id: ${u}`);let[h,f,w,g,i]=a;g&&(i&&c._OrtClearBoundOutputs(g.handle),c._OrtReleaseBinding(g.handle)),c.jsepOnReleaseSession?.(u),f.forEach(E=>c._OrtFree(E)),w.forEach(E=>c._OrtFree(E)),c._OrtReleaseSession(h),ze.delete(u)},Ir=(u,c,a,h,f,w=!1)=>{if(!u){c.push(0);return}let g=Z(),i=u[0],E=u[1],P=u[3],U,D;if(i==="string"&&P==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");if(w&&P!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${f} when enableGraphCapture is true.`);if(P==="gpu-buffer"){let R=u[2].gpuBuffer,I=It(Rt(i));D=E.reduce((k,W)=>k*W,1)*I;let v=g.jsepRegisterBuffer;if(!v)throw new Error(\'Tensor location "gpu-buffer" is not supported without using WebGPU.\');U=v(h,f,R,D)}else{let R=u[2];if(Array.isArray(R)){D=4*R.length,U=g._malloc(D),a.push(U);let I=U/4;for(let v=0;v<R.length;v++){if(typeof R[v]!="string")throw new TypeError(`tensor data at index ${v} is not a string`);g.HEAPU32[I++]=q(R[v],a)}}else D=R.byteLength,U=g._malloc(D),a.push(U),g.HEAPU8.set(new Uint8Array(R.buffer,R.byteOffset,D),U)}let x=g.stackSave(),K=g.stackAlloc(4*E.length);try{let R=K/4;E.forEach(v=>g.HEAP32[R++]=v);let I=g._OrtCreateTensor(Rt(i),U,D,K,E.length,Ur(P));I===0&&V(`Can\'t create tensor for input/output. session=${h}, index=${f}.`),c.push(I)}finally{g.stackRestore(x)}},Nr=async(u,c,a,h,f,w)=>{let g=Z(),i=ze.get(u);if(!i)throw new Error(`cannot run inference. invalid session id: ${u}`);let E=i[0],P=i[1],U=i[2],D=i[3],x=i[4],K=i[5],R=c.length,I=h.length,v=0,k=[],W=[],H=[],se=[],ee=g.stackSave(),S=g.stackAlloc(R*4),j=g.stackAlloc(R*4),Ce=g.stackAlloc(I*4),Ue=g.stackAlloc(I*4);try{[v,k]=Mr(w);for(let F=0;F<R;F++)Ir(a[F],W,se,u,c[F],x);for(let F=0;F<I;F++)Ir(f[F],H,se,u,R+h[F],x);let ce=S/4,ne=j/4,Q=Ce/4,Oe=Ue/4;for(let F=0;F<R;F++)g.HEAPU32[ce++]=W[F],g.HEAPU32[ne++]=P[c[F]];for(let F=0;F<I;F++)g.HEAPU32[Q++]=H[F],g.HEAPU32[Oe++]=U[h[F]];g.jsepOnRunStart?.(E);let he;he=await g._OrtRun(E,j,S,R,Ue,I,Ce,v),he!==0&&V("failed to call OrtRun().");let ae=[];for(let F=0;F<I;F++){let ye=g.HEAPU32[Ce/4+F];if(ye===H[F]){ae.push(f[F]);continue}let ve=g.stackSave(),fe=g.stackAlloc(4*4),_e=!1,Y,pe=0;try{g._OrtGetTensorData(ye,fe,fe+4,fe+8,fe+12)!==0&&V(`Can\'t access output tensor data on index ${F}.`);let Ee=fe/4,be=g.HEAPU32[Ee++];pe=g.HEAPU32[Ee++];let we=g.HEAPU32[Ee++],Le=g.HEAPU32[Ee++],me=[];for(let te=0;te<Le;te++)me.push(g.HEAPU32[we/4+te]);g._OrtFree(we);let Se=me.reduce((te,z)=>te*z,1);Y=Dr(be);let De=D?.outputPreferredLocations[h[F]];if(Y==="string"){if(De==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");let te=[],z=pe/4;for(let le=0;le<Se;le++){let Fe=g.HEAPU32[z++],Ae=le===Se-1?void 0:g.HEAPU32[z]-Fe;te.push(g.UTF8ToString(Fe,Ae))}ae.push([Y,me,te,"cpu"])}else if(De==="gpu-buffer"&&Se>0){let te=g.jsepGetBuffer;if(!te)throw new Error(\'preferredLocation "gpu-buffer" is not supported without using WebGPU.\');let z=te(pe),le=It(be);if(le===void 0||!Pr(Y))throw new Error(`Unsupported data type: ${Y}`);_e=!0,ae.push([Y,me,{gpuBuffer:z,download:g.jsepCreateDownloader(z,Se*le,Y),dispose:()=>{g._OrtReleaseTensor(ye)}},"gpu-buffer"])}else{let te=Fr(Y),z=new te(Se);new Uint8Array(z.buffer,z.byteOffset,z.byteLength).set(g.HEAPU8.subarray(pe,pe+z.byteLength)),ae.push([Y,me,z,"cpu"])}}finally{g.stackRestore(ve),Y==="string"&&pe&&g._free(pe),_e||g._OrtReleaseTensor(ye)}}return D&&!x&&(g._OrtClearBoundOutputs(D.handle),ze.set(u,[E,P,U,D,x,!1])),ae}finally{g.stackRestore(ee),W.forEach(ce=>g._OrtReleaseTensor(ce)),H.forEach(ce=>g._OrtReleaseTensor(ce)),se.forEach(ce=>g._free(ce)),v!==0&&g._OrtReleaseRunOptions(v),k.forEach(ce=>g._free(ce))}},Hr=u=>{let c=Z(),a=ze.get(u);if(!a)throw new Error("invalid session id");let h=a[0],f=c._OrtEndProfiling(h);f===0&&V("Can\'t get an profile file name."),c._OrtFree(f)},Gr=u=>{let c=[];for(let a of u){let h=a[2];!Array.isArray(h)&&"buffer"in h&&c.push(h.buffer)}return c};self.onmessage=u=>{let{type:c,in:a}=u.data;
vendor: 6,124 bytes, line 1809
1809try{switch(c){case"init-wasm":Tr(a.wasm).then(()=>{Lr(a).then(()=>{postMessage({type:c})},h=>{postMessage({type:c,err:h})})},h=>{postMessage({type:c,err:h})});break;case"init-ep":{let{epName:h,env:f}=a;Br(f,h).then(()=>{postMessage({type:c})},w=>{postMessage({type:c,err:w})});break}case"copy-from":{let{buffer:h}=a,f=Lt(h);postMessage({type:c,out:f});break}case"create":{let{model:h,options:f}=a;kr(h,f).then(w=>{postMessage({type:c,out:w})},w=>{postMessage({type:c,err:w})});break}case"release":Wr(a),postMessage({type:c});break;case"run":{let{sessionId:h,inputIndices:f,inputs:w,outputIndices:g,options:i}=a;Nr(h,f,w,g,new Array(g.length).fill(null),i).then(E=>{E.some(P=>P[3]!=="cpu")?postMessage({type:c,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:c,out:E},Gr([...w,...E]))},E=>{postMessage({type:c,err:E})});break}case"end-profiling":Hr(a),postMessage({type:c});break;default:}}catch(h){postMessage({type:c,err:h})}};})();\n'}),wr,ht,xn,Fo,Co,da,ha,Hr,qr,wg,Lo,ad,sd,ud,ld,fd,cd,pd,ma=E(()=>{var t;Tt(),od(),Vr(),wr=()=>!!Z.wasm.proxy&&typeof document<"u",xn=!1,Fo=!1,Co=!1,ha=new Map,Hr=(e,o)=>{let a=ha.get(e);a?a.push(o):ha.set(e,[o])},qr=()=>{if(xn||!Fo||Co||!ht)throw new Error("worker not ready")},wg=e=>{switch(e.data.type){case"init-wasm":xn=!1,e.data.err?(Co=!0,da[1](e.data.err)):(Fo=!0,da[0]());break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let o=ha.get(e.data.type);e.data.err?o.shift()[1](e.data.err):o.shift()[0](e.data.out);break}}},Lo=typeof document<"u"?(t=document==null?void 0:document.currentScript)==null?void 0:t.src:void 0,ad=async()=>{if(!Fo){if(xn)throw new Error("multiple calls to 'initWasm()' detected.");if(Co)throw new Error("previous call to 'initWasm()' failed.");if(xn=!0,wr())return Z.wasm.wasmPaths===void 0&&Lo&&Lo.indexOf("blob:")!==0&&(Z.wasm.wasmPaths=Lo.substr(0,+Lo.lastIndexOf("/")+1)),new Promise((e,o)=>{ht==null||ht.terminate();let a=URL.createObjectURL(new Blob([id()],{type:"text/javascript"}));(ht=new Worker(a,{name:"ort-wasm-proxy-worker"})).onerror=f=>o(f),ht.onmessage=wg,URL.revokeObjectURL(a),da=[e,o];let l={type:"init-wasm",in:Z};ht.postMessage(l)});try{await Up(Z.wasm),await Jp(Z),Fo=!0}catch(e){throw Co=!0,e}finally{xn=!1}}},sd=async e=>{if(wr())return qr(),new Promise((o,a)=>{Hr("init-ep",[o,a]);let l={type:"init-ep",in:{epName:e,env:Z}};ht.postMessage(l)});await Zp(Z,e)},ud=async e=>wr()?(qr(),new Promise((o,a)=>{Hr("copy-from",[o,a]);let l={type:"copy-from",in:{buffer:e}};ht.postMessage(l,[e.buffer])})):pa(e),ld=async(e,o)=>{if(wr()){if(o!=null&&o.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return qr(),new Promise((a,l)=>{Hr("create",[a,l]);let f={type:"create",in:{model:e,options:{...o}}},d=[];e instanceof Uint8Array&&d.push(e.buffer),ht.postMessage(f,d)})}return Qp(e,o)},fd=async e=>{if(wr())return qr(),new Promise((o,a)=>{Hr("release",[o,a]);let l={type:"release",in:e};ht.postMessage(l)});ed(e)},cd=async(e,o,a,l,f,d)=>{if(wr()){if(a.some(p=>p[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(f.some(p=>p))throw new Error("pre-allocated output tensor is not supported for proxy.");return qr(),new Promise((p,h)=>{Hr("run",[p,h]);let n=a,c={type:"run",in:{sessionId:e,inputIndices:o,inputs:n,outputIndices:l,options:d}};ht.postMessage(c,nd(n))})}return td(e,o,a,l,f,d)},pd=async e=>{if(wr())return qr(),new Promise((o,a)=>{Hr("end-profiling",[o,a]);let l={type:"end-profiling",in:e};ht.postMessage(l)});rd(e)}}),dd,vg,$o,hd=E(()=>{Tt(),ma(),fa(),ca(),dd=(t,e)=>{switch(t.location){case"cpu":return[t.type,t.dims,t.data,"cpu"];case"gpu-buffer":return[t.type,t.dims,{gpuBuffer:t.gpuBuffer},"gpu-buffer"];default:throw new Error(`invalid data location: ${t.location} for ${e()}`)}},vg=t=>{switch(t[3]){case"cpu":return new Re(t[0],t[2],t[1]);case"gpu-buffer":{let e=t[0];if(!Do(e))throw new Error(`not supported data type: ${e} for deserializing GPU tensor`);let{gpuBuffer:o,download:a,dispose:l}=t[2];return Re.fromGpuBuffer(o,{dataType:e,dims:t[1],download:a,dispose:l})}default:throw new Error(`invalid data location: ${t[3]}`)}},$o=class{async fetchModelAndCopyToWasmMemory(t){return ud(await Tn(t))}async loadModel(t,e){let o;sr(),o=typeof t=="string"?typeof dist.process<"u"&&dist.process.versions&&dist.process.versions.node?await Tn(t):await this.fetchModelAndCopyToWasmMemory(t):t,[this.sessionId,this.inputNames,this.outputNames]=await ld(o,e),ur()}async dispose(){return fd(this.sessionId)}async run(t,e,o){sr();let a=[],l=[];Object.entries(t).forEach(r=>{let s=r[0],u=r[1],g=this.inputNames.indexOf(s);if(g===-1)throw new Error(`invalid input '${s}'`);a.push(u),l.push(g)});let f=[],d=[];Object.entries(e).forEach(r=>{let s=r[0],u=r[1],g=this.outputNames.indexOf(s);if(g===-1)throw new Error(`invalid output '${s}'`);f.push(u),d.push(g)});let p=a.map((r,s)=>dd(r,()=>`input "${this.inputNames[l[s]]}"`)),h=f.map((r,s)=>r?dd(r,()=>`output "${this.outputNames[d[s]]}"`):null),n=await cd(this.sessionId,l,p,d,h,o),c={};for(let r=0;r<n.length;r++)c[this.outputNames[d[r]]]=f[r]??vg(n[r]);return ur(),c}startProfiling(){}endProfiling(){pd(this.sessionId)}}}),_g,ko,md=E(()=>{Tt(),ma(),hd(),_g=()=>{if((typeof Z.wasm.initTimeout!="number"||Z.wasm.initTimeout<0)&&(Z.wasm.initTimeout=0),typeof Z.wasm.simd!="boolean"&&(Z.wasm.simd=!0),typeof Z.wasm.proxy!="boolean"&&(Z.wasm.proxy=!1),typeof Z.wasm.trace!="boolean"&&(Z.wasm.trace=!1),typeof Z.wasm.numThreads!="number"||!Number.isInteger(Z.wasm.numThreads)||Z.wasm.numThreads<=0){(typeof self<"u"&&!self.crossOriginIsolated||typeof dist.process<"u"&&dist.process.versions&&dist.process.versions.node)&&(Z.wasm.numThreads=1);let t=typeof navigator>"u"?(void 0)().length:navigator.hardwareConcurrency;Z.wasm.numThreads=Math.min(4,Math.ceil((t||1)/2))}},ko=class{async init(t){_g(),await ad(),await sd(t)}async createInferenceSessionHandler(t,e){let o=new $o;return await o.loadModel(t,e),Promise.resolve(o)}}}),bd={};Pr(bd,{wasmBackend:()=>Og});var Og,gd=E(()=>{md(),Og=new ko});Tt(),Tt(),Tt();var ws="1.17.3";
1809{let t=(Sp(),or(Ip)).onnxjsBackend;Dr("webgl",t,-10)}{let t=(gd(),or(bd)).wasmBackend;Dr("cpu",t,10),Dr("wasm",t,10)}/*! Bundled license information:
1810
1811	long/index.js:
1812	  (**
1813	   * @license
1814	   * Copyright 2009 The Closure Library Authors
1815	   * Copyright 2020 Daniel Wirtz / The long.js Authors.
1816	   *
1817	   * Licensed under the Apache License, Version 2.0 (the "License");
1818	   * you may not use this file except in compliance with the License.
1819	   * You may obtain a copy of the License at
1820	   *
1821	   *     http://www.apache.org/licenses/LICENSE-2.0
1822	   *
1823	   * Unless required by applicable law or agreed to in writing, software
1824	   * distributed under the License is distributed on an "AS IS" BASIS,
1825	   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1826	   * See the License for the specific language governing permissions and
1827	   * limitations under the License.
1828	   *
1829	   * SPDX-License-Identifier: Apache-2.0
1830	   *)
1831	*/let myOnnxSession;async function loadModel(){if(typeof WebAssembly.validate=="function"){const t=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));Z.wasm.simd=t}else Z.wasm.simd=!1;myOnnxSession=await Dd.create("views/eyetracking_google.onnx",{executionProviders:["wasm"],graphOptimizationLevel:"all"})}Object.defineProperty(Z.versions,"web",{value:ws,enumerable:!0}),loadModel().then(()=>{console.log("Model loaded successfully")}).catch(t=>{console.error("Failed to load model:",t),postMessage({error:(t==null?void 0:t.message)||String(t),stack:t==null?void 0:t.stack,context:"loadModel"})}),onmessage=async function(t){try{if(!myOnnxSession)throw new Error("Model not initialized");let e,o,a;e=new Re("float32",t.data.input1.data,[1,3,128,128]),o=new Re("float32",t.data.input2.data,[1,3,128,128]),a=new Re("float32",t.data.kpsTensor.data,[1,8]);const l=await myOnnxSession.run({input1:e,input2:o,kps:a});postMessage(l)}catch(e){console.error("[Worker]: Error processing message",e),postMessage({error:e.message})}}})();
1832//# sourceMappingURL=worker.c935b39d-DYStRbPY.js.map

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.