diff --git a/.gitignore b/.gitignore index aa724b7..87f66f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,7 @@ *.iml .gradle /local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml +.idea/ .DS_Store /build /captures diff --git a/app/.gitignore b/app/.gitignore index 42afabf..956c004 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,2 @@ -/build \ No newline at end of file +/build +/release \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f0c2e45..78caaf0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -13,8 +13,8 @@ android { applicationId = "com.thryan.secondclass" minSdk = 26 targetSdk = 34 - versionCode = 1 - versionName = "1.3.3" + versionCode = 2 + versionName = "1.3.4" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -24,7 +24,8 @@ android { buildTypes { release { - isMinifyEnabled = false + isMinifyEnabled = true + isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" @@ -57,7 +58,6 @@ dependencies { implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2") implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3") implementation("androidx.activity:activity-compose:1.7.2") diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index ff59496..2f9dc5a 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,4 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile diff --git a/app/src/main/assets/model.onnx b/app/src/main/assets/model.onnx new file mode 100644 index 0000000..18bd71d Binary files /dev/null and b/app/src/main/assets/model.onnx differ diff --git a/app/src/main/assets/ort-wasm-simd.wasm b/app/src/main/assets/ort-wasm-simd.wasm new file mode 100644 index 0000000..e5b776e Binary files /dev/null and b/app/src/main/assets/ort-wasm-simd.wasm differ diff --git a/app/src/main/assets/script.js b/app/src/main/assets/script.js new file mode 100644 index 0000000..85f6b5d --- /dev/null +++ b/app/src/main/assets/script.js @@ -0,0 +1,1822 @@ +// ==UserScript== +// @name CUIT验证码自动填写 +// @namespace wed0n.cuit.captcha +// @homepage https://github.com/wed0n/cuit_captcha +// @version 0.1.6 +// @description 驾校教务处登录自动填写验证码 +// @author Wed0n +// @license MIT +// @match *.cuit.edu.cn*/authserver/* +// @match https://webvpn.cuit.edu.cn/* +// @icon https://static.wed0n.top/cuit/captcha/vite.svg +// @grant none +// @sandbox JavaScript +// @run-at document-idle +// ==/UserScript== + +// 如果你不想忍受Cloudflare在璃月的访问速度较慢,而且你有自己的服务器,你可以修改这个资源路径。 +const resourcePath = "https://static.wed0n.top/cuit/captcha/"; + +console.log("cuit_captcha"); + +(function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const p of document.querySelectorAll('link[rel="modulepreload"]'))m(p);new MutationObserver(p=>{for(const h of p)if(h.type==="childList")for(const d of h.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&m(d)}).observe(document,{childList:!0,subtree:!0});function y(p){const h={};return p.integrity&&(h.integrity=p.integrity),p.referrerPolicy&&(h.referrerPolicy=p.referrerPolicy),p.crossOrigin==="use-credentials"?h.credentials="include":p.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function m(p){if(p.ep)return;p.ep=!0;const h=y(p);fetch(p.href,h)}})();function getDefaultExportFromCjs($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var browser={exports:{}},process=browser.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($){if(cachedSetTimeout===setTimeout)return setTimeout($,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout($,0);try{return cachedSetTimeout($,0)}catch{try{return cachedSetTimeout.call(null,$,0)}catch{return cachedSetTimeout.call(this,$,0)}}}function runClearTimeout($){if(cachedClearTimeout===clearTimeout)return clearTimeout($);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout($);try{return cachedClearTimeout($)}catch{try{return cachedClearTimeout.call(null,$)}catch{return cachedClearTimeout.call(this,$)}}}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 $=runTimeout(cleanUpNextTick);draining=!0;for(var c=queue.length;c;){for(currentQueue=queue,queue=[];++queueIndex1)for(var y=1;y(()=>{var __webpack_modules__={5716:($,c,y)=>{c.R=void 0;const m=y(6027),p=y(1723);c.R=new class{async init(){}async createSessionHandler(h,d){const u=new m.Session(d);return await u.loadModel(h),new p.OnnxjsSessionHandler(u)}}},2818:($,c,y)=>{c.c8=c.rX=void 0;const m=y(2235),p=y(5381),h=y(9544),d=y(6640);c.rX=()=>{if((typeof m.env.wasm.initTimeout!="number"||m.env.wasm.initTimeout<0)&&(m.env.wasm.initTimeout=0),typeof m.env.wasm.simd!="boolean"&&(m.env.wasm.simd=!0),typeof m.env.wasm.proxy!="boolean"&&(m.env.wasm.proxy=!1),typeof m.env.wasm.numThreads!="number"||!Number.isInteger(m.env.wasm.numThreads)||m.env.wasm.numThreads<=0){const u=typeof navigator>"u"?(0,p.cpus)().length:navigator.hardwareConcurrency;m.env.wasm.numThreads=Math.min(4,Math.ceil((u||1)/2))}},c.c8=new class{async init(){(0,c.rX)(),await(0,h.initializeWebAssemblyInstance)()}async createSessionHandler(u,l){const a=new d.OnnxruntimeWebAssemblySessionHandler;return await a.loadModel(u,l),Promise.resolve(a)}}},1057:function($,c,y){var m=this&&this.__createBinding||(Object.create?function(u,l,a,o){o===void 0&&(o=a);var n=Object.getOwnPropertyDescriptor(l,a);n&&!("get"in n?!l.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return l[a]}}),Object.defineProperty(u,o,n)}:function(u,l,a,o){o===void 0&&(o=a),u[o]=l[a]}),p=this&&this.__exportStar||function(u,l){for(var a in u)a==="default"||Object.prototype.hasOwnProperty.call(l,a)||m(l,u,a)};Object.defineProperty(c,"__esModule",{value:!0}),p(y(2235),c);const h=y(2235),d=y(8408);{const u=y(5716).R;(0,h.registerBackend)("webgl",u,-10)}{const u=y(2818).c8;(0,h.registerBackend)("cpu",u,10),(0,h.registerBackend)("wasm",u,10),(0,h.registerBackend)("xnnpack",u,9),(0,h.registerBackend)("webnn",u,9)}h.env.versions.web=d.version},4910:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createAttributeWithCacheKey=void 0;class y{constructor(p){Object.assign(this,p)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(p=>`${this[p]}`).join(";")),this._cacheKey}}c.createAttributeWithCacheKey=m=>new y(m)},6874:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Attribute=void 0;const m=y(5127),p=y(2446),h=y(9240),d=y(7273);var u=m.onnxruntime.experimental.fbs;class l{constructor(o){if(this._attributes=new Map,o!=null){for(const n of o)n instanceof p.onnx.AttributeProto?this._attributes.set(n.name,[l.getValue(n),l.getType(n)]):n instanceof u.Attribute&&this._attributes.set(n.name(),[l.getValue(n),l.getType(n)]);if(this._attributes.sizeh.Tensor.fromProto(e));if(o instanceof u.Attribute)return t.map(e=>h.Tensor.fromOrtTensor(e))}if(n===p.onnx.AttributeProto.AttributeType.STRING&&o instanceof p.onnx.AttributeProto){const e=t;return(0,d.decodeUtf8String)(e)}return n===p.onnx.AttributeProto.AttributeType.STRINGS&&o instanceof p.onnx.AttributeProto?t.map(d.decodeUtf8String):t}static getValueNoCheck(o){return o instanceof p.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(o):this.getValueNoCheckFromOrtFormat(o)}static getValueNoCheckFromOnnxFormat(o){switch(o.type){case p.onnx.AttributeProto.AttributeType.FLOAT:return o.f;case p.onnx.AttributeProto.AttributeType.INT:return o.i;case p.onnx.AttributeProto.AttributeType.STRING:return o.s;case p.onnx.AttributeProto.AttributeType.TENSOR:return o.t;case p.onnx.AttributeProto.AttributeType.GRAPH:return o.g;case p.onnx.AttributeProto.AttributeType.FLOATS:return o.floats;case p.onnx.AttributeProto.AttributeType.INTS:return o.ints;case p.onnx.AttributeProto.AttributeType.STRINGS:return o.strings;case p.onnx.AttributeProto.AttributeType.TENSORS:return o.tensors;case p.onnx.AttributeProto.AttributeType.GRAPHS:return o.graphs;default:throw new Error(`unsupported attribute type: ${p.onnx.AttributeProto.AttributeType[o.type]}`)}}static getValueNoCheckFromOrtFormat(o){switch(o.type()){case u.AttributeType.FLOAT:return o.f();case u.AttributeType.INT:return o.i();case u.AttributeType.STRING:return o.s();case u.AttributeType.TENSOR:return o.t();case u.AttributeType.GRAPH:return o.g();case u.AttributeType.FLOATS:return o.floatsArray();case u.AttributeType.INTS:{const n=[];for(let t=0;t{Object.defineProperty(c,"__esModule",{value:!0}),c.resolveBackend=c.backend=void 0;const m=y(4418),p=new Map;async function h(d){const u=c.backend;if(u[d]!==void 0&&function(l){const a=l;return"initialize"in a&&typeof a.initialize=="function"&&"createSessionHandler"in a&&typeof a.createSessionHandler=="function"&&"dispose"in a&&typeof a.dispose=="function"}(u[d])){const l=u[d];let a=l.initialize();if(typeof a=="object"&&"then"in a&&(a=await a),a)return p.set(d,l),l}}c.backend={webgl:new m.WebGLBackend},c.resolveBackend=async function d(u){if(!u)return d(["webgl"]);{const l=typeof u=="string"?[u]:u;for(const a of l){const o=p.get(a);if(o)return o;const n=await h(a);if(n)return n}}throw new Error("no available backend to use")}},4418:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLBackend=void 0;const m=y(2235),p=y(1315),h=y(2171),d=y(3389);c.WebGLBackend=class{get contextId(){return m.env.webgl.contextId}set contextId(u){m.env.webgl.contextId=u}get matmulMaxBatchSize(){return m.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(u){m.env.webgl.matmulMaxBatchSize=u}get textureCacheMode(){return m.env.webgl.textureCacheMode}set textureCacheMode(u){m.env.webgl.textureCacheMode=u}get pack(){return m.env.webgl.pack}set pack(u){m.env.webgl.pack=u}get async(){return m.env.webgl.async}set async(u){m.env.webgl.async=u}initialize(){try{return this.glContext=(0,d.createWebGLContext)(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),p.Logger.setWithEnv(m.env),p.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(u){return p.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${u}`),!1}}createSessionHandler(u){return new h.WebGLSessionHandler(this,u)}dispose(){this.glContext.dispose()}}},6859:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoordsGlslLib=void 0;const m=y(7273),p=y(1997),h=y(6757),d=y(7618),u=y(432);class l extends p.GlslLib{constructor(o){super(o)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new p.GlslLibRoutine(` + vec2 offsetToCoords(int offset, int width, int height) { + int t = offset / width; + int s = offset - t*width; + vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height); + return coords; + } + `)}}coordsToOffset(){return{coordsToOffset:new p.GlslLibRoutine(` + int coordsToOffset(vec2 coords, int width, int height) { + float s = coords.s * float(width); + float t = coords.t * float(height); + int offset = int(t) * width + int(s); + return offset; + } + `)}}getOutputSamplingSnippet(){const o=this.context.outputTextureLayout;return o.isPacked?this.getPackedOutputSamplingSnippet(o):this.getUnpackedOutputSamplingSnippet(o)}getPackedOutputSamplingSnippet(o){const n=o.unpackedShape,t=[o.width,o.height],e={},r="getOutputCoords";switch(n.length){case 0:e[r]=this.getOutputScalarCoords();break;case 1:e[r]=this.getOutputPacked1DCoords(n,t);break;case 2:e[r]=this.getOutputPacked2DCoords(n,t);break;case 3:e[r]=this.getOutputPacked3DCoords(n,t);break;default:e[r]=this.getOutputPackedNDCoords(n,t)}const i=` + void setOutput(vec4 val) { + ${(0,h.getGlsl)(this.context.glContext.version).output} = val; + } + `;return e.floatTextureSetRGBA=new p.GlslLibRoutine(i),e}getUnpackedOutputSamplingSnippet(o){const n=o.unpackedShape,t=[o.width,o.height],e={},r="getOutputCoords";switch(n.length){case 0:e[r]=this.getOutputScalarCoords();break;case 1:e[r]=this.getOutputUnpacked1DCoords(n,t);break;case 2:e[r]=this.getOutputUnpacked2DCoords(n,t);break;case 3:e[r]=this.getOutputUnpacked3DCoords(n,t);break;case 4:e[r]=this.getOutputUnpacked4DCoords(n,t);break;case 5:e[r]=this.getOutputUnpacked5DCoords(n,t);break;case 6:e[r]=this.getOutputUnpacked6DCoords(n,t);break;default:throw new Error(`Unsupported output dimensionality: ${n.length}`)}const i=` + void setOutput(float val) { + ${(0,h.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); + } + `;return e.floatTextureSetR=new p.GlslLibRoutine(i),e}getOutputScalarCoords(){return new p.GlslLibRoutine(` + int getOutputCoords() { + return 0; + } + `)}getOutputPacked1DCoords(o,n){const t=n;let e="";return t[0]===1?(e=` + int getOutputCoords() { + return 2 * int(TexCoords.y * ${t[1]}.0); + } + `,new p.GlslLibRoutine(e)):t[1]===1?(e=` + int getOutputCoords() { + return 2 * int(TexCoords.x * ${t[0]}.0); + } + `,new p.GlslLibRoutine(e)):(e=` + int getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${t[0]}, ${t[1]})); + return 2 * (resTexRC.y * ${t[0]} + resTexRC.x); + } + `,new p.GlslLibRoutine(e))}getOutputPacked2DCoords(o,n){let t="";if(m.ArrayUtil.arraysEqual(o,n))return t=` + ivec2 getOutputCoords() { + return 2 * ivec2(TexCoords.xy * vec2(${n[0]}, ${n[1]})); + } + `,new p.GlslLibRoutine(t);const e=n,r=Math.ceil(o[1]/2);return t=` + ivec2 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${e[0]}, ${e[1]})); + + int index = resTexRC.y * ${e[0]} + resTexRC.x; + + // reverse r and c order for packed texture + int r = imod(index, ${r}) * 2; + int c = 2 * (index / ${r}); + + return ivec2(r, c); + } + `,new p.GlslLibRoutine(t)}getOutputPacked3DCoords(o,n){const t=[n[0],n[1]],e=Math.ceil(o[2]/2),r=e*Math.ceil(o[1]/2),i=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${t[0]}, ${t[1]})); + int index = resTexRC.y * ${t[0]} + resTexRC.x; + + int b = index / ${r}; + index -= b * ${r}; + + // reverse r and c order for packed texture + int r = imod(index, ${e}) * 2; + int c = 2 * (index / ${e}); + + return ivec3(b, r, c); + } + `;return new p.GlslLibRoutine(i)}getOutputPackedNDCoords(o,n){const t=[n[0],n[1]],e=Math.ceil(o[o.length-1]/2),r=e*Math.ceil(o[o.length-2]/2);let i=r,s="",f="b, r, c";for(let b=2;b=0;--f)r[f]=r[f+1]*o[f+1];const i=["r","c","d"],s=r.map((f,g)=>`int ${i[g]} = index / ${f}; ${g===r.length-1?`int ${i[g+1]} = index - ${i[g]} * ${f}`:`index -= ${i[g]} * ${f}`};`).join("");return t=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${n[0]}, ${n[1]})); + int index = resTexRC.y * ${n[0]} + resTexRC.x; + ${s} + return ivec3(r, c, d); + } + `,new p.GlslLibRoutine(t)}getOutputUnpacked4DCoords(o,n){let t="";const e=o.length;let r=null;e<2&&(r=[]),r=new Array(e-1),r[e-2]=o[e-1];for(let f=e-3;f>=0;--f)r[f]=r[f+1]*o[f+1];const i=["r","c","d","d2"],s=r.map((f,g)=>`int ${i[g]} = index / ${f}; ${g===r.length-1?`int ${i[g+1]} = index - ${i[g]} * ${f}`:`index -= ${i[g]} * ${f}`};`).join("");return t=` + ivec4 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${n[0]}, ${n[1]})); + int index = resTexRC.y * ${n[0]} + resTexRC.x; + ${s} + return ivec4(r, c, d, d2); + } + `,new p.GlslLibRoutine(t)}getOutputUnpacked5DCoords(o,n){let t="";const e=o.length;let r=null;e<2&&(r=[]),r=new Array(e-1),r[e-2]=o[e-1];for(let f=e-3;f>=0;--f)r[f]=r[f+1]*o[f+1];const i=["r","c","d","d2","d3"],s=r.map((f,g)=>`int ${i[g]} = index / ${f}; ${g===r.length-1?`int ${i[g+1]} = index - ${i[g]} * ${f}`:`index -= ${i[g]} * ${f}`};`).join("");return t=` + ivec5 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${n[0]}, ${n[1]})); + int index = resTexRC.y * ${n[0]} + resTexRC.x; + ${s} + return ivec5(r, c, d, d2, d3); + } + `,new p.GlslLibRoutine(t)}getOutputUnpacked6DCoords(o,n){let t="";const e=o.length;let r=null;e<2&&(r=[]),r=new Array(e-1),r[e-2]=o[e-1];for(let f=e-3;f>=0;--f)r[f]=r[f+1]*o[f+1];const i=["r","c","d","d2","d3","d4"],s=r.map((f,g)=>`int ${i[g]} = index / ${f}; ${g===r.length-1?`int ${i[g+1]} = index - ${i[g]} * ${f}`:`index -= ${i[g]} * ${f}`};`).join("");return t=` + ivec6 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${n[0]}, ${n[1]})); + int index = resTexRC.y * ${n[0]} + resTexRC.x; + ${s} + return ivec6(r, c, d, d2, d3, d4); + } + `,new p.GlslLibRoutine(t)}getCommonUtilFuncs(){const o={};let n="uvFromFlat";o[n]=new p.GlslLibRoutine(` + vec2 uvFromFlat(int texNumR, int texNumC, int index) { + int texC = index / texNumR; + int texR = index - texC * texNumR; + // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to + // v. + return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC); + } + `),n="packedUVfrom1D",o[n]=new p.GlslLibRoutine(` + vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { + int texelIndex = index / 2; + int texR = texelIndex / texNumC; + int texC = texelIndex - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),n="packedUVfrom2D",o[n]=new p.GlslLibRoutine(` + vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) { + int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); + int texR = texelIndex / texNumC; + int texC = texelIndex - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),n="packedUVfrom3D",o[n]=new p.GlslLibRoutine(` + vec2 packedUVfrom3D(int texNumR, int texNumC, + int texelsInBatch, int texelsInLogicalRow, int b, + int row, int col) { + int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); + int texR = index / texNumC; + int texC = index - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),n="sampleTexture";const t=(0,h.getGlsl)(this.context.glContext.version);return o[n]=new p.GlslLibRoutine(` + float sampleTexture(sampler2D textureSampler, vec2 uv) { + return ${t.texture2D}(textureSampler, uv).r; + }`),o}getInputsSamplingSnippets(){const o={},n=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((t,e)=>{const r=this.context.inputTextureLayouts[e],i=(0,u.generateShaderFuncNameFromInputSamplerName)(t);r.isPacked?o[i]=this.getPackedSamplerFromInput(i,t,r):o[i]=this.getUnpackedSamplerFromInput(i,t,r);const s=(0,u.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(t);r.unpackedShape.length<=n.unpackedShape.length&&(r.isPacked?o[s]=this.getPackedSamplerAtOutputCoords(s,r,n,t):o[s]=this.getUnpackedSamplerAtOutputCoords(s,r,n,t))}),o}getPackedSamplerAtOutputCoords(o,n,t,e){const r=n.unpackedShape,i=t.unpackedShape,s=e,f=(0,u.generateShaderFuncNameFromInputSamplerName)(s),g=r.length,b=i.length,v=m.BroadcastUtil.getBroadcastDims(r,i),w=(0,u.getCoordsDataType)(b),T=b-g;let x;const A=(0,u.getGlChannels)();x=g===0?"":b<2&&v.length>=1?"coords = 0;":v.map(U=>`coords.${A[U+T]} = 0;`).join(` +`);let D="";D=b<2&&g>0?"coords":r.map((U,O)=>`coords.${A[O+T]}`).join(", ");let k="return outputValue;";const j=m.ShapeUtil.size(r)===1,M=m.ShapeUtil.size(i)===1;if(g!==1||j||M){if(j&&!M)k=b===1?` + return vec4(outputValue.x, outputValue.x, 0., 0.); + `:` + return vec4(outputValue.x); + `;else if(v.length){const U=g-2,O=g-1;v.indexOf(U)>-1&&v.indexOf(O)>-1?k="return vec4(outputValue.x);":v.indexOf(U)>-1?k="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":v.indexOf(O)>-1&&(k="return vec4(outputValue.xx, outputValue.zz);")}}else k=` + return vec4(outputValue.xy, outputValue.xy); + `;const S=` + vec4 ${o}() { + ${w} coords = getOutputCoords(); + + int lastDim = coords.${A[b-1]}; + coords.${A[b-1]} = coords.${A[b-2]}; + coords.${A[b-2]} = lastDim; + + ${x} + vec4 outputValue = ${f}(${D}); + ${k} + } + `;return new p.GlslLibRoutine(S,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(o,n,t,e){const r=[t.width,t.height],i=[n.width,n.height],s=n.unpackedShape.length,f=t.unpackedShape.length,g=n.unpackedShape,b=t.unpackedShape,v=(0,u.generateShaderFuncNameFromInputSamplerName)(e);if(s===f&&m.ArrayUtil.arraysEqual(i,r)){const M=` + float ${o}() { + return sampleTexture(${e}, TexCoords); + } + `;return new p.GlslLibRoutine(M,["coordinates.sampleTexture"])}const w=(0,u.getCoordsDataType)(f),T=m.BroadcastUtil.getBroadcastDims(g,b),x=f-s;let A;const D=(0,u.getGlChannels)();A=s===0?"":f<2&&T.length>=1?"coords = 0;":T.map(M=>`coords.${D[M+x]} = 0;`).join(` +`);let k="";k=f<2&&s>0?"coords":n.unpackedShape.map((M,S)=>`coords.${D[S+x]}`).join(", ");const j=` + float ${o}() { + ${w} coords = getOutputCoords(); + ${A} + return ${v}(${k}); + } + `;return new p.GlslLibRoutine(j,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(o,n,t){switch(t.unpackedShape.length){case 0:return this.getPackedSamplerScalar(o,n);case 1:return this.getPackedSampler1D(o,n,t);case 2:return this.getPackedSampler2D(o,n,t);case 3:return this.getPackedSampler3D(o,n,t);default:return this.getPackedSamplerND(o,n,t)}}getUnpackedSamplerFromInput(o,n,t){const e=t.unpackedShape;switch(e.length){case 0:return this.getUnpackedSamplerScalar(o,n,t);case 1:return this.getUnpackedSampler1D(o,n,t);case 2:return this.getUnpackedSampler2D(o,n,t);case 3:return this.getUnpackedSampler3D(o,n,t);case 4:return this.getUnpackedSampler4D(o,n,t);case 5:return this.getUnpackedSampler5D(o,n,t);case 6:return this.getUnpackedSampler6D(o,n,t);default:throw new Error(`Unsupported dimension ${e.length}-D`)}}getPackedSamplerScalar(o,n){const t=` + vec4 ${o}() { + return ${(0,h.getGlsl)(this.context.glContext.version).texture2D}(${n}, halfCR); + } + `;return new p.GlslLibRoutine(t)}getPackedSampler1D(o,n,t){const e=[t.width,t.height],r=[e[1],e[0]],i=(0,h.getGlsl)(this.context.glContext.version),s=`vec4 ${o}(int index) { + vec2 uv = packedUVfrom1D( + ${r[0]}, ${r[1]}, index); + return ${i.texture2D}(${n}, uv); + }`;return new p.GlslLibRoutine(s,["coordinates.packedUVfrom1D"])}getPackedSampler2D(o,n,t){const e=t.unpackedShape,r=[t.width,t.height],i=(0,h.getGlsl)(this.context.glContext.version),s=r[0],f=r[1];if(r!=null&&m.ArrayUtil.arraysEqual(e,r)){const w=`vec4 ${o}(int row, int col) { + vec2 uv = (vec2(col, row) + halfCR) / vec2(${f}.0, ${s}.0); + return ${i.texture2D}(${n}, uv); + }`;return new p.GlslLibRoutine(w)}const g=r,b=Math.ceil(e[1]/2),v=`vec4 ${o}(int row, int col) { + vec2 uv = packedUVfrom2D(${g[1]}, ${g[0]}, ${b}, row, col); + return ${i.texture2D}(${n}, uv); + }`;return new p.GlslLibRoutine(v,["coordinates.packedUVfrom2D"])}getPackedSampler3D(o,n,t){const e=t.unpackedShape,r=[t.width,t.height],i=[r[0],r[1]],s=(0,h.getGlsl)(this.context.glContext.version);if(e[0]===1){const w=e.slice(1),T=[1,2],x=(0,u.squeezeInputShape)(e,w),A=["b","row","col"],D=JSON.parse(JSON.stringify(t));D.unpackedShape=x;const k=this.getPackedSamplerFromInput(o,n,D),j=`${k.routineBody} + vec4 ${o}(int b, int row, int col) { + return ${o}(${(0,u.getSqueezedParams)(A,T)}); + } `;return new p.GlslLibRoutine(j,k.dependencies)}const f=i[0],g=i[1],b=Math.ceil(e[2]/2),v=`vec4 ${o}(int b, int row, int col) { + vec2 uv = packedUVfrom3D( + ${g}, ${f}, ${b*Math.ceil(e[1]/2)}, ${b}, b, row, col); + return ${s.texture2D}(${n}, uv);}`;return new p.GlslLibRoutine(v,["coordinates.packedUVfrom3D"])}getPackedSamplerND(o,n,t){const e=t.unpackedShape,r=e.length,i=[t.width,t.height],s=(0,h.getGlsl)(this.context.glContext.version),f=[i[0],i[1]],g=f[1],b=f[0],v=Math.ceil(e[r-1]/2);let w=v*Math.ceil(e[r-2]/2),T="int b, int row, int col",x=`b * ${w} + (row / 2) * ${v} + (col / 2)`;for(let D=2;D{const e=this.context.inputTextureLayouts[t],r=(e.unpackedShape.length>0?e.unpackedShape:e.shape).length;let i=`_${n}`;o[i]=new p.GlslLibRoutine(this.getValueFromSingle(n,r,e.width,e.height,!1),[`shapeUtils.indicesToOffset${i}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),i+="_T",o[i]=new p.GlslLibRoutine(this.getValueFromSingle(n,r,e.width,e.height,!0),[`shapeUtils.indicesToOffset${i}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),o}getValueFromSingle(o,n,t,e,r){let i=`_${o}`;return r&&(i+="_T"),` + float ${i}(int m[${n}]) { + int offset = indicesToOffset${i}(m); + vec2 coords = offsetToCoords(offset, ${t}, ${e}); + float value = getColorAsFloat(${(0,h.getGlsl)(this.context.glContext.version).texture2D}(${o}, coords)); + return value; + } + `}getPackedValueFrom(o,n,t,e,r){let i=`_${o}_Pack`;return r&&(i+="_T"),` + vec4 ${i}(int m[${n}]) { + int offset = indicesToOffset_${o}(m); + vec2 coords = offsetToCoords(offset, ${t}, ${e}); + return ${(0,h.getGlsl)(this.context.glContext.version).texture2D}(${o}, coords); + } + `}}c.CoordsGlslLib=l},1997:($,c)=>{var y;Object.defineProperty(c,"__esModule",{value:!0}),c.TopologicalSortGlslRoutines=c.GlslLibRoutineNode=c.GlslLibRoutine=c.GlslLib=c.GlslContext=c.FunctionType=void 0,(y=c.FunctionType||(c.FunctionType={}))[y.ValueBased=0]="ValueBased",y[y.Positional=1]="Positional",c.GlslContext=class{constructor(m,p,h,d){this.glContext=m,this.programInfo=p,this.inputTextureLayouts=h,this.outputTextureLayout=d}},c.GlslLib=class{constructor(m){this.context=m}},c.GlslLibRoutine=class{constructor(m,p){this.routineBody=m,this.dependencies=p}},c.GlslLibRoutineNode=class{constructor(m,p,h){this.name=m,this.dependencies=h||[],p&&(this.routineBody=p)}addDependency(m){m&&this.dependencies.push(m)}},c.TopologicalSortGlslRoutines=class{static returnOrderedNodes(m){if(!m||m.length===0)return[];if(m.length===1)return m;const p=new Set,h=new Set,d=new Array;return this.createOrderedNodes(m,p,h,d),d}static createOrderedNodes(m,p,h,d){for(let u=0;u0)for(let l=0;l{Object.defineProperty(c,"__esModule",{value:!0}),c.EncodingGlslLib=void 0;const m=y(1997);class p extends m.GlslLib{constructor(d){super(d)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new m.GlslLibRoutine(`highp vec4 encode(highp float f) { + return vec4(f, 0.0, 0.0, 0.0); + } + `)}}decodeFloat32(){return{decode:new m.GlslLibRoutine(`highp float decode(highp vec4 rgba) { + return rgba.r; + } + `)}}encodeUint8(){const d=p.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new m.GlslLibRoutine(` + highp vec4 encode(highp float f) { + highp float F = abs(f); + highp float Sign = step(0.0,-f); + highp float Exponent = floor(log2(F)); + highp float Mantissa = (exp2(- Exponent) * F); + Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); + highp vec4 rgba; + rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); + rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); + rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); + rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); + ${d} + rgba = rgba / 255.0; // values need to be normalized to [0,1] + return rgba; + } + `)}}decodeUint8(){const d=p.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new m.GlslLibRoutine(` + highp float decode(highp vec4 rgba) { + rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] + ${d} + highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; + highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; + highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); + highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); + return Result; + } + `)}}static isLittleEndian(){const d=new ArrayBuffer(4),u=new Uint32Array(d),l=new Uint8Array(d);if(u[0]=3735928559,l[0]===239)return!0;if(l[0]===222)return!1;throw new Error("unknown endianness")}}c.EncodingGlslLib=p},2691:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FragColorGlslLib=void 0;const m=y(1997),p=y(6757);class h extends m.GlslLib{constructor(u){super(u)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const u=(0,p.getGlsl)(this.context.glContext.version);return{setFragColor:new m.GlslLibRoutine(` + void setFragColor(float value) { + ${u.output} = encode(value); + } + `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new m.GlslLibRoutine(` + float getColorAsFloat(vec4 color) { + return decode(color); + } + `,["encoding.decode"])}}}c.FragColorGlslLib=h},3878:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.replaceInlines=void 0;const y=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;c.replaceInlines=function(m){const p={};let h;for(;(h=y.exec(m))!==null;){const d=h[3].split(",").map(u=>{const l=u.trim().split(" ");return l&&l.length===2?{type:l[0],name:l[1]}:null}).filter(u=>u!==null);p[h[2]]={params:d,body:h[4]}}for(const d in p){const u="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",d),l=new RegExp(u,"gm");for(;(h=l.exec(m))!==null;){const a=h[1],o=h[2],n=h[3].split(","),t=a?`${a} ${o};`:"";let e=p[d].body,r="";p[d].params.forEach((s,f)=>{s&&(r+=`${s.type} ${s.name} = ${n[f]}; +`)}),e=`${r} + ${e}`,e=e.replace("return",`${o} = `);const i=` + ${t} + { + ${e} + } + `;m=m.replace(h[0],i)}}return m.replace(y,"")}},8897:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.GlslPreprocessor=void 0;const m=y(1997),p=y(3878),h=y(1248),d=y(6757);c.GlslPreprocessor=class{constructor(u,l,a,o){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new m.GlslContext(u,l,a,o),Object.keys(h.glslRegistry).forEach(t=>{const e=new h.glslRegistry[t](this.context);this.libs[t]=e});const n=this.glslLibRoutineDependencyGraph;for(const t in this.libs){const e=this.libs[t].getFunctions();for(const r in e){const i=t+"."+r;let s;n[i]?(s=n[i],s.routineBody=e[r].routineBody):(s=new m.GlslLibRoutineNode(i,e[r].routineBody),n[i]=s);const f=e[r].dependencies;if(f)for(let g=0;g{const o=a.split(".")[1];u.indexOf(o)!==-1&&l.push(this.glslLibRoutineDependencyGraph[a])}),m.TopologicalSortGlslRoutines.returnOrderedNodes(l)}getUniforms(u,l){const a=[];if(u)for(const o of u)a.push(`uniform sampler2D ${o};`);if(l)for(const o of l)a.push(`uniform ${o.type} ${o.name}${o.arrayLength?`[${o.arrayLength}]`:""};`);return a.join(` +`)}}},1248:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.glslRegistry=void 0;const m=y(6859),p=y(1371),h=y(2691),d=y(9183),u=y(9314);c.glslRegistry={encoding:p.EncodingGlslLib,fragcolor:h.FragColorGlslLib,vec:u.VecGlslLib,shapeUtils:d.ShapeUtilsGlslLib,coordinates:m.CoordsGlslLib}},9183:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ShapeUtilsGlslLib=void 0;const m=y(1997);class p extends m.GlslLib{constructor(d){super(d)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const d=this.context.outputTextureLayout.shape.length,u={};return this.context.programInfo.inputNames.forEach((l,a)=>{const o=this.context.inputTextureLayouts[a].unpackedShape;if(o.length<=d){const n=o.length,t=d-n,e=`bcastIndices_${l}`;let r="";for(let s=0;s{const o=this.context.inputTextureLayouts[a].shape;if(!(o.length<2||o.length>d)){const n=o.length,t=d-n,e=`bcastMatmulIndices_${l}`;let r="";for(let s=0;s{const a=this.context.inputTextureLayouts[l].shape,o=this.context.inputTextureLayouts[l].strides,n=a.length;let t=`indicesToOffset_${u}`;d[t]=new m.GlslLibRoutine(p.indexToOffsetSingle(t,n,o)),t=`indicesToOffset_${u}_T`,d[t]=new m.GlslLibRoutine(p.indexToOffsetSingle(t,n,o.slice().reverse()))}),d}static indexToOffsetSingle(d,u,l){let a="";for(let o=u-1;o>=0;--o)a+=` + offset += indices[${o}] * ${l[o]}; + `;return` + int ${d}(int indices[${u}]) { + int offset = 0; + ${a} + return offset; + } + `}offsetToIndices(){const d={};return this.context.programInfo.inputNames.forEach((u,l)=>{const a=this.context.inputTextureLayouts[l].shape,o=this.context.inputTextureLayouts[l].strides,n=a.length;let t=`offsetToIndices_${u}`;d[t]=new m.GlslLibRoutine(p.offsetToIndicesSingle(t,n,o)),t=`offsetToIndices_${u}_T`,d[t]=new m.GlslLibRoutine(p.offsetToIndicesSingle(t,n,o.slice().reverse()))}),d}static offsetToIndicesSingle(d,u,l){const a=[];for(let o=0;o{const a=this.context.inputTextureLayouts[l].shape,o=a.length,n=`incrementIndices_${u}`;let t="";for(let r=0;r= 0; --i) { + if(i > axis) continue; + indices[i] += 1; + if(indices[i] < shape[i]) { + break; + } + indices[i] = 0; + } + } + `;d[n]=new m.GlslLibRoutine(e)}),d}}c.ShapeUtilsGlslLib=p},6757:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getDefaultFragShaderMain=c.getFragShaderPreamble=c.getVertexShaderSource=c.getGlsl=void 0;const y={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},m={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function p(h){return h===1?y:m}c.getGlsl=p,c.getVertexShaderSource=function(h){const d=p(h);return`${d.version} + precision highp float; + ${d.attribute} vec3 position; + ${d.attribute} vec2 textureCoord; + + ${d.varyingVertex} vec2 TexCoords; + + void main() + { + gl_Position = vec4(position, 1.0); + TexCoords = textureCoord; + }`},c.getFragShaderPreamble=function(h){const d=p(h);return`${d.version} + precision highp float; + precision highp int; + precision highp sampler2D; + ${d.varyingFrag} vec2 TexCoords; + ${d.outputDeclaration} + const vec2 halfCR = vec2(0.5, 0.5); + + // Custom vector types to handle higher dimenalities. + struct ivec5 + { + int x; + int y; + int z; + int w; + int u; + }; + + struct ivec6 + { + int x; + int y; + int z; + int w; + int u; + int v; + }; + + int imod(int x, int y) { + return x - y * (x / y); + } + + `},c.getDefaultFragShaderMain=function(h,d){return` + void main() { + int indices[${d}]; + toVec(TexCoords, indices); + vec4 result = vec4(process(indices)); + ${p(h).output} = result; + } + `}},9314:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.VecGlslLib=void 0;const m=y(1997);class p extends m.GlslLib{constructor(d){super(d)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const d=this.context.outputTextureLayout.shape.length,u={add:"+=",sub:"-=",mul:"*=",div:"/="},l={};for(const a in u){const o=`${a}Vec`;let n="";for(let e=0;e{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLInferenceHandler=void 0;const m=y(1315),p=y(9240),h=y(7273),d=y(9),u=y(7379),l=y(2488),a=y(540),o=y(3314),n=y(5639);c.WebGLInferenceHandler=class{constructor(t){this.session=t,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(t,e){return(0,o.calculateTextureWidthAndHeight)(this.session.layoutStrategy,t,e)}executeProgram(t,e){if(e.length{const T=w.map(A=>`${A.unpackedShape.join(",")};${A.width}x${A.height}`).join("_");let x=v.name;return v.cacheHint&&(x+="["+v.cacheHint+"]"),x+=":"+T,x})(t,r);let s=this.session.programManager.getArtifact(i);const f=s?s.programInfo:typeof t.get=="function"?t.get():t,g=(0,o.createTextureLayoutFromTextureType)(this.session.layoutStrategy,f.output.dims,f.output.textureType),b=this.createTextureData(g,f.output.type);return s||(s=this.session.programManager.build(f,r,b),this.session.programManager.setArtifact(i,s)),this.runProgram(s,r,b),b}run(t,e){return this.executeProgram(t,e).tensor}runProgram(t,e,r){for(let i=0;ithis.readTexture(f),async g=>this.readTextureAsync(f),void 0,s),texture:r});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,r=!1){this.session.isInitializer(t)?this.session.setTextureData(t,e,r):(r?this.packedTextureDataCache:this.unpackedTextureDataCache).set(t,e)}isTextureLayoutCached(t,e=!1){return!!this.getTextureData(t.dataId,e)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(t=>this.session.textureManager.releaseTexture(t)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(t=>this.session.textureManager.releaseTexture(t)),this.unpackedTextureDataCache=new Map}readTexture(t){return t.isPacked?this.readTexture(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,l.encodeAsUint8)(this,t))}async readTextureAsync(t){return t.isPacked?this.readTextureAsync(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,l.encodeAsUint8)(this,t))}pack(t){return this.executeProgram((0,d.createPackProgramInfoLoader)(this,t.tensor),[t.tensor])}unpack(t){return this.executeProgram((0,a.createUnpackProgramInfoLoader)(this,t.tensor),[t.tensor])}}},4110:function($,c,y){var m=this&&this.__createBinding||(Object.create?function(K,X,J,tt){tt===void 0&&(tt=J);var nt=Object.getOwnPropertyDescriptor(X,J);nt&&!("get"in nt?!X.__esModule:nt.writable||nt.configurable)||(nt={enumerable:!0,get:function(){return X[J]}}),Object.defineProperty(K,tt,nt)}:function(K,X,J,tt){tt===void 0&&(tt=J),K[tt]=X[J]}),p=this&&this.__setModuleDefault||(Object.create?function(K,X){Object.defineProperty(K,"default",{enumerable:!0,value:X})}:function(K,X){K.default=X}),h=this&&this.__importStar||function(K){if(K&&K.__esModule)return K;var X={};if(K!=null)for(var J in K)J!=="default"&&Object.prototype.hasOwnProperty.call(K,J)&&m(X,K,J);return p(X,K),X};Object.defineProperty(c,"__esModule",{value:!0}),c.WEBGL_OP_RESOLVE_RULES=void 0;const d=y(8817),u=h(y(5194)),l=y(4752),a=y(6668),o=y(9754),n=y(5042),t=y(6742),e=y(4125),r=y(6149),i=y(5378),s=y(6981),f=y(7413),g=y(7006),b=y(8276),v=y(5565),w=y(2834),T=y(1010),x=y(8126),A=y(2801),D=y(565),k=y(2444),j=y(815),M=y(564),S=y(5416),U=y(1240),O=y(5944),E=y(5707),N=h(y(9087)),q=y(7862),H=y(3980);c.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",N.abs],["Acos","","7+",N.acos],["Add","","7+",u.add],["And","","7+",u.and],["Asin","","7+",N.asin],["Atan","","7+",N.atan],["AveragePool","","7+",w.averagePool,w.parseAveragePoolAttributes],["BatchNormalization","","7+",d.batchNormalization,d.parseBatchNormalizationAttributes],["Cast","","6+",l.cast,l.parseCastAttributes],["Ceil","","6+",N.ceil],["Clip","","6-10",N.clip,N.parseClipAttributes],["Clip","","11+",N.clipV11],["Concat","","4+",a.concat,a.parseConcatAttributes],["Conv","","1+",o.conv,o.parseConvAttributes],["ConvTranspose","","1+",n.convTranspose,n.parseConvTransposeAttributes],["Cos","","7+",N.cos],["Div","","7+",u.div],["Dropout","","7+",N.identity],["DepthToSpace","","1+",t.depthToSpace,t.parseDepthToSpaceAttributes],["Equal","","7+",u.equal],["Elu","","6+",N.elu,N.parseEluAttributes],["Exp","","6+",N.exp],["Flatten","","1+",e.flatten,e.parseFlattenAttributes],["Floor","","6+",N.floor],["FusedConv","com.microsoft","1+",o.conv,o.parseConvAttributes],["Gather","","1+",r.gather,r.parseGatherAttributes],["Gemm","","7-10",i.gemm,i.parseGemmAttributesV7],["Gemm","","11+",i.gemm,i.parseGemmAttributesV11],["GlobalAveragePool","","1+",w.globalAveragePool,w.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",w.globalMaxPool],["Greater","","7+",u.greater],["Identity","","1+",N.identity],["ImageScaler","","1+",s.imageScaler,s.parseImageScalerAttributes],["InstanceNormalization","","6+",f.instanceNormalization,f.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",N.leakyRelu,N.parseLeakyReluAttributes],["Less","","7+",u.less],["LRN","","1+",g.lrn,g.parseLrnAttributes],["Log","","6+",N.log],["MatMul","","1+",b.matMul,b.parseMatMulAttributes],["MaxPool","","1+",w.maxPool,w.parseMaxPoolAttributes],["Mul","","7+",u.mul],["Neg","","6+",N.neg],["Not","","1+",N.not],["Or","","7+",u.or],["Pad","","2-10",v.padV2,v.parsePadAttributesV2],["Pad","","11+",v.padV11,v.parsePadAttributesV11],["Pow","","7+",u.pow],["PRelu","","7+",u.pRelu],["ReduceLogSum","","1+",T.reduceLogSum,T.parseReduceAttributes],["ReduceMax","","1+",T.reduceMax,T.parseReduceAttributes],["ReduceMean","","1+",T.reduceMean,T.parseReduceAttributes],["ReduceMin","","1+",T.reduceMin,T.parseReduceAttributes],["ReduceProd","","1+",T.reduceProd,T.parseReduceAttributes],["ReduceSum","","1-12",T.reduceSum,T.parseReduceAttributes],["ReduceSumSquare","","1+",T.reduceLogSumSquare,T.parseReduceAttributes],["Relu","","6+",N.relu],["Reshape","","5+",x.reshape],["Resize","","10",A.resize,A.parseResizeAttributesV10],["Resize","","11+",A.resize,A.parseResizeAttributesV11],["Shape","","1+",D.shape],["Sigmoid","","6+",N.sigmoid],["Sin","","7+",N.sin],["Slice","","10+",k.sliceV10],["Slice","","1-9",k.slice,k.parseSliceAttributes],["Softmax","","1-12",j.softmax,j.parseSoftmaxAttributes],["Softmax","","13+",j.softmaxV13,j.parseSoftmaxAttributesV13],["Split","","2-12",M.split,M.parseSplitAttributes],["Sqrt","","6+",N.sqrt],["Squeeze","","1-12",S.squeeze,S.parseSqueezeAttributes],["Squeeze","","13+",S.squeezeV13],["Sub","","7+",u.sub],["Sum","","6+",U.sum],["Tan","","7+",N.tan],["Tanh","","6+",N.tanh],["Tile","","6+",O.tile],["Transpose","","1+",E.transpose,E.parseTransposeAttributes],["Upsample","","7-8",H.upsample,H.parseUpsampleAttributesV7],["Upsample","","9",H.upsample,H.parseUpsampleAttributesV9],["Unsqueeze","","1-12",q.unsqueeze,q.parseUnsqueezeAttributes],["Unsqueeze","","13+",q.unsqueezeV13],["Xor","","7+",u.xor]]},8817:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseBatchNormalizationAttributes=c.batchNormalization=void 0;const m=y(4910),p=y(6757),h=y(5639),d={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[h.TextureType.unpacked,h.TextureType.unpacked,h.TextureType.unpacked,h.TextureType.unpacked,h.TextureType.unpacked]};c.batchNormalization=(a,o,n)=>(l(o),[a.run(Object.assign(Object.assign({},d),{cacheHint:n.cacheKey,get:()=>u(a,o,n)}),o)]),c.parseBatchNormalizationAttributes=a=>{const o=a.attributes.getFloat("epsilon",1e-5),n=a.attributes.getFloat("momentum",.9),t=a.attributes.getInt("spatial",1);return(0,m.createAttributeWithCacheKey)({epsilon:o,momentum:n,spatial:t})};const u=(a,o,n)=>{const t=(0,p.getGlsl)(a.session.backend.glContext.version),e=o[0].dims.length,[r,i]=a.calculateTextureWidthAndHeight(o[1].dims,h.TextureType.unpacked),s=` + float process(int[${e}] indices) { + vec2 position = offsetToCoords(indices[1], ${r}, ${i}); + float scale = getColorAsFloat(${t.texture2D}(Scale, position)); + float mean = getColorAsFloat(${t.texture2D}(Mean, position)); + float variance = getColorAsFloat(${t.texture2D}(Variance, position)); + float b = getColorAsFloat(${t.texture2D}(B, position)); + + return scale * ( (_A(indices) - mean) / sqrt(variance + float(${n.epsilon})) ) + b; + }`;return Object.assign(Object.assign({},d),{output:{dims:o[0].dims,type:o[0].type,textureType:h.TextureType.unpacked},shaderSource:s})},l=a=>{if(!a||a.length!==5)throw new Error("BatchNormalization requires 5 inputs.");const o=a[0],n=a[1],t=a[2],e=a[3],r=a[4];if(o.dims.length<3||n.dims.length!==1||t.dims.length!==1||e.dims.length!==1||r.dims.length!==1)throw new Error("invalid input shape.");if(n.dims[0]!==o.dims[1]||t.dims[0]!==o.dims[1]||e.dims[0]!==o.dims[1]||r.dims[0]!==o.dims[1])throw new Error("invalid input shape.");if(o.type!=="float32"&&o.type!=="float64"||n.type!=="float32"&&n.type!=="float64"||t.type!=="float32"&&t.type!=="float64"||e.type!=="float32"&&e.type!=="float64"||r.type!=="float32"&&r.type!=="float64")throw new Error("invalid input tensor types.")}},5194:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.xor=c.sub=c.pRelu=c.pow=c.or=c.mul=c.less=c.greater=c.equal=c.div=c.and=c.add=c.glslPRelu=c.glslPow=c.glslXor=c.glslOr=c.glslAnd=c.glslLess=c.glslGreater=c.glslEqual=c.glslSub=c.glslMul=c.glslDiv=c.glslAdd=void 0;const m=y(7273),p=y(1997),h=y(6757),d=y(5639);function u(){const w="add_";return{body:` + float ${w}(float a, float b) { + return a + b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 + v2; + } + `,name:w,type:p.FunctionType.ValueBased}}function l(){const w="div_";return{body:` + float ${w}(float a, float b) { + return a / b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 / v2; + } + `,name:w,type:p.FunctionType.ValueBased}}function a(){const w="mul_";return{body:` + float ${w}(float a, float b) { + return a * b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 * v2; + } + `,name:w,type:p.FunctionType.ValueBased}}function o(){const w="sub_";return{body:` + float ${w}(float a, float b) { + return a - b; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return v1 - v2; + } + `,name:w,type:p.FunctionType.ValueBased}}function n(){const w="equal_";return{body:` + float ${w}(float a, float b) { + return float(a == b); + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4(equal(v1, v2)); + } + `,name:w,type:p.FunctionType.ValueBased}}function t(){const w="greater_";return{body:` + float ${w}(float a, float b) { + return float(a > b); + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4( v1.r > v2.r , + v1.g > v2.g, + v1.b > v2.b, + v1.a > v2.a ); + } + `,name:w,type:p.FunctionType.ValueBased}}function e(){const w="less_";return{body:` + float ${w}(float a, float b) { + return float(a < b); + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4( v1.r < v2.r , + v1.g < v2.g, + v1.b < v2.b, + v1.a < v2.a ); + } + `,name:w,type:p.FunctionType.ValueBased}}function r(){const w="and_";return{body:` + float ${w}(float a, float b) { + return float( bool(a) && bool(b) ); + } + vec4 ${w}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r && b2.r , + b1.g && b2.g, + b1.b && b2.b, + b1.a && b2.a ); + } + `,name:w,type:p.FunctionType.ValueBased}}function i(){const w="or_";return{body:` + float ${w}(float a, float b) { + return float( bool(a) || bool(b) ); + } + vec4 ${w}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r || b2.r , + b1.g || b2.g, + b1.b || b2.b, + b1.a || b2.a ); + } + `,name:w,type:p.FunctionType.ValueBased}}function s(){const w="xor_";return{body:` + float ${w}(float a, float b) { + return float( bool(a) ^^ bool(b) ); + } + vec4 ${w}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r ^^ b2.r , + b1.g ^^ b2.g, + b1.b ^^ b2.b, + b1.a ^^ b2.a ); + } + `,name:w,type:p.FunctionType.ValueBased}}function f(){return function(w){const T=`${w}_`;return{body:` + float ${T}(float a, float b) { + return ${w}(a, b); + } + vec4 ${T}(vec4 v1, vec4 v2) { + return ${w}(v1, v2); + } + `,name:T,type:p.FunctionType.ValueBased}}("pow")}function g(){const w="prelu_";return{body:` + float ${w}(float a, float b) { + return a < 0.0 ? a * b: a; + } + vec4 ${w}(vec4 v1, vec4 v2) { + return vec4( + v1.r < 0.0 ? v1.r * v2.r: v1.r, + v1.g < 0.0 ? v1.g * v2.g: v1.g, + v1.b < 0.0 ? v1.b * v2.b: v1.b, + v1.a < 0.0 ? v1.a * v2.a: v1.a + ); + } + `,name:w,type:p.FunctionType.ValueBased}}c.glslAdd=u,c.glslDiv=l,c.glslMul=a,c.glslSub=o,c.glslEqual=n,c.glslGreater=t,c.glslLess=e,c.glslAnd=r,c.glslOr=i,c.glslXor=s,c.glslPow=f,c.glslPRelu=g;const b=(w,T,x,A=T[0].type,D)=>{const k=w.session.pack?d.TextureType.packed:d.TextureType.unpacked;return{name:x.name,inputNames:["A","B"],inputTypes:[k,k],cacheHint:D,get:()=>v(w,T,x,A)}},v=(w,T,x,A=T[0].type)=>{const D=w.session.pack?d.TextureType.packed:d.TextureType.unpacked,k=!m.ShapeUtil.areEqual(T[0].dims,T[1].dims);let j=T[0].dims;const M=w.session.pack;if(k){const O=m.BroadcastUtil.calcShape(T[0].dims,T[1].dims,!1);if(!O)throw new Error("Can't perform binary op on the given tensors");j=O;const E=j.length,N=T[0].dims.length!==0?T[0].dims.length:1,q=T[1].dims.length!==0?T[1].dims.length:1,H=T[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",K=T[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",X=(0,h.getGlsl)(w.session.backend.glContext.version),J=M?` + ${x.body} + void main() { + vec4 a = getAAtOutCoords(); + vec4 b = getBAtOutCoords(); + vec4 result = ${x.name}(a, b); + ${X.output} = result; + }`:` + ${x.body} + float process(int indices[${E}]) { + int aindices[${N}]; + int bindices[${q}]; + ${H} + ${K} + return ${x.name}(_A(aindices), _B(bindices)); + }`;return{name:x.name,inputNames:["A","B"],inputTypes:[D,D],output:{dims:j,type:A,textureType:D},shaderSource:J,hasMain:M}}const S=(0,h.getGlsl)(w.session.backend.glContext.version),U=` + ${x.body} + void main() { + vec4 v1 = ${S.texture2D}(A, TexCoords); + vec4 v2 = ${S.texture2D}(B, TexCoords); + vec4 result = ${x.name}(v1, v2); + ${S.output} = result; + } + `;return{name:x.name,inputNames:["A","B"],inputTypes:[D,D],output:{dims:T[0].dims,type:A,textureType:D},shaderSource:U,hasMain:!0}};c.add=(w,T)=>[w.run(b(w,T,u()),T)],c.and=(w,T)=>[w.run(b(w,T,r(),"bool"),T)],c.div=(w,T)=>[w.run(b(w,T,l()),T)],c.equal=(w,T)=>[w.run(b(w,T,n(),"bool"),T)],c.greater=(w,T)=>[w.run(b(w,T,t(),"bool"),T)],c.less=(w,T)=>[w.run(b(w,T,e(),"bool"),T)],c.mul=(w,T)=>[w.run(b(w,T,a()),T)],c.or=(w,T)=>[w.run(b(w,T,i(),"bool"),T)],c.pow=(w,T)=>[w.run(b(w,T,f()),T)],c.pRelu=(w,T)=>[w.run(b(w,T,g()),T)],c.sub=(w,T)=>[w.run(b(w,T,o()),T)],c.xor=(w,T)=>[w.run(b(w,T,s(),"bool"),T)]},4752:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseCastAttributes=c.cast=void 0;const m=y(7273);c.cast=(h,d,u)=>(p(d),[h.cast(d[0],u)]),c.parseCastAttributes=h=>m.ProtoUtil.tensorDataTypeFromProto(h.attributes.getInt("to"));const p=h=>{if(!h||h.length!==1)throw new Error("Cast requires 1 input.");if(h[0].type==="string")throw new Error("Invalid input type.")}},4595:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedConcatProgramInfoLoader=void 0;const m=y(6757),p=y(5639),h=y(432),d=y(5614);c.createPackedConcatProgramInfoLoader=(l,a,o)=>{const n=(t=a.length,e=o.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:t},(r,i)=>`X${i}`),inputTypes:Array(t).fill(p.TextureType.packed),cacheHint:e});var t,e;return Object.assign(Object.assign({},n),{get:()=>((r,i,s,f)=>{const g=s[0].dims.slice();if(f>=g.length||f<-1*g.length)throw new Error("axis specified for concat doesn't match input dimensionality");f<0&&(f=g.length+f);const b=g.slice(0);for(let H=1;HH.dims),D=(0,h.getGlChannels)(v),k=new Array(A.length-1);k[0]=A[0][f];for(let H=1;H= ${k[H-1]}) { + return getChannel( + getX${H}(${u(D,j,K)}), + vec2(${u(M,j,K)})); + }`}const O=k.length,E=k[k.length-1];U+=` + return getChannel( + getX${O}(${u(D,j,E)}), + vec2(${u(M,j,E)}));`;const N=(0,m.getGlsl)(r.session.backend.glContext.version),q=` + ${x} + float getValue(${D.map(H=>"int "+H)}) { + ${U} + } + + void main() { + ${T} coords = getOutputCoords(); + int lastDim = coords.${D[v-1]}; + coords.${D[v-1]} = coords.${D[v-2]}; + coords.${D[v-2]} = lastDim; + + vec4 result = vec4(getValue(${w}), 0., 0., 0.); + + ${w[v-1]} = ${w[v-1]} + 1; + if (${w[v-1]} < ${b[v-1]}) { + result.g = getValue(${w}); + } + + ${w[v-2]} = ${w[v-2]} + 1; + if (${w[v-2]} < ${b[v-2]}) { + result.a = getValue(${w}); + } + + ${w[v-1]} = ${w[v-1]} - 1; + if (${w[v-2]} < ${b[v-2]} && + ${w[v-1]} < ${b[v-1]}) { + result.b = getValue(${w}); + } + ${N.output} = result; + } + `;return Object.assign(Object.assign({},i),{output:{dims:b,type:s[0].type,textureType:p.TextureType.packed},shaderSource:q,hasMain:!0})})(l,n,a,o.axis)})};const u=(l,a,o)=>{const n=l.indexOf(a);return l.map((t,e)=>e===n?`${t} - ${o}`:t).join()}},6668:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConcatAttributes=c.concat=void 0;const m=y(4910),p=y(5639),h=y(4595);c.concat=(t,e,r)=>(n(e),t.session.pack&&e[0].dims.length>1?[t.run((0,h.createPackedConcatProgramInfoLoader)(t,e,r),e)]:[t.run(d(t,e,r),e)]);const d=(t,e,r)=>{const i=(s=e.length,f=r.cacheKey,{name:"Concat",inputNames:Array.from({length:s},(g,b)=>`X${b}`),inputTypes:Array(s).fill(p.TextureType.unpacked),cacheHint:f});var s,f;return Object.assign(Object.assign({},i),{get:()=>((g,b,v,w)=>{const T=v[0].dims.slice();if(w>=T.length||w<-1*T.length)throw new Error("axis specified for concat doesn't match input dimensionality");w<0&&(w=T.length+w);const x=T.slice(0);for(let S=1;S`int getTextureWhereDataResides(int index) { + ${t.map((e,r)=>`if(index<${e}) {return ${r};} +`).join("")} + }`,l=t=>u(t),a=(t,e)=>{const r=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${e}]) {`];for(let i=0;i{const e=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let r=0;r(0,m.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis")});const n=t=>{if(!t||t.length<1)throw new Error("too few inputs");const e=t[0].type,r=t[0].dims.length;if(e==="string")throw new Error("string tensor is not supported yet");for(const i of t){if(i.type!==e)throw new Error("input tensors should be one type");if(i.dims.length!==r)throw new Error("input tensors should have the same shape")}}},7825:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createUnpackedGroupedConvProgramInfoLoader=void 0;const m=y(1315),p=y(6757),h=y(5639),d=y(9754),u=y(2150);c.createUnpackedGroupedConvProgramInfoLoader=(l,a,o)=>{const n=(t=a.length>2,e=o.cacheKey,{name:"GroupedConv",inputNames:t?["X","W","Bias"]:["X","W"],inputTypes:t?[h.TextureType.unpacked,h.TextureType.unpacked,h.TextureType.unpacked]:[h.TextureType.unpacked,h.TextureType.unpacked],cacheHint:e});var t,e;return Object.assign(Object.assign({},n),{get:()=>((r,i,s,f)=>{const g=i.length>2?"value += getBias(output_channel);":"",b=i[0].dims.slice(),v=i[1].dims.slice(),w=v[0]/f.group;m.Logger.verbose("GroupedConv",`autpPad:${f.autoPad}, dilations:${f.dilations}, group:${f.group}, kernelShape:${f.kernelShape}, pads:${f.pads}, strides:${f.strides}`);const T=(0,d.calculateOutputShape)(b,v,f.dilations,f.pads,f.strides),x=(0,p.getGlsl)(r.session.backend.glContext.version),{activationFunction:A,applyActivation:D}=(0,u.getActivationSnippet)(f),k=` + const ivec2 strides = ivec2(${f.strides[0]}, ${f.strides[1]}); + const ivec2 pads = ivec2(${f.pads[0]}, ${f.pads[1]}); + ${A} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + ivec2 xRCCorner = coords.zw * strides - pads; + int group_id = output_channel / ${w}; + + float value = 0.0; + for (int wInChannel = 0; wInChannel < ${v[1]}; wInChannel++) { + int input_channel = group_id * ${v[1]} + wInChannel; + for (int wHeight = 0; wHeight < ${v[2]}; wHeight++) { + int xHeight = xRCCorner.x + wHeight * ${f.dilations[0]}; + + if (xHeight < 0 || xHeight >= ${b[2]}) { + continue; + } + + for (int wWidth = 0; wWidth < ${v[3]}; wWidth++) { + int xWidth = xRCCorner.y + wWidth * ${f.dilations[1]}; + if (xWidth < 0 || xWidth >= ${b[3]}) { + continue; + } + + float xVal = getX(batch, input_channel, xWidth, xHeight); + float wVal = getW(output_channel, wInChannel, wWidth, wHeight); + value += xVal*wVal; + } + } + } + ${g} + ${D} + ${x.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},s),{output:{dims:T,type:i[0].type,textureType:h.TextureType.unpacked},shaderSource:k,hasMain:!0})})(l,a,n,o)})}},7708:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.conv2DPacked=c.conv2DPackedPointwise=void 0;const m=y(9754),p=y(5950),h=y(5632);c.conv2DPackedPointwise=(d,u,l)=>{const a=u[0].dims,o=u[1].dims,n=(0,m.calculateOutputShape)(a,o,l.dilations,l.pads,l.strides),t=d.reshapePacked(u[0],[a[1],a[2]*a[3]]),e=d.reshapePacked(u[1],[o[0],o[1]]),r=u.length>2?[e,t,u[2]]:[e,t],i=d.run((0,h.createPackedMatmulProgramInfoLoader)(d,r,l),r);return d.reshapePacked(i,n)},c.conv2DPacked=(d,u,l)=>{const a=u[0].dims,o=u[1].dims,n=(0,m.calculateOutputShape)(a,o,l.dilations,l.pads,l.strides),t=d.run((0,p.createPackedIm2ColProgramInfoLoader)(d,u[0],u[1],n,l),[u[0]]),e=d.reshapePacked(u[1],[o[0],o[1]*o[2]*o[3]]),r=u.length===3?[e,t,u[2]]:[e,t],i=d.run((0,h.createPackedMatmulProgramInfoLoader)(d,r,l),r);return d.reshapePacked(i,n)}},5042:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConvTransposeAttributes=c.convTranspose=void 0;const m=y(4910),p=y(6757),h=y(5639),d=y(2150),u=(e,r,i,s,f,g)=>(e-1)*r+i+(s-1)*f+1-g,l=(e,r,i,s,f)=>{const g=Math.floor(e/2);r==="SAME_UPPER"?(i[s]=g,i[f]=e-g):r==="SAME_LOWER"&&(i[s]=e-g,i[f]=g)};c.convTranspose=(e,r,i)=>(t(r,i),a(e,r,i));const a=(e,r,i)=>{const s=n(i,r);return[o(e,r,s)]},o=(e,r,i)=>e.run(((s,f,g)=>{const b=(v=f.length>2,w=g.cacheKey,{name:"ConvTranspose",inputNames:v?["X","W","B"]:["X","W"],inputTypes:v?[h.TextureType.unpacked,h.TextureType.unpacked,h.TextureType.unpacked]:[h.TextureType.unpacked,h.TextureType.unpacked],cacheHint:w});var v,w;return Object.assign(Object.assign({},b),{get:()=>((T,x,A,D)=>{const k=x.length>2?"getB(output_channel)":"0.0",j=x[0].dims,M=x[1].dims,S=M[1],U=M[0]/D.group,O=[x[0].dims[0],x[1].dims[1]*D.group,...D.outputShape],E=(0,p.getGlsl)(T.session.backend.glContext.version),{activationFunction:N,applyActivation:q}=(0,d.getActivationSnippet)(D),H=` + const ivec2 strides = ivec2(${D.strides[0]}, ${D.strides[1]}); + const ivec2 pads = ivec2(${D.pads[0]}, ${D.pads[1]}); + ${N} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + + ivec2 loc = coords.zw + pads; + + int group_id = output_channel / ${S}; + int wOutChannel = output_channel - group_id * ${S}; + + float value = ${k}; + for (int inChannelOffset = 0; inChannelOffset < ${U}; inChannelOffset++) { + int input_channel = group_id * ${U} + inChannelOffset; + for (int wWOff = 0; wWOff < ${M[2]}; wWOff++) { + for (int wHOff = 0; wHOff < ${M[3]}; wHOff++) { + ivec2 wOff = ivec2(wWOff * ${D.dilations[0]}, wHOff * ${D.dilations[1]}); + ivec2 wLoc = loc - wOff; + ivec2 wLocIn = wLoc / strides; + if ( + wLocIn * strides == wLoc && + wLocIn.x >= 0 && wLocIn.x < ${j[2]} && + wLocIn.y >= 0 && wLocIn.y < ${j[3]} + ) { + float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); + float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); + value += xVal * wVal; + } + } + } + } + ${q} + ${E.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},A),{output:{dims:O,type:x[0].type,textureType:h.TextureType.unpacked},shaderSource:H,hasMain:!0})})(s,f,b,g)})})(e,r,i),r),n=(e,r)=>{const i=e.kernelShape.slice();if(e.kernelShape.length===0)for(let b=2;b{const j=b.length-2,M=k.length===0;for(let S=0;S{const r=e.attributes,i=(0,d.parseInternalActivationAttributes)(r),s=r.getString("auto_pad","NOTSET"),f=r.getInts("dilations",[1,1]),g=r.getInt("group",1),b=r.getInts("kernel_shape",[]),v=r.getInts("output_padding",[0,0]),w=r.getInts("output_shape",[]),T=r.getInts("pads",[0,0,0,0]),x=r.getInts("strides",[1,1]);return(0,m.createAttributeWithCacheKey)(Object.assign({autoPad:s,dilations:f,group:g,kernelShape:b,outputPadding:v,outputShape:w,pads:T,strides:x},i))};const t=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length!==4||e[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(e[0].dims[1]!==e[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const i=e[1].dims[1]*r.group;if(e.length===3&&(e[2].dims.length!==1||e[2].dims[0]!==i))throw new Error("invalid bias");const s=e[0].dims.length-2;if(r.dilations.length!==s)throw new Error(`dilations should be ${s}D`);if(r.strides.length!==s)throw new Error(`strides should be ${s}D`);if(r.pads.length!==2*s)throw new Error(`pads should be ${2*s}D`);if(r.outputPadding.length!==s)throw new Error(`output_padding should be ${s}D`);if(r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape");if(r.outputShape.length!==0&&r.outputShape.length!==e[0].dims.length-2)throw new Error("invalid output shape");if(e[0].type!=="float32"||e[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(e.length===3&&e[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}},9754:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConvAttributes=c.conv=c.calculateOutputShape=void 0;const m=y(4910),p=y(7273),h=y(7825),d=y(7708),u=y(3281),l=y(2150),a=y(1625),o=y(8276);c.calculateOutputShape=(s,f,g,b,v)=>{const w=s[0],T=s.slice(2),x=T.length,A=f[0],D=f.slice(2).map((j,M)=>j+(j-1)*(g[M]-1)),k=T.map((j,M)=>j+b[M]+b[M+x]).map((j,M)=>Math.floor((j-D[M]+v[M])/v[M]));return[w,A].concat(...k)},c.conv=(s,f,g)=>(i(f,g),n(s,f,g));const n=(s,f,g)=>{const b=r(g,f),v=s.session.pack,w=b.kernelShape[0]===1&&b.kernelShape[1]===1;return b.group>1?[s.run((0,h.createUnpackedGroupedConvProgramInfoLoader)(s,f,b),f)]:w&&v?[t(s,f,b)]:v&&f[0].dims.length===4&&f[0].dims[0]===1&&!w?[(0,d.conv2DPacked)(s,f,b)]:[e(s,f,b)]},t=(s,f,g)=>{const b=f[0].dims,v=f[1].dims,w=(0,c.calculateOutputShape)(b,v,g.dilations,g.pads,g.strides),T=s.reshapeUnpacked(f[0],[b[1],b[2]*b[3]]),x=s.reshapeUnpacked(f[1],[v[0],v[1]]),A=f.length>2?[x,T,f[2]]:[x,T],D=s.run((0,o.createMatmulProgramInfoLoader)(A,g),A);return s.reshapeUnpacked(D,w)},e=(s,f,g)=>{const b=f[0].dims,v=f[1].dims,w=(0,c.calculateOutputShape)(b,v,g.dilations,g.pads,g.strides),T=s.run((0,a.createIm2ColProgramInfoLoader)(s,f[0],f[1],w,g),[f[0]]),x=f.length===3?[T,f[1],f[2]]:[T,f[1]];return s.run((0,u.createDotProductProgramInfoLoader)(s,f,w,g),x)},r=(s,f)=>{const g=s.kernelShape.slice();if(s.kernelShape.length===0)for(let w=2;w{const f=s.attributes,g=(0,l.parseInternalActivationAttributes)(f),b=f.getString("auto_pad","NOTSET"),v=f.getInts("dilations",[1,1]),w=f.getInt("group",1),T=f.getInts("kernel_shape",[]),x=f.getInts("pads",[0,0,0,0]),A=f.getInts("strides",[1,1]);return(0,m.createAttributeWithCacheKey)(Object.assign({autoPad:b,dilations:v,group:w,kernelShape:T,pads:x,strides:A},g))};const i=(s,f)=>{if(!s||s.length!==2&&s.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(s[0].dims.length!==4||s[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(s[0].dims[1]!==s[1].dims[1]*f.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(s.length===3&&(s[2].dims.length!==1||s[1].dims[0]!==s[2].dims[0]))throw new Error("invalid bias");const g=s[0].dims.length-2;if(f.dilations.length!==g)throw new Error(`dilations should be ${g}D`);if(f.strides.length!==g)throw new Error(`strides should be ${g}D`);if(f.pads.length!==2*g)throw new Error(`pads should be ${2*g}D`);if(f.kernelShape.length!==0&&f.kernelShape.length!==s[1].dims.length-2)throw new Error("invalid kernel shape");if(s[0].type!=="float32"||s[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(s.length===3&&s[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}},6742:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseDepthToSpaceAttributes=c.depthToSpace=void 0;const m=y(5707);c.depthToSpace=(h,d,u)=>{p(d);const l=u.blocksize,a=l*l,o=u.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],n=u.mode==="DCR"?[d[0].dims[0],l,l,d[0].dims[1]/a,d[0].dims[2],d[0].dims[3]]:[d[0].dims[0],d[0].dims[1]/a,l,l,d[0].dims[2],d[0].dims[3]],t=h.reshapeUnpacked(d[0],n),e={perm:o,cacheKey:`${o}`},[r]=(0,m.transpose)(h,[t],e),i=[d[0].dims[0],d[0].dims[1]/a,d[0].dims[2]*l,d[0].dims[3]*l];return[h.reshapeUnpacked(r,i)]},c.parseDepthToSpaceAttributes=h=>{const d=h.attributes.getInt("blocksize");if(d<1)throw new Error(`blocksize must be >= 1, but got : ${d} for DepthToSpace`);const u=h.attributes.getString("mode","DCR");if(u!=="DCR"&&u!=="CRD")throw new Error(`unrecognized mode: ${u} for DepthToSpace`);return{mode:u,blocksize:d}};const p=h=>{if(h.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${h.length}`);if(h[0].type==="string"||h[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},3281:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDotProductProgramInfoLoader=void 0;const m=y(7273),p=y(6757),h=y(5639),d=y(2150),u=y(1625);c.createDotProductProgramInfoLoader=(l,a,o,n)=>{const t=((e,r)=>({name:"ConvDotProduct",inputNames:e?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:e?[h.TextureType.unpacked,h.TextureType.packedLastDimension,h.TextureType.unpacked]:[h.TextureType.unpacked,h.TextureType.packedLastDimension],cacheKey:r.activationCacheKey}))(a.length>2,n);return Object.assign(Object.assign({},t),{get:()=>((e,r,i,s,f)=>{const g=i[0].dims,b=i[1].dims,v=[b[0],Math.ceil(g[1]*b[2]*b[3]/4)],w=(0,u.calculateIm2ColDims)(g,b,s),[T,x]=e.calculateTextureWidthAndHeight(v,h.TextureType.packedLastDimension),A=m.ShapeUtil.computeStrides(w),[D,k]=e.calculateTextureWidthAndHeight(w,h.TextureType.packedLastDimension),j=s.length,M=i.length<3?"0.0":"_B(b)",S=Math.ceil(g[1]*b[2]*b[3]/4),{activationFunction:U,applyActivation:O}=(0,d.getActivationSnippet)(f),E=(0,p.getGlsl)(e.session.backend.glContext.version),N=` +${U} +float process(int indices[${j}]) { + int b[1]; + b[0] = indices[1]; + int im2col[4]; + im2col[0] = indices[0]; + im2col[1] = indices[2]; + im2col[2] = indices[3]; + int im2colOffset = im2col[0] * ${A[0]} + im2col[1] * ${A[1]} + im2col[2] * ${A[2]}; + int kernelOffset = indices[1] * ${v[1]}; + float value = ${M}; + for (int i = 0; i < ${S}; ++i) { + vec2 im2colCoords = offsetToCoords(im2colOffset, ${D}, ${k}); + vec2 kernelCoords = offsetToCoords(kernelOffset, ${T}, ${x}); + value += dot(${E.texture2D}(Im2Col, im2colCoords), ${E.texture2D}(K, kernelCoords)); + ++im2colOffset; + ++kernelOffset; + } + ${O} + return value; +}`;return Object.assign(Object.assign({},r),{output:{dims:s,type:i[0].type,textureType:h.TextureType.unpacked},shaderSource:N})})(l,t,a,o,n)})}},4125:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseFlattenAttributes=c.flatten=void 0;const m=y(7273);c.flatten=(h,d,u)=>{p(d,u);const l=m.ShapeUtil.flattenShape(d[0].dims,u);return[h.reshapeUnpacked(d[0],l)]},c.parseFlattenAttributes=h=>h.attributes.getInt("axis",1);const p=(h,d)=>{if(!h||h.length!==1)throw new Error("Flatten requires 1 input.");const u=h[0].dims.length;if(u===0)throw new Error("scalar tensor is not supported.");if(d<-u||d>u)throw new Error("Invalid axis");if(h[0].type==="string")throw new Error("string tensor is not supported.")}},2150:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseInternalActivationAttributes=c.getActivationSnippet=void 0;const m=y(7273),p=y(9087);c.getActivationSnippet=function(h){let d;switch(h.activation){case"Relu":d=(0,p.glslRelu)();break;case"Sigmoid":d=(0,p.glslSigmoid)();break;case"Clip":d=(0,p.glslClip)(h.clipMin,h.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const u=d.name;return{activationFunction:d.body,applyActivation:`value = ${u}_(value);`}},c.parseInternalActivationAttributes=h=>{const d=h.getString("activation","");if(d==="Clip"){const[u,l]=h.getFloats("activation_params",[m.MIN_CLIP,m.MAX_CLIP]);return{activation:d,clipMax:l,clipMin:u,activationCacheKey:`${d}:${u},${l}`}}return{activation:d,activationCacheKey:d}}},6149:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseGatherAttributes=c.gather=void 0;const m=y(4910),p=y(6145),h=y(7273),d=y(5639);c.gather=(o,n,t)=>(a(n,t.axis),[o.run(l(o,n,t),n)]),c.parseGatherAttributes=o=>(0,m.createAttributeWithCacheKey)({axis:o.attributes.getInt("axis",0)});const u={name:"Gather",inputNames:["A","B"],inputTypes:[d.TextureType.unpacked,d.TextureType.unpacked]},l=(o,n,t)=>{const e=Object.assign(Object.assign({},u),{cacheHint:t.cacheKey});return Object.assign(Object.assign({},e),{get:()=>((r,i,s,f)=>{const g=s[0].dims.slice(),b=s[1].dims.slice(),v=new Array(g.length+b.length-1);f=h.ShapeUtil.normalizeAxis(f,g.length);const w=[];for(let x=0;x{if(!o||o.length!==2)throw new Error("Gather requires 2 inputs.");const t=o[0].dims.length;if(t<1)throw new Error("Invalid input shape.");if(n<-t||n>t-1)throw new Error("Invalid axis.");if(p.NUMBER_TYPES.indexOf(o[0].type)===-1)throw new Error("Invaid input type.");if(o[1].type!=="int32"&&o[1].type!=="int16")throw new Error("Invaid input type.")}},5378:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseGemmAttributesV11=c.parseGemmAttributesV7=c.gemm=void 0;const m=y(4910),p=y(7273),h=y(5639);c.gemm=(o,n,t)=>(a(n,t),[o.run(u(n,t),n)]);const d=(o,n)=>{const t=o.attributes.getInt("transA",0)!==0,e=o.attributes.getInt("transB",0)!==0,r=o.attributes.getFloat("alpha",1),i=o.attributes.getFloat("beta",1);return(0,m.createAttributeWithCacheKey)({transA:t,transB:e,alpha:r,beta:i,isOptionalC:n})};c.parseGemmAttributesV7=o=>d(o,!1),c.parseGemmAttributesV11=o=>d(o,!0);const u=(o,n)=>{const t={name:"Gemm",inputNames:o.length===3?["A","B","C"]:["A","B"],inputTypes:o.length===3?[h.TextureType.unpacked,h.TextureType.unpacked,h.TextureType.unpacked]:[h.TextureType.unpacked,h.TextureType.unpacked],key:n.cacheKey};return Object.assign(Object.assign({},t),{get:()=>l(t,o,n)})},l=(o,n,t)=>{const e=n[0].dims.slice(),r=n[1].dims.slice(),[i,s]=p.GemmUtil.getShapeOfGemmResult(e,t.transA,r,t.transB,n.length===3?n[2].dims:void 0),f=[i,s];if(!f)throw new Error("Can't use gemm on the given tensors");let g=e[e.length-1],b="";t.transA&&(g=e[0]),t.transA&&t.transB?b="value += _A_T(a) * _B_T(b);":t.transA&&!t.transB?b="value += _A_T(a) * _B(b);":!t.transA&&t.transB?b="value += _A(a) * _B_T(b);":t.transA||t.transB||(b="value += _A(a) * _B(b);");const v=f.length,w=` + float process(int indices[${v}]) { + int a[${v}]; + int b[${v}]; + ${n.length===3?`int c[${n[2].dims.length}];`:""} + + copyVec(indices, a); + copyVec(indices, b); + ${n.length===3?"bcastIndices_C(indices, c);":""} + + float value = 0.0; + for (int k=0; k<${g}; ++k) { + a[${v-1}] = k; + b[${v-2}] = k; + ${b} + } + + value = value * alpha; + ${n.length===3?"value += beta * _C(c);":""} + return value; + }`;return Object.assign(Object.assign({},o),{output:{dims:f,type:n[0].type,textureType:h.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:t.alpha},{name:"beta",type:"float",data:t.beta}],shaderSource:w})},a=(o,n)=>{if(!o)throw new Error("Input is missing");if(n.isOptionalC&&(o.length<2||o.length>3))throw new Error("Invaid input shape.");if(!n.isOptionalC&&o.length!==3)throw new Error("Gemm requires 3 inputs");if(o.length===3&&o[2].dims.length!==1&&o[2].dims.length!==2)throw new Error("Invalid input shape of C");if(o[0].type!=="float32"&&o[0].type!=="float64"||o[1].type!=="float32"&&o[1].type!=="float64"||o.length===3&&o[2].type!=="float32"&&o[2].type!=="float64")throw new Error("Invalid input type.");if(o[0].type!==o[1].type||o.length===3&&o[0].type!==o[2].type)throw new Error("Input types are mismatched")}},5950:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedIm2ColProgramInfoLoader=void 0;const m=y(6757),p=y(5639),h=y(5614);c.createPackedIm2ColProgramInfoLoader=(d,u,l,a,o)=>{const n=(t=o.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[p.TextureType.packed],cacheHint:t});var t;return Object.assign(Object.assign({},n),{get:()=>((e,r,i,s,f,g)=>{const b=i.dims,v=s.dims,w=f.length,T=[v[1]*v[2]*v[3],f[2]*f[3]],x=v[2]*v[3],A=(0,h.unpackFromChannel)(),D=(0,m.getGlsl)(e.session.backend.glContext.version);let k="";for(let M=0;M<=1;M++)for(let S=0;S<=1;S++)k+=` + blockIndex = rc.x + ${S}; + pos = rc.y + ${M}; + + if(blockIndex < ${T[1]} && pos < ${T[0]}) { + offsetY = int(blockIndex / (${f[w-1]})) * ${g.strides[0]} - + ${g.pads[0]}; + d0 = offsetY + ${g.dilations[0]} * (imod(pos, ${x}) / ${v[2]}); + + if(d0 < ${b[2]} && d0 >= 0) { + offsetX = imod(blockIndex, ${f[w-1]}) * ${g.strides[1]} - + ${g.pads[1]}; + d1 = offsetX + ${g.dilations[1]} * imod(imod(pos, ${x}), ${v[2]}); + + if(d1 < ${b[3]} && d1 >= 0) { + + ch = int(float(pos)/ ${x}.); + innerDims = vec2(d0, d1); + result[${2*M+S}] = getChannel( + getA(0, ch, int(innerDims.x), + int(innerDims.y)), innerDims); + } + } + } + + `;const j=` + ${A} + + void main() { + ivec2 rc = getOutputCoords(); + vec4 result = vec4(0.0); + int blockIndex, pos, offsetY, d0, offsetX, d1, ch; + vec2 innerDims; + ${k} + ${D.output} = result; + } + `;return Object.assign(Object.assign({},r),{output:{dims:T,type:i.type,textureType:p.TextureType.packed},shaderSource:j,hasMain:!0})})(d,n,u,l,a,o)})}},1625:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.calculateIm2ColDims=c.createIm2ColProgramInfoLoader=void 0;const m=y(5639);c.createIm2ColProgramInfoLoader=(p,h,d,u,l)=>{const a=(o=l.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[m.TextureType.unpacked],cacheHint:o});var o;return Object.assign(Object.assign({},a),{get:()=>((n,t,e,r,i,s)=>{const f=e.dims,g=r.dims,b=i.length,v=(0,c.calculateIm2ColDims)(f,g,i,4),w=` + const int XC = ${f[1]}; + const int XH = ${f[2]}; + const int XW = ${f[3]}; + const int KH = ${s.kernelShape[0]}; + const int KW = ${s.kernelShape[1]}; + const int dilationH = ${s.dilations[0]}; + const int dilationW = ${s.dilations[1]}; + const int strideH = ${s.strides[0]}; + const int strideW = ${s.strides[1]}; + const int padH = ${s.pads[0]}; + const int padW = ${s.pads[1]}; + const int KHKW = KH*KW; + const int XCKHKW = XC * KHKW; + const int outputChannels = 4; + vec4 process(int indices[${b}]) { + int b = indices[0]; // batch size + int oh = indices[1] * strideH - padH; //output height + int ow = indices[2] * strideW - padW; //output width + int p = indices[3] * outputChannels; //patch + vec4 value = vec4(0.0); + for(int i=0; i < outputChannels; ++i) { + if(p < XCKHKW) { + int patchC = p / KHKW; + int patchH = (p - patchC*KHKW) / KW; + int patchW = (p - patchC*KHKW) - patchH * KW; + int xh2 = oh + patchH * dilationH; + int xw2 = ow + patchW * dilationW; + int x[${f.length}]; + x[0] = b; + x[1] = patchC; + x[2] = xh2; + x[3] = xw2; + if(xh2 >= 0 && + xh2 < XH && + xw2 >= 0 && + xw2 < XW) { + value[i] = _X(x); + } + } + ++p; + } + return value; + } + `;return Object.assign(Object.assign({},t),{output:{dims:v,type:e.type,textureType:m.TextureType.packedLastDimension},shaderSource:w})})(0,a,h,d,u,l)})},c.calculateIm2ColDims=(p,h,d,u=4)=>[d[0],d[2],d[3],Math.ceil(p[1]*h[2]*h[3]/u)]},6981:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseImageScalerAttributes=c.imageScaler=void 0;const m=y(4910),p=y(5639);c.imageScaler=(a,o,n)=>(l(o),[a.run(d(a,o,n),o)]),c.parseImageScalerAttributes=a=>{const o=a.attributes.getFloat("scale"),n=a.attributes.getFloats("bias");return(0,m.createAttributeWithCacheKey)({scale:o,bias:n})};const h={name:"ImageScaler",inputNames:["X"],inputTypes:[p.TextureType.unpacked]},d=(a,o,n)=>{const t=Object.assign(Object.assign({},h),{cacheHint:n.cacheKey});return Object.assign(Object.assign({},t),{get:()=>((e,r,i,s)=>{const f=i[0].dims.slice(),g=f.length,b=` + ${u(s.bias.length)} + float process(int indices[${g}]) { + return _X(indices) * scale + getBias(bias, indices[1]); + }`;return Object.assign(Object.assign({},r),{output:{dims:f,type:i[0].type,textureType:p.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:s.bias.length,data:s.bias},{name:"scale",type:"float",data:s.scale}],shaderSource:b})})(0,t,o,n)})},u=a=>{const o=[`float getBias(float bias[${a}], int channel) {`];for(let n=0;n{if(!a||a.length!==1)throw new Error("ImageScaler requires 1 input.");if(a[0].dims.length!==4)throw new Error("Invalid input shape.");if(a[0].type!=="float32"&&a[0].type!=="float64")throw new Error("Invalid input type.")}},7413:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseInstanceNormalizationAttributes=c.instanceNormalization=void 0;const m=y(6757),p=y(5639);c.instanceNormalization=(o,n,t)=>{a(n);const e=o.run(d(n[0]),n);return[o.run(l(o,n[0],t,e.dims),[n[0],e,n[1],n[2]])]},c.parseInstanceNormalizationAttributes=o=>o.attributes.getFloat("epsilon",1e-5);const h={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[p.TextureType.unpacked]},d=o=>Object.assign(Object.assign({},h),{get:()=>((n,t)=>{const e=t.dims.slice(),r=e[1],i=e[2]*e[3],s=[e[0],r],f=` + vec4 process(int[2] indices) { + vec4 v = vec4(0.0); + int a[4]; + a[0] = indices[0]; + a[1] = indices[1]; + float temp = 0.0; + for(int a2=0; a2<${e[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${e[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += x; + } + } + float mean = temp / float(${i}); + temp = 0.0; + for(int a2=0; a2<${e[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${e[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += (x - mean) * (x - mean); + } + } + v.r = mean; + v.g = temp / float(${i}); + + return v; + }`;return Object.assign(Object.assign({},n),{output:{dims:s,type:t.type,textureType:p.TextureType.packedLastDimension},shaderSource:f})})(h,o)}),u={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[p.TextureType.unpacked,p.TextureType.packedLastDimension,p.TextureType.unpacked,p.TextureType.unpacked]},l=(o,n,t,e)=>{const r=Object.assign(Object.assign({},u),{cacheHint:`${t}`});return Object.assign(Object.assign({},r),{get:()=>((i,s,f,g,b)=>{const v=(0,m.getGlsl)(i.session.backend.glContext.version),[w,T]=i.calculateTextureWidthAndHeight(b,p.TextureType.packedLastDimension),[x,A]=[w/4,T],D=` + vec4 get_MeanAndVariance(int[2] mv) { + int offset = indicesToOffset_MeanAndVariance(mv); + vec2 coords = offsetToCoords(offset, ${x}, ${A}); + return ${v.texture2D}(MeanAndVariance, coords); + } + + float process(int[4] indices) { + int mv[2]; + mv[0] = indices[0]; + mv[1] = indices[1]; + vec4 mean_and_variance = get_MeanAndVariance(mv); + float mean = mean_and_variance.r; + float variance = mean_and_variance.g; + + int sb[1]; + sb[0] = indices[1]; + float scale = _Scale(sb); + float b = _B(sb); + + return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; + }`;return Object.assign(Object.assign({},s),{output:{dims:f.dims,type:f.type,textureType:p.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:g}],shaderSource:D})})(o,r,n,t,e)})},a=o=>{if(!o||o.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");const n=o[0],t=o[1],e=o[2];if(n.dims.length<3||t.dims.length!==1||e.dims.length!==1)throw new Error("Invalid input shape.");if(t.dims[0]!==n.dims[1]||e.dims[0]!==n.dims[1])throw new Error("Input shapes are mismatched.");if(n.type!=="float32"&&n.type!=="float64"||t.type!=="float32"&&t.type!=="float64"||e.type!=="float32"&&e.type!=="float64")throw new Error("Invalid input type.");if(o[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}},7006:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createLrnProgramInfoLoader=c.parseLrnAttributes=c.lrn=void 0;const m=y(4910),p=y(5639);c.lrn=(l,a,o)=>(u(a),[l.run(d(a,o),a)]),c.parseLrnAttributes=l=>{const a=l.attributes.getFloat("alpha",1e-4),o=l.attributes.getFloat("beta",.75),n=l.attributes.getFloat("bias",1),t=l.attributes.getInt("size");return(0,m.createAttributeWithCacheKey)({alpha:a,beta:o,bias:n,size:t})};const h={name:"LRN",inputNames:["X"],inputTypes:[p.TextureType.unpacked]};function d(l,a){return Object.assign(Object.assign({},h),{cacheHint:a.cacheKey,get:()=>function(o,n){const t=o[0].dims[1],e=o[0].dims.length,r=-Math.floor((n.size-1)/2),i=Math.ceil((n.size-1)/2),s=`float(${n.alpha}) / float(${n.size})`,f=` + float process(int indices[${e}]) { + int c = indices[1]; + float x = _X(indices); + float square_sum = 0.0; + + for (int i = ${r}; i <= ${i}; i++) { + int idx = c + i; + if (c >= 0 && c < ${t}) { + indices[1] = idx; + float j = _X(indices); + square_sum += j * j; + } + } + return x / pow(float(${n.bias}) + ${s} * square_sum, float(${n.beta})); + }`;return Object.assign(Object.assign({},h),{cacheHint:n.cacheKey,output:{dims:o[0].dims,type:o[0].type,textureType:p.TextureType.unpacked},shaderSource:f})}(l,a)})}c.createLrnProgramInfoLoader=d;const u=l=>{if(!l||l.length!==1)throw new Error("LRN requires 1 input.");if(l[0].dims.length!==4)throw new Error('currently only support LRN for input with "NCHW" format');if(l[0].type!=="float32")throw new Error("input should be float type")}},5632:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedMatmulProgramInfoLoader=void 0;const m=y(7273),p=y(6757),h=y(5639),d=y(432),u=y(2150),l=y(8276);c.createPackedMatmulProgramInfoLoader=(a,o,n)=>{const t=(e=o.length>2,r=n.activationCacheKey,{name:"MatMul (packed)",inputNames:e?["A","B","Bias"]:["A","B"],inputTypes:e?[h.TextureType.packed,h.TextureType.packed,h.TextureType.packed]:[h.TextureType.packed,h.TextureType.packed],cacheHint:r});var e,r;return Object.assign(Object.assign({},t),{get:()=>((i,s,f,g)=>{const b=f.length>2,v=b?"value += getBiasForMatmul();":"",w=f[0].dims,T=f[1].dims,x=m.BroadcastUtil.calcShape(w,T,!0),A=!m.ShapeUtil.areEqual(f[0].dims,f[1].dims);if(!x)throw new Error("Can't use matmul on the given tensors");const D=w[w.length-1],k=Math.ceil(D/2),j=w.length,M=T.length,S=(0,p.getGlsl)(i.session.backend.glContext.version),U=(0,d.getCoordsDataType)(x.length),O=x.length,E=(0,d.getGlChannels)(),{activationFunction:N,applyActivation:q}=(0,u.getActivationSnippet)(g),H=b?`${(0,l.getBiasForMatmul)(U,E,f[2].dims,x,!0)}`:"",K=A?`${function(nt,rt,it,ut){let gt=[],xt=[];const kt=it[0].dims,mt=it[1].dims,Dt=kt.length,lt=mt.length,bt=ut.length,St=bt-Dt,_t=bt-lt;gt=kt.map((Ot,Ft)=>`coords.${rt[Ft+St]}`),gt[Dt-1]="i*2",gt.join(", "),xt=mt.map((Ot,Ft)=>`coords.${rt[Ft+_t]}`),xt[lt-2]="i*2",xt.join(", ");const At=m.BroadcastUtil.getBroadcastDims(kt,ut),Et=m.BroadcastUtil.getBroadcastDims(mt,ut),Pt=At.map(Ot=>`coords.${rt[Ot+St]} = 0;`).join(` +`),Rt=Et.map(Ot=>`coords.${rt[Ot+_t]} = 0;`).join(` +`),Ct=`int lastDim = coords.${rt[bt-1]}; + coords.${rt[bt-1]} = coords.${rt[bt-2]}; + coords.${rt[bt-2]} = lastDim;`;return` +vec4 getAAtOutCoordsMatmul(int i) { + ${nt} coords = getOutputCoords(); + ${Ct} + ${Pt} + vec4 outputValue = getA(${gt}); + return outputValue; +} + +vec4 getBAtOutCoordsMatmul(int i) { + ${nt} coords = getOutputCoords(); + ${Ct} + ${Rt} + vec4 outputValue = getB(${xt}); + return outputValue; +}`}(U,E,f,x)}`:"",X=A?"getAAtOutCoordsMatmul(i)":`getA(${function(nt,rt){let it="";for(let ut=0;ut{Object.defineProperty(c,"__esModule",{value:!0}),c.getBiasForMatmul=c.createMatmulProgramInfoLoader=c.parseMatMulAttributes=c.matMul=void 0;const m=y(7273),p=y(5639),h=y(432),d=y(2150),u=y(5632);c.matMul=(t,e,r)=>(o(e),t.session.pack?[t.run((0,u.createPackedMatmulProgramInfoLoader)(t,e,r),e)]:[t.run(a(e,r),e)]),c.parseMatMulAttributes=t=>(0,d.parseInternalActivationAttributes)(t.attributes);const l=(t,e)=>({name:"MatMul",inputNames:t?["A","B","Bias"]:["A","B"],inputTypes:t?[p.TextureType.unpacked,p.TextureType.unpacked,p.TextureType.unpacked]:[p.TextureType.unpacked,p.TextureType.unpacked],cacheHint:e});function a(t,e){const r=l(t.length>2,e.activationCacheKey);return Object.assign(Object.assign({},r),{get:()=>function(i,s,f){const g=s[0].dims,b=s[1].dims,v=m.BroadcastUtil.calcShape(g,b,!0);if(!v)throw new Error("Can't use matmul on the given tensors");const w=(0,h.getCoordsDataType)(v.length),T=(0,h.getGlChannels)(),{activationFunction:x,applyActivation:A}=(0,d.getActivationSnippet)(f),D=s.length>2,k=D?"value += getBiasForMatmul();":"",j=D?`${n(w,T,s[2].dims,v,!1)}`:"",M=v.length,S=g.length,U=b.length,O=` + ${x} + ${j} + float process(int indices[${M}]) { + int a[${S}]; + int b[${U}]; + bcastMatmulIndices_A(indices, a); + bcastMatmulIndices_B(indices, b); + + float value; + for (int k=0; k<${g[g.length-1]}; ++k) { + a[${S-1}] = k; + b[${U-2}] = k; + value += _A(a) * _B(b); + } + ${k} + ${A} + return value; + }`;return Object.assign(Object.assign({},i),{output:{dims:v,type:s[0].type,textureType:p.TextureType.unpacked},shaderSource:O})}(r,t,e)})}c.createMatmulProgramInfoLoader=a;const o=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 n(t,e,r,i,s){let f="";const g=r.length,b=i.length,v=b-g;f=b<2&&g>0?"coords":r.map((x,A)=>`coords.${e[A+v]}`).join(", ");const w=m.BroadcastUtil.getBroadcastDims(r,i).map(x=>`coords.${e[x+v]} = 0;`).join(` +`);let T="vec4(outputValue.xx, outputValue.yy)";return m.ShapeUtil.size(r)===1&&(T="vec4(outputValue.x)"),s?` +vec4 getBiasForMatmul() { + ${t} coords = getOutputCoords(); + ${w} + vec4 outputValue = getBias(${f}); + return ${T}; +}`:` +float getBiasForMatmul() { + ${t} coords = getOutputCoords(); + ${w} + return getBias(coords.x); +}`}c.getBiasForMatmul=n},9:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackProgramInfoLoader=void 0;const m=y(6757),p=y(5639),h=y(432),d=y(5614),u={name:"pack",inputNames:["A"],inputTypes:[p.TextureType.unpackedReversed]};c.createPackProgramInfoLoader=(l,a)=>Object.assign(Object.assign({},u),{get:()=>((o,n)=>{const t=(0,m.getGlsl)(o.session.backend.glContext.version),e=n.dims,r=e.length,i=n.dims.length,s=(0,h.getCoordsDataType)(i),f=(0,d.getChannels)("rc",i),g=(b=i,v=f,w=e[e.length-2],T=e[e.length-1],b===0||b===1?"":` + int r = ${v[b-2]}; + int c = ${v[b-1]}; + int rp1 = ${v[b-2]} + 1; + int cp1 = ${v[b-1]} + 1; + bool rEdge = rp1 >= ${T}; + bool cEdge = cp1 >= ${w}; + `);var b,v,w,T;let x;x=r===0?[1,1]:r===1?[e[0],1]:[e[i-1],e[i-2]];const A=function(j,M,S){if(j===0)return"false";if(j===1)return`rc > ${M[0]}`;let U="";for(let O=j-2;O= ${M[O-j+2]}`,O= ${j[0]} ? 0. : getA(rc + 1), + 0, 0`;let U="";if(S>2)for(let O=0;O{Object.defineProperty(c,"__esModule",{value:!0}),c.unpackFromChannel=c.getChannels=c.getVecChannels=void 0;const m=y(432);function p(h,d){return(0,m.getGlChannels)(d).map(u=>`${h}.${u}`)}c.getVecChannels=p,c.getChannels=function(h,d){return d===1?[h]:p(h,d)},c.unpackFromChannel=function(){return` + float getChannel(vec4 frag, int dim) { + int modCoord = imod(dim, 2); + return modCoord == 0 ? frag.r : frag.g; + } + + float getChannel(vec4 frag, vec2 innerDims) { + vec2 modCoord = mod(innerDims, 2.); + return modCoord.x == 0. ? + (modCoord.y == 0. ? frag.r : frag.g) : + (modCoord.y == 0. ? frag.b : frag.a); + } + `}},5565:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parsePadAttributesV11=c.padV11=c.parsePadAttributesV2=c.padV2=void 0;const m=y(4910),p=y(7273),h=y(6757),d=y(5639),u={name:"Pad",inputNames:["A"],inputTypes:[d.TextureType.unpacked]};c.padV2=(s,f,g)=>(o(f),[s.run(Object.assign(Object.assign({},u),{cacheHint:g.cacheKey,get:()=>a(s,f[0],g)}),f)]),c.parsePadAttributesV2=s=>{const f=s.attributes.getString("mode","constant"),g=s.attributes.getFloat("value",0),b=s.attributes.getInts("pads");return(0,m.createAttributeWithCacheKey)({mode:f,value:g,pads:b})},c.padV11=(s,f,g)=>{n(f);const b=l(s,f,g);return(0,c.padV2)(s,[f[0]],b)},c.parsePadAttributesV11=s=>s.attributes.getString("mode","constant");const l=(s,f,g)=>{if(!s.session.isInitializer(f[1].dataId)||f.length>=3&&!s.session.isInitializer(f[2].dataId))throw new Error("dynamic pad attributes are not allowed");const b=Array.from(f[1].integerData),v=f.length>=3?f[2].floatData[0]:0;return(0,m.createAttributeWithCacheKey)({mode:g,pads:b,value:v})},a=(s,f,g)=>{const b=p.ShapeUtil.padShape(f.dims.slice(),g.pads),v=b.length,w=` + ${t(s,f,g)} + float process(int[${v}] indices) { + return padA(indices); + }`;return{name:"Pad",inputNames:["A"],inputTypes:[d.TextureType.unpacked],output:{dims:b,type:f.type,textureType:d.TextureType.unpacked},shaderSource:w}},o=s=>{if(!s||s.length!==1)throw new Error("Pad requires 1 input");if(s[0].type!=="float32"&&s[0].type!=="float64")throw new Error("Invalid input type.")},n=s=>{if(!s||s.length!==2&&s.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(s[1].type!=="int32")throw new Error("Invalid input type.");if(s.length>=3&&s[2].type==="string")throw new Error("Invalid input type.")},t=(s,f,g)=>{const b=(0,h.getGlsl)(s.session.backend.glContext.version),[v,w]=s.calculateTextureWidthAndHeight(f.dims,d.TextureType.unpacked),T=p.ShapeUtil.computeStrides(f.dims);switch(g.mode){case"constant":return e(b,f.dims,T,v,w,g.pads,g.value);case"reflect":return r(b,f.dims,T,v,w,g.pads);case"edge":return i(b,f.dims,T,v,w,g.pads);default:throw new Error("Invalid mode")}},e=(s,f,g,b,v,w,T)=>{const x=f.length;let A="";for(let D=x-1;D>=0;--D)A+=` + k = m[${D}] - ${w[D]}; + if (k < 0) return constant; + if (k >= ${f[D]}) return constant; + offset += k * ${g[D]}; + `;return` + float padA(int m[${x}]) { + const float constant = float(${T}); + int offset = 0; + int k = 0; + ${A} + vec2 coords = offsetToCoords(offset, ${b}, ${v}); + float value = getColorAsFloat(${s.texture2D}(A, coords)); + return value; + } + `},r=(s,f,g,b,v,w)=>{const T=f.length;let x="";for(let A=T-1;A>=0;--A)x+=` + k = m[${A}] - ${w[A]}; + if (k < 0) { k = -k; } + { + const int _2n_1 = ${2*(f[A]-1)}; + k = int( mod( float(k), float(_2n_1) ) ) ; + if(k >= ${f[A]}) { k = _2n_1 - k; } + } + offset += k * ${g[A]}; + `;return` + float padA(int m[${T}]) { + int offset = 0; + int k = 0; + ${x} + vec2 coords = offsetToCoords(offset, ${b}, ${v}); + float value = getColorAsFloat(${s.texture2D}(A, coords)); + return value; + } + `},i=(s,f,g,b,v,w)=>{const T=f.length;let x="";for(let A=T-1;A>=0;--A)x+=` + k = m[${A}] - ${w[A]}; + if (k < 0) k = 0; + if (k >= ${f[A]}) k = ${f[A]-1}; + offset += k * ${g[A]}; + `;return` + float padA(int m[${T}]) { + int offset = 0; + int k = 0; + ${x} + vec2 coords = offsetToCoords(offset, ${b}, ${v}); + float value = getColorAsFloat(${s.texture2D}(A, coords)); + return value; + } + `}},2834:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.globalMaxPool=c.parseMaxPoolAttributes=c.maxPool=c.parseGlobalAveragePoolAttributes=c.globalAveragePool=c.parseAveragePoolAttributes=c.averagePool=void 0;const m=y(4910),p=y(7273),h=y(5639);c.averagePool=(i,s,f)=>{n(s);const g={name:"AveragePool",inputNames:["X"],inputTypes:[h.TextureType.unpacked],cacheHint:f.cacheKey};return[i.run(Object.assign(Object.assign({},g),{get:()=>d(s,g,!1,f)}),s)]},c.parseAveragePoolAttributes=i=>{const s=i.attributes.getString("auto_pad","NOTSET"),f=i.attributes.getInt("ceil_mode",0),g=i.attributes.getInt("count_include_pad",0)!==0,b=i.attributes.getInts("kernel_shape"),v=i.attributes.getInts("strides",[]),w=i.attributes.getInts("pads",[]);if(f!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,m.createAttributeWithCacheKey)({autoPad:s,ceilMode:f,countIncludePad:g,kernelShape:b,strides:v,pads:w})};const d=(i,s,f,g)=>{const[b,v]=l(i,g,f),w=p.ShapeUtil.size(b.kernelShape);let T="";b.countIncludePad?T+=`value /= float(${w});`:T+=`value /= float(${w} - pad);`;const x=` + ${t(i[0].dims,b,"value += _X(x);",T,"0.0")} + `;return Object.assign(Object.assign({},s),{output:{dims:v,type:i[0].type,textureType:h.TextureType.unpacked},shaderSource:x})};c.globalAveragePool=(i,s,f)=>{n(s);const g={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[h.TextureType.unpacked],cacheHint:`${f.countIncludePad}`};return[i.run(Object.assign(Object.assign({},g),{get:()=>d(s,g,!0,f)}),s)]},c.parseGlobalAveragePoolAttributes=i=>{const s=i.attributes.getInt("count_include_pad",0)!==0;return(0,m.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:s,kernelShape:[],strides:[],pads:[]})},c.maxPool=(i,s,f)=>{n(s);const g={name:"MaxPool",inputNames:["X"],inputTypes:[h.TextureType.unpacked],cacheHint:f.cacheKey};return[i.run(Object.assign(Object.assign({},g),{get:()=>u(s,g,!1,f)}),s)]},c.parseMaxPoolAttributes=i=>{const s=i.attributes.getString("auto_pad","NOTSET"),f=i.attributes.getInt("ceil_mode",0),g=i.attributes.getInts("kernel_shape"),b=i.attributes.getInts("strides",[]),v=i.attributes.getInts("pads",[]),w=i.attributes.getInt("storage_order",0),T=i.attributes.getInts("dilations",[]);if(w!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(f!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,m.createAttributeWithCacheKey)({autoPad:s,ceilMode:f,countIncludePad:!1,kernelShape:g,strides:b,pads:v,storageOrder:w,dilations:T})};const u=(i,s,f,g)=>{const[b,v]=l(i,g,f),w=` + ${t(i[0].dims,b,` + value = max(_X(x), value); + `,"","-1e5")} + `;return Object.assign(Object.assign({},s),{output:{dims:v,type:i[0].type,textureType:h.TextureType.unpacked},shaderSource:w})},l=(i,s,f)=>{const g=i[0].dims.slice(),b=Object.hasOwnProperty.call(s,"dilations"),v=s.kernelShape.slice(),w=s.strides.slice(),T=b?s.dilations.slice():[],x=s.pads.slice();p.PoolConvUtil.adjustPoolAttributes(f,g,v,w,T,x);const A=p.PoolConvUtil.computePoolOutputShape(f,g,w,T,v,x,s.autoPad),D=Object.assign({},s);return b?Object.assign(D,{kernelShape:v,strides:w,pads:x,dilations:T,cacheKey:s.cacheKey}):Object.assign(D,{kernelShape:v,strides:w,pads:x,cacheKey:s.cacheKey}),[D,A]},a={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},o={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[h.TextureType.unpacked]};c.globalMaxPool=(i,s)=>(n(s),[i.run(Object.assign(Object.assign({},o),{get:()=>u(s,o,!0,a)}),s)]);const n=i=>{if(!i||i.length!==1)throw new Error("Pool ops requires 1 input.");if(i[0].type!=="float32"&&i[0].type!=="float64")throw new Error("Invalid input type.")},t=(i,s,f,g,b)=>{const v=i.length;if(s.kernelShape.length<=2){const w=s.kernelShape[s.kernelShape.length-1],T=s.strides[s.strides.length-1],x=s.pads[s.pads.length/2-1],A=s.pads[s.pads.length-1],D=i[v-1];let k="",j="",M="";if(k=x+A!==0?` + for (int i = 0; i < ${w}; i++) { + x[${v} - 1] = indices[${v} - 1] * ${T} - ${x} + i; + if (x[${v} - 1] < 0 || x[${v} - 1] >= ${D}) { + pad++; + continue; + } + ${f} + }`:` + for (int i = 0; i < ${w}; i++) { + x[${v} - 1] = indices[${v} - 1] * ${T} - ${x} + i; + ${f} + }`,s.kernelShape.length===2){const S=s.kernelShape[s.kernelShape.length-2],U=s.strides[s.strides.length-2],O=s.pads[s.pads.length/2-2],E=s.pads[s.pads.length-2],N=i[v-2];j=O+E!==0?` + for (int j = 0; j < ${S}; j++) { + x[${v} - 2] = indices[${v} - 2] * ${U} - ${O} + j; + if (x[${v} - 2] < 0 || x[${v} - 2] >= ${N}) { + pad+= ${w}; + continue; + } + `:` + for (int j = 0; j < ${S}; j++) { + x[${v} - 2] = indices[${v} - 2] * ${U} - ${O} + j; + `,M=` + } + `}return` + float process(int indices[${v}]) { + int x[${v}]; + copyVec(indices, x); + + float value = ${b}; + int pad = 0; + ${j} + ${k} + ${M} + ${g} + return value; + } + `}{const w=p.ShapeUtil.size(s.kernelShape),T=p.ShapeUtil.computeStrides(s.kernelShape),x=T.length,A=s.pads.length,D=r(x),k=e(i,"inputDims"),j=e(s.pads,"pads"),M=e(T,"kernelStrides"),S=e(s.strides,"strides");let U="";return U=s.pads.reduce((O,E)=>O+E)?` + if (x[j] >= inputDims[j] || x[j] < 0) { + pad++; + isPad = true; + break; + } + } + if (!isPad) { + ${f} + }`:` + } + ${f} + `,` + ${D} + float process(int indices[${v}]) { + int x[${v}]; + copyVec(indices, x); + int offset[${x}]; + int pads[${A}]; + int inputDims[${v}]; + int kernelStrides[${x}]; + int strides[${x}]; + ${j} + ${k} + ${S} + ${M} + + float value = ${b}; + int pad = 0; + bool isPad = false; + for (int i = 0; i < ${w}; i++) { + offsetToIndices(i, kernelStrides, offset); + isPad = false; + for (int j = ${v} - ${x}; j < ${v}; j++) { + x[j] = indices[j] * strides[j - ${v} + ${x}] + + offset[j - ${v} + ${x}] - pads[j - 2]; + ${U} + } + ${g} + + return value; + } + `}},e=(i,s)=>{let f="";for(let g=0;g` + void offsetToIndices(int offset, int[${i}] strides, out int[${i}] indices) { + if (${i} == 0) { + return; + } + for (int i = 0; i < ${i} - 1; ++i) { + indices[i] = offset / strides[i]; + offset -= indices[i] * strides[i]; + } + indices[${i} - 1] = offset; + }`},1010:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.reduceLogSumSquare=c.reduceLogSum=c.reduceProd=c.reduceMin=c.reduceMax=c.reduceMean=c.reduceSum=c.parseReduceAttributes=void 0;const m=y(4910),p=y(6145),h=y(7273),d=y(5639),u=(o,n,t,e,r)=>{a(n);const i={name:e,inputNames:["A"],inputTypes:[d.TextureType.unpacked]};return[o.run(Object.assign(Object.assign({},i),{cacheHint:t.cacheKey,get:()=>l(o,n,t,e,r,i)}),n)]};c.parseReduceAttributes=o=>{const n=o.attributes.getInts("axes",[]),t=o.attributes.getInt("keepdims",1)===1;return(0,m.createAttributeWithCacheKey)({axes:n,keepDims:t})};const l=(o,n,t,e,r,i)=>{const s=[],f=n[0].dims.length||1,g=[],b=h.ShapeUtil.normalizeAxes(t.axes,n[0].dims.length),v=r(n,b);let w=v[1];for(let x=0;x=0||b.length===0?(t.keepDims&&s.push(1),w=` + for(int j${x} = 0; j${x} < ${n[0].dims[x]}; j${x}++) { + inputIdx[${x}] = j${x}; + ${w} + }`):(g.push(`inputIdx[${x}] = outputIdx[${s.length}];`),s.push(n[0].dims[x]));const T=` + float process(int outputIdx[${s.length||1}]) { + float value; // final result + int inputIdx[${f}]; // addressing input data + ${g.join(` +`)} + ${v[0]} // init ops for reduce max/min + ${w} + ${v[2]} // final computation for reduce mean + return value; + }`;return Object.assign(Object.assign({},i),{output:{dims:s,type:n[0].type,textureType:d.TextureType.unpacked},shaderSource:T})},a=o=>{if(!o||o.length!==1)throw new Error("Reduce op requires 1 input.");if(p.NUMBER_TYPES.indexOf(o[0].type)===-1)throw new Error("Invalid input type.")};c.reduceSum=(o,n,t)=>u(o,n,t,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),c.reduceMean=(o,n,t)=>u(o,n,t,"ReduceMean",(e,r)=>{let i=1;for(let s=0;s=0||r.length===0)&&(i*=e[0].dims[s]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${i}.;`]}),c.reduceMax=(o,n,t)=>u(o,n,t,"ReduceMax",(e,r)=>{const i=[];for(let s=0;s=0||r.length===0)&&i.push(`inputIdx[${s}] = 0;`);return[`${i.join(` +`)} +value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),c.reduceMin=(o,n,t)=>u(o,n,t,"ReduceMin",(e,r)=>{const i=[];for(let s=0;s=0||r.length===0)&&i.push(`inputIdx[${s}] = 0;`);return[`${i.join(` +`)} +value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),c.reduceProd=(o,n,t)=>u(o,n,t,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),c.reduceLogSum=(o,n,t)=>u(o,n,t,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),c.reduceLogSumSquare=(o,n,t)=>u(o,n,t,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7379:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isReshapeCheap=c.processDims3D=c.createPackedReshape3DProgramInfoLoader=void 0;const m=y(7273),p=y(6757),h=y(5639),d=y(5614);c.createPackedReshape3DProgramInfoLoader=(u,l,a)=>{const o=(n=>({name:"Reshape (packed)",inputTypes:[h.TextureType.packed],inputNames:["A"],cacheHint:`${n}`}))(a);return Object.assign(Object.assign({},o),{get:()=>((n,t,e,r)=>{const i=t.dims,s=r;let f="";for(let v=0;v<4;v++){let w="";switch(v){case 0:w="outputCoords = rc;";break;case 1:w="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:w="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:w="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}f+=` + ${w} + ${v>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} + int flattenedIndex = getFlattenedIndex(outputCoords); + + ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); + vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); + + result[${v}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); + + ${v>0?"}":""} + `}const g=(0,p.getGlsl)(n.session.backend.glContext.version),b=` + ${function(v){const w=m.ShapeUtil.computeStrides(v),T=["b","r","c"],x="index";return` + ivec3 inputCoordsFromReshapedOutCoords(int index) { + ${w.map((A,D)=>`int ${T[D]} = ${x} / ${A}; ${D===w.length-1?`int ${T[D+1]} = ${x} - ${T[D]} * ${A}`:`index -= ${T[D]} * ${A}`};`).join("")} + return ivec3(b, r, c); + } + `}(i)} + ${function(v){const w=m.ShapeUtil.computeStrides(v);return` + int getFlattenedIndex(ivec3 coords) { + // reverse y, z order + return coords.x * ${w[0]} + coords.z * ${w[1]} + coords.y; + } +`}(s)} + ${(0,d.unpackFromChannel)()} + + void main() { + ivec3 rc = getOutputCoords(); + + vec4 result = vec4(0.0); + + ivec3 outputCoords; + int rows = ${s[2]}; + int cols = ${s[1]}; + + ${f} + ${g.output} = result; + } + `;return Object.assign(Object.assign({},e),{output:{dims:s,type:t.type,textureType:h.TextureType.packed},shaderSource:b,hasMain:!0})})(u,l,o,a)})},c.processDims3D=function(u){if(u.length===0)return[1,1,1];let l=1;for(let a=0;a1?u[u.length-2]:1,u[u.length-1]]},c.isReshapeCheap=function(u,l){let a=!1;return a=u.length===0||l.length===0||(u.length<2||l.length<2?u[u.length-1]===l[l.length-1]:u[u.length-1]===l[l.length-1]&&u[u.length-2]===l[l.length-2]),a}},8126:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.reshape=void 0;const m=y(7273);c.reshape=(p,h)=>{const d=m.ShapeUtil.calculateReshapedDims(h[0].dims,h[1].integerData);return p.session.pack?[p.reshapePacked(h[0],d)]:[p.reshapeUnpacked(h[0],d)]}},2801:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseResizeAttributesV11=c.parseResizeAttributesV10=c.resize=void 0;const m=y(6757),p=y(5639),h=y(432),d=y(5614),u=y(3980),l={name:"Resize",inputNames:["A"],inputTypes:[p.TextureType.packed]};c.resize=(e,r,i)=>((0,u.validateInputs)(r,i),[e.run(Object.assign(Object.assign({},l),{cacheHint:i.cacheKey,get:()=>a(e,r,i)}),r)]),c.parseResizeAttributesV10=e=>(0,u.parseUpsampleAttributes)(e,10),c.parseResizeAttributesV11=e=>(0,u.parseUpsampleAttributes)(e,11);const a=(e,r,i)=>{const s=(0,m.getGlsl)(e.session.backend.glContext.version),[f,g]=o(r,i);if(f.every(U=>U===1)&&i.coordinateTransformMode!=="tf_crop_and_resize")return Object.assign(Object.assign({},l),{output:{dims:g,type:r[0].type,textureType:p.TextureType.packed},hasMain:!0,shaderSource:`void main() { + vec4 v = ${s.texture2D}(X, TexCoords); + ${s.output} = v; + }`});const b=g.length;if(b<2)throw new Error(`output dimension should be at least 2, but got ${b}`);const v=g[b-2],w=g[b-1],T=r[0].dims;if(b!==T.length)throw new Error(`output dimension should match input ${T.length}, but got ${b}`);const x=T[b-2],A=T[b-1],D=f[b-2],k=f[b-1];let j="";if(i.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${i.mode}'`);switch(i.coordinateTransformMode){case"asymmetric":j=` + vec4 getSourceFracIndex(ivec4 coords) { + return vec4(coords) / scaleWHWH; + } + `;break;case"half_pixel":j=` + vec4 getSourceFracIndex(ivec4 coords) { + return (vec4(coords) + 0.5) / scaleWHWH - 0.5; + } + `;break;case"pytorch_half_pixel":j=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 fcoords = vec4(coords); + return vec4( + ${w}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, + ${v}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, + ${w}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, + ${v}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 + ); + } + `;break;case"align_corners":j=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 resized = vec4(${w}.0 - 1.0, ${v}.0 - 1.0, ${w}.0 - 1.0, + ${v}.0 - 1.0); + vec4 original = vec4(${A}.0 - 1.0, ${x}.0 - 1.0, ${A}.0 - 1.0, + ${x}.0 - 1.0); + vec4 new_scale = original / resized; + return vec4(coords) * new_scale; + } + `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${i.coordinateTransformMode}'`)}const M=(0,h.getCoordsDataType)(b),S=` + const vec2 inputWH = vec2(${x}.0, ${A}.0); + const vec4 scaleWHWH = vec4(float(${D}), float(${k}), float(${D}), float(${k})); + ${(0,d.unpackFromChannel)()} + ${j} + float getAValue(int x10, int r, int c, int d) { + return getChannel(getA(x10, r, c, d), vec2(c, d)); + } + void main() { + ${M} rc = getOutputCoords(); + + int batch = rc[0]; + int depth = rc[1]; + + // retrieve the 4 coordinates that is used in the 4 packed output values. + ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); + + // calculate the source index in fraction + vec4 sourceFrac = getSourceFracIndex(coords); + + // get the lower and upper bound of the 4 values that will be packed into one texel. + ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); + ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); + ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); + ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); + + bool hasNextRow = rc.w < ${v-1}; + bool hasNextCol = rc.z < ${w-1}; + + // pack x00, x01, x10, x11's top-left corner into one vec4 structure + vec4 topLeft = vec4( + getAValue(batch, depth, x00.x, x00.y), + hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); + + // pack x00, x01, x10, x11's top-right corner into one vec4 structure + vec4 topRight = vec4( + getAValue(batch, depth, x00.x, x00.w), + hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); + + // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure + vec4 bottomLeft = vec4( + getAValue(batch, depth, x00.z, x00.y), + hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); + + // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure + vec4 bottomRight = vec4( + getAValue(batch, depth, x00.z, x00.w), + hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); + + // calculate the interpolation fraction on u and v direction + vec4 frac = vec4(sourceFrac) - floor(sourceFrac); + vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); + + vec4 top = mix(topLeft, topRight, clampFrac.ywyw); + vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); + vec4 newValue = mix(top, bottom, clampFrac.xxzz); + + ${s.output} = vec4(newValue); + } + `;return Object.assign(Object.assign({},l),{output:{dims:g,type:r[0].type,textureType:p.TextureType.packed},hasMain:!0,shaderSource:S})},o=(e,r)=>{const i=e[0].dims;let s,f=r.scales;if(f.length===0){const b=e[r.scalesInputIdx];if(b&&b.size!==0){if(e[r.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");f=n(b,r.mode,r.isResize)}else{const v=e[r.sizesInputIdx];if(!v||v.size===0)throw new Error("Either scales or sizes MUST be provided as input.");s=Array.from(v.integerData),f=t(s,i,r.mode,r.isResize)}}else if(e[r.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const g=s||i.map((b,v)=>Math.floor(b*f[v]));return[f,g]},n=(e,r,i)=>{const s=Array.from(e.floatData);return(0,u.scalesValidation)(s,r,i),s},t=(e,r,i,s)=>{const f=r.length,g=new Array(f);for(let b=0,v=f;b{Object.defineProperty(c,"__esModule",{value:!0}),c.shape=void 0;const m=y(9240);c.shape=(h,d)=>(p(d),[new m.Tensor([d[0].dims.length],"int32",void 0,void 0,new Int32Array(d[0].dims))]);const p=h=>{if(!h||h.length!==1)throw new Error("Shape requires 1 input.")}},2444:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.sliceV10=c.parseSliceAttributes=c.slice=void 0;const m=y(4910),p=y(6145),h=y(7273),d=y(5639),u={name:"Slice",inputNames:["A"],inputTypes:[d.TextureType.unpacked]};c.slice=(t,e,r)=>(a(e),[t.run(Object.assign(Object.assign({},u),{cacheHint:r.cacheKey,get:()=>l(t,e[0],r)}),e)]),c.parseSliceAttributes=t=>{const e=t.attributes.getInts("starts"),r=t.attributes.getInts("ends"),i=t.attributes.getInts("axes",[]);return(0,m.createAttributeWithCacheKey)({starts:e,ends:r,axes:i})};const l=(t,e,r)=>{const i=r.axes.length===0?e.dims.slice(0).map((T,x)=>x):r.axes,s=h.ShapeUtil.normalizeAxes(i,e.dims.length),f=r.starts.map((T,x)=>T>e.dims[s[x]]-1?e.dims[s[x]]:h.ShapeUtil.normalizeAxis(T,e.dims[s[x]])),g=r.ends.map((T,x)=>T>e.dims[s[x]]-1?e.dims[s[x]]:h.ShapeUtil.normalizeAxis(T,e.dims[s[x]])),b=e.dims.slice(),v=[];for(let T=0;T0&&v.push(`outputIdx[${s[T]}] += ${f[T]};`);const w=` + float process(int outputIdx[${b.length}]) { + ${v.join(` + `)} + return _A(outputIdx); + }`;return Object.assign(Object.assign({},u),{output:{dims:b,type:e.type,textureType:d.TextureType.unpacked},shaderSource:w})},a=t=>{if(!t||t.length!==1)throw new Error("Slice requires 1 input.");if(p.NUMBER_TYPES.indexOf(t[0].type)===-1)throw new Error("Invalid input type.")};c.sliceV10=(t,e)=>{n(e);const r=o(t,e);return[t.run(Object.assign(Object.assign({},u),{cacheHint:r.cacheKey,get:()=>l(t,e[0],r)}),[e[0]])]};const o=(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");const r=Array.from(e[1].integerData),i=Array.from(e[2].integerData),s=e.length>=4?Array.from(e[3].integerData):[];return{starts:r,ends:i,axes:s,cacheKey:`${s};${r};${i}`}},n=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.")}},815:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.softmaxV13=c.parseSoftmaxAttributesV13=c.parseSoftmaxAttributes=c.softmax=void 0;const m=y(4910),p=y(7273),h=y(6757),d=y(5639),u=y(5707),l={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[d.TextureType.unpacked]},a={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[d.TextureType.unpacked,d.TextureType.unpacked]},o={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[d.TextureType.unpacked,d.TextureType.unpacked,d.TextureType.unpacked]};c.softmax=(s,f,g)=>{i(f);const b=f[0].dims.slice(),v=p.ShapeUtil.normalizeAxis(g.axis,b.length),w=p.ShapeUtil.sizeToDimension(b,v),T=p.ShapeUtil.sizeFromDimension(b,v);return n(s,f,g,w,T)},c.parseSoftmaxAttributes=s=>(0,m.createAttributeWithCacheKey)({axis:s.attributes.getInt("axis",1)}),c.parseSoftmaxAttributesV13=s=>(0,m.createAttributeWithCacheKey)({axis:s.attributes.getInt("axis",-1)}),c.softmaxV13=(s,f,g)=>{i(f);const b=f[0].dims.slice(),v=p.ShapeUtil.normalizeAxis(g.axis,b.length),w=b.length,T=v!==w-1,x=[];let A,D=[],k=[];T&&(D=Array.from({length:w}).map((U,O)=>O),D[v]=w-1,D[w-1]=v,D.map(U=>x.push(b[U])),A=(0,m.createAttributeWithCacheKey)({perm:D}),k=(0,u.transpose)(s,f,A));const j=T?p.ShapeUtil.sizeToDimension(x,w-1):p.ShapeUtil.sizeToDimension(b,w-1),M=T?p.ShapeUtil.sizeFromDimension(x,w-1):p.ShapeUtil.sizeFromDimension(b,w-1),S=n(s,T?k:f,g,j,M);return T?(0,u.transpose)(s,S,A):S};const n=(s,f,g,b,v)=>{const w=t(s,f[0],b,v,[b]),T=s.run(Object.assign(Object.assign({},l),{cacheHint:g.cacheKey,get:()=>w}),f),x=e(s,f[0],b,v,w.output.dims,[b]),A=s.run(Object.assign(Object.assign({},a),{cacheHint:g.cacheKey,get:()=>x}),[f[0],T]),D=r(s,f[0],b,v,w.output.dims,x.output.dims);return[s.run(Object.assign(Object.assign({},o),{cacheHint:g.cacheKey,get:()=>D}),[f[0],T,A])]},t=(s,f,g,b,v)=>{const[w,T]=s.calculateTextureWidthAndHeight(f.dims,d.TextureType.unpacked),x=v.length;if(g<1||b<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(v.length!==1)throw new Error("Dimensionality of the output should be 1");if(v[0]!==g)throw new Error("Shape of the output should be equal to logical row count");const A=(0,h.getGlsl)(s.session.backend.glContext.version),D=` + float process(int[${x}] indices) { + int logical_row_start_offset = indices[0] * ${b}; + + float max = getColorAsFloat(${A.texture2D}(A, offsetToCoords(logical_row_start_offset, ${w}, + ${T} ))); + for(int i=1; i<${b}; ++i) + { + float current = getColorAsFloat(${A.texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${w}, ${T}))); + if(current > max) + max = current; + } + + return max; + }`;return Object.assign(Object.assign({},l),{output:{dims:v,type:f.type,textureType:d.TextureType.unpacked},shaderSource:D})},e=(s,f,g,b,v,w)=>{const[T,x]=s.calculateTextureWidthAndHeight(f.dims,d.TextureType.unpacked),A=w.length;if(g<1||b<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(w.length!==1)throw new Error("Dimensionality of the output should be 1");if(w[0]!==g)throw new Error("Shape of the output should be equal to logical row count");if(v.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(v[0]!==g)throw new Error("Shape of the intermediate results should be equal to logical row count");const D=` + float process(int[${A}] indices) { + int logical_row_start_offset = indices[0] * ${b}; + + float norm_factor = 0.0; + float max = _Max(indices); + for(int i=0; i<${b}; ++i) + { + norm_factor += exp(getColorAsFloat(${(0,h.getGlsl)(s.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${T}, ${x}))) - max); + } + + return norm_factor; + }`;return Object.assign(Object.assign({},a),{output:{dims:w,type:f.type,textureType:d.TextureType.unpacked},shaderSource:D})},r=(s,f,g,b,v,w)=>{const[T,x]=s.calculateTextureWidthAndHeight(f.dims,d.TextureType.unpacked),A=f.dims.length;if(g<1||b<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(v.length!==1||w.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(v[0]!==g||w[0]!==g)throw new Error("Shape of the intermediate results should be equal to logical row count");const D=` + float process(int[${A}] indices) { + + // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) + int offset = coordsToOffset(TexCoords, ${T}, ${x}); + + //determine the logical row for this index + int logical_row_index[1]; + logical_row_index[0] = offset / ${b}; + + float norm_factor = _Norm(logical_row_index); + + // avoid possible division by 0 + // if norm_facor is 0, all elements are zero + // if so, return 0 + if(norm_factor == 0.0) + return 0.0; + + return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; + }`;return Object.assign(Object.assign({},o),{output:{dims:f.dims,type:f.type,textureType:d.TextureType.unpacked},shaderSource:D})},i=s=>{if(!s||s.length!==1)throw new Error("Softmax requires 1 input.");if(s[0].type!=="float32"&&s[0].type!=="float64")throw new Error("Invalid input type")}},564:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseSplitAttributes=c.split=void 0;const m=y(4910),p=y(7273),h=y(5639),d={name:"Split",inputNames:["A"],inputTypes:[h.TextureType.unpacked]};c.split=(o,n,t)=>{a(n);const e=p.ShapeUtil.normalizeAxis(t.axis,n[0].dims.length),r=u(o,n,e,t),i=[];for(let s=0;sl(o,n[0],t,e,s)}),n));return i},c.parseSplitAttributes=o=>{const n=o.attributes.getInt("axis",0),t=o.attributes.getInts("split",[]),e=o.outputs.length;return(0,m.createAttributeWithCacheKey)({axis:n,split:t,numOutputs:e})};const u=(o,n,t,e)=>{const[,r]=p.SplitUtil.splitShape(n[0].dims,t,e.split,e.numOutputs);return r.length},l=(o,n,t,e,r)=>{const[i,s]=p.SplitUtil.splitShape(n.dims,e,t.split,t.numOutputs),f=s[r],g=i[r],b=` + float process(int indices[${g.length}]) { + indices[${e}] += ${f}; + return _A(indices); + } + `;return Object.assign(Object.assign({},d),{cacheHint:`${t.cacheKey}:${r}`,output:{dims:g,type:n.type,textureType:h.TextureType.unpacked},shaderSource:b})},a=o=>{if(!o||o.length!==1)throw new Error("Split requires one input.");if(o[0].type!=="int8"&&o[0].type!=="uint8"&&o[0].type!=="int16"&&o[0].type!=="uint16"&&o[0].type!=="int32"&&o[0].type!=="uint32"&&o[0].type!=="float32"&&o[0].type!=="float64"&&o[0].type!=="bool")throw new Error("Invalid input type.")}},5416:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseSqueezeAttributes=c.squeezeV13=c.squeeze=void 0;const m=y(7273);c.squeeze=(d,u,l)=>{p(u);const a=m.ShapeUtil.squeezeShape(u[0].dims,l);return[d.reshapeUnpacked(u[0],a)]},c.squeezeV13=(d,u)=>(h(u),(0,c.squeeze)(d,[u[0]],Array.from(u[1].integerData))),c.parseSqueezeAttributes=d=>d.attributes.getInts("axes");const p=d=>{if(!d||d.length!==1)throw new Error("Squeeze requires 1 input.");if(d[0].type==="string")throw new Error("invalid input tensor types.")},h=d=>{if(!d||d.length!==2)throw new Error("Squeeze requires 2 inputs.");if(d[1].type!=="int32")throw new Error("Invalid input type.")}},1240:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.sum=void 0;const m=y(6757),p=y(5639);c.sum=(u,l)=>{d(l);const a={name:"Sum",inputNames:l.map((o,n)=>`X${n}`),inputTypes:new Array(l.length).fill(p.TextureType.unpacked)};return[u.run(Object.assign(Object.assign({},a),{get:()=>h(u,l,a)}),l)]};const h=(u,l,a)=>{const o=(0,m.getGlsl)(u.session.backend.glContext.version),n=l[0].dims.slice(),t=` + void main() { + vec4 result = ${l.map((e,r)=>`${o.texture2D}(X${r},TexCoords)`).join(" + ")}; + ${o.output} = result; + } + `;return Object.assign(Object.assign({},a),{output:{dims:n,type:l[0].type,textureType:p.TextureType.unpacked},hasMain:!0,shaderSource:t})},d=u=>{if(!u||u.length===0)throw new Error("Sum requires inputs.");const l=u[0].dims.length;for(let a=1;a{Object.defineProperty(c,"__esModule",{value:!0}),c.tile=void 0;const m=y(6145),p=y(5639);c.tile=(u,l)=>{d(l);const a={name:"Tile",inputNames:["A"],inputTypes:[p.TextureType.unpacked]};return[u.run(Object.assign(Object.assign({},a),{get:()=>h(u,l,a)}),l)]};const h=(u,l,a)=>{const o=l[0].dims.slice(),n=new Array(o.length),t=[];for(let i=0;i{if(!u||u.length!==2)throw new Error("Tile requires 2 input.");if(u[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(u[1].dims[0]!==u[0].dims.length)throw new Error("Invalid input shape.");if(m.NUMBER_TYPES.indexOf(u[0].type)===-1)throw new Error("Invalid input type.");if(u[1].type!=="int32"&&u[1].type!=="int16")throw new Error("Invalid repeat type.")}},5707:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseTransposeAttributes=c.transpose=void 0;const m=y(4910),p=y(7273),h=y(5639),d={name:"Transpose",inputNames:["A"],inputTypes:[h.TextureType.unpacked]};c.transpose=(t,e,r)=>(n(e),[t.run(Object.assign(Object.assign({},d),{cacheHint:r.cacheKey,get:()=>u(t,e[0],r.perm)}),e)]),c.parseTransposeAttributes=t=>(0,m.createAttributeWithCacheKey)({perm:t.attributes.getInts("perm",[])});const u=(t,e,r)=>{const i=e.dims;r=l(i,r);const s=a(i,r),f=i.length,g=` + ${o("perm",r,f)} + float process(int indices[${f}]) { + int a[${f}]; + perm(a, indices); + return _A(a); + }`;return Object.assign(Object.assign({},d),{output:{dims:s,type:e.type,textureType:h.TextureType.unpacked},shaderSource:g})},l=(t,e)=>(e&&e.length!==t.length&&(e=[...t.keys()].reverse()),e),a=(t,e)=>(e=l(t,e),p.ShapeUtil.sortBasedOnPerm(t,e)),o=(t,e,r)=>{const i=[];i.push(`void ${t}(out int a[${r}], int src[${r}]) {`);for(let s=0;s{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")}},2488:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.encodeAsUint8=void 0;const m=y(6757),p=y(5639);c.encodeAsUint8=(h,d)=>{const u=d.shape,l=(0,m.getGlsl)(h.session.backend.glContext.version),a=` + const float FLOAT_MAX = 1.70141184e38; + const float FLOAT_MIN = 1.17549435e-38; + + bool isNaN(float val) { + return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; + } + + highp vec4 encodeAsUint8(highp float v) { + if (isNaN(v)) { + return vec4(255, 255, 255, 255); + } + + highp float av = abs(v); + + if(av < FLOAT_MIN) { + return vec4(0.0, 0.0, 0.0, 0.0); + } else if(v > FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; + } else if(v < -FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; + } + + highp vec4 c = vec4(0,0,0,0); + + highp float e = floor(log2(av)); + highp float m = exp2(fract(log2(av))) - 1.0; + + c[2] = floor(128.0 * m); + m -= c[2] / 128.0; + c[1] = floor(32768.0 * m); + m -= c[1] / 32768.0; + c[0] = floor(8388608.0 * m); + + highp float ebias = e + 127.0; + c[3] = floor(ebias / 2.0); + ebias -= c[3] * 2.0; + c[2] += floor(ebias) * 128.0; + + c[3] += 128.0 * step(0.0, -v); + + return c / 255.0; + } + + void main() { + float value = ${l.texture2D}(X,TexCoords).r; + ${l.output} = encodeAsUint8(value); + }`,o={name:"Uint8Encode",inputTypes:[p.TextureType.unpacked],inputNames:["X"],output:{dims:u,type:d.tensor.type,textureType:p.TextureType.downloadUint8AsFloat},shaderSource:a,hasMain:!0};return h.executeProgram(o,[d.tensor])}},9087:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tanh=c.tan=c.sqrt=c.sin=c.sigmoid=c.relu=c.not=c.neg=c.log=c.parseLeakyReluAttributes=c.leakyRelu=c.identity=c.floor=c.exp=c.parseEluAttributes=c.elu=c.cos=c.ceil=c.clipV11=c.parseClipAttributes=c.clip=c.atan=c.asin=c.acos=c.abs=c.glslTanh=c.glslTan=c.glslSqrt=c.glslSigmoid=c.glslRelu=c.glslSin=c.glslNot=c.glslNeg=c.glslLog=c.glslLeakyRelu=c.glslIdentity=c.glslClip=c.glslFloor=c.glslExp=c.glslElu=c.glslCos=c.glslCeil=c.glslAtan=c.glslAsin=c.glslAcos=c.glslAbs=void 0;const m=y(4910),p=y(7273),h=y(1997),d=y(6757),u=y(5639);function l(){return S("abs")}function a(){return S("acos")}function o(){return S("asin")}function n(){return S("atan")}function t(){return S("ceil")}function e(){return S("cos")}function r(E){const N="elu";return{body:` + const float alpha = float(${E}); + + float ${N}_(float a) { + return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; + } + vec4 ${N}_(vec4 v) { + return vec4(${N}_(v.x), ${N}_(v.y), ${N}_(v.z), ${N}_(v.w)); + } + `,name:N,type:h.FunctionType.ValueBased}}function i(){return S("exp")}function s(){return S("floor")}function f(E,N){const q="clip";return{body:` + const float min = float(${E}); + const float max = float(${N}); + + float ${q}_(float a) { + return clamp(a, min, max); + } + vec4 ${q}_(vec4 v) { + return clamp(v, min, max); + } + `,name:q,type:h.FunctionType.ValueBased}}function g(){const E="indentity";return{body:` + float ${E}_(float a) { + return a; + } + vec4 ${E}_(vec4 v) { + return v; + } + `,name:E,type:h.FunctionType.ValueBased}}function b(E){const N="leakyRelu";return{body:` + const float alpha = float(${E}); + + float ${N}_(float a) { + return a < 0.0 ? a * alpha : a; + } + vec4 ${N}_(vec4 v) { + return vec4(${N}_(v.x), ${N}_(v.y), ${N}_(v.z), ${N}_(v.w)); + } + `,name:N,type:h.FunctionType.ValueBased}}function v(){return S("log")}function w(){const E="neg";return{body:` + float ${E}_(float a) { + return -a; + } + vec4 ${E}_(vec4 v) { + return -v; + } + `,name:E,type:h.FunctionType.ValueBased}}function T(){const E="not";return{body:` + float ${E}_(float a) { + return float( ! bool(a) ); + } + bool ${E}_(bool a) { + return !a; + } + vec4 ${E}_(vec4 v) { + return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); + } + bvec4 ${E}_(bvec4 v) { + return bvec4(!v.x, !v.y, !v.z, !v.w); + } + `,name:E,type:h.FunctionType.ValueBased}}function x(){return S("sin")}function A(){const E="relu";return{body:` + float ${E}_(float a) { + return max( a, 0.0 ); + } + vec4 ${E}_(vec4 v) { + return max( v, 0.0 ); + } + `,name:E,type:h.FunctionType.ValueBased}}function D(){const E="sigmoid";return{body:` + float ${E}_(float a) { + return 1.0 / (1.0 + exp(-a)); + } + vec4 ${E}_(vec4 v) { + return 1.0 / (1.0 + exp(-v)); + } + `,name:E,type:h.FunctionType.ValueBased}}function k(){return S("sqrt")}function j(){return S("tan")}function M(){const E="tanh";return{body:` + float ${E}_(float a) { + a = clamp(a, -10., 10.); + a = exp(2.*a); + return (a - 1.) / (a + 1.); + } + vec4 ${E}_(vec4 v) { + v = clamp(v, -10., 10.); + v = exp(2.*v); + return (v - 1.) / (v + 1.); + } + `,name:E,type:h.FunctionType.ValueBased}}function S(E){return{body:` + float ${E}_(float a) { + return ${E}(a); + } + vec4 ${E}_(vec4 v) { + return ${E}(v); + } + `,name:E,type:h.FunctionType.ValueBased}}c.glslAbs=l,c.glslAcos=a,c.glslAsin=o,c.glslAtan=n,c.glslCeil=t,c.glslCos=e,c.glslElu=r,c.glslExp=i,c.glslFloor=s,c.glslClip=f,c.glslIdentity=g,c.glslLeakyRelu=b,c.glslLog=v,c.glslNeg=w,c.glslNot=T,c.glslSin=x,c.glslRelu=A,c.glslSigmoid=D,c.glslSqrt=k,c.glslTan=j,c.glslTanh=M;const U=(E,N,q,H)=>{const K=E.session.pack?u.TextureType.packed:u.TextureType.unpacked,X={name:q.name,inputTypes:[K],inputNames:["A"],cacheHint:H};return Object.assign(Object.assign({},X),{get:()=>((J,tt,nt,rt)=>{const it=J.session.pack?u.TextureType.packed:u.TextureType.unpacked,ut=(0,d.getGlsl)(J.session.backend.glContext.version);return Object.assign(Object.assign({},tt),{output:{dims:nt.dims,type:nt.type,textureType:it},shaderSource:` + ${rt.body} + void main() { + vec4 v = ${ut.texture2D}(A, TexCoords); + v = ${rt.name}_(v); + ${ut.output} = v; + } + `,hasMain:!0})})(E,X,N,q)})};c.abs=(E,N)=>[E.run(U(E,N[0],l()),N)],c.acos=(E,N)=>[E.run(U(E,N[0],a()),N)],c.asin=(E,N)=>[E.run(U(E,N[0],o()),N)],c.atan=(E,N)=>[E.run(U(E,N[0],n()),N)],c.clip=(E,N,q)=>[E.run(U(E,N[0],f(q.min,q.max),q.cacheKey),N)],c.parseClipAttributes=E=>(0,m.createAttributeWithCacheKey)({min:E.attributes.getFloat("min",p.MIN_CLIP),max:E.attributes.getFloat("max",p.MAX_CLIP)}),c.clipV11=(E,N)=>{const q=O(E,N);return(0,c.clip)(E,[N[0]],q)};const O=(E,N)=>{if(N.length>=3&&(!E.session.isInitializer(N[1].dataId)||!E.session.isInitializer(N[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const q=N.length>=3?N[1].numberData[0]:p.MIN_CLIP,H=N.length>=3?N[2].numberData[0]:p.MAX_CLIP;return(0,m.createAttributeWithCacheKey)({min:q,max:H})};c.ceil=(E,N)=>[E.run(U(E,N[0],t()),N)],c.cos=(E,N)=>[E.run(U(E,N[0],e()),N)],c.elu=(E,N,q)=>[E.run(U(E,N[0],r(q.alpha),q.cacheKey),N)],c.parseEluAttributes=E=>(0,m.createAttributeWithCacheKey)({alpha:E.attributes.getFloat("alpha",1)}),c.exp=(E,N)=>[E.run(U(E,N[0],i()),N)],c.floor=(E,N)=>[E.run(U(E,N[0],s()),N)],c.identity=(E,N)=>[E.run(U(E,N[0],g()),N)],c.leakyRelu=(E,N,q)=>[E.run(U(E,N[0],b(q.alpha),q.cacheKey),N)],c.parseLeakyReluAttributes=E=>(0,m.createAttributeWithCacheKey)({alpha:E.attributes.getFloat("alpha",.01)}),c.log=(E,N)=>[E.run(U(E,N[0],v()),N)],c.neg=(E,N)=>[E.run(U(E,N[0],w()),N)],c.not=(E,N)=>[E.run(U(E,N[0],T()),N)],c.relu=(E,N)=>[E.run(U(E,N[0],A()),N)],c.sigmoid=(E,N)=>[E.run(U(E,N[0],D()),N)],c.sin=(E,N)=>[E.run(U(E,N[0],x()),N)],c.sqrt=(E,N)=>[E.run(U(E,N[0],k()),N)],c.tan=(E,N)=>[E.run(U(E,N[0],j()),N)],c.tanh=(E,N)=>[E.run(U(E,N[0],M()),N)]},540:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createUnpackProgramInfoLoader=c.createUnpackProgramInfo=void 0;const m=y(6757),p=y(5639),h=y(432),d=y(5614),u={name:"unpack",inputNames:["A"],inputTypes:[p.TextureType.packed]};c.createUnpackProgramInfo=(l,a)=>{const o=a.dims.length,n=(0,d.getChannels)("rc",o),t=n.slice(-2),e=(0,h.getCoordsDataType)(o),r=(0,d.unpackFromChannel)(),i=a.dims.length===0?"":function(g,b){if(g===1)return"rc";let v="";for(let w=0;wObject.assign(Object.assign({},u),{get:()=>(0,c.createUnpackProgramInfo)(l,a)})},7862:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseUnsqueezeAttributes=c.unsqueezeV13=c.unsqueeze=void 0;const m=y(7273);c.unsqueeze=(d,u,l)=>{p(u);const a=m.ShapeUtil.unsqueezeShape(u[0].dims,l);return[d.reshapeUnpacked(u[0],a)]},c.unsqueezeV13=(d,u)=>(h(u),(0,c.unsqueeze)(d,[u[0]],Array.from(u[1].integerData))),c.parseUnsqueezeAttributes=d=>d.attributes.getInts("axes");const p=d=>{if(!d||d.length!==1)throw new Error("Unsqueeze requires 1 input.");if(d[0].type==="string")throw new Error("invalid input tensor types.")},h=d=>{if(!d||d.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(d[1].type!=="int32")throw new Error("Invalid input type.")}},3980:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.scalesValidation=c.validateInputs=c.parseUpsampleAttributes=c.parseUpsampleAttributesV9=c.parseUpsampleAttributesV7=c.upsample=void 0;const m=y(4910),p=y(6757),h=y(5639),d={name:"Upsample",inputNames:["X"],inputTypes:[h.TextureType.unpacked]};c.upsample=(l,a,o)=>((0,c.validateInputs)(a,o),[l.run(Object.assign(Object.assign({},d),{cacheHint:o.cacheKey,get:()=>u(l,a,o)}),a)]),c.parseUpsampleAttributesV7=l=>(0,c.parseUpsampleAttributes)(l,7),c.parseUpsampleAttributesV9=l=>(0,c.parseUpsampleAttributes)(l,9),c.parseUpsampleAttributes=(l,a)=>{const o=a>=10,n=l.attributes.getString("mode","nearest");if(n!=="nearest"&&n!=="linear"&&(a<11||n!=="cubic"))throw new Error(`unrecognized mode: ${n}`);let t=[];a<9&&(t=l.attributes.getFloats("scales"),(0,c.scalesValidation)(t,n,o));const e=l.attributes.getFloat("extrapolation_value",0),r=a>10?l.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(r)===-1)throw new Error(`coordinate_transform_mode '${r}' is not supported`);const i=r==="tf_crop_and_resize",s=i,f=n==="nearest"&&a>=11?l.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(f)===-1)throw new Error(`nearest_mode '${f}' is not supported`);const g=l.attributes.getFloat("cubic_coeff_a",-.75),b=l.attributes.getInt("exclude_outside",0)!==0;if(b&&n!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const v=a<11||n==="nearest"&&r==="asymmetric"&&f==="floor";let w=0,T=0,x=0;return a>10?l.inputs.length>2?(w=1,T=2,x=3):(T=1,x=2):a===9&&(T=1),(0,m.createAttributeWithCacheKey)({opset:a,isResize:o,mode:n,scales:t,extrapolationValue:e,coordinateTransformMode:r,useExtrapolation:s,needRoiInput:i,nearestMode:f,cubicCoefficientA:g,excludeOutside:b,useNearest2xOptimization:v,roiInputIdx:w,scalesInputIdx:T,sizesInputIdx:x})};const u=(l,a,o)=>{const n=(0,p.getGlsl)(l.session.backend.glContext.version),[t,e]=l.calculateTextureWidthAndHeight(a[0].dims,h.TextureType.unpacked),r=a[0].dims.map((x,A)=>Math.floor(x*o.scales[A])),[i,s]=l.calculateTextureWidthAndHeight(r,h.TextureType.unpacked),f=r.length,g=new Array(f),b=new Array(f);let v=` + int output_pitches[${f}]; + int input_pitches[${f}]; + `;for(let x=f-1;x>=0;x--)g[x]=x===f-1?1:g[x+1]*r[x+1],b[x]=x===f-1?1:b[x+1]*a[0].dims[x+1],v+=` + output_pitches[${x}] = ${g[x]}; + input_pitches[${x}] = ${b[x]}; + `;const w=` + float getInputFloat(int index) { + vec2 coords = offsetToCoords(index, ${t}, ${e}); + float value = getColorAsFloat(${n.texture2D}(X, coords)); + return value; + } + `,T=o.mode==="nearest"?` + ${w} + float process(int indices[${f}]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${i}, ${s}); + + ${v} + + int d, m; + for (int dim = 0; dim < ${f}; ++dim) { + d = output_index / output_pitches[dim]; + m = output_index - d * output_pitches[dim]; + output_index = m; + + if (scales[dim] != 1 && d > 0) { + int d2 = d / scales[dim]; + m = d - d2 * scales[dim]; + d = d2; + } + input_index += input_pitches[dim] * d; + } + + return getInputFloat(input_index); + }`:f===4?` + ${w} + float process(int indices[4]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${i}, ${s}); + + ${v} + + int m; + int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m / output_pitches[1]; + m = m - index_of_dim1 * output_pitches[1]; + index_of_dim2 = m / output_pitches[2]; + m = m - index_of_dim2 * output_pitches[2]; + index_of_dim3 = m; + + int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; + index_of_input_dim2 = index_of_dim2 / scales[2]; + y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; + index_of_input_dim3 = index_of_dim3 / scales[3]; + x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; + + input_index = index_of_dim0 * input_pitches[0] + + index_of_dim1 * input_pitches[1] + + index_of_input_dim2 * input_pitches[2] + + index_of_input_dim3; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim2 = false; + if (index_of_input_dim2 == (${a[0].dims[2]} - 1)) { + // It's the end in dimension 2 + x01 = x00; + end_of_dim2 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[2]); + } + + if (index_of_input_dim3 == (input_pitches[2] - 1)) { + // It's the end in dimension 3 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); + }`:` + ${w} + float process(int indices[2]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${i}, ${s}); + + ${v} + + int m; + int index_of_dim0, index_of_dim1; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m; + + int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; + index_of_input_dim0 = index_of_dim0 / scales[0]; + y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; + index_of_input_dim1 = index_of_dim1 / scales[1]; + x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; + + input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim0 = false; + if (index_of_input_dim0 == (${a[0].dims[0]} - 1)) { + // It's the end in dimension 0 + x01 = x00; + end_of_dim0 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[0]); + } + + if (index_of_input_dim1 == (input_pitches[0] - 1)) { + // It's the end in dimension 1 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); + }`;return Object.assign(Object.assign({},d),{output:{dims:r,type:a[0].type,textureType:h.TextureType.unpacked},shaderSource:T,variables:[{name:"scales",type:"int",arrayLength:o.scales.length,data:o.scales.map(x=>Math.ceil(x))}]})};c.validateInputs=(l,a)=>{if(!l||a.opset<9&&l.length!==1||a.opset>=9&&a.opset<11&&l.length!==2||a.opset>=11&&l.length<2)throw new Error("invalid inputs.");if(a.scales.length>0&&l[0].dims.length!==a.scales.length)throw new Error("Invalid input shape.");if(l[0].type==="string")throw new Error("Invalid input tensor types.")},c.scalesValidation=(l,a,o)=>{if(o){for(const n of l)if(n<=0)throw new Error("Scale value should be greater than 0.")}else for(const n of l)if(n<1)throw new Error("Scale value should be greater than or equal to 1.");if(!(a!=="linear"&&a!=="cubic"||l.length===2||l.length===4&&l[0]===1&&l[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.`)}},2757:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ProgramManager=void 0;const m=y(2235),p=y(1315),h=y(8897),d=y(6757);c.ProgramManager=class{constructor(u,l,a){this.profiler=u,this.glContext=l,this.textureLayoutStrategy=a,this.repo=new Map,this.attributesBound=!1}getArtifact(u){return this.repo.get(u)}setArtifact(u,l){this.repo.set(u,l)}run(u,l,a){var o;this.profiler.event("op",`ProgramManager.run ${(o=u.programInfo.name)!==null&&o!==void 0?o:"unknown kernel"}`,()=>{var n;const t=this.glContext.gl,e=u.program;t.useProgram(e);try{this.bindOutput(a),this.attributesBound||this.bindAttributes(u.attribLocations),this.bindUniforms(u.uniformLocations,(n=u.programInfo.variables)!==null&&n!==void 0?n:[],l)}catch(r){throw p.Logger.error("ProgramManager",u.programInfo.shaderSource),r}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(u=>this.glContext.deleteProgram(u.program))}build(u,l,a){return this.profiler.event("backend","ProgramManager.build",()=>{const o=new h.GlslPreprocessor(this.glContext,u,l,a),n=o.preprocess(),t=this.compile(n);return{programInfo:u,program:t,uniformLocations:this.getUniformLocations(t,o.context.programInfo.inputNames,o.context.programInfo.variables),attribLocations:this.getAttribLocations(t)}})}compile(u){if(!this.vertexShader){p.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const o=(0,d.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(o,this.glContext.gl.VERTEX_SHADER)}m.env.debug&&p.Logger.verbose("ProrgramManager",`FragShader: +${u} +`);const l=this.glContext.compileShader(u,this.glContext.gl.FRAGMENT_SHADER),a=this.glContext.createProgram(this.vertexShader,l);return this.glContext.deleteShader(l),a}bindOutput(u){const l=u.width,a=u.height;p.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${l}/${a}, shape=${u.shape}, type=${u.tensor.type}`),this.glContext.attachFramebuffer(u.texture,l,a)}bindAttributes(u){const l=u.position,a=u.textureCoord;this.glContext.setVertexAttributes(l,a),this.attributesBound=!0}bindUniforms(u,l,a){var o;const n=this.glContext.gl;let t=0;for(const{name:e,type:r,location:i,arrayLength:s}of u){const f=(o=l.find(g=>g.name===e))===null||o===void 0?void 0:o.data;if(r!=="sampler2D"&&!f)throw new Error(`variable '${e}' does not have data defined in program info`);switch(r){case"sampler2D":this.bindTexture(a[t],i,t),t++;break;case"float":s?n.uniform1fv(i,f):n.uniform1f(i,f);break;case"int":s?n.uniform1iv(i,f):n.uniform1i(i,f);break;default:throw new Error(`Uniform not implemented: ${r}`)}}}bindTexture(u,l,a){this.glContext.bindTextureToUniform(u.texture,a,l)}getAttribLocations(u){return{position:this.getAttribLocation(u,"position"),textureCoord:this.getAttribLocation(u,"textureCoord")}}getUniformLocations(u,l,a){const o=[];if(l)for(const n of l)o.push({name:n,type:"sampler2D",location:this.getUniformLocation(u,n)});if(a)for(const n of a)o.push(Object.assign(Object.assign({},n),{location:this.getUniformLocation(u,n.name)}));return o}getUniformLocation(u,l){const a=this.glContext.gl.getUniformLocation(u,l);if(a===null)throw new Error(`Uniform ${l} not found.`);return a}getAttribLocation(u,l){return this.glContext.gl.getAttribLocation(u,l)}}},2171:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLSessionHandler=void 0;const m=y(1315),p=y(5881),h=y(7860),d=y(4110),u=y(2757),l=y(7618),a=y(5243);c.WebGLSessionHandler=class{constructor(o,n){this.backend=o,this.context=n,this.layoutStrategy=new l.PreferLogicalStrategy(o.glContext.maxTextureSize),this.programManager=new u.ProgramManager(this.context.profiler,o.glContext,this.layoutStrategy),this.textureManager=new a.TextureManager(o.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:o.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=o.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new h.WebGLInferenceHandler(this)}onGraphInitialized(o){const n=o.getValues().filter(t=>t.from===-1&&t.tensor).map(t=>t.tensor.dataId);this.initializers=new Set(n)}isInitializer(o){return!!this.initializers&&this.initializers.has(o)}addInitializer(o){this.initializers.add(o)}getTextureData(o,n){return n?this.packedTextureDataCache.get(o):this.unpackedTextureDataCache.get(o)}setTextureData(o,n,t=!1){m.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),t?this.packedTextureDataCache.set(o,n):this.unpackedTextureDataCache.set(o,n)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(o=>this.textureManager.releaseTexture(o,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(o=>this.textureManager.releaseTexture(o,!0)),this.unpackedTextureDataCache=new Map}resolve(o,n,t){const e=(0,p.resolveOperator)(o,n,d.WEBGL_OP_RESOLVE_RULES);return{impl:e.opImpl,context:e.opInit?e.opInit(o,t):o}}}},9622:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Uint8DataEncoder=c.RGBAFloatDataEncoder=c.RedFloat32DataEncoder=void 0;const m=y(1315);c.RedFloat32DataEncoder=class{constructor(p,h=1){if(h===1)this.internalFormat=p.R32F,this.format=p.RED,this.textureType=p.FLOAT,this.channelSize=h;else{if(h!==4)throw new Error(`Invalid number of channels: ${h}`);this.internalFormat=p.RGBA32F,this.format=p.RGBA,this.textureType=p.FLOAT,this.channelSize=h}}encode(p,h){let d,u;return p.constructor!==Float32Array&&(m.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),u=new Float32Array(p)),h*this.channelSize>p.length?(m.Logger.warning("Encoder","Source data too small. Allocating larger array"),u=p,d=this.allocate(h*this.channelSize),u.forEach((l,a)=>d[a]=l)):(u=p,d=u),d}allocate(p){return new Float32Array(4*p)}decode(p,h){return this.channelSize===1?p.filter((d,u)=>u%4==0).subarray(0,h):p.subarray(0,h)}},c.RGBAFloatDataEncoder=class{constructor(p,h=1,d){if(h!==1&&h!==4)throw new Error(`Invalid number of channels: ${h}`);this.internalFormat=p.RGBA,this.format=p.RGBA,this.channelSize=h,this.textureType=d||p.FLOAT}encode(p,h){let d=p;return this.channelSize===1&&(m.Logger.verbose("Encoder","Exploding into a larger array"),d=this.allocate(h),p.forEach((u,l)=>d[4*l]=u)),d}allocate(p){return new Float32Array(4*p)}decode(p,h){return this.channelSize===1?p.filter((d,u)=>u%4==0).subarray(0,h):p.subarray(0,h)}},c.Uint8DataEncoder=class{constructor(p,h=1){if(this.channelSize=4,h===1)this.internalFormat=p.ALPHA,this.format=p.ALPHA,this.textureType=p.UNSIGNED_BYTE,this.channelSize=h;else{if(h!==4)throw new Error(`Invalid number of channels: ${h}`);this.internalFormat=p.RGBA,this.format=p.RGBA,this.textureType=p.UNSIGNED_BYTE,this.channelSize=h}}encode(p,h){return new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}allocate(p){return new Uint8Array(p*this.channelSize)}decode(p,h){if(p instanceof Uint8Array)return p.subarray(0,h);throw new Error(`Invalid array type: ${p.constructor}`)}}},7618:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getBatchDim=c.sizeToSquarishShape=c.getRowsCols=c.sizeFromShape=c.isInt=c.parseAxisParam=c.squeezeShape=c.PreferLogicalStrategy=c.AlwaysKeepOriginalSizeStrategy=void 0;const m=y(1315),p=y(7273);function h(o,n){const t=[],e=[],r=n!=null&&Array.isArray(n)&&n.length===0,i=n==null||r?null:d(n,o).sort();let s=0;for(let f=0;ff)&&o[f]===1&&(t.push(o[f]),e.push(f)),i[s]<=f&&s++}o[f]!==1&&(t.push(o[f]),e.push(f))}return{newShape:t,keptDims:e}}function d(o,n){const t=n.length;return o=o==null?n.map((e,r)=>r):[].concat(o),(0,p.assert)(o.every(e=>e>=-t&&e`All values in axis param must be in range [-${t}, ${t}) but got axis ${o}`),(0,p.assert)(o.every(u),()=>`All values in axis param must be integers but got axis ${o}`),o.map(e=>e<0?t+e:e)}function u(o){return o%1==0}function l(o){if(o.length===0)return 1;let n=o[0];for(let t=1;t=o.length?1:o.slice(n.breakAxis).reduce((f,g)=>f*g),s=n.breakAxis<=0?1:o.slice(0,n.breakAxis).reduce((f,g)=>f*g);if(!(i>t||s>t))return[i,s];m.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${o}, breakAxis:${n.breakAxis}`)}const e=o.reduce((i,s)=>i*s);let r=Math.floor(Math.sqrt(e));for(;r=t||e%r!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${o}`);return[r,e/r]}},c.PreferLogicalStrategy=class{constructor(o){this.maxTextureSize=o}computeTextureWH(o,n){const t=this.computeTexture(o,n);return n&&n.isPacked&&(t[0]/=2,t[1]/=2),n&&n.reverseWH?[t[1],t[0]]:t}computeTexture(o,n){const t=n&&n.isPacked;if(o.length===0)return t?[2,2]:[1,1];let e=this.maxTextureSize;if(n&&n.breakAxis!==void 0){const s=n.breakAxis>=o.length?1:o.slice(n.breakAxis).reduce((g,b)=>g*b),f=n.breakAxis<=0?1:o.slice(0,n.breakAxis).reduce((g,b)=>g*b);if(!(s>e||f>e))return[s,f];m.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${o}, breakAxis:${n.breakAxis}`)}let r=o.slice(0);t&&(e*=2,r=r.map((s,f)=>f>=r.length-2?r[f]%2==0?r[f]:r[f]+1:r[f]),r.length===1&&(r=[2,r[0]])),r.length!==2&&(r=h(r).newShape);const i=l(r);return r.length<=1&&i<=e?[1,i]:r.length===2&&r[0]<=e&&r[1]<=e?r:r.length===3&&r[0]*r[1]<=e&&r[2]<=e?[r[0]*r[1],r[2]]:r.length===3&&r[0]<=e&&r[1]*r[2]<=e?[r[0],r[1]*r[2]]:r.length===4&&r[0]*r[1]*r[2]<=e&&r[3]<=e?[r[0]*r[1]*r[2],r[3]]:r.length===4&&r[0]<=e&&r[1]*r[2]*r[3]<=e?[r[0],r[1]*r[2]*r[3]]:t?a(i/4).map(s=>2*s):a(i)}},c.squeezeShape=h,c.parseAxisParam=d,c.isInt=u,c.sizeFromShape=l,c.getRowsCols=function(o){if(o.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[o.length>1?o[o.length-2]:1,o[o.length-1]]},c.sizeToSquarishShape=a,c.getBatchDim=function(o,n=2){return l(o.slice(0,o.length-n))}},3314:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createTextureLayoutFromShape=c.calculateTextureWidthAndHeight=c.createTextureLayoutFromTextureType=void 0;const m=y(7273),p=y(5639);c.createTextureLayoutFromTextureType=(h,d,u)=>{const l=u===p.TextureType.unpacked||u===p.TextureType.unpackedReversed?1:4,a=u===p.TextureType.packed,o=u===p.TextureType.unpackedReversed||u===p.TextureType.packed,n=u===p.TextureType.packedLastDimension?d.length-1:void 0,t=u===p.TextureType.packedLastDimension?d.map((e,r)=>r===d.length-1?4*e:e):void 0;return(0,c.createTextureLayoutFromShape)(h,d,l,t,{isPacked:a,reverseWH:o,breakAxis:n})},c.calculateTextureWidthAndHeight=(h,d,u)=>{const l=(0,c.createTextureLayoutFromTextureType)(h,d,u);return[l.width,l.height]},c.createTextureLayoutFromShape=(h,d,u=1,l,a)=>{const o=!(!a||!a.isPacked),[n,t]=h.computeTextureWH(o&&l||d,a),e=d.length;let r=d.slice(0);if(e===0&&(r=[1]),u===1)l=d;else if(o){if(u!==4)throw new Error("a packed texture must be 4-channel");l=d,e>0&&(r[e-1]=Math.ceil(r[e-1]/2)),e>1&&(r[e-2]=Math.ceil(r[e-2]/2))}else if(!l)throw new Error("Unpacked shape is needed when using channels > 1");return{width:n,height:t,channels:u,isPacked:o,shape:r,strides:m.ShapeUtil.computeStrides(r),unpackedShape:l,reversedWH:a&&a.reverseWH}}},5243:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TextureManager=void 0;const m=y(1315);c.TextureManager=class{constructor(p,h,d,u){this.glContext=p,this.layoutStrategy=h,this.profiler=d,this.config=u,this.pendingRead=new Map,u.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(p,h,d,u){const l=this.toEncoderType(p),a=this.glContext.getEncoder(l,h.channels||1,u);if(h.isPacked&&u===1)throw new Error("not implemented");const o=h.width,n=h.height;let t,e;if(this.config.reuseTextures){t=`${o}x${n}_${a.format}_${a.internalFormat}_${a.textureType}`,e=this.inUseTextures.get(t),e||(e=[],this.inUseTextures.set(t,e));const i=this.idleTextures.get(t);if(i&&i.length>0){const s=i.pop();return e.push(s),u===1&&this.glContext.updateTexture(s,o,n,a,this.toTextureData(p,d)),s}}m.Logger.verbose("TextureManager",`Creating new texture of size ${h.width}x${h.height}`);const r=this.glContext.allocateTexture(o,n,a,this.toTextureData(p,d));return this.config.reuseTextures&&(e.push(r),this.textureLookup.set(r,t)),r}readTexture(p,h,d){return d||(d=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const u=p.shape.reduce((a,o)=>a*o)*d,l=this.glContext.readTexture(p.texture,p.width,p.height,u,this.toEncoderType(h),d);return this.toTensorData(h,l)})}async readTextureAsync(p,h,d){const u=p.tensor.dataId;if(d||(d=1),this.pendingRead.has(u)){const l=this.pendingRead.get(u);return new Promise(a=>l==null?void 0:l.push(a))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(u,[]);const l=p.shape.reduce((t,e)=>t*e)*d;await this.glContext.createAndWaitForFence();const a=this.glContext.readTexture(p.texture,p.width,p.height,l,this.toEncoderType(h),d),o=this.toTensorData(h,a),n=this.pendingRead.get(u);return this.pendingRead.delete(u),n==null||n.forEach(t=>t(o)),o})}readUint8TextureAsFloat(p){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const h=p.shape.reduce((u,l)=>u*l),d=this.glContext.readTexture(p.texture,p.width,p.height,4*h,"byte",4);return new Float32Array(d.buffer,d.byteOffset,h)})}releaseTexture(p,h){let d;if(this.config.reuseTextures&&(d=this.textureLookup.get(p.texture),d)){h&&this.textureLookup.delete(d);const u=this.inUseTextures.get(d);if(u){const l=u.indexOf(p.texture);if(l!==-1){u.splice(l,1);let a=this.idleTextures.get(d);a||(a=[],this.idleTextures.set(d,a)),a.push(p.texture)}}}d&&!h||(m.Logger.verbose("TextureManager",`Deleting texture of size ${p.width}x${p.height}`),this.glContext.deleteTexture(p.texture))}toTensorData(p,h){switch(p){case"int16":return h instanceof Int16Array?h:Int16Array.from(h);case"int32":return h instanceof Int32Array?h:Int32Array.from(h);case"int8":return h instanceof Int8Array?h:Int8Array.from(h);case"uint16":return h instanceof Uint16Array?h:Uint16Array.from(h);case"uint32":return h instanceof Uint32Array?h:Uint32Array.from(h);case"uint8":case"bool":return h instanceof Uint8Array?h:Uint8Array.from(h);case"float32":return h instanceof Float32Array?h:Float32Array.from(h);case"float64":return h instanceof Float64Array?h:Float64Array.from(h);default:throw new Error(`TensorData type ${p} is not supported`)}}toTextureData(p,h){if(h)return h instanceof Float32Array?h:new Float32Array(h)}toEncoderType(p){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},5639:($,c)=>{var y;Object.defineProperty(c,"__esModule",{value:!0}),c.TextureType=void 0,(y=c.TextureType||(c.TextureType={}))[y.unpacked=0]="unpacked",y[y.unpackedReversed=1]="unpackedReversed",y[y.packed=2]="packed",y[y.downloadUint8AsFloat=3]="downloadUint8AsFloat",y[y.packedLastDimension=4]="packedLastDimension"},432:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getGlChannels=c.getCoordsDataType=c.getSqueezedParams=c.squeezeInputShape=c.generateShaderFuncNameFromInputSamplerNameAtOutCoords=c.generateShaderFuncNameFromInputSamplerName=c.repeatedTry=c.getPackedShape=void 0;const m=y(7273);c.getPackedShape=function(p){const h=p.length;return p.slice(0,h-1).concat(p[h-1]/4)},c.repeatedTry=async function(p,h=u=>0,d){return new Promise((u,l)=>{let a=0;const o=()=>{if(p())return void u();a++;const n=h(a);d!=null&&a>=d?l():setTimeout(o,n)};o()})},c.generateShaderFuncNameFromInputSamplerName=function(p){return(0,m.assert)(p!==void 0&&p.length!==0,()=>"empty string found for sampler name"),"get"+p.charAt(0).toUpperCase()+p.slice(1)},c.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(p){return(0,m.assert)(p!==void 0&&p.length!==0,()=>"empty string found for sampler name"),"get"+p.charAt(0).toUpperCase()+p.slice(1)+"AtOutCoords"},c.squeezeInputShape=function(p,h){let d=JSON.parse(JSON.stringify(p));return d=h,d},c.getSqueezedParams=function(p,h){return h.map(d=>p[d]).join(", ")},c.getCoordsDataType=function(p){if(p<=1)return"int";if(p===2)return"ivec2";if(p===3)return"ivec3";if(p===4)return"ivec4";if(p===5)return"ivec5";if(p===6)return"ivec6";throw Error(`GPU for rank ${p} is not yet supported`)},c.getGlChannels=function(p=6){return["x","y","z","w","u","v"].slice(0,p)}},3389:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createNewWebGLContext=c.createWebGLContext=void 0;const m=y(1315),p=y(3524),h={};function d(u,l){let a;const o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!l||l==="webgl2")&&(a=u.getContext("webgl2",o),a))try{return new p.WebGLContext(a,2)}catch(n){m.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${n}`)}if((!l||l==="webgl")&&(a=u.getContext("webgl",o)||u.getContext("experimental-webgl",o),a))try{return new p.WebGLContext(a,1)}catch(n){m.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${n}`)}throw new Error("WebGL is not supported")}c.createWebGLContext=function u(l){let a;if(l&&l!=="webgl2"||!("webgl2"in h)?l&&l!=="webgl"||!("webgl"in h)||(a=h.webgl):a=h.webgl2,!a)try{a=d(function(){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create offscreen canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}(),l)}catch{a=d(function(){if(typeof document>"u")throw new TypeError("failed to create canvas: document is not supported");const t=document.createElement("canvas");return t.width=1,t.height=1,t}(),l)}l=l||a.version===1?"webgl":"webgl2";const o=a.gl;return h[l]=a,o.isContextLost()?(delete h[l],u(l)):(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),a)},c.createNewWebGLContext=d},3524:function($,c,y){var m=this&&this.__createBinding||(Object.create?function(o,n,t,e){e===void 0&&(e=t);var r=Object.getOwnPropertyDescriptor(n,t);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(o,e,r)}:function(o,n,t,e){e===void 0&&(e=t),o[e]=n[t]}),p=this&&this.__setModuleDefault||(Object.create?function(o,n){Object.defineProperty(o,"default",{enumerable:!0,value:n})}:function(o,n){o.default=n}),h=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(o!=null)for(var t in o)t!=="default"&&Object.prototype.hasOwnProperty.call(o,t)&&m(n,o,t);return p(n,o),n};Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLContext=c.linearSearchLastTrue=void 0;const d=y(2235),u=h(y(9622)),l=y(432);function a(o){let n=0;for(;nthis.isTimerResultAvailable(o)),this.getTimerResult(o)}async createAndWaitForFence(){const o=this.createFence(this.gl);return this.pollFence(o)}createFence(o){let n;const t=o,e=t.fenceSync(t.SYNC_GPU_COMMANDS_COMPLETE,0);return o.flush(),n=e===null?()=>!0:()=>{const r=t.clientWaitSync(e,0,0);return r===t.ALREADY_SIGNALED||r===t.CONDITION_SATISFIED},{query:e,isFencePassed:n}}async pollFence(o){return new Promise(n=>{this.addItemToPoll(()=>o.isFencePassed(),()=>n())})}pollItems(){const o=a(this.itemsToPoll.map(n=>n.isDoneFn));for(let n=0;n<=o;++n){const{resolveFn:t}=this.itemsToPoll[n];t()}this.itemsToPoll=this.itemsToPoll.slice(o+1)}async addItemToPoll(o,n){this.itemsToPoll.push({isDoneFn:o,resolveFn:n}),this.itemsToPoll.length>1||await(0,l.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},6496:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExecutionPlan=void 0;const m=y(1315);class p{constructor(d,u){this.op=d,this.node=u}}c.ExecutionPlan=class{constructor(h,d,u){this.graph=h,this.profiler=u,this.initialize(d)}initialize(h){this.profiler.event("session","ExecutionPlan.initialize",()=>{const d=this.graph.getNodes();if(d.length!==h.length)throw new Error("The size of nodes and OPs do not match.");this._ops=h.map((u,l)=>new p(u,d[l])),this.reset(),this._starter=[],this._ops.forEach((u,l)=>{let a=!0;for(const o of u.node.inputs)if(!this._values[o]&&this.graph.getInputIndices().indexOf(o)===-1){a=!1;break}a&&this._starter.push(l)})})}reset(){this._values=this.graph.getValues().map(h=>h.tensor)}async execute(h,d){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const u=h.createInferenceHandler(),l=this.graph.getInputIndices();if(d.length!==l.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${d.length} expected: ${l.length}`);d.forEach((r,i)=>{const s=l[i];this._values[s]=r});const a=this._starter.slice(0),o=this.graph.getValues(),n=this.graph.getNodes();let t=0;for(;tthis._values[v]);if(s.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${i.node}`);const f=s;m.Logger.verbose("ExecPlan",`Runing op:${i.node.name} (${f.map((v,w)=>`'${i.node.inputs[w]}': ${v.type}[${v.dims.join(",")}]`).join(", ")})`);const g=await this.profiler.event("node",i.node.name,async()=>i.op.impl(u,f,i.op.context));if(g.length!==i.node.outputs.length)throw new Error("the size of output does not match model definition.");g.forEach((v,w)=>{const T=i.node.outputs[w];if(this._values[T])throw new Error(`output [${T}] already has value: op:${i.node.name}`);this._values[T]=v});const b=new Set;g.forEach((v,w)=>{const T=i.node.outputs[w];for(const x of o[T].to){const A=n[x];let D=!0;for(const k of A.inputs)if(!this._values[k]){D=!1;break}D&&b.add(x)}}),a.push(...b)}const e=[];for(let r=0;r{Object.defineProperty(c,"__esModule",{value:!0}),c.Graph=void 0;const m=y(6874),p=y(5127),h=y(2446),d=y(9240),u=y(7273);var l=p.onnxruntime.experimental.fbs;c.Graph={from:(t,e)=>new n(t,e)};class a{constructor(e){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,e&&(this.type=u.ProtoUtil.tensorValueTypeFromProto(e.type.tensorType))}get from(){return this._from}get to(){return this._to}}class o{constructor(e,r){e instanceof h.onnx.NodeProto?(this.name=e.name,this.opType=e.opType,this.attributes=new m.Attribute(e.attribute)):e instanceof l.Node&&(this.name=r??e.name(),this.opType=e.opType(),this.attributes=new m.Attribute(u.ProtoUtil.tensorAttributesFromORTFormat(e))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class n{constructor(e,r){if(!e)throw new TypeError("graph is empty");this.buildGraph(e),this.transformGraph(r),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(e){if(e instanceof h.onnx.GraphProto)this.buildGraphFromOnnxFormat(e);else{if(!(e instanceof l.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(e)}}buildGraphFromOnnxFormat(e){const r=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const i=new Map;if(!e.input)throw new Error("missing information in graph: input");const s=[];for(const f of e.input){if(r.has(f.name))throw new Error(`duplicated input name: ${f.name}`);const g=this._allData.push(new a(f))-1;r.set(f.name,g),s.push(f.name)}if(!e.initializer)throw new Error("missing information in graph: initializer");for(const f of e.initializer){let g=r.get(f.name);if(g===void 0){const b=new a;b.type={shape:{dims:u.ProtoUtil.tensorDimsFromProto(f.dims)},tensorType:u.ProtoUtil.tensorDataTypeFromProto(f.dataType)},g=this._allData.push(b)-1,r.set(f.name,g)}this._allData[g]._from=-1,this._allData[g].tensor=d.Tensor.fromProto(f)}for(let f=0;f{this._allData[s]._to.forEach(f=>{e.add(f)})});const r=Array.from(e),i=new Array(this._nodes.length).fill("white");for(;r.length>0;){const s=r.pop();i[s]==="gray"?i[s]="black":(r.push(s),i[s]="gray",this._nodes[s].outputs.forEach(f=>{const g=this._allData[f];if(g.tensor!==void 0)throw new Error("node outputs should not be initialized");if(g._from!==s)throw new Error("from property of the Value object doesn't match index of Node being processed");g._to.forEach(b=>{if(i[b]==="gray")throw new Error("model graph is cyclic");i[b]==="white"&&r.push(b)})}))}}transformGraph(e){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),e&&e.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let e=0;const r=new Array(this._nodes.length,0);let i=0;for(let s=0;s{this._allData[f]._from=-2});this._nodes.splice(i,this._nodes.length-i);for(let s=0;s=0))throw new Error("Trying to update a removed node");f._to[g]=r[f._to[g]]}}e=0;for(let s=0;s0){let f=-1;this._allData[s].from!==void 0&&this._allData[s].from!==-1?(f=this._nodes[this._allData[s].from].outputs.indexOf(s+e),f!==-1&&(this._nodes[this._allData[s].from].outputs[f]=s)):(f=this._allInputIndices.indexOf(s+e),f!==-1&&(this._allInputIndices[f]=s)),this._allData[s].to.forEach(g=>{f=this._nodes[g].inputs.indexOf(s+e),f!==-1&&(this._nodes[g].inputs[f]=s)}),this._allData[s].to.length===0&&(f=this._allOutputIndices.indexOf(s+e),f!==-1&&(this._allOutputIndices[f]=s))}}else e++,this._allData.splice(s,1),s--}deleteNode(e){const r=this._nodes[e];if(r.outputs.length>1){for(let b=1;b0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}r.executeNode=!1;const i=r.inputs[0],s=r.outputs[0],f=this._allData[s].to;for(let b=0;b0)for(const b of f){const v=this._nodes[b].inputs.indexOf(s);if(v===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[b].inputs[v]=i,this._allData[i].to.push(b)}}removeAllDropoutNodes(){let e=0;for(const r of this._nodes){if(r.opType==="Dropout"){if(r.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(r.outputs.length!==1&&r.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(r.outputs.length===2&&this._allData[r.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(e)}e++}}removeAllIdentityNodes(){let e=0;for(const r of this._nodes)r.opType==="Identity"&&this.deleteNode(e),e++}isActivation(e){switch(e.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const e of this._nodes)if(e.opType==="Conv"){const r=this._allData[e.outputs[0]]._to;if(r.length===1&&this.isActivation(this._nodes[r[0]])){const i=this._nodes[r[0]];if(i.opType==="Clip")if(i.inputs.length===1)try{e.attributes.set("activation_params","floats",[i.attributes.getFloat("min"),i.attributes.getFloat("max")])}catch{e.attributes.set("activation_params","floats",[u.MIN_CLIP,u.MAX_CLIP])}else{if(!(i.inputs.length>=3&&this._allData[i.inputs[1]].tensor!==void 0&&this._allData[i.inputs[2]].tensor!==void 0))continue;e.attributes.set("activation_params","floats",[this._allData[i.inputs[1]].tensor.floatData[0],this._allData[i.inputs[2]].tensor.floatData[0]])}e.attributes.set("activation","string",i.opType),this.deleteNode(r[0])}}}}},1315:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.now=c.Profiler=c.Logger=void 0;const y={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},m={none:new class{log(o,n,t){}},console:new class{log(o,n,t){console.log(`${this.color(o)} ${t?"\x1B[35m"+t+"\x1B[0m ":""}${n}`)}color(o){switch(o){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: ${o}`)}}}},p={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let h={"":p};function d(o,n,t,e){if(n===void 0)return r=o,{verbose:d.verbose.bind(null,r),info:d.info.bind(null,r),warning:d.warning.bind(null,r),error:d.error.bind(null,r),fatal:d.fatal.bind(null,r)};if(t===void 0)u(o,n);else if(typeof t=="number"&&e===void 0)u(o,n);else if(typeof t=="string"&&e===void 0)u(o,t,0,n);else{if(typeof t!="string"||typeof e!="number")throw new TypeError("input is valid");u(o,t,0,n)}var r}function u(o,n,t,e){const r=h[e||""]||h[""];y[o]{s.then(async b=>{r&&await r.end(),f(b)},async b=>{r&&await r.end(),g(b)})});if(!i&&r){const f=r.end();if(f&&typeof f.then=="function")return new Promise((g,b)=>{f.then(()=>{g(s)},v=>{b(v)})})}return s}begin(o,n,t){if(!this._started)throw new Error("profiler is not started yet");if(t===void 0){const e=(0,c.now)();return this.flush(e),new l(o,n,e,r=>this.endSync(r))}{const e=t.beginTimer();return new l(o,n,0,async r=>this.end(r),e,t)}}async end(o){const n=await o.checkTimer();this._timingEvents.length=this._flushBatchSize||o-this._flushTime>=this._flushIntervalInMilliseconds){for(const n=this._flushPointer;this._flushPointerperformance.now():Date.now},1745:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Model=void 0;const m=y(5686),p=y(4662),h=y(5127),d=y(2446),u=y(7273);var l=h.onnxruntime.experimental.fbs;c.Model=class{constructor(){}load(a,o,n){if(!n)try{return void this.loadFromOnnxFormat(a,o)}catch(t){if(n!==void 0)throw t}this.loadFromOrtFormat(a,o)}loadFromOnnxFormat(a,o){const n=d.onnx.ModelProto.decode(a);if(u.LongUtil.longToNumber(n.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=n.opsetImport.map(t=>({domain:t.domain,version:u.LongUtil.longToNumber(t.version)})),this._graph=p.Graph.from(n.graph,o)}loadFromOrtFormat(a,o){const n=new m.flatbuffers.ByteBuffer(a),t=l.InferenceSession.getRootAsInferenceSession(n).model();if(u.LongUtil.longToNumber(t.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let e=0;e{Object.defineProperty(c,"__esModule",{value:!0}),c.FLOAT_TYPES=c.INT_TYPES=c.NUMBER_TYPES=void 0,c.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],c.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],c.FLOAT_TYPES=["float32","float64"]},5881:($,c)=>{function y(m,p){if(p.endsWith("+")){const h=Number.parseInt(p.substring(0,p.length-1),10);return!isNaN(h)&&h<=m}if(p.split("-").length===2){const h=p.split("-"),d=Number.parseInt(h[0],10),u=Number.parseInt(h[1],10);return!isNaN(d)&&!isNaN(u)&&d<=m&&m<=u}return Number.parseInt(p,10)===m}Object.defineProperty(c,"__esModule",{value:!0}),c.resolveOperator=void 0,c.resolveOperator=function(m,p,h){for(const d of h){const u=d[0],l=d[1],a=d[2],o=d[3],n=d[4];if(m.opType===u){for(const t of p)if((t.domain===l||t.domain==="ai.onnx"&&l==="")&&y(t.version,a))return{opImpl:o,opInit:n}}}throw new TypeError(`cannot resolve operator '${m.opType}' with opsets: ${p.map(d=>`${d.domain||"ai.onnx"} v${d.version}`).join(", ")}`)}},5127:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.onnxruntime=void 0;const m=y(5686);var p,h;p=c.onnxruntime||(c.onnxruntime={}),function(d){(function(u){u[u.UNDEFINED=0]="UNDEFINED",u[u.FLOAT=1]="FLOAT",u[u.INT=2]="INT",u[u.STRING=3]="STRING",u[u.TENSOR=4]="TENSOR",u[u.GRAPH=5]="GRAPH",u[u.FLOATS=6]="FLOATS",u[u.INTS=7]="INTS",u[u.STRINGS=8]="STRINGS",u[u.TENSORS=9]="TENSORS",u[u.GRAPHS=10]="GRAPHS",u[u.SPARSE_TENSOR=11]="SPARSE_TENSOR",u[u.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(d.AttributeType||(d.AttributeType={}))}((h=p.experimental||(p.experimental={})).fbs||(h.fbs={})),function(d){(function(u){(function(l){(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.VALUE=1]="VALUE",a[a.PARAM=2]="PARAM"})(l.DimensionValueType||(l.DimensionValueType={}))})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){(function(a){a[a.UNDEFINED=0]="UNDEFINED",a[a.FLOAT=1]="FLOAT",a[a.UINT8=2]="UINT8",a[a.INT8=3]="INT8",a[a.UINT16=4]="UINT16",a[a.INT16=5]="INT16",a[a.INT32=6]="INT32",a[a.INT64=7]="INT64",a[a.STRING=8]="STRING",a[a.BOOL=9]="BOOL",a[a.FLOAT16=10]="FLOAT16",a[a.DOUBLE=11]="DOUBLE",a[a.UINT32=12]="UINT32",a[a.UINT64=13]="UINT64",a[a.COMPLEX64=14]="COMPLEX64",a[a.COMPLEX128=15]="COMPLEX128",a[a.BFLOAT16=16]="BFLOAT16",a[a.FLOAT8E4M3FN=17]="FLOAT8E4M3FN",a[a.FLOAT8E4M3FNUZ=18]="FLOAT8E4M3FNUZ",a[a.FLOAT8E5M2=19]="FLOAT8E5M2",a[a.FLOAT8E5M2FNUZ=20]="FLOAT8E5M2FNUZ"})(l.TensorDataType||(l.TensorDataType={}))})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){(function(a){a[a.Primitive=0]="Primitive",a[a.Fused=1]="Fused"})(l.NodeType||(l.NodeType={}))})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){(function(a){a[a.NONE=0]="NONE",a[a.tensor_type=1]="tensor_type",a[a.sequence_type=2]="sequence_type",a[a.map_type=3]="map_type"})(l.TypeInfoValue||(l.TypeInfoValue={}))})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsShape(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsShape(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}dim(n,t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new d.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){n.addFieldOffset(0,t,0)}static createDimVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startDimVector(n,t){n.startVector(4,t,4)}static endShape(n){return n.endObject()}static createShape(n,t){return a.startShape(n),a.addDim(n,t),a.endShape(n)}}l.Shape=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsDimension(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimension(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}value(n){let t=this.bb.__offset(this.bb_pos,4);return t?(n||new d.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}denotation(n){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,n):null}static startDimension(n){n.startObject(2)}static addValue(n,t){n.addFieldOffset(0,t,0)}static addDenotation(n,t){n.addFieldOffset(1,t,0)}static endDimension(n){return n.endObject()}static createDimension(n,t,e){return a.startDimension(n),a.addValue(n,t),a.addDenotation(n,e),a.endDimension(n)}}l.Dimension=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsDimensionValue(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimensionValue(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__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):d.experimental.fbs.DimensionValueType.UNKNOWN}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 t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__string(this.bb_pos+t,n):null}static startDimensionValue(n){n.startObject(3)}static addDimType(n,t){n.addFieldInt8(0,t,d.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(n,t){n.addFieldInt64(1,t,n.createLong(0,0))}static addDimParam(n,t){n.addFieldOffset(2,t,0)}static endDimensionValue(n){return n.endObject()}static createDimensionValue(n,t,e,r){return a.startDimensionValue(n),a.addDimType(n,t),a.addDimValue(n,e),a.addDimParam(n,r),a.endDimensionValue(n)}}l.DimensionValue=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsTensorTypeAndShape(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensorTypeAndShape(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__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):d.experimental.fbs.TensorDataType.UNDEFINED}shape(n){let t=this.bb.__offset(this.bb_pos,6);return t?(n||new d.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startTensorTypeAndShape(n){n.startObject(2)}static addElemType(n,t){n.addFieldInt32(0,t,d.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(n,t){n.addFieldOffset(1,t,0)}static endTensorTypeAndShape(n){return n.endObject()}static createTensorTypeAndShape(n,t,e){return a.startTensorTypeAndShape(n),a.addElemType(n,t),a.addShape(n,e),a.endTensorTypeAndShape(n)}}l.TensorTypeAndShape=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsMapType(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsMapType(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__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):d.experimental.fbs.TensorDataType.UNDEFINED}valueType(n){let t=this.bb.__offset(this.bb_pos,6);return t?(n||new d.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startMapType(n){n.startObject(2)}static addKeyType(n,t){n.addFieldInt32(0,t,d.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(n,t){n.addFieldOffset(1,t,0)}static endMapType(n){return n.endObject()}static createMapType(n,t,e){return a.startMapType(n),a.addKeyType(n,t),a.addValueType(n,e),a.endMapType(n)}}l.MapType=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsSequenceType(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSequenceType(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}elemType(n){let t=this.bb.__offset(this.bb_pos,4);return t?(n||new d.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startSequenceType(n){n.startObject(1)}static addElemType(n,t){n.addFieldOffset(0,t,0)}static endSequenceType(n){return n.endObject()}static createSequenceType(n,t){return a.startSequenceType(n),a.addElemType(n,t),a.endSequenceType(n)}}l.SequenceType=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(u.fbs||(u.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(l,a){return this.bb_pos=l,this.bb=a,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(l,a,o,n){return l.prep(4,12),l.writeInt32(n),l.writeInt32(o),l.writeInt32(a),l.offset()}}})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsNodeEdge(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNodeEdge(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__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,t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new d.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+e)+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,t){let e=this.bb.__offset(this.bb_pos,8);return e?(t||new d.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+e)+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,t){n.addFieldInt32(0,t,0)}static addInputEdges(n,t){n.addFieldOffset(1,t,0)}static startInputEdgesVector(n,t){n.startVector(12,t,4)}static addOutputEdges(n,t){n.addFieldOffset(2,t,0)}static startOutputEdgesVector(n,t){n.startVector(12,t,4)}static endNodeEdge(n){return n.endObject()}static createNodeEdge(n,t,e,r){return a.startNodeEdge(n),a.addNodeIndex(n,t),a.addInputEdges(n,e),a.addOutputEdges(n,r),a.endNodeEdge(n)}}l.NodeEdge=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsNode(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNode(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}name(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,n):null}docString(n){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,n):null}domain(n){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__string(this.bb_pos+t,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 t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__string(this.bb_pos+t,n):null}type(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.readInt32(this.bb_pos+n):d.experimental.fbs.NodeType.Primitive}executionProviderType(n){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__string(this.bb_pos+t,n):null}inputs(n,t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__string(this.bb.__vector(this.bb_pos+e)+4*n,t):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,20);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,t){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.__string(this.bb.__vector(this.bb_pos+e)+4*n,t):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,22);return n?this.bb.__vector_len(this.bb_pos+n):0}attributes(n,t){let e=this.bb.__offset(this.bb_pos,24);return e?(t||new d.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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 t=this.bb.__offset(this.bb_pos,26);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+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,t){let e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb.__vector(this.bb_pos+e)+4*n,t):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,t){n.addFieldOffset(0,t,0)}static addDocString(n,t){n.addFieldOffset(1,t,0)}static addDomain(n,t){n.addFieldOffset(2,t,0)}static addSinceVersion(n,t){n.addFieldInt32(3,t,0)}static addIndex(n,t){n.addFieldInt32(4,t,0)}static addOpType(n,t){n.addFieldOffset(5,t,0)}static addType(n,t){n.addFieldInt32(6,t,d.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(n,t){n.addFieldOffset(7,t,0)}static addInputs(n,t){n.addFieldOffset(8,t,0)}static createInputsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startInputsVector(n,t){n.startVector(4,t,4)}static addOutputs(n,t){n.addFieldOffset(9,t,0)}static createOutputsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startOutputsVector(n,t){n.startVector(4,t,4)}static addAttributes(n,t){n.addFieldOffset(10,t,0)}static createAttributesVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startAttributesVector(n,t){n.startVector(4,t,4)}static addInputArgCounts(n,t){n.addFieldOffset(11,t,0)}static createInputArgCountsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addInt32(t[e]);return n.endVector()}static startInputArgCountsVector(n,t){n.startVector(4,t,4)}static addImplicitInputs(n,t){n.addFieldOffset(12,t,0)}static createImplicitInputsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startImplicitInputsVector(n,t){n.startVector(4,t,4)}static endNode(n){return n.endObject()}static createNode(n,t,e,r,i,s,f,g,b,v,w,T,x,A){return a.startNode(n),a.addName(n,t),a.addDocString(n,e),a.addDomain(n,r),a.addSinceVersion(n,i),a.addIndex(n,s),a.addOpType(n,f),a.addType(n,g),a.addExecutionProviderType(n,b),a.addInputs(n,v),a.addOutputs(n,w),a.addAttributes(n,T),a.addInputArgCounts(n,x),a.addImplicitInputs(n,A),a.endNode(n)}}l.Node=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsValueInfo(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsValueInfo(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}name(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,n):null}docString(n){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,n):null}type(n){let t=this.bb.__offset(this.bb_pos,8);return t?(n||new d.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startValueInfo(n){n.startObject(3)}static addName(n,t){n.addFieldOffset(0,t,0)}static addDocString(n,t){n.addFieldOffset(1,t,0)}static addType(n,t){n.addFieldOffset(2,t,0)}static endValueInfo(n){return n.endObject()}static createValueInfo(n,t,e,r){return a.startValueInfo(n),a.addName(n,t),a.addDocString(n,e),a.addType(n,r),a.endValueInfo(n)}}l.ValueInfo=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsTypeInfo(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTypeInfo(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}denotation(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,n):null}valueType(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readUint8(this.bb_pos+n):d.experimental.fbs.TypeInfoValue.NONE}value(n){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(n,this.bb_pos+t):null}static startTypeInfo(n){n.startObject(3)}static addDenotation(n,t){n.addFieldOffset(0,t,0)}static addValueType(n,t){n.addFieldInt8(1,t,d.experimental.fbs.TypeInfoValue.NONE)}static addValue(n,t){n.addFieldOffset(2,t,0)}static endTypeInfo(n){return n.endObject()}static createTypeInfo(n,t,e,r){return a.startTypeInfo(n),a.addDenotation(n,t),a.addValueType(n,e),a.addValue(n,r),a.endTypeInfo(n)}}l.TypeInfo=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsOperatorSetId(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsOperatorSetId(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}domain(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,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,t){n.addFieldOffset(0,t,0)}static addVersion(n,t){n.addFieldInt64(1,t,n.createLong(0,0))}static endOperatorSetId(n){return n.endObject()}static createOperatorSetId(n,t,e){return a.startOperatorSetId(n),a.addDomain(n,t),a.addVersion(n,e),a.endOperatorSetId(n)}}l.OperatorSetId=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsTensor(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensor(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}name(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,n):null}docString(n){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,n):null}dims(n){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+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):d.experimental.fbs.TensorDataType.UNDEFINED}rawData(n){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint8(this.bb.__vector(this.bb_pos+t)+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,t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb.__vector(this.bb_pos+e)+4*n,t):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,t){n.addFieldOffset(0,t,0)}static addDocString(n,t){n.addFieldOffset(1,t,0)}static addDims(n,t){n.addFieldOffset(2,t,0)}static createDimsVector(n,t){n.startVector(8,t.length,8);for(let e=t.length-1;e>=0;e--)n.addInt64(t[e]);return n.endVector()}static startDimsVector(n,t){n.startVector(8,t,8)}static addDataType(n,t){n.addFieldInt32(3,t,d.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(n,t){n.addFieldOffset(4,t,0)}static createRawDataVector(n,t){n.startVector(1,t.length,1);for(let e=t.length-1;e>=0;e--)n.addInt8(t[e]);return n.endVector()}static startRawDataVector(n,t){n.startVector(1,t,1)}static addStringData(n,t){n.addFieldOffset(5,t,0)}static createStringDataVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startStringDataVector(n,t){n.startVector(4,t,4)}static endTensor(n){return n.endObject()}static createTensor(n,t,e,r,i,s,f){return a.startTensor(n),a.addName(n,t),a.addDocString(n,e),a.addDims(n,r),a.addDataType(n,i),a.addRawData(n,s),a.addStringData(n,f),a.endTensor(n)}}l.Tensor=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsSparseTensor(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSparseTensor(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}values(n){let t=this.bb.__offset(this.bb_pos,4);return t?(n||new d.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}indices(n){let t=this.bb.__offset(this.bb_pos,6);return t?(n||new d.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dims(n){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+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,t){n.addFieldOffset(0,t,0)}static addIndices(n,t){n.addFieldOffset(1,t,0)}static addDims(n,t){n.addFieldOffset(2,t,0)}static createDimsVector(n,t){n.startVector(8,t.length,8);for(let e=t.length-1;e>=0;e--)n.addInt64(t[e]);return n.endVector()}static startDimsVector(n,t){n.startVector(8,t,8)}static endSparseTensor(n){return n.endObject()}static createSparseTensor(n,t,e,r){return a.startSparseTensor(n),a.addValues(n,t),a.addIndices(n,e),a.addDims(n,r),a.endSparseTensor(n)}}l.SparseTensor=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsAttribute(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsAttribute(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}name(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,n):null}docString(n){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,n):null}type(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.readInt32(this.bb_pos+n):d.experimental.fbs.AttributeType.UNDEFINED}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 t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__string(this.bb_pos+t,n):null}t(n){let t=this.bb.__offset(this.bb_pos,16);return t?(n||new d.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}g(n){let t=this.bb.__offset(this.bb_pos,18);return t?(n||new d.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}floats(n){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readFloat32(this.bb.__vector(this.bb_pos+t)+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 t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+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,t){let e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb.__vector(this.bb_pos+e)+4*n,t):null}stringsLength(){let n=this.bb.__offset(this.bb_pos,24);return n?this.bb.__vector_len(this.bb_pos+n):0}tensors(n,t){let e=this.bb.__offset(this.bb_pos,26);return e?(t||new d.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){let e=this.bb.__offset(this.bb_pos,28);return e?(t||new d.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){n.addFieldOffset(0,t,0)}static addDocString(n,t){n.addFieldOffset(1,t,0)}static addType(n,t){n.addFieldInt32(2,t,d.experimental.fbs.AttributeType.UNDEFINED)}static addF(n,t){n.addFieldFloat32(3,t,0)}static addI(n,t){n.addFieldInt64(4,t,n.createLong(0,0))}static addS(n,t){n.addFieldOffset(5,t,0)}static addT(n,t){n.addFieldOffset(6,t,0)}static addG(n,t){n.addFieldOffset(7,t,0)}static addFloats(n,t){n.addFieldOffset(8,t,0)}static createFloatsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addFloat32(t[e]);return n.endVector()}static startFloatsVector(n,t){n.startVector(4,t,4)}static addInts(n,t){n.addFieldOffset(9,t,0)}static createIntsVector(n,t){n.startVector(8,t.length,8);for(let e=t.length-1;e>=0;e--)n.addInt64(t[e]);return n.endVector()}static startIntsVector(n,t){n.startVector(8,t,8)}static addStrings(n,t){n.addFieldOffset(10,t,0)}static createStringsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startStringsVector(n,t){n.startVector(4,t,4)}static addTensors(n,t){n.addFieldOffset(11,t,0)}static createTensorsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startTensorsVector(n,t){n.startVector(4,t,4)}static addGraphs(n,t){n.addFieldOffset(12,t,0)}static createGraphsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startGraphsVector(n,t){n.startVector(4,t,4)}static endAttribute(n){return n.endObject()}static createAttribute(n,t,e,r,i,s,f,g,b,v,w,T,x,A){return a.startAttribute(n),a.addName(n,t),a.addDocString(n,e),a.addType(n,r),a.addF(n,i),a.addI(n,s),a.addS(n,f),a.addT(n,g),a.addG(n,b),a.addFloats(n,v),a.addInts(n,w),a.addStrings(n,T),a.addTensors(n,x),a.addGraphs(n,A),a.endAttribute(n)}}l.Attribute=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsGraph(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsGraph(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}initializers(n,t){let e=this.bb.__offset(this.bb_pos,4);return e?(t||new d.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new d.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){let e=this.bb.__offset(this.bb_pos,8);return e?(t||new d.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new d.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb.__vector(this.bb_pos+e)+4*n,t):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,t){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__string(this.bb.__vector(this.bb_pos+e)+4*n,t):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.__vector_len(this.bb_pos+n):0}sparseInitializers(n,t){let e=this.bb.__offset(this.bb_pos,18);return e?(t||new d.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){n.addFieldOffset(0,t,0)}static createInitializersVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startInitializersVector(n,t){n.startVector(4,t,4)}static addNodeArgs(n,t){n.addFieldOffset(1,t,0)}static createNodeArgsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startNodeArgsVector(n,t){n.startVector(4,t,4)}static addNodes(n,t){n.addFieldOffset(2,t,0)}static createNodesVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startNodesVector(n,t){n.startVector(4,t,4)}static addMaxNodeIndex(n,t){n.addFieldInt32(3,t,0)}static addNodeEdges(n,t){n.addFieldOffset(4,t,0)}static createNodeEdgesVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startNodeEdgesVector(n,t){n.startVector(4,t,4)}static addInputs(n,t){n.addFieldOffset(5,t,0)}static createInputsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startInputsVector(n,t){n.startVector(4,t,4)}static addOutputs(n,t){n.addFieldOffset(6,t,0)}static createOutputsVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startOutputsVector(n,t){n.startVector(4,t,4)}static addSparseInitializers(n,t){n.addFieldOffset(7,t,0)}static createSparseInitializersVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startSparseInitializersVector(n,t){n.startVector(4,t,4)}static endGraph(n){return n.endObject()}static createGraph(n,t,e,r,i,s,f,g,b){return a.startGraph(n),a.addInitializers(n,t),a.addNodeArgs(n,e),a.addNodes(n,r),a.addMaxNodeIndex(n,i),a.addNodeEdges(n,s),a.addInputs(n,f),a.addOutputs(n,g),a.addSparseInitializers(n,b),a.endGraph(n)}}l.Graph=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsModel(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsModel(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__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,t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new d.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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 t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__string(this.bb_pos+t,n):null}producerVersion(n){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__string(this.bb_pos+t,n):null}domain(n){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__string(this.bb_pos+t,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 t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__string(this.bb_pos+t,n):null}graph(n){let t=this.bb.__offset(this.bb_pos,18);return t?(n||new d.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}graphDocString(n){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__string(this.bb_pos+t,n):null}static startModel(n){n.startObject(9)}static addIrVersion(n,t){n.addFieldInt64(0,t,n.createLong(0,0))}static addOpsetImport(n,t){n.addFieldOffset(1,t,0)}static createOpsetImportVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startOpsetImportVector(n,t){n.startVector(4,t,4)}static addProducerName(n,t){n.addFieldOffset(2,t,0)}static addProducerVersion(n,t){n.addFieldOffset(3,t,0)}static addDomain(n,t){n.addFieldOffset(4,t,0)}static addModelVersion(n,t){n.addFieldInt64(5,t,n.createLong(0,0))}static addDocString(n,t){n.addFieldOffset(6,t,0)}static addGraph(n,t){n.addFieldOffset(7,t,0)}static addGraphDocString(n,t){n.addFieldOffset(8,t,0)}static endModel(n){return n.endObject()}static createModel(n,t,e,r,i,s,f,g,b,v){return a.startModel(n),a.addIrVersion(n,t),a.addOpsetImport(n,e),a.addProducerName(n,r),a.addProducerVersion(n,i),a.addDomain(n,s),a.addModelVersion(n,f),a.addDocString(n,g),a.addGraph(n,b),a.addGraphDocString(n,v),a.endModel(n)}}l.Model=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsKernelCreateInfos(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsKernelCreateInfos(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}nodeIndices(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb.__vector(this.bb_pos+t)+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 t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint64(this.bb.__vector(this.bb_pos+t)+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,t){n.addFieldOffset(0,t,0)}static createNodeIndicesVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addInt32(t[e]);return n.endVector()}static startNodeIndicesVector(n,t){n.startVector(4,t,4)}static addKernelDefHashes(n,t){n.addFieldOffset(1,t,0)}static createKernelDefHashesVector(n,t){n.startVector(8,t.length,8);for(let e=t.length-1;e>=0;e--)n.addInt64(t[e]);return n.endVector()}static startKernelDefHashesVector(n,t){n.startVector(8,t,8)}static endKernelCreateInfos(n){return n.endObject()}static createKernelCreateInfos(n,t,e){return a.startKernelCreateInfos(n),a.addNodeIndices(n,t),a.addKernelDefHashes(n,e),a.endKernelCreateInfos(n)}}l.KernelCreateInfos=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsSubGraphSessionState(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSubGraphSessionState(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}graphId(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,n):null}sessionState(n){let t=this.bb.__offset(this.bb_pos,6);return t?(n||new d.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startSubGraphSessionState(n){n.startObject(2)}static addGraphId(n,t){n.addFieldOffset(0,t,0)}static addSessionState(n,t){n.addFieldOffset(1,t,0)}static endSubGraphSessionState(n){let t=n.endObject();return n.requiredField(t,4),t}static createSubGraphSessionState(n,t,e){return a.startSubGraphSessionState(n),a.addGraphId(n,t),a.addSessionState(n,e),a.endSubGraphSessionState(n)}}l.SubGraphSessionState=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsSessionState(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSessionState(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}kernels(n){let t=this.bb.__offset(this.bb_pos,4);return t?(n||new d.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}subGraphSessionStates(n,t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new d.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+e)+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,t){n.addFieldOffset(0,t,0)}static addSubGraphSessionStates(n,t){n.addFieldOffset(1,t,0)}static createSubGraphSessionStatesVector(n,t){n.startVector(4,t.length,4);for(let e=t.length-1;e>=0;e--)n.addOffset(t[e]);return n.endVector()}static startSubGraphSessionStatesVector(n,t){n.startVector(4,t,4)}static endSessionState(n){return n.endObject()}static createSessionState(n,t,e){return a.startSessionState(n),a.addKernels(n,t),a.addSubGraphSessionStates(n,e),a.endSessionState(n)}}l.SessionState=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(d){(function(u){(function(l){class a{constructor(){this.bb=null,this.bb_pos=0}__init(n,t){return this.bb_pos=n,this.bb=t,this}static getRootAsInferenceSession(n,t){return(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsInferenceSession(n,t){return n.setPosition(n.position()+m.flatbuffers.SIZE_PREFIX_LENGTH),(t||new a).__init(n.readInt32(n.position())+n.position(),n)}static bufferHasIdentifier(n){return n.__has_identifier("ORTM")}ortVersion(n){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,n):null}model(n){let t=this.bb.__offset(this.bb_pos,6);return t?(n||new d.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}sessionState(n){let t=this.bb.__offset(this.bb_pos,8);return t?(n||new d.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startInferenceSession(n){n.startObject(3)}static addOrtVersion(n,t){n.addFieldOffset(0,t,0)}static addModel(n,t){n.addFieldOffset(1,t,0)}static addSessionState(n,t){n.addFieldOffset(2,t,0)}static endInferenceSession(n){return n.endObject()}static finishInferenceSessionBuffer(n,t){n.finish(t,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(n,t){n.finish(t,"ORTM",!0)}static createInferenceSession(n,t,e,r){return a.startInferenceSession(n),a.addOrtVersion(n,t),a.addModel(n,e),a.addSessionState(n,r),a.endInferenceSession(n)}}l.InferenceSession=a})(u.fbs||(u.fbs={}))})(d.experimental||(d.experimental={}))}(c.onnxruntime||(c.onnxruntime={}))},1723:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OnnxjsSessionHandler=void 0;const m=y(2235),p=y(9240);c.OnnxjsSessionHandler=class{constructor(h){this.session=h,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(h,d,u){const l=new Map;for(const n in h)if(Object.hasOwnProperty.call(h,n)){const t=h[n];l.set(n,new p.Tensor(t.dims,t.type,void 0,void 0,t.data))}const a=await this.session.run(l),o={};return a.forEach((n,t)=>{o[t]=new m.Tensor(n.type,n.data,n.dims)}),o}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6027:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Session=void 0;const m=y(7067),p=y(1296),h=y(1975),d=y(6496),u=y(1315),l=y(1745);c.Session=class{constructor(a={}){this._initialized=!1,this.backendHint=a.backendHint,this.profiler=u.Profiler.create(a.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(a,o,n){await this.profiler.event("session","Session.loadModel",async()=>{const t=await(0,h.resolveBackend)(this.backendHint);if(this.sessionHandler=t.createSessionHandler(this.context),this._model=new l.Model,typeof a=="string"){const e=a.endsWith(".ort");if(typeof process$1<"u"&&process$1.versions&&process$1.versions.node){const r=await(0,p.promisify)(m.readFile)(a);this.initialize(r,e)}else{const r=await fetch(a),i=await r.arrayBuffer();this.initialize(new Uint8Array(i),e)}}else if(ArrayBuffer.isView(a))this.initialize(a);else{const e=new Uint8Array(a,o||0,n||a.byteLength);this.initialize(e)}})}initialize(a,o){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const n=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(a,n,o),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new d.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(a){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const o=this.normalizeAndValidateInputs(a),n=await this._executionPlan.execute(this.sessionHandler,o);return this.createOutput(n)})}normalizeAndValidateInputs(a){const o=this._model.graph.getInputNames();if(Array.isArray(a)){if(a.length!==o.length)throw new Error(`incorrect input array length: expected ${o.length} but got ${a.length}`)}else{if(a.size!==o.length)throw new Error(`incorrect input map size: expected ${o.length} but got ${a.size}`);const n=new Array(a.size);let t=0;for(let e=0;etypeof A=="string")))throw new TypeError("cache should be a string array");x&&(this.cache=new Array(T))}else{if(v!==void 0){const A=t(f);if(!(v instanceof A))throw new TypeError(`cache should be type ${A.name}`)}if(x){const A=new ArrayBuffer(T*function(D){switch(D){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 ${D}`)}}(f));this.cache=function(D,k){return new(t(k))(D)}(A,f)}}}static fromProto(s){if(!s)throw new Error("cannot construct Value from an empty tensor");const f=l.ProtoUtil.tensorDataTypeFromProto(s.dataType),g=l.ProtoUtil.tensorDimsFromProto(s.dims),b=new o(g,f);if(f==="string")s.stringData.forEach((v,w)=>{b.data[w]=(0,l.decodeUtf8String)(v)});else if(s.rawData&&typeof s.rawData.byteLength=="number"&&s.rawData.byteLength>0){const v=b.data,w=new DataView(s.rawData.buffer,s.rawData.byteOffset,s.rawData.byteLength),T=n(s.dataType),x=s.rawData.byteLength/T;if(s.rawData.byteLength%T!=0)throw new Error("invalid buffer length");if(v.length!==x)throw new Error("buffer length mismatch");for(let A=0;A0){const v=b.data,w=new DataView(s.rawDataArray().buffer,s.rawDataArray().byteOffset,s.rawDataLength()),T=n(s.dataType()),x=s.rawDataLength()/T;if(s.rawDataLength()%T!=0)throw new Error("invalid buffer length");if(v.length!==x)throw new Error("buffer length mismatch");for(let A=0;A1&&k>1)return;x[T-A]=Math.max(D,k)}return x}static index(f,g){const b=new Array(g.length);return a.fillIndex(f,g,b),b}static fillIndex(f,g,b){const v=f.length-g.length;for(let w=0;w=0;q--)D[q]=M%T[q],M=Math.floor(M/T[q]);O||(a.fillIndex(D,f.dims,k),S=f.get(k)),E||(a.fillIndex(D,g.dims,j),U=g.get(j)),A.set(D,b(S,U))}}return A}}static isValidBroadcast(f,g){const b=f.length,v=g.length;if(b>v)return!1;for(let w=1;w<=b;w++)if(f[b-w]!==1&&f[b-w]!==g[v-w])return!1;return!0}static getBroadcastDims(f,g){const b=f.length,v=[];for(let w=0;w1&&x===1&&v.unshift(T)}return v}}c.BroadcastUtil=a,c.arrayCopyHelper=function(s,f,g,b,v){if(b<0||b>=f.length)throw new Error("sourceIndex out of bounds");if(g<0||g>=s.length)throw new Error("targetIndex out of bounds");if(b+v>f.length)throw new Error("source indices to be copied are outside bounds");if(g+v>s.length)throw new Error("target array is too small to hold result");for(let w=0;wh.default.isLong(g)?g.toNumber():g)}static tensorValueTypeFromProto(f){return{tensorType:o.tensorDataTypeFromProto(f.elemType),shape:{dims:o.tensorDimsFromProto(f.shape.dim.map(g=>g.dimValue))}}}static tensorDimsFromORTFormat(f){const g=[];for(let b=0;bf.length)throw new Error(`invalid dimension of ${g} for sizeFromDimension as Tensor has ${f.length} dimensions.`);return t.getSizeFromDimensionRange(f,g,f.length)}static sizeToDimension(f,g){if(g<0||g>f.length)throw new Error(`invalid dimension of ${g} for sizeToDimension as Tensor has ${f.length} dimensions.`);return t.getSizeFromDimensionRange(f,0,g)}static getSizeFromDimensionRange(f,g,b){let v=1;for(let w=g;w=0;--v)b[v]=b[v+1]*f[v+1];return b}static transpose(f){return f.slice().reverse()}static indicesToOffset(f,g,b){b===void 0&&(b=f.length);let v=0;for(let w=0;w=g)throw new Error("unsupported axis for this operation.");return f<0?f+g:f}static normalizeAxes(f,g){return f.map(b=>this.normalizeAxis(b,g))}static incrementIndex(f,g,b){if(g.length===0||f.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(b===void 0)b=g.length;else if(b<=0||b>g.length)throw new Error("Incorrect axis to increment on");for(let v=b-1;v>=0&&(f[v]++,!(f[v]=f.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");v[A]=f[A]}else v[A]=g[A];T*=v[A]}}const x=t.size(f);if(w!==-1){if(x%T!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${f}] Output shape: [${g}]`);v[w]=x/T}else if(T!==x)throw new Error("reshapedDims and originalDims don't have matching sizes");return v}static sortBasedOnPerm(f,g){return g?g.map(b=>f[b]):f.slice().reverse()}static padShape(f,g){const b=f.length;return f.map((v,w)=>v+g[w]+g[w+b])}static areEqual(f,g){return f.length===g.length&&f.every((b,v)=>b===g[v])}static validateDimsAndCalcSize(f){if(f.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let g=1;for(const b of f){if(!Number.isInteger(b))throw new TypeError(`Invalid shape: ${b} is not an integer`);if(b<0||b>2147483647)throw new TypeError(`Invalid shape: length ${b} is not allowed`);g*=b}return g}static flattenShape(f,g){g<0&&(g+=f.length);const b=f.reduce((w,T)=>w*T,1),v=f.slice(g).reduce((w,T)=>w*T,1);return[b/v,v]}static squeezeShape(f,g){const b=new Array;g=t.normalizeAxes(g,f.length);for(let v=0;v=0;if(w&&f[v]!==1)throw new Error("squeeze an axis of size different than 1");(g.length===0&&f[v]>1||g.length>0&&!w)&&b.push(f[v])}return b}static unsqueezeShape(f,g){const b=new Array(f.length+g.length);b.fill(0);for(let w=0;w=b.length)throw new Error("'axes' has an out of range axis");if(b[T]!==0)throw new Error("'axes' has a duplicate axis");b[T]=1}let v=0;for(let w=0;w=f.length)throw new Error("sourceIndex out of bounds");if(g<0||g>=s.length)throw new Error("targetIndex out of bounds");if(b+v>f.length)throw new Error("source indices to be copied are outside bounds");if(g+v>s.length)throw new Error("target array is too small to hold result");for(let w=0;w=f.length)throw new Error("sourceIndex out of bounds");if(g<0||g>=s.length)throw new Error("targetIndex out of bounds");if(b+v>f.length)throw new Error("source indices to be copied are outside bounds");if(g+v>s.length)throw new Error("target array is too small to hold result");for(let T=0;T=f.length)throw new Error("sourceIndex out of bounds");if(g<0||g>=s.length)throw new Error("targetIndex out of bounds");if(b+v>f.length)throw new Error("source indices to be copied are outside bounds");if(g+v>s.length)throw new Error("target array is too small to hold result");for(let T=0;T=f.length)throw new Error("sourceIndex out of bounds");if(g<0||g>=s.length)throw new Error("targetIndex out of bounds");if(b+v>f.length)throw new Error("source indices to be copied are outside bounds");if(g+v>s.length)throw new Error("target array is too small to hold result");for(let w=0;wg.push(U));const x=r.calcReduceShape(T,g,!0),A=t.size(x),D=new u.Tensor(x,f.type),k=t.computeStrides(x),j=t.computeStrides(T),M=new Array(T.length);for(let S=0;S=g.length)return T(f[w]);const D=g[v],k=D>=b.length?1:t.size(b.slice(D+1));for(let j=0;jw!==0)}}c.ReduceUtil=r;class i{static adjustPoolAttributes(f,g,b,v,w,T){if(!f&&b.length!==g.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(f)for(let x=0;x=b.length?b.push(g[x+2]):b[x]=g[x+2];for(let x=0;x=b[x]||T[x+b.length]>=b[x])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(f,g,b,v,w,T){if(T){if(w.length!==2*(f.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(g.length!==f.length-2)throw new Error("length of strides should be the length of data dimensions");if(v.length!==f.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let x=0;x{Object.defineProperty(c,"__esModule",{value:!0}),c.version=void 0,c.version="1.16.3"},9544:function($,c,y){var m,p=this&&this.__createBinding||(Object.create?function(k,j,M,S){S===void 0&&(S=M);var U=Object.getOwnPropertyDescriptor(j,M);U&&!("get"in U?!j.__esModule:U.writable||U.configurable)||(U={enumerable:!0,get:function(){return j[M]}}),Object.defineProperty(k,S,U)}:function(k,j,M,S){S===void 0&&(S=M),k[S]=j[M]}),h=this&&this.__setModuleDefault||(Object.create?function(k,j){Object.defineProperty(k,"default",{enumerable:!0,value:j})}:function(k,j){k.default=j}),d=this&&this.__importStar||function(k){if(k&&k.__esModule)return k;var j={};if(k!=null)for(var M in k)M!=="default"&&Object.prototype.hasOwnProperty.call(k,M)&&p(j,k,M);return h(j,k),j};Object.defineProperty(c,"__esModule",{value:!0}),c.endProfiling=c.run=c.releaseSession=c.createSession=c.createSessionFinalize=c.createSessionAllocate=c.initializeRuntime=c.initializeWebAssemblyInstance=void 0;const u=y(2235),l=d(y(1259)),a=y(263),o=()=>!!u.env.wasm.proxy&&typeof document<"u";let n,t,e,r=!1,i=!1,s=!1;const f=[],g=[],b=[],v=[],w=[],T=[],x=()=>{if(r||!i||s||!n)throw new Error("worker not ready")},A=k=>{switch(k.data.type){case"init-wasm":r=!1,k.data.err?(s=!0,t[1](k.data.err)):(i=!0,t[0]());break;case"init-ort":k.data.err?e[1](k.data.err):e[0]();break;case"create_allocate":k.data.err?f.shift()[1](k.data.err):f.shift()[0](k.data.out);break;case"create_finalize":k.data.err?g.shift()[1](k.data.err):g.shift()[0](k.data.out);break;case"create":k.data.err?b.shift()[1](k.data.err):b.shift()[0](k.data.out);break;case"release":k.data.err?v.shift()[1](k.data.err):v.shift()[0]();break;case"run":k.data.err?w.shift()[1](k.data.err):w.shift()[0](k.data.out);break;case"end-profiling":k.data.err?T.shift()[1](k.data.err):T.shift()[0]()}},D=typeof document<"u"?(m=document==null?void 0:document.currentScript)===null||m===void 0?void 0:m.src:void 0;c.initializeWebAssemblyInstance=async()=>{if(o()){if(i)return;if(r)throw new Error("multiple calls to 'initWasm()' detected.");if(s)throw new Error("previous call to 'initWasm()' failed.");return r=!0,u.env.wasm.wasmPaths===void 0&&D&&D.indexOf("blob:")!==0&&(u.env.wasm.wasmPaths=D.substr(0,+D.lastIndexOf("/")+1)),new Promise((k,j)=>{n==null||n.terminate(),n=y(8050).Z(),n.onmessage=A,t=[k,j];const M={type:"init-wasm",in:u.env.wasm};n.postMessage(M)})}return(0,a.initializeWebAssembly)(u.env.wasm)},c.initializeRuntime=async k=>{if(o())return x(),new Promise((j,M)=>{e=[j,M];const S={type:"init-ort",in:k};n.postMessage(S)});await l.initRuntime(k)},c.createSessionAllocate=async k=>o()?(x(),new Promise((j,M)=>{f.push([j,M]);const S={type:"create_allocate",in:{model:k}};n.postMessage(S,[k.buffer])})):l.createSessionAllocate(k),c.createSessionFinalize=async(k,j)=>o()?(x(),new Promise((M,S)=>{g.push([M,S]);const U={type:"create_finalize",in:{modeldata:k,options:j}};n.postMessage(U)})):l.createSessionFinalize(k,j),c.createSession=async(k,j)=>o()?(x(),new Promise((M,S)=>{b.push([M,S]);const U={type:"create",in:{model:k,options:j}};n.postMessage(U,[k.buffer])})):l.createSession(k,j),c.releaseSession=async k=>{if(o())return x(),new Promise((j,M)=>{v.push([j,M]);const S={type:"release",in:k};n.postMessage(S)});l.releaseSession(k)},c.run=async(k,j,M,S,U)=>o()?(x(),new Promise((O,E)=>{w.push([O,E]);const N={type:"run",in:{sessionId:k,inputIndices:j,inputs:M,outputIndices:S,options:U}};n.postMessage(N,l.extractTransferableBuffers(M))})):l.run(k,j,M,S,U),c.endProfiling=async k=>{if(o())return x(),new Promise((j,M)=>{T.push([j,M]);const S={type:"end-profiling",in:k};n.postMessage(S)});l.endProfiling(k)}},7918:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.setRunOptions=void 0;const m=y(263),p=y(1497);c.setRunOptions=h=>{const d=(0,m.getInstance)();let u=0;const l=[],a=h||{};try{if((h==null?void 0:h.logSeverityLevel)===void 0)a.logSeverityLevel=2;else if(typeof h.logSeverityLevel!="number"||!Number.isInteger(h.logSeverityLevel)||h.logSeverityLevel<0||h.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${h.logSeverityLevel}`);if((h==null?void 0:h.logVerbosityLevel)===void 0)a.logVerbosityLevel=0;else if(typeof h.logVerbosityLevel!="number"||!Number.isInteger(h.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${h.logVerbosityLevel}`);(h==null?void 0:h.terminate)===void 0&&(a.terminate=!1);let o=0;return(h==null?void 0:h.tag)!==void 0&&(o=(0,p.allocWasmString)(h.tag,l)),u=d._OrtCreateRunOptions(a.logSeverityLevel,a.logVerbosityLevel,!!a.terminate,o),u===0&&(0,p.checkLastError)("Can't create run options."),(h==null?void 0:h.extra)!==void 0&&(0,p.iterateExtraOptions)(h.extra,"",new WeakSet,(n,t)=>{const e=(0,p.allocWasmString)(n,l),r=(0,p.allocWasmString)(t,l);d._OrtAddRunConfigEntry(u,e,r)!==0&&(0,p.checkLastError)(`Can't set a run config entry: ${n} - ${t}.`)}),[u,l]}catch(o){throw u!==0&&d._OrtReleaseRunOptions(u),l.forEach(n=>d._free(n)),o}}},6640:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OnnxruntimeWebAssemblySessionHandler=void 0;const m=y(2806),p=y(2235),h=y(2850),d=y(9544);let u;c.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(l){const a=await fetch(l);if(a.status!==200)throw new Error(`failed to load model: ${l}`);const o=await a.arrayBuffer();return(0,d.createSessionAllocate)(new Uint8Array(o))}async loadModel(l,a){if(u||(await(0,d.initializeRuntime)(p.env),u=!0),typeof l=="string")if(typeof process$1<"u"&&process$1.versions&&process$1.versions.node){const o=await(0,h.promisify)(m.readFile)(l);[this.sessionId,this.inputNames,this.outputNames]=await(0,d.createSession)(o,a)}else{const o=await this.createSessionAllocate(l);[this.sessionId,this.inputNames,this.outputNames]=await(0,d.createSessionFinalize)(o,a)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,d.createSession)(l,a)}async dispose(){return(0,d.releaseSession)(this.sessionId)}async run(l,a,o){const n=[],t=[];Object.entries(l).forEach(s=>{const f=s[0],g=s[1],b=this.inputNames.indexOf(f);if(b===-1)throw new Error(`invalid input '${f}'`);n.push(g),t.push(b)});const e=[];Object.entries(a).forEach(s=>{const f=s[0],g=this.outputNames.indexOf(f);if(g===-1)throw new Error(`invalid output '${f}'`);e.push(g)});const r=await(0,d.run)(this.sessionId,t,n.map(s=>[s.type,s.dims,s.data]),e,o),i={};for(let s=0;s{Object.defineProperty(c,"__esModule",{value:!0}),c.setSessionOptions=void 0;const m=y(263),p=y(1497);c.setSessionOptions=h=>{var d,u,l,a;const o=(0,m.getInstance)();let n=0;const t=[],e=h||{};(r=>{r.extra||(r.extra={}),r.extra.session||(r.extra.session={});const i=r.extra.session;i.use_ort_model_bytes_directly||(i.use_ort_model_bytes_directly="1"),r.executionProviders&&r.executionProviders.some(s=>(typeof s=="string"?s:s.name)==="webgpu")&&(r.enableMemPattern=!1)})(e);try{const r=(v=>{switch(v){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${v}`)}})((d=e.graphOptimizationLevel)!==null&&d!==void 0?d:"all"),i=(v=>{switch(v){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${v}`)}})((u=e.executionMode)!==null&&u!==void 0?u:"sequential"),s=typeof e.logId=="string"?(0,p.allocWasmString)(e.logId,t):0,f=(l=e.logSeverityLevel)!==null&&l!==void 0?l:2;if(!Number.isInteger(f)||f<0||f>4)throw new Error(`log serverity level is not valid: ${f}`);const g=(a=e.logVerbosityLevel)!==null&&a!==void 0?a:0;if(!Number.isInteger(g)||g<0||g>4)throw new Error(`log verbosity level is not valid: ${g}`);const b=typeof e.optimizedModelFilePath=="string"?(0,p.allocWasmString)(e.optimizedModelFilePath,t):0;return n=o._OrtCreateSessionOptions(r,!!e.enableCpuMemArena,!!e.enableMemPattern,i,!!e.enableProfiling,0,s,f,g,b),n===0&&(0,p.checkLastError)("Can't create session options."),e.executionProviders&&((v,w,T)=>{for(const x of w){let A=typeof x=="string"?x:x.name;switch(A){case"xnnpack":A="XNNPACK";break;case"webnn":if(A="WEBNN",typeof x!="string"){const k=x;if(k!=null&&k.deviceType){const j=(0,p.allocWasmString)("deviceType",T),M=(0,p.allocWasmString)(k.deviceType,T);(0,m.getInstance)()._OrtAddSessionConfigEntry(v,j,M)!==0&&(0,p.checkLastError)(`Can't set a session config entry: 'deviceType' - ${k.deviceType}.`)}if(k!=null&&k.powerPreference){const j=(0,p.allocWasmString)("powerPreference",T),M=(0,p.allocWasmString)(k.powerPreference,T);(0,m.getInstance)()._OrtAddSessionConfigEntry(v,j,M)!==0&&(0,p.checkLastError)(`Can't set a session config entry: 'powerPreference' - ${k.powerPreference}.`)}}break;case"webgpu":A="JS";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${A}`)}const D=(0,p.allocWasmString)(A,T);(0,m.getInstance)()._OrtAppendExecutionProvider(v,D)!==0&&(0,p.checkLastError)(`Can't append execution provider: ${A}.`)}})(n,e.executionProviders,t),e.extra!==void 0&&(0,p.iterateExtraOptions)(e.extra,"",new WeakSet,(v,w)=>{const T=(0,p.allocWasmString)(v,t),x=(0,p.allocWasmString)(w,t);o._OrtAddSessionConfigEntry(n,T,x)!==0&&(0,p.checkLastError)(`Can't set a session config entry: ${v} - ${w}.`)}),[n,t]}catch(r){throw n!==0&&o._OrtReleaseSessionOptions(n),t.forEach(i=>o._free(i)),r}}},7917:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.logLevelStringToEnum=c.tensorTypeToTypedArrayConstructor=c.getTensorElementSize=c.tensorDataTypeEnumToString=c.tensorDataTypeStringToEnum=void 0,c.tensorDataTypeStringToEnum=y=>{switch(y){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: ${y}`)}},c.tensorDataTypeEnumToString=y=>{switch(y){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: ${y}`)}},c.getTensorElementSize=y=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][y],c.tensorTypeToTypedArrayConstructor=y=>{switch(y){case"float16":case"uint16":return Uint16Array;case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;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: ${y}`)}},c.logLevelStringToEnum=y=>{switch(y){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: ${y}`)}}},1259:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.extractTransferableBuffers=c.endProfiling=c.run=c.releaseSession=c.createSession=c.createSessionFinalize=c.createSessionAllocate=c.initRuntime=void 0;const m=y(7918),p=y(7622),h=y(7917),d=y(263),u=y(1497);c.initRuntime=async a=>{var o,n;o=a.wasm.numThreads,n=(0,h.logLevelStringToEnum)(a.logLevel),(0,d.getInstance)()._OrtInit(o,n)!==0&&(0,u.checkLastError)("Can't initialize onnxruntime.")};const l=new Map;c.createSessionAllocate=a=>{const o=(0,d.getInstance)(),n=o._malloc(a.byteLength);if(n===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${a.byteLength}.`);return o.HEAPU8.set(a,n),[n,a.byteLength]},c.createSessionFinalize=(a,o)=>{const n=(0,d.getInstance)();let t=0,e=0,r=[];const i=[],s=[];try{[e,r]=(0,p.setSessionOptions)(o),t=n._OrtCreateSession(a[0],a[1],e),t===0&&(0,u.checkLastError)("Can't create a session.");const[f,g]=(w=>{const T=(0,d.getInstance)(),x=T.stackSave();try{const A=T.stackAlloc(8);return T._OrtGetInputOutputCount(w,A,A+4)!==0&&(0,u.checkLastError)("Can't get session input/output count."),[T.HEAP32[A/4],T.HEAP32[A/4+1]]}finally{T.stackRestore(x)}})(t),b=[],v=[];for(let w=0;wn._OrtFree(g)),s.forEach(g=>n._OrtFree(g)),t!==0&&n._OrtReleaseSession(t),f}finally{n._free(a[0]),e!==0&&n._OrtReleaseSessionOptions(e),r.forEach(f=>n._free(f))}},c.createSession=(a,o)=>{const n=(0,c.createSessionAllocate)(a);return(0,c.createSessionFinalize)(n,o)},c.releaseSession=a=>{const o=(0,d.getInstance)(),n=l.get(a);if(!n)throw new Error(`cannot release session. invalid session id: ${a}`);const[t,e,r]=n;e.forEach(i=>o._OrtFree(i)),r.forEach(i=>o._OrtFree(i)),o._OrtReleaseSession(t),l.delete(a)},c.run=async(a,o,n,t,e)=>{const r=(0,d.getInstance)(),i=l.get(a);if(!i)throw new Error(`cannot run inference. invalid session id: ${a}`);const[s,f,g]=i,b=o.length,v=t.length;let w=0,T=[];const x=[],A=[];try{[w,T]=(0,m.setRunOptions)(e);for(let U=0;Ur.HEAP32[J++]=nt);const tt=r._OrtCreateTensor((0,h.tensorDataTypeStringToEnum)(O),q,H,X,E.length);tt===0&&(0,u.checkLastError)(`Can't create tensor for input[${U}].`),x.push(tt)}finally{r.stackRestore(K)}}const D=r.stackSave(),k=r.stackAlloc(4*b),j=r.stackAlloc(4*b),M=r.stackAlloc(4*v),S=r.stackAlloc(4*v);try{let U=k/4,O=j/4,E=M/4,N=S/4;for(let X=0;Xlt*bt);if(rt=(0,h.tensorDataTypeEnumToString)(gt),rt==="string"){const lt=[];let bt=it/4;for(let St=0;Str._OrtReleaseTensor(D)),A.forEach(D=>r._free(D)),w!==0&&r._OrtReleaseRunOptions(w),T.forEach(D=>r._free(D))}},c.endProfiling=a=>{const o=(0,d.getInstance)(),n=l.get(a);if(!n)throw new Error("invalid session id");const t=n[0],e=o._OrtEndProfiling(t);e===0&&(0,u.checkLastError)("Can't get an profile file name."),o._OrtFree(e)},c.extractTransferableBuffers=a=>{const o=[];for(const n of a){const t=n[2];!Array.isArray(t)&&t.buffer&&o.push(t.buffer)}return o}},263:function($,c,y){var m=this&&this.__createBinding||(Object.create?function(e,r,i,s){s===void 0&&(s=i);var f=Object.getOwnPropertyDescriptor(r,i);f&&!("get"in f?!r.__esModule:f.writable||f.configurable)||(f={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(e,s,f)}:function(e,r,i,s){s===void 0&&(s=i),e[s]=r[i]}),p=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),h=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)&&m(r,e,i);return p(r,e),r};Object.defineProperty(c,"__esModule",{value:!0}),c.dispose=c.getInstance=c.initializeWebAssembly=void 0;const d=h(y(6449)),u=y(932),l=y(3474);let a,o=!1,n=!1,t=!1;c.initializeWebAssembly=async e=>{if(o)return Promise.resolve();if(n)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(t)throw new Error("previous call to 'initializeWebAssembly()' failed.");n=!0;const r=e.initTimeout,i=e.numThreads,s=e.simd,f=i>1&&(()=>{try{return typeof SharedArrayBuffer<"u"&&(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}})(),g=s&&(()=>{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}})(),b=e.wasmPaths,v=typeof b=="string"?b:void 0,w=((D,k)=>k?D?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":D?"ort-wasm-simd.wasm":"ort-wasm.wasm")(g,f),T=typeof b=="object"?b[w]:void 0;let x=!1;const A=[];if(r>0&&A.push(new Promise(D=>{setTimeout(()=>{x=!0,D()},r)})),A.push(new Promise((D,k)=>{const j=f?l:u,M={locateFile:(S,U)=>f&&S.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([y(4154)],{type:"text/javascript"})):S.endsWith(".wasm")?T||(v??U)+w:U+S};if(f)if(typeof Blob>"u")M.mainScriptUrlOrBlob=d.join(__dirname,"ort-wasm-threaded.js");else{const S=`var ortWasmThreaded=(function(){var _scriptDir;return ${j.toString()}})();`;M.mainScriptUrlOrBlob=new Blob([S],{type:"text/javascript"})}j(M).then(S=>{n=!1,o=!0,a=S,D()},S=>{n=!1,t=!0,k(S)})})),await Promise.race(A),x)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},c.getInstance=()=>{if(o&&a)return a;throw new Error("WebAssembly is not initialized yet.")},c.dispose=()=>{var e;!o||n||t||(n=!0,(e=a.PThread)===null||e===void 0||e.terminateAllThreads(),a=void 0,n=!1,o=!1,t=!0)}},1497:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.checkLastError=c.iterateExtraOptions=c.allocWasmString=void 0;const m=y(263);c.allocWasmString=(p,h)=>{const d=(0,m.getInstance)(),u=d.lengthBytesUTF8(p)+1,l=d._malloc(u);return d.stringToUTF8(p,l,u),h.push(l),l},c.iterateExtraOptions=(p,h,d,u)=>{if(typeof p=="object"&&p!==null){if(d.has(p))throw new Error("Circular reference in options");d.add(p)}Object.entries(p).forEach(([l,a])=>{const o=h?h+l:l;if(typeof a=="object")(0,c.iterateExtraOptions)(a,o+".",d,u);else if(typeof a=="string"||typeof a=="number")u(o,a.toString());else{if(typeof a!="boolean")throw new Error("Can't handle extra config type: "+typeof a);u(o,a?"1":"0")}})},c.checkLastError=p=>{const h=(0,m.getInstance)(),d=h.stackSave();try{const u=h.stackAlloc(8);h._OrtGetLastError(u,u+4);const l=h.HEAP32[u/4],a=h.HEAPU32[u/4+1],o=a?h.UTF8ToString(a):"";throw new Error(`${p} ERROR_CODE: ${l}, ERROR_MESSAGE: ${o}`)}finally{h.stackRestore(d)}}},8050:($,c,y)=>{y.d(c,{Z:()=>h});var m=y(6614),p=y.n(m);function h(){return p()('/*!\n* ONNX Runtime Web v1.16.3\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var e={918:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setRunOptions=void 0;const n=r(263),a=r(497);t.setRunOptions=e=>{const t=(0,n.getInstance)();let r=0;const o=[],i=e||{};try{if(void 0===(null==e?void 0:e.logSeverityLevel))i.logSeverityLevel=2;else if("number"!=typeof e.logSeverityLevel||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if(void 0===(null==e?void 0:e.logVerbosityLevel))i.logVerbosityLevel=0;else if("number"!=typeof e.logVerbosityLevel||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);void 0===(null==e?void 0:e.terminate)&&(i.terminate=!1);let n=0;return void 0!==(null==e?void 0:e.tag)&&(n=(0,a.allocWasmString)(e.tag,o)),r=t._OrtCreateRunOptions(i.logSeverityLevel,i.logVerbosityLevel,!!i.terminate,n),0===r&&(0,a.checkLastError)("Can\'t create run options."),void 0!==(null==e?void 0:e.extra)&&(0,a.iterateExtraOptions)(e.extra,"",new WeakSet,((e,n)=>{const i=(0,a.allocWasmString)(e,o),s=(0,a.allocWasmString)(n,o);0!==t._OrtAddRunConfigEntry(r,i,s)&&(0,a.checkLastError)(`Can\'t set a run config entry: ${e} - ${n}.`)})),[r,o]}catch(e){throw 0!==r&&t._OrtReleaseRunOptions(r),o.forEach((e=>t._free(e))),e}}},622:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setSessionOptions=void 0;const n=r(263),a=r(497);t.setSessionOptions=e=>{var t,r,o,i;const s=(0,n.getInstance)();let u=0;const c=[],l=e||{};(e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});const t=e.extra.session;t.use_ort_model_bytes_directly||(t.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some((e=>"webgpu"===("string"==typeof e?e:e.name)))&&(e.enableMemPattern=!1)})(l);try{const e=(e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}})(null!==(t=l.graphOptimizationLevel)&&void 0!==t?t:"all"),f=(e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}})(null!==(r=l.executionMode)&&void 0!==r?r:"sequential"),d="string"==typeof l.logId?(0,a.allocWasmString)(l.logId,c):0,p=null!==(o=l.logSeverityLevel)&&void 0!==o?o:2;if(!Number.isInteger(p)||p<0||p>4)throw new Error(`log serverity level is not valid: ${p}`);const g=null!==(i=l.logVerbosityLevel)&&void 0!==i?i:0;if(!Number.isInteger(g)||g<0||g>4)throw new Error(`log verbosity level is not valid: ${g}`);const h="string"==typeof l.optimizedModelFilePath?(0,a.allocWasmString)(l.optimizedModelFilePath,c):0;return u=s._OrtCreateSessionOptions(e,!!l.enableCpuMemArena,!!l.enableMemPattern,f,!!l.enableProfiling,0,d,p,g,h),0===u&&(0,a.checkLastError)("Can\'t create session options."),l.executionProviders&&((e,t,r)=>{for(const o of t){let t="string"==typeof o?o:o.name;switch(t){case"xnnpack":t="XNNPACK";break;case"webnn":if(t="WEBNN","string"!=typeof o){const t=o;if(null==t?void 0:t.deviceType){const o=(0,a.allocWasmString)("deviceType",r),i=(0,a.allocWasmString)(t.deviceType,r);0!==(0,n.getInstance)()._OrtAddSessionConfigEntry(e,o,i)&&(0,a.checkLastError)(`Can\'t set a session config entry: \'deviceType\' - ${t.deviceType}.`)}if(null==t?void 0:t.powerPreference){const o=(0,a.allocWasmString)("powerPreference",r),i=(0,a.allocWasmString)(t.powerPreference,r);0!==(0,n.getInstance)()._OrtAddSessionConfigEntry(e,o,i)&&(0,a.checkLastError)(`Can\'t set a session config entry: \'powerPreference\' - ${t.powerPreference}.`)}}break;case"webgpu":t="JS";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${t}`)}const i=(0,a.allocWasmString)(t,r);0!==(0,n.getInstance)()._OrtAppendExecutionProvider(e,i)&&(0,a.checkLastError)(`Can\'t append execution provider: ${t}.`)}})(u,l.executionProviders,c),void 0!==l.extra&&(0,a.iterateExtraOptions)(l.extra,"",new WeakSet,((e,t)=>{const r=(0,a.allocWasmString)(e,c),n=(0,a.allocWasmString)(t,c);0!==s._OrtAddSessionConfigEntry(u,r,n)&&(0,a.checkLastError)(`Can\'t set a session config entry: ${e} - ${t}.`)})),[u,c]}catch(e){throw 0!==u&&s._OrtReleaseSessionOptions(u),c.forEach((e=>s._free(e))),e}}},917:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logLevelStringToEnum=t.tensorTypeToTypedArrayConstructor=t.getTensorElementSize=t.tensorDataTypeEnumToString=t.tensorDataTypeStringToEnum=void 0,t.tensorDataTypeStringToEnum=e=>{switch(e){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${e}`)}},t.tensorDataTypeEnumToString=e=>{switch(e){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${e}`)}},t.getTensorElementSize=e=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][e],t.tensorTypeToTypedArrayConstructor=e=>{switch(e){case"float16":case"uint16":return Uint16Array;case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;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: ${e}`)}},t.logLevelStringToEnum=e=>{switch(e){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${e}`)}}},259:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractTransferableBuffers=t.endProfiling=t.run=t.releaseSession=t.createSession=t.createSessionFinalize=t.createSessionAllocate=t.initRuntime=void 0;const n=r(918),a=r(622),o=r(917),i=r(263),s=r(497);t.initRuntime=async e=>{var t,r;t=e.wasm.numThreads,r=(0,o.logLevelStringToEnum)(e.logLevel),0!==(0,i.getInstance)()._OrtInit(t,r)&&(0,s.checkLastError)("Can\'t initialize onnxruntime.")};const u=new Map;t.createSessionAllocate=e=>{const t=(0,i.getInstance)(),r=t._malloc(e.byteLength);if(0===r)throw new Error(`Can\'t create a session. failed to allocate a buffer of size ${e.byteLength}.`);return t.HEAPU8.set(e,r),[r,e.byteLength]},t.createSessionFinalize=(e,t)=>{const r=(0,i.getInstance)();let n=0,o=0,c=[];const l=[],f=[];try{[o,c]=(0,a.setSessionOptions)(t),n=r._OrtCreateSession(e[0],e[1],o),0===n&&(0,s.checkLastError)("Can\'t create a session.");const[d,p]=(e=>{const t=(0,i.getInstance)(),r=t.stackSave();try{const r=t.stackAlloc(8);return 0!==t._OrtGetInputOutputCount(e,r,r+4)&&(0,s.checkLastError)("Can\'t get session input/output count."),[t.HEAP32[r/4],t.HEAP32[r/4+1]]}finally{t.stackRestore(r)}})(n),g=[],h=[];for(let e=0;er._OrtFree(e))),f.forEach((e=>r._OrtFree(e))),0!==n&&r._OrtReleaseSession(n),e}finally{r._free(e[0]),0!==o&&r._OrtReleaseSessionOptions(o),c.forEach((e=>r._free(e)))}},t.createSession=(e,r)=>{const n=(0,t.createSessionAllocate)(e);return(0,t.createSessionFinalize)(n,r)},t.releaseSession=e=>{const t=(0,i.getInstance)(),r=u.get(e);if(!r)throw new Error(`cannot release session. invalid session id: ${e}`);const[n,a,o]=r;a.forEach((e=>t._OrtFree(e))),o.forEach((e=>t._OrtFree(e))),t._OrtReleaseSession(n),u.delete(e)},t.run=async(e,t,r,a,c)=>{const l=(0,i.getInstance)(),f=u.get(e);if(!f)throw new Error(`cannot run inference. invalid session id: ${e}`);const[d,p,g]=f,h=t.length,m=a.length;let y=0,v=[];const b=[],w=[];try{[y,v]=(0,n.setRunOptions)(c);for(let e=0;el.HEAP32[r++]=e));const a=l._OrtCreateTensor((0,o.tensorDataTypeStringToEnum)(t),i,u,f,n.length);0===a&&(0,s.checkLastError)(`Can\'t create tensor for input[${e}].`),b.push(a)}finally{l.stackRestore(c)}}const e=l.stackSave(),i=l.stackAlloc(4*h),u=l.stackAlloc(4*h),f=l.stackAlloc(4*m),_=l.stackAlloc(4*m);try{let e=i/4,r=u/4,n=f/4,c=_/4;for(let n=0;ne*t));if(a=(0,o.tensorDataTypeEnumToString)(u),"string"===a){const e=[];let t=i/4;for(let r=0;rl._OrtReleaseTensor(e))),w.forEach((e=>l._free(e))),0!==y&&l._OrtReleaseRunOptions(y),v.forEach((e=>l._free(e)))}},t.endProfiling=e=>{const t=(0,i.getInstance)(),r=u.get(e);if(!r)throw new Error("invalid session id");const n=r[0],a=t._OrtEndProfiling(n);0===a&&(0,s.checkLastError)("Can\'t get an profile file name."),t._OrtFree(a)},t.extractTransferableBuffers=e=>{const t=[];for(const r of e){const e=r[2];!Array.isArray(e)&&e.buffer&&t.push(e.buffer)}return t}},263:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return a(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.dispose=t.getInstance=t.initializeWebAssembly=void 0;const i=o(r(449)),s=r(932),u=r(474);let c,l=!1,f=!1,d=!1;t.initializeWebAssembly=async e=>{if(l)return Promise.resolve();if(f)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(d)throw new Error("previous call to \'initializeWebAssembly()\' failed.");f=!0;const t=e.initTimeout,n=e.numThreads,a=e.simd,o=n>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(e){return!1}})(),p=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(e){return!1}})(),g=e.wasmPaths,h="string"==typeof g?g:void 0,m=((e,t)=>t?e?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":e?"ort-wasm-simd.wasm":"ort-wasm.wasm")(p,o),y="object"==typeof g?g[m]:void 0;let v=!1;const b=[];if(t>0&&b.push(new Promise((e=>{setTimeout((()=>{v=!0,e()}),t)}))),b.push(new Promise(((e,t)=>{const n=o?u:s,a={locateFile:(e,t)=>o&&e.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([r(154)],{type:"text/javascript"})):e.endsWith(".wasm")?y||(null!=h?h:t)+m:t+e};if(o)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=i.join(__dirname,"ort-wasm-threaded.js");else{const e=`var ortWasmThreaded=(function(){var _scriptDir;return ${n.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([e],{type:"text/javascript"})}n(a).then((t=>{f=!1,l=!0,c=t,e()}),(e=>{f=!1,d=!0,t(e)}))}))),await Promise.race(b),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},t.getInstance=()=>{if(l&&c)return c;throw new Error("WebAssembly is not initialized yet.")},t.dispose=()=>{var e;!l||f||d||(f=!0,null===(e=c.PThread)||void 0===e||e.terminateAllThreads(),c=void 0,f=!1,l=!1,d=!0)}},497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkLastError=t.iterateExtraOptions=t.allocWasmString=void 0;const n=r(263);t.allocWasmString=(e,t)=>{const r=(0,n.getInstance)(),a=r.lengthBytesUTF8(e)+1,o=r._malloc(a);return r.stringToUTF8(e,o,a),t.push(o),o},t.iterateExtraOptions=(e,r,n,a)=>{if("object"==typeof e&&null!==e){if(n.has(e))throw new Error("Circular reference in options");n.add(e)}Object.entries(e).forEach((([e,o])=>{const i=r?r+e:e;if("object"==typeof o)(0,t.iterateExtraOptions)(o,i+".",n,a);else if("string"==typeof o||"number"==typeof o)a(i,o.toString());else{if("boolean"!=typeof o)throw new Error("Can\'t handle extra config type: "+typeof o);a(i,o?"1":"0")}}))},t.checkLastError=e=>{const t=(0,n.getInstance)(),r=t.stackSave();try{const r=t.stackAlloc(8);t._OrtGetLastError(r,r+4);const n=t.HEAP32[r/4],a=t.HEAPU32[r/4+1],o=a?t.UTF8ToString(a):"";throw new Error(`${e} ERROR_CODE: ${n}, ERROR_MESSAGE: ${o}`)}finally{t.stackRestore(r)}}},474:(e,t,r)=>{var _scriptDir,n=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(_scriptDir=_scriptDir||__filename),function(e={}){function t(){return k.buffer!=x.buffer&&Y(),x}function n(){return k.buffer!=x.buffer&&Y(),I}function a(){return k.buffer!=x.buffer&&Y(),U}function o(){return k.buffer!=x.buffer&&Y(),L}function i(){return k.buffer!=x.buffer&&Y(),W}var s,u,c=e;c.ready=new Promise(((e,t)=>{s=e,u=t}));var l,f,d,p=Object.assign({},c),g="./this.program",h=(e,t)=>{throw t},m="object"==typeof window,y="function"==typeof importScripts,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,b=c.ENVIRONMENT_IS_PTHREAD||!1,w="";function _(e){return c.locateFile?c.locateFile(e,w):w+e}if(v){var O=r(384),S=r(908);let t;w=y?S.dirname(w)+"/":__dirname+"/",l=(e,t)=>(e=e.startsWith("file://")?new URL(e):S.normalize(e),O.readFileSync(e,t?void 0:"utf8")),d=e=>((e=l(e,!0)).buffer||(e=new Uint8Array(e)),e),f=(e,t,r,n=!0)=>{e=e.startsWith("file://")?new URL(e):S.normalize(e),O.readFile(e,n?void 0:"utf8",((e,a)=>{e?r(e):t(n?a.buffer:a)}))},!c.thisProgram&&1{throw process.exitCode=e,t},c.inspect=()=>"[Emscripten Module object]";try{t=r(925)}catch(e){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),e}global.Worker=t.Worker}else(m||y)&&(y?w=self.location.href:"undefined"!=typeof document&&document.currentScript&&(w=document.currentScript.src),_scriptDir&&(w=_scriptDir),w=0!==w.indexOf("blob:")?w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):"",v||(l=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},y&&(d=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),f=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)}));v&&"undefined"==typeof performance&&(global.performance=r(953).performance);var E=console.log.bind(console),A=console.error.bind(console);v&&(E=(...e)=>O.writeSync(1,e.join(" ")+"\\n"),A=(...e)=>O.writeSync(2,e.join(" ")+"\\n"));var T,M=c.print||E,R=c.printErr||A;Object.assign(c,p),p=null,c.thisProgram&&(g=c.thisProgram),c.quit&&(h=c.quit),c.wasmBinary&&(T=c.wasmBinary);var F=c.noExitRuntime||!0;"object"!=typeof WebAssembly&&te("no native wasm support detected");var k,C,P,D,x,I,U,L,W,H=!1;function Y(){var e=k.buffer;c.HEAP8=x=new Int8Array(e),c.HEAP16=new Int16Array(e),c.HEAP32=U=new Int32Array(e),c.HEAPU8=I=new Uint8Array(e),c.HEAPU16=new Uint16Array(e),c.HEAPU32=L=new Uint32Array(e),c.HEAPF32=new Float32Array(e),c.HEAPF64=W=new Float64Array(e)}var j=c.INITIAL_MEMORY||16777216;if(5242880<=j||te("INITIAL_MEMORY should be larger than STACK_SIZE, was "+j+"! (STACK_SIZE=5242880)"),b)k=c.wasmMemory;else if(c.wasmMemory)k=c.wasmMemory;else if(!((k=new WebAssembly.Memory({initial:j/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw R("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"),v&&R("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");Y(),j=k.buffer.byteLength;var z,G=[],N=[],B=[],$=0;function q(){return F||0<$}var V,J,X=0,K=null,Z=null;function Q(){X++,c.monitorRunDependencies&&c.monitorRunDependencies(X)}function ee(){if(X--,c.monitorRunDependencies&&c.monitorRunDependencies(X),0==X&&(null!==K&&(clearInterval(K),K=null),Z)){var e=Z;Z=null,e()}}function te(e){throw c.onAbort&&c.onAbort(e),R(e="Aborted("+e+")"),H=!0,D=1,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),u(e),e}function re(e){return e.startsWith("data:application/octet-stream;base64,")}function ne(e){if(e==V&&T)return new Uint8Array(T);if(d)return d(e);throw"both async and sync fetching of the wasm failed"}function ae(e,t,r){return function(e){if(!T&&(m||y)){if("function"==typeof fetch&&!e.startsWith("file://"))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at \'"+e+"\'";return t.arrayBuffer()})).catch((()=>ne(e)));if(f)return new Promise(((t,r)=>{f(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>ne(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{R("failed to asynchronously prepare wasm: "+e),te(e)}))}function oe(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}function ie(e){e.terminate(),e.onmessage=()=>{}}function se(e){(e=ge.Fa[e])||te(),ge.fb(e)}function ue(e){var t=ge.Za();if(!t)return 6;ge.Ia.push(t),ge.Fa[e.Ha]=t,t.Ha=e.Ha;var r={cmd:"run",start_routine:e.gb,arg:e.Ya,pthread_ptr:e.Ha};return v&&t.unref(),t.postMessage(r,e.mb),0}re(V="ort-wasm-threaded.wasm")||(V=_(V));var ce="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,le=(e,t,r)=>{var n=(t>>>=0)+r;for(r=t;e[r]&&!(r>=n);)++r;if(16(a=224==(240&a)?(15&a)<<12|o<<6|i:(7&a)<<18|o<<12|i<<6|63&e[t++])?n+=String.fromCharCode(a):(a-=65536,n+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else n+=String.fromCharCode(a)}return n},fe=(e,t)=>(e>>>=0)?le(n(),e,t):"";function de(e){if(b)return qe(1,1,e);D=e,q()||(ge.hb(),c.onExit&&c.onExit(e),H=!0),h(e,new oe(e))}var pe=e=>{if(D=e,b)throw me(e),"unwind";de(e)},ge={La:[],Ia:[],Ta:[],Fa:{},Pa:function(){b?ge.ab():ge.$a()},$a:function(){G.unshift((()=>{Q(),ge.bb((()=>ee()))}))},ab:function(){ge.receiveObjectTransfer=ge.eb,ge.threadInitTLS=ge.Sa,ge.setExitStatus=ge.Ra,F=!1},Ra:function(e){D=e},rb:["$terminateWorker"],hb:function(){for(var e of ge.Ia)ie(e);for(e of ge.La)ie(e);ge.La=[],ge.Ia=[],ge.Fa=[]},fb:function(e){var t=e.Ha;delete ge.Fa[t],ge.La.push(e),ge.Ia.splice(ge.Ia.indexOf(e),1),e.Ha=0,yt(t)},eb:function(){},Sa:function(){ge.Ta.forEach((e=>e()))},cb:e=>new Promise((t=>{e.onmessage=r=>{var n=(r=r.data).cmd;if(r.targetThread&&r.targetThread!=dt()){var a=ge.Fa[r.qb];a?a.postMessage(r,r.transferList):R(\'Internal error! Worker sent a message "\'+n+\'" to target pthread \'+r.targetThread+", but that thread no longer exists!")}else"checkMailbox"===n?He():"spawnThread"===n?ue(r):"cleanupThread"===n?se(r.thread):"killThread"===n?(r=r.thread,n=ge.Fa[r],delete ge.Fa[r],ie(n),yt(r),ge.Ia.splice(ge.Ia.indexOf(n),1),n.Ha=0):"cancelThread"===n?ge.Fa[r.thread].postMessage({cmd:"cancel"}):"loaded"===n?(e.loaded=!0,t(e)):"alert"===n?alert("Thread "+r.threadId+": "+r.text):"setimmediate"===r.target?e.postMessage(r):"callHandler"===n?c[r.handler](...r.args):n&&R("worker sent an unknown command "+n)},e.onerror=e=>{throw R("worker sent an error! "+e.filename+":"+e.lineno+": "+e.message),e},v&&(e.on("message",(function(t){e.onmessage({data:t})})),e.on("error",(function(t){e.onerror(t)})));var r,n=[];for(r of["onExit","onAbort","print","printErr"])c.hasOwnProperty(r)&&n.push(r);e.postMessage({cmd:"load",handlers:n,urlOrBlob:c.mainScriptUrlOrBlob||_scriptDir,wasmMemory:k,wasmModule:P})})),bb:function(e){e()},Xa:function(){var e=_("ort-wasm-threaded.worker.js");e=new Worker(e),ge.La.push(e)},Za:function(){return 0==ge.La.length&&(ge.Xa(),ge.cb(ge.La[0])),ge.La.pop()}};c.PThread=ge;var he=e=>{for(;0>2>>>0];e=a()[e+56>>2>>>0],_t(t,t-e),St(t)};var ye=[];function ve(e){this.Oa=e-24,this.Wa=function(e){o()[this.Oa+4>>2>>>0]=e},this.Va=function(e){o()[this.Oa+8>>2>>>0]=e},this.Pa=function(e,t){this.Ua(),this.Wa(e),this.Va(t)},this.Ua=function(){o()[this.Oa+16>>2>>>0]=0}}function be(e,t,r,n){return b?qe(3,1,e,t,r,n):we(e,t,r,n)}function we(e,t,r,n){if(e>>>=0,t>>>=0,r>>>=0,n>>>=0,"undefined"==typeof SharedArrayBuffer)return R("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return b&&0===a.length?be(e,t,r,n):(e={gb:r,Ha:e,Ya:n,mb:a},b?(e.ob="spawnThread",postMessage(e,a),0):ue(e))}function _e(e,t,r){return b?qe(4,1,e,t,r):0}function Oe(e,t){if(b)return qe(5,1,e,t)}c.invokeEntryPoint=function(e,t){var r=ye[e];r||(e>=ye.length&&(ye.length=e+1),ye[e]=r=z.get(e)),e=r(t),q()?ge.Ra(e):vt(e)};var Se=e=>{for(var t=0,r=0;r=n?t++:2047>=n?t+=2:55296<=n&&57343>=n?(t+=4,++r):t+=3}return t},Ee=(e,t,r,n)=>{if(!(0>>=0;n=r+n-1;for(var o=0;o=i&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++o)),127>=i){if(r>=n)break;t[r++>>>0]=i}else{if(2047>=i){if(r+1>=n)break;t[r++>>>0]=192|i>>6}else{if(65535>=i){if(r+2>=n)break;t[r++>>>0]=224|i>>12}else{if(r+3>=n)break;t[r++>>>0]=240|i>>18,t[r++>>>0]=128|i>>12&63}t[r++>>>0]=128|i>>6&63}t[r++>>>0]=128|63&i}}return t[r>>>0]=0,r-a},Ae=(e,t,r)=>Ee(e,n(),t,r);function Te(e,t){if(b)return qe(6,1,e,t)}function Me(e,t,r){if(b)return qe(7,1,e,t,r)}function Re(e,t,r){return b?qe(8,1,e,t,r):0}function Fe(e,t){if(b)return qe(9,1,e,t)}function ke(e,t,r){if(b)return qe(10,1,e,t,r)}function Ce(e,t,r,n){if(b)return qe(11,1,e,t,r,n)}function Pe(e,t,r,n){if(b)return qe(12,1,e,t,r,n)}function De(e,t,r,n){if(b)return qe(13,1,e,t,r,n)}function xe(e){if(b)return qe(14,1,e)}function Ie(e,t){if(b)return qe(15,1,e,t)}function Ue(e,t,r){if(b)return qe(16,1,e,t,r)}var Le=e=>{if(!H)try{if(e(),!q())try{b?vt(D):pe(D)}catch(e){e instanceof oe||"unwind"==e||h(1,e)}}catch(e){e instanceof oe||"unwind"==e||h(1,e)}};function We(e){e>>>=0,"function"==typeof Atomics.nb&&(Atomics.nb(a(),e>>2,e).value.then(He),e+=128,Atomics.store(a(),e>>2,1))}function He(){var e=dt();e&&(We(e),Le((()=>bt())))}c.__emscripten_thread_mailbox_await=We,c.checkMailbox=He;var Ye=e=>0==e%4&&(0!=e%100||0==e%400),je=[0,31,60,91,121,152,182,213,244,274,305,335],ze=[0,31,59,90,120,151,181,212,243,273,304,334];function Ge(e,t,r,n,a,o,i,s){return b?qe(17,1,e,t,r,n,a,o,i,s):-52}function Ne(e,t,r,n,a,o,i){if(b)return qe(18,1,e,t,r,n,a,o,i)}var Be=e=>{var t=Se(e)+1,r=pt(t);return r&&Ae(e,r,t),r},$e=e=>{var t=Ot();return e=e(),St(t),e};function qe(e,t){var r=arguments.length-2,n=arguments;return $e((()=>{for(var a=Et(8*r),o=a>>3,s=0;s>>0]=u}return mt(e,r,a,t)}))}var Ve,Je=[],Xe={},Ke=()=>{if(!Ve){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"};for(e in Xe)void 0===Xe[e]?delete t[e]:t[e]=Xe[e];var r=[];for(e in t)r.push(`${e}=${t[e]}`);Ve=r}return Ve};function Ze(e,r){if(b)return qe(19,1,e,r);e>>>=0,r>>>=0;var n=0;return Ke().forEach((function(a,i){var s=r+n;for(i=o()[e+4*i>>2>>>0]=s,s=0;s>0>>>0]=a.charCodeAt(s);t()[i>>0>>>0]=0,n+=a.length+1})),0}function Qe(e,t){if(b)return qe(20,1,e,t);e>>>=0,t>>>=0;var r=Ke();o()[e>>2>>>0]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),o()[t>>2>>>0]=n,0}function et(e){return b?qe(21,1,e):52}function tt(e,t,r,n){return b?qe(22,1,e,t,r,n):52}function rt(e,t,r,n,a){return b?qe(23,1,e,t,r,n,a):70}var nt=[null,[],[]];function at(e,t,r,a){if(b)return qe(24,1,e,t,r,a);t>>>=0,r>>>=0,a>>>=0;for(var i=0,s=0;s>2>>>0],c=o()[t+4>>2>>>0];t+=8;for(var l=0;l>>0],d=nt[e];0===f||10===f?((1===e?M:R)(le(d,0)),d.length=0):d.push(f)}i+=c}return o()[a>>2>>>0]=i,0}var ot=e=>(ot=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>(e.set(crypto.getRandomValues(new Uint8Array(e.byteLength))),e);if(v)try{var e=r(760);if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}te("initRandomDevice")})())(e),it=[31,29,31,30,31,30,31,31,30,31,30,31],st=[31,28,31,30,31,30,31,31,30,31,30,31],ut=(e,r)=>{t().set(e,r>>>0)};function ct(e,t,r,n){function o(e,t,r){for(e="number"==typeof e?e.toString():e||"";e.lengthe?-1:0n-e.getDate())){e.setDate(e.getDate()+t);break}t-=n-e.getDate()+1,e.setDate(1),11>r?e.setMonth(r+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return r=new Date(e.getFullYear()+1,0,4),t=u(new Date(e.getFullYear(),0,4)),r=u(r),0>=s(t,e)?0>=s(r,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}e>>>=0,t>>>=0,r>>>=0,n>>>=0;var l=a()[n+40>>2>>>0];for(var f in n={kb:a()[n>>2>>>0],jb:a()[n+4>>2>>>0],Ma:a()[n+8>>2>>>0],Qa:a()[n+12>>2>>>0],Na:a()[n+16>>2>>>0],Ka:a()[n+20>>2>>>0],Ga:a()[n+24>>2>>>0],Ja:a()[n+28>>2>>>0],sb:a()[n+32>>2>>>0],ib:a()[n+36>>2>>>0],lb:l?fe(l):""},r=fe(r),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(f,"g"),l[f]);var d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(f in l={"%a":e=>d[e.Ga].substring(0,3),"%A":e=>d[e.Ga],"%b":e=>p[e.Na].substring(0,3),"%B":e=>p[e.Na],"%C":e=>i((e.Ka+1900)/100|0,2),"%d":e=>i(e.Qa,2),"%e":e=>o(e.Qa,2," "),"%g":e=>c(e).toString().substring(2),"%G":e=>c(e),"%H":e=>i(e.Ma,2),"%I":e=>(0==(e=e.Ma)?e=12:12{for(var t=0,r=0;r<=e.Na-1;t+=(Ye(e.Ka+1900)?it:st)[r++]);return i(e.Qa+t,3)},"%m":e=>i(e.Na+1,2),"%M":e=>i(e.jb,2),"%n":()=>"\\n","%p":e=>0<=e.Ma&&12>e.Ma?"AM":"PM","%S":e=>i(e.kb,2),"%t":()=>"\\t","%u":e=>e.Ga||7,"%U":e=>i(Math.floor((e.Ja+7-e.Ga)/7),2),"%V":e=>{var t=Math.floor((e.Ja+7-(e.Ga+6)%7)/7);if(2>=(e.Ga+371-e.Ja-2)%7&&t++,t)53==t&&(4==(r=(e.Ga+371-e.Ja)%7)||3==r&&Ye(e.Ka)||(t=1));else{t=52;var r=(e.Ga+7-e.Ja-1)%7;(4==r||5==r&&Ye(e.Ka%400-1))&&t++}return i(t,2)},"%w":e=>e.Ga,"%W":e=>i(Math.floor((e.Ja+7-(e.Ga+6)%7)/7),2),"%y":e=>(e.Ka+1900).toString().substring(2),"%Y":e=>e.Ka+1900,"%z":e=>{var t=0<=(e=e.ib);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":e=>e.lb,"%%":()=>"%"},r=r.replace(/%%/g,"\\0\\0"),l)r.includes(f)&&(r=r.replace(new RegExp(f,"g"),l[f](n)));return f=function(e){var t=Array(Se(e)+1);return Ee(e,t,0,t.length),t}(r=r.replace(/\\0\\0/g,"%")),f.length>t?0:(ut(f,e),f.length-1)}ge.Pa();var lt=[null,de,me,be,_e,Oe,Te,Me,Re,Fe,ke,Ce,Pe,De,xe,Ie,Ue,Ge,Ne,Ze,Qe,et,tt,rt,at],ft={b:function(e,t,r){throw new ve(e>>>=0).Pa(t>>>0,r>>>0),e},N:function(e){gt(e>>>0,!y,1,!m,131072,!1),ge.Sa()},k:function(e){e>>>=0,b?postMessage({cmd:"cleanupThread",thread:e}):se(e)},I:we,h:_e,T:Oe,E:Te,G:Me,U:Re,R:Fe,J:ke,Q:Ce,o:Pe,F:De,C:xe,S:Ie,D:Ue,q:()=>!0,A:function(e,t){(e>>>=0)==t>>>0?setTimeout((()=>He())):b?postMessage({targetThread:e,cmd:"checkMailbox"}):(e=ge.Fa[e])&&e.postMessage({cmd:"checkMailbox"})},L:function(){return-1},M:We,p:function(e){v&&ge.Fa[e>>>0].ref()},t:function(e,t,r){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,r>>>=0,e=new Date(1e3*e),a()[r>>2>>>0]=e.getUTCSeconds(),a()[r+4>>2>>>0]=e.getUTCMinutes(),a()[r+8>>2>>>0]=e.getUTCHours(),a()[r+12>>2>>>0]=e.getUTCDate(),a()[r+16>>2>>>0]=e.getUTCMonth(),a()[r+20>>2>>>0]=e.getUTCFullYear()-1900,a()[r+24>>2>>>0]=e.getUTCDay(),e=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[r+28>>2>>>0]=e},u:function(e,t,r){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,r>>>=0,e=new Date(1e3*e),a()[r>>2>>>0]=e.getSeconds(),a()[r+4>>2>>>0]=e.getMinutes(),a()[r+8>>2>>>0]=e.getHours(),a()[r+12>>2>>>0]=e.getDate(),a()[r+16>>2>>>0]=e.getMonth(),a()[r+20>>2>>>0]=e.getFullYear()-1900,a()[r+24>>2>>>0]=e.getDay(),t=(Ye(e.getFullYear())?je:ze)[e.getMonth()]+e.getDate()-1|0,a()[r+28>>2>>>0]=t,a()[r+36>>2>>>0]=-60*e.getTimezoneOffset(),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var n=new Date(e.getFullYear(),0,1).getTimezoneOffset();e=0|(t!=n&&e.getTimezoneOffset()==Math.min(n,t)),a()[r+32>>2>>>0]=e},v:function(e){e>>>=0;var t=new Date(a()[e+20>>2>>>0]+1900,a()[e+16>>2>>>0],a()[e+12>>2>>>0],a()[e+8>>2>>>0],a()[e+4>>2>>>0],a()[e>>2>>>0],0),r=a()[e+32>>2>>>0],n=t.getTimezoneOffset(),o=new Date(t.getFullYear(),6,1).getTimezoneOffset(),i=new Date(t.getFullYear(),0,1).getTimezoneOffset(),s=Math.min(i,o);return 0>r?a()[e+32>>2>>>0]=Number(o!=i&&s==n):0>2>>>0]=t.getDay(),r=(Ye(t.getFullYear())?je:ze)[t.getMonth()]+t.getDate()-1|0,a()[e+28>>2>>>0]=r,a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getYear(),e=t.getTime()/1e3,wt((J=e,1<=+Math.abs(J)?0>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)),e>>>0},r:Ge,s:Ne,z:function(e,t,r){function n(e){return(e=e.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?e[1]:"GMT"}e>>>=0,t>>>=0,r>>>=0;var i=(new Date).getFullYear(),s=new Date(i,0,1),u=new Date(i,6,1);i=s.getTimezoneOffset();var c=u.getTimezoneOffset(),l=Math.max(i,c);o()[e>>2>>>0]=60*l,a()[t>>2>>>0]=Number(i!=c),e=n(s),t=n(u),e=Be(e),t=Be(t),c>2>>>0]=e,o()[r+4>>2>>>0]=t):(o()[r>>2>>>0]=t,o()[r+4>>2>>>0]=e)},c:()=>{te("")},l:function(){},i:function(){return Date.now()},V:()=>{throw $+=1,"unwind"},B:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:function(){return v?r(993).cpus().length:navigator.hardwareConcurrency},K:function(e,t,r,n){for(ge.pb=t>>>0,Je.length=r,t=n>>>0>>3,n=0;n>>0];return lt[e].apply(null,Je)},y:function(e){e>>>=0;var t=n().length;if(e<=t||4294901760=r;r*=2){var a=t*(1+.2/r);a=Math.min(a,e+100663296);var o=Math;a=Math.max(e,a);e:{o=o.min.call(o,4294901760,a+(65536-a%65536)%65536)-k.buffer.byteLength+65535>>>16;try{k.grow(o),Y();var i=1;break e}catch(e){}i=void 0}if(i)return!0}return!1},O:Ze,P:Qe,j:pe,g:et,n:tt,w:rt,m:at,x:function(e,t){return e>>>=0,t>>>=0,ot(n().subarray(e>>>0,e+t>>>0)),0},a:k||c.wasmMemory,H:ct,d:function(e,t,r,n){return ct(e>>>0,t>>>0,r>>>0,n>>>0)}};!function(){function e(e,t){return e=e.exports,C=e=function(e){var t=e=>()=>e()>>>0,r=e=>t=>e(t)>>>0;return(e=Object.assign({},e)).__errno_location=t(e.__errno_location),e.pthread_self=t(e.pthread_self),e.malloc=r(e.malloc),e.stackSave=t(e.stackSave),e.stackAlloc=r(e.stackAlloc),e}(e),ge.Ta.push(C.sa),z=C.ta,N.unshift(C.W),P=t,ee(),e}var t={a:ft};if(Q(),c.instantiateWasm)try{return c.instantiateWasm(t,e)}catch(e){R("Module.instantiateWasm callback failed with error: "+e),u(e)}(function(e,t){var r=V;return T||"function"!=typeof WebAssembly.instantiateStreaming||re(r)||r.startsWith("file://")||v||"function"!=typeof fetch?ae(r,e,t):fetch(r,{credentials:"same-origin"}).then((n=>WebAssembly.instantiateStreaming(n,e).then(t,(function(n){return R("wasm streaming compile failed: "+n),R("falling back to ArrayBuffer instantiation"),ae(r,e,t)}))))})(t,(function(t){e(t.instance,t.module)})).catch(u)}(),c._OrtInit=(e,t)=>(c._OrtInit=C.X)(e,t),c._OrtGetLastError=(e,t)=>(c._OrtGetLastError=C.Y)(e,t),c._OrtCreateSessionOptions=(e,t,r,n,a,o,i,s,u,l)=>(c._OrtCreateSessionOptions=C.Z)(e,t,r,n,a,o,i,s,u,l),c._OrtAppendExecutionProvider=(e,t)=>(c._OrtAppendExecutionProvider=C._)(e,t),c._OrtAddSessionConfigEntry=(e,t,r)=>(c._OrtAddSessionConfigEntry=C.$)(e,t,r),c._OrtReleaseSessionOptions=e=>(c._OrtReleaseSessionOptions=C.aa)(e),c._OrtCreateSession=(e,t,r)=>(c._OrtCreateSession=C.ba)(e,t,r),c._OrtReleaseSession=e=>(c._OrtReleaseSession=C.ca)(e),c._OrtGetInputOutputCount=(e,t,r)=>(c._OrtGetInputOutputCount=C.da)(e,t,r),c._OrtGetInputName=(e,t)=>(c._OrtGetInputName=C.ea)(e,t),c._OrtGetOutputName=(e,t)=>(c._OrtGetOutputName=C.fa)(e,t),c._OrtFree=e=>(c._OrtFree=C.ga)(e),c._OrtCreateTensor=(e,t,r,n,a)=>(c._OrtCreateTensor=C.ha)(e,t,r,n,a),c._OrtGetTensorData=(e,t,r,n,a)=>(c._OrtGetTensorData=C.ia)(e,t,r,n,a),c._OrtReleaseTensor=e=>(c._OrtReleaseTensor=C.ja)(e),c._OrtCreateRunOptions=(e,t,r,n)=>(c._OrtCreateRunOptions=C.ka)(e,t,r,n),c._OrtAddRunConfigEntry=(e,t,r)=>(c._OrtAddRunConfigEntry=C.la)(e,t,r),c._OrtReleaseRunOptions=e=>(c._OrtReleaseRunOptions=C.ma)(e),c._OrtRun=(e,t,r,n,a,o,i,s)=>(c._OrtRun=C.na)(e,t,r,n,a,o,i,s),c._OrtEndProfiling=e=>(c._OrtEndProfiling=C.oa)(e);var dt=c._pthread_self=()=>(dt=c._pthread_self=C.pa)(),pt=c._malloc=e=>(pt=c._malloc=C.qa)(e);c._free=e=>(c._free=C.ra)(e),c.__emscripten_tls_init=()=>(c.__emscripten_tls_init=C.sa)();var gt=c.__emscripten_thread_init=(e,t,r,n,a,o)=>(gt=c.__emscripten_thread_init=C.ua)(e,t,r,n,a,o);c.__emscripten_thread_crashed=()=>(c.__emscripten_thread_crashed=C.va)();var ht,mt=(e,t,r,n)=>(mt=C.wa)(e,t,r,n),yt=e=>(yt=C.xa)(e),vt=c.__emscripten_thread_exit=e=>(vt=c.__emscripten_thread_exit=C.ya)(e),bt=c.__emscripten_check_mailbox=()=>(bt=c.__emscripten_check_mailbox=C.za)(),wt=e=>(wt=C.Aa)(e),_t=(e,t)=>(_t=C.Ba)(e,t),Ot=()=>(Ot=C.Ca)(),St=e=>(St=C.Da)(e),Et=e=>(Et=C.Ea)(e);function At(){function e(){if(!ht&&(ht=!0,c.calledRun=!0,!H)&&(b||he(N),s(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),!b)){if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var e=c.postRun.shift();B.unshift(e)}he(B)}}if(!(0{var _scriptDir,n=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(_scriptDir=_scriptDir||__filename),function(e={}){var t,n,a=e;a.ready=new Promise(((e,r)=>{t=e,n=r}));var o,i,s,u=Object.assign({},a),c="./this.program",l=(e,t)=>{throw t},f="object"==typeof window,d="function"==typeof importScripts,p="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,g="";if(p){var h=r(384),m=r(908);g=d?m.dirname(g)+"/":__dirname+"/",o=(e,t)=>(e=e.startsWith("file://")?new URL(e):m.normalize(e),h.readFileSync(e,t?void 0:"utf8")),s=e=>((e=o(e,!0)).buffer||(e=new Uint8Array(e)),e),i=(e,t,r,n=!0)=>{e=e.startsWith("file://")?new URL(e):m.normalize(e),h.readFile(e,n?void 0:"utf8",((e,a)=>{e?r(e):t(n?a.buffer:a)}))},!a.thisProgram&&1{throw process.exitCode=e,t},a.inspect=()=>"[Emscripten Module object]"}else(f||d)&&(d?g=self.location.href:"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src),_scriptDir&&(g=_scriptDir),g=0!==g.indexOf("blob:")?g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},d&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var y,v=a.print||console.log.bind(console),b=a.printErr||console.error.bind(console);Object.assign(a,u),u=null,a.thisProgram&&(c=a.thisProgram),a.quit&&(l=a.quit),a.wasmBinary&&(y=a.wasmBinary);var w=a.noExitRuntime||!0;"object"!=typeof WebAssembly&&W("no native wasm support detected");var _,O,S,E,A,T,M=!1;function R(){var e=_.buffer;a.HEAP8=S=new Int8Array(e),a.HEAP16=new Int16Array(e),a.HEAP32=A=new Int32Array(e),a.HEAPU8=E=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAPU32=T=new Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=new Float64Array(e)}var F=[],k=[],C=[];function P(){var e=a.preRun.shift();F.unshift(e)}var D,x,I=0,U=null,L=null;function W(e){throw a.onAbort&&a.onAbort(e),b(e="Aborted("+e+")"),M=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),n(e),e}function H(e){return e.startsWith("data:application/octet-stream;base64,")}if(!H(D="ort-wasm.wasm")){var Y=D;D=a.locateFile?a.locateFile(Y,g):g+Y}function j(e){if(e==D&&y)return new Uint8Array(y);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function z(e,t,r){return function(e){if(!y&&(f||d)){if("function"==typeof fetch&&!e.startsWith("file://"))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at \'"+e+"\'";return t.arrayBuffer()})).catch((()=>j(e)));if(i)return new Promise(((t,r)=>{i(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>j(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{b("failed to asynchronously prepare wasm: "+e),W(e)}))}function G(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var N=e=>{for(;0>2>>>0]=e},this.ua=function(e){T[this.qa+8>>2>>>0]=e},this.sa=function(e,t){this.ta(),this.va(e),this.ua(t)},this.ta=function(){T[this.qa+16>>2>>>0]=0}}var $,q="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,V=(e,t,r)=>{var n=(t>>>=0)+r;for(r=t;e[r]&&!(r>=n);)++r;if(16(a=224==(240&a)?(15&a)<<12|o<<6|i:(7&a)<<18|o<<12|i<<6|63&e[t++])?n+=String.fromCharCode(a):(a-=65536,n+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else n+=String.fromCharCode(a)}return n},J=(e,t)=>(e>>>=0)?V(E,e,t):"",X=e=>{for(var t=0,r=0;r=n?t++:2047>=n?t+=2:55296<=n&&57343>=n?(t+=4,++r):t+=3}return t},K=(e,t,r,n)=>{if(!(0>>=0;n=r+n-1;for(var o=0;o=i&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++o)),127>=i){if(r>=n)break;t[r++>>>0]=i}else{if(2047>=i){if(r+1>=n)break;t[r++>>>0]=192|i>>6}else{if(65535>=i){if(r+2>=n)break;t[r++>>>0]=224|i>>12}else{if(r+3>=n)break;t[r++>>>0]=240|i>>18,t[r++>>>0]=128|i>>12&63}t[r++>>>0]=128|i>>6&63}t[r++>>>0]=128|63&i}}return t[r>>>0]=0,r-a},Z=e=>0==e%4&&(0!=e%100||0==e%400),Q=[0,31,60,91,121,152,182,213,244,274,305,335],ee=[0,31,59,90,120,151,181,212,243,273,304,334],te=e=>{var t=X(e)+1,r=le(t);return r&&K(e,E,r,t),r},re={},ne=()=>{if(!$){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:c||"./this.program"};for(e in re)void 0===re[e]?delete t[e]:t[e]=re[e];var r=[];for(e in t)r.push(`${e}=${t[e]}`);$=r}return $},ae=[null,[],[]],oe=e=>(oe=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(p)try{var e=r(760);if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}W("initRandomDevice")})())(e),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];function ue(e,t,r,n){function a(e,t,r){for(e="number"==typeof e?e.toString():e||"";e.lengthe?-1:0n-e.getDate())){e.setDate(e.getDate()+t);break}t-=n-e.getDate()+1,e.setDate(1),11>r?e.setMonth(r+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return r=new Date(e.getFullYear()+1,0,4),t=s(new Date(e.getFullYear(),0,4)),r=s(r),0>=i(t,e)?0>=i(r,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}e>>>=0,t>>>=0,r>>>=0;var c=A[40+(n>>>=0)>>2>>>0];for(var l in n={ya:A[n>>2>>>0],xa:A[n+4>>2>>>0],oa:A[n+8>>2>>>0],ra:A[n+12>>2>>>0],pa:A[n+16>>2>>>0],na:A[n+20>>2>>>0],ha:A[n+24>>2>>>0],ma:A[n+28>>2>>>0],Aa:A[n+32>>2>>>0],wa:A[n+36>>2>>>0],za:c?J(c):""},r=J(r),c={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(l,"g"),c[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(l in c={"%a":e=>f[e.ha].substring(0,3),"%A":e=>f[e.ha],"%b":e=>d[e.pa].substring(0,3),"%B":e=>d[e.pa],"%C":e=>o((e.na+1900)/100|0,2),"%d":e=>o(e.ra,2),"%e":e=>a(e.ra,2," "),"%g":e=>u(e).toString().substring(2),"%G":e=>u(e),"%H":e=>o(e.oa,2),"%I":e=>(0==(e=e.oa)?e=12:12{for(var t=0,r=0;r<=e.pa-1;t+=(Z(e.na+1900)?ie:se)[r++]);return o(e.ra+t,3)},"%m":e=>o(e.pa+1,2),"%M":e=>o(e.xa,2),"%n":()=>"\\n","%p":e=>0<=e.oa&&12>e.oa?"AM":"PM","%S":e=>o(e.ya,2),"%t":()=>"\\t","%u":e=>e.ha||7,"%U":e=>o(Math.floor((e.ma+7-e.ha)/7),2),"%V":e=>{var t=Math.floor((e.ma+7-(e.ha+6)%7)/7);if(2>=(e.ha+371-e.ma-2)%7&&t++,t)53==t&&(4==(r=(e.ha+371-e.ma)%7)||3==r&&Z(e.na)||(t=1));else{t=52;var r=(e.ha+7-e.ma-1)%7;(4==r||5==r&&Z(e.na%400-1))&&t++}return o(t,2)},"%w":e=>e.ha,"%W":e=>o(Math.floor((e.ma+7-(e.ha+6)%7)/7),2),"%y":e=>(e.na+1900).toString().substring(2),"%Y":e=>e.na+1900,"%z":e=>{var t=0<=(e=e.wa);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":e=>e.za,"%%":()=>"%"},r=r.replace(/%%/g,"\\0\\0"),c)r.includes(l)&&(r=r.replace(new RegExp(l,"g"),c[l](n)));return l=function(e){var t=Array(X(e)+1);return K(e,t,0,t.length),t}(r=r.replace(/\\0\\0/g,"%")),l.length>t?0:(S.set(l,e>>>0),l.length-1)}var ce={a:function(e,t,r){throw new B(e>>>=0).sa(t>>>0,r>>>0),e},e:function(){return 0},I:function(){},y:function(){},A:function(){},K:function(){return 0},G:function(){},B:function(){},F:function(){},g:function(){},z:function(){},w:function(){},H:function(){},x:function(){},k:()=>!0,n:function(e,t,r){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,r>>>=0,e=new Date(1e3*e),A[r>>2>>>0]=e.getUTCSeconds(),A[r+4>>2>>>0]=e.getUTCMinutes(),A[r+8>>2>>>0]=e.getUTCHours(),A[r+12>>2>>>0]=e.getUTCDate(),A[r+16>>2>>>0]=e.getUTCMonth(),A[r+20>>2>>>0]=e.getUTCFullYear()-1900,A[r+24>>2>>>0]=e.getUTCDay(),A[r+28>>2>>>0]=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},o:function(e,t,r){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,r>>>=0,e=new Date(1e3*e),A[r>>2>>>0]=e.getSeconds(),A[r+4>>2>>>0]=e.getMinutes(),A[r+8>>2>>>0]=e.getHours(),A[r+12>>2>>>0]=e.getDate(),A[r+16>>2>>>0]=e.getMonth(),A[r+20>>2>>>0]=e.getFullYear()-1900,A[r+24>>2>>>0]=e.getDay(),A[r+28>>2>>>0]=(Z(e.getFullYear())?Q:ee)[e.getMonth()]+e.getDate()-1|0,A[r+36>>2>>>0]=-60*e.getTimezoneOffset(),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var n=new Date(e.getFullYear(),0,1).getTimezoneOffset();A[r+32>>2>>>0]=0|(t!=n&&e.getTimezoneOffset()==Math.min(n,t))},p:function(e){e>>>=0;var t=new Date(A[e+20>>2>>>0]+1900,A[e+16>>2>>>0],A[e+12>>2>>>0],A[e+8>>2>>>0],A[e+4>>2>>>0],A[e>>2>>>0],0),r=A[e+32>>2>>>0],n=t.getTimezoneOffset(),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),o=new Date(t.getFullYear(),0,1).getTimezoneOffset(),i=Math.min(o,a);return 0>r?A[e+32>>2>>>0]=Number(a!=o&&i==n):0>2>>>0]=t.getDay(),A[e+28>>2>>>0]=(Z(t.getFullYear())?Q:ee)[t.getMonth()]+t.getDate()-1|0,A[e>>2>>>0]=t.getSeconds(),A[e+4>>2>>>0]=t.getMinutes(),A[e+8>>2>>>0]=t.getHours(),A[e+12>>2>>>0]=t.getDate(),A[e+16>>2>>>0]=t.getMonth(),A[e+20>>2>>>0]=t.getYear(),e=t.getTime()/1e3,de((x=e,1<=+Math.abs(x)?0>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)),e>>>0},l:function(){return-52},m:function(){},u:function(e,t,r){function n(e){return(e=e.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?e[1]:"GMT"}r>>>=0;var a=(new Date).getFullYear(),o=new Date(a,0,1),i=new Date(a,6,1);a=o.getTimezoneOffset();var s=i.getTimezoneOffset();T[e>>>0>>2>>>0]=60*Math.max(a,s),A[t>>>0>>2>>>0]=Number(a!=s),e=n(o),t=n(i),e=te(e),t=te(t),s>2>>>0]=e,T[r+4>>2>>>0]=t):(T[r>>2>>>0]=t,T[r+4>>2>>>0]=e)},d:()=>{W("")},h:function(){return Date.now()},v:function(){return 4294901760},b:()=>performance.now(),J:function(e,t,r){return t>>>=0,E.copyWithin(e>>>0>>>0,t>>>0,t+(r>>>0)>>>0)},t:function(e){e>>>=0;var t=E.length;if(4294901760=r;r*=2){var n=t*(1+.2/r);n=Math.min(n,e+100663296);var a=Math;n=Math.max(e,n);e:{a=a.min.call(a,4294901760,n+(65536-n%65536)%65536)-_.buffer.byteLength+65535>>>16;try{_.grow(a),R();var o=1;break e}catch(e){}o=void 0}if(o)return!0}return!1},D:function(e,t){e>>>=0,t>>>=0;var r=0;return ne().forEach((function(n,a){var o=t+r;for(a=T[e+4*a>>2>>>0]=o,o=0;o>0>>>0]=n.charCodeAt(o);S[a>>0>>>0]=0,r+=n.length+1})),0},E:function(e,t){e>>>=0,t>>>=0;var r=ne();T[e>>2>>>0]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),T[t>>2>>>0]=n,0},s:e=>{w||(a.onExit&&a.onExit(e),M=!0),l(e,new G(e))},f:()=>52,j:function(){return 52},q:function(){return 70},i:function(e,t,r,n){t>>>=0,r>>>=0,n>>>=0;for(var a=0,o=0;o>2>>>0],s=T[t+4>>2>>>0];t+=8;for(var u=0;u>>0],l=ae[e];0===c||10===c?((1===e?v:b)(V(l,0)),l.length=0):l.push(c)}a+=s}return T[n>>2>>>0]=a,0},r:function(e,t){return e>>>=0,oe(E.subarray(e>>>0,e+(t>>>0)>>>0)),0},C:ue,c:function(e,t,r,n){return ue(e>>>0,t>>>0,r>>>0,n>>>0)}};!function(){function e(e){if(e=e.exports,O=e=function(e){var t=e=>()=>e()>>>0,r=e=>t=>e(t)>>>0;return(e=Object.assign({},e)).__errno_location=t(e.__errno_location),e.malloc=r(e.malloc),e.stackSave=t(e.stackSave),e.stackAlloc=r(e.stackAlloc),e}(e),_=O.L,R(),k.unshift(O.M),I--,a.monitorRunDependencies&&a.monitorRunDependencies(I),0==I&&(null!==U&&(clearInterval(U),U=null),L)){var t=L;L=null,t()}return e}var t={a:ce};if(I++,a.monitorRunDependencies&&a.monitorRunDependencies(I),a.instantiateWasm)try{return a.instantiateWasm(t,e)}catch(e){b("Module.instantiateWasm callback failed with error: "+e),n(e)}(function(e,t){var r=D;return y||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||r.startsWith("file://")||p||"function"!=typeof fetch?z(r,e,t):fetch(r,{credentials:"same-origin"}).then((n=>WebAssembly.instantiateStreaming(n,e).then(t,(function(n){return b("wasm streaming compile failed: "+n),b("falling back to ArrayBuffer instantiation"),z(r,e,t)}))))})(t,(function(t){e(t.instance)})).catch(n)}(),a._OrtInit=(e,t)=>(a._OrtInit=O.N)(e,t),a._OrtGetLastError=(e,t)=>(a._OrtGetLastError=O.O)(e,t),a._OrtCreateSessionOptions=(e,t,r,n,o,i,s,u,c,l)=>(a._OrtCreateSessionOptions=O.P)(e,t,r,n,o,i,s,u,c,l),a._OrtAppendExecutionProvider=(e,t)=>(a._OrtAppendExecutionProvider=O.Q)(e,t),a._OrtAddSessionConfigEntry=(e,t,r)=>(a._OrtAddSessionConfigEntry=O.R)(e,t,r),a._OrtReleaseSessionOptions=e=>(a._OrtReleaseSessionOptions=O.S)(e),a._OrtCreateSession=(e,t,r)=>(a._OrtCreateSession=O.T)(e,t,r),a._OrtReleaseSession=e=>(a._OrtReleaseSession=O.U)(e),a._OrtGetInputOutputCount=(e,t,r)=>(a._OrtGetInputOutputCount=O.V)(e,t,r),a._OrtGetInputName=(e,t)=>(a._OrtGetInputName=O.W)(e,t),a._OrtGetOutputName=(e,t)=>(a._OrtGetOutputName=O.X)(e,t),a._OrtFree=e=>(a._OrtFree=O.Y)(e),a._OrtCreateTensor=(e,t,r,n,o)=>(a._OrtCreateTensor=O.Z)(e,t,r,n,o),a._OrtGetTensorData=(e,t,r,n,o)=>(a._OrtGetTensorData=O._)(e,t,r,n,o),a._OrtReleaseTensor=e=>(a._OrtReleaseTensor=O.$)(e),a._OrtCreateRunOptions=(e,t,r,n)=>(a._OrtCreateRunOptions=O.aa)(e,t,r,n),a._OrtAddRunConfigEntry=(e,t,r)=>(a._OrtAddRunConfigEntry=O.ba)(e,t,r),a._OrtReleaseRunOptions=e=>(a._OrtReleaseRunOptions=O.ca)(e),a._OrtRun=(e,t,r,n,o,i,s,u)=>(a._OrtRun=O.da)(e,t,r,n,o,i,s,u),a._OrtEndProfiling=e=>(a._OrtEndProfiling=O.ea)(e);var le=a._malloc=e=>(le=a._malloc=O.fa)(e);a._free=e=>(a._free=O.ga)(e);var fe,de=e=>(de=O.ia)(e),pe=()=>(pe=O.ja)(),ge=e=>(ge=O.ka)(e),he=e=>(he=O.la)(e);function me(){function e(){if(!fe&&(fe=!0,a.calledRun=!0,!M)){if(N(k),t(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var e=a.postRun.shift();C.unshift(e)}N(C)}}if(!(0K(e,E,t,r),a.lengthBytesUTF8=X,L=function e(){fe||me(),fe||(L=e)},a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0{"use strict";e.exports=\'"use strict";var e={},a="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(a){var r=require("worker_threads"),t=r.parentPort;t.on("message",(e=>onmessage({data:e})));var s=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:e=>(0,eval)(s.readFileSync(e,"utf8")+"//# sourceURL="+e),postMessage:e=>t.postMessage(e),performance:global.performance||{now:Date.now}})}var o=!1,d=function(){var e=Array.prototype.slice.call(arguments).join(" ");a?s.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var a=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:a,threadId:e._pthread_self()})},e.instantiateWasm=(a,r)=>{var t=e.wasmModule;return e.wasmModule=null,r(new WebAssembly.Instance(t,a))},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=function a(r){try{if("load"===r.data.cmd){let s=[];self.onmessage=e=>s.push(e),self.startWorker=r=>{e=r,postMessage({cmd:"loaded"});for(let e of s)a(e);self.onmessage=a},e.wasmModule=r.data.wasmModule;for(const a of r.data.handlers)e[a]=(...e)=>{postMessage({cmd:"callHandler",handler:a,args:e})};if(e.wasmMemory=r.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof r.data.urlOrBlob)importScripts(r.data.urlOrBlob);else{var t=URL.createObjectURL(r.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(e)}else if("run"===r.data.cmd){e.__emscripten_thread_init(r.data.pthread_ptr,0,0,1),e.__emscripten_thread_mailbox_await(r.data.pthread_ptr),e.establishStackSpace(),e.PThread.receiveObjectTransfer(r.data),e.PThread.threadInitTLS(),o||(o=!0);try{e.invokeEntryPoint(r.data.start_routine,r.data.arg)}catch(e){if("unwind"!=e)throw e}}else"cancel"===r.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===r.data.target||("checkMailbox"===r.data.cmd?o&&e.checkMailbox():r.data.cmd&&(d("worker.js received unknown command "+r.data.cmd),d(r.data)))}catch(a){throw e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),a}};\\n\'},760:()=>{},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(()=>{"use strict";const e=r(259),t=r(263);self.onmessage=r=>{switch(r.data.type){case"init-wasm":try{(0,t.initializeWebAssembly)(r.data.in).then((()=>postMessage({type:"init-wasm"})),(e=>postMessage({type:"init-wasm",err:e})))}catch(e){postMessage({type:"init-wasm",err:e})}break;case"init-ort":try{(0,e.initRuntime)(r.data.in).then((()=>postMessage({type:"init-ort"})),(e=>postMessage({type:"init-ort",err:e}))),postMessage({type:"init-ort"})}catch(e){postMessage({type:"init-ort",err:e})}break;case"create_allocate":try{const{model:t}=r.data.in,n=(0,e.createSessionAllocate)(t);postMessage({type:"create_allocate",out:n})}catch(e){postMessage({type:"create_allocate",err:e})}break;case"create_finalize":try{const{modeldata:t,options:n}=r.data.in,a=(0,e.createSessionFinalize)(t,n);postMessage({type:"create_finalize",out:a})}catch(e){postMessage({type:"create_finalize",err:e})}break;case"create":try{const{model:t,options:n}=r.data.in,a=(0,e.createSession)(t,n);postMessage({type:"create",out:a})}catch(e){postMessage({type:"create",err:e})}break;case"release":try{const t=r.data.in;(0,e.releaseSession)(t),postMessage({type:"release"})}catch(e){postMessage({type:"release",err:e})}break;case"run":try{const{sessionId:t,inputIndices:n,inputs:a,outputIndices:o,options:i}=r.data.in;(0,e.run)(t,n,a,o,i).then((t=>{postMessage({type:"run",out:t},(0,e.extractTransferableBuffers)(t))}),(e=>{postMessage({type:"run",err:e})}))}catch(e){postMessage({type:"run",err:e})}break;case"end-profiling":try{const t=r.data.in;(0,e.endProfiling)(t),postMessage({type:"end-profiling"})}catch(e){postMessage({type:"end-profiling",err:e})}}}})()})();\n',"Worker",void 0,void 0)}},6614:$=>{$.exports=function(c,y,m,p){var h=self||window;try{try{var d;try{d=new h.Blob([c])}catch{(d=new(h.BlobBuilder||h.WebKitBlobBuilder||h.MozBlobBuilder||h.MSBlobBuilder)).append(c),d=d.getBlob()}var u=h.URL||h.webkitURL,l=u.createObjectURL(d),a=new h[y](l,m);return u.revokeObjectURL(l),a}catch{return new h[y]("data:application/javascript,".concat(encodeURIComponent(c)),m)}}catch{if(!p)throw Error("Inline worker is not supported");return new h[y](p,m)}}},2446:($,c,y)=>{var m,p,h,d=y(2100),u=d.Reader,l=d.Writer,a=d.util,o=d.roots.default||(d.roots.default={});o.onnx=((h={}).Version=(m={},(p=Object.create(m))[m[0]="_START_VERSION"]=0,p[m[1]="IR_VERSION_2017_10_10"]=1,p[m[2]="IR_VERSION_2017_10_30"]=2,p[m[3]="IR_VERSION_2017_11_3"]=3,p[m[4]="IR_VERSION_2019_1_22"]=4,p[m[5]="IR_VERSION_2019_3_18"]=5,p[m[6]="IR_VERSION_2019_9_19"]=6,p[m[7]="IR_VERSION_2020_5_8"]=7,p[m[8]="IR_VERSION_2021_7_30"]=8,p[m[9]="IR_VERSION"]=9,p),h.AttributeProto=function(){function n(t){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],this.sparseTensors=[],this.typeProtos=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:i.name=t.string();break;case 21:i.refAttrName=t.string();break;case 13:i.docString=t.string();break;case 20:i.type=t.int32();break;case 2:i.f=t.float();break;case 3:i.i=t.int64();break;case 4:i.s=t.bytes();break;case 5:i.t=o.onnx.TensorProto.decode(t,t.uint32());break;case 6:i.g=o.onnx.GraphProto.decode(t,t.uint32());break;case 22:i.sparseTensor=o.onnx.SparseTensorProto.decode(t,t.uint32());break;case 14:i.tp=o.onnx.TypeProto.decode(t,t.uint32());break;case 7:if(i.floats&&i.floats.length||(i.floats=[]),(7&s)==2)for(var f=t.uint32()+t.pos;t.pos>>0,t.i.high>>>0).toNumber())),t.s!=null&&(typeof t.s=="string"?a.base64.decode(t.s,e.s=a.newBuffer(a.base64.length(t.s)),0):t.s.length>=0&&(e.s=t.s)),t.t!=null){if(typeof t.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");e.t=o.onnx.TensorProto.fromObject(t.t)}if(t.g!=null){if(typeof t.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");e.g=o.onnx.GraphProto.fromObject(t.g)}if(t.sparseTensor!=null){if(typeof t.sparseTensor!="object")throw TypeError(".onnx.AttributeProto.sparseTensor: object expected");e.sparseTensor=o.onnx.SparseTensorProto.fromObject(t.sparseTensor)}if(t.tp!=null){if(typeof t.tp!="object")throw TypeError(".onnx.AttributeProto.tp: object expected");e.tp=o.onnx.TypeProto.fromObject(t.tp)}if(t.floats){if(!Array.isArray(t.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");e.floats=[];for(var r=0;r>>0,t.ints[r].high>>>0).toNumber())}if(t.strings){if(!Array.isArray(t.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(e.strings=[],r=0;r=0&&(e.strings[r]=t.strings[r])}if(t.tensors){if(!Array.isArray(t.tensors))throw TypeError(".onnx.AttributeProto.tensors: array expected");for(e.tensors=[],r=0;r>>0,t.i.high>>>0).toNumber():t.i),t.s!=null&&t.hasOwnProperty("s")&&(r.s=e.bytes===String?a.base64.encode(t.s,0,t.s.length):e.bytes===Array?Array.prototype.slice.call(t.s):t.s),t.t!=null&&t.hasOwnProperty("t")&&(r.t=o.onnx.TensorProto.toObject(t.t,e)),t.g!=null&&t.hasOwnProperty("g")&&(r.g=o.onnx.GraphProto.toObject(t.g,e)),t.floats&&t.floats.length){r.floats=[];for(var s=0;s>>0,t.ints[s].high>>>0).toNumber():t.ints[s];if(t.strings&&t.strings.length)for(r.strings=[],s=0;s>>3){case 1:i.name=t.string();break;case 2:i.type=o.onnx.TypeProto.decode(t,t.uint32());break;case 3:i.docString=t.string();break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.name!=null&&t.hasOwnProperty("name")&&!a.isString(t.name))return"name: string expected";if(t.type!=null&&t.hasOwnProperty("type")){var e=o.onnx.TypeProto.verify(t.type);if(e)return"type."+e}return t.docString!=null&&t.hasOwnProperty("docString")&&!a.isString(t.docString)?"docString: string expected":null},n.fromObject=function(t){if(t instanceof o.onnx.ValueInfoProto)return t;var e=new o.onnx.ValueInfoProto;if(t.name!=null&&(e.name=String(t.name)),t.type!=null){if(typeof t.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");e.type=o.onnx.TypeProto.fromObject(t.type)}return t.docString!=null&&(e.docString=String(t.docString)),e},n.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.name="",r.type=null,r.docString=""),t.name!=null&&t.hasOwnProperty("name")&&(r.name=t.name),t.type!=null&&t.hasOwnProperty("type")&&(r.type=o.onnx.TypeProto.toObject(t.type,e)),t.docString!=null&&t.hasOwnProperty("docString")&&(r.docString=t.docString),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/onnx.ValueInfoProto"},n}(),h.NodeProto=function(){function n(t){if(this.input=[],this.output=[],this.attribute=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:i.input&&i.input.length||(i.input=[]),i.input.push(t.string());break;case 2:i.output&&i.output.length||(i.output=[]),i.output.push(t.string());break;case 3:i.name=t.string();break;case 4:i.opType=t.string();break;case 7:i.domain=t.string();break;case 5:i.attribute&&i.attribute.length||(i.attribute=[]),i.attribute.push(o.onnx.AttributeProto.decode(t,t.uint32()));break;case 6:i.docString=t.string();break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.input!=null&&t.hasOwnProperty("input")){if(!Array.isArray(t.input))return"input: array expected";for(var e=0;e>>3){case 1:i.initialization=o.onnx.GraphProto.decode(t,t.uint32());break;case 2:i.algorithm=o.onnx.GraphProto.decode(t,t.uint32());break;case 3:i.initializationBinding&&i.initializationBinding.length||(i.initializationBinding=[]),i.initializationBinding.push(o.onnx.StringStringEntryProto.decode(t,t.uint32()));break;case 4:i.updateBinding&&i.updateBinding.length||(i.updateBinding=[]),i.updateBinding.push(o.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.initialization!=null&&t.hasOwnProperty("initialization")&&(r=o.onnx.GraphProto.verify(t.initialization)))return"initialization."+r;if(t.algorithm!=null&&t.hasOwnProperty("algorithm")&&(r=o.onnx.GraphProto.verify(t.algorithm)))return"algorithm."+r;if(t.initializationBinding!=null&&t.hasOwnProperty("initializationBinding")){if(!Array.isArray(t.initializationBinding))return"initializationBinding: array expected";for(var e=0;e>>3){case 1:i.irVersion=t.int64();break;case 8:i.opsetImport&&i.opsetImport.length||(i.opsetImport=[]),i.opsetImport.push(o.onnx.OperatorSetIdProto.decode(t,t.uint32()));break;case 2:i.producerName=t.string();break;case 3:i.producerVersion=t.string();break;case 4:i.domain=t.string();break;case 5:i.modelVersion=t.int64();break;case 6:i.docString=t.string();break;case 7:i.graph=o.onnx.GraphProto.decode(t,t.uint32());break;case 14:i.metadataProps&&i.metadataProps.length||(i.metadataProps=[]),i.metadataProps.push(o.onnx.StringStringEntryProto.decode(t,t.uint32()));break;case 20:i.trainingInfo&&i.trainingInfo.length||(i.trainingInfo=[]),i.trainingInfo.push(o.onnx.TrainingInfoProto.decode(t,t.uint32()));break;case 25:i.functions&&i.functions.length||(i.functions=[]),i.functions.push(o.onnx.FunctionProto.decode(t,t.uint32()));break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.irVersion!=null&&t.hasOwnProperty("irVersion")&&!(a.isInteger(t.irVersion)||t.irVersion&&a.isInteger(t.irVersion.low)&&a.isInteger(t.irVersion.high)))return"irVersion: integer|Long expected";if(t.opsetImport!=null&&t.hasOwnProperty("opsetImport")){if(!Array.isArray(t.opsetImport))return"opsetImport: array expected";for(var e=0;e>>0,t.irVersion.high>>>0).toNumber())),t.opsetImport){if(!Array.isArray(t.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");e.opsetImport=[];for(var r=0;r>>0,t.modelVersion.high>>>0).toNumber())),t.docString!=null&&(e.docString=String(t.docString)),t.graph!=null){if(typeof t.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");e.graph=o.onnx.GraphProto.fromObject(t.graph)}if(t.metadataProps){if(!Array.isArray(t.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(e.metadataProps=[],r=0;r>>0,t.irVersion.high>>>0).toNumber():t.irVersion),t.producerName!=null&&t.hasOwnProperty("producerName")&&(r.producerName=t.producerName),t.producerVersion!=null&&t.hasOwnProperty("producerVersion")&&(r.producerVersion=t.producerVersion),t.domain!=null&&t.hasOwnProperty("domain")&&(r.domain=t.domain),t.modelVersion!=null&&t.hasOwnProperty("modelVersion")&&(typeof t.modelVersion=="number"?r.modelVersion=e.longs===String?String(t.modelVersion):t.modelVersion:r.modelVersion=e.longs===String?a.Long.prototype.toString.call(t.modelVersion):e.longs===Number?new a.LongBits(t.modelVersion.low>>>0,t.modelVersion.high>>>0).toNumber():t.modelVersion),t.docString!=null&&t.hasOwnProperty("docString")&&(r.docString=t.docString),t.graph!=null&&t.hasOwnProperty("graph")&&(r.graph=o.onnx.GraphProto.toObject(t.graph,e)),t.opsetImport&&t.opsetImport.length){r.opsetImport=[];for(var s=0;s>>3){case 1:i.key=t.string();break;case 2:i.value=t.string();break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.key!=null&&t.hasOwnProperty("key")&&!a.isString(t.key)?"key: string expected":t.value!=null&&t.hasOwnProperty("value")&&!a.isString(t.value)?"value: string expected":null},n.fromObject=function(t){if(t instanceof o.onnx.StringStringEntryProto)return t;var e=new o.onnx.StringStringEntryProto;return t.key!=null&&(e.key=String(t.key)),t.value!=null&&(e.value=String(t.value)),e},n.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.key="",r.value=""),t.key!=null&&t.hasOwnProperty("key")&&(r.key=t.key),t.value!=null&&t.hasOwnProperty("value")&&(r.value=t.value),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/onnx.StringStringEntryProto"},n}(),h.TensorAnnotation=function(){function n(t){if(this.quantParameterTensorNames=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:i.tensorName=t.string();break;case 2:i.quantParameterTensorNames&&i.quantParameterTensorNames.length||(i.quantParameterTensorNames=[]),i.quantParameterTensorNames.push(o.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.tensorName!=null&&t.hasOwnProperty("tensorName")&&!a.isString(t.tensorName))return"tensorName: string expected";if(t.quantParameterTensorNames!=null&&t.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(t.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var e=0;e>>3){case 1:i.node&&i.node.length||(i.node=[]),i.node.push(o.onnx.NodeProto.decode(t,t.uint32()));break;case 2:i.name=t.string();break;case 5:i.initializer&&i.initializer.length||(i.initializer=[]),i.initializer.push(o.onnx.TensorProto.decode(t,t.uint32()));break;case 15:i.sparseInitializer&&i.sparseInitializer.length||(i.sparseInitializer=[]),i.sparseInitializer.push(o.onnx.SparseTensorProto.decode(t,t.uint32()));break;case 10:i.docString=t.string();break;case 11:i.input&&i.input.length||(i.input=[]),i.input.push(o.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 12:i.output&&i.output.length||(i.output=[]),i.output.push(o.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 13:i.valueInfo&&i.valueInfo.length||(i.valueInfo=[]),i.valueInfo.push(o.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 14:i.quantizationAnnotation&&i.quantizationAnnotation.length||(i.quantizationAnnotation=[]),i.quantizationAnnotation.push(o.onnx.TensorAnnotation.decode(t,t.uint32()));break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.node!=null&&t.hasOwnProperty("node")){if(!Array.isArray(t.node))return"node: array expected";for(var e=0;e>>3){case 1:if(i.dims&&i.dims.length||(i.dims=[]),(7&s)==2)for(var f=t.uint32()+t.pos;t.pos>>0,t.dims[r].high>>>0).toNumber())}if(t.dataType!=null&&(e.dataType=0|t.dataType),t.segment!=null){if(typeof t.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");e.segment=o.onnx.TensorProto.Segment.fromObject(t.segment)}if(t.floatData){if(!Array.isArray(t.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(e.floatData=[],r=0;r=0&&(e.stringData[r]=t.stringData[r])}if(t.int64Data){if(!Array.isArray(t.int64Data))throw TypeError(".onnx.TensorProto.int64Data: array expected");for(e.int64Data=[],r=0;r>>0,t.int64Data[r].high>>>0).toNumber())}if(t.name!=null&&(e.name=String(t.name)),t.docString!=null&&(e.docString=String(t.docString)),t.rawData!=null&&(typeof t.rawData=="string"?a.base64.decode(t.rawData,e.rawData=a.newBuffer(a.base64.length(t.rawData)),0):t.rawData.length>=0&&(e.rawData=t.rawData)),t.externalData){if(!Array.isArray(t.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(e.externalData=[],r=0;r>>0,t.uint64Data[r].high>>>0).toNumber(!0))}return e},n.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.dims=[],r.floatData=[],r.int32Data=[],r.stringData=[],r.int64Data=[],r.doubleData=[],r.uint64Data=[],r.externalData=[]),e.defaults&&(r.dataType=0,r.segment=null,r.name="",e.bytes===String?r.rawData="":(r.rawData=[],e.bytes!==Array&&(r.rawData=a.newBuffer(r.rawData))),r.docString="",r.dataLocation=e.enums===String?"DEFAULT":0),t.dims&&t.dims.length){r.dims=[];for(var i=0;i>>0,t.dims[i].high>>>0).toNumber():t.dims[i]}if(t.dataType!=null&&t.hasOwnProperty("dataType")&&(r.dataType=t.dataType),t.segment!=null&&t.hasOwnProperty("segment")&&(r.segment=o.onnx.TensorProto.Segment.toObject(t.segment,e)),t.floatData&&t.floatData.length)for(r.floatData=[],i=0;i>>0,t.int64Data[i].high>>>0).toNumber():t.int64Data[i];if(t.name!=null&&t.hasOwnProperty("name")&&(r.name=t.name),t.rawData!=null&&t.hasOwnProperty("rawData")&&(r.rawData=e.bytes===String?a.base64.encode(t.rawData,0,t.rawData.length):e.bytes===Array?Array.prototype.slice.call(t.rawData):t.rawData),t.doubleData&&t.doubleData.length)for(r.doubleData=[],i=0;i>>0,t.uint64Data[i].high>>>0).toNumber(!0):t.uint64Data[i];if(t.docString!=null&&t.hasOwnProperty("docString")&&(r.docString=t.docString),t.externalData&&t.externalData.length)for(r.externalData=[],i=0;i>>3){case 1:s.begin=e.int64();break;case 2:s.end=e.int64();break;default:e.skipType(7&f)}}return s},t.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},t.verify=function(e){return typeof e!="object"||e===null?"object expected":e.begin!=null&&e.hasOwnProperty("begin")&&!(a.isInteger(e.begin)||e.begin&&a.isInteger(e.begin.low)&&a.isInteger(e.begin.high))?"begin: integer|Long expected":e.end!=null&&e.hasOwnProperty("end")&&!(a.isInteger(e.end)||e.end&&a.isInteger(e.end.low)&&a.isInteger(e.end.high))?"end: integer|Long expected":null},t.fromObject=function(e){if(e instanceof o.onnx.TensorProto.Segment)return e;var r=new o.onnx.TensorProto.Segment;return e.begin!=null&&(a.Long?(r.begin=a.Long.fromValue(e.begin)).unsigned=!1:typeof e.begin=="string"?r.begin=parseInt(e.begin,10):typeof e.begin=="number"?r.begin=e.begin:typeof e.begin=="object"&&(r.begin=new a.LongBits(e.begin.low>>>0,e.begin.high>>>0).toNumber())),e.end!=null&&(a.Long?(r.end=a.Long.fromValue(e.end)).unsigned=!1:typeof e.end=="string"?r.end=parseInt(e.end,10):typeof e.end=="number"?r.end=e.end:typeof e.end=="object"&&(r.end=new a.LongBits(e.end.low>>>0,e.end.high>>>0).toNumber())),r},t.toObject=function(e,r){r||(r={});var i={};if(r.defaults){if(a.Long){var s=new a.Long(0,0,!1);i.begin=r.longs===String?s.toString():r.longs===Number?s.toNumber():s}else i.begin=r.longs===String?"0":0;a.Long?(s=new a.Long(0,0,!1),i.end=r.longs===String?s.toString():r.longs===Number?s.toNumber():s):i.end=r.longs===String?"0":0}return e.begin!=null&&e.hasOwnProperty("begin")&&(typeof e.begin=="number"?i.begin=r.longs===String?String(e.begin):e.begin:i.begin=r.longs===String?a.Long.prototype.toString.call(e.begin):r.longs===Number?new a.LongBits(e.begin.low>>>0,e.begin.high>>>0).toNumber():e.begin),e.end!=null&&e.hasOwnProperty("end")&&(typeof e.end=="number"?i.end=r.longs===String?String(e.end):e.end:i.end=r.longs===String?a.Long.prototype.toString.call(e.end):r.longs===Number?new a.LongBits(e.end.low>>>0,e.end.high>>>0).toNumber():e.end),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TensorProto.Segment"},t}(),n.DataLocation=function(){var t={},e=Object.create(t);return e[t[0]="DEFAULT"]=0,e[t[1]="EXTERNAL"]=1,e}(),n}(),h.SparseTensorProto=function(){function n(t){if(this.dims=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:i.values=o.onnx.TensorProto.decode(t,t.uint32());break;case 2:i.indices=o.onnx.TensorProto.decode(t,t.uint32());break;case 3:if(i.dims&&i.dims.length||(i.dims=[]),(7&s)==2)for(var f=t.uint32()+t.pos;t.pos>>0,t.dims[r].high>>>0).toNumber())}return e},n.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.dims=[]),e.defaults&&(r.values=null,r.indices=null),t.values!=null&&t.hasOwnProperty("values")&&(r.values=o.onnx.TensorProto.toObject(t.values,e)),t.indices!=null&&t.hasOwnProperty("indices")&&(r.indices=o.onnx.TensorProto.toObject(t.indices,e)),t.dims&&t.dims.length){r.dims=[];for(var i=0;i>>0,t.dims[i].high>>>0).toNumber():t.dims[i]}return r},n.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/onnx.SparseTensorProto"},n}(),h.TensorShapeProto=function(){function n(t){if(this.dim=[],t)for(var e=Object.keys(t),r=0;r>>3==1?(i.dim&&i.dim.length||(i.dim=[]),i.dim.push(o.onnx.TensorShapeProto.Dimension.decode(t,t.uint32()))):t.skipType(7&s)}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.dim!=null&&t.hasOwnProperty("dim")){if(!Array.isArray(t.dim))return"dim: array expected";for(var e=0;e>>3){case 1:f.dimValue=r.int64();break;case 2:f.dimParam=r.string();break;case 3:f.denotation=r.string();break;default:r.skipType(7&g)}}return f},t.decodeDelimited=function(r){return r instanceof u||(r=new u(r)),this.decode(r,r.uint32())},t.verify=function(r){if(typeof r!="object"||r===null)return"object expected";var i={};if(r.dimValue!=null&&r.hasOwnProperty("dimValue")&&(i.value=1,!(a.isInteger(r.dimValue)||r.dimValue&&a.isInteger(r.dimValue.low)&&a.isInteger(r.dimValue.high))))return"dimValue: integer|Long expected";if(r.dimParam!=null&&r.hasOwnProperty("dimParam")){if(i.value===1)return"value: multiple values";if(i.value=1,!a.isString(r.dimParam))return"dimParam: string expected"}return r.denotation!=null&&r.hasOwnProperty("denotation")&&!a.isString(r.denotation)?"denotation: string expected":null},t.fromObject=function(r){if(r instanceof o.onnx.TensorShapeProto.Dimension)return r;var i=new o.onnx.TensorShapeProto.Dimension;return r.dimValue!=null&&(a.Long?(i.dimValue=a.Long.fromValue(r.dimValue)).unsigned=!1:typeof r.dimValue=="string"?i.dimValue=parseInt(r.dimValue,10):typeof r.dimValue=="number"?i.dimValue=r.dimValue:typeof r.dimValue=="object"&&(i.dimValue=new a.LongBits(r.dimValue.low>>>0,r.dimValue.high>>>0).toNumber())),r.dimParam!=null&&(i.dimParam=String(r.dimParam)),r.denotation!=null&&(i.denotation=String(r.denotation)),i},t.toObject=function(r,i){i||(i={});var s={};return i.defaults&&(s.denotation=""),r.dimValue!=null&&r.hasOwnProperty("dimValue")&&(typeof r.dimValue=="number"?s.dimValue=i.longs===String?String(r.dimValue):r.dimValue:s.dimValue=i.longs===String?a.Long.prototype.toString.call(r.dimValue):i.longs===Number?new a.LongBits(r.dimValue.low>>>0,r.dimValue.high>>>0).toNumber():r.dimValue,i.oneofs&&(s.value="dimValue")),r.dimParam!=null&&r.hasOwnProperty("dimParam")&&(s.dimParam=r.dimParam,i.oneofs&&(s.value="dimParam")),r.denotation!=null&&r.hasOwnProperty("denotation")&&(s.denotation=r.denotation),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},t.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TensorShapeProto.Dimension"},t}(),n}(),h.TypeProto=function(){function n(e){if(e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.tensorType=o.onnx.TypeProto.Tensor.decode(e,e.uint32());break;case 4:s.sequenceType=o.onnx.TypeProto.Sequence.decode(e,e.uint32());break;case 5:s.mapType=o.onnx.TypeProto.Map.decode(e,e.uint32());break;case 9:s.optionalType=o.onnx.TypeProto.Optional.decode(e,e.uint32());break;case 8:s.sparseTensorType=o.onnx.TypeProto.SparseTensor.decode(e,e.uint32());break;case 6:s.denotation=e.string();break;default:e.skipType(7&f)}}return s},n.decodeDelimited=function(e){return e instanceof u||(e=new u(e)),this.decode(e,e.uint32())},n.verify=function(e){if(typeof e!="object"||e===null)return"object expected";var r={};if(e.tensorType!=null&&e.hasOwnProperty("tensorType")&&(r.value=1,i=o.onnx.TypeProto.Tensor.verify(e.tensorType)))return"tensorType."+i;if(e.sequenceType!=null&&e.hasOwnProperty("sequenceType")){if(r.value===1)return"value: multiple values";if(r.value=1,i=o.onnx.TypeProto.Sequence.verify(e.sequenceType))return"sequenceType."+i}if(e.mapType!=null&&e.hasOwnProperty("mapType")){if(r.value===1)return"value: multiple values";if(r.value=1,i=o.onnx.TypeProto.Map.verify(e.mapType))return"mapType."+i}if(e.optionalType!=null&&e.hasOwnProperty("optionalType")){if(r.value===1)return"value: multiple values";if(r.value=1,i=o.onnx.TypeProto.Optional.verify(e.optionalType))return"optionalType."+i}if(e.sparseTensorType!=null&&e.hasOwnProperty("sparseTensorType")){if(r.value===1)return"value: multiple values";var i;if(r.value=1,i=o.onnx.TypeProto.SparseTensor.verify(e.sparseTensorType))return"sparseTensorType."+i}return e.denotation!=null&&e.hasOwnProperty("denotation")&&!a.isString(e.denotation)?"denotation: string expected":null},n.fromObject=function(e){if(e instanceof o.onnx.TypeProto)return e;var r=new o.onnx.TypeProto;if(e.tensorType!=null){if(typeof e.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");r.tensorType=o.onnx.TypeProto.Tensor.fromObject(e.tensorType)}if(e.sequenceType!=null){if(typeof e.sequenceType!="object")throw TypeError(".onnx.TypeProto.sequenceType: object expected");r.sequenceType=o.onnx.TypeProto.Sequence.fromObject(e.sequenceType)}if(e.mapType!=null){if(typeof e.mapType!="object")throw TypeError(".onnx.TypeProto.mapType: object expected");r.mapType=o.onnx.TypeProto.Map.fromObject(e.mapType)}if(e.optionalType!=null){if(typeof e.optionalType!="object")throw TypeError(".onnx.TypeProto.optionalType: object expected");r.optionalType=o.onnx.TypeProto.Optional.fromObject(e.optionalType)}if(e.sparseTensorType!=null){if(typeof e.sparseTensorType!="object")throw TypeError(".onnx.TypeProto.sparseTensorType: object expected");r.sparseTensorType=o.onnx.TypeProto.SparseTensor.fromObject(e.sparseTensorType)}return e.denotation!=null&&(r.denotation=String(e.denotation)),r},n.toObject=function(e,r){r||(r={});var i={};return r.defaults&&(i.denotation=""),e.tensorType!=null&&e.hasOwnProperty("tensorType")&&(i.tensorType=o.onnx.TypeProto.Tensor.toObject(e.tensorType,r),r.oneofs&&(i.value="tensorType")),e.sequenceType!=null&&e.hasOwnProperty("sequenceType")&&(i.sequenceType=o.onnx.TypeProto.Sequence.toObject(e.sequenceType,r),r.oneofs&&(i.value="sequenceType")),e.mapType!=null&&e.hasOwnProperty("mapType")&&(i.mapType=o.onnx.TypeProto.Map.toObject(e.mapType,r),r.oneofs&&(i.value="mapType")),e.denotation!=null&&e.hasOwnProperty("denotation")&&(i.denotation=e.denotation),e.sparseTensorType!=null&&e.hasOwnProperty("sparseTensorType")&&(i.sparseTensorType=o.onnx.TypeProto.SparseTensor.toObject(e.sparseTensorType,r),r.oneofs&&(i.value="sparseTensorType")),e.optionalType!=null&&e.hasOwnProperty("optionalType")&&(i.optionalType=o.onnx.TypeProto.Optional.toObject(e.optionalType,r),r.oneofs&&(i.value="optionalType")),i},n.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},n.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TypeProto"},n.Tensor=function(){function e(r){if(r)for(var i=Object.keys(r),s=0;s>>3){case 1:f.elemType=r.int32();break;case 2:f.shape=o.onnx.TensorShapeProto.decode(r,r.uint32());break;default:r.skipType(7&g)}}return f},e.decodeDelimited=function(r){return r instanceof u||(r=new u(r)),this.decode(r,r.uint32())},e.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.elemType!=null&&r.hasOwnProperty("elemType")&&!a.isInteger(r.elemType))return"elemType: integer expected";if(r.shape!=null&&r.hasOwnProperty("shape")){var i=o.onnx.TensorShapeProto.verify(r.shape);if(i)return"shape."+i}return null},e.fromObject=function(r){if(r instanceof o.onnx.TypeProto.Tensor)return r;var i=new o.onnx.TypeProto.Tensor;if(r.elemType!=null&&(i.elemType=0|r.elemType),r.shape!=null){if(typeof r.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");i.shape=o.onnx.TensorShapeProto.fromObject(r.shape)}return i},e.toObject=function(r,i){i||(i={});var s={};return i.defaults&&(s.elemType=0,s.shape=null),r.elemType!=null&&r.hasOwnProperty("elemType")&&(s.elemType=r.elemType),r.shape!=null&&r.hasOwnProperty("shape")&&(s.shape=o.onnx.TensorShapeProto.toObject(r.shape,i)),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TypeProto.Tensor"},e}(),n.Sequence=function(){function e(r){if(r)for(var i=Object.keys(r),s=0;s>>3==1?f.elemType=o.onnx.TypeProto.decode(r,r.uint32()):r.skipType(7&g)}return f},e.decodeDelimited=function(r){return r instanceof u||(r=new u(r)),this.decode(r,r.uint32())},e.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.elemType!=null&&r.hasOwnProperty("elemType")){var i=o.onnx.TypeProto.verify(r.elemType);if(i)return"elemType."+i}return null},e.fromObject=function(r){if(r instanceof o.onnx.TypeProto.Sequence)return r;var i=new o.onnx.TypeProto.Sequence;if(r.elemType!=null){if(typeof r.elemType!="object")throw TypeError(".onnx.TypeProto.Sequence.elemType: object expected");i.elemType=o.onnx.TypeProto.fromObject(r.elemType)}return i},e.toObject=function(r,i){i||(i={});var s={};return i.defaults&&(s.elemType=null),r.elemType!=null&&r.hasOwnProperty("elemType")&&(s.elemType=o.onnx.TypeProto.toObject(r.elemType,i)),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TypeProto.Sequence"},e}(),n.Map=function(){function e(r){if(r)for(var i=Object.keys(r),s=0;s>>3){case 1:f.keyType=r.int32();break;case 2:f.valueType=o.onnx.TypeProto.decode(r,r.uint32());break;default:r.skipType(7&g)}}return f},e.decodeDelimited=function(r){return r instanceof u||(r=new u(r)),this.decode(r,r.uint32())},e.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.keyType!=null&&r.hasOwnProperty("keyType")&&!a.isInteger(r.keyType))return"keyType: integer expected";if(r.valueType!=null&&r.hasOwnProperty("valueType")){var i=o.onnx.TypeProto.verify(r.valueType);if(i)return"valueType."+i}return null},e.fromObject=function(r){if(r instanceof o.onnx.TypeProto.Map)return r;var i=new o.onnx.TypeProto.Map;if(r.keyType!=null&&(i.keyType=0|r.keyType),r.valueType!=null){if(typeof r.valueType!="object")throw TypeError(".onnx.TypeProto.Map.valueType: object expected");i.valueType=o.onnx.TypeProto.fromObject(r.valueType)}return i},e.toObject=function(r,i){i||(i={});var s={};return i.defaults&&(s.keyType=0,s.valueType=null),r.keyType!=null&&r.hasOwnProperty("keyType")&&(s.keyType=r.keyType),r.valueType!=null&&r.hasOwnProperty("valueType")&&(s.valueType=o.onnx.TypeProto.toObject(r.valueType,i)),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TypeProto.Map"},e}(),n.Optional=function(){function e(r){if(r)for(var i=Object.keys(r),s=0;s>>3==1?f.elemType=o.onnx.TypeProto.decode(r,r.uint32()):r.skipType(7&g)}return f},e.decodeDelimited=function(r){return r instanceof u||(r=new u(r)),this.decode(r,r.uint32())},e.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.elemType!=null&&r.hasOwnProperty("elemType")){var i=o.onnx.TypeProto.verify(r.elemType);if(i)return"elemType."+i}return null},e.fromObject=function(r){if(r instanceof o.onnx.TypeProto.Optional)return r;var i=new o.onnx.TypeProto.Optional;if(r.elemType!=null){if(typeof r.elemType!="object")throw TypeError(".onnx.TypeProto.Optional.elemType: object expected");i.elemType=o.onnx.TypeProto.fromObject(r.elemType)}return i},e.toObject=function(r,i){i||(i={});var s={};return i.defaults&&(s.elemType=null),r.elemType!=null&&r.hasOwnProperty("elemType")&&(s.elemType=o.onnx.TypeProto.toObject(r.elemType,i)),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TypeProto.Optional"},e}(),n.SparseTensor=function(){function e(r){if(r)for(var i=Object.keys(r),s=0;s>>3){case 1:f.elemType=r.int32();break;case 2:f.shape=o.onnx.TensorShapeProto.decode(r,r.uint32());break;default:r.skipType(7&g)}}return f},e.decodeDelimited=function(r){return r instanceof u||(r=new u(r)),this.decode(r,r.uint32())},e.verify=function(r){if(typeof r!="object"||r===null)return"object expected";if(r.elemType!=null&&r.hasOwnProperty("elemType")&&!a.isInteger(r.elemType))return"elemType: integer expected";if(r.shape!=null&&r.hasOwnProperty("shape")){var i=o.onnx.TensorShapeProto.verify(r.shape);if(i)return"shape."+i}return null},e.fromObject=function(r){if(r instanceof o.onnx.TypeProto.SparseTensor)return r;var i=new o.onnx.TypeProto.SparseTensor;if(r.elemType!=null&&(i.elemType=0|r.elemType),r.shape!=null){if(typeof r.shape!="object")throw TypeError(".onnx.TypeProto.SparseTensor.shape: object expected");i.shape=o.onnx.TensorShapeProto.fromObject(r.shape)}return i},e.toObject=function(r,i){i||(i={});var s={};return i.defaults&&(s.elemType=0,s.shape=null),r.elemType!=null&&r.hasOwnProperty("elemType")&&(s.elemType=r.elemType),r.shape!=null&&r.hasOwnProperty("shape")&&(s.shape=o.onnx.TensorShapeProto.toObject(r.shape,i)),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},e.getTypeUrl=function(r){return r===void 0&&(r="type.googleapis.com"),r+"/onnx.TypeProto.SparseTensor"},e}(),n}(),h.OperatorSetIdProto=function(){function n(t){if(t)for(var e=Object.keys(t),r=0;r>>3){case 1:i.domain=t.string();break;case 2:i.version=t.int64();break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.domain!=null&&t.hasOwnProperty("domain")&&!a.isString(t.domain)?"domain: string expected":t.version!=null&&t.hasOwnProperty("version")&&!(a.isInteger(t.version)||t.version&&a.isInteger(t.version.low)&&a.isInteger(t.version.high))?"version: integer|Long expected":null},n.fromObject=function(t){if(t instanceof o.onnx.OperatorSetIdProto)return t;var e=new o.onnx.OperatorSetIdProto;return t.domain!=null&&(e.domain=String(t.domain)),t.version!=null&&(a.Long?(e.version=a.Long.fromValue(t.version)).unsigned=!1:typeof t.version=="string"?e.version=parseInt(t.version,10):typeof t.version=="number"?e.version=t.version:typeof t.version=="object"&&(e.version=new a.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber())),e},n.toObject=function(t,e){e||(e={});var r={};if(e.defaults)if(r.domain="",a.Long){var i=new a.Long(0,0,!1);r.version=e.longs===String?i.toString():e.longs===Number?i.toNumber():i}else r.version=e.longs===String?"0":0;return t.domain!=null&&t.hasOwnProperty("domain")&&(r.domain=t.domain),t.version!=null&&t.hasOwnProperty("version")&&(typeof t.version=="number"?r.version=e.longs===String?String(t.version):t.version:r.version=e.longs===String?a.Long.prototype.toString.call(t.version):e.longs===Number?new a.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber():t.version),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,d.util.toJSONOptions)},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/onnx.OperatorSetIdProto"},n}(),h.OperatorStatus=function(){var n={},t=Object.create(n);return t[n[0]="EXPERIMENTAL"]=0,t[n[1]="STABLE"]=1,t}(),h.FunctionProto=function(){function n(t){if(this.input=[],this.output=[],this.attribute=[],this.attributeProto=[],this.node=[],this.opsetImport=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:i.name=t.string();break;case 4:i.input&&i.input.length||(i.input=[]),i.input.push(t.string());break;case 5:i.output&&i.output.length||(i.output=[]),i.output.push(t.string());break;case 6:i.attribute&&i.attribute.length||(i.attribute=[]),i.attribute.push(t.string());break;case 11:i.attributeProto&&i.attributeProto.length||(i.attributeProto=[]),i.attributeProto.push(o.onnx.AttributeProto.decode(t,t.uint32()));break;case 7:i.node&&i.node.length||(i.node=[]),i.node.push(o.onnx.NodeProto.decode(t,t.uint32()));break;case 8:i.docString=t.string();break;case 9:i.opsetImport&&i.opsetImport.length||(i.opsetImport=[]),i.opsetImport.push(o.onnx.OperatorSetIdProto.decode(t,t.uint32()));break;case 10:i.domain=t.string();break;default:t.skipType(7&s)}}return i},n.decodeDelimited=function(t){return t instanceof u||(t=new u(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.name!=null&&t.hasOwnProperty("name")&&!a.isString(t.name))return"name: string expected";if(t.input!=null&&t.hasOwnProperty("input")){if(!Array.isArray(t.input))return"input: array expected";for(var e=0;e{var m,p=(m=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(m=m||__filename),function(h={}){function d(){return q.buffer!=J.buffer&>(),J}function u(){return q.buffer!=J.buffer&>(),tt}function l(){return q.buffer!=J.buffer&>(),nt}function a(){return q.buffer!=J.buffer&>(),rt}function o(){return q.buffer!=J.buffer&>(),it}var n,t,e=h;e.ready=new Promise((_,P)=>{n=_,t=P});var r,i,s,f=Object.assign({},e),g="./this.program",b=(_,P)=>{throw P},v=typeof window=="object",w=typeof importScripts=="function",T=typeof process$1=="object"&&typeof process$1.versions=="object"&&typeof process$1.versions.node=="string",x=e.ENVIRONMENT_IS_PTHREAD||!1,A="";function D(_){return e.locateFile?e.locateFile(_,A):A+_}if(T){var k=y(1384),j=y(908);let _;A=w?j.dirname(A)+"/":__dirname+"/",r=(P,F)=>(P=P.startsWith("file://")?new URL(P):j.normalize(P),k.readFileSync(P,F?void 0:"utf8")),s=P=>((P=r(P,!0)).buffer||(P=new Uint8Array(P)),P),i=(P,F,L,B=!0)=>{P=P.startsWith("file://")?new URL(P):j.normalize(P),k.readFile(P,B?void 0:"utf8",(Y,Q)=>{Y?L(Y):F(B?Q.buffer:Q)})},!e.thisProgram&&1{throw process$1.exitCode=P,F},e.inspect=()=>"[Emscripten Module object]";try{_=y(9925)}catch(P){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),P}commonjsGlobal.Worker=_.Worker}else(v||w)&&(w?A=self.location.href:typeof document<"u"&&document.currentScript&&(A=document.currentScript.src),m&&(A=m),A=A.indexOf("blob:")!==0?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",T||(r=_=>{var P=new XMLHttpRequest;return P.open("GET",_,!1),P.send(null),P.responseText},w&&(s=_=>{var P=new XMLHttpRequest;return P.open("GET",_,!1),P.responseType="arraybuffer",P.send(null),new Uint8Array(P.response)}),i=(_,P,F)=>{var L=new XMLHttpRequest;L.open("GET",_,!0),L.responseType="arraybuffer",L.onload=()=>{L.status==200||L.status==0&&L.response?P(L.response):F()},L.onerror=F,L.send(null)}));T&&typeof performance>"u"&&(commonjsGlobal.performance=y(6953).performance);var M=console.log.bind(console),S=console.error.bind(console);T&&(M=(..._)=>k.writeSync(1,_.join(" ")+` +`),S=(..._)=>k.writeSync(2,_.join(" ")+` +`));var U,O=e.print||M,E=e.printErr||S;Object.assign(e,f),f=null,e.thisProgram&&(g=e.thisProgram),e.quit&&(b=e.quit),e.wasmBinary&&(U=e.wasmBinary);var N=e.noExitRuntime||!0;typeof WebAssembly!="object"&&Ot("no native wasm support detected");var q,H,K,X,J,tt,nt,rt,it,ut=!1;function gt(){var _=q.buffer;e.HEAP8=J=new Int8Array(_),e.HEAP16=new Int16Array(_),e.HEAP32=nt=new Int32Array(_),e.HEAPU8=tt=new Uint8Array(_),e.HEAPU16=new Uint16Array(_),e.HEAPU32=rt=new Uint32Array(_),e.HEAPF32=new Float32Array(_),e.HEAPF64=it=new Float64Array(_)}var xt=e.INITIAL_MEMORY||16777216;if(5242880<=xt||Ot("INITIAL_MEMORY should be larger than STACK_SIZE, was "+xt+"! (STACK_SIZE=5242880)"),x)q=e.wasmMemory;else if(e.wasmMemory)q=e.wasmMemory;else if(!((q=new WebAssembly.Memory({initial:xt/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw E("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"),T&&E("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");gt(),xt=q.buffer.byteLength;var kt,mt=[],Dt=[],lt=[],bt=0;function St(){return N||0{if(!B.ok)throw"failed to load wasm binary file at '"+L+"'";return B.arrayBuffer()}).catch(()=>Gt(L));if(i)return new Promise((B,Y)=>{i(L,Q=>B(new Uint8Array(Q)),Y)})}return Promise.resolve().then(()=>Gt(L))}(_).then(L=>WebAssembly.instantiate(L,P)).then(L=>L).then(F,L=>{E("failed to asynchronously prepare wasm: "+L),Ot(L)})}function jt(_){this.name="ExitStatus",this.message=`Program terminated with exit(${_})`,this.status=_}function Bt(_){_.terminate(),_.onmessage=()=>{}}function Ht(_){(_=et.Fa[_])||Ot(),et.fb(_)}function qt(_){var P=et.Za();if(!P)return 6;et.Ia.push(P),et.Fa[_.Ha]=P,P.Ha=_.Ha;var F={cmd:"run",start_routine:_.gb,arg:_.Ya,pthread_ptr:_.Ha};return T&&P.unref(),P.postMessage(F,_.mb),0}Ft(_t="ort-wasm-threaded.wasm")||(_t=D(_t));var te=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Wt=(_,P,F)=>{var L=(P>>>=0)+F;for(F=P;_[F]&&!(F>=L);)++F;if(16(B=(240&B)==224?(15&B)<<12|Y<<6|Q:(7&B)<<18|Y<<12|Q<<6|63&_[P++])?L+=String.fromCharCode(B):(B-=65536,L+=String.fromCharCode(55296|B>>10,56320|1023&B))}}else L+=String.fromCharCode(B)}return L},Lt=(_,P)=>(_>>>=0)?Wt(u(),_,P):"";function Xt(_){if(x)return pt(1,1,_);X=_,St()||(et.hb(),e.onExit&&e.onExit(_),ut=!0),b(_,new jt(_))}var Vt=_=>{if(X=_,x)throw Yt(_),"unwind";Xt(_)},et={La:[],Ia:[],Ta:[],Fa:{},Pa:function(){x?et.ab():et.$a()},$a:function(){mt.unshift(()=>{Rt(),et.bb(()=>Ct())})},ab:function(){et.receiveObjectTransfer=et.eb,et.threadInitTLS=et.Sa,et.setExitStatus=et.Ra,N=!1},Ra:function(_){X=_},rb:["$terminateWorker"],hb:function(){for(var _ of et.Ia)Bt(_);for(_ of et.La)Bt(_);et.La=[],et.Ia=[],et.Fa=[]},fb:function(_){var P=_.Ha;delete et.Fa[P],et.La.push(_),et.Ia.splice(et.Ia.indexOf(_),1),_.Ha=0,le(P)},eb:function(){},Sa:function(){et.Ta.forEach(_=>_())},cb:_=>new Promise(P=>{_.onmessage=B=>{var Y=(B=B.data).cmd;if(B.targetThread&&B.targetThread!=ne()){var Q=et.Fa[B.qb];Q?Q.postMessage(B,B.transferList):E('Internal error! Worker sent a message "'+Y+'" to target pthread '+B.targetThread+", but that thread no longer exists!")}else Y==="checkMailbox"?ee():Y==="spawnThread"?qt(B):Y==="cleanupThread"?Ht(B.thread):Y==="killThread"?(B=B.thread,Y=et.Fa[B],delete et.Fa[B],Bt(Y),le(B),et.Ia.splice(et.Ia.indexOf(Y),1),Y.Ha=0):Y==="cancelThread"?et.Fa[B.thread].postMessage({cmd:"cancel"}):Y==="loaded"?(_.loaded=!0,P(_)):Y==="alert"?alert("Thread "+B.threadId+": "+B.text):B.target==="setimmediate"?_.postMessage(B):Y==="callHandler"?e[B.handler](...B.args):Y&&E("worker sent an unknown command "+Y)},_.onerror=B=>{throw E("worker sent an error! "+B.filename+":"+B.lineno+": "+B.message),B},T&&(_.on("message",function(B){_.onmessage({data:B})}),_.on("error",function(B){_.onerror(B)}));var F,L=[];for(F of["onExit","onAbort","print","printErr"])e.hasOwnProperty(F)&&L.push(F);_.postMessage({cmd:"load",handlers:L,urlOrBlob:e.mainScriptUrlOrBlob||m,wasmMemory:q,wasmModule:K})}),bb:function(_){_()},Xa:function(){var _=D("ort-wasm-threaded.worker.js");_=new Worker(_),et.La.push(_)},Za:function(){return et.La.length==0&&(et.Xa(),et.cb(et.La[0])),et.La.pop()}};e.PThread=et;var Mt=_=>{for(;0<_.length;)_.shift()(e)};function Yt(_){if(x)return pt(2,0,_);Vt(_)}e.establishStackSpace=function(){var _=ne(),P=l()[_+52>>2>>>0];_=l()[_+56>>2>>>0],Le(P,P-_),oe(P)};var I=[];function C(_){this.Oa=_-24,this.Wa=function(P){a()[this.Oa+4>>2>>>0]=P},this.Va=function(P){a()[this.Oa+8>>2>>>0]=P},this.Pa=function(P,F){this.Ua(),this.Wa(P),this.Va(F)},this.Ua=function(){a()[this.Oa+16>>2>>>0]=0}}function R(_,P,F,L){return x?pt(3,1,_,P,F,L):G(_,P,F,L)}function G(_,P,F,L){if(_>>>=0,P>>>=0,F>>>=0,L>>>=0,typeof SharedArrayBuffer>"u")return E("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var B=[];return x&&B.length===0?R(_,P,F,L):(_={gb:F,Ha:_,Ya:L,mb:B},x?(_.ob="spawnThread",postMessage(_,B),0):qt(_))}function W(_,P,F){return x?pt(4,1,_,P,F):0}function Z(_,P){if(x)return pt(5,1,_,P)}e.invokeEntryPoint=function(_,P){var F=I[_];F||(_>=I.length&&(I.length=_+1),I[_]=F=kt.get(_)),_=F(P),St()?et.Ra(_):ce(_)};var ot=_=>{for(var P=0,F=0;F<_.length;++F){var L=_.charCodeAt(F);127>=L?P++:2047>=L?P+=2:55296<=L&&57343>=L?(P+=4,++F):P+=3}return P},ht=(_,P,F,L)=>{if(!(0>>=0;L=F+L-1;for(var Y=0;Y<_.length;++Y){var Q=_.charCodeAt(Y);if(55296<=Q&&57343>=Q&&(Q=65536+((1023&Q)<<10)|1023&_.charCodeAt(++Y)),127>=Q){if(F>=L)break;P[F++>>>0]=Q}else{if(2047>=Q){if(F+1>=L)break;P[F++>>>0]=192|Q>>6}else{if(65535>=Q){if(F+2>=L)break;P[F++>>>0]=224|Q>>12}else{if(F+3>=L)break;P[F++>>>0]=240|Q>>18,P[F++>>>0]=128|Q>>12&63}P[F++>>>0]=128|Q>>6&63}P[F++>>>0]=128|63&Q}}return P[F>>>0]=0,F-B},yt=(_,P,F)=>ht(_,u(),P,F);function Tt(_,P){if(x)return pt(6,1,_,P)}function vt(_,P,F){if(x)return pt(7,1,_,P,F)}function Kt(_,P,F){return x?pt(8,1,_,P,F):0}function Jt(_,P){if(x)return pt(9,1,_,P)}function V(_,P,F){if(x)return pt(10,1,_,P,F)}function at(_,P,F,L){if(x)return pt(11,1,_,P,F,L)}function ct(_,P,F,L){if(x)return pt(12,1,_,P,F,L)}function Nt(_,P,F,L){if(x)return pt(13,1,_,P,F,L)}function Zt(_){if(x)return pt(14,1,_)}function fe(_,P){if(x)return pt(15,1,_,P)}function he(_,P,F){if(x)return pt(16,1,_,P,F)}var Be=_=>{if(!ut)try{if(_(),!St())try{x?ce(X):Vt(X)}catch(P){P instanceof jt||P=="unwind"||b(1,P)}}catch(P){P instanceof jt||P=="unwind"||b(1,P)}};function ie(_){_>>>=0,typeof Atomics.nb=="function"&&(Atomics.nb(l(),_>>2,_).value.then(ee),_+=128,Atomics.store(l(),_>>2,1))}function ee(){var _=ne();_&&(ie(_),Be(()=>Ne()))}e.__emscripten_thread_mailbox_await=ie,e.checkMailbox=ee;var zt=_=>_%4==0&&(_%100!=0||_%400==0),ge=[0,31,60,91,121,152,182,213,244,274,305,335],me=[0,31,59,90,120,151,181,212,243,273,304,334];function be(_,P,F,L,B,Y,Q,dt){return x?pt(17,1,_,P,F,L,B,Y,Q,dt):-52}function ye(_,P,F,L,B,Y,Q){if(x)return pt(18,1,_,P,F,L,B,Y,Q)}var ve=_=>{var P=ot(_)+1,F=$e(P);return F&&yt(_,F,P),F},Ve=_=>{var P=pe();return _=_(),oe(P),_};function pt(_,P){var F=arguments.length-2,L=arguments;return Ve(()=>{for(var B=de(8*F),Y=B>>3,Q=0;Q>>0]=dt}return Fe(_,F,B,P)})}var ae,se=[],ue={},we=()=>{if(!ae){var _,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",_:g||"./this.program"};for(_ in ue)ue[_]===void 0?delete P[_]:P[_]=ue[_];var F=[];for(_ in P)F.push(`${_}=${P[_]}`);ae=F}return ae};function Te(_,P){if(x)return pt(19,1,_,P);_>>>=0,P>>>=0;var F=0;return we().forEach(function(L,B){var Y=P+F;for(B=a()[_+4*B>>2>>>0]=Y,Y=0;Y>0>>>0]=L.charCodeAt(Y);d()[B>>0>>>0]=0,F+=L.length+1}),0}function xe(_,P){if(x)return pt(20,1,_,P);_>>>=0,P>>>=0;var F=we();a()[_>>2>>>0]=F.length;var L=0;return F.forEach(function(B){L+=B.length+1}),a()[P>>2>>>0]=L,0}function _e(_){return x?pt(21,1,_):52}function Oe(_,P,F,L){return x?pt(22,1,_,P,F,L):52}function Se(_,P,F,L,B){return x?pt(23,1,_,P,F,L,B):70}var ze=[null,[],[]];function Ae(_,P,F,L){if(x)return pt(24,1,_,P,F,L);P>>>=0,F>>>=0,L>>>=0;for(var B=0,Y=0;Y>2>>>0],dt=a()[P+4>>2>>>0];P+=8;for(var $t=0;$t>>0],It=ze[_];wt===0||wt===10?((_===1?O:E)(Wt(It,0)),It.length=0):It.push(wt)}B+=dt}return a()[L>>2>>>0]=B,0}var Pe=_=>(Pe=(()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return L=>(L.set(crypto.getRandomValues(new Uint8Array(L.byteLength))),L);if(T)try{var P=y(760);if(P.randomFillSync)return L=>P.randomFillSync(L);var F=P.randomBytes;return L=>(L.set(F(L.byteLength)),L)}catch{}Ot("initRandomDevice")})())(_),Ie=[31,29,31,30,31,30,31,31,30,31,30,31],Ee=[31,28,31,30,31,30,31,31,30,31,30,31],Ge=(_,P)=>{d().set(_,P>>>0)};function De(_,P,F,L){function B(z,st,ft){for(z=typeof z=="number"?z.toString():z||"";z.lengthUe?-1:0Ut-z.getDate())){z.setDate(z.getDate()+st);break}st-=Ut-z.getDate()+1,z.setDate(1),11>ft?z.setMonth(ft+1):(z.setMonth(0),z.setFullYear(z.getFullYear()+1))}return ft=new Date(z.getFullYear()+1,0,4),st=dt(new Date(z.getFullYear(),0,4)),ft=dt(ft),0>=Q(st,z)?0>=Q(ft,z)?z.getFullYear()+1:z.getFullYear():z.getFullYear()-1}_>>>=0,P>>>=0,F>>>=0,L>>>=0;var wt=l()[L+40>>2>>>0];for(var It in L={kb:l()[L>>2>>>0],jb:l()[L+4>>2>>>0],Ma:l()[L+8>>2>>>0],Qa:l()[L+12>>2>>>0],Na:l()[L+16>>2>>>0],Ka:l()[L+20>>2>>>0],Ga:l()[L+24>>2>>>0],Ja:l()[L+28>>2>>>0],sb:l()[L+32>>2>>>0],ib:l()[L+36>>2>>>0],lb:wt?Lt(wt):""},F=Lt(F),wt={"%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"})F=F.replace(new RegExp(It,"g"),wt[It]);var je="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Me="January February March April May June July August September October November December".split(" ");for(It in wt={"%a":z=>je[z.Ga].substring(0,3),"%A":z=>je[z.Ga],"%b":z=>Me[z.Na].substring(0,3),"%B":z=>Me[z.Na],"%C":z=>Y((z.Ka+1900)/100|0,2),"%d":z=>Y(z.Qa,2),"%e":z=>B(z.Qa,2," "),"%g":z=>$t(z).toString().substring(2),"%G":z=>$t(z),"%H":z=>Y(z.Ma,2),"%I":z=>((z=z.Ma)==0?z=12:12{for(var st=0,ft=0;ft<=z.Na-1;st+=(zt(z.Ka+1900)?Ie:Ee)[ft++]);return Y(z.Qa+st,3)},"%m":z=>Y(z.Na+1,2),"%M":z=>Y(z.jb,2),"%n":()=>` +`,"%p":z=>0<=z.Ma&&12>z.Ma?"AM":"PM","%S":z=>Y(z.kb,2),"%t":()=>" ","%u":z=>z.Ga||7,"%U":z=>Y(Math.floor((z.Ja+7-z.Ga)/7),2),"%V":z=>{var st=Math.floor((z.Ja+7-(z.Ga+6)%7)/7);if(2>=(z.Ga+371-z.Ja-2)%7&&st++,st)st==53&&((ft=(z.Ga+371-z.Ja)%7)==4||ft==3&&zt(z.Ka)||(st=1));else{st=52;var ft=(z.Ga+7-z.Ja-1)%7;(ft==4||ft==5&&zt(z.Ka%400-1))&&st++}return Y(st,2)},"%w":z=>z.Ga,"%W":z=>Y(Math.floor((z.Ja+7-(z.Ga+6)%7)/7),2),"%y":z=>(z.Ka+1900).toString().substring(2),"%Y":z=>z.Ka+1900,"%z":z=>{var st=0<=(z=z.ib);return z=Math.abs(z)/60,(st?"+":"-")+("0000"+(z/60*100+z%60)).slice(-4)},"%Z":z=>z.lb,"%%":()=>"%"},F=F.replace(/%%/g,"\0\0"),wt)F.includes(It)&&(F=F.replace(new RegExp(It,"g"),wt[It](L)));return It=function(z){var st=Array(ot(z)+1);return ht(z,st,0,st.length),st}(F=F.replace(/\0\0/g,"%")),It.length>P?0:(Ge(It,_),It.length-1)}et.Pa();var He=[null,Xt,Yt,R,W,Z,Tt,vt,Kt,Jt,V,at,ct,Nt,Zt,fe,he,be,ye,Te,xe,_e,Oe,Se,Ae],qe={b:function(_,P,F){throw new C(_>>>=0).Pa(P>>>0,F>>>0),_},N:function(_){ke(_>>>0,!w,1,!v,131072,!1),et.Sa()},k:function(_){_>>>=0,x?postMessage({cmd:"cleanupThread",thread:_}):Ht(_)},I:G,h:W,T:Z,E:Tt,G:vt,U:Kt,R:Jt,J:V,Q:at,o:ct,F:Nt,C:Zt,S:fe,D:he,q:()=>!0,A:function(_,P){(_>>>=0)==P>>>0?setTimeout(()=>ee()):x?postMessage({targetThread:_,cmd:"checkMailbox"}):(_=et.Fa[_])&&_.postMessage({cmd:"checkMailbox"})},L:function(){return-1},M:ie,p:function(_){T&&et.Fa[_>>>0].ref()},t:function(_,P,F){_=P+2097152>>>0<4194305-!!_?(_>>>0)+4294967296*P:NaN,F>>>=0,_=new Date(1e3*_),l()[F>>2>>>0]=_.getUTCSeconds(),l()[F+4>>2>>>0]=_.getUTCMinutes(),l()[F+8>>2>>>0]=_.getUTCHours(),l()[F+12>>2>>>0]=_.getUTCDate(),l()[F+16>>2>>>0]=_.getUTCMonth(),l()[F+20>>2>>>0]=_.getUTCFullYear()-1900,l()[F+24>>2>>>0]=_.getUTCDay(),_=(_.getTime()-Date.UTC(_.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,l()[F+28>>2>>>0]=_},u:function(_,P,F){_=P+2097152>>>0<4194305-!!_?(_>>>0)+4294967296*P:NaN,F>>>=0,_=new Date(1e3*_),l()[F>>2>>>0]=_.getSeconds(),l()[F+4>>2>>>0]=_.getMinutes(),l()[F+8>>2>>>0]=_.getHours(),l()[F+12>>2>>>0]=_.getDate(),l()[F+16>>2>>>0]=_.getMonth(),l()[F+20>>2>>>0]=_.getFullYear()-1900,l()[F+24>>2>>>0]=_.getDay(),P=(zt(_.getFullYear())?ge:me)[_.getMonth()]+_.getDate()-1|0,l()[F+28>>2>>>0]=P,l()[F+36>>2>>>0]=-60*_.getTimezoneOffset(),P=new Date(_.getFullYear(),6,1).getTimezoneOffset();var L=new Date(_.getFullYear(),0,1).getTimezoneOffset();_=0|(P!=L&&_.getTimezoneOffset()==Math.min(L,P)),l()[F+32>>2>>>0]=_},v:function(_){_>>>=0;var P=new Date(l()[_+20>>2>>>0]+1900,l()[_+16>>2>>>0],l()[_+12>>2>>>0],l()[_+8>>2>>>0],l()[_+4>>2>>>0],l()[_>>2>>>0],0),F=l()[_+32>>2>>>0],L=P.getTimezoneOffset(),B=new Date(P.getFullYear(),6,1).getTimezoneOffset(),Y=new Date(P.getFullYear(),0,1).getTimezoneOffset(),Q=Math.min(Y,B);return 0>F?l()[_+32>>2>>>0]=+(B!=Y&&Q==L):0>2>>>0]=P.getDay(),F=(zt(P.getFullYear())?ge:me)[P.getMonth()]+P.getDate()-1|0,l()[_+28>>2>>>0]=F,l()[_>>2>>>0]=P.getSeconds(),l()[_+4>>2>>>0]=P.getMinutes(),l()[_+8>>2>>>0]=P.getHours(),l()[_+12>>2>>>0]=P.getDate(),l()[_+16>>2>>>0]=P.getMonth(),l()[_+20>>2>>>0]=P.getYear(),_=P.getTime()/1e3,Ce((At=_,1<=+Math.abs(At)?0>>0:~~+Math.ceil((At-+(~~At>>>0))/4294967296)>>>0:0)),_>>>0},r:be,s:ye,z:function(_,P,F){function L(wt){return(wt=wt.toTimeString().match(/\(([A-Za-z ]+)\)$/))?wt[1]:"GMT"}_>>>=0,P>>>=0,F>>>=0;var B=new Date().getFullYear(),Y=new Date(B,0,1),Q=new Date(B,6,1);B=Y.getTimezoneOffset();var dt=Q.getTimezoneOffset(),$t=Math.max(B,dt);a()[_>>2>>>0]=60*$t,l()[P>>2>>>0]=+(B!=dt),_=L(Y),P=L(Q),_=ve(_),P=ve(P),dt>2>>>0]=_,a()[F+4>>2>>>0]=P):(a()[F>>2>>>0]=P,a()[F+4>>2>>>0]=_)},c:()=>{Ot("")},l:function(){},i:function(){return Date.now()},V:()=>{throw bt+=1,"unwind"},B:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:function(){return T?y(3993).cpus().length:navigator.hardwareConcurrency},K:function(_,P,F,L){for(et.pb=P>>>0,se.length=F,P=L>>>0>>3,L=0;L>>0];return He[_].apply(null,se)},y:function(_){_>>>=0;var P=u().length;if(_<=P||4294901760<_)return!1;for(var F=1;4>=F;F*=2){var L=P*(1+.2/F);L=Math.min(L,_+100663296);var B=Math;L=Math.max(_,L);t:{B=B.min.call(B,4294901760,L+(65536-L%65536)%65536)-q.buffer.byteLength+65535>>>16;try{q.grow(B),gt();var Y=1;break t}catch{}Y=void 0}if(Y)return!0}return!1},O:Te,P:xe,j:Vt,g:_e,n:Oe,w:Se,m:Ae,x:function(_,P){return _>>>=0,P>>>=0,Pe(u().subarray(_>>>0,_+P>>>0)),0},a:q||e.wasmMemory,H:De,d:function(_,P,F,L){return De(_>>>0,P>>>0,F>>>0,L>>>0)}};(function(){function _(F,L){return F=F.exports,H=F=function(B){var Y=dt=>()=>dt()>>>0,Q=dt=>$t=>dt($t)>>>0;return(B=Object.assign({},B)).__errno_location=Y(B.__errno_location),B.pthread_self=Y(B.pthread_self),B.malloc=Q(B.malloc),B.stackSave=Y(B.stackSave),B.stackAlloc=Q(B.stackAlloc),B}(F),et.Ta.push(H.sa),kt=H.ta,Dt.unshift(H.W),K=L,Ct(),F}var P={a:qe};if(Rt(),e.instantiateWasm)try{return e.instantiateWasm(P,_)}catch(F){E("Module.instantiateWasm callback failed with error: "+F),t(F)}(function(F,L){var B=_t;return U||typeof WebAssembly.instantiateStreaming!="function"||Ft(B)||B.startsWith("file://")||T||typeof fetch!="function"?Qt(B,F,L):fetch(B,{credentials:"same-origin"}).then(Y=>WebAssembly.instantiateStreaming(Y,F).then(L,function(Q){return E("wasm streaming compile failed: "+Q),E("falling back to ArrayBuffer instantiation"),Qt(B,F,L)}))})(P,function(F){_(F.instance,F.module)}).catch(t)})(),e._OrtInit=(_,P)=>(e._OrtInit=H.X)(_,P),e._OrtGetLastError=(_,P)=>(e._OrtGetLastError=H.Y)(_,P),e._OrtCreateSessionOptions=(_,P,F,L,B,Y,Q,dt,$t,wt)=>(e._OrtCreateSessionOptions=H.Z)(_,P,F,L,B,Y,Q,dt,$t,wt),e._OrtAppendExecutionProvider=(_,P)=>(e._OrtAppendExecutionProvider=H._)(_,P),e._OrtAddSessionConfigEntry=(_,P,F)=>(e._OrtAddSessionConfigEntry=H.$)(_,P,F),e._OrtReleaseSessionOptions=_=>(e._OrtReleaseSessionOptions=H.aa)(_),e._OrtCreateSession=(_,P,F)=>(e._OrtCreateSession=H.ba)(_,P,F),e._OrtReleaseSession=_=>(e._OrtReleaseSession=H.ca)(_),e._OrtGetInputOutputCount=(_,P,F)=>(e._OrtGetInputOutputCount=H.da)(_,P,F),e._OrtGetInputName=(_,P)=>(e._OrtGetInputName=H.ea)(_,P),e._OrtGetOutputName=(_,P)=>(e._OrtGetOutputName=H.fa)(_,P),e._OrtFree=_=>(e._OrtFree=H.ga)(_),e._OrtCreateTensor=(_,P,F,L,B)=>(e._OrtCreateTensor=H.ha)(_,P,F,L,B),e._OrtGetTensorData=(_,P,F,L,B)=>(e._OrtGetTensorData=H.ia)(_,P,F,L,B),e._OrtReleaseTensor=_=>(e._OrtReleaseTensor=H.ja)(_),e._OrtCreateRunOptions=(_,P,F,L)=>(e._OrtCreateRunOptions=H.ka)(_,P,F,L),e._OrtAddRunConfigEntry=(_,P,F)=>(e._OrtAddRunConfigEntry=H.la)(_,P,F),e._OrtReleaseRunOptions=_=>(e._OrtReleaseRunOptions=H.ma)(_),e._OrtRun=(_,P,F,L,B,Y,Q,dt)=>(e._OrtRun=H.na)(_,P,F,L,B,Y,Q,dt),e._OrtEndProfiling=_=>(e._OrtEndProfiling=H.oa)(_);var ne=e._pthread_self=()=>(ne=e._pthread_self=H.pa)(),$e=e._malloc=_=>($e=e._malloc=H.qa)(_);e._free=_=>(e._free=H.ra)(_),e.__emscripten_tls_init=()=>(e.__emscripten_tls_init=H.sa)();var ke=e.__emscripten_thread_init=(_,P,F,L,B,Y)=>(ke=e.__emscripten_thread_init=H.ua)(_,P,F,L,B,Y);e.__emscripten_thread_crashed=()=>(e.__emscripten_thread_crashed=H.va)();var re,Fe=(_,P,F,L)=>(Fe=H.wa)(_,P,F,L),le=_=>(le=H.xa)(_),ce=e.__emscripten_thread_exit=_=>(ce=e.__emscripten_thread_exit=H.ya)(_),Ne=e.__emscripten_check_mailbox=()=>(Ne=e.__emscripten_check_mailbox=H.za)(),Ce=_=>(Ce=H.Aa)(_),Le=(_,P)=>(Le=H.Ba)(_,P),pe=()=>(pe=H.Ca)(),oe=_=>(oe=H.Da)(_),de=_=>(de=H.Ea)(_);function Re(){function _(){if(!re&&(re=!0,e.calledRun=!0,!ut)&&(x||Mt(Dt),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),!x)){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;){var P=e.postRun.shift();lt.unshift(P)}Mt(lt)}}if(!(0{var m,p=(m=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(m=m||__filename),function(h={}){var d,u,l=h;l.ready=new Promise((I,C)=>{d=I,u=C});var a,o,n,t=Object.assign({},l),e="./this.program",r=(I,C)=>{throw C},i=typeof window=="object",s=typeof importScripts=="function",f=typeof process$1=="object"&&typeof process$1.versions=="object"&&typeof process$1.versions.node=="string",g="";if(f){var b=y(1384),v=y(908);g=s?v.dirname(g)+"/":__dirname+"/",a=(I,C)=>(I=I.startsWith("file://")?new URL(I):v.normalize(I),b.readFileSync(I,C?void 0:"utf8")),n=I=>((I=a(I,!0)).buffer||(I=new Uint8Array(I)),I),o=(I,C,R,G=!0)=>{I=I.startsWith("file://")?new URL(I):v.normalize(I),b.readFile(I,G?void 0:"utf8",(W,Z)=>{W?R(W):C(G?Z.buffer:Z)})},!l.thisProgram&&1{throw process$1.exitCode=I,C},l.inspect=()=>"[Emscripten Module object]"}else(i||s)&&(s?g=self.location.href:typeof document<"u"&&document.currentScript&&(g=document.currentScript.src),m&&(g=m),g=g.indexOf("blob:")!==0?g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):"",a=I=>{var C=new XMLHttpRequest;return C.open("GET",I,!1),C.send(null),C.responseText},s&&(n=I=>{var C=new XMLHttpRequest;return C.open("GET",I,!1),C.responseType="arraybuffer",C.send(null),new Uint8Array(C.response)}),o=(I,C,R)=>{var G=new XMLHttpRequest;G.open("GET",I,!0),G.responseType="arraybuffer",G.onload=()=>{G.status==200||G.status==0&&G.response?C(G.response):R()},G.onerror=R,G.send(null)});var w,T=l.print||console.log.bind(console),x=l.printErr||console.error.bind(console);Object.assign(l,t),t=null,l.thisProgram&&(e=l.thisProgram),l.quit&&(r=l.quit),l.wasmBinary&&(w=l.wasmBinary);var A=l.noExitRuntime||!0;typeof WebAssembly!="object"&&rt("no native wasm support detected");var D,k,j,M,S,U,O=!1;function E(){var I=D.buffer;l.HEAP8=j=new Int8Array(I),l.HEAP16=new Int16Array(I),l.HEAP32=S=new Int32Array(I),l.HEAPU8=M=new Uint8Array(I),l.HEAPU16=new Uint16Array(I),l.HEAPU32=U=new Uint32Array(I),l.HEAPF32=new Float32Array(I),l.HEAPF64=new Float64Array(I)}var N=[],q=[],H=[];function K(){var I=l.preRun.shift();N.unshift(I)}var X,J,tt=0,nt=null;function rt(I){throw l.onAbort&&l.onAbort(I),x(I="Aborted("+I+")"),O=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),u(I),I}function it(I){return I.startsWith("data:application/octet-stream;base64,")}if(!it(X="ort-wasm.wasm")){var ut=X;X=l.locateFile?l.locateFile(ut,g):g+ut}function gt(I){if(I==X&&w)return new Uint8Array(w);if(n)return n(I);throw"both async and sync fetching of the wasm failed"}function xt(I,C,R){return function(G){if(!w&&(i||s)){if(typeof fetch=="function"&&!G.startsWith("file://"))return fetch(G,{credentials:"same-origin"}).then(W=>{if(!W.ok)throw"failed to load wasm binary file at '"+G+"'";return W.arrayBuffer()}).catch(()=>gt(G));if(o)return new Promise((W,Z)=>{o(G,ot=>W(new Uint8Array(ot)),Z)})}return Promise.resolve().then(()=>gt(G))}(I).then(G=>WebAssembly.instantiate(G,C)).then(G=>G).then(R,G=>{x("failed to asynchronously prepare wasm: "+G),rt(G)})}function kt(I){this.name="ExitStatus",this.message=`Program terminated with exit(${I})`,this.status=I}var mt=I=>{for(;0>2>>>0]=C},this.ua=function(C){U[this.qa+8>>2>>>0]=C},this.sa=function(C,R){this.ta(),this.va(C),this.ua(R)},this.ta=function(){U[this.qa+16>>2>>>0]=0}}var lt,bt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,St=(I,C,R)=>{var G=(C>>>=0)+R;for(R=C;I[R]&&!(R>=G);)++R;if(16(W=(240&W)==224?(15&W)<<12|Z<<6|ot:(7&W)<<18|Z<<12|ot<<6|63&I[C++])?G+=String.fromCharCode(W):(W-=65536,G+=String.fromCharCode(55296|W>>10,56320|1023&W))}}else G+=String.fromCharCode(W)}return G},_t=(I,C)=>(I>>>=0)?St(M,I,C):"",At=I=>{for(var C=0,R=0;R=G?C++:2047>=G?C+=2:55296<=G&&57343>=G?(C+=4,++R):C+=3}return C},Et=(I,C,R,G)=>{if(!(0>>=0;G=R+G-1;for(var Z=0;Z=ot&&(ot=65536+((1023&ot)<<10)|1023&I.charCodeAt(++Z)),127>=ot){if(R>=G)break;C[R++>>>0]=ot}else{if(2047>=ot){if(R+1>=G)break;C[R++>>>0]=192|ot>>6}else{if(65535>=ot){if(R+2>=G)break;C[R++>>>0]=224|ot>>12}else{if(R+3>=G)break;C[R++>>>0]=240|ot>>18,C[R++>>>0]=128|ot>>12&63}C[R++>>>0]=128|ot>>6&63}C[R++>>>0]=128|63&ot}}return C[R>>>0]=0,R-W},Pt=I=>I%4==0&&(I%100!=0||I%400==0),Rt=[0,31,60,91,121,152,182,213,244,274,305,335],Ct=[0,31,59,90,120,151,181,212,243,273,304,334],Ot=I=>{var C=At(I)+1,R=Wt(C);return R&&Et(I,M,R,C),R},Ft={},Gt=()=>{if(!lt){var I,C={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",_:e||"./this.program"};for(I in Ft)Ft[I]===void 0?delete C[I]:C[I]=Ft[I];var R=[];for(I in C)R.push(`${I}=${C[I]}`);lt=R}return lt},Qt=[null,[],[]],jt=I=>(jt=(()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return G=>crypto.getRandomValues(G);if(f)try{var C=y(760);if(C.randomFillSync)return G=>C.randomFillSync(G);var R=C.randomBytes;return G=>(G.set(R(G.byteLength)),G)}catch{}rt("initRandomDevice")})())(I),Bt=[31,29,31,30,31,30,31,31,30,31,30,31],Ht=[31,28,31,30,31,30,31,31,30,31,30,31];function qt(I,C,R,G){function W(V,at,ct){for(V=typeof V=="number"?V.toString():V||"";V.lengthZt?-1:0Nt-V.getDate())){V.setDate(V.getDate()+at);break}at-=Nt-V.getDate()+1,V.setDate(1),11>ct?V.setMonth(ct+1):(V.setMonth(0),V.setFullYear(V.getFullYear()+1))}return ct=new Date(V.getFullYear()+1,0,4),at=ht(new Date(V.getFullYear(),0,4)),ct=ht(ct),0>=ot(at,V)?0>=ot(ct,V)?V.getFullYear()+1:V.getFullYear():V.getFullYear()-1}I>>>=0,C>>>=0,R>>>=0;var Tt=S[40+(G>>>=0)>>2>>>0];for(var vt in G={ya:S[G>>2>>>0],xa:S[G+4>>2>>>0],oa:S[G+8>>2>>>0],ra:S[G+12>>2>>>0],pa:S[G+16>>2>>>0],na:S[G+20>>2>>>0],ha:S[G+24>>2>>>0],ma:S[G+28>>2>>>0],Aa:S[G+32>>2>>>0],wa:S[G+36>>2>>>0],za:Tt?_t(Tt):""},R=_t(R),Tt={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})R=R.replace(new RegExp(vt,"g"),Tt[vt]);var Kt="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Jt="January February March April May June July August September October November December".split(" ");for(vt in Tt={"%a":V=>Kt[V.ha].substring(0,3),"%A":V=>Kt[V.ha],"%b":V=>Jt[V.pa].substring(0,3),"%B":V=>Jt[V.pa],"%C":V=>Z((V.na+1900)/100|0,2),"%d":V=>Z(V.ra,2),"%e":V=>W(V.ra,2," "),"%g":V=>yt(V).toString().substring(2),"%G":V=>yt(V),"%H":V=>Z(V.oa,2),"%I":V=>((V=V.oa)==0?V=12:12{for(var at=0,ct=0;ct<=V.pa-1;at+=(Pt(V.na+1900)?Bt:Ht)[ct++]);return Z(V.ra+at,3)},"%m":V=>Z(V.pa+1,2),"%M":V=>Z(V.xa,2),"%n":()=>` +`,"%p":V=>0<=V.oa&&12>V.oa?"AM":"PM","%S":V=>Z(V.ya,2),"%t":()=>" ","%u":V=>V.ha||7,"%U":V=>Z(Math.floor((V.ma+7-V.ha)/7),2),"%V":V=>{var at=Math.floor((V.ma+7-(V.ha+6)%7)/7);if(2>=(V.ha+371-V.ma-2)%7&&at++,at)at==53&&((ct=(V.ha+371-V.ma)%7)==4||ct==3&&Pt(V.na)||(at=1));else{at=52;var ct=(V.ha+7-V.ma-1)%7;(ct==4||ct==5&&Pt(V.na%400-1))&&at++}return Z(at,2)},"%w":V=>V.ha,"%W":V=>Z(Math.floor((V.ma+7-(V.ha+6)%7)/7),2),"%y":V=>(V.na+1900).toString().substring(2),"%Y":V=>V.na+1900,"%z":V=>{var at=0<=(V=V.wa);return V=Math.abs(V)/60,(at?"+":"-")+("0000"+(V/60*100+V%60)).slice(-4)},"%Z":V=>V.za,"%%":()=>"%"},R=R.replace(/%%/g,"\0\0"),Tt)R.includes(vt)&&(R=R.replace(new RegExp(vt,"g"),Tt[vt](G)));return vt=function(V){var at=Array(At(V)+1);return Et(V,at,0,at.length),at}(R=R.replace(/\0\0/g,"%")),vt.length>C?0:(j.set(vt,I>>>0),vt.length-1)}var te={a:function(I,C,R){throw new Dt(I>>>=0).sa(C>>>0,R>>>0),I},e:function(){return 0},I:function(){},y:function(){},A:function(){},K:function(){return 0},G:function(){},B:function(){},F:function(){},g:function(){},z:function(){},w:function(){},H:function(){},x:function(){},k:()=>!0,n:function(I,C,R){I=C+2097152>>>0<4194305-!!I?(I>>>0)+4294967296*C:NaN,R>>>=0,I=new Date(1e3*I),S[R>>2>>>0]=I.getUTCSeconds(),S[R+4>>2>>>0]=I.getUTCMinutes(),S[R+8>>2>>>0]=I.getUTCHours(),S[R+12>>2>>>0]=I.getUTCDate(),S[R+16>>2>>>0]=I.getUTCMonth(),S[R+20>>2>>>0]=I.getUTCFullYear()-1900,S[R+24>>2>>>0]=I.getUTCDay(),S[R+28>>2>>>0]=(I.getTime()-Date.UTC(I.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},o:function(I,C,R){I=C+2097152>>>0<4194305-!!I?(I>>>0)+4294967296*C:NaN,R>>>=0,I=new Date(1e3*I),S[R>>2>>>0]=I.getSeconds(),S[R+4>>2>>>0]=I.getMinutes(),S[R+8>>2>>>0]=I.getHours(),S[R+12>>2>>>0]=I.getDate(),S[R+16>>2>>>0]=I.getMonth(),S[R+20>>2>>>0]=I.getFullYear()-1900,S[R+24>>2>>>0]=I.getDay(),S[R+28>>2>>>0]=(Pt(I.getFullYear())?Rt:Ct)[I.getMonth()]+I.getDate()-1|0,S[R+36>>2>>>0]=-60*I.getTimezoneOffset(),C=new Date(I.getFullYear(),6,1).getTimezoneOffset();var G=new Date(I.getFullYear(),0,1).getTimezoneOffset();S[R+32>>2>>>0]=0|(C!=G&&I.getTimezoneOffset()==Math.min(G,C))},p:function(I){I>>>=0;var C=new Date(S[I+20>>2>>>0]+1900,S[I+16>>2>>>0],S[I+12>>2>>>0],S[I+8>>2>>>0],S[I+4>>2>>>0],S[I>>2>>>0],0),R=S[I+32>>2>>>0],G=C.getTimezoneOffset(),W=new Date(C.getFullYear(),6,1).getTimezoneOffset(),Z=new Date(C.getFullYear(),0,1).getTimezoneOffset(),ot=Math.min(Z,W);return 0>R?S[I+32>>2>>>0]=+(W!=Z&&ot==G):0>2>>>0]=C.getDay(),S[I+28>>2>>>0]=(Pt(C.getFullYear())?Rt:Ct)[C.getMonth()]+C.getDate()-1|0,S[I>>2>>>0]=C.getSeconds(),S[I+4>>2>>>0]=C.getMinutes(),S[I+8>>2>>>0]=C.getHours(),S[I+12>>2>>>0]=C.getDate(),S[I+16>>2>>>0]=C.getMonth(),S[I+20>>2>>>0]=C.getYear(),I=C.getTime()/1e3,Xt((J=I,1<=+Math.abs(J)?0>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)),I>>>0},l:function(){return-52},m:function(){},u:function(I,C,R){function G(yt){return(yt=yt.toTimeString().match(/\(([A-Za-z ]+)\)$/))?yt[1]:"GMT"}R>>>=0;var W=new Date().getFullYear(),Z=new Date(W,0,1),ot=new Date(W,6,1);W=Z.getTimezoneOffset();var ht=ot.getTimezoneOffset();U[I>>>0>>2>>>0]=60*Math.max(W,ht),S[C>>>0>>2>>>0]=+(W!=ht),I=G(Z),C=G(ot),I=Ot(I),C=Ot(C),ht>2>>>0]=I,U[R+4>>2>>>0]=C):(U[R>>2>>>0]=C,U[R+4>>2>>>0]=I)},d:()=>{rt("")},h:function(){return Date.now()},v:function(){return 4294901760},b:()=>performance.now(),J:function(I,C,R){return C>>>=0,M.copyWithin(I>>>0>>>0,C>>>0,C+(R>>>0)>>>0)},t:function(I){I>>>=0;var C=M.length;if(4294901760=R;R*=2){var G=C*(1+.2/R);G=Math.min(G,I+100663296);var W=Math;G=Math.max(I,G);t:{W=W.min.call(W,4294901760,G+(65536-G%65536)%65536)-D.buffer.byteLength+65535>>>16;try{D.grow(W),E();var Z=1;break t}catch{}Z=void 0}if(Z)return!0}return!1},D:function(I,C){I>>>=0,C>>>=0;var R=0;return Gt().forEach(function(G,W){var Z=C+R;for(W=U[I+4*W>>2>>>0]=Z,Z=0;Z>0>>>0]=G.charCodeAt(Z);j[W>>0>>>0]=0,R+=G.length+1}),0},E:function(I,C){I>>>=0,C>>>=0;var R=Gt();U[I>>2>>>0]=R.length;var G=0;return R.forEach(function(W){G+=W.length+1}),U[C>>2>>>0]=G,0},s:I=>{A||(l.onExit&&l.onExit(I),O=!0),r(I,new kt(I))},f:()=>52,j:function(){return 52},q:function(){return 70},i:function(I,C,R,G){C>>>=0,R>>>=0,G>>>=0;for(var W=0,Z=0;Z>2>>>0],ht=U[C+4>>2>>>0];C+=8;for(var yt=0;yt>>0],vt=Qt[I];Tt===0||Tt===10?((I===1?T:x)(St(vt,0)),vt.length=0):vt.push(Tt)}W+=ht}return U[G>>2>>>0]=W,0},r:function(I,C){return I>>>=0,jt(M.subarray(I>>>0,I+(C>>>0)>>>0)),0},C:qt,c:function(I,C,R,G){return qt(I>>>0,C>>>0,R>>>0,G>>>0)}};(function(){function I(R){if(R=R.exports,k=R=function(W){var Z=ht=>()=>ht()>>>0,ot=ht=>yt=>ht(yt)>>>0;return(W=Object.assign({},W)).__errno_location=Z(W.__errno_location),W.malloc=ot(W.malloc),W.stackSave=Z(W.stackSave),W.stackAlloc=ot(W.stackAlloc),W}(R),D=k.L,E(),q.unshift(k.M),tt--,l.monitorRunDependencies&&l.monitorRunDependencies(tt),tt==0&&nt){var G=nt;nt=null,G()}return R}var C={a:te};if(tt++,l.monitorRunDependencies&&l.monitorRunDependencies(tt),l.instantiateWasm)try{return l.instantiateWasm(C,I)}catch(R){x("Module.instantiateWasm callback failed with error: "+R),u(R)}(function(R,G){var W=X;return w||typeof WebAssembly.instantiateStreaming!="function"||it(W)||W.startsWith("file://")||f||typeof fetch!="function"?xt(W,R,G):fetch(W,{credentials:"same-origin"}).then(Z=>WebAssembly.instantiateStreaming(Z,R).then(G,function(ot){return x("wasm streaming compile failed: "+ot),x("falling back to ArrayBuffer instantiation"),xt(W,R,G)}))})(C,function(R){I(R.instance)}).catch(u)})(),l._OrtInit=(I,C)=>(l._OrtInit=k.N)(I,C),l._OrtGetLastError=(I,C)=>(l._OrtGetLastError=k.O)(I,C),l._OrtCreateSessionOptions=(I,C,R,G,W,Z,ot,ht,yt,Tt)=>(l._OrtCreateSessionOptions=k.P)(I,C,R,G,W,Z,ot,ht,yt,Tt),l._OrtAppendExecutionProvider=(I,C)=>(l._OrtAppendExecutionProvider=k.Q)(I,C),l._OrtAddSessionConfigEntry=(I,C,R)=>(l._OrtAddSessionConfigEntry=k.R)(I,C,R),l._OrtReleaseSessionOptions=I=>(l._OrtReleaseSessionOptions=k.S)(I),l._OrtCreateSession=(I,C,R)=>(l._OrtCreateSession=k.T)(I,C,R),l._OrtReleaseSession=I=>(l._OrtReleaseSession=k.U)(I),l._OrtGetInputOutputCount=(I,C,R)=>(l._OrtGetInputOutputCount=k.V)(I,C,R),l._OrtGetInputName=(I,C)=>(l._OrtGetInputName=k.W)(I,C),l._OrtGetOutputName=(I,C)=>(l._OrtGetOutputName=k.X)(I,C),l._OrtFree=I=>(l._OrtFree=k.Y)(I),l._OrtCreateTensor=(I,C,R,G,W)=>(l._OrtCreateTensor=k.Z)(I,C,R,G,W),l._OrtGetTensorData=(I,C,R,G,W)=>(l._OrtGetTensorData=k._)(I,C,R,G,W),l._OrtReleaseTensor=I=>(l._OrtReleaseTensor=k.$)(I),l._OrtCreateRunOptions=(I,C,R,G)=>(l._OrtCreateRunOptions=k.aa)(I,C,R,G),l._OrtAddRunConfigEntry=(I,C,R)=>(l._OrtAddRunConfigEntry=k.ba)(I,C,R),l._OrtReleaseRunOptions=I=>(l._OrtReleaseRunOptions=k.ca)(I),l._OrtRun=(I,C,R,G,W,Z,ot,ht)=>(l._OrtRun=k.da)(I,C,R,G,W,Z,ot,ht),l._OrtEndProfiling=I=>(l._OrtEndProfiling=k.ea)(I);var Wt=l._malloc=I=>(Wt=l._malloc=k.fa)(I);l._free=I=>(l._free=k.ga)(I);var Lt,Xt=I=>(Xt=k.ia)(I),Vt=()=>(Vt=k.ja)(),et=I=>(et=k.ka)(I),Mt=I=>(Mt=k.la)(I);function Yt(){function I(){if(!Lt&&(Lt=!0,l.calledRun=!0,!O)){if(mt(q),d(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;){var C=l.postRun.shift();H.unshift(C)}mt(H)}}if(!(0Et(I,M,C,R),l.lengthBytesUTF8=At,nt=function I(){Lt||Yt(),Lt||(nt=I)},l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);0{$.exports=function(c,y){for(var m=new Array(arguments.length-1),p=0,h=2,d=!0;h{var y=c;y.length=function(u){var l=u.length;if(!l)return 0;for(var a=0;--l%4>1&&u.charAt(l)==="=";)++a;return Math.ceil(3*u.length)/4-a};for(var m=new Array(64),p=new Array(123),h=0;h<64;)p[m[h]=h<26?h+65:h<52?h+71:h<62?h-4:h-59|43]=h++;y.encode=function(u,l,a){for(var o,n=null,t=[],e=0,r=0;l>2],o=(3&i)<<4,r=1;break;case 1:t[e++]=m[o|i>>4],o=(15&i)<<2,r=2;break;case 2:t[e++]=m[o|i>>6],t[e++]=m[63&i],r=0}e>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,t)),e=0)}return r&&(t[e++]=m[o],t[e++]=61,r===1&&(t[e++]=61)),n?(e&&n.push(String.fromCharCode.apply(String,t.slice(0,e))),n.join("")):String.fromCharCode.apply(String,t.slice(0,e))};var d="invalid encoding";y.decode=function(u,l,a){for(var o,n=a,t=0,e=0;e1)break;if((r=p[r])===void 0)throw Error(d);switch(t){case 0:o=r,t=1;break;case 1:l[a++]=o<<2|(48&r)>>4,o=r,t=2;break;case 2:l[a++]=(15&o)<<4|(60&r)>>2,o=r,t=3;break;case 3:l[a++]=(3&o)<<6|r,t=0}}if(t===1)throw Error(d);return a-n},y.test=function(u){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u)}},9211:$=>{function c(){this._listeners={}}$.exports=c,c.prototype.on=function(y,m,p){return(this._listeners[y]||(this._listeners[y]=[])).push({fn:m,ctx:p||this}),this},c.prototype.off=function(y,m){if(y===void 0)this._listeners={};else if(m===void 0)this._listeners[y]=[];else for(var p=this._listeners[y],h=0;h{function c(d){return typeof Float32Array<"u"?function(){var u=new Float32Array([-0]),l=new Uint8Array(u.buffer),a=l[3]===128;function o(r,i,s){u[0]=r,i[s]=l[0],i[s+1]=l[1],i[s+2]=l[2],i[s+3]=l[3]}function n(r,i,s){u[0]=r,i[s]=l[3],i[s+1]=l[2],i[s+2]=l[1],i[s+3]=l[0]}function t(r,i){return l[0]=r[i],l[1]=r[i+1],l[2]=r[i+2],l[3]=r[i+3],u[0]}function e(r,i){return l[3]=r[i],l[2]=r[i+1],l[1]=r[i+2],l[0]=r[i+3],u[0]}d.writeFloatLE=a?o:n,d.writeFloatBE=a?n:o,d.readFloatLE=a?t:e,d.readFloatBE=a?e:t}():function(){function u(a,o,n,t){var e=o<0?1:0;if(e&&(o=-o),o===0)a(1/o>0?0:2147483648,n,t);else if(isNaN(o))a(2143289344,n,t);else if(o>34028234663852886e22)a((e<<31|2139095040)>>>0,n,t);else if(o<11754943508222875e-54)a((e<<31|Math.round(o/1401298464324817e-60))>>>0,n,t);else{var r=Math.floor(Math.log(o)/Math.LN2);a((e<<31|r+127<<23|8388607&Math.round(o*Math.pow(2,-r)*8388608))>>>0,n,t)}}function l(a,o,n){var t=a(o,n),e=2*(t>>31)+1,r=t>>>23&255,i=8388607&t;return r===255?i?NaN:e*(1/0):r===0?1401298464324817e-60*e*i:e*Math.pow(2,r-150)*(i+8388608)}d.writeFloatLE=u.bind(null,y),d.writeFloatBE=u.bind(null,m),d.readFloatLE=l.bind(null,p),d.readFloatBE=l.bind(null,h)}(),typeof Float64Array<"u"?function(){var u=new Float64Array([-0]),l=new Uint8Array(u.buffer),a=l[7]===128;function o(r,i,s){u[0]=r,i[s]=l[0],i[s+1]=l[1],i[s+2]=l[2],i[s+3]=l[3],i[s+4]=l[4],i[s+5]=l[5],i[s+6]=l[6],i[s+7]=l[7]}function n(r,i,s){u[0]=r,i[s]=l[7],i[s+1]=l[6],i[s+2]=l[5],i[s+3]=l[4],i[s+4]=l[3],i[s+5]=l[2],i[s+6]=l[1],i[s+7]=l[0]}function t(r,i){return l[0]=r[i],l[1]=r[i+1],l[2]=r[i+2],l[3]=r[i+3],l[4]=r[i+4],l[5]=r[i+5],l[6]=r[i+6],l[7]=r[i+7],u[0]}function e(r,i){return l[7]=r[i],l[6]=r[i+1],l[5]=r[i+2],l[4]=r[i+3],l[3]=r[i+4],l[2]=r[i+5],l[1]=r[i+6],l[0]=r[i+7],u[0]}d.writeDoubleLE=a?o:n,d.writeDoubleBE=a?n:o,d.readDoubleLE=a?t:e,d.readDoubleBE=a?e:t}():function(){function u(a,o,n,t,e,r){var i=t<0?1:0;if(i&&(t=-t),t===0)a(0,e,r+o),a(1/t>0?0:2147483648,e,r+n);else if(isNaN(t))a(0,e,r+o),a(2146959360,e,r+n);else if(t>17976931348623157e292)a(0,e,r+o),a((i<<31|2146435072)>>>0,e,r+n);else{var s;if(t<22250738585072014e-324)a((s=t/5e-324)>>>0,e,r+o),a((i<<31|s/4294967296)>>>0,e,r+n);else{var f=Math.floor(Math.log(t)/Math.LN2);f===1024&&(f=1023),a(4503599627370496*(s=t*Math.pow(2,-f))>>>0,e,r+o),a((i<<31|f+1023<<20|1048576*s&1048575)>>>0,e,r+n)}}}function l(a,o,n,t,e){var r=a(t,e+o),i=a(t,e+n),s=2*(i>>31)+1,f=i>>>20&2047,g=4294967296*(1048575&i)+r;return f===2047?g?NaN:s*(1/0):f===0?5e-324*s*g:s*Math.pow(2,f-1075)*(g+4503599627370496)}d.writeDoubleLE=u.bind(null,y,0,4),d.writeDoubleBE=u.bind(null,m,4,0),d.readDoubleLE=l.bind(null,p,0,4),d.readDoubleBE=l.bind(null,h,4,0)}(),d}function y(d,u,l){u[l]=255&d,u[l+1]=d>>>8&255,u[l+2]=d>>>16&255,u[l+3]=d>>>24}function m(d,u,l){u[l]=d>>>24,u[l+1]=d>>>16&255,u[l+2]=d>>>8&255,u[l+3]=255&d}function p(d,u){return(d[u]|d[u+1]<<8|d[u+2]<<16|d[u+3]<<24)>>>0}function h(d,u){return(d[u]<<24|d[u+1]<<16|d[u+2]<<8|d[u+3])>>>0}$.exports=c(c)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch($){}return null}module.exports=inquire},6662:$=>{$.exports=function(c,y,m){var p=m||8192,h=p>>>1,d=null,u=p;return function(l){if(l<1||l>h)return c(l);u+l>p&&(d=c(p),u=0);var a=y.call(d,u,u+=l);return 7&u&&(u=1+(7|u)),a}}},4997:($,c)=>{var y=c;y.length=function(m){for(var p=0,h=0,d=0;d191&&d<224?l[a++]=(31&d)<<6|63&m[p++]:d>239&&d<365?(d=((7&d)<<18|(63&m[p++])<<12|(63&m[p++])<<6|63&m[p++])-65536,l[a++]=55296+(d>>10),l[a++]=56320+(1023&d)):l[a++]=(15&d)<<12|(63&m[p++])<<6|63&m[p++],a>8191&&((u||(u=[])).push(String.fromCharCode.apply(String,l)),a=0);return u?(a&&u.push(String.fromCharCode.apply(String,l.slice(0,a))),u.join("")):String.fromCharCode.apply(String,l.slice(0,a))},y.write=function(m,p,h){for(var d,u,l=h,a=0;a>6|192,p[h++]=63&d|128):(64512&d)==55296&&(64512&(u=m.charCodeAt(a+1)))==56320?(d=65536+((1023&d)<<10)+(1023&u),++a,p[h++]=d>>18|240,p[h++]=d>>12&63|128,p[h++]=d>>6&63|128,p[h++]=63&d|128):(p[h++]=d>>12|224,p[h++]=d>>6&63|128,p[h++]=63&d|128);return h-l}},3442:($,c)=>{c.__esModule=!0;var y=function(){function m(p){if(!p)throw new TypeError("Invalid argument; `value` has no value.");this.value=m.EMPTY,p&&m.isGuid(p)&&(this.value=p)}return m.isGuid=function(p){var h=p.toString();return p&&(p instanceof m||m.validator.test(h))},m.create=function(){return new m([m.gen(2),m.gen(1),m.gen(1),m.gen(1),m.gen(3)].join("-"))},m.createEmpty=function(){return new m("emptyguid")},m.parse=function(p){return new m(p)},m.raw=function(){return[m.gen(2),m.gen(1),m.gen(1),m.gen(1),m.gen(3)].join("-")},m.gen=function(p){for(var h="",d=0;d{$.exports=y(9482)},9482:($,c,y)=>{var m=c;function p(){m.util._configure(),m.Writer._configure(m.BufferWriter),m.Reader._configure(m.BufferReader)}m.build="minimal",m.Writer=y(1173),m.BufferWriter=y(3155),m.Reader=y(1408),m.BufferReader=y(593),m.util=y(9693),m.rpc=y(5994),m.roots=y(5054),m.configure=p,p()},1408:($,c,y)=>{$.exports=l;var m,p=y(9693),h=p.LongBits,d=p.utf8;function u(i,s){return RangeError("index out of range: "+i.pos+" + "+(s||1)+" > "+i.len)}function l(i){this.buf=i,this.pos=0,this.len=i.length}var a,o=typeof Uint8Array<"u"?function(i){if(i instanceof Uint8Array||Array.isArray(i))return new l(i);throw Error("illegal buffer")}:function(i){if(Array.isArray(i))return new l(i);throw Error("illegal buffer")},n=function(){return p.Buffer?function(i){return(l.create=function(s){return p.Buffer.isBuffer(s)?new m(s):o(s)})(i)}:o};function t(){var i=new h(0,0),s=0;if(!(this.len-this.pos>4)){for(;s<3;++s){if(this.pos>=this.len)throw u(this);if(i.lo=(i.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return i}return i.lo=(i.lo|(127&this.buf[this.pos++])<<7*s)>>>0,i}for(;s<4;++s)if(i.lo=(i.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return i;if(i.lo=(i.lo|(127&this.buf[this.pos])<<28)>>>0,i.hi=(i.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return i;if(s=0,this.len-this.pos>4){for(;s<5;++s)if(i.hi=(i.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return i}else for(;s<5;++s){if(this.pos>=this.len)throw u(this);if(i.hi=(i.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return i}throw Error("invalid varint encoding")}function e(i,s){return(i[s-4]|i[s-3]<<8|i[s-2]<<16|i[s-1]<<24)>>>0}function r(){if(this.pos+8>this.len)throw u(this,8);return new h(e(this.buf,this.pos+=4),e(this.buf,this.pos+=4))}l.create=n(),l.prototype._slice=p.Array.prototype.subarray||p.Array.prototype.slice,l.prototype.uint32=(a=4294967295,function(){if(a=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(a=(a|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(a=(a|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(a=(a|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(a=(a|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return a;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return a}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var i=this.uint32();return i>>>1^-(1&i)|0},l.prototype.bool=function(){return this.uint32()!==0},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return e(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return 0|e(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var i=p.float.readFloatLE(this.buf,this.pos);return this.pos+=4,i},l.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var i=p.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,i},l.prototype.bytes=function(){var i=this.uint32(),s=this.pos,f=this.pos+i;if(f>this.len)throw u(this,i);return this.pos+=i,Array.isArray(this.buf)?this.buf.slice(s,f):s===f?new this.buf.constructor(0):this._slice.call(this.buf,s,f)},l.prototype.string=function(){var i=this.bytes();return d.read(i,0,i.length)},l.prototype.skip=function(i){if(typeof i=="number"){if(this.pos+i>this.len)throw u(this,i);this.pos+=i}else do if(this.pos>=this.len)throw u(this);while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(i){switch(i){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(i=7&this.uint32())!=4;)this.skipType(i);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+i+" at offset "+this.pos)}return this},l._configure=function(i){m=i,l.create=n(),m._configure();var s=p.Long?"toLong":"toNumber";p.merge(l.prototype,{int64:function(){return t.call(this)[s](!1)},uint64:function(){return t.call(this)[s](!0)},sint64:function(){return t.call(this).zzDecode()[s](!1)},fixed64:function(){return r.call(this)[s](!0)},sfixed64:function(){return r.call(this)[s](!1)}})}},593:($,c,y)=>{$.exports=h;var m=y(1408);(h.prototype=Object.create(m.prototype)).constructor=h;var p=y(9693);function h(d){m.call(this,d)}h._configure=function(){p.Buffer&&(h.prototype._slice=p.Buffer.prototype.slice)},h.prototype.string=function(){var d=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+d,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+d,this.len))},h._configure()},5054:$=>{$.exports={}},5994:($,c,y)=>{c.Service=y(7948)},7948:($,c,y)=>{$.exports=p;var m=y(9693);function p(h,d,u){if(typeof h!="function")throw TypeError("rpcImpl must be a function");m.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!d,this.responseDelimited=!!u}(p.prototype=Object.create(m.EventEmitter.prototype)).constructor=p,p.prototype.rpcCall=function h(d,u,l,a,o){if(!a)throw TypeError("request must be specified");var n=this;if(!o)return m.asPromise(h,n,d,u,l,a);if(n.rpcImpl)try{return n.rpcImpl(d,u[n.requestDelimited?"encodeDelimited":"encode"](a).finish(),function(t,e){if(t)return n.emit("error",t,d),o(t);if(e!==null){if(!(e instanceof l))try{e=l[n.responseDelimited?"decodeDelimited":"decode"](e)}catch(r){return n.emit("error",r,d),o(r)}return n.emit("data",e,d),o(null,e)}n.end(!0)})}catch(t){return n.emit("error",t,d),void setTimeout(function(){o(t)},0)}else setTimeout(function(){o(Error("already ended"))},0)},p.prototype.end=function(h){return this.rpcImpl&&(h||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:($,c,y)=>{$.exports=p;var m=y(9693);function p(l,a){this.lo=l>>>0,this.hi=a>>>0}var h=p.zero=new p(0,0);h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1};var d=p.zeroHash="\0\0\0\0\0\0\0\0";p.fromNumber=function(l){if(l===0)return h;var a=l<0;a&&(l=-l);var o=l>>>0,n=(l-o)/4294967296>>>0;return a&&(n=~n>>>0,o=~o>>>0,++o>4294967295&&(o=0,++n>4294967295&&(n=0))),new p(o,n)},p.from=function(l){if(typeof l=="number")return p.fromNumber(l);if(m.isString(l)){if(!m.Long)return p.fromNumber(parseInt(l,10));l=m.Long.fromString(l)}return l.low||l.high?new p(l.low>>>0,l.high>>>0):h},p.prototype.toNumber=function(l){if(!l&&this.hi>>>31){var a=1+~this.lo>>>0,o=~this.hi>>>0;return a||(o=o+1>>>0),-(a+4294967296*o)}return this.lo+4294967296*this.hi},p.prototype.toLong=function(l){return m.Long?new m.Long(0|this.lo,0|this.hi,!!l):{low:0|this.lo,high:0|this.hi,unsigned:!!l}};var u=String.prototype.charCodeAt;p.fromHash=function(l){return l===d?h:new p((u.call(l,0)|u.call(l,1)<<8|u.call(l,2)<<16|u.call(l,3)<<24)>>>0,(u.call(l,4)|u.call(l,5)<<8|u.call(l,6)<<16|u.call(l,7)<<24)>>>0)},p.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)},p.prototype.zzEncode=function(){var l=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^l)>>>0,this.lo=(this.lo<<1^l)>>>0,this},p.prototype.zzDecode=function(){var l=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^l)>>>0,this.hi=(this.hi>>>1^l)>>>0,this},p.prototype.length=function(){var l=this.lo,a=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?a===0?l<16384?l<128?1:2:l<2097152?3:4:a<16384?a<128?5:6:a<2097152?7:8:o<128?9:10}},9693:function($,c,y){var m=c;function p(d,u,l){for(var a=Object.keys(u),o=0;o0)},m.Buffer=function(){try{var d=m.inquire("buffer").Buffer;return d.prototype.utf8Write?d:null}catch{return null}}(),m._Buffer_from=null,m._Buffer_allocUnsafe=null,m.newBuffer=function(d){return typeof d=="number"?m.Buffer?m._Buffer_allocUnsafe(d):new m.Array(d):m.Buffer?m._Buffer_from(d):typeof Uint8Array>"u"?d:new Uint8Array(d)},m.Array=typeof Uint8Array<"u"?Uint8Array:Array,m.Long=m.global.dcodeIO&&m.global.dcodeIO.Long||m.global.Long||m.inquire("long"),m.key2Re=/^true|false|0|1$/,m.key32Re=/^-?(?:0|[1-9][0-9]*)$/,m.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,m.longToHash=function(d){return d?m.LongBits.from(d).toHash():m.LongBits.zeroHash},m.longFromHash=function(d,u){var l=m.LongBits.fromHash(d);return m.Long?m.Long.fromBits(l.lo,l.hi,u):l.toNumber(!!u)},m.merge=p,m.lcFirst=function(d){return d.charAt(0).toLowerCase()+d.substring(1)},m.newError=h,m.ProtocolError=h("ProtocolError"),m.oneOfGetter=function(d){for(var u={},l=0;l-1;--o)if(u[a[o]]===1&&this[a[o]]!==void 0&&this[a[o]]!==null)return a[o]}},m.oneOfSetter=function(d){return function(u){for(var l=0;l{$.exports=n;var m,p=y(9693),h=p.LongBits,d=p.base64,u=p.utf8;function l(g,b,v){this.fn=g,this.len=b,this.next=void 0,this.val=v}function a(){}function o(g){this.head=g.head,this.tail=g.tail,this.len=g.len,this.next=g.states}function n(){this.len=0,this.head=new l(a,0,0),this.tail=this.head,this.states=null}var t=function(){return p.Buffer?function(){return(n.create=function(){return new m})()}:function(){return new n}};function e(g,b,v){b[v]=255&g}function r(g,b){this.len=g,this.next=void 0,this.val=b}function i(g,b,v){for(;g.hi;)b[v++]=127&g.lo|128,g.lo=(g.lo>>>7|g.hi<<25)>>>0,g.hi>>>=7;for(;g.lo>127;)b[v++]=127&g.lo|128,g.lo=g.lo>>>7;b[v++]=g.lo}function s(g,b,v){b[v]=255&g,b[v+1]=g>>>8&255,b[v+2]=g>>>16&255,b[v+3]=g>>>24}n.create=t(),n.alloc=function(g){return new p.Array(g)},p.Array!==Array&&(n.alloc=p.pool(n.alloc,p.Array.prototype.subarray)),n.prototype._push=function(g,b,v){return this.tail=this.tail.next=new l(g,b,v),this.len+=b,this},r.prototype=Object.create(l.prototype),r.prototype.fn=function(g,b,v){for(;g>127;)b[v++]=127&g|128,g>>>=7;b[v]=g},n.prototype.uint32=function(g){return this.len+=(this.tail=this.tail.next=new r((g>>>=0)<128?1:g<16384?2:g<2097152?3:g<268435456?4:5,g)).len,this},n.prototype.int32=function(g){return g<0?this._push(i,10,h.fromNumber(g)):this.uint32(g)},n.prototype.sint32=function(g){return this.uint32((g<<1^g>>31)>>>0)},n.prototype.uint64=function(g){var b=h.from(g);return this._push(i,b.length(),b)},n.prototype.int64=n.prototype.uint64,n.prototype.sint64=function(g){var b=h.from(g).zzEncode();return this._push(i,b.length(),b)},n.prototype.bool=function(g){return this._push(e,1,g?1:0)},n.prototype.fixed32=function(g){return this._push(s,4,g>>>0)},n.prototype.sfixed32=n.prototype.fixed32,n.prototype.fixed64=function(g){var b=h.from(g);return this._push(s,4,b.lo)._push(s,4,b.hi)},n.prototype.sfixed64=n.prototype.fixed64,n.prototype.float=function(g){return this._push(p.float.writeFloatLE,4,g)},n.prototype.double=function(g){return this._push(p.float.writeDoubleLE,8,g)};var f=p.Array.prototype.set?function(g,b,v){b.set(g,v)}:function(g,b,v){for(var w=0;w>>0;if(!b)return this._push(e,1,0);if(p.isString(g)){var v=n.alloc(b=d.length(g));d.decode(g,v,0),g=v}return this.uint32(b)._push(f,b,g)},n.prototype.string=function(g){var b=u.length(g);return b?this.uint32(b)._push(u.write,b,g):this._push(e,1,0)},n.prototype.fork=function(){return this.states=new o(this),this.head=this.tail=new l(a,0,0),this.len=0,this},n.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 l(a,0,0),this.len=0),this},n.prototype.ldelim=function(){var g=this.head,b=this.tail,v=this.len;return this.reset().uint32(v),v&&(this.tail.next=g.next,this.tail=b,this.len+=v),this},n.prototype.finish=function(){for(var g=this.head.next,b=this.constructor.alloc(this.len),v=0;g;)g.fn(g.val,b,v),v+=g.len,g=g.next;return b},n._configure=function(g){m=g,n.create=t(),m._configure()}},3155:($,c,y)=>{$.exports=h;var m=y(1173);(h.prototype=Object.create(m.prototype)).constructor=h;var p=y(9693);function h(){m.call(this)}function d(u,l,a){u.length<40?p.utf8.write(u,l,a):l.utf8Write?l.utf8Write(u,a):l.write(u,a)}h._configure=function(){h.alloc=p._Buffer_allocUnsafe,h.writeBytesBuffer=p.Buffer&&p.Buffer.prototype instanceof Uint8Array&&p.Buffer.prototype.set.name==="set"?function(u,l,a){l.set(u,a)}:function(u,l,a){if(u.copy)u.copy(l,a,0,u.length);else for(var o=0;o>>0;return this.uint32(l),l&&this._push(h.writeBytesBuffer,l,u),this},h.prototype.string=function(u){var l=p.Buffer.byteLength(u);return this.uint32(l),l&&this._push(d,l,u),this},h._configure()},4154:$=>{$.exports=`"use strict";var e={},a="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(a){var r=require("worker_threads"),t=r.parentPort;t.on("message",(e=>onmessage({data:e})));var s=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:e=>(0,eval)(s.readFileSync(e,"utf8")+"//# sourceURL="+e),postMessage:e=>t.postMessage(e),performance:global.performance||{now:Date.now}})}var o=!1,d=function(){var e=Array.prototype.slice.call(arguments).join(" ");a?s.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var a=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:a,threadId:e._pthread_self()})},e.instantiateWasm=(a,r)=>{var t=e.wasmModule;return e.wasmModule=null,r(new WebAssembly.Instance(t,a))},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=function a(r){try{if("load"===r.data.cmd){let s=[];self.onmessage=e=>s.push(e),self.startWorker=r=>{e=r,postMessage({cmd:"loaded"});for(let e of s)a(e);self.onmessage=a},e.wasmModule=r.data.wasmModule;for(const a of r.data.handlers)e[a]=(...e)=>{postMessage({cmd:"callHandler",handler:a,args:e})};if(e.wasmMemory=r.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof r.data.urlOrBlob)importScripts(r.data.urlOrBlob);else{var t=URL.createObjectURL(r.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(e)}else if("run"===r.data.cmd){e.__emscripten_thread_init(r.data.pthread_ptr,0,0,1),e.__emscripten_thread_mailbox_await(r.data.pthread_ptr),e.establishStackSpace(),e.PThread.receiveObjectTransfer(r.data),e.PThread.threadInitTLS(),o||(o=!0);try{e.invokeEntryPoint(r.data.start_routine,r.data.arg)}catch(e){if("unwind"!=e)throw e}}else"cancel"===r.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===r.data.target||("checkMailbox"===r.data.cmd?o&&e.checkMailbox():r.data.cmd&&(d("worker.js received unknown command "+r.data.cmd),d(r.data)))}catch(a){throw e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),a}}; +`},7067:()=>{},1296:()=>{},760:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},685:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.resolveBackend=c.registerBackend=void 0;const y={},m=[];c.registerBackend=(p,h,d)=>{if(!h||typeof h.init!="function"||typeof h.createSessionHandler!="function")throw new TypeError("not a valid backend");{const u=y[p];if(u===void 0)y[p]={backend:h,priority:d};else{if(u.priority>d)return;if(u.priority===d&&u.backend!==h)throw new Error(`cannot register backend "${p}" using priority ${d}`)}if(d>=0){const l=m.indexOf(p);l!==-1&&m.splice(l,1);for(let a=0;a{const h=p.length===0?m:p,d=[];for(const u of h){const l=y[u];if(l){if(l.initialized)return l.backend;if(l.aborted)continue;const a=!!l.initPromise;try{return a||(l.initPromise=l.backend.init()),await l.initPromise,l.initialized=!0,l.backend}catch(o){a||d.push({name:u,err:o}),l.aborted=!0}finally{delete l.initPromise}}}throw new Error(`no available backend found. ERR: ${d.map(u=>`[${u.name}] ${u.err}`).join(", ")}`)}},4798:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.registerBackend=void 0;var m=y(685);Object.defineProperty(c,"registerBackend",{enumerable:!0,get:function(){return m.registerBackend}})},3121:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.env=void 0;const m=y(9104);let p="warning";c.env={wasm:{},webgl:{},webgpu:{},versions:{common:m.version},set logLevel(h){if(h!==void 0){if(typeof h!="string"||["verbose","info","warning","error","fatal"].indexOf(h)===-1)throw new Error(`Unsupported logging level: ${h}`);p=h}},get logLevel(){return p}},Object.defineProperty(c.env,"logLevel",{enumerable:!0})},2457:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.env=void 0;const m=y(3121);c.env=m.env},2235:function($,c,y){var m=this&&this.__createBinding||(Object.create?function(h,d,u,l){l===void 0&&(l=u);var a=Object.getOwnPropertyDescriptor(d,u);a&&!("get"in a?!d.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return d[u]}}),Object.defineProperty(h,l,a)}:function(h,d,u,l){l===void 0&&(l=u),h[l]=d[u]}),p=this&&this.__exportStar||function(h,d){for(var u in h)u==="default"||Object.prototype.hasOwnProperty.call(d,u)||m(d,h,u)};Object.defineProperty(c,"__esModule",{value:!0}),p(y(4798),c),p(y(2457),c),p(y(3974),c),p(y(963),c),p(y(7852),c)},8036:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InferenceSession=void 0;const m=y(685),p=y(963);class h{constructor(u){this.handler=u}async run(u,l,a){const o={};let n={};if(typeof u!="object"||u===null||u instanceof p.Tensor||Array.isArray(u))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let t=!0;if(typeof l=="object"){if(l===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(l instanceof p.Tensor)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.");t=!1;for(const i of l){if(typeof i!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(i)===-1)throw new RangeError(`'fetches' contains invalid output name: ${i}.`);o[i]=null}if(typeof a=="object"&&a!==null)n=a;else if(a!==void 0)throw new TypeError("'options' must be an object.")}else{let i=!1;const s=Object.getOwnPropertyNames(l);for(const f of this.outputNames)if(s.indexOf(f)!==-1){const g=l[f];(g===null||g instanceof p.Tensor)&&(i=!0,t=!1,o[f]=g)}if(i){if(typeof a=="object"&&a!==null)n=a;else if(a!==void 0)throw new TypeError("'options' must be an object.")}else n=l}}else if(l!==void 0)throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(const i of this.inputNames)if(u[i]===void 0)throw new Error(`input '${i}' is missing in 'feeds'.`);if(t)for(const i of this.outputNames)o[i]=null;const e=await this.handler.run(u,o,n),r={};for(const i in e)Object.hasOwnProperty.call(e,i)&&(r[i]=new p.Tensor(e[i].type,e[i].data,e[i].dims));return r}async release(){return this.handler.dispose()}static async create(u,l,a,o){let n,t={};if(typeof u=="string"){if(n=u,typeof l=="object"&&l!==null)t=l;else if(l!==void 0)throw new TypeError("'options' must be an object.")}else if(u instanceof Uint8Array){if(n=u,typeof l=="object"&&l!==null)t=l;else if(l!==void 0)throw new TypeError("'options' must be an object.")}else{if(!(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer))throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");{const s=u;let f=0,g=u.byteLength;if(typeof l=="object"&&l!==null)t=l;else if(typeof l=="number"){if(f=l,!Number.isSafeInteger(f))throw new RangeError("'byteOffset' must be an integer.");if(f<0||f>=s.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${s.byteLength}).`);if(g=u.byteLength-f,typeof a=="number"){if(g=a,!Number.isSafeInteger(g))throw new RangeError("'byteLength' must be an integer.");if(g<=0||f+g>s.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${s.byteLength-f}].`);if(typeof o=="object"&&o!==null)t=o;else if(o!==void 0)throw new TypeError("'options' must be an object.")}else if(a!==void 0)throw new TypeError("'byteLength' must be a number.")}else if(l!==void 0)throw new TypeError("'options' must be an object.");n=new Uint8Array(s,f,g)}}const e=(t.executionProviders||[]).map(s=>typeof s=="string"?s:s.name),r=await(0,m.resolveBackend)(e),i=await r.createSessionHandler(n,t);return new h(i)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}c.InferenceSession=h},3974:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InferenceSession=void 0;const m=y(8036);c.InferenceSession=m.InferenceSession},7852:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0})},2350:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tensorToImageData=c.tensorToDataURL=void 0,c.tensorToDataURL=(y,m)=>{const p=document.createElement("canvas");p.width=y.dims[3],p.height=y.dims[2];const h=p.getContext("2d");if(h!=null){let d,u;(m==null?void 0:m.tensorLayout)!==void 0&&m.tensorLayout==="NHWC"?(d=y.dims[2],u=y.dims[3]):(d=y.dims[3],u=y.dims[2]);const l=(m==null?void 0:m.format)!==void 0?m.format:"RGB",a=m==null?void 0:m.norm;let o,n;a===void 0||a.mean===void 0?o=[255,255,255,255]:typeof a.mean=="number"?o=[a.mean,a.mean,a.mean,a.mean]:(o=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(o[3]=a.mean[3])),a===void 0||a.bias===void 0?n=[0,0,0,0]:typeof a.bias=="number"?n=[a.bias,a.bias,a.bias,a.bias]:(n=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(n[3]=a.bias[3]));const t=u*d;let e=0,r=t,i=2*t,s=-1;l==="RGBA"?(e=0,r=t,i=2*t,s=3*t):l==="RGB"?(e=0,r=t,i=2*t):l==="RBG"&&(e=0,i=t,r=2*t);for(let f=0;f{const p=document.createElement("canvas").getContext("2d");let h;if(p==null)throw new Error("Can not access image data");{let d,u,l;(m==null?void 0:m.tensorLayout)!==void 0&&m.tensorLayout==="NHWC"?(d=y.dims[2],u=y.dims[1],l=y.dims[3]):(d=y.dims[3],u=y.dims[2],l=y.dims[1]);const a=m!==void 0&&m.format!==void 0?m.format:"RGB",o=m==null?void 0:m.norm;let n,t;o===void 0||o.mean===void 0?n=[255,255,255,255]:typeof o.mean=="number"?n=[o.mean,o.mean,o.mean,o.mean]:(n=[o.mean[0],o.mean[1],o.mean[2],255],o.mean[3]!==void 0&&(n[3]=o.mean[3])),o===void 0||o.bias===void 0?t=[0,0,0,0]:typeof o.bias=="number"?t=[o.bias,o.bias,o.bias,o.bias]:(t=[o.bias[0],o.bias[1],o.bias[2],0],o.bias[3]!==void 0&&(t[3]=o.bias[3]));const e=u*d;if(m!==void 0&&(m.format!==void 0&&l===4&&m.format!=="RGBA"||l===3&&m.format!=="RGB"&&m.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");const r=4;let i=0,s=1,f=2,g=3,b=0,v=e,w=2*e,T=-1;a==="RGBA"?(b=0,v=e,w=2*e,T=3*e):a==="RGB"?(b=0,v=e,w=2*e):a==="RBG"&&(b=0,w=e,v=2*e),h=p.createImageData(d,u);for(let x=0;x{Object.defineProperty(c,"__esModule",{value:!0}),c.tensorFromImage=c.bufferToTensor=void 0;const m=y(963);c.bufferToTensor=(p,h)=>{if(p===void 0)throw new Error("Image buffer must be defined");if(h.height===void 0||h.width===void 0)throw new Error("Image height and width must be defined");if(h.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");const{height:d,width:u}=h,l=h.norm??{mean:255,bias:0};let a,o;a=typeof l.mean=="number"?[l.mean,l.mean,l.mean,l.mean]:[l.mean[0],l.mean[1],l.mean[2],l.mean[3]??255],o=typeof l.bias=="number"?[l.bias,l.bias,l.bias,l.bias]:[l.bias[0],l.bias[1],l.bias[2],l.bias[3]??0];const n=h.format!==void 0?h.format:"RGBA",t=h.tensorFormat!==void 0&&h.tensorFormat!==void 0?h.tensorFormat:"RGB",e=d*u,r=t==="RGBA"?new Float32Array(4*e):new Float32Array(3*e);let i=4,s=0,f=1,g=2,b=3,v=0,w=e,T=2*e,x=-1;n==="RGB"&&(i=3,s=0,f=1,g=2,b=-1),t==="RGBA"?x=3*e:t==="RBG"?(v=0,T=e,w=2*e):t==="BGR"&&(T=0,w=e,v=2*e);for(let A=0;A{const d=typeof HTMLImageElement<"u"&&p instanceof HTMLImageElement,u=typeof ImageData<"u"&&p instanceof ImageData,l=typeof ImageBitmap<"u"&&p instanceof ImageBitmap,a=typeof p=="string";let o,n=h??{};if(d){const t=document.createElement("canvas");t.width=p.width,t.height=p.height;const e=t.getContext("2d");if(e==null)throw new Error("Can not access image data");{let r=p.height,i=p.width;if(h!==void 0&&h.resizedHeight!==void 0&&h.resizedWidth!==void 0&&(r=h.resizedHeight,i=h.resizedWidth),h!==void 0){if(n=h,h.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");n.tensorFormat="RGBA",n.height=r,n.width=i}else n.tensorFormat="RGBA",n.height=r,n.width=i;e.drawImage(p,0,0),o=e.getImageData(0,0,i,r).data}}else{if(!u){if(l){if(h===void 0)throw new Error("Please provide image config with format for Imagebitmap");const t=document.createElement("canvas");t.width=p.width,t.height=p.height;const e=t.getContext("2d");if(e!=null){const r=p.height,i=p.width;return e.drawImage(p,0,0,i,r),o=e.getImageData(0,0,i,r).data,n.height=r,n.width=i,(0,c.bufferToTensor)(o,n)}throw new Error("Can not access image data")}if(a)return new Promise((t,e)=>{const r=document.createElement("canvas"),i=r.getContext("2d");if(!p||!i)return e();const s=new Image;s.crossOrigin="Anonymous",s.src=p,s.onload=()=>{r.width=s.width,r.height=s.height,i.drawImage(s,0,0,r.width,r.height);const f=i.getImageData(0,0,r.width,r.height);n.height=r.height,n.width=r.width,t((0,c.bufferToTensor)(f.data,n))}});throw new Error("Input data provided is not supported - aborted tensor creation")}{let t,e;if(h!==void 0&&h.resizedWidth!==void 0&&h.resizedHeight!==void 0?(t=h.resizedHeight,e=h.resizedWidth):(t=p.height,e=p.width),h!==void 0&&(n=h),n.format="RGBA",n.height=t,n.width=e,h!==void 0){const r=document.createElement("canvas");r.width=e,r.height=t;const i=r.getContext("2d");if(i==null)throw new Error("Can not access image data");i.putImageData(p,0,0),o=i.getImageData(0,0,e,t).data}else o=p.data}}if(o!==void 0)return(0,c.bufferToTensor)(o,n);throw new Error("Input data provided is not supported - aborted tensor creation")}},5957:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Tensor=void 0;const m=y(2350),p=y(4866),h=y(106),d=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["float16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),u=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);let l=!1;c.Tensor=class{constructor(a,o,n){let t,e,r;if((()=>{if(!l){l=!0;const s=typeof BigInt64Array<"u"&&typeof BigInt64Array.from=="function",f=typeof BigUint64Array<"u"&&typeof BigUint64Array.from=="function";s&&(d.set("int64",BigInt64Array),u.set(BigInt64Array,"int64")),f&&(d.set("uint64",BigUint64Array),u.set(BigUint64Array,"uint64"))}})(),typeof a=="string")if(t=a,r=n,a==="string"){if(!Array.isArray(o))throw new TypeError("A string tensor's data must be a string array.");e=o}else{const s=d.get(a);if(s===void 0)throw new TypeError(`Unsupported tensor type: ${a}.`);if(Array.isArray(o)){if(a==="float16")throw new TypeError("Creating a float16 tensor from number array is not supported. Please use Uint16Array as data.");e=a==="uint64"||a==="int64"?s.from(o,BigInt):s.from(o)}else{if(!(o instanceof s))throw new TypeError(`A ${t} tensor's data must be type of ${s}`);e=o}}else if(r=o,Array.isArray(a)){if(a.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const s=typeof a[0];if(s==="string")t="string",e=a;else{if(s!=="boolean")throw new TypeError(`Invalid element type of data array: ${s}.`);t="bool",e=Uint8Array.from(a)}}else{const s=u.get(a.constructor);if(s===void 0)throw new TypeError(`Unsupported type for tensor data: ${a.constructor}.`);t=s,e=a}if(r===void 0)r=[e.length];else if(!Array.isArray(r))throw new TypeError("A tensor's dims must be a number array");const i=(0,h.calculateSize)(r);if(i!==e.length)throw new Error(`Tensor's size(${i}) does not match data length(${e.length}).`);this.dims=r,this.type=t,this.data=e,this.size=i}static async fromImage(a,o){return(0,p.tensorFromImage)(a,o)}toDataURL(a){return(0,m.tensorToDataURL)(this,a)}toImageData(a){return(0,m.tensorToImageData)(this,a)}reshape(a){return(0,h.tensorReshape)(this,a)}}},106:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tensorReshape=c.calculateSize=void 0;const m=y(963);c.calculateSize=p=>{let h=1;for(let d=0;dnew m.Tensor(p.type,p.data,h)},963:($,c,y)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Tensor=void 0;const m=y(5957);c.Tensor=m.Tensor},9104:($,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.version=void 0,c.version="1.16.3"},1583:($,c)=>{var y,m=function(p){Object.defineProperty(p,"__esModule",{value:!0}),p.default=void 0;var h=null;try{h=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{}function d(O,E,N){this.low=0|O,this.high=0|E,this.unsigned=!!N}function u(O){return(O&&O.__isLong__)===!0}function l(O){var E=Math.clz32(O&-O);return O?31-E:E}d.prototype.__isLong__,Object.defineProperty(d.prototype,"__isLong__",{value:!0}),d.isLong=u;var a={},o={};function n(O,E){var N,q,H;return E?(H=0<=(O>>>=0)&&O<256)&&(q=o[O])?q:(N=e(O,0,!0),H&&(o[O]=N),N):(H=-128<=(O|=0)&&O<128)&&(q=a[O])?q:(N=e(O,O<0?-1:0,!1),H&&(a[O]=N),N)}function t(O,E){if(isNaN(O))return E?T:w;if(E){if(O<0)return T;if(O>=g)return j}else{if(O<=-b)return M;if(O+1>=b)return k}return O<0?t(-O,E).neg():e(O%f|0,O/f|0,E)}function e(O,E,N){return new d(O,E,N)}d.fromInt=n,d.fromNumber=t,d.fromBits=e;var r=Math.pow;function i(O,E,N){if(O.length===0)throw Error("empty string");if(typeof E=="number"?(N=E,E=!1):E=!!E,O==="NaN"||O==="Infinity"||O==="+Infinity"||O==="-Infinity")return E?T:w;if((N=N||10)<2||360)throw Error("interior hyphen");if(q===0)return i(O.substring(1),E,N).neg();for(var H=t(r(N,8)),K=w,X=0;X>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},S.toString=function(O){if((O=O||10)<2||36>>0).toString(O);if((K=J).isZero())return tt+X;for(;tt.length<6;)tt="0"+tt;X=""+tt+X}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(M)?64:this.neg().getNumBitsAbs();for(var O=this.high!=0?this.high:this.low,E=31;E>0&&!(O&1<=0},S.isOdd=function(){return(1&this.low)==1},S.isEven=function(){return(1&this.low)==0},S.equals=function(O){return u(O)||(O=s(O)),(this.unsigned===O.unsigned||this.high>>>31!=1||O.high>>>31!=1)&&this.high===O.high&&this.low===O.low},S.eq=S.equals,S.notEquals=function(O){return!this.eq(O)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(O){return this.comp(O)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(O){return this.comp(O)<=0},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(O){return this.comp(O)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(O){return this.comp(O)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(O){if(u(O)||(O=s(O)),this.eq(O))return 0;var E=this.isNegative(),N=O.isNegative();return E&&!N?-1:!E&&N?1:this.unsigned?O.high>>>0>this.high>>>0||O.high===this.high&&O.low>>>0>this.low>>>0?-1:1:this.sub(O).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(M)?M:this.not().add(x)},S.neg=S.negate,S.add=function(O){u(O)||(O=s(O));var E=this.high>>>16,N=65535&this.high,q=this.low>>>16,H=65535&this.low,K=O.high>>>16,X=65535&O.high,J=O.low>>>16,tt=0,nt=0,rt=0,it=0;return rt+=(it+=H+(65535&O.low))>>>16,nt+=(rt+=q+J)>>>16,tt+=(nt+=N+X)>>>16,tt+=E+K,e((rt&=65535)<<16|(it&=65535),(tt&=65535)<<16|(nt&=65535),this.unsigned)},S.subtract=function(O){return u(O)||(O=s(O)),this.add(O.neg())},S.sub=S.subtract,S.multiply=function(O){if(this.isZero())return this;if(u(O)||(O=s(O)),h)return e(h.mul(this.low,this.high,O.low,O.high),h.get_high(),this.unsigned);if(O.isZero())return this.unsigned?T:w;if(this.eq(M))return O.isOdd()?M:w;if(O.eq(M))return this.isOdd()?M:w;if(this.isNegative())return O.isNegative()?this.neg().mul(O.neg()):this.neg().mul(O).neg();if(O.isNegative())return this.mul(O.neg()).neg();if(this.lt(v)&&O.lt(v))return t(this.toNumber()*O.toNumber(),this.unsigned);var E=this.high>>>16,N=65535&this.high,q=this.low>>>16,H=65535&this.low,K=O.high>>>16,X=65535&O.high,J=O.low>>>16,tt=65535&O.low,nt=0,rt=0,it=0,ut=0;return it+=(ut+=H*tt)>>>16,rt+=(it+=q*tt)>>>16,it&=65535,rt+=(it+=H*J)>>>16,nt+=(rt+=N*tt)>>>16,rt&=65535,nt+=(rt+=q*J)>>>16,rt&=65535,nt+=(rt+=H*X)>>>16,nt+=E*tt+N*J+q*X+H*K,e((it&=65535)<<16|(ut&=65535),(nt&=65535)<<16|(rt&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(O){if(u(O)||(O=s(O)),O.isZero())throw Error("division by zero");var E,N,q;if(h)return this.unsigned||this.high!==-2147483648||O.low!==-1||O.high!==-1?e((this.unsigned?h.div_u:h.div_s)(this.low,this.high,O.low,O.high),h.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?T:w;if(this.unsigned){if(O.unsigned||(O=O.toUnsigned()),O.gt(this))return T;if(O.gt(this.shru(1)))return A;q=T}else{if(this.eq(M))return O.eq(x)||O.eq(D)?M:O.eq(M)?x:(E=this.shr(1).div(O).shl(1)).eq(w)?O.isNegative()?x:D:(N=this.sub(O.mul(E)),q=E.add(N.div(O)));if(O.eq(M))return this.unsigned?T:w;if(this.isNegative())return O.isNegative()?this.neg().div(O.neg()):this.neg().div(O).neg();if(O.isNegative())return this.div(O.neg()).neg();q=w}for(N=this;N.gte(O);){E=Math.max(1,Math.floor(N.toNumber()/O.toNumber()));for(var H=Math.ceil(Math.log(E)/Math.LN2),K=H<=48?1:r(2,H-48),X=t(E),J=X.mul(O);J.isNegative()||J.gt(N);)J=(X=t(E-=K,this.unsigned)).mul(O);X.isZero()&&(X=x),q=q.add(X),N=N.sub(J)}return q},S.div=S.divide,S.modulo=function(O){return u(O)||(O=s(O)),h?e((this.unsigned?h.rem_u:h.rem_s)(this.low,this.high,O.low,O.high),h.get_high(),this.unsigned):this.sub(this.div(O).mul(O))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return e(~this.low,~this.high,this.unsigned)},S.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},S.clz=S.countLeadingZeros,S.countTrailingZeros=function(){return this.low?l(this.low):l(this.high)+32},S.ctz=S.countTrailingZeros,S.and=function(O){return u(O)||(O=s(O)),e(this.low&O.low,this.high&O.high,this.unsigned)},S.or=function(O){return u(O)||(O=s(O)),e(this.low|O.low,this.high|O.high,this.unsigned)},S.xor=function(O){return u(O)||(O=s(O)),e(this.low^O.low,this.high^O.high,this.unsigned)},S.shiftLeft=function(O){return u(O)&&(O=O.toInt()),(O&=63)==0?this:O<32?e(this.low<>>32-O,this.unsigned):e(0,this.low<>>O|this.high<<32-O,this.high>>O,this.unsigned):e(this.high>>O-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(O){return u(O)&&(O=O.toInt()),(O&=63)==0?this:O<32?e(this.low>>>O|this.high<<32-O,this.high>>>O,this.unsigned):e(O===32?this.high:this.high>>>O-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.rotateLeft=function(O){var E;return u(O)&&(O=O.toInt()),(O&=63)==0?this:O===32?e(this.high,this.low,this.unsigned):O<32?(E=32-O,e(this.low<>>E,this.high<>>E,this.unsigned)):(E=32-(O-=32),e(this.high<>>E,this.low<>>E,this.unsigned))},S.rotl=S.rotateLeft,S.rotateRight=function(O){var E;return u(O)&&(O=O.toInt()),(O&=63)==0?this:O===32?e(this.high,this.low,this.unsigned):O<32?(E=32-O,e(this.high<>>O,this.low<>>O,this.unsigned)):(E=32-(O-=32),e(this.low<>>O,this.high<>>O,this.unsigned))},S.rotr=S.rotateRight,S.toSigned=function(){return this.unsigned?e(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:e(this.low,this.high,!0)},S.toBytes=function(O){return O?this.toBytesLE():this.toBytesBE()},S.toBytesLE=function(){var O=this.high,E=this.low;return[255&E,E>>>8&255,E>>>16&255,E>>>24,255&O,O>>>8&255,O>>>16&255,O>>>24]},S.toBytesBE=function(){var O=this.high,E=this.low;return[O>>>24,O>>>16&255,O>>>8&255,255&O,E>>>24,E>>>16&255,E>>>8&255,255&E]},d.fromBytes=function(O,E,N){return N?d.fromBytesLE(O,E):d.fromBytesBE(O,E)},d.fromBytesLE=function(O,E){return new d(O[0]|O[1]<<8|O[2]<<16|O[3]<<24,O[4]|O[5]<<8|O[6]<<16|O[7]<<24,E)},d.fromBytesBE=function(O,E){return new d(O[4]<<24|O[5]<<16|O[6]<<8|O[7],O[0]<<24|O[1]<<16|O[2]<<8|O[3],E)};var U=d;return p.default=U,"default"in p?p.default:p}({});(y=(function(){return m}).apply(c,[]))===void 0||($.exports=y)},5686:($,c,y)=>{y.r(c),y.d(c,{flatbuffers:()=>m});var m={};m.Offset,m.Table,m.SIZEOF_SHORT=2,m.SIZEOF_INT=4,m.FILE_IDENTIFIER_LENGTH=4,m.SIZE_PREFIX_LENGTH=4,m.Encoding={UTF8_BYTES:1,UTF16_STRING:2},m.int32=new Int32Array(2),m.float32=new Float32Array(m.int32.buffer),m.float64=new Float64Array(m.int32.buffer),m.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,m.Long=function(p,h){this.low=0|p,this.high=0|h},m.Long.create=function(p,h){return p==0&&h==0?m.Long.ZERO:new m.Long(p,h)},m.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},m.Long.prototype.equals=function(p){return this.low==p.low&&this.high==p.high},m.Long.ZERO=new m.Long(0,0),m.Builder=function(p){if(p)h=p;else var h=1024;this.bb=m.ByteBuffer.allocate(h),this.space=h,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},m.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},m.Builder.prototype.forceDefaults=function(p){this.force_defaults=p},m.Builder.prototype.dataBuffer=function(){return this.bb},m.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},m.Builder.prototype.prep=function(p,h){p>this.minalign&&(this.minalign=p);for(var d=1+~(this.bb.capacity()-this.space+h)&p-1;this.space=0&&this.vtable[h]==0;h--);for(var d=h+1;h>=0;h--)this.addInt16(this.vtable[h]!=0?p-this.vtable[h]:0);this.addInt16(p-this.object_start);var u=(d+2)*m.SIZEOF_SHORT;this.addInt16(u);var l=0,a=this.space;t:for(h=0;h=0;a--)this.writeInt8(l.charCodeAt(a))}this.prep(this.minalign,m.SIZEOF_INT+u),this.addOffset(p),u&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},m.Builder.prototype.finishSizePrefixed=function(p,h){this.finish(p,h,!0)},m.Builder.prototype.requiredField=function(p,h){var d=this.bb.capacity()-p,u=d-this.bb.readInt32(d);if(this.bb.readInt16(u+h)==0)throw new Error("FlatBuffers: field "+h+" must be set")},m.Builder.prototype.startVector=function(p,h,d){this.notNested(),this.vector_num_elems=h,this.prep(m.SIZEOF_INT,p*h),this.prep(d,p*h)},m.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},m.Builder.prototype.createString=function(p){if(p instanceof Uint8Array)var h=p;else{h=[];for(var d=0;d=56320?l:(l<<10)+p.charCodeAt(d++)+-56613888)<128?h.push(u):(u<2048?h.push(u>>6&31|192):(u<65536?h.push(u>>12&15|224):h.push(u>>18&7|240,u>>12&63|128),h.push(u>>6&63|128)),h.push(63&u|128))}}this.addInt8(0),this.startVector(1,h.length,1),this.bb.setPosition(this.space-=h.length),d=0;for(var a=this.space,o=this.bb.bytes();d>24},m.ByteBuffer.prototype.readUint8=function(p){return this.bytes_[p]},m.ByteBuffer.prototype.readInt16=function(p){return this.readUint16(p)<<16>>16},m.ByteBuffer.prototype.readUint16=function(p){return this.bytes_[p]|this.bytes_[p+1]<<8},m.ByteBuffer.prototype.readInt32=function(p){return this.bytes_[p]|this.bytes_[p+1]<<8|this.bytes_[p+2]<<16|this.bytes_[p+3]<<24},m.ByteBuffer.prototype.readUint32=function(p){return this.readInt32(p)>>>0},m.ByteBuffer.prototype.readInt64=function(p){return new m.Long(this.readInt32(p),this.readInt32(p+4))},m.ByteBuffer.prototype.readUint64=function(p){return new m.Long(this.readUint32(p),this.readUint32(p+4))},m.ByteBuffer.prototype.readFloat32=function(p){return m.int32[0]=this.readInt32(p),m.float32[0]},m.ByteBuffer.prototype.readFloat64=function(p){return m.int32[m.isLittleEndian?0:1]=this.readInt32(p),m.int32[m.isLittleEndian?1:0]=this.readInt32(p+4),m.float64[0]},m.ByteBuffer.prototype.writeInt8=function(p,h){this.bytes_[p]=h},m.ByteBuffer.prototype.writeUint8=function(p,h){this.bytes_[p]=h},m.ByteBuffer.prototype.writeInt16=function(p,h){this.bytes_[p]=h,this.bytes_[p+1]=h>>8},m.ByteBuffer.prototype.writeUint16=function(p,h){this.bytes_[p]=h,this.bytes_[p+1]=h>>8},m.ByteBuffer.prototype.writeInt32=function(p,h){this.bytes_[p]=h,this.bytes_[p+1]=h>>8,this.bytes_[p+2]=h>>16,this.bytes_[p+3]=h>>24},m.ByteBuffer.prototype.writeUint32=function(p,h){this.bytes_[p]=h,this.bytes_[p+1]=h>>8,this.bytes_[p+2]=h>>16,this.bytes_[p+3]=h>>24},m.ByteBuffer.prototype.writeInt64=function(p,h){this.writeInt32(p,h.low),this.writeInt32(p+4,h.high)},m.ByteBuffer.prototype.writeUint64=function(p,h){this.writeUint32(p,h.low),this.writeUint32(p+4,h.high)},m.ByteBuffer.prototype.writeFloat32=function(p,h){m.float32[0]=h,this.writeInt32(p,m.int32[0])},m.ByteBuffer.prototype.writeFloat64=function(p,h){m.float64[0]=h,this.writeInt32(p,m.int32[m.isLittleEndian?0:1]),this.writeInt32(p+4,m.int32[m.isLittleEndian?1:0])},m.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&a)))}return u},m.ByteBuffer.prototype.__indirect=function(p){return p+this.readInt32(p)},m.ByteBuffer.prototype.__vector=function(p){return p+this.readInt32(p)+m.SIZEOF_INT},m.ByteBuffer.prototype.__vector_len=function(p){return this.readInt32(p+this.readInt32(p))},m.ByteBuffer.prototype.__has_identifier=function(p){if(p.length!=m.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+m.FILE_IDENTIFIER_LENGTH);for(var h=0;h{var c=$&&$.__esModule?()=>$.default:()=>$;return __webpack_require__.d(c,{a:c}),c},__webpack_require__.d=($,c)=>{for(var y in c)__webpack_require__.o(c,y)&&!__webpack_require__.o($,y)&&Object.defineProperty($,y,{enumerable:!0,get:c[y]})},__webpack_require__.o=($,c)=>Object.prototype.hasOwnProperty.call($,c),__webpack_require__.r=$=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(1057);return __webpack_exports__})())})(ort_min);var ort_minExports=ort_min.exports;async function getImageTensor($){const c=document.createElement("canvas");c.height=64,c.width=Math.round($.width*(64/$.height));const y=c.getContext("2d");y.drawImage($,0,0,c.width,c.height);const m=y.getImageData(0,0,c.width,c.height).data;return imageDataToTensor(m,c.width,c.height)}function tensorToStr($){const c=["","掀","袜","顧","徕","榱","荪","浡","其","炎","玉","恩","劣","徽","廉","桂","拂","鳊","撤","赏","哮","侄","蓮","И","进","饭","饱","优","楸","礻","蜉","營","伙","杌","修","榜","准","铒","戏","赭","襟","彘","彩","雁","闽","坎","聂","氡","辜","苁","潆","摁","月","稇","而","醴","簉","卑","妖","埽","嘡","醛","見","煎","汪","秽","迄","噭","焉","钌","瑕","玻","仙","蹑","钀","翦","丰","矗","2","胚","镊","镡","鍊","帖","僰","淀","吒","冲","挡","粼","螈","缵","孺","侦","曷","渐","敷","投","宸","祉","柳","尖","梃","淘","臁","躇","撖","惭","狄","聢","官","狴","诬","骄","跻","場","姻","钎","藥","綉","驾","舻","黢","鲦","蜣","渖","绹","佰","怜","三","痪","眍","养","角","薜","濑","劳","戟","傎","纫","徉","收","稍","虫","螋","鬲","捌","陡","蓟","邳","蹢","涉","煋","端","懷","椤","埶","廊","免","秫","猢","睐","臺","擀","布","麃","彗","汊","芄","遣","胙","另","癯","徭","疢","茆","忡","'","烃","笕","薤","肆","熛","過","盖","跷","呷","痿","沖","魍","讣","庤","弑","诩","庵","履","暮","始","滟","矅","蛹","鸿","啃","铋","沿","鐾","酆","團","恙","閥","聒","讵","颠","沾","堅","踣","陴","覃","滙","浐","钇","脆","炙","亮","觌","産","汩","鸭","斄","堆","掭","揞","鹂","郫","瘅","蚂","揩","学","组","浸","腙","耀","嗛","局","蠓","肠","昏","I","岑","镯","憧","油","泸","鸟","潇","蕻","褒","瞧","旸","昭","庐","鞒","内","痈","己","曙","怠","锟","晞","耢","鲢","醦","糕","療","寇","梵","黾","呻","苒","ü","校","嘏","昃","Ⅰ","蕰","凖","嵛","裨","筏","匜","咋","乏","婵","镂","珰","感","蔗","蚵","庞","弢","槟","口","漉","﹒","咂","俩","增","硐","襙","绉","卿","距","璱","猖","铚","郚","嬖","缒","阃","扞","V","望","最","浔","骜","赃","闻","砍","奸","灶","以","获","鳎","浦","罐","孓","纭","瘀","普","氰","塮","症","顷","们","螓","蛸","鵰","册","美","萨","沘","犰","嫌","名",")","懦","滇","F","垡","声","毅","隅","鲎","煨","萦","宜","唇","鯨","邛","杲","赜","长","魂","桠","锇","搓","俘","仰","膘","宦","歹","遁","猃","噉","幂","糜","嗤","周","剂","曦","暧","焖","髻","釐","泰","窟","檎","旧","犀","镄","百","取","岍","逗","叽","呃","鲪","萬","陈","7","習","区","逄","宏","罡","漭","盗","郿","般","谢","倪","纵","婶","砧","揖","扪","濒","愤","茓","浞","子","揄","旌","趄","樊","醑","遄","婚","汶","矩","裈","弊","呱","铳","勿","蚴","忿","褓","缚","酱","璞","庆","除","礌","珩","榨","鼢","逞","容","圯","猛","陌","-","嚯","镘","鱾","睚","猬","杜","鳓","燈","計","咣","炜","睁","箱","邮","略","馇","逐","雀","僬","髯","奖","俱","-","绗","犏","辱","忑","挽","康","蝼","栏","模","辒","•","儋","罱","墈","会","秀","栈","缔","醜","蚣","阮","鼗","眼","湧","沁","夥","毕","媚","瘳","痣","搴","闿","遍","焰","岣","舱","埌","麿","嘿","靽","体","想","霓","钛","摽","苑","芳","技","綮","钅","燠","栾","年","悱","腹","员","呕","闇","嗫","檩","荒","溱","舨","峙","卒","洑","预","弯","蔷","叵","锯","慈","牧","患","贇","偷","鲜","锓","躔","嚬","烈","娌","嘲","详","麺","舒","厨","徵","葹","只","篦","鹀","剕","驳","聍","黧","砾","暅","褫","呈","森","结","龛","钲","轧","扔","蕹","赵","涒","冯","渲","缭","坚","趼","鲑","倫","门","班","垚","鞍","菘","畐","僇","侉","禢","轳","饦","兽","呯","捂","樨","卧","栝","豭","冶","鉰","申","蜈","印","缨","镫","蕾","圜","扑","娉","烦","缳","广","峄","獒","铔","奁","醚","倥","蹇","阚","镆","煺","德","颉","嗅","绷","蒯","祺","崧","往","枨","涡","鲲","瓅","岌","肘","飔","缘","千","棱","溶","窣","篼","代","捡","送","咡","术","滑","茜","晾","挤","曳","糈","G","翊","殴","妹","溥","璆","烩","拙","襄","几","嘴","D","驮","淙","蹐","合","環","剑","怪","褂","畑","燏","订","珪","≥","瘟","耷","槑","衷","猕","迁","霎","槜","﹖","鋈","苹","嫣","祜","李","鄒","噢","萄","仝","纨","直","悛","拣","远","诏","圧","躬","蝟","總","眆","筻","硇","鳁","眠","钆","泞","猱","宾","酞","募","螳","腴","念","宠","唯","怊","勃","M","兿","蟑","妁","掸","拌","铸","讼","诟","锺","Ω","竟","羚","剽","C","苦","煳","罢","跨","~","豸","±","俬","捺","彦","钣","鋆","用","缤","搁","徼","谦","筘","嗨","扮","旇","折","咯","昆","叟","垂","箐","捻","燕","島","瞀","鮮","屡","點","瘭","恚","旚","丟","捽","菁","瀑","炕","蹩","芒","r","是","媾","鹝","囵","萤","拷","频","埴","课","癍","袱","螯","谘","榛","Y","缣","裔","憩","相","觀","晗","坳","炔","勉","汆","钡","舐","衫","疫","鲙","蘩","穈","殁","九","泻","咤","構","谆","陕","装","蔡","画","介","苋","務","敝","俟","帇","鸺","贸","茗","肃","滪","输","瘗","菽","饹","诉","遐","浑","扎","卟","铀","邗","觋","嘎","塑","潏","金","姘","潋","逵","鲻","逯","炮","甄","髡","剩","嗬","芴","屋","改","骣","芪","邠","痋","珑","帆","狙","八","奔","族","轵","氖","雕","痧","眊","胛","酉","鲼","砣","猸","餮","郇","沫","跖","蝉","屑","辘","閣","涑","邡","篃","交","笼","颇","贻","魄","黡","劂","糠","炅","帨","苍","瓴","粤","莎","朿","埔","绸","齁","鱿","惨","腢","郡","棠","猫","脑","風","蚱","捐","嵌","胱","馗","竽","泥","辍","怖","雾","絮","淼","筝","碲","悼","龀","の","珥","忐","溲","昕","荔","掂","瘦","僭","蔌","抺","椅","誉","扯","僜","停","衉","汇","赔","眄","呙","咙","剿","次","蛟","嗓","』","汕","詈","帘","踧","姁","血","堪","喜","滩","璎","胄","俨","眚","凌","拽","滔","⑿","嬃","―","汐","潭","阡","呓","婷","执","妊","恂","妥","鳘","蔫","设","睒","笪","謇","鞋","谍","黯","虍","馬","蚧","骑","峤","舾","儀","駡","β","蓑","柏","痒","蒇","痕","妍","熠","僻","爬","迭","畫","绰","湯","凭","菼","懈","顒","午","箪","糙","址","钼","堵","佘","侍","卤","(","榚","泽","溘","蟹","b","燁","颂","菠","榉","鲡","埸","荛","歘","断","邸","贡","礞","蔼","脸","爪","帜","翡","仟","皎","辆","滫","昔","™","柬","弓","遇","杪","侨","娓","镪","觑","一","踌","牟","褡","厩","晌","每","娘","渤","c","咫","成","颏","孩","鼓","瞌","槁","捒","阉","伉","癣","胞","鲟","瓤","杅","紡","喂","掠","镜","镧","侞","赦","貝","丕","臧","L","池","彷","棓","锽","渊","食","饨","堡","玥","氣","讽","敬","闺","帡","携","哫","珈","魆","哄","旁","喻","泄","畎","郁","唅","葜","繪","飐","谶","聆","斝","谥","辉","髅","進","吧","蹀","铛","笛","睥","楼","凝","況","鸷","苠","饺","沙","缴","块","梢","慝","珐","鄏","霰","迸","氆","趵","棣","鳔","祆","☆","苯","恁","螨","庭","缠","槠","津","髋","诔","葶","蜾","坻","蒹","摔","向","垩","蹭","淇","筛","滬","玡","铺","逼","劵","绲","团","鳀","常","玖","擢","株","铵","樽","弭","醇","糨","璈","曩","潔","祘","磨","希","鲅","擂","谗","唳","欷","欧","绋","庙","琬","稳","糊","拥","霪","浼","翎","俜","摸","筚","巯","墼","苫","缩","镚","婪","圹","咚","儿","蒽","婆","鲐","雹","霞","嶪","濠","琉","澌","媢","禤","摺","掏","矢","艄","围","呸","寺","拤","氐","柝","跎","僖","挢","茨","涮","缫","撸","荨","嶷","廋","魋","付","喋","蜗","邙","棹","璪","倡","鞭","游","錦","眬","抒","眈","培","夏","黔","獐","皋","戛","鲀","垒","耽","纤","漩","铈","握","窝","芋","濞","截","零","敖","眸","怦","噎","簋","掳","妣","湃","璠","殄","觞","桅","笋","鲞","踯","傀","犨","抵","疰","暌","耖","供","枳","怂","娶","鸩","捣","庸","逡","懋","颃","長","鼫","姮","蹈","耵","乂","骐","殇","膏","仳","冥","梭","洵","碣","昝","仉","軒","隍","更","な","嵕","拜","粑","鲴","吇","秃","尕","魃","狨","臛","蟥","胨","注","谁","张","才","尸","派","矮","洳","舟","溺","锴","寓","籴","夕","叭","荠","澼","劃","久","私","炉","娟","麤","稂","河","纴","夺","亏","焙","。","塗","蜩","栌","渡","薰","崋","揿","漤","啾","郏","舣","卉","爱","牚","撵","钺","再","企","笺","疾","承","俾","瞈","邰","汾","瘛","檫","蒎","觅","绀","掎","U","赓","匳","聘","蛤","跤","嗜","洼","歔","弟","飕","莼","嫉","那","滈","践","僦","偎","扢","绚","乕","旳","招","饯","®","攸","鞁","囫","铨","陒","鷄","畀","韨","經","纾","萸","肴","→","宗","迳","鳞","亚","搂","喀","狮","坦","瞥","采","姝","钳","□","剌","維","葸","鼩","公","刀","沩","喔","泺","哉","徨","篝","掊","沕","运","偆","浒","语","乇","仪","萝","疍","踽","碡","熰","荞","嚓","天","饰","泵","械","孑","蛰","荟","源","峡","矜","睬","噬","腆","婉","‘","等","誓","辀","岖","琖","碜","霍","怼","唛","弈","淑","疆","晴","镴","鸡","埚","焕","芦","唻","踅","吴","殡","唏","吨","寡","鹉","絲","坉","會","埭","Ⅲ","捏","墅","卓","叙","徇","柜","各","荭","J","恝","囐","蓉","犋","叡","莺","颌","蒸","饸","疋","玊","兢","鱽","藍","杳","辂","獘","拔","侪","湍","膂","渔","瘊","雉","稁","職","僤","鄳","祁","稱","I","裴","锉","曹","鲶","挨","哑","鷪","鏠","煞","师","蛲","牁","琅","告","媒","祭","确","荚","亰","蝗","阗","歩","疲","f","唣","愛","郾","棍","山","狲","纽","蚡","栂","馓","诊","猴","喤","来","继","桎","嬛","骞","邴","暄","贼","昴","廿","克","耔","彤","鹭","葓","骢","龁","鏡","瀚","赅","韩","譄","榷","殚","膛","须","、","砖","唶","番","蛘","畴","铠","亢","氓","铰","炻","筫","迢","兰","玺","砻","积","莜","吸","监","膦","迪","迷","冷","哀","贳","瞄","器","鹡","惺","徐","酢","寒","Ⓡ","倾","飞","楽","涢","队","舆","赤","璩","戳","殳","掮","舴","蜷","宄","拴","癌","舛","婀","抟","靡","骍","揸","思","慧","平","橘","臭","硖","卬","畈","兠","茸","脂","魚","晩","御","龋","涣","罨","爍","糌","汧","缐","贽","要","祀","鲊","爼","獯","瀣","棋","肈","佣","娣","柩","枸","偃","v","唷","劍","榴","槐","漫","洽","蒡","籼","魔","峋","第","歙","萧","谮","埯","撮","马","绡","裘","鹋","蓬","显","噶","倒","镳","艽","窬","拳","樯","跋","詹","钥","心","嶽","嚋","戎","吕","涂","悃","麦","骋","推","箩","硚","匆","村","五","杨","凑","鞫","镰","伥","诒","纣","崃","鸻","翰","辌","廛","證","舢","盼","腿","圳","贱","皿","隆","屈","龏","瓒","顏","↓","赈","煙","窍","韧","壁","莰","箬","蹋","褰","峥","悚","坜","环","回","疼","渍","蝄","东","臂","坩","走","痍","或","蜀","熳","蜻","佐","懿","嚅","紗","螭","忖","顶","狡","吲","洣","帛","呶","柞","柫","酿","粥","琢","呵","踝","榀","呲","價","鼋","欺","此","背","猎","昱","濡","稚","欠","暇","茬","牙","迹","尼","氛","膠","缯","娼","骚","姒","鬟","霁","鲔","者","驰","倩","馉","工","芬","烙","卦","C","裂","垲","摆","珮","缏","杞","绘","司","如","姞","荆","挖","跗","伍","氚","钘","郢","轱","篆","吭","夡","鹫","讷","轺","!","匈","待","聱","黏","海","蹶","趋","鎮","觊","江","咸","富","艴","稗","钜","搏","壶","鲮","薪","猞","轰","踪","赣","循","序","噻","若","裾","许","癞","吓","判","踔","查","蚀","[","樓","坌","岳","榄","役","倜","⒂","旭","溆","惯","咀","跫","选","囱","污","镶","⒁","淠","氮","酯","寅","芼","炊","夯","郪","农","褲","嘬","蹻","烔","罄","开","靴","镇","杯","羰","硪","籍","摘","馀","餐","眯","⑴","呗","巫","幤","蒤","蒗","镥","檵","盛","純","娃","●","耿","巡","婴","槔","i","颊","Ⅳ","栅","绅","邘","冉","碧","使","熨","羞","扼","漳","觯","楊","励","逑","咄","之","斤","嘣","鹰","媸","鲂","褚","磚","琨","聪","牖","太","蓍","涫","≤","虽","鸽","燧","褊","聿","壬","然","疚","莲","悴","簃","颓","坠","瞬","汳","l","登","瘼","窳","桤","縯","匣","坡","↑","愦","攘","渭","嬢","鲰","性","楚","澈","赪","達","鄯","罅","帽","茠","底","嫜","奏","浅","荽","楹","鼍","枵","嗔","滍","椴","嵩","氤","搠","两","榔","树","吝","基","峂","栎","侮","舸","遂","颡","锷","杼","酔","幄","哽","睢","陔","※","嚆","宬","宽","髦","笾","保","蹊","榕","咏","椋","丧","裤","骛","逧","弇","崆","樘","疤","鸤","伞","抚","诎","诵","豢","佳","差","埝","极","黍","煜","曰","阱","悞","叹","垤","藁","嗵","崔","卫","珂","憯","蔬","菜","碑","扈","铆","夹","衡","弱","挈","徜","疠","丶","遠","提","斧","炟","肺","B","她","晟","谎","邱","粳","酽","爨","鬼","伧","兹","嶓","谤","饕","揶","谱","歡","髪","餍","泳","郞","谣","汉","褐","非","刽","缅","饴","齐","兴","涯","芫","凡","褶","晡","努","蚶","彥","皤","砌","黼","吹","指","㙟","蓁","鹜","話","拊","辨","盎","肌","旘","软","颍","甏","滚","旦","滨","间","尴","对","鄘","称","镗","咅","璐","怔","垛","洎","瓮","绨","脚","遒","吊","纸","蹅","经","泉","武","汀","歪","败","拾","铪","吼","邹","磊","论","岛","厍","锛","芎","芭","音","澧","镕","锒","宙","牵","忱","嫔","麯","澉","擐","砥","撞","痴","盹","畿","厾","酸","俑","脽","鸈","枷","咨","蔹","诂","胰","董","脶","黩","髓","鉵","澎","鲽","梧","樱","诜","鲯","跂","盂","浴","苻","锅","實","碁","嘛","氕","艮","涟","绢","姿","茝","砘","簿","穷","镃","∈","抽","事","誜","窅","瀘","鲹","兖","嵎","陧","榍","轶","柿","藤","薏","娆","骷","梅","摒","睪","剪","羸","忧","邝","跺","旆","堕","伫","绍","疵","樟","–","绾","蜴","靸","侃","瘘","珧","遨","縠","信","充","桔","黇","劬","脒","良","俵","颙","轹","犿","屐","牾","4","兮","澝","汗","沼","铲","濋","鹬","丝","妫","重","蒺","磲","曚","尔","国","桐","俣","剐","哼","恹","哧","藔","谓","轨","眩","痞","添","鬯","库","梱","婕","蜢","贿","敕","泯","羟","龇","垸","左","肖","辎","鞣","谄","可","腺","末","狞","贷","嗌","仕","楞","膻","臻","欻","洲","所","檀","抔","罹","牒","仫","芨","柄","嫩","酒","祙","渠","的","笨","鳐","楡","过","苡","核","拖","阢","莒","凤","锋","`","硎","弁","鬶","朐","忏","於","昊","剟","咳","湘","日","满","哨","螵","餪","放","佶","葵","硷","c","抱","锥","芮","啻","惊","峁","琊","嶲","撺","煅","屏","袗","鄞","梓","鹌","宅","赂","鱼","洱","騳","E","物","觏","雙","瑀","上","淩","愀","❋","鄙","憝","沛","硫","产","垯","亁","枭","堰","赑","趾","庹","腭","迨","拚","晒","蜇","扣","纰","闵","窭","椽","菏","嘁","伛","郸","素","殷","表","躞","笸","耻","荧","辛","篑","馈","壮","耩","宛","慰","盡","塆","铯","苏","王","桕","⑧","°","浚","栉","朘","虚","骆","坂","秤","鲋","蕊","渝","呦","潼","驱","诼","峇","盤","趴","肄","笑","讹","貋","穂","啼","趟","暽","傣","蜎","挎","陳","勖","戴","旃","瞎","舌","幻","喾","赁","E","播","诀","蟛","鹛","骶","輸","連","醳","逅","奉","崖","娩","幔","佃","扅","阔","生","贬","疯","珀","苶","屯","裣","蹯","蝮","解","陂","疝","茈","帑","议","仲","埙","竺","峰","遮","涎","穸","阂","潵","镱","例","荑","u","脎","衍","轲","⑵","虾","颚","钞","²","伴","根","沣","腌","户","~","辙","愧","噤","觥","波","铗","纂","鲺","僚","毐","〇","桼","祗","慢","啵","坏","吗","嗞","甬","曈","徹","灏","混","渌","括","脖","汝","現","訇","紅","飘","虢","腱","旄","嬴","昨","孀","蚁","呛","讳","病",",","喈","蒋","镭","葩","耲","鳈","锄","喘","返","傕","咆","享","枥","瓠","茳","铱","脘","暹","廒","爝","橹","瞑","铎","岢","叁","翏","捭","賀","悉","帝","芥","牀","闌","毯","亍","弧","锆","币","祊","纔","齑","肟","绤","獨","翚","颢","係","鍪","粉","统","诗","娜","褥","鈺","湔","呤","犸","湨","泣","蟾","犾","烛","斐","朦","室","诨","榭","煦","醺","敞","燮","糅","衽","孔","猄","疭","辰","钽","胁","釆","钉","胤","涧","弼","濯","汨","颖","茫","皑","遏","捃","坭","燴","肩","滞","玢","巽","砺","蜿","毁","億","骥","本","忽","肚","搽","靰","郴","跆","客","酣","α","屎","辩","殂","垝","紫","秦","喇","凶","傧","铐","蘊","補","贤","竿","途","慗","榖","券","莠","逆","鳇","误","崟","妇","磷","捧","莸","⇋","绺","稻","填","逋","侈","隶","侵","翥","惘","惧","鸥","赠","壳","芯","巩","獗","硅","搎","鲛","9","夸","穆","缜","诓","观","薛","咎","杧","页","饫","瑟","率","礤","悭","畔","匯","匮","鼠","犒","芡","傍","嫂","啸","鄉","哭","鄱","捷","靺","嚒","嘀","哒","#","拼","钚","魁","霣","眶","郊","死","愁","箭","鼙","签","害","斛","睑","蟜","余","墨","様","读","養","貉","较","浆","翩","徂","冕","铧","列","诈","穝","缑","纲","志","舀","甾","举","馁","ä","畹","榼","垢","襁","麟","灭","佴","镩","酝","柒","梯","傈","萭","悫","莨","搞","+","兄","偲","攀","曝","嵝","喳","从","遶","撴",".","鄄","欲","挺","娡","发","速","胲","褀","态","行","蚓","坼","适","厦","寐","带","緃","醤","珽","‧","溍","斋","鐀","朝","欢","传","築","咪","据","蹜","医","妄","肇","囝","怡","镎","桩","轩","岔","腐","矽","媵","搒","菔","拘","D","欃","唧","瞒","郈","绦","吟","撝","醉","镣","匝","拎","砒","顸","袁","驼","愔","实","國","奧","胩","府","逾","愕","廷","碌","锖","狩","褴","镢","芷","娥","唤","┌","云","О","檔","驴","躯","驺","洃","檑","窴","(","腕","立","楯","齮","〔","漆","k","芍","蹽","鬓","概","楣","唐","闲","糗","旱","幸","腽","嗄","迂","镠","顿","扥","圃","烜","馍","佝","岷","童","悦","┐","铌","袈","靓","骸","和","乔","灸","泓","临","睿","掖","偿","鐘","犁","祓","鈴","搌","授","鹳","赢","怅","絪","硬","芙","螅","”","傢","避","裕","歁","全","衰","仃","媛","鬻","跽","沌","急","猷","激","巉","哝","渣","笫","跳","螫","熜","Z","筷","佩","啶","萃","頫","荙","出","孽","钟","戡","釉","咬","滦","鹇","贯","鹮","具","翁","机","濱","谳","釣","懑","葛","袯","谭","质","胴","誊","侗","⑩","静","蚜","溋","嫪","嗲","瑭","座","舫","靶","棘","泊","嵖","摧","勋","僡","藉","疖","巂","随","罾","崚","猹","憨","苘","斓","鼷","利","谲","剔","艺","箓","蛀","鲚","搐","裟","捶","绌","揪","帮","缥","匍","冀","杻","逛","邑","禾","郰","黜","丘","樂","滌","緣","胃","苄","巾","瑜","元","蝶","层","烧","级","岭","蘭","繇","蝓","洞","奢","则","政","矾","啭","瘠","碴","忤","身","匠","警","饩","犬","皲","箔","豕","虑","草","喟","芤","逭","艳","幡","姚","賓","饪","卯","敌","烽","嫚","黝","豺","㭗","教","偕","板","茹","孤","人","狻","寰","厕","玲","璨","锵","搛","勍","匾","聃","奘","垃","焓","喽","嫫","貌","瘐","嚰","孟","衔","郎","账","础","电","黑","骁","拨","濆","圉","刮","闭","竣","铅","羔","硌","筑","难","管","苕","眺","嫄","竖","榟","崴","摭","狐","娑","②","罽","谊","←","狳","铫","凯","狉","9","肪","崤","莊","妨","缶","滃","瀦","揉","肫","恧","糯","嵬","5","裆","嚷","稣","隐","仂","て","驹","籽","肢","尘","苈","撷","镲","趹","晤","唱","鉏","篌","驩","雍","闳","拄","藜","朴","伺","诳","房","吱","Й","鳄","罿","祧","酩","郅","耎","尜","绝","禅","揠","鎏","慕","麥","呜","鸫","党","尝","砑","牌","踉","刨","襻","㾄","螽","谌","止","抑","爻","磬","铄","蓠","委","汲","鹑","╱","嚣","彝","穄","穹","態","醋","⒀","叼","婳","簌","渥","很","甸","帅","锏","与","樾","泷","棼","湲","越","祥","短","顼","阘","宋","馘","鈉","未","囍","浏","叻","箜","鑽","法","曲","淤","僮","做","强","析","磕","谠","染","促","朊","隼","铉","莆","蝣","孛","薮","s","惴","秘","妩","訄","蔓","喷","诡","犷","酐","酇","刹","壅","甫","史","孃","髌","螬","擤","漏","寞","奡","悢","颔","岁","耄",";","又","锭","鲤","癔","杰","孥","酲","蓐","耋","捆","庖","面","鹈","殊","剡","峪","识","锨","归","茴","—","菤","汁","攝","液","鼐","示","讠","男","凍","ò","明","莓","砜","崎","蜂","斡","榫","娅","钪","昙","胜","欣","怨","◆","粗","秷","节","市","贩","祟","弍","蒟","烁","糧","蠃","編","黙","壕","戚","犊","桥","仺","孳","怯","皓","倆","垮","扩","诮","钝","脯","晏","帔","葫","瑾","運","孬","跄","掣","癜","掌","墀","禇","耸","蜓","鹆","鄢","攰","瘢","暝","鸣","峧","遵","笃","畚","帧","晨","镔","搜","靠","咐","韓","绮","觉","拦","斲","疽","掐","尽","許","矶","镉","豹","粞","袋","酵","蛙","戕","劉","髀","彭","玎","囿","郐","善","睃","結","拧","邯","讧","召","椭","瑪","痼","庼","反","疱","屠","荣","君","胍","乙","臬","头","诰","讪","席","晁",":","理","槿","璘","禧","呢","蹙","擒","鸲","丐","苓","壑","滥","⑾","炗","礴","耕","卅","唿","苛","寵","窖","麻","蕨","沤","氢","虔","癃","及","崛","爽","蛔","颤","膲","桢","坐","蟞","儇","葚","骤","誤","寝","嘭","灰","汹","韂","铮","慒","寶","肽","摅","紧","亞","潸","悯","橛","檗","闹","愿","担","袄","棚","垟","塄","婞","麈","麸","暗","咦","跞","谡","盈","磐","慎","瘰","掼","憔","研","被","贮","莛","至","呀","庑","矫","摛","怃","缙","磺","即","驻","瘤","偏","℃","嫘","癫","汈","鹟","搅","辅","璀","阊","绻","瑙","蓂","棺","孢","铊","鼒","果","砮","飾","凰","Я","遗","祛","纮","劲","霹","骃","绔","薅","瀵","垅","?","轻","惇","怕","啥","哙","燎","缆","匡","怫","卞","朋","酏","阑","爾","伏","敏","埼","罩","菹","艋","肭","鯭","杋","裀","撬","蕺","惠","大","爇","笈","絷","琳","谫","诛","糇","袢","倓","髃","觽","埏","寖","個","筴","外","漯","樭","喁","杀","臑","缇","裸","巅","毹","茅","忆","琼","唑","烷","项","隋","约","排","吮","谂","宝","牲","瘫","娄","沂","醫","拭","纺","蹰","哞","风","霆","值","酺","侠","螾","埂","育","夷","鮼","怍","鸠","Θ","瞳","阇","耥","羝","伽","洴","記","楔","颼","沪","邢","冰","昀","阙","洌","嫦","杂","仔","芑","潴","痄","桨","连","碓","塈","F","昇","何","桦","晥","驵","旋","药","银","奋","灣","俐","絡","嫁","浮","为","鞅","科","颦","潽","镍","鸨","粵","骂","拱","韫","盆","赎","尿","钿","坍","唁","秧","昌","曆","颋","遭","秭","褔","腋","〉","吉","漓","臆","焘","已","制","钹","鴨","咖","莘","P","碥","互","治","标","膝","伪","浿","纛","郗","看","佧","糖","篓","亡","´","骙","澡","影","窂","紬","镅","慌","框","晋","説","丢","凹","卖","巧","蹉","乾","莫","Z","谔","矧","铑","暴","庄","湿","活","穿","腩","筣","水","6","琦","迈","伯","洄","抡","▪","酋","荤","雒","粕","簠","菰","髁","枇","陲","多","仗","央","滁","胸","梏","痉","姑","襞","﹑","齿","弩","花","吆","赫","岵","佪","谑","锤","轴","盐","馄","臜","戢","涠","鸸","糟","孪","禁","蒲","化","疏","痰","脾","刈","應","珍","膺","扌","廙","汜","牍","虐","婿","啕","彻","赝","陶","蠲",">","位","屁","醍","粢","挪","臌","滹","遴","馨","n","稼","徊","酌","轸","债","朰","程","辞","痊","插","鹩","郄","铝","狱","叱","同","寄","搪","蚯","魭","舍","旷","闰","涝","民","嗡","苌","馕","姥","屉","啧","枢","❤","窕","钊","矬","菂","佑","≠","獬","桁","墟","皖","鼻","它","歇","独","好","晕","蚝","锞","颈","豚","聖","裉","扫","岿","悒","佥","苗","妞","晚","圭","茼","脲","摊","窠","狸","抻","场","呼","囟","噗","狺","困","瀹","削","衬","谰","蛆","訓","鉄","痃","炱","蝻","我","暨","骓","馋","埤","脞","晃","螟","洮","泛","掾","穑","米","蕲","玦","讙","逢","劐","袭","凫","僳","畛","晷","鳕","Ë","愬","坫","鳡","鞯","叔","胂","囚","筋","青","度","涕","琰","﹔","径","陇","睛","链","状","逶","蘅","“","庇","邽","纥","踶","爺","狭","钫","桃","弛","淳","办","茕","砸","喱","仅","潞","杈","得","咕","俞","检","借","恋","驿","倌","钢","琐","哆","撙","箫","川","猥","牢","蹁","城","馏","锡","楝","蛱","奈","瑶","桺","耆","翟","阒","稲","橐","萱","惹","蘼","主","擦","蟒","台","佬","荫","廖","笏","铕","衣","洇","炒","瀍","崭","圻","洚","契","嫱","倏","晶","了","堠","勰","椎","询","梗","飒","锰","览","溇","寻","蓅","【","碇","井","露","顔","堌","庳","踩","i","饷","俊","楫","條","搭","奍","羽","憋","岘","毡","曜","乃","′","针","羲","菓","吩","咩","鞘","尊","宫","舜","啖","惗","北","懊","骇","阄","躅","权","缲","肥","铜","《","录","也","棬","煮","舄","厮","'","順","受","霜","新","售","牞","圣","妗","犴","宥","哦","陀","卺","冚","蹒","亸","禮","骰","瑢","弒","抛","谷","嫰","動","嘌","惩","枣","忌","茡","爵","嘚","郧","丨","敲","帚","沭","槊","⑶","專","毶","圄","磅","蛭","由","蠹","剜","诫","秆","愠","藓","母","请","衩","忸","蜕","饽","晦","倔","腠","痛","品","簧","父","锐","描","蓰","蛴","箍","兕","苜","饼","奚","泗","裥","皂","嵚",",","澶","蠖","沅","馎","籀","菝","眵","糥","铽","痤","颟","淄","作","抉","俄","么","郑","耒","佛","1","纡","鸢","④","鎚","壖","遢","鬈","拢","托","哈","節","橦","冼","六","耗","樵","涔","舳","龌","衿","婧","栓","椹","嘘","膊","茁","丹","螃","剖","洧","珞","潺","孱","呐","萩","刷","引","说","熟","/","靖","酷","耠","饬","菌","洙","荃","饲","酾","阁","陬","铿","倻","牮","鞡","撕","倘","盒","曺","襦","辄","算","塬","潢","羖","湾","续","△","疙","谖","嘅","遑","篚","筮","氍","递","尧","G","{","分","埒","@","蜍","荼","襆","槭","檠","縢","濉","梆","隔","镛","倞","润","瓯","瓢","蟊","沐","啷","砚","皱","剅","儙","错","幌","滓","砗","郤","喧","峣","簸","毖","踏","锕","…","悖","谧","醵","加","镐","泐","傫","胪","缄","卩","蓼","丸","垌","汞","宴","膙","圊","矻","嚏","漾","幕","駕","葒","绪","袪","镋","杭","澴","鬃","粟","偻","饳","抨","亟","温","韶","轿","罟","际","诖","复","坯","骗","*","副","裢","憬","邾","崇","蕈","疮","粽","炝","珲","莅","衾","爲","枯","汛","仁","熏","馥","㎡","檐","锦","竭","颁","遽","瘙","样","遛","殍","湄","消","鳌","痫","鳏","瓶","窈","谚","麒","鸹","蟋","横","唠","瘪","媪","侔","鐵","系","杖","m","叉","沟","衢","寘","■","弗","建","疣","珣","綦","劈","道","嘈","先","芝","降","滕","邵","邺","給",")","廨","郛","势","氇","坤","昂","焼","奕","闱","朓","毽","还","坨","銭","龂","銎","壽","矸","窒","①","玷","蝽","泃","烀","魈","★","慶","K","嘶","酶","呖","殿","乡","䄂","阳","轪","碱","譬","摩","鳖","刳","地","包","貊","悝","圩","今","嚭","凳","谕","馃","捎","佯","侬","愆","微","涤","舔","蛇","筲","助","锾","剧","缧","簪","惚","柢","庾","虹","雪","猡","脔","亶","烨","T","锗","芈","女","动","偬","琥","县","诣","精","嬗","栀","艨","智","冗","闼","嗝","z","夢","拿","鹲","尤","啮","﹐","ɔ","钓","施","萼","邻","竞","碶","艰","》","翻","馆","橪","逝","臀","淫","枉","羿","拇","溷","徒","涓","關","聋","嵊","殖","叛","敫","舵","亊","诽","菱","苎","破","腚","A","嵋","扊","挂","篷","棂","碟","復","劾","韪","疔","粒","鲵","毙","店","锻","衮","寳","◎","斯","倦","醢","曾","茚","荐","隗","芊","豪","亻","哂","堃","宇","桑","匋","植","亥","撂","棒","蟠","W","迟","蚋","溊","缌","鞚","蚤","適","赌","卣","厚","鲾","匙","槃","郎","鬏","玳","龄","丈","圮","冑","院","葬","嵐","瓦","孵","漶","星","吐","獍","藠","萍","振","潜","龉","匦","粹","諾","畵","峦","&","埕","朵","戒","炳","酪","绂","篁","测","殆","涌","业","盏","醊","笆","孰","骊","湛","踰","汎","哲","澙","鲷","√","鄣","亿","螺","吠","伟","凛","骡","恻","巨","扶","泡","峯","韵","腎","睦","栖","}","笙","疌","绶","忒","哥","价","纻","薨","漂","濮","缮","勐","妮","傩","陛","陷","柆","瞭","鲳","烬","喉","固","桡","聊","逦","猊","梻","涵","栒","逍","饥","凼","早","姣","蕤","塌","桀","亳","虻","鹨","典","情","怄","商","钍","赚","塥","煽","垱","蝴","乓","籁","帷","锢","圪","快","赘","杵","漠","滴","斩","拈","蚕","陽","篡","郦","瞻","郯","鳍","幽","旅","乖","鹖","斫","痂","肸","右","锂","永","泾","茎","觱","彼","擎","䨱","翱","徝","醅","求","湫","転","溴","師","瓣","蝠","铭","社","苞","仇","噌","你","嗾","雳","榧","駹","雯","叨","遫","氏","航","辗","溢","历","楷","诱","雏","梳","藕","屺","槎","钐","燘","棽","驸","褪","清","十","廰","移","筌","揾","瞠","姽","馑","恢","逸","p","瑚","茄","鹧","俗","璟","栊","买","瀛","镒","球","氲","缛","講","胀","焒","悲","翕","拗","T","桌","脓","闪","稀","狎","火","柁","琴","澍","嗟","龚","楮","噼","隽","栩","焻","哩","藻","瘸","含","偶","界","嘃","昶","澄","頤","绒","鲁","麝","决","撒","岙","季","刿","肝","蒉","蓇","财","完","蠔","脉","肱","谙","蜮","郭","慨","晔","髂","蛏","眨","钗","葺","惆","娈","瞵","踞","棁","蝢","嚎","猝","必","剞","关","咛","劫","闸","肯","№","莩","哇","蛑","镬","羡","驊","茂","塍","沓","筱","杉","战","茧","耙","击","需","腊","酎","畦","葙","鹘","韭","嚚","争","域","伢","鞲","哳","栲","某","翌","哗","焚","螗","懲","躲","約","镖","凿","饶","够","剁","铥","应","署","杮","蒂"," ","坷","礅","款","梁","鄜","髹","選","伤","路","З","亲","野","啦","捯","憷","鲩","札","怏","塘","绊","愍","簦","牦","黥","鳜","唉","W","沱","蚺","甪","摉","协","耨","娱","桄","仆","类","搡","滤","岗","休","坶","谒","忭","飨","闷","菟","鲣","驷","湜","疡","蚩","萊","䝉","硒","贺","弃","徘","陨","否","遥","妒","X","間","觜","跬","夬","羮","喙","赇","鹗","『","砀","残","绿","小","勘","瀌","扉","耧","衅","挟","乐","鹏","墁","澜","噍","坊","術","嗖","知","盉","圆","嗈","蘖","资","爭","=","刑","裒","〈","淸","定","袒","戗","钤","吵","旯","蓝","裎","溅","贰","荏","甥","悌","勤","炽","换","躜","!","薄","痱","双","匕","肷","挥","茑","船","砝","煤","荜","弘","▏","陆","稔","朽","冤","頉","遊","砰","迎","碎","唪","醪","稆","练","锸","阵","皇","香","镀","嫡","持","桶","垄","阍","戥","臣","琛","涘","惶","赙","葆","住","舊","枝","媲","蓣","龅","搦","_","图","力","纪","悍","麗","戽","腧","绣","跟","哕","打","蝰","Φ","吞","功","夀","劓","沇","熔","占","隰","命","佻","豁","苣","楦","掇","蛛","唢","郜","霉","鲏","予","沸","殻","俯","探","篪","荇","邈","烯","忮","伸","岬","×","锧","窸","毪","纩","蛋","讯","骼","叶","楂","犟","站","盘","隈","喝","儣","兵","尚","孙","爿","芜","羁","旖","溽","迩","京","7","龃","狝","缦","缁","鲃","怒","故","據","枫","髙","亭","耳","飚","O","编","箸","幼","氘","鞮","匐","祯","臃","辫","磋","溝","墙","诚","阻","档","歆","璃","悻","婤","映","瑞","牂","话","忠","潘","惋","冬","氦","腔","胬","盔",'"',"饮","贶","嚄","儆","溜","砷","樇","跏","泩","馌","埃","莙","革","珙","乌","鍋","穴","石","珺","熹","诞","<","腉","姊","钧","罪","拆","赊","殒","堇","仑","掺","塃","獴","迥","盦","檬","益","居","鼑","异","嘻","悔","旮","况","時","阋","洛","線","#","型","迕","睇","橱","笊","蛞","愚","茉","镈","镞","垭","扁","泫","搬","古","书","疸","痨","黟","墉","料","并","ㆍ","裳","鞑","湮","柠","颐","形","━","逹","硁","置","韦","瓞","象","殽","均","浓","瞓","椐","洨","乱","襜","终","優","睹","敦","鼬","唆","佼","財","瘃","H","痳","勺","依","虎","蕖","玄","缓","滢","^","骅","诘","弋",":","∩","廪","缈","造","蕉","孖","嫒","寨","意","岽","庶","罗","瞢","酹","蔟","赴","烂","栋","格","矛","驯","词","嗦","剀","蓓","期","鏢","羑","奴","椱","A","狗","烟","蹬","案","记","讴","鳑","侯","霏","焜","沬","份","酦","芗","庚","瑗","鹎","穗","鲠","肛","厄","蜔","學","伊","⑥","琪","邒","少","霖","蓖","猜","塾","肾","罃","伐","钩","骈","溟","饵","莉","é","刖","洯","堉","锝","趔","七","萁","竹","憾","蚨","离","柔","替","侑","飙","气","震","厥","备","刻","顽","瞽","腄","雄","燃","旬","简","翠","熥","◇","吃","囡","玙","铷","暖","配","傻","窄","皈","夼","舂","乜","苩","攉","雠","茇","锈","酰","粮","祝","考","堍","鳅","彬","▲","孝","蠊","顇","娲","腥","$","珠","厂","诠","蹓","轼","嵫","捩","硗","胺","证","膀","」","胯","钷","毂","柙","深","沄","匹","8","爷","礳","秏","窜","魑","d","转","烆","屿","眙","極","袤","護","V","狂","柑","玠","氩","’","馊","玛","坢","%","燔","颗","舅","暂","艾","芹","溏","晰","件","琚","仿","祾","酤","騠","揳","鲫","蜥","仨","牺","步","讓","港","煲","铴","腦","鳝","危","鋪","冠","正","柽","抍","掘","控","娴","娀","離","手","臾","酗","筼","煸","弹","照","哎","毒","颀","诙","刚","搢","䧳","峒","滋","\\","匀","黉","毓","娠","床","浪","祐","铟","4","?","凄","飗","蚍","葑","抗","鹞","糸","红","英","违","橡","眷","防","缬","龠","察","仍","辇","减","闫","箴","龍","館","屙","翙","媽","涴","到","旻","删","瞾","鏖","咭","豨","荘","炭","畼","构","锘","鉫","候","扇","繄","猩","瘵","恺","贵","榦","息","恽","胎","狰","雜","辋","璜","硈","泠","呔","蹿","踹","摄","炀","坞","蹄","裝","赛","蝥","塔","靳","荬","找","仡","淮","比","淆","义","淝","卢","辟","寂","庒","鳯","暲","景","邪","腻","赍","甍","讲","哌","嶝","鎌","总","缱","问","磛","谅","拉","靈","奭","沆","茔","羅","鄠","網","吏","懵","鑫","歌","黹","嵘","涞","碳","崂","婥","赞","镑","購","幺","鸰","饟","蝌","忝","懒","禺","梽","齉","恳","拯","弥","荡","芾","幪","厌","馒","蜘","欸","吣","1","却","榻","碾","袂","錎","钬","無","嬉","笞","蹴","视","雇","创","椟","6","瘁","斜","傥","喃","炷","秾","嘱","茀","犄","窑","庀","潍","伦","䀲","凉","Р","撻","萜","二","倨","蔑","捕","勚","士","鈇","踺","啤","彧","缪","述","傅","颅","畸","畜","滗","慭","琎","斌","参","胳","骖","稠","汰","铻","闯","留","蘘","沏","亦","择","華","禽","砟","祼","狃","噫","狼","寤","跪","浠","·","费","瓘","鼹","锪","箢","垣","慊","虏","秩","偉","镏","钯","恐","鹃","菇","炸","潮","蟀","硂","偌","哏","验","桉","阴","初","掴","鹺","峨","赋","舉","裹","赶","土","淋","瘌","沔","r","赀","淖","茯","怛","谜","洗","似","舡","纳","晓","R","诐","痹","漪","顺","挛","阎","贝","钰","惬","疬","菀","埘","怙","部","译","鲭","窋","敢","夜","撰","珅","特","襕","癖","胡","⒃","附","擘","痢","尬","鉴","瞋","膨","阽","挲","⒄","骎","帕","缕","计","障","鳆","隹","朔","碹","当","迦","氙","蘑","妓","炬","苊","萎","浈","沥","绯","壤","噱","蹾","驶","葱","孕","羹","钻","農","勝","膈","灿","赆","靿","耱","陪","忙","缰","奶","儒","个","朱","燹","琮","轷","錾","箅","澳","嗥","攥","没","匿","鲆","|","矣","他","鸶","芸","B","髑","街","巿","廣","盯","監","鲸","胭","凬","寿","挝","绽","+","劝","究","眢","集","衙","卷","j","跶","牡","畯","貅","销","發","咱","蓊","揣","咝","琶","荦","阌","盅","嘹","苟","醮","洪","鲧","钒","柱","氨","旰","冽","茭","嵇","粲","蛾","訾","辔","N","尹","趿","蹲","疟","祠","段","車","网","⒉","舷","廐","侣","棵","粜","觐","铼","锁","兒","舁","时","垦","版","摈","扳","见","腮","嫖","痭","呆","簖","伋","鳙","珊","麂","既","谴","热","超","蠕","铞","e","殓","因","锿","文","禊","皙","鑙","爹","鋼","忻","秣","镁","奠","橉","畺","笮","疹","湝","龟","殃","毵","溃","勢","索","砉","阼","堞","酥","冁","喊","¥","幛","娇","锲","蕃","铘","铍","鴿","响","傲","脏","杓","罕","笥","弦","但","缃","扬","盲","碚","幢","鎖","缺","钋","麽","禳","浃","啄","昧","蒴","帙","琏","咧","舰","亵","浊","豳","衲","俏","镵","浩","勾","槛","榈","徙","鹤","洹","铂","揎","棕","挦","挫","阆","衹","甚","近","】","簏","汽","踮","淌","檇","痔","谝","钙","蕞","蔯","兆","蔽","后","蚬","谸","芟","枞","叫","栗","餘","营","郝","氯","㺃","狍","冏","庛","纱","泼","碍","认","邓","茵","饧","闟","惝","裙","噙","忘","虬","群","S","佗","恼","坟","肮","皮","玃","在","赧","孚","偾","镨","恨","葡","西","缞","挠","逃","吾","膪","焦","翘","桧","变","渗","繁","際","痘","撼","筅","坑","前","玑","数","融","鲌","讦","窃","鄌","伾","众","攻","彪","锎","焐","殛","锊","嗉","枓","抢","鞠","掩","贾","搔","皁","拶","朗","渺","跛","㛃","鏾","慥","杆","沈","戍","豫","楠","爆","汤","昉","耘","缡",".","允","揜","责","艟","裁","喬","砹","鹣","裼","啉","蛳","酮","听","维","阪","獾","浣","訂","瘿","蜡","泖","蔚","貔","致","禨","尓","糺","绐","遯","笄","邦","圈","洟","缟","槲","桹","镓","骒","髫","暾","像","縻","戊","飧","驽","干","万","绕","披","雅","桊","卡","贲","吡","沧","鳟","堂","扺","岱","封","鄭","螣","瞩","幞","邕","睫","涩","自","趱","愣","威","酊","罂","慑","袴","架","烘","现","灞","钔","股","興","乍","噜","济","碛","兀","诅","柴","瓿","[","怿","竦","白","黄","阶","务","榮","澹","谏","垓","跸","繻","窿","紊","陟","劁","嗑","牯","厉","敛","鮕","嘉","蔻","鼎","恒","硝","溉","骘","窘","任","裱","处","旨","舶","缸","囹","笠","讥","泜","脊","煊","淦","牝","硕","胧","泚","溪","贪","牛","答","瘴","Q","炯","⑤","篾","銀","乩","杶","垆","蛐","苔","啪","y","玮","琫","寮","邂","後","僵","贴","硭","枚","姆","乎","讶","醭","橥","脱","蒈","擞","忪","顾","柚","褿","忲","辖","铡","螠","殉","喆","爡","轮","棰","鲉","跃","韬","睡","嘧","袅","圗","檄","踊","阀","题","桫","林","沉","禚","散","麇","沦","秋","导","斑","宰","嘞","暑","笱","搋","擅","镤","锶","L","厣","有","猗","袆","绞","甭","歧","跣","潦","専","绑","飱","廓","磔","接","腓","窎","瑁","飓","蟪","俎","П","缉","䘵","夙","潟","桷","淡","虺","恶","|","驭","怀","邋","辢","逻","晖","蜃","蜊","溻","冢","尻","礼","厝","亘","酴","饔","悸","戆","什","玚","馔","哔","沃","竑","葭","垞","鏂","抃","弄","去","焊","焌","x","苇","與","炼","蛄","莴","阏","薷","禀","鸯","栽","冒","姓","0","尃","蜞","毗","骟","秸","荸","柈","恬","赡","侏","兑","蝤","荷","徳","押","挣","腰","宣","鸵","葳","遘","讨","狒","涿","囤","邃","蒜","疑","脍","嘟","鹠","吻","鄹","耦","华","霸","侥","勒","挞","臊","尺","让","榆","阝","鳚","灾","鲬","艿","Ⅱ","锩","攮","蚊","蔁","唝","涅","挹","淏","鏊","氵","鹕","律","對","粱","恫","挻","滏","叮","‰","鼯","绫","秉","怩","質","岐","菊","佤","帏","骺","爰","珉","耪","乞","郕","鲱","雷","蒿","不","啐","侓","郓","歼","拒","胗","寕","旒","勁","婢","诌","蹂","姐","媳","歃","拐","辐","拟","醯","雌","点","玟","您","鲨","载","藩","罔","噀","抹","萏","补","蝎","辈","劢","乚","唔","瓜","恿","蟭","涸","纬","睽","樣","帻","蓥","谯","柯","渴","脁","诲","福","③","熊","羌","疴","袖","虿","杏","覌","易","醾","筒","肤","苷","柃","榇","酬","癸","啰","眛","稷","展","鸾","祢","蝾","敵","毛","痦","老","赐","单","淹","畋","符","奎","绥","轾","鄺","濩","眦","觎","忾","璋","刘","翳","菪","簟","胼","孫","機","獻","低","o","捅","鳥","⑨","卸","废","启","呋","窥","巢","揭","咴","趺","鲥","空","膄","崮","锜","络","納","恤","刭","批","霭","氧","钮","甑","祲","粘","辏","∶","臨","│","粪","惰","肼","浉","橄","5","東","8","漁","浜","忍","奂","遹","扃","扦","入","欤","豆","悠","蕴","萑","媄","龈","÷","磙","鸬","缎","嗯","浕","木","陋","柰","瘩","箨","松","躁","鲇","彰","恕","楗","姨","撅","诹","戮","桓","棉","束","嗍","庋","瞿","郂","哪","町","a","铁","洫","失","栳","篇","鳗","眇","椿","義","就","都","镌","阖","夭","拃","跚","業","圬","演","篥","3","昼","從","瞍","蓦","鼾","坪","觫","鲍","馿","妾","密","奥","耰","佟","嘤","貘","薯","稽","届","褛","钠","猿","佈","倍","铩","铙","踵","o","捱","鹐","當","狷","写","遆","钱","姗","寸","综","挑","礶","靼","溯","湟","漱","碰","职","味","Λ","璁","壴","给","碘","恭","苴","酚","套","宕","辽","窀","催","踢","惟","璧","翔","稿","癀","霈","光","膑","妆","庡","圾","躺","惮","切","目","梦","岫","飑","叠","累","鴻","透","量","妻","沨","俪","屣","挚","w","厅","货","箧","漦","隙","瘥","妃","門","鹦","隳","龆","瞪","跑","帼","刺","起","鞴","岸","渫","莽","髭","耜","瑛","葉","宵","绠","眭","畅","茱","卜","濂","浍","冈","脬","厘","夔","纟","槚","哐","萋","曼","膳","潲","啜","啊","猾","捉","箕","㐂","藝","艘","園","妲","灵","蚌","范","&","疥","陑","洒","唾","a","婄","谋","t","唬","宓","瓷","︰","焗","默","噔","菡","恃","亩","边","啟","颞","啬","盟","墩","汭","缝","魇","酡","疗","梾","尾","鹿","锔","溦","酃","囊","掉","罥","报","诤","喹","蕙","割","蠢","兼","俺","升","屦","獠","辣","跹","颧","宪","抬","咿","沲","旗","荩","傒","鳳","變","偈","薹","钭","垧","谪","躐","谀","R","字","怆","陵","追","迓","舞","卲","捲","麾","税","方","竴","壹","射","轫","塞","僧","椠","突","阕","惫","U","佞","秒","友","視","莹","攒","荻","俅","筐","能","刓","拍","浥","揽","谨","军","巷","怵","额","恪","荀","糍","湎","褙","觇","效","估","噩","恍","聚","涛","式","兜","汔","祃","銘","烺","瑄","枘","丁","樗","堙","窗","號","鬣","阈","乳","簇","绳","淞","]","征","聩","凸","礓","柘","懂","㧎","纷","里","爸","靥","莞","馅","仞","芏","莳","殪","煌","落","佚","帱","诶","家","将","浯","抿","讫","趸","筢","绩","原","专","滂","嗳","踬","泱","體","蜱","绵","伻","埗","妤","蔺","赳","嘢","梨","鹪","烤","镦","赉","崞","蚰","骝","幅","汴","丽","访","叩","羼","亓","恸","燥","笤","丑","枰","守","蜚","戈","高","q","瓻","隘","H","南","剎","扭","骠","孜","园","锬","审","¥","罚","购","裰","泔","醌","醒","绎","莪","掬","睾","鹁","蛊","票","剃","释","调","黛","撩","篱","茌","敓","蜜","魉","鳤","昽","俳","辁","键","犯","嶙","狈","邬","枋","婊","憎","督","救","措","足","码","栟","虼","棻","阅","肊","坛","鸱","侩","烫","湉","脐","戾","旎","膚","椒","境","绛","濛","蓄","章","压","窦","彖","阜","咻","神","存","诺","課","覺","鲈","渚","「","缢","仓","氅","筇","桴","荥","些","纯","肋","退","妪","别","書","租","嚼","芘","笳","涰","馐","熵","犹","朕","猪","蔸","參","觳","舖","蝙","骏","织","躏","纹","锹","蛉","撑","氽","茶","俛","誠","胖","崽","炫","乘","把","趑","谵","骧","犍","鸮","灌","焯","倭","狁","盱","踱","滠","儡","诸","芽","駆","蹼","虱","祇"," ","蠡","衄","谬","蒍","婺","蘧","博","捍","磁","慷","釂","蛩","钕","祎","呑","贫","斗","菅","操","规","硼","惕","丫","俭","肿","骀","砼","句","茛","闶","钏","饻","圠","萌","魏","铃","摞","┅","伎","獭","田","钴","峭","魅","捋","唼","鹅","祚","嬷","圖","抄","嶂","鸳","溧","钵","嗽","墠","锌","愈","併","踟","羯","翅","纠","勻","岚","菖","便","祈","毳","屹","掰","倬","扛","巴","拮","绁","跌","飯","嵯","翮","堤","诃","腑","皆","鄂","胾","片","这","浙","雨","鼱","袼","鹊","厢","蛣","摇","蛮","揍","⒅","啱","薇","岈","兔","谇","纶","肉","崩","甩","涪","馼","铣","锚","丙","雲","烹","钦","撄","铬","令","虮","湊","禹","抖","喏","旺","畲","戬","嗷","釜","车","缀","玕","谐","啁","怎","下","惑","恅","藿","筰","帐","祸","镝","喵","刁","习","藏","墓","护","聲","箦","严","按","谛","睨","艚","歉","蟮","胶","盍","鳃","狯","垫","杠","线","3","葖","t","熬","虞","嶶","篮","黻","墒","氟","嫠","漕","腾","哟","玫","撇","垍","靛","翼","淅","省","斥","稞","蠼","谩","埠","蘸","刊","烝","宁","鹚","龊","苪","袷","诧","细","蒌","焅","2","筹","扒","卮","捞","净","菲","逮","槍","蛎","莱","黠","逖","辚","剥","啴","诿","楱","氪","领","嗒","藐","惜","甘","佾","嵴","胫",";","晳","锣","瞅","缷","耶","搤","策","咽","邀","霾","悟","属","鸪","牴","贞","趁","丞","瘆","豌","著","饿","筠","划","璇","损","卵","腒","畏","盥","耐","圏","拓","蒙","鋫","劙","蹦","熘","烊","匏","咔","轘","沽","菩","罴","磉","炖","假","枪","龙","俸","焱","四","─","毫","涨","浇","椰","賣","蘇","真","安","坝","枕","鸼","昵","亨","苤","祷","枧","赟","菑","鳂","戌","悄","種","鳢","嗣","電","颥","妯","谟","蜒","训","泍","洁","勇","哿","扰","蟆","螂","刃","絜","曪","乒","湖","鞨","懜","夤","哓","胥","桞","俇","肣","半","于","橼","锑","熙","甜","槌","盾","屃","缗","共","碗","凇","笔","阿","擗","袍","敉","钾","俶","蚪","琤","凱","辕","à","恣","皴","創","寥","妳","腈","畤","迤","垠","触","趙","铤","逊","羊","碉","锱","骨","仄","斟","俚","啡","芩","迫","杷","种","鹄","牗","耑","艇","芰","整","慙","飛","甓","岩","鸦","黎","僊","糁","谈","洋","椑","健","〕","內","言","掷","倚","姬","矿","灯","阐","凋","銮","豇","瑰","抓","噪","堋","吁","妈","庥","彳","鄗","闩","夫","0","庠","悬","妙","琵","着","首","熣","瞰","揆","燚","条","姜","滘","麓","鳉","椀","蓿","廠","泌","蝈","倕","丛","耍","且","蝇","凉","豐","泪","臼","服","刍","織","渎","尥","甙","埋","珏","援","祖","彊","臱","惦","葴","礁","达","橋","钨","崦","醐","巳","中","颜","溠","铹","负","抠","愎","罘","雩","胝","冱","筵","篙","材","肓","○","迅","腼","橙","仵","茏","慵","齌","琯","疃","貢","豉","瞟","忉","禄","通","咒","愫","秕","筜","觖","州","渑","胆","喑","張","衖","洺","眉","榞","色","邶","攫","堑","淬","嗪","肐","殣","辊","隧","献","潤","蓺","函","鹱","轭","劭","椁","膜","亹","侧","貂","哚","磴","蠋","囔","险","伶","世","菥","莶","瘾","燫","延","∵","毋","羧","无","雎","曛","沚","巍","g","熄","恰","伷","開","冻","颛","支","⑦","鞥","赖","试","泮","联","沮","穰","è","峻","滿","豊","刎","鴈","覆","串","锃","春","储","矍","哺","评","猁","愉","疳","閃","奄","甲","墦","頭","锫","俦","玩","搀","砭","流","橇","泅","琇","趣","∧","辑","灊","貴","迮","摹","霄","濟","限","彀","匪","缂","觚","奇","诋","灼","萘","狠","澥","岂","悺","闾","麋","号","槽","姹","陉","瑯","尉","h","绖","宿","戋","粝","砂","该","鞧","翯","釘","铢","窨","設","⒆"],y=$.output.data;let m="";for(const p of y)p!=0&&(m+=c[p]);return m}function imageDataToTensor($,c,y){const m=new Array;for(let h=0;h<$.length;h+=4){const u=($[h]+$[h+1]+$[h+2])/3/255;m.push((u-.5)/.5)}return new ort_minExports.Tensor("float32",m,[1,1,y,c])}function getInputs(){if(window.location.host=="webvpn.cuit.edu.cn"){const $=document.getElementsByClassName("input-txt");return{usernameInput:$[0],passwordInput:$[1],isJwc:!1}}else if(/.*\.cuit\.edu\.cn[^/]*\/authserver\/.*/.test(window.location.href))return{usernameInput:document.getElementById("usernamepsw"),passwordInput:document.getElementById("password"),isJwc:!0};throw"Not cuit website"}const USERNAME="username",PASSWORD="password",username=localStorage.getItem(USERNAME),password=localStorage.getItem(PASSWORD),img=document.getElementById("imgCode"),captchaInput=document.getElementById("captcha");ort_minExports.env.wasm.wasmPaths=resourcePath;let session,shouldClick=!0;async function main(){const{usernameInput:$,passwordInput:c,isJwc:y}=getInputs(),m=document.getElementsByTagName("button")[0];function p(){let u=(l,a)=>{const o=new Event("change");l.value=a,l.dispatchEvent(o)};username!=null&&password!=null&&(u($,username),u(c,password),shouldClick&&m.click())}function h(){const u=new Date().getTime();img.src=`captcha?timestamp=${u}`}async function d(){if(session==null){session=await ort_minExports.InferenceSession.create(resourcePath+"model.onnx");const o=document.getElementsByClassName("tipLi")[0];new MutationObserver(()=>{const t=o.innerHTML;t.includes("验证码")?h():t.includes("账号或者密码")&&(shouldClick=!1)}).observe(o,{childList:!0,subtree:!1})}const u=await getImageTensor(img),l=await session.run({input1:u}),a=tensorToStr(l);if(!/^\w{4}$/.test(a)){h();return}captchaInput.value=a.toLowerCase(),p()}m.onclick=()=>{let u=(l,a)=>{l.value!=""&&localStorage.setItem(a,l.value)};u($,USERNAME),u(c,PASSWORD),y&&checkLogin()},y?(img.onload=d,img.complete&&d()):p()}const wait=setInterval(()=>{document.getElementsByTagName("form")[0]!=null&&(clearInterval(wait),main())},500); diff --git a/app/src/main/java/com/thryan/secondclass/SCRepository.kt b/app/src/main/java/com/thryan/secondclass/SCRepository.kt index 5f2923a..b11505d 100644 --- a/app/src/main/java/com/thryan/secondclass/SCRepository.kt +++ b/app/src/main/java/com/thryan/secondclass/SCRepository.kt @@ -21,7 +21,7 @@ import kotlinx.coroutines.flow.MutableStateFlow class SCRepository { val activities: MutableStateFlow> = MutableStateFlow(emptyList()) - private var secondClass: SecondClass? = null + var secondClass: SecondClass? = null private var account: String? = null private var password: String? = null diff --git a/app/src/main/java/com/thryan/secondclass/ui/login/Login.kt b/app/src/main/java/com/thryan/secondclass/ui/login/Login.kt index 1dd1b41..51d1516 100644 --- a/app/src/main/java/com/thryan/secondclass/ui/login/Login.kt +++ b/app/src/main/java/com/thryan/secondclass/ui/login/Login.kt @@ -1,43 +1,16 @@ package com.thryan.secondclass.ui.login import android.annotation.SuppressLint -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.statusBarsPadding -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.text.KeyboardActions -import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.AlertDialog -import androidx.compose.material3.Button -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedButton -import androidx.compose.material3.OutlinedTextField -import androidx.compose.material3.Text -import androidx.compose.material3.TextButton -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.collectAsState -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.layout.* +import androidx.compose.material3.* +import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.input.ImeAction -import androidx.compose.ui.text.input.PasswordVisualTransformation -import androidx.compose.ui.text.input.VisualTransformation +import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import com.thryan.secondclass.R import kotlinx.coroutines.delay @@ -45,121 +18,28 @@ import kotlinx.coroutines.delay @Composable fun Login(modifier: Modifier = Modifier, viewModel: LoginViewModel) { val uiState by viewModel.uiState.collectAsState() - - Column( - modifier = modifier - .verticalScroll(rememberScrollState()) - .padding(16.dp) - .statusBarsPadding(), - verticalArrangement = Arrangement.spacedBy(16.dp) - ) { - LoginContent(uiState = uiState, viewModel = viewModel) - } - if (uiState.showDialog) Dialog(message = uiState.message, viewModel = viewModel) -} - -@Composable -fun LoginContent(uiState: LoginState, viewModel: LoginViewModel) { - var err by rememberSaveable { - mutableStateOf(false) - } - - - Text( - "第二课堂", - style = MaterialTheme.typography.displaySmall, - modifier = Modifier.padding(bottom = 16.dp) - ) - - OutlinedTextField( - value = uiState.account, - singleLine = true, - modifier = Modifier - .fillMaxWidth(), - onValueChange = { - viewModel.send(LoginIntent.UpdateAccount(it)) - err = !it.all { char -> char.isDigit() } - }, - label = { Text("学号") }, - isError = err, - keyboardOptions = KeyboardOptions.Default.copy( - imeAction = ImeAction.Done - ), - keyboardActions = KeyboardActions( - onDone = { } - ), - supportingText = { - if (err) { - Text( - modifier = Modifier.fillMaxWidth(), - text = "仅数字", - color = MaterialTheme.colorScheme.error - ) - } - } - ) - OutlinedTextField( - value = uiState.password, - singleLine = true, - modifier = Modifier.fillMaxWidth(), - onValueChange = { viewModel.send(LoginIntent.UpdatePassword(it)) }, - label = { Text("密码") }, - placeholder = { Text("EasyConnect/教务处密码") }, - isError = false, - keyboardOptions = KeyboardOptions.Default.copy( - imeAction = ImeAction.Done - ), - keyboardActions = KeyboardActions( - onDone = { } - ), - trailingIcon = { - IconButton(onClick = { viewModel.send(LoginIntent.UpdatePasswordVisible(!uiState.showPassword)) }) { - Icon( - if (uiState.showPassword) painterResource(R.drawable.visibility) - else painterResource(R.drawable.visibility_off), - "visible", - modifier = Modifier.padding(8.dp) - ) - } - }, - visualTransformation = if (uiState.showPassword) VisualTransformation.None else PasswordVisualTransformation() - ) - - OutlinedTextField( - value = uiState.scPassword, - singleLine = true, - modifier = Modifier - .fillMaxWidth() - .padding(top = 8.dp), - onValueChange = { viewModel.send(LoginIntent.UpdateSCAccount(it)) }, - label = { Text("二课密码") }, - placeholder = { Text("默认为123456,可不填") }, - keyboardOptions = KeyboardOptions.Default.copy( - imeAction = ImeAction.Done - ), - keyboardActions = KeyboardActions( - onDone = { } - ) - ) - Text( - stringResource(R.string.login_tips), - style = MaterialTheme.typography.labelSmall + val url = "http://ekt-cuit-edu-cn.webvpn.cuit.edu.cn:8118/api/mSsoLogin" + WebView( + Modifier.fillMaxSize().statusBarsPadding(), viewModel, url ) - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.End, - modifier = Modifier.fillMaxWidth() - ) { - DebouncedButton( - modifier = Modifier.padding(start = 8.dp), - enabled = !uiState.pending, - onClick = { - viewModel.send(LoginIntent.Login) - } + if (uiState.pending) { + val interactionSource = remember { MutableInteractionSource() } + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .fillMaxSize() + .background(with(MaterialTheme.colorScheme.background) { + Color(red, green, blue, 0.5f) + }) + // 拦截对WebView的点击 + .clickable(onClick = {}, interactionSource = interactionSource, indication = null) ) { - Text(if (uiState.pending) "Login..." else "Login") + CircularProgressIndicator( + modifier = Modifier.size(64.dp) + ) } } + if (uiState.showDialog) Dialog(message = uiState.message, viewModel = viewModel) } @Composable diff --git a/app/src/main/java/com/thryan/secondclass/ui/login/LoginIntent.kt b/app/src/main/java/com/thryan/secondclass/ui/login/LoginIntent.kt index e0fface..6dc7144 100644 --- a/app/src/main/java/com/thryan/secondclass/ui/login/LoginIntent.kt +++ b/app/src/main/java/com/thryan/secondclass/ui/login/LoginIntent.kt @@ -9,4 +9,6 @@ sealed class LoginIntent { data class UpdatePassword(val password: String) : LoginIntent() data class UpdateSCAccount(val scAccount: String) : LoginIntent() data class UpdatePasswordVisible(val visible: Boolean) : LoginIntent() + data class UpdatePending(val isPending: Boolean) : LoginIntent() + data class WebLogin(val twfid: String, val token: String) : LoginIntent() } \ No newline at end of file diff --git a/app/src/main/java/com/thryan/secondclass/ui/login/LoginViewModel.kt b/app/src/main/java/com/thryan/secondclass/ui/login/LoginViewModel.kt index 25de154..8ae788f 100644 --- a/app/src/main/java/com/thryan/secondclass/ui/login/LoginViewModel.kt +++ b/app/src/main/java/com/thryan/secondclass/ui/login/LoginViewModel.kt @@ -3,10 +3,12 @@ package com.thryan.secondclass.ui.login import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import cn.thriic.common.SecondClass import cn.thriic.common.WebVpn import cn.thriic.common.data.VpnInfo import com.thryan.secondclass.AppDataStore import com.thryan.secondclass.Navigator +import com.thryan.secondclass.SCRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -20,7 +22,8 @@ import javax.inject.Inject @HiltViewModel class LoginViewModel @Inject constructor( private val appDataStore: AppDataStore, - private val navigator: Navigator + private val navigator: Navigator, + private val scRepository: SCRepository ) : ViewModel() { private val _uiState = MutableStateFlow(LoginState("", "", "", false, "", false, false)) @@ -138,6 +141,23 @@ class LoginViewModel @Inject constructor( update(uiState.value.copy(showPassword = intent.visible)) } + is LoginIntent.UpdatePending -> { + update(uiState.value.copy(pending = intent.isPending)) + } + + is LoginIntent.WebLogin -> { + scRepository.secondClass = SecondClass(intent.twfid, intent.token) + appDataStore.putLastTime( + System.currentTimeMillis().toString() + ) + withContext(Dispatchers.Main) { + navigator.navigate("page?twfid=\"\"&account=\"\"&password=\"\"") { + popUpTo("login") { inclusive = true } + launchSingleTop = true + } + } + } + is LoginIntent.Init -> { update( uiState.value.copy( diff --git a/app/src/main/java/com/thryan/secondclass/ui/login/Webview.kt b/app/src/main/java/com/thryan/secondclass/ui/login/Webview.kt new file mode 100644 index 0000000..2903620 --- /dev/null +++ b/app/src/main/java/com/thryan/secondclass/ui/login/Webview.kt @@ -0,0 +1,133 @@ +package com.thryan.secondclass.ui.login + +import android.annotation.SuppressLint +import android.app.Activity +import android.util.Log +import android.view.ViewGroup +import android.webkit.* +import androidx.activity.compose.BackHandler +import androidx.compose.runtime.Composable +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.viewinterop.AndroidView +import com.thryan.secondclass.BuildConfig +import kotlinx.coroutines.launch +import java.util.regex.Pattern + +@SuppressLint("SetJavaScriptEnabled") +@Composable +fun WebView( + modifier: Modifier = Modifier, + viewModel: LoginViewModel, + targetUrl: String +) { + val activity = LocalContext.current as Activity + lateinit var webView: WebView + val jwcPattern = Pattern.compile(".*\\.cuit\\.edu\\.cn[^/]*/authserver/.*") + val webViewChromeClient = object : WebChromeClient() { + override fun onProgressChanged(view: WebView, newProgress: Int) { + if (newProgress < 100) { + viewModel.send(LoginIntent.UpdatePending(true)) + } else { + viewModel.send(LoginIntent.UpdatePending(false)) + } + super.onProgressChanged(view, newProgress) + } + } + val webViewClient = object : WebViewClient() { + var twfid: String = "" + var token: String = "" + override fun shouldInterceptRequest(view: WebView, request: WebResourceRequest): WebResourceResponse? { + val url = request.url + val host = url.host!! + val path = url.path!! +// Log.d("webview", path) + + //由于Cloudflare在璃月访问慢且Android WebView缓存大小限制为20MB,因此手动替换为本地资源 + if (path.contains("cuit/captcha")) { + val filename = path.split("/").last() + val inputStream = activity.assets.open(filename) + val mimeType = if (filename.contains(".js")) { + "application/javascript" + } else { + "application/wasm" + } + val response = WebResourceResponse(mimeType, "UTF-8", inputStream) + val headers = HashMap() + headers["Access-Control-Allow-Origin"] = "*" + headers["Cache-Control"]="no-cache, no-store" + response.responseHeaders = headers + return response + } else if (host.contains("ekty-cuit-edu-cn")) { + val cookie = CookieManager.getInstance().getCookie(url.toString()) + Log.d("webLogin", "cookie $cookie") + if (cookie != null) { + twfid = cookie.split("TWFID=")[1] + } + } else if (host.contains("ekt-cuit-edu-cn")) { + val authorization = request.requestHeaders["Authorization"] + Log.d("webLogin", "auth $authorization") + if (authorization != null) { + token = authorization.split(" ")[1] + } + } + + if (twfid != "" && token != "") { + viewModel.send(LoginIntent.WebLogin(twfid, token)) + } + return null + } + + override fun onPageFinished(view: WebView, url: String) { + Log.d("webview", url) + if (url == "https://webvpn.cuit.edu.cn/portal/#!/service") { + Log.d("webview", "service") + view.loadUrl(targetUrl) + } else if (jwcPattern.matcher(url).matches() or (url == "https://webvpn.cuit.edu.cn/portal/#!/login")) { + //如果是登录页面则注入填写验证码的js脚本 + Log.d("webview", "inject script") + view.loadUrl("javascript:(()=>{window.resourcePath=\"https://static.wed0n.top/cuit/captcha/\";const script=document.createElement(\"script\");script.src=resourcePath+\"script.js\";script.type=\"module\";document.body.appendChild(script);})()") + } + } + } + + val coroutineScope = rememberCoroutineScope() + AndroidView(modifier = modifier, factory = { context -> + WebView(context).apply { + layoutParams = ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + ) + + WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG) + this.webChromeClient = webViewChromeClient + this.webViewClient = webViewClient + settings.apply { + //支持js交互 + javaScriptEnabled = true + javaScriptCanOpenWindowsAutomatically = true + domStorageEnabled = true + //将图片调整到适合webView的大小 + useWideViewPort = true + //缩放至屏幕的大小 + loadWithOverviewMode = true + //启用缩放功能 + setSupportZoom(true) + builtInZoomControls = true + displayZoomControls = false + } + webView = this + loadUrl(targetUrl) + } + }) + BackHandler { + coroutineScope.launch { + if (webView.canGoBack()) { + webView.goBack() + } else { + activity.finish() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/thryan/secondclass/ui/page/PageViewModel.kt b/app/src/main/java/com/thryan/secondclass/ui/page/PageViewModel.kt index b0bfbf7..52cc905 100644 --- a/app/src/main/java/com/thryan/secondclass/ui/page/PageViewModel.kt +++ b/app/src/main/java/com/thryan/secondclass/ui/page/PageViewModel.kt @@ -54,7 +54,7 @@ class PageViewModel @Inject constructor( init { Log.i(TAG, "PageViewModel Created") - scRepository.init(twfid, account, password) +// scRepository.init(twfid, account, password) send(PageIntent.Init) viewModelScope.launch { scRepository.activities.collect { @@ -155,8 +155,8 @@ class PageViewModel @Inject constructor( private suspend fun login() = withContext(Dispatchers.IO) { try { update(PageActions.Loading("登录中").reduce(pageState.value)) - val loginResult = scRepository.login() - Log.i(TAG, "login secondclass $loginResult") +// val loginResult = scRepository.login() +// Log.i(TAG, "login secondclass $loginResult") update(PageActions.Loading("获取活动信息").reduce(pageState.value)) val activityJob = launch { this@PageViewModel.getActivities() } activityJob.join() diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a595206 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists