@webex/ladon-ts 5.4.3 → 5.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/build/module/lib/pipeline.js +19 -19
- package/build/module/lib/pipeline.js.map +1 -1
- package/build/module/lib/version.d.ts +1 -1
- package/build/module/lib/version.js +1 -1
- package/build/module/lib/version.js.map +1 -1
- package/build/worker/segmentation.js +29 -29
- package/build/worker/segmentation.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cisco Ladon-TS
|
|
3
3
|
* Copyright (c) Cisco Systems, Inc. All rights reserved.
|
|
4
|
-
* Build timestamp: March
|
|
4
|
+
* Build timestamp: March 27, 2025 at 10:35:06 PM UTC
|
|
5
5
|
*/
|
|
6
6
|
(function(){"use strict";var _documentCurrentScript=typeof document<"u"?document.currentScript:null;self.document={baseURI:location.origin};const originalConsoleLog=console.log,originalConsoleWarn=console.warn,originalConsoleError=console.error;console.log=(...t)=>{postMessage({type:"log",message:t.join(" "),severity:"log"}),originalConsoleLog(...t)},console.warn=(...t)=>{postMessage({type:"log",message:t.join(" "),severity:"warn"}),originalConsoleWarn(...t)},console.error=(...t)=>{postMessage({type:"log",message:t.join(" "),severity:"error"}),originalConsoleError(...t)};/*!
|
|
7
7
|
* ONNX Runtime Web v1.20.1
|
|
8
8
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
9
|
* Licensed under the MIT License.
|
|
10
|
-
*/var Hd=Object.create,an=Object.defineProperty,qd=Object.getOwnPropertyDescriptor,jd=Object.getOwnPropertyNames,Xd=Object.getPrototypeOf,Kd=Object.prototype.hasOwnProperty,Co=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(r,o)=>(typeof require<"u"?require:r)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),O=(t,r)=>()=>(t&&(r=t(t=0)),r),mt=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),Or=(t,r)=>{for(var o in r)an(t,o,{get:r[o],enumerable:!0})},Qa=(t,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of jd(r))!Kd.call(t,u)&&u!==o&&an(t,u,{get:()=>r[u],enumerable:!(i=qd(r,u))||i.enumerable});return t},rr=(t,r,o)=>(o=t!=null?Hd(Xd(t)):{},Qa(!t||!t.__esModule?an(o,"default",{value:t,enumerable:!0}):o,t)),sn=t=>Qa(an({},"__esModule",{value:!0}),t),un,ke,nr,Jd,ln,fn=O(()=>{un=new Map,ke=[],nr=(t,r,o)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let i=un.get(t);if(i===void 0)un.set(t,{backend:r,priority:o});else{if(i.priority>o)return;if(i.priority===o&&i.backend!==r)throw new Error(`cannot register backend "${t}" using priority ${o}`)}if(o>=0){let u=ke.indexOf(t);u!==-1&&ke.splice(u,1);for(let n=0;n<ke.length;n++)if(un.get(ke[n]).priority<=o){ke.splice(n,0,t);return}ke.push(t)}return}throw new TypeError("not a valid backend")},Jd=async t=>{let r=un.get(t);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let o=!!r.initPromise;try{return o||(r.initPromise=r.backend.init(t)),await r.initPromise,r.initialized=!0,r.backend}catch(i){return o||(r.error=`${i}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},ln=async t=>{let r=t.executionProviders||[],o=r.map(c=>typeof c=="string"?c:c.name),i=o.length===0?ke:o,u,n=[],a=new Set;for(let c of i){let e=await Jd(c);typeof e=="string"?n.push({name:c,err:e}):(u||(u=e),u===e&&a.add(c))}if(!u)throw new Error(`no available backend found. ERR: ${n.map(c=>`[${c.name}] ${c.err}`).join(", ")}`);for(let{name:c,err:e}of n)o.includes(c)&&console.warn(`removing requested execution provider "${c}" from session options because it is not available: ${e}`);let d=r.filter(c=>a.has(typeof c=="string"?c:c.name));return[u,new Proxy(t,{get:(c,e)=>e==="executionProviders"?d:Reflect.get(c,e)})]}}),ts=O(()=>{fn()}),es,rs=O(()=>{es="1.20.1"}),ns,Gt,No=O(()=>{rs(),ns="warning",Gt={wasm:{},webgl:{},webgpu:{},versions:{common:es},set logLevel(t){if(t!==void 0){if(typeof t!="string"||["verbose","info","warning","error","fatal"].indexOf(t)===-1)throw new Error(`Unsupported logging level: ${t}`);ns=t}},get logLevel(){return ns}},Object.defineProperty(Gt,"logLevel",{enumerable:!0})}),z,os=O(()=>{No(),z=Gt}),is,as,ss=O(()=>{is=(t,r)=>{let o=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);o.width=t.dims[3],o.height=t.dims[2];let i=o.getContext("2d");if(i!=null){let u,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(u=t.dims[2],n=t.dims[3]):(u=t.dims[3],n=t.dims[2]);let a=(r==null?void 0:r.format)!==void 0?r.format:"RGB",d=r==null?void 0:r.norm,c,e;d===void 0||d.mean===void 0?c=[255,255,255,255]:typeof d.mean=="number"?c=[d.mean,d.mean,d.mean,d.mean]:(c=[d.mean[0],d.mean[1],d.mean[2],0],d.mean[3]!==void 0&&(c[3]=d.mean[3])),d===void 0||d.bias===void 0?e=[0,0,0,0]:typeof d.bias=="number"?e=[d.bias,d.bias,d.bias,d.bias]:(e=[d.bias[0],d.bias[1],d.bias[2],0],d.bias[3]!==void 0&&(e[3]=d.bias[3]));let l=n*u,s=0,h=l,f=l*2,m=-1;a==="RGBA"?(s=0,h=l,f=l*2,m=l*3):a==="RGB"?(s=0,h=l,f=l*2):a==="RBG"&&(s=0,f=l,h=l*2);for(let v=0;v<n;v++)for(let _=0;_<u;_++){let I=(t.data[s++]-e[0])*c[0],T=(t.data[h++]-e[1])*c[1],P=(t.data[f++]-e[2])*c[2],C=m===-1?255:(t.data[m++]-e[3])*c[3];i.fillStyle="rgba("+I+","+T+","+P+","+C+")",i.fillRect(_,v,1,1)}if("toDataURL"in o)return o.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},as=(t,r)=>{let o=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),i;if(o!=null){let u,n,a;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(u=t.dims[2],n=t.dims[1],a=t.dims[3]):(u=t.dims[3],n=t.dims[2],a=t.dims[1]);let d=r!==void 0&&r.format!==void 0?r.format:"RGB",c=r==null?void 0:r.norm,e,l;c===void 0||c.mean===void 0?e=[255,255,255,255]:typeof c.mean=="number"?e=[c.mean,c.mean,c.mean,c.mean]:(e=[c.mean[0],c.mean[1],c.mean[2],255],c.mean[3]!==void 0&&(e[3]=c.mean[3])),c===void 0||c.bias===void 0?l=[0,0,0,0]:typeof c.bias=="number"?l=[c.bias,c.bias,c.bias,c.bias]:(l=[c.bias[0],c.bias[1],c.bias[2],0],c.bias[3]!==void 0&&(l[3]=c.bias[3]));let s=n*u;if(r!==void 0&&(r.format!==void 0&&a===4&&r.format!=="RGBA"||a===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let h=4,f=0,m=1,v=2,_=3,I=0,T=s,P=s*2,C=-1;d==="RGBA"?(I=0,T=s,P=s*2,C=s*3):d==="RGB"?(I=0,T=s,P=s*2):d==="RBG"&&(I=0,P=s,T=s*2),i=o.createImageData(u,n);for(let V=0;V<n*u;f+=h,m+=h,v+=h,_+=h,V++)i.data[f]=(t.data[I++]-l[0])*e[0],i.data[m]=(t.data[T++]-l[1])*e[1],i.data[v]=(t.data[P++]-l[2])*e[2],i.data[_]=C===-1?255:(t.data[C++]-l[3])*e[3]}else throw new Error("Can not access image data");return i}}),Ro,us,ls,fs,cs,ps,ds=O(()=>{cn(),Ro=(t,r)=>{if(t===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:o,width:i}=r,u=r.norm??{mean:255,bias:0},n,a;typeof u.mean=="number"?n=[u.mean,u.mean,u.mean,u.mean]:n=[u.mean[0],u.mean[1],u.mean[2],u.mean[3]??255],typeof u.bias=="number"?a=[u.bias,u.bias,u.bias,u.bias]:a=[u.bias[0],u.bias[1],u.bias[2],u.bias[3]??0];let d=r.format!==void 0?r.format:"RGBA",c=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",e=o*i,l=c==="RGBA"?new Float32Array(e*4):new Float32Array(e*3),s=4,h=0,f=1,m=2,v=3,_=0,I=e,T=e*2,P=-1;d==="RGB"&&(s=3,h=0,f=1,m=2,v=-1),c==="RGBA"?P=e*3:c==="RBG"?(_=0,T=e,I=e*2):c==="BGR"&&(T=0,I=e,_=e*2);for(let C=0;C<e;C++,h+=s,m+=s,f+=s,v+=s)l[_++]=(t[h]+a[0])/n[0],l[I++]=(t[f]+a[1])/n[1],l[T++]=(t[m]+a[2])/n[2],P!==-1&&v!==-1&&(l[P++]=(t[v]+a[3])/n[3]);return c==="RGBA"?new St("float32",l,[1,4,o,i]):new St("float32",l,[1,3,o,i])},us=async(t,r)=>{let o=typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement,i=typeof ImageData<"u"&&t instanceof ImageData,u=typeof ImageBitmap<"u"&&t instanceof ImageBitmap,n=typeof t=="string",a,d=r??{},c=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},e=l=>typeof HTMLCanvasElement<"u"&&l instanceof HTMLCanvasElement||l instanceof OffscreenCanvas?l.getContext("2d"):null;if(o){let l=c();l.width=t.width,l.height=t.height;let s=e(l);if(s!=null){let h=t.height,f=t.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(h=r.resizedHeight,f=r.resizedWidth),r!==void 0){if(d=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");d.tensorFormat="RGBA",d.height=h,d.width=f}else d.tensorFormat="RGBA",d.height=h,d.width=f;s.drawImage(t,0,0),a=s.getImageData(0,0,f,h).data}else throw new Error("Can not access image data")}else if(i){let l,s;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(l=r.resizedHeight,s=r.resizedWidth):(l=t.height,s=t.width),r!==void 0&&(d=r),d.format="RGBA",d.height=l,d.width=s,r!==void 0){let h=c();h.width=s,h.height=l;let f=e(h);if(f!=null)f.putImageData(t,0,0),a=f.getImageData(0,0,s,l).data;else throw new Error("Can not access image data")}else a=t.data}else if(u){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let l=c();l.width=t.width,l.height=t.height;let s=e(l);if(s!=null){let h=t.height,f=t.width;return s.drawImage(t,0,0,f,h),a=s.getImageData(0,0,f,h).data,d.height=h,d.width=f,Ro(a,d)}else throw new Error("Can not access image data")}else{if(n)return new Promise((l,s)=>{let h=c(),f=e(h);if(!t||!f)return s();let m=new Image;m.crossOrigin="Anonymous",m.src=t,m.onload=()=>{h.width=m.width,h.height=m.height,f.drawImage(m,0,0,h.width,h.height);let v=f.getImageData(0,0,h.width,h.height);d.height=h.height,d.width=h.width,l(Ro(v.data,d))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(a!==void 0)return Ro(a,d);throw new Error("Input data provided is not supported - aborted tensor creation")},ls=(t,r)=>{let{width:o,height:i,download:u,dispose:n}=r,a=[1,i,o,4];return new St({location:"texture",type:"float32",texture:t,dims:a,download:u,dispose:n})},fs=(t,r)=>{let{dataType:o,dims:i,download:u,dispose:n}=r;return new St({location:"gpu-buffer",type:o??"float32",gpuBuffer:t,dims:i,download:u,dispose:n})},cs=(t,r)=>{let{dataType:o,dims:i,download:u,dispose:n}=r;return new St({location:"ml-tensor",type:o??"float32",mlTensor:t,dims:i,download:u,dispose:n})},ps=(t,r,o)=>new St({location:"cpu-pinned",type:t,data:r,dims:o??[r.length]})}),Be,Sr,hs,ms,bs=O(()=>{Be=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Sr=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),hs=!1,ms=()=>{if(!hs){hs=!0;let t=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,o=typeof Float16Array<"u"&&Float16Array.from;t&&(Be.set("int64",BigInt64Array),Sr.set(BigInt64Array,"int64")),r&&(Be.set("uint64",BigUint64Array),Sr.set(BigUint64Array,"uint64")),o?(Be.set("float16",Float16Array),Sr.set(Float16Array,"float16")):Be.set("float16",Uint16Array)}}}),gs,ys,xs=O(()=>{cn(),gs=t=>{let r=1;for(let o=0;o<t.length;o++){let i=t[o];if(typeof i!="number"||!Number.isSafeInteger(i))throw new TypeError(`dims[${o}] must be an integer, got: ${i}`);if(i<0)throw new RangeError(`dims[${o}] must be a non-negative integer, got: ${i}`);r*=i}return r},ys=(t,r)=>{switch(t.location){case"cpu":return new St(t.type,t.data,r);case"cpu-pinned":return new St({location:"cpu-pinned",data:t.data,type:t.type,dims:r});case"texture":return new St({location:"texture",texture:t.texture,type:t.type,dims:r});case"gpu-buffer":return new St({location:"gpu-buffer",gpuBuffer:t.gpuBuffer,type:t.type,dims:r});case"ml-tensor":return new St({location:"ml-tensor",mlTensor:t.mlTensor,type:t.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${t.location} is not supported`)}}}),St,cn=O(()=>{ss(),ds(),bs(),xs(),St=class{constructor(t,r,o){ms();let i,u;if(typeof t=="object"&&"location"in t)switch(this.dataLocation=t.location,i=t.type,u=t.dims,t.location){case"cpu-pinned":{let a=Be.get(i);if(!a)throw new TypeError(`unsupported type "${i}" to create tensor from pinned buffer`);if(!(t.data instanceof a))throw new TypeError(`buffer should be of type ${a.name}`);this.cpuData=t.data;break}case"texture":{if(i!=="float32")throw new TypeError(`unsupported type "${i}" to create tensor from texture`);this.gpuTextureData=t.texture,this.downloader=t.download,this.disposer=t.dispose;break}case"gpu-buffer":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from gpu buffer`);this.gpuBufferData=t.gpuBuffer,this.downloader=t.download,this.disposer=t.dispose;break}case"ml-tensor":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint64"&&i!=="int8"&&i!=="uint8"&&i!=="bool")throw new TypeError(`unsupported type "${i}" to create tensor from MLTensor`);this.mlTensorData=t.mlTensor,this.downloader=t.download,this.disposer=t.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,d;if(typeof t=="string")if(i=t,d=o,t==="string"){if(!Array.isArray(r))throw new TypeError("A string tensor's data must be a string array.");a=r}else{let c=Be.get(t);if(c===void 0)throw new TypeError(`Unsupported tensor type: ${t}.`);if(Array.isArray(r)){if(t==="float16"&&c===Uint16Array||t==="uint4"||t==="int4")throw new TypeError(`Creating a ${t} tensor from number array is not supported. Please use ${c.name} as data.`);t==="uint64"||t==="int64"?a=c.from(r,BigInt):a=c.from(r)}else if(r instanceof c)a=r;else if(r instanceof Uint8ClampedArray)if(t==="uint8")a=Uint8Array.from(r);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else throw new TypeError(`A ${i} tensor's data must be type of ${c}`)}else if(d=r,Array.isArray(t)){if(t.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let c=typeof t[0];if(c==="string")i="string",a=t;else if(c==="boolean")i="bool",a=Uint8Array.from(t);else throw new TypeError(`Invalid element type of data array: ${c}.`)}else if(t instanceof Uint8ClampedArray)i="uint8",a=Uint8Array.from(t);else{let c=Sr.get(t.constructor);if(c===void 0)throw new TypeError(`Unsupported type for tensor data: ${t.constructor}.`);i=c,a=t}if(d===void 0)d=[a.length];else if(!Array.isArray(d))throw new TypeError("A tensor's dims must be a number array");u=d,this.cpuData=a,this.dataLocation="cpu"}let n=gs(u);if(this.cpuData&&n!==this.cpuData.length&&!((i==="uint4"||i==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=i,this.dims=u,this.size=n}static async fromImage(t,r){return us(t,r)}static fromTexture(t,r){return ls(t,r)}static fromGpuBuffer(t,r){return fs(t,r)}static fromMLTensor(t,r){return cs(t,r)}static fromPinnedBuffer(t,r,o){return ps(t,r,o)}toDataURL(t){return is(this,t)}toImageData(t){return as(this,t)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(t){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let r=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=r,t&&this.disposer&&(this.disposer(),this.disposer=void 0),r}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(t){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return ys(this,t)}}}),yt,pn=O(()=>{cn(),yt=St}),Ts,ws,Fe,Ce,Go=O(()=>{No(),Ts=(t,r)=>{(typeof Gt.trace>"u"?!Gt.wasm.trace:!Gt.trace)||console.timeStamp(`${t}::ORT::${r}`)},ws=(t,r)=>{var u;let o=((u=new Error().stack)==null?void 0:u.split(/\r\n|\r|\n/g))||[],i=!1;for(let n=0;n<o.length;n++){if(i&&!o[n].includes("TRACE_FUNC")){let a=`FUNC_${t}::${o[n].trim().split(" ")[1]}`;r&&(a+=`::${r}`),Ts("CPU",a);return}o[n].includes("TRACE_FUNC")&&(i=!0)}},Fe=t=>{(typeof Gt.trace>"u"?!Gt.wasm.trace:!Gt.trace)||ws("BEGIN",t)},Ce=t=>{(typeof Gt.trace>"u"?!Gt.wasm.trace:!Gt.trace)||ws("END",t)}}),dn,vs=O(()=>{fn(),pn(),Go(),dn=class Sa{constructor(r){this.handler=r}async run(r,o,i){Fe();let u={},n={};if(typeof r!="object"||r===null||r instanceof yt||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let a=!0;if(typeof o=="object"){if(o===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(o instanceof yt)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(o)){if(o.length===0)throw new TypeError("'fetches' cannot be an empty array.");a=!1;for(let e of o){if(typeof e!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(e)===-1)throw new RangeError(`'fetches' contains invalid output name: ${e}.`);u[e]=null}if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else{let e=!1,l=Object.getOwnPropertyNames(o);for(let s of this.outputNames)if(l.indexOf(s)!==-1){let h=o[s];(h===null||h instanceof yt)&&(e=!0,a=!1,u[s]=h)}if(e){if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else n=o}}else if(typeof o<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let e of this.inputNames)if(typeof r[e]>"u")throw new Error(`input '${e}' is missing in 'feeds'.`);if(a)for(let e of this.outputNames)u[e]=null;let d=await this.handler.run(r,u,n),c={};for(let e in d)if(Object.hasOwnProperty.call(d,e)){let l=d[e];l instanceof yt?c[e]=l:c[e]=new yt(l.type,l.data,l.dims)}return Ce(),c}async release(){return this.handler.dispose()}static async create(r,o,i,u){Fe();let n,a={};if(typeof r=="string"){if(n=r,typeof o=="object"&&o!==null)a=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof o=="object"&&o!==null)a=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let l=r,s=0,h=r.byteLength;if(typeof o=="object"&&o!==null)a=o;else if(typeof o=="number"){if(s=o,!Number.isSafeInteger(s))throw new RangeError("'byteOffset' must be an integer.");if(s<0||s>=l.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${l.byteLength}).`);if(h=r.byteLength-s,typeof i=="number"){if(h=i,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||s+h>l.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${l.byteLength-s}].`);if(typeof u=="object"&&u!==null)a=u;else if(typeof u<"u")throw new TypeError("'options' must be an object.")}else if(typeof i<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof o<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(l,s,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[d,c]=await ln(a),e=await d.createInferenceSessionHandler(n,c);return Ce(),new Sa(e)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}}),Yd,Is=O(()=>{vs(),Yd=dn}),_s=O(()=>{}),Os=O(()=>{}),Ss=O(()=>{}),As=O(()=>{}),Zd,hn,Ps=O(()=>{fn(),pn(),Zd="Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.",hn=class Ea{constructor(r,o,i){this.handler=r,this.hasOptimizerModel=o,this.hasEvalModel=i}get trainingInputNames(){return this.handler.inputNames}get trainingOutputNames(){return this.handler.outputNames}get evalInputNames(){if(this.hasEvalModel)return this.handler.evalInputNames;throw new Error("This training session has no evalModel loaded.")}get evalOutputNames(){if(this.hasEvalModel)return this.handler.evalOutputNames;throw new Error("This training session has no evalModel loaded.")}static async create(r,o){let i=r.evalModel||"",u=r.optimizerModel||"",n=o||{},[a,d]=await ln(n);if(a.createTrainingSessionHandler){let c=await a.createTrainingSessionHandler(r.checkpointState,r.trainModel,i,u,d);return new Ea(c,!!r.optimizerModel,!!r.evalModel)}else throw new Error(Zd)}typeNarrowingForRunStep(r,o,i,u,n){let a={},d={};if(typeof i!="object"||i===null||i instanceof yt||Array.isArray(i))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let c=!0;if(typeof u=="object"){if(u===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(u instanceof yt)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(u)){if(u.length===0)throw new TypeError("'fetches' cannot be an empty array.");c=!1;for(let e of u){if(typeof e!="string")throw new TypeError("'fetches' must be a string array or an object.");if(o.indexOf(e)===-1)throw new RangeError(`'fetches' contains invalid output name: ${e}.`);a[e]=null}if(typeof n=="object"&&n!==null)d=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else{let e=!1,l=Object.getOwnPropertyNames(u);for(let s of o)if(l.indexOf(s)!==-1){let h=u[s];(h===null||h instanceof yt)&&(e=!0,c=!1,a[s]=h)}if(e){if(typeof n=="object"&&n!==null)d=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else d=u}}else if(typeof u<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let e of r)if(typeof i[e]>"u")throw new Error(`input '${e}' is missing in 'feeds'.`);if(c)for(let e of o)a[e]=null;return[a,d]}convertHandlerReturnTypeToMapOfTensors(r){let o={};for(let i in r)if(Object.hasOwnProperty.call(r,i)){let u=r[i];u instanceof yt?o[i]=u:o[i]=new yt(u.type,u.data,u.dims)}return o}async lazyResetGrad(){await this.handler.lazyResetGrad()}async runTrainStep(r,o,i){let[u,n]=this.typeNarrowingForRunStep(this.trainingInputNames,this.trainingOutputNames,r,o,i),a=await this.handler.runTrainStep(r,u,n);return this.convertHandlerReturnTypeToMapOfTensors(a)}async runOptimizerStep(r){if(this.hasOptimizerModel)await this.handler.runOptimizerStep(r||{});else throw new Error("This TrainingSession has no OptimizerModel loaded.")}async runEvalStep(r,o,i){if(this.hasEvalModel){let[u,n]=this.typeNarrowingForRunStep(this.evalInputNames,this.evalOutputNames,r,o,i),a=await this.handler.runEvalStep(r,u,n);return this.convertHandlerReturnTypeToMapOfTensors(a)}else throw new Error("This TrainingSession has no EvalModel loaded.")}async getParametersSize(r=!0){return this.handler.getParametersSize(r)}async loadParametersBuffer(r,o=!0){let i=await this.getParametersSize(o);if(r.length!==4*i)throw new Error("Size of the buffer passed into loadParametersBuffer must match the number of parameters in the model. Please use getParametersSize method to check.");return this.handler.loadParametersBuffer(r,o)}async getContiguousParameters(r=!0){return this.handler.getContiguousParameters(r)}async release(){return this.handler.dispose()}}}),Qd,Es=O(()=>{Ps(),Qd=hn}),Mo={};Or(Mo,{InferenceSession:()=>Yd,TRACE:()=>Ts,TRACE_FUNC_BEGIN:()=>Fe,TRACE_FUNC_END:()=>Ce,Tensor:()=>yt,TrainingSession:()=>Qd,env:()=>z,registerBackend:()=>nr});var Yt=O(()=>{ts(),os(),Is(),pn(),_s(),Os(),Go(),Ss(),As(),Es()});function _e(t,r,o,i){if(r===void 0)return eh(t);if(o===void 0)mn(t,r);else if(typeof o=="number"&&i===void 0)mn(t,r);else if(typeof o=="string"&&i===void 0)mn(t,o,1,r);else if(typeof o=="string"&&typeof i=="number")mn(t,o,i,r);else throw new TypeError("input is valid")}function eh(t){return{verbose:_e.verbose.bind(null,t),info:_e.info.bind(null,t),warning:_e.warning.bind(null,t),error:_e.error.bind(null,t),fatal:_e.fatal.bind(null,t)}}function mn(t,r,o,i){let u=Ar[i||""]||Ar[""];Ls[t]<Ls[u.minimalSeverity]||(u.logDateTime&&(r=`${new Date().toISOString()}|${r}`),u.logSourceLocation,th[u.provider].log(t,r,i))}var Uo,Vo,Ls,th,$s,Ar,tt,gn,yn,xn,bn,Ut=O(()=>{Uo=class{log(t,r,o){}},Vo=class{log(t,r,o){console.log(`${this.color(t)} ${o?"\x1B[35m"+o+"\x1B[0m ":""}${r}`)}color(t){switch(t){case"verbose":return"\x1B[34;40mv\x1B[0m";case"info":return"\x1B[32mi\x1B[0m";case"warning":return"\x1B[30;43mw\x1B[0m";case"error":return"\x1B[31;40me\x1B[0m";case"fatal":return"\x1B[101mf\x1B[0m";default:throw new Error(`unsupported severity: ${t}`)}}},Ls={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},th={none:new Uo,console:new Vo},$s={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1},Ar={"":$s},(t=>{function r(e,l){t("verbose",e,l)}t.verbose=r;function o(e,l){t("info",e,l)}t.info=o;function i(e,l){t("warning",e,l)}t.warning=i;function u(e,l){t("error",e,l)}t.error=u;function n(e,l){t("fatal",e,l)}t.fatal=n;function a(e){Ar={},d("",e||{})}t.reset=a;function d(e,l){if(e==="*")a(l);else{let s=Ar[e]||$s;Ar[e]={provider:l.provider||s.provider,minimalSeverity:l.minimalSeverity||s.minimalSeverity,logDateTime:l.logDateTime===void 0?s.logDateTime:l.logDateTime,logSourceLocation:l.logSourceLocation===void 0?s.logSourceLocation:l.logSourceLocation}}}t.set=d;function c(e){let l={};e.logLevel&&(l.minimalSeverity=e.logLevel),d("",l)}t.setWithEnv=c})(_e||(_e={})),tt=_e,gn=class{constructor(t,r,o,i,u,n){this.category=t,this.name=r,this.startTime=o,this.endCallback=i,this.timer=u,this.ctx=n}async end(){return this.endCallback(this)}async checkTimer(){if(this.ctx===void 0||this.timer===void 0)throw new Error("No webgl timer found");return this.ctx.endTimer(),this.ctx.waitForQueryAndGetTime(this.timer)}},yn=class{constructor(t,r,o,i){this.category=t,this.name=r,this.startTime=o,this.endTime=i}},xn=class{constructor(t,r,o){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=t===void 0?1e4:t,this._flushBatchSize=r===void 0?10:r,this._flushIntervalInMilliseconds=o===void 0?5e3:o}static create(t){return t===void 0?new this:new this(t.maxNumberEvents,t.flushBatchSize,t.flushIntervalInMilliseconds)}start(){this._started=!0,this._timingEvents=[],this._flushTime=bn(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer])}event(t,r,o,i){let u=this._started?this.begin(t,r,i):void 0,n=!1,a=o();if(a&&typeof a.then=="function")return n=!0,new Promise((d,c)=>{a.then(async e=>{u&&await u.end(),d(e)},async e=>{u&&await u.end(),c(e)})});if(!n&&u){let d=u.end();if(d&&typeof d.then=="function")return new Promise((c,e)=>{d.then(()=>{c(a)},l=>{e(l)})})}return a}begin(t,r,o){if(!this._started)throw new Error("profiler is not started yet");if(o===void 0){let i=bn();return this.flush(i),new gn(t,r,i,u=>this.endSync(u))}else{let i=o.beginTimer();return new gn(t,r,0,async u=>this.end(u),i,o)}}async end(t){let r=await t.checkTimer();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new yn(t.category,t.name,t.startTime,r)),this.flush(r))}endSync(t){let r=bn();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new yn(t.category,t.name,t.startTime,r)),this.flush(r))}logOneEvent(t){tt.verbose(`Profiler.${t.category}`,`${(t.endTime-t.startTime).toFixed(2)}ms on event '${t.name}' at ${t.endTime.toFixed(2)}`)}flush(t){if(this._timingEvents.length-this._flushPointer>=this._flushBatchSize||t-this._flushTime>=this._flushIntervalInMilliseconds){for(let r=this._flushPointer;this._flushPointer<r+this._flushBatchSize&&this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer]);this._flushTime=bn()}}get started(){return this._started}},bn=typeof performance<"u"&&performance.now?()=>performance.now():Date.now});function ks(t,r,o){for(let i of o){let u=i[0],n=i[1],a=i[2],d=i[3],c=i[4];if(t.opType===u){for(let e of r)if((e.domain===n||e.domain==="ai.onnx"&&n==="")&&rh(e.version,a))return{opImpl:d,opInit:c}}}throw new TypeError(`cannot resolve operator '${t.opType}' with opsets: ${r.map(i=>`${i.domain||"ai.onnx"} v${i.version}`).join(", ")}`)}function rh(t,r){if(r.endsWith("+")){let o=Number.parseInt(r.substring(0,r.length-1),10);return!isNaN(o)&&o<=t}else if(r.split("-").length===2){let o=r.split("-"),i=Number.parseInt(o[0],10),u=Number.parseInt(o[1],10);return!isNaN(i)&&!isNaN(u)&&i<=t&&t<=u}else return Number.parseInt(r,10)===t}var Bs=O(()=>{}),Fs=mt(t=>{t.__esModule=!0;var r=function(){function o(i){if(!i)throw new TypeError("Invalid argument; `value` has no value.");this.value=o.EMPTY,i&&o.isGuid(i)&&(this.value=i)}return o.isGuid=function(i){var u=i.toString();return i&&(i instanceof o||o.validator.test(u))},o.create=function(){return new o([o.gen(2),o.gen(1),o.gen(1),o.gen(1),o.gen(3)].join("-"))},o.createEmpty=function(){return new o("emptyguid")},o.parse=function(i){return new o(i)},o.raw=function(){return[o.gen(2),o.gen(1),o.gen(1),o.gen(1),o.gen(3)].join("-")},o.gen=function(i){for(var u="",n=0;n<i;n++)u+=((1+Math.random())*65536|0).toString(16).substring(1);return u},o.prototype.equals=function(i){return o.isGuid(i)&&this.value===i.toString()},o.prototype.isEmpty=function(){return this.value===o.EMPTY},o.prototype.toString=function(){return this.value},o.prototype.toJSON=function(){return{value:this.value}},o.validator=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i"),o.EMPTY="00000000-0000-0000-0000-000000000000",o}();t.Guid=r});function rt(t,r,o){this.low=t|0,this.high=r|0,this.unsigned=!!o}function Et(t){return(t&&t.__isLong__)===!0}function Cs(t){var r=Math.clz32(t&-t);return t?31-r:r}function Ne(t,r){var o,i,u;return r?(t>>>=0,(u=0<=t&&t<256)&&(i=Rs[t],i)?i:(o=J(t,0,!0),u&&(Rs[t]=o),o)):(t|=0,(u=-128<=t&&t<128)&&(i=Ns[t],i)?i:(o=J(t,t<0?-1:0,!1),u&&(Ns[t]=o),o))}function zt(t,r){if(isNaN(t))return r?ye:Zt;if(r){if(t<0)return ye;if(t>=Vs)return Hs}else{if(t<=-Ms)return Ct;if(t+1>=Ms)return Ws}return t<0?zt(-t,r).neg():J(t%ir|0,t/ir|0,r)}function J(t,r,o){return new rt(t,r,o)}function Ho(t,r,o){if(t.length===0)throw Error("empty string");if(typeof r=="number"?(o=r,r=!1):r=!!r,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return r?ye:Zt;if(o=o||10,o<2||36<o)throw RangeError("radix");var i;if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return Ho(t.substring(1),r,o).neg();for(var u=zt(Tn(o,8)),n=Zt,a=0;a<t.length;a+=8){var d=Math.min(8,t.length-a),c=parseInt(t.substring(a,a+d),o);if(d<8){var e=zt(Tn(o,d));n=n.mul(e).add(zt(c))}else n=n.mul(u),n=n.add(zt(c))}return n.unsigned=r,n}function Qt(t,r){return typeof t=="number"?zt(t,r):typeof t=="string"?Ho(t,r):J(t.low,t.high,typeof r=="boolean"?r:t.unsigned)}var Vt,Ns,Rs,Tn,Gs,oh,ir,Vs,Ms,Us,Zt,ye,or,zs,Wo,Ws,Hs,Ct,D,xe,qo=O(()=>{Vt=null;try{Vt=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{}rt.prototype.__isLong__,Object.defineProperty(rt.prototype,"__isLong__",{value:!0}),rt.isLong=Et,Ns={},Rs={},rt.fromInt=Ne,rt.fromNumber=zt,rt.fromBits=J,Tn=Math.pow,rt.fromString=Ho,rt.fromValue=Qt,Gs=65536,oh=1<<24,ir=Gs*Gs,Vs=ir*ir,Ms=Vs/2,Us=Ne(oh),Zt=Ne(0),rt.ZERO=Zt,ye=Ne(0,!0),rt.UZERO=ye,or=Ne(1),rt.ONE=or,zs=Ne(1,!0),rt.UONE=zs,Wo=Ne(-1),rt.NEG_ONE=Wo,Ws=J(-1,2147483647,!1),rt.MAX_VALUE=Ws,Hs=J(-1,-1,!0),rt.MAX_UNSIGNED_VALUE=Hs,Ct=J(0,-2147483648,!1),rt.MIN_VALUE=Ct,D=rt.prototype,D.toInt=function(){return this.unsigned?this.low>>>0:this.low},D.toNumber=function(){return this.unsigned?(this.high>>>0)*ir+(this.low>>>0):this.high*ir+(this.low>>>0)},D.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Ct)){var r=zt(t),o=this.div(r),i=o.mul(r).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var u=zt(Tn(t,6),this.unsigned),n=this,a="";;){var d=n.div(u),c=n.sub(d.mul(u)).toInt()>>>0,e=c.toString(t);if(n=d,n.isZero())return e+a;for(;e.length<6;)e="0"+e;a=""+e+a}},D.getHighBits=function(){return this.high},D.getHighBitsUnsigned=function(){return this.high>>>0},D.getLowBits=function(){return this.low},D.getLowBitsUnsigned=function(){return this.low>>>0},D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ct)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1},D.isZero=function(){return this.high===0&&this.low===0},D.eqz=D.isZero,D.isNegative=function(){return!this.unsigned&&this.high<0},D.isPositive=function(){return this.unsigned||this.high>=0},D.isOdd=function(){return(this.low&1)===1},D.isEven=function(){return(this.low&1)===0},D.equals=function(t){return Et(t)||(t=Qt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low},D.eq=D.equals,D.notEquals=function(t){return!this.eq(t)},D.neq=D.notEquals,D.ne=D.notEquals,D.lessThan=function(t){return this.comp(t)<0},D.lt=D.lessThan,D.lessThanOrEqual=function(t){return this.comp(t)<=0},D.lte=D.lessThanOrEqual,D.le=D.lessThanOrEqual,D.greaterThan=function(t){return this.comp(t)>0},D.gt=D.greaterThan,D.greaterThanOrEqual=function(t){return this.comp(t)>=0},D.gte=D.greaterThanOrEqual,D.ge=D.greaterThanOrEqual,D.compare=function(t){if(Et(t)||(t=Qt(t)),this.eq(t))return 0;var r=this.isNegative(),o=t.isNegative();return r&&!o?-1:!r&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},D.comp=D.compare,D.negate=function(){return!this.unsigned&&this.eq(Ct)?Ct:this.not().add(or)},D.neg=D.negate,D.add=function(t){Et(t)||(t=Qt(t));var r=this.high>>>16,o=this.high&65535,i=this.low>>>16,u=this.low&65535,n=t.high>>>16,a=t.high&65535,d=t.low>>>16,c=t.low&65535,e=0,l=0,s=0,h=0;return h+=u+c,s+=h>>>16,h&=65535,s+=i+d,l+=s>>>16,s&=65535,l+=o+a,e+=l>>>16,l&=65535,e+=r+n,e&=65535,J(s<<16|h,e<<16|l,this.unsigned)},D.subtract=function(t){return Et(t)||(t=Qt(t)),this.add(t.neg())},D.sub=D.subtract,D.multiply=function(t){if(this.isZero())return this;if(Et(t)||(t=Qt(t)),Vt){var r=Vt.mul(this.low,this.high,t.low,t.high);return J(r,Vt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ye:Zt;if(this.eq(Ct))return t.isOdd()?Ct:Zt;if(t.eq(Ct))return this.isOdd()?Ct:Zt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(Us)&&t.lt(Us))return zt(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,u=this.low>>>16,n=this.low&65535,a=t.high>>>16,d=t.high&65535,c=t.low>>>16,e=t.low&65535,l=0,s=0,h=0,f=0;return f+=n*e,h+=f>>>16,f&=65535,h+=u*e,s+=h>>>16,h&=65535,h+=n*c,s+=h>>>16,h&=65535,s+=i*e,l+=s>>>16,s&=65535,s+=u*c,l+=s>>>16,s&=65535,s+=n*d,l+=s>>>16,s&=65535,l+=o*e+i*c+u*d+n*a,l&=65535,J(h<<16|f,l<<16|s,this.unsigned)},D.mul=D.multiply,D.divide=function(t){if(Et(t)||(t=Qt(t)),t.isZero())throw Error("division by zero");if(Vt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Vt.div_u:Vt.div_s)(this.low,this.high,t.low,t.high);return J(r,Vt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ye:Zt;var o,i,u;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ye;if(t.gt(this.shru(1)))return zs;u=ye}else{if(this.eq(Ct)){if(t.eq(or)||t.eq(Wo))return Ct;if(t.eq(Ct))return or;var n=this.shr(1);return o=n.div(t).shl(1),o.eq(Zt)?t.isNegative()?or:Wo:(i=this.sub(t.mul(o)),u=o.add(i.div(t)),u)}else if(t.eq(Ct))return this.unsigned?ye:Zt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();u=Zt}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(o)/Math.LN2),d=a<=48?1:Tn(2,a-48),c=zt(o),e=c.mul(t);e.isNegative()||e.gt(i);)o-=d,c=zt(o,this.unsigned),e=c.mul(t);c.isZero()&&(c=or),u=u.add(c),i=i.sub(e)}return u},D.div=D.divide,D.modulo=function(t){if(Et(t)||(t=Qt(t)),Vt){var r=(this.unsigned?Vt.rem_u:Vt.rem_s)(this.low,this.high,t.low,t.high);return J(r,Vt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},D.mod=D.modulo,D.rem=D.modulo,D.not=function(){return J(~this.low,~this.high,this.unsigned)},D.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},D.clz=D.countLeadingZeros,D.countTrailingZeros=function(){return this.low?Cs(this.low):Cs(this.high)+32},D.ctz=D.countTrailingZeros,D.and=function(t){return Et(t)||(t=Qt(t)),J(this.low&t.low,this.high&t.high,this.unsigned)},D.or=function(t){return Et(t)||(t=Qt(t)),J(this.low|t.low,this.high|t.high,this.unsigned)},D.xor=function(t){return Et(t)||(t=Qt(t)),J(this.low^t.low,this.high^t.high,this.unsigned)},D.shiftLeft=function(t){return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?J(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):J(0,this.low<<t-32,this.unsigned)},D.shl=D.shiftLeft,D.shiftRight=function(t){return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?J(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):J(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},D.shr=D.shiftRight,D.shiftRightUnsigned=function(t){return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?J(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?J(this.high,0,this.unsigned):J(this.high>>>t-32,0,this.unsigned)},D.shru=D.shiftRightUnsigned,D.shr_u=D.shiftRightUnsigned,D.rotateLeft=function(t){var r;return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?J(this.high,this.low,this.unsigned):t<32?(r=32-t,J(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,J(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))},D.rotl=D.rotateLeft,D.rotateRight=function(t){var r;return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?J(this.high,this.low,this.unsigned):t<32?(r=32-t,J(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,J(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))},D.rotr=D.rotateRight,D.toSigned=function(){return this.unsigned?J(this.low,this.high,!1):this},D.toUnsigned=function(){return this.unsigned?this:J(this.low,this.high,!0)},D.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},D.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},D.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},rt.fromBytes=function(t,r,o){return o?rt.fromBytesLE(t,r):rt.fromBytesBE(t,r)},rt.fromBytesLE=function(t,r){return new rt(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)},rt.fromBytesBE=function(t,r){return new rt(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)},xe=rt}),w,wn=O(()=>{w={},w.Offset,w.Table,w.SIZEOF_SHORT=2,w.SIZEOF_INT=4,w.FILE_IDENTIFIER_LENGTH=4,w.SIZE_PREFIX_LENGTH=4,w.Encoding={UTF8_BYTES:1,UTF16_STRING:2},w.int32=new Int32Array(2),w.float32=new Float32Array(w.int32.buffer),w.float64=new Float64Array(w.int32.buffer),w.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,w.Long=function(t,r){this.low=t|0,this.high=r|0},w.Long.create=function(t,r){return t==0&&r==0?w.Long.ZERO:new w.Long(t,r)},w.Long.prototype.toFloat64=function(){return(this.low>>>0)+this.high*4294967296},w.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},w.Long.ZERO=new w.Long(0,0),w.Builder=function(t){if(t)var r=t;else var r=1024;this.bb=w.ByteBuffer.allocate(r),this.space=r,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},w.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},w.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},w.Builder.prototype.dataBuffer=function(){return this.bb},w.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},w.Builder.prototype.prep=function(t,r){t>this.minalign&&(this.minalign=t);for(var o=~(this.bb.capacity()-this.space+r)+1&t-1;this.space<o+t+r;){var i=this.bb.capacity();this.bb=w.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(o)},w.Builder.prototype.pad=function(t){for(var r=0;r<t;r++)this.bb.writeInt8(--this.space,0)},w.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},w.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},w.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},w.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},w.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},w.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},w.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},w.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},w.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},w.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},w.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},w.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},w.Builder.prototype.addFieldInt8=function(t,r,o){(this.force_defaults||r!=o)&&(this.addInt8(r),this.slot(t))},w.Builder.prototype.addFieldInt16=function(t,r,o){(this.force_defaults||r!=o)&&(this.addInt16(r),this.slot(t))},w.Builder.prototype.addFieldInt32=function(t,r,o){(this.force_defaults||r!=o)&&(this.addInt32(r),this.slot(t))},w.Builder.prototype.addFieldInt64=function(t,r,o){(this.force_defaults||!r.equals(o))&&(this.addInt64(r),this.slot(t))},w.Builder.prototype.addFieldFloat32=function(t,r,o){(this.force_defaults||r!=o)&&(this.addFloat32(r),this.slot(t))},w.Builder.prototype.addFieldFloat64=function(t,r,o){(this.force_defaults||r!=o)&&(this.addFloat64(r),this.slot(t))},w.Builder.prototype.addFieldOffset=function(t,r,o){(this.force_defaults||r!=o)&&(this.addOffset(r),this.slot(t))},w.Builder.prototype.addFieldStruct=function(t,r,o){r!=o&&(this.nested(r),this.slot(t))},w.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},w.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},w.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},w.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},w.Builder.growByteBuffer=function(t){var r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var o=r<<1,i=w.ByteBuffer.allocate(o);return i.setPosition(o-r),i.bytes().set(t.bytes(),o-r),i},w.Builder.prototype.addOffset=function(t){this.prep(w.SIZEOF_INT,0),this.writeInt32(this.offset()-t+w.SIZEOF_INT)},w.Builder.prototype.startObject=function(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(var r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()},w.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),r=this.vtable_in_use-1;r>=0&&this.vtable[r]==0;r--);for(var o=r+1;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);var i=2;this.addInt16(t-this.object_start);var u=(o+i)*w.SIZEOF_SHORT;this.addInt16(u);var n=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){var d=this.bb.capacity()-this.vtables[r];if(u==this.bb.readInt16(d)){for(var c=w.SIZEOF_SHORT;c<u;c+=w.SIZEOF_SHORT)if(this.bb.readInt16(a+c)!=this.bb.readInt16(d+c))continue t;n=this.vtables[r];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},w.Builder.prototype.finish=function(t,r,o){var i=o?w.SIZE_PREFIX_LENGTH:0;if(r){var u=r;if(this.prep(this.minalign,w.SIZEOF_INT+w.FILE_IDENTIFIER_LENGTH+i),u.length!=w.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+w.FILE_IDENTIFIER_LENGTH);for(var n=w.FILE_IDENTIFIER_LENGTH-1;n>=0;n--)this.writeInt8(u.charCodeAt(n))}this.prep(this.minalign,w.SIZEOF_INT+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},w.Builder.prototype.finishSizePrefixed=function(t,r){this.finish(t,r,!0)},w.Builder.prototype.requiredField=function(t,r){var o=this.bb.capacity()-t,i=o-this.bb.readInt32(o),u=this.bb.readInt16(i+r)!=0;if(!u)throw new Error("FlatBuffers: field "+r+" must be set")},w.Builder.prototype.startVector=function(t,r,o){this.notNested(),this.vector_num_elems=r,this.prep(w.SIZEOF_INT,t*r),this.prep(o,t*r)},w.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},w.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var r=t;else for(var r=[],o=0;o<t.length;){var i,u=t.charCodeAt(o++);if(u<55296||u>=56320)i=u;else{var n=t.charCodeAt(o++);i=(u<<10)+n+-56613888}i<128?r.push(i):(i<2048?r.push(i>>6&31|192):(i<65536?r.push(i>>12&15|224):r.push(i>>18&7|240,i>>12&63|128),r.push(i>>6&63|128)),r.push(i&63|128))}this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length);for(var o=0,a=this.space,d=this.bb.bytes();o<r.length;o++)d[a++]=r[o];return this.endVector()},w.Builder.prototype.createLong=function(t,r){return w.Long.create(t,r)},w.ByteBuffer=function(t){this.bytes_=t,this.position_=0},w.ByteBuffer.allocate=function(t){return new w.ByteBuffer(new Uint8Array(t))},w.ByteBuffer.prototype.clear=function(){this.position_=0},w.ByteBuffer.prototype.bytes=function(){return this.bytes_},w.ByteBuffer.prototype.position=function(){return this.position_},w.ByteBuffer.prototype.setPosition=function(t){this.position_=t},w.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},w.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},w.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},w.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},w.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},w.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},w.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},w.ByteBuffer.prototype.readInt64=function(t){return new w.Long(this.readInt32(t),this.readInt32(t+4))},w.ByteBuffer.prototype.readUint64=function(t){return new w.Long(this.readUint32(t),this.readUint32(t+4))},w.ByteBuffer.prototype.readFloat32=function(t){return w.int32[0]=this.readInt32(t),w.float32[0]},w.ByteBuffer.prototype.readFloat64=function(t){return w.int32[w.isLittleEndian?0:1]=this.readInt32(t),w.int32[w.isLittleEndian?1:0]=this.readInt32(t+4),w.float64[0]},w.ByteBuffer.prototype.writeInt8=function(t,r){this.bytes_[t]=r},w.ByteBuffer.prototype.writeUint8=function(t,r){this.bytes_[t]=r},w.ByteBuffer.prototype.writeInt16=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8},w.ByteBuffer.prototype.writeUint16=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8},w.ByteBuffer.prototype.writeInt32=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24},w.ByteBuffer.prototype.writeUint32=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24},w.ByteBuffer.prototype.writeInt64=function(t,r){this.writeInt32(t,r.low),this.writeInt32(t+4,r.high)},w.ByteBuffer.prototype.writeUint64=function(t,r){this.writeUint32(t,r.low),this.writeUint32(t+4,r.high)},w.ByteBuffer.prototype.writeFloat32=function(t,r){w.float32[0]=r,this.writeInt32(t,w.int32[0])},w.ByteBuffer.prototype.writeFloat64=function(t,r){w.float64[0]=r,this.writeInt32(t,w.int32[w.isLittleEndian?0:1]),this.writeInt32(t+4,w.int32[w.isLittleEndian?1:0])},w.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+w.SIZEOF_INT+w.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",r=0;r<w.FILE_IDENTIFIER_LENGTH;r++)t+=String.fromCharCode(this.readInt8(this.position_+w.SIZEOF_INT+r));return t},w.ByteBuffer.prototype.__offset=function(t,r){var o=t-this.readInt32(t);return r<this.readInt16(o)?this.readInt16(o+r):0},w.ByteBuffer.prototype.__union=function(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t},w.ByteBuffer.prototype.__string=function(t,r){t+=this.readInt32(t);var o=this.readInt32(t),i="",u=0;if(t+=w.SIZEOF_INT,r===w.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+o);for(;u<o;){var n,a=this.readUint8(t+u++);if(a<192)n=a;else{var d=this.readUint8(t+u++);if(a<224)n=(a&31)<<6|d&63;else{var c=this.readUint8(t+u++);if(a<240)n=(a&15)<<12|(d&63)<<6|c&63;else{var e=this.readUint8(t+u++);n=(a&7)<<18|(d&63)<<12|(c&63)<<6|e&63}}}n<65536?i+=String.fromCharCode(n):(n-=65536,i+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return i},w.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},w.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+w.SIZEOF_INT},w.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},w.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=w.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+w.FILE_IDENTIFIER_LENGTH);for(var r=0;r<w.FILE_IDENTIFIER_LENGTH;r++)if(t.charCodeAt(r)!=this.readInt8(this.position_+w.SIZEOF_INT+r))return!1;return!0},w.ByteBuffer.prototype.createLong=function(t,r){return w.Long.create(t,r)}}),F,Pr=O(()=>{wn(),(t=>{(r=>{(o=>{(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i.FLOAT=1]="FLOAT",i[i.INT=2]="INT",i[i.STRING=3]="STRING",i[i.TENSOR=4]="TENSOR",i[i.GRAPH=5]="GRAPH",i[i.FLOATS=6]="FLOATS",i[i.INTS=7]="INTS",i[i.STRINGS=8]="STRINGS",i[i.TENSORS=9]="TENSORS",i[i.GRAPHS=10]="GRAPHS",i[i.SPARSE_TENSOR=11]="SPARSE_TENSOR",i[i.SPARSE_TENSORS=12]="SPARSE_TENSORS"))(o.AttributeType||(o.AttributeType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VALUE=1]="VALUE",i[i.PARAM=2]="PARAM"))(o.DimensionValueType||(o.DimensionValueType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i.FLOAT=1]="FLOAT",i[i.UINT8=2]="UINT8",i[i.INT8=3]="INT8",i[i.UINT16=4]="UINT16",i[i.INT16=5]="INT16",i[i.INT32=6]="INT32",i[i.INT64=7]="INT64",i[i.STRING=8]="STRING",i[i.BOOL=9]="BOOL",i[i.FLOAT16=10]="FLOAT16",i[i.DOUBLE=11]="DOUBLE",i[i.UINT32=12]="UINT32",i[i.UINT64=13]="UINT64",i[i.COMPLEX64=14]="COMPLEX64",i[i.COMPLEX128=15]="COMPLEX128",i[i.BFLOAT16=16]="BFLOAT16",i[i.FLOAT8E4M3FN=17]="FLOAT8E4M3FN",i[i.FLOAT8E4M3FNUZ=18]="FLOAT8E4M3FNUZ",i[i.FLOAT8E5M2=19]="FLOAT8E5M2",i[i.FLOAT8E5M2FNUZ=20]="FLOAT8E5M2FNUZ"))(o.TensorDataType||(o.TensorDataType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.Primitive=0]="Primitive",i[i.Fused=1]="Fused"))(o.NodeType||(o.NodeType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.NONE=0]="NONE",i[i.tensor_type=1]="tensor_type",i[i.sequence_type=2]="sequence_type",i[i.map_type=3]="map_type"))(o.TypeInfoValue||(o.TypeInfoValue={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsShape(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsShape(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}dim(n,a){let d=this.bb.__offset(this.bb_pos,4);return d?(a||new t.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static createDimVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startDimVector(n,a){n.startVector(4,a,4)}static endShape(n){return n.endObject()}static createShape(n,a){return i.startShape(n),i.addDim(n,a),i.endShape(n)}}o.Shape=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsDimension(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimension(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}value(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}denotation(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}static startDimension(n){n.startObject(2)}static addValue(n,a){n.addFieldOffset(0,a,0)}static addDenotation(n,a){n.addFieldOffset(1,a,0)}static endDimension(n){return n.endObject()}static createDimension(n,a,d){return i.startDimension(n),i.addValue(n,a),i.addDenotation(n,d),i.endDimension(n)}}o.Dimension=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsDimensionValue(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimensionValue(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}dimType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt8(this.bb_pos+n):0}dimValue(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}dimParam(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__string(this.bb_pos+a,n):null}static startDimensionValue(n){n.startObject(3)}static addDimType(n,a){n.addFieldInt8(0,a,0)}static addDimValue(n,a){n.addFieldInt64(1,a,n.createLong(0,0))}static addDimParam(n,a){n.addFieldOffset(2,a,0)}static endDimensionValue(n){return n.endObject()}static createDimensionValue(n,a,d,c){return i.startDimensionValue(n),i.addDimType(n,a),i.addDimValue(n,d),i.addDimParam(n,c),i.endDimensionValue(n)}}o.DimensionValue=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsTensorTypeAndShape(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensorTypeAndShape(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}elemType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt32(this.bb_pos+n):0}shape(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startTensorTypeAndShape(n){n.startObject(2)}static addElemType(n,a){n.addFieldInt32(0,a,0)}static addShape(n,a){n.addFieldOffset(1,a,0)}static endTensorTypeAndShape(n){return n.endObject()}static createTensorTypeAndShape(n,a,d){return i.startTensorTypeAndShape(n),i.addElemType(n,a),i.addShape(n,d),i.endTensorTypeAndShape(n)}}o.TensorTypeAndShape=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsMapType(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsMapType(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}keyType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt32(this.bb_pos+n):0}valueType(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startMapType(n){n.startObject(2)}static addKeyType(n,a){n.addFieldInt32(0,a,0)}static addValueType(n,a){n.addFieldOffset(1,a,0)}static endMapType(n){return n.endObject()}static createMapType(n,a,d){return i.startMapType(n),i.addKeyType(n,a),i.addValueType(n,d),i.endMapType(n)}}o.MapType=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSequenceType(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSequenceType(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}elemType(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startSequenceType(n){n.startObject(1)}static addElemType(n,a){n.addFieldOffset(0,a,0)}static endSequenceType(n){return n.endObject()}static createSequenceType(n,a){return i.startSequenceType(n),i.addElemType(n,a),i.endSequenceType(n)}}o.SequenceType=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,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(n,a,d,c){return n.prep(4,12),n.writeInt32(c),n.writeInt32(d),n.writeInt32(a),n.offset()}}o.EdgeEnd=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsNodeEdge(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNodeEdge(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__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,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+d)+n*12,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,a){let d=this.bb.__offset(this.bb_pos,8);return d?(a||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+d)+n*12,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,a){n.addFieldInt32(0,a,0)}static addInputEdges(n,a){n.addFieldOffset(1,a,0)}static startInputEdgesVector(n,a){n.startVector(12,a,4)}static addOutputEdges(n,a){n.addFieldOffset(2,a,0)}static startOutputEdgesVector(n,a){n.startVector(12,a,4)}static endNodeEdge(n){return n.endObject()}static createNodeEdge(n,a,d,c){return i.startNodeEdge(n),i.addNodeIndex(n,a),i.addInputEdges(n,d),i.addOutputEdges(n,c),i.endNodeEdge(n)}}o.NodeEdge=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsNode(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNode(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}domain(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__string(this.bb_pos+a,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 a=this.bb.__offset(this.bb_pos,14);return a?this.bb.__string(this.bb_pos+a,n):null}type(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.readInt32(this.bb_pos+n):0}executionProviderType(n){let a=this.bb.__offset(this.bb_pos,18);return a?this.bb.__string(this.bb_pos+a,n):null}inputs(n,a){let d=this.bb.__offset(this.bb_pos,20);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,20);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,a){let d=this.bb.__offset(this.bb_pos,22);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,22);return n?this.bb.__vector_len(this.bb_pos+n):0}attributes(n,a){let d=this.bb.__offset(this.bb_pos,24);return d?(a||new t.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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 a=this.bb.__offset(this.bb_pos,26);return a?this.bb.readInt32(this.bb.__vector(this.bb_pos+a)+n*4):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,a){let d=this.bb.__offset(this.bb_pos,28);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):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,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addDomain(n,a){n.addFieldOffset(2,a,0)}static addSinceVersion(n,a){n.addFieldInt32(3,a,0)}static addIndex(n,a){n.addFieldInt32(4,a,0)}static addOpType(n,a){n.addFieldOffset(5,a,0)}static addType(n,a){n.addFieldInt32(6,a,0)}static addExecutionProviderType(n,a){n.addFieldOffset(7,a,0)}static addInputs(n,a){n.addFieldOffset(8,a,0)}static createInputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startInputsVector(n,a){n.startVector(4,a,4)}static addOutputs(n,a){n.addFieldOffset(9,a,0)}static createOutputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startOutputsVector(n,a){n.startVector(4,a,4)}static addAttributes(n,a){n.addFieldOffset(10,a,0)}static createAttributesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startAttributesVector(n,a){n.startVector(4,a,4)}static addInputArgCounts(n,a){n.addFieldOffset(11,a,0)}static createInputArgCountsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addInt32(a[d]);return n.endVector()}static startInputArgCountsVector(n,a){n.startVector(4,a,4)}static addImplicitInputs(n,a){n.addFieldOffset(12,a,0)}static createImplicitInputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startImplicitInputsVector(n,a){n.startVector(4,a,4)}static endNode(n){return n.endObject()}static createNode(n,a,d,c,e,l,s,h,f,m,v,_,I,T){return i.startNode(n),i.addName(n,a),i.addDocString(n,d),i.addDomain(n,c),i.addSinceVersion(n,e),i.addIndex(n,l),i.addOpType(n,s),i.addType(n,h),i.addExecutionProviderType(n,f),i.addInputs(n,m),i.addOutputs(n,v),i.addAttributes(n,_),i.addInputArgCounts(n,I),i.addImplicitInputs(n,T),i.endNode(n)}}o.Node=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsValueInfo(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsValueInfo(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}type(n){let a=this.bb.__offset(this.bb_pos,8);return a?(n||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startValueInfo(n){n.startObject(3)}static addName(n,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addType(n,a){n.addFieldOffset(2,a,0)}static endValueInfo(n){return n.endObject()}static createValueInfo(n,a,d,c){return i.startValueInfo(n),i.addName(n,a),i.addDocString(n,d),i.addType(n,c),i.endValueInfo(n)}}o.ValueInfo=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsTypeInfo(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTypeInfo(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}denotation(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}valueType(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readUint8(this.bb_pos+n):0}value(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__union(n,this.bb_pos+a):null}static startTypeInfo(n){n.startObject(3)}static addDenotation(n,a){n.addFieldOffset(0,a,0)}static addValueType(n,a){n.addFieldInt8(1,a,0)}static addValue(n,a){n.addFieldOffset(2,a,0)}static endTypeInfo(n){return n.endObject()}static createTypeInfo(n,a,d,c){return i.startTypeInfo(n),i.addDenotation(n,a),i.addValueType(n,d),i.addValue(n,c),i.endTypeInfo(n)}}o.TypeInfo=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsOperatorSetId(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsOperatorSetId(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}domain(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,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,a){n.addFieldOffset(0,a,0)}static addVersion(n,a){n.addFieldInt64(1,a,n.createLong(0,0))}static endOperatorSetId(n){return n.endObject()}static createOperatorSetId(n,a,d){return i.startOperatorSetId(n),i.addDomain(n,a),i.addVersion(n,d),i.endOperatorSetId(n)}}o.OperatorSetId=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsTensor(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensor(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}dims(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.readInt64(this.bb.__vector(this.bb_pos+a)+n*8):this.bb.createLong(0,0)}dimsLength(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__vector_len(this.bb_pos+n):0}dataType(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt32(this.bb_pos+n):0}rawData(n){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.readUint8(this.bb.__vector(this.bb_pos+a)+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,a){let d=this.bb.__offset(this.bb_pos,14);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):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,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addDims(n,a){n.addFieldOffset(2,a,0)}static createDimsVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startDimsVector(n,a){n.startVector(8,a,8)}static addDataType(n,a){n.addFieldInt32(3,a,0)}static addRawData(n,a){n.addFieldOffset(4,a,0)}static createRawDataVector(n,a){n.startVector(1,a.length,1);for(let d=a.length-1;d>=0;d--)n.addInt8(a[d]);return n.endVector()}static startRawDataVector(n,a){n.startVector(1,a,1)}static addStringData(n,a){n.addFieldOffset(5,a,0)}static createStringDataVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startStringDataVector(n,a){n.startVector(4,a,4)}static endTensor(n){return n.endObject()}static createTensor(n,a,d,c,e,l,s){return i.startTensor(n),i.addName(n,a),i.addDocString(n,d),i.addDims(n,c),i.addDataType(n,e),i.addRawData(n,l),i.addStringData(n,s),i.endTensor(n)}}o.Tensor=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSparseTensor(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSparseTensor(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}values(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}indices(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}dims(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.readInt64(this.bb.__vector(this.bb_pos+a)+n*8):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,a){n.addFieldOffset(0,a,0)}static addIndices(n,a){n.addFieldOffset(1,a,0)}static addDims(n,a){n.addFieldOffset(2,a,0)}static createDimsVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startDimsVector(n,a){n.startVector(8,a,8)}static endSparseTensor(n){return n.endObject()}static createSparseTensor(n,a,d,c){return i.startSparseTensor(n),i.addValues(n,a),i.addIndices(n,d),i.addDims(n,c),i.endSparseTensor(n)}}o.SparseTensor=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsAttribute(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsAttribute(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}type(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.readInt32(this.bb_pos+n):0}f(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readFloat32(this.bb_pos+n):0}i(){let n=this.bb.__offset(this.bb_pos,12);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}s(n){let a=this.bb.__offset(this.bb_pos,14);return a?this.bb.__string(this.bb_pos+a,n):null}t(n){let a=this.bb.__offset(this.bb_pos,16);return a?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}g(n){let a=this.bb.__offset(this.bb_pos,18);return a?(n||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}floats(n){let a=this.bb.__offset(this.bb_pos,20);return a?this.bb.readFloat32(this.bb.__vector(this.bb_pos+a)+n*4):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 a=this.bb.__offset(this.bb_pos,22);return a?this.bb.readInt64(this.bb.__vector(this.bb_pos+a)+n*8):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,a){let d=this.bb.__offset(this.bb_pos,24);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}stringsLength(){let n=this.bb.__offset(this.bb_pos,24);return n?this.bb.__vector_len(this.bb_pos+n):0}tensors(n,a){let d=this.bb.__offset(this.bb_pos,26);return d?(a||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,28);return d?(a||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addType(n,a){n.addFieldInt32(2,a,0)}static addF(n,a){n.addFieldFloat32(3,a,0)}static addI(n,a){n.addFieldInt64(4,a,n.createLong(0,0))}static addS(n,a){n.addFieldOffset(5,a,0)}static addT(n,a){n.addFieldOffset(6,a,0)}static addG(n,a){n.addFieldOffset(7,a,0)}static addFloats(n,a){n.addFieldOffset(8,a,0)}static createFloatsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addFloat32(a[d]);return n.endVector()}static startFloatsVector(n,a){n.startVector(4,a,4)}static addInts(n,a){n.addFieldOffset(9,a,0)}static createIntsVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startIntsVector(n,a){n.startVector(8,a,8)}static addStrings(n,a){n.addFieldOffset(10,a,0)}static createStringsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startStringsVector(n,a){n.startVector(4,a,4)}static addTensors(n,a){n.addFieldOffset(11,a,0)}static createTensorsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startTensorsVector(n,a){n.startVector(4,a,4)}static addGraphs(n,a){n.addFieldOffset(12,a,0)}static createGraphsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startGraphsVector(n,a){n.startVector(4,a,4)}static endAttribute(n){return n.endObject()}static createAttribute(n,a,d,c,e,l,s,h,f,m,v,_,I,T){return i.startAttribute(n),i.addName(n,a),i.addDocString(n,d),i.addType(n,c),i.addF(n,e),i.addI(n,l),i.addS(n,s),i.addT(n,h),i.addG(n,f),i.addFloats(n,m),i.addInts(n,v),i.addStrings(n,_),i.addTensors(n,I),i.addGraphs(n,T),i.endAttribute(n)}}o.Attribute=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsGraph(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsGraph(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}initializers(n,a){let d=this.bb.__offset(this.bb_pos,4);return d?(a||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,8);return d?(a||new t.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,12);return d?(a||new t.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,14);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,a){let d=this.bb.__offset(this.bb_pos,16);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.__vector_len(this.bb_pos+n):0}sparseInitializers(n,a){let d=this.bb.__offset(this.bb_pos,18);return d?(a||new t.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static createInitializersVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startInitializersVector(n,a){n.startVector(4,a,4)}static addNodeArgs(n,a){n.addFieldOffset(1,a,0)}static createNodeArgsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startNodeArgsVector(n,a){n.startVector(4,a,4)}static addNodes(n,a){n.addFieldOffset(2,a,0)}static createNodesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startNodesVector(n,a){n.startVector(4,a,4)}static addMaxNodeIndex(n,a){n.addFieldInt32(3,a,0)}static addNodeEdges(n,a){n.addFieldOffset(4,a,0)}static createNodeEdgesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startNodeEdgesVector(n,a){n.startVector(4,a,4)}static addInputs(n,a){n.addFieldOffset(5,a,0)}static createInputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startInputsVector(n,a){n.startVector(4,a,4)}static addOutputs(n,a){n.addFieldOffset(6,a,0)}static createOutputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startOutputsVector(n,a){n.startVector(4,a,4)}static addSparseInitializers(n,a){n.addFieldOffset(7,a,0)}static createSparseInitializersVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startSparseInitializersVector(n,a){n.startVector(4,a,4)}static endGraph(n){return n.endObject()}static createGraph(n,a,d,c,e,l,s,h,f){return i.startGraph(n),i.addInitializers(n,a),i.addNodeArgs(n,d),i.addNodes(n,c),i.addMaxNodeIndex(n,e),i.addNodeEdges(n,l),i.addInputs(n,s),i.addOutputs(n,h),i.addSparseInitializers(n,f),i.endGraph(n)}}o.Graph=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsModel(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsModel(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__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,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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 a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__string(this.bb_pos+a,n):null}producerVersion(n){let a=this.bb.__offset(this.bb_pos,10);return a?this.bb.__string(this.bb_pos+a,n):null}domain(n){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.__string(this.bb_pos+a,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 a=this.bb.__offset(this.bb_pos,16);return a?this.bb.__string(this.bb_pos+a,n):null}graph(n){let a=this.bb.__offset(this.bb_pos,18);return a?(n||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}graphDocString(n){let a=this.bb.__offset(this.bb_pos,20);return a?this.bb.__string(this.bb_pos+a,n):null}static startModel(n){n.startObject(9)}static addIrVersion(n,a){n.addFieldInt64(0,a,n.createLong(0,0))}static addOpsetImport(n,a){n.addFieldOffset(1,a,0)}static createOpsetImportVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startOpsetImportVector(n,a){n.startVector(4,a,4)}static addProducerName(n,a){n.addFieldOffset(2,a,0)}static addProducerVersion(n,a){n.addFieldOffset(3,a,0)}static addDomain(n,a){n.addFieldOffset(4,a,0)}static addModelVersion(n,a){n.addFieldInt64(5,a,n.createLong(0,0))}static addDocString(n,a){n.addFieldOffset(6,a,0)}static addGraph(n,a){n.addFieldOffset(7,a,0)}static addGraphDocString(n,a){n.addFieldOffset(8,a,0)}static endModel(n){return n.endObject()}static createModel(n,a,d,c,e,l,s,h,f,m){return i.startModel(n),i.addIrVersion(n,a),i.addOpsetImport(n,d),i.addProducerName(n,c),i.addProducerVersion(n,e),i.addDomain(n,l),i.addModelVersion(n,s),i.addDocString(n,h),i.addGraph(n,f),i.addGraphDocString(n,m),i.endModel(n)}}o.Model=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsKernelCreateInfos(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsKernelCreateInfos(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}nodeIndices(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.readUint32(this.bb.__vector(this.bb_pos+a)+n*4):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 a=this.bb.__offset(this.bb_pos,6);return a?this.bb.readUint64(this.bb.__vector(this.bb_pos+a)+n*8):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,a){n.addFieldOffset(0,a,0)}static createNodeIndicesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addInt32(a[d]);return n.endVector()}static startNodeIndicesVector(n,a){n.startVector(4,a,4)}static addKernelDefHashes(n,a){n.addFieldOffset(1,a,0)}static createKernelDefHashesVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startKernelDefHashesVector(n,a){n.startVector(8,a,8)}static endKernelCreateInfos(n){return n.endObject()}static createKernelCreateInfos(n,a,d){return i.startKernelCreateInfos(n),i.addNodeIndices(n,a),i.addKernelDefHashes(n,d),i.endKernelCreateInfos(n)}}o.KernelCreateInfos=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSubGraphSessionState(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSubGraphSessionState(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}graphId(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}sessionState(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startSubGraphSessionState(n){n.startObject(2)}static addGraphId(n,a){n.addFieldOffset(0,a,0)}static addSessionState(n,a){n.addFieldOffset(1,a,0)}static endSubGraphSessionState(n){let a=n.endObject();return n.requiredField(a,4),a}static createSubGraphSessionState(n,a,d){return i.startSubGraphSessionState(n),i.addGraphId(n,a),i.addSessionState(n,d),i.endSubGraphSessionState(n)}}o.SubGraphSessionState=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSessionState(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSessionState(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}kernels(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}subGraphSessionStates(n,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static addSubGraphSessionStates(n,a){n.addFieldOffset(1,a,0)}static createSubGraphSessionStatesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startSubGraphSessionStatesVector(n,a){n.startVector(4,a,4)}static endSessionState(n){return n.endObject()}static createSessionState(n,a,d){return i.startSessionState(n),i.addKernels(n,a),i.addSubGraphSessionStates(n,d),i.endSessionState(n)}}o.SessionState=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsInferenceSession(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsInferenceSession(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static bufferHasIdentifier(n){return n.__has_identifier("ORTM")}ortVersion(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}model(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}sessionState(n){let a=this.bb.__offset(this.bb_pos,8);return a?(n||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startInferenceSession(n){n.startObject(3)}static addOrtVersion(n,a){n.addFieldOffset(0,a,0)}static addModel(n,a){n.addFieldOffset(1,a,0)}static addSessionState(n,a){n.addFieldOffset(2,a,0)}static endInferenceSession(n){return n.endObject()}static finishInferenceSessionBuffer(n,a){n.finish(a,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(n,a){n.finish(a,"ORTM",!0)}static createInferenceSession(n,a,d,c){return i.startInferenceSession(n),i.addOrtVersion(n,a),i.addModel(n,d),i.addSessionState(n,c),i.endInferenceSession(n)}}o.InferenceSession=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={}))}),js=mt((t,r)=>{r.exports=o;function o(i,u){for(var n=new Array(arguments.length-1),a=0,d=2,c=!0;d<arguments.length;)n[a++]=arguments[d++];return new Promise(function(e,l){n[a]=function(s){if(c)if(c=!1,s)l(s);else{for(var h=new Array(arguments.length-1),f=0;f<h.length;)h[f++]=arguments[f];e.apply(null,h)}};try{i.apply(u||null,n)}catch(s){c&&(c=!1,l(s))}})}}),Ys=mt(t=>{var r=t;r.length=function(a){var d=a.length;if(!d)return 0;for(var c=0;--d%4>1&&a.charAt(d)==="=";)++c;return Math.ceil(a.length*3)/4-c};var o=new Array(64),i=new Array(123);for(u=0;u<64;)i[o[u]=u<26?u+65:u<52?u+71:u<62?u-4:u-59|43]=u++;var u;r.encode=function(a,d,c){for(var e=null,l=[],s=0,h=0,f;d<c;){var m=a[d++];switch(h){case 0:l[s++]=o[m>>2],f=(m&3)<<4,h=1;break;case 1:l[s++]=o[f|m>>4],f=(m&15)<<2,h=2;break;case 2:l[s++]=o[f|m>>6],l[s++]=o[m&63],h=0;break}s>8191&&((e||(e=[])).push(String.fromCharCode.apply(String,l)),s=0)}return h&&(l[s++]=o[f],l[s++]=61,h===1&&(l[s++]=61)),e?(s&&e.push(String.fromCharCode.apply(String,l.slice(0,s))),e.join("")):String.fromCharCode.apply(String,l.slice(0,s))};var n="invalid encoding";r.decode=function(a,d,c){for(var e=c,l=0,s,h=0;h<a.length;){var f=a.charCodeAt(h++);if(f===61&&l>1)break;if((f=i[f])===void 0)throw Error(n);switch(l){case 0:s=f,l=1;break;case 1:d[c++]=s<<2|(f&48)>>4,s=f,l=2;break;case 2:d[c++]=(s&15)<<4|(f&60)>>2,s=f,l=3;break;case 3:d[c++]=(s&3)<<6|f,l=0;break}}if(l===1)throw Error(n);return c-e},r.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)}}),Qs=mt((t,r)=>{r.exports=o;function o(){this._listeners={}}o.prototype.on=function(i,u,n){return(this._listeners[i]||(this._listeners[i]=[])).push({fn:u,ctx:n||this}),this},o.prototype.off=function(i,u){if(i===void 0)this._listeners={};else if(u===void 0)this._listeners[i]=[];else for(var n=this._listeners[i],a=0;a<n.length;)n[a].fn===u?n.splice(a,1):++a;return this},o.prototype.emit=function(i){var u=this._listeners[i];if(u){for(var n=[],a=1;a<arguments.length;)n.push(arguments[a++]);for(a=0;a<u.length;)u[a].fn.apply(u[a++].ctx,n)}return this}}),au=mt((t,r)=>{r.exports=o(o);function o(d){return typeof Float32Array<"u"?function(){var c=new Float32Array([-0]),e=new Uint8Array(c.buffer),l=e[3]===128;function s(v,_,I){c[0]=v,_[I]=e[0],_[I+1]=e[1],_[I+2]=e[2],_[I+3]=e[3]}function h(v,_,I){c[0]=v,_[I]=e[3],_[I+1]=e[2],_[I+2]=e[1],_[I+3]=e[0]}d.writeFloatLE=l?s:h,d.writeFloatBE=l?h:s;function f(v,_){return e[0]=v[_],e[1]=v[_+1],e[2]=v[_+2],e[3]=v[_+3],c[0]}function m(v,_){return e[3]=v[_],e[2]=v[_+1],e[1]=v[_+2],e[0]=v[_+3],c[0]}d.readFloatLE=l?f:m,d.readFloatBE=l?m:f}():function(){function c(l,s,h,f){var m=s<0?1:0;if(m&&(s=-s),s===0)l(1/s>0?0:2147483648,h,f);else if(isNaN(s))l(2143289344,h,f);else if(s>34028234663852886e22)l((m<<31|2139095040)>>>0,h,f);else if(s<11754943508222875e-54)l((m<<31|Math.round(s/1401298464324817e-60))>>>0,h,f);else{var v=Math.floor(Math.log(s)/Math.LN2),_=Math.round(s*Math.pow(2,-v)*8388608)&8388607;l((m<<31|v+127<<23|_)>>>0,h,f)}}d.writeFloatLE=c.bind(null,i),d.writeFloatBE=c.bind(null,u);function e(l,s,h){var f=l(s,h),m=(f>>31)*2+1,v=f>>>23&255,_=f&8388607;return v===255?_?NaN:m*(1/0):v===0?m*1401298464324817e-60*_:m*Math.pow(2,v-150)*(_+8388608)}d.readFloatLE=e.bind(null,n),d.readFloatBE=e.bind(null,a)}(),typeof Float64Array<"u"?function(){var c=new Float64Array([-0]),e=new Uint8Array(c.buffer),l=e[7]===128;function s(v,_,I){c[0]=v,_[I]=e[0],_[I+1]=e[1],_[I+2]=e[2],_[I+3]=e[3],_[I+4]=e[4],_[I+5]=e[5],_[I+6]=e[6],_[I+7]=e[7]}function h(v,_,I){c[0]=v,_[I]=e[7],_[I+1]=e[6],_[I+2]=e[5],_[I+3]=e[4],_[I+4]=e[3],_[I+5]=e[2],_[I+6]=e[1],_[I+7]=e[0]}d.writeDoubleLE=l?s:h,d.writeDoubleBE=l?h:s;function f(v,_){return e[0]=v[_],e[1]=v[_+1],e[2]=v[_+2],e[3]=v[_+3],e[4]=v[_+4],e[5]=v[_+5],e[6]=v[_+6],e[7]=v[_+7],c[0]}function m(v,_){return e[7]=v[_],e[6]=v[_+1],e[5]=v[_+2],e[4]=v[_+3],e[3]=v[_+4],e[2]=v[_+5],e[1]=v[_+6],e[0]=v[_+7],c[0]}d.readDoubleLE=l?f:m,d.readDoubleBE=l?m:f}():function(){function c(l,s,h,f,m,v){var _=f<0?1:0;if(_&&(f=-f),f===0)l(0,m,v+s),l(1/f>0?0:2147483648,m,v+h);else if(isNaN(f))l(0,m,v+s),l(2146959360,m,v+h);else if(f>17976931348623157e292)l(0,m,v+s),l((_<<31|2146435072)>>>0,m,v+h);else{var I;if(f<22250738585072014e-324)I=f/5e-324,l(I>>>0,m,v+s),l((_<<31|I/4294967296)>>>0,m,v+h);else{var T=Math.floor(Math.log(f)/Math.LN2);T===1024&&(T=1023),I=f*Math.pow(2,-T),l(I*4503599627370496>>>0,m,v+s),l((_<<31|T+1023<<20|I*1048576&1048575)>>>0,m,v+h)}}}d.writeDoubleLE=c.bind(null,i,0,4),d.writeDoubleBE=c.bind(null,u,4,0);function e(l,s,h,f,m){var v=l(f,m+s),_=l(f,m+h),I=(_>>31)*2+1,T=_>>>20&2047,P=4294967296*(_&1048575)+v;return T===2047?P?NaN:I*(1/0):T===0?I*5e-324*P:I*Math.pow(2,T-1075)*(P+4503599627370496)}d.readDoubleLE=e.bind(null,n,0,4),d.readDoubleBE=e.bind(null,a,4,0)}(),d}function i(d,c,e){c[e]=d&255,c[e+1]=d>>>8&255,c[e+2]=d>>>16&255,c[e+3]=d>>>24}function u(d,c,e){c[e]=d>>>24,c[e+1]=d>>>16&255,c[e+2]=d>>>8&255,c[e+3]=d&255}function n(d,c){return(d[c]|d[c+1]<<8|d[c+2]<<16|d[c+3]<<24)>>>0}function a(d,c){return(d[c]<<24|d[c+1]<<16|d[c+2]<<8|d[c+3])>>>0}}),su=mt((exports,module)=>{module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}}),lu=mt(t=>{var r=t;r.length=function(o){for(var i=0,u=0,n=0;n<o.length;++n)u=o.charCodeAt(n),u<128?i+=1:u<2048?i+=2:(u&64512)===55296&&(o.charCodeAt(n+1)&64512)===56320?(++n,i+=4):i+=3;return i},r.read=function(o,i,u){var n=u-i;if(n<1)return"";for(var a=null,d=[],c=0,e;i<u;)e=o[i++],e<128?d[c++]=e:e>191&&e<224?d[c++]=(e&31)<<6|o[i++]&63:e>239&&e<365?(e=((e&7)<<18|(o[i++]&63)<<12|(o[i++]&63)<<6|o[i++]&63)-65536,d[c++]=55296+(e>>10),d[c++]=56320+(e&1023)):d[c++]=(e&15)<<12|(o[i++]&63)<<6|o[i++]&63,c>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,d)),c=0);return a?(c&&a.push(String.fromCharCode.apply(String,d.slice(0,c))),a.join("")):String.fromCharCode.apply(String,d.slice(0,c))},r.write=function(o,i,u){for(var n=u,a,d,c=0;c<o.length;++c)a=o.charCodeAt(c),a<128?i[u++]=a:a<2048?(i[u++]=a>>6|192,i[u++]=a&63|128):(a&64512)===55296&&((d=o.charCodeAt(c+1))&64512)===56320?(a=65536+((a&1023)<<10)+(d&1023),++c,i[u++]=a>>18|240,i[u++]=a>>12&63|128,i[u++]=a>>6&63|128,i[u++]=a&63|128):(i[u++]=a>>12|224,i[u++]=a>>6&63|128,i[u++]=a&63|128);return u-n}}),cu=mt((t,r)=>{r.exports=o;function o(i,u,n){var a=n||8192,d=a>>>1,c=null,e=a;return function(l){if(l<1||l>d)return i(l);e+l>a&&(c=i(a),e=0);var s=u.call(c,e,e+=l);return e&7&&(e=(e|7)+1),s}}}),du=mt((t,r)=>{r.exports=i;var o=Se();function i(d,c){this.lo=d>>>0,this.hi=c>>>0}var u=i.zero=new i(0,0);u.toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1};var n=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(d){if(d===0)return u;var c=d<0;c&&(d=-d);var e=d>>>0,l=(d-e)/4294967296>>>0;return c&&(l=~l>>>0,e=~e>>>0,++e>4294967295&&(e=0,++l>4294967295&&(l=0))),new i(e,l)},i.from=function(d){if(typeof d=="number")return i.fromNumber(d);if(o.isString(d))if(o.Long)d=o.Long.fromString(d);else return i.fromNumber(parseInt(d,10));return d.low||d.high?new i(d.low>>>0,d.high>>>0):u},i.prototype.toNumber=function(d){if(!d&&this.hi>>>31){var c=~this.lo+1>>>0,e=~this.hi>>>0;return c||(e=e+1>>>0),-(c+e*4294967296)}return this.lo+this.hi*4294967296},i.prototype.toLong=function(d){return o.Long?new o.Long(this.lo|0,this.hi|0,!!d):{low:this.lo|0,high:this.hi|0,unsigned:!!d}};var a=String.prototype.charCodeAt;i.fromHash=function(d){return d===n?u:new i((a.call(d,0)|a.call(d,1)<<8|a.call(d,2)<<16|a.call(d,3)<<24)>>>0,(a.call(d,4)|a.call(d,5)<<8|a.call(d,6)<<16|a.call(d,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var d=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^d)>>>0,this.lo=(this.lo<<1^d)>>>0,this},i.prototype.zzDecode=function(){var d=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^d)>>>0,this.hi=(this.hi>>>1^d)>>>0,this},i.prototype.length=function(){var d=this.lo,c=(this.lo>>>28|this.hi<<4)>>>0,e=this.hi>>>24;return e===0?c===0?d<16384?d<128?1:2:d<2097152?3:4:c<16384?c<128?5:6:c<2097152?7:8:e<128?9:10}}),Se=mt(t=>{var r=t;r.asPromise=js(),r.base64=Ys(),r.EventEmitter=Qs(),r.float=au(),r.inquire=su(),r.utf8=lu(),r.pool=cu(),r.LongBits=du(),r.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node),r.global=r.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||t,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u},r.isString=function(u){return typeof u=="string"||u instanceof String},r.isObject=function(u){return u&&typeof u=="object"},r.isset=r.isSet=function(u,n){var a=u[n];return a!=null&&u.hasOwnProperty(n)?typeof a!="object"||(Array.isArray(a)?a.length:Object.keys(a).length)>0:!1},r.Buffer=function(){try{var u=r.inquire("buffer").Buffer;return u.prototype.utf8Write?u:null}catch{return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(u){return typeof u=="number"?r.Buffer?r._Buffer_allocUnsafe(u):new r.Array(u):r.Buffer?r._Buffer_from(u):typeof Uint8Array>"u"?u:new Uint8Array(u)},r.Array=typeof Uint8Array<"u"?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(u){return u?r.LongBits.from(u).toHash():r.LongBits.zeroHash},r.longFromHash=function(u,n){var a=r.LongBits.fromHash(u);return r.Long?r.Long.fromBits(a.lo,a.hi,n):a.toNumber(!!n)};function o(u,n,a){for(var d=Object.keys(n),c=0;c<d.length;++c)(u[d[c]]===void 0||!a)&&(u[d[c]]=n[d[c]]);return u}r.merge=o,r.lcFirst=function(u){return u.charAt(0).toLowerCase()+u.substring(1)};function i(u){function n(a,d){if(!(this instanceof n))return new n(a,d);Object.defineProperty(this,"message",{get:function(){return a}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:new Error().stack||""}),d&&o(this,d)}return n.prototype=Object.create(Error.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return u},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),n}r.newError=i,r.ProtocolError=i("ProtocolError"),r.oneOfGetter=function(u){for(var n={},a=0;a<u.length;++a)n[u[a]]=1;return function(){for(var d=Object.keys(this),c=d.length-1;c>-1;--c)if(n[d[c]]===1&&this[d[c]]!==void 0&&this[d[c]]!==null)return d[c]}},r.oneOfSetter=function(u){return function(n){for(var a=0;a<u.length;++a)u[a]!==n&&delete this[u[a]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var u=r.Buffer;if(!u){r._Buffer_from=r._Buffer_allocUnsafe=null;return}r._Buffer_from=u.from!==Uint8Array.from&&u.from||function(n,a){return new u(n,a)},r._Buffer_allocUnsafe=u.allocUnsafe||function(n){return new u(n)}}}),ei=mt((t,r)=>{r.exports=l;var o=Se(),i,u=o.LongBits,n=o.base64,a=o.utf8;function d(T,P,C){this.fn=T,this.len=P,this.next=void 0,this.val=C}function c(){}function e(T){this.head=T.head,this.tail=T.tail,this.len=T.len,this.next=T.states}function l(){this.len=0,this.head=new d(c,0,0),this.tail=this.head,this.states=null}var s=function(){return o.Buffer?function(){return(l.create=function(){return new i})()}:function(){return new l}};l.create=s(),l.alloc=function(T){return new o.Array(T)},o.Array!==Array&&(l.alloc=o.pool(l.alloc,o.Array.prototype.subarray)),l.prototype._push=function(T,P,C){return this.tail=this.tail.next=new d(T,P,C),this.len+=P,this};function h(T,P,C){P[C]=T&255}function f(T,P,C){for(;T>127;)P[C++]=T&127|128,T>>>=7;P[C]=T}function m(T,P){this.len=T,this.next=void 0,this.val=P}m.prototype=Object.create(d.prototype),m.prototype.fn=f,l.prototype.uint32=function(T){return this.len+=(this.tail=this.tail.next=new m((T=T>>>0)<128?1:T<16384?2:T<2097152?3:T<268435456?4:5,T)).len,this},l.prototype.int32=function(T){return T<0?this._push(v,10,u.fromNumber(T)):this.uint32(T)},l.prototype.sint32=function(T){return this.uint32((T<<1^T>>31)>>>0)};function v(T,P,C){for(;T.hi;)P[C++]=T.lo&127|128,T.lo=(T.lo>>>7|T.hi<<25)>>>0,T.hi>>>=7;for(;T.lo>127;)P[C++]=T.lo&127|128,T.lo=T.lo>>>7;P[C++]=T.lo}l.prototype.uint64=function(T){var P=u.from(T);return this._push(v,P.length(),P)},l.prototype.int64=l.prototype.uint64,l.prototype.sint64=function(T){var P=u.from(T).zzEncode();return this._push(v,P.length(),P)},l.prototype.bool=function(T){return this._push(h,1,T?1:0)};function _(T,P,C){P[C]=T&255,P[C+1]=T>>>8&255,P[C+2]=T>>>16&255,P[C+3]=T>>>24}l.prototype.fixed32=function(T){return this._push(_,4,T>>>0)},l.prototype.sfixed32=l.prototype.fixed32,l.prototype.fixed64=function(T){var P=u.from(T);return this._push(_,4,P.lo)._push(_,4,P.hi)},l.prototype.sfixed64=l.prototype.fixed64,l.prototype.float=function(T){return this._push(o.float.writeFloatLE,4,T)},l.prototype.double=function(T){return this._push(o.float.writeDoubleLE,8,T)};var I=o.Array.prototype.set?function(T,P,C){P.set(T,C)}:function(T,P,C){for(var V=0;V<T.length;++V)P[C+V]=T[V]};l.prototype.bytes=function(T){var P=T.length>>>0;if(!P)return this._push(h,1,0);if(o.isString(T)){var C=l.alloc(P=n.length(T));n.decode(T,C,0),T=C}return this.uint32(P)._push(I,P,T)},l.prototype.string=function(T){var P=a.length(T);return P?this.uint32(P)._push(a.write,P,T):this._push(h,1,0)},l.prototype.fork=function(){return this.states=new e(this),this.head=this.tail=new d(c,0,0),this.len=0,this},l.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 d(c,0,0),this.len=0),this},l.prototype.ldelim=function(){var T=this.head,P=this.tail,C=this.len;return this.reset().uint32(C),C&&(this.tail.next=T.next,this.tail=P,this.len+=C),this},l.prototype.finish=function(){for(var T=this.head.next,P=this.constructor.alloc(this.len),C=0;T;)T.fn(T.val,P,C),C+=T.len,T=T.next;return P},l._configure=function(T){i=T,l.create=s(),i._configure()}}),vu=mt((t,r)=>{r.exports=u;var o=ei();(u.prototype=Object.create(o.prototype)).constructor=u;var i=Se();function u(){o.call(this)}u._configure=function(){u.alloc=i._Buffer_allocUnsafe,u.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&i.Buffer.prototype.set.name==="set"?function(a,d,c){d.set(a,c)}:function(a,d,c){if(a.copy)a.copy(d,c,0,a.length);else for(var e=0;e<a.length;)d[c++]=a[e++]}},u.prototype.bytes=function(a){i.isString(a)&&(a=i._Buffer_from(a,"base64"));var d=a.length>>>0;return this.uint32(d),d&&this._push(u.writeBytesBuffer,d,a),this};function n(a,d,c){a.length<40?i.utf8.write(a,d,c):d.utf8Write?d.utf8Write(a,c):d.write(a,c)}u.prototype.string=function(a){var d=i.Buffer.byteLength(a);return this.uint32(d),d&&this._push(n,d,a),this},u._configure()}),oi=mt((t,r)=>{r.exports=d;var o=Se(),i,u=o.LongBits,n=o.utf8;function a(f,m){return RangeError("index out of range: "+f.pos+" + "+(m||1)+" > "+f.len)}function d(f){this.buf=f,this.pos=0,this.len=f.length}var c=typeof Uint8Array<"u"?function(f){if(f instanceof Uint8Array||Array.isArray(f))return new d(f);throw Error("illegal buffer")}:function(f){if(Array.isArray(f))return new d(f);throw Error("illegal buffer")},e=function(){return o.Buffer?function(f){return(d.create=function(m){return o.Buffer.isBuffer(m)?new i(m):c(m)})(f)}:c};d.create=e(),d.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,d.prototype.uint32=function(){var f=4294967295;return function(){if(f=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(f=(f|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return f;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return f}}(),d.prototype.int32=function(){return this.uint32()|0},d.prototype.sint32=function(){var f=this.uint32();return f>>>1^-(f&1)|0};function l(){var f=new u(0,0),m=0;if(this.len-this.pos>4){for(;m<4;++m)if(f.lo=(f.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return f;if(f.lo=(f.lo|(this.buf[this.pos]&127)<<28)>>>0,f.hi=(f.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return f;m=0}else{for(;m<3;++m){if(this.pos>=this.len)throw a(this);if(f.lo=(f.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return f}return f.lo=(f.lo|(this.buf[this.pos++]&127)<<m*7)>>>0,f}if(this.len-this.pos>4){for(;m<5;++m)if(f.hi=(f.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return f}else for(;m<5;++m){if(this.pos>=this.len)throw a(this);if(f.hi=(f.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return f}throw Error("invalid varint encoding")}d.prototype.bool=function(){return this.uint32()!==0};function s(f,m){return(f[m-4]|f[m-3]<<8|f[m-2]<<16|f[m-1]<<24)>>>0}d.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return s(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return s(this.buf,this.pos+=4)|0};function h(){if(this.pos+8>this.len)throw a(this,8);return new u(s(this.buf,this.pos+=4),s(this.buf,this.pos+=4))}d.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var f=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,f},d.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var f=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,f},d.prototype.bytes=function(){var f=this.uint32(),m=this.pos,v=this.pos+f;if(v>this.len)throw a(this,f);if(this.pos+=f,Array.isArray(this.buf))return this.buf.slice(m,v);if(m===v){var _=o.Buffer;return _?_.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,m,v)},d.prototype.string=function(){var f=this.bytes();return n.read(f,0,f.length)},d.prototype.skip=function(f){if(typeof f=="number"){if(this.pos+f>this.len)throw a(this,f);this.pos+=f}else do if(this.pos>=this.len)throw a(this);while(this.buf[this.pos++]&128);return this},d.prototype.skipType=function(f){switch(f){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(f=this.uint32()&7)!==4;)this.skipType(f);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+f+" at offset "+this.pos)}return this},d._configure=function(f){i=f,d.create=e(),i._configure();var m=o.Long?"toLong":"toNumber";o.merge(d.prototype,{int64:function(){return l.call(this)[m](!1)},uint64:function(){return l.call(this)[m](!0)},sint64:function(){return l.call(this).zzDecode()[m](!1)},fixed64:function(){return h.call(this)[m](!0)},sfixed64:function(){return h.call(this)[m](!1)}})}}),Lu=mt((t,r)=>{r.exports=u;var o=oi();(u.prototype=Object.create(o.prototype)).constructor=u;var i=Se();function u(n){o.call(this,n)}u._configure=function(){i.Buffer&&(u.prototype._slice=i.Buffer.prototype.slice)},u.prototype.string=function(){var n=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+n,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+n,this.len))},u._configure()}),ku=mt((t,r)=>{r.exports=i;var o=Se();(i.prototype=Object.create(o.EventEmitter.prototype)).constructor=i;function i(u,n,a){if(typeof u!="function")throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=u,this.requestDelimited=!!n,this.responseDelimited=!!a}i.prototype.rpcCall=function u(n,a,d,c,e){if(!c)throw TypeError("request must be specified");var l=this;if(!e)return o.asPromise(u,l,n,a,d,c);if(!l.rpcImpl){setTimeout(function(){e(Error("already ended"))},0);return}try{return l.rpcImpl(n,a[l.requestDelimited?"encodeDelimited":"encode"](c).finish(),function(s,h){if(s)return l.emit("error",s,n),e(s);if(h===null){l.end(!0);return}if(!(h instanceof d))try{h=d[l.responseDelimited?"decodeDelimited":"decode"](h)}catch(f){return l.emit("error",f,n),e(f)}return l.emit("data",h,n),e(null,h)})}catch(s){l.emit("error",s,n),setTimeout(function(){e(s)},0);return}},i.prototype.end=function(u){return this.rpcImpl&&(u||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}}),Fu=mt(t=>{var r=t;r.Service=ku()}),Nu=mt((t,r)=>{r.exports={}}),Mu=mt(t=>{var r=t;r.build="minimal",r.Writer=ei(),r.BufferWriter=vu(),r.Reader=oi(),r.BufferReader=Lu(),r.util=Se(),r.rpc=Fu(),r.roots=Nu(),r.configure=o;function o(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}o()}),Vu=mt((t,r)=>{r.exports=Mu()}),sr=mt((t,r)=>{var o=Vu(),i=o.Reader,u=o.Writer,n=o.util,a=o.roots.default||(o.roots.default={});a.onnx=function(){var d={};return d.Version=function(){var c={},e=Object.create(c);return e[c[0]="_START_VERSION"]=0,e[c[1]="IR_VERSION_2017_10_10"]=1,e[c[2]="IR_VERSION_2017_10_30"]=2,e[c[3]="IR_VERSION_2017_11_3"]=3,e[c[4]="IR_VERSION_2019_1_22"]=4,e[c[5]="IR_VERSION_2019_3_18"]=5,e[c[6]="IR_VERSION_2019_9_19"]=6,e[c[7]="IR_VERSION_2020_5_8"]=7,e[c[8]="IR_VERSION_2021_7_30"]=8,e[c[9]="IR_VERSION"]=9,e}(),d.AttributeProto=function(){function c(e){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],this.sparseTensors=[],this.typeProtos=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.name="",c.prototype.refAttrName="",c.prototype.docString="",c.prototype.type=0,c.prototype.f=0,c.prototype.i=n.Long?n.Long.fromBits(0,0,!1):0,c.prototype.s=n.newBuffer([]),c.prototype.t=null,c.prototype.g=null,c.prototype.sparseTensor=null,c.prototype.tp=null,c.prototype.floats=n.emptyArray,c.prototype.ints=n.emptyArray,c.prototype.strings=n.emptyArray,c.prototype.tensors=n.emptyArray,c.prototype.graphs=n.emptyArray,c.prototype.sparseTensors=n.emptyArray,c.prototype.typeProtos=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(10).string(e.name),e.f!=null&&Object.hasOwnProperty.call(e,"f")&&l.uint32(21).float(e.f),e.i!=null&&Object.hasOwnProperty.call(e,"i")&&l.uint32(24).int64(e.i),e.s!=null&&Object.hasOwnProperty.call(e,"s")&&l.uint32(34).bytes(e.s),e.t!=null&&Object.hasOwnProperty.call(e,"t")&&a.onnx.TensorProto.encode(e.t,l.uint32(42).fork()).ldelim(),e.g!=null&&Object.hasOwnProperty.call(e,"g")&&a.onnx.GraphProto.encode(e.g,l.uint32(50).fork()).ldelim(),e.floats!=null&&e.floats.length){l.uint32(58).fork();for(var s=0;s<e.floats.length;++s)l.float(e.floats[s]);l.ldelim()}if(e.ints!=null&&e.ints.length){l.uint32(66).fork();for(var s=0;s<e.ints.length;++s)l.int64(e.ints[s]);l.ldelim()}if(e.strings!=null&&e.strings.length)for(var s=0;s<e.strings.length;++s)l.uint32(74).bytes(e.strings[s]);if(e.tensors!=null&&e.tensors.length)for(var s=0;s<e.tensors.length;++s)a.onnx.TensorProto.encode(e.tensors[s],l.uint32(82).fork()).ldelim();if(e.graphs!=null&&e.graphs.length)for(var s=0;s<e.graphs.length;++s)a.onnx.GraphProto.encode(e.graphs[s],l.uint32(90).fork()).ldelim();if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(106).string(e.docString),e.tp!=null&&Object.hasOwnProperty.call(e,"tp")&&a.onnx.TypeProto.encode(e.tp,l.uint32(114).fork()).ldelim(),e.typeProtos!=null&&e.typeProtos.length)for(var s=0;s<e.typeProtos.length;++s)a.onnx.TypeProto.encode(e.typeProtos[s],l.uint32(122).fork()).ldelim();if(e.type!=null&&Object.hasOwnProperty.call(e,"type")&&l.uint32(160).int32(e.type),e.refAttrName!=null&&Object.hasOwnProperty.call(e,"refAttrName")&&l.uint32(170).string(e.refAttrName),e.sparseTensor!=null&&Object.hasOwnProperty.call(e,"sparseTensor")&&a.onnx.SparseTensorProto.encode(e.sparseTensor,l.uint32(178).fork()).ldelim(),e.sparseTensors!=null&&e.sparseTensors.length)for(var s=0;s<e.sparseTensors.length;++s)a.onnx.SparseTensorProto.encode(e.sparseTensors[s],l.uint32(186).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.AttributeProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.name=e.string();break}case 21:{h.refAttrName=e.string();break}case 13:{h.docString=e.string();break}case 20:{h.type=e.int32();break}case 2:{h.f=e.float();break}case 3:{h.i=e.int64();break}case 4:{h.s=e.bytes();break}case 5:{h.t=a.onnx.TensorProto.decode(e,e.uint32());break}case 6:{h.g=a.onnx.GraphProto.decode(e,e.uint32());break}case 22:{h.sparseTensor=a.onnx.SparseTensorProto.decode(e,e.uint32());break}case 14:{h.tp=a.onnx.TypeProto.decode(e,e.uint32());break}case 7:{if(h.floats&&h.floats.length||(h.floats=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.floats.push(e.float());else h.floats.push(e.float());break}case 8:{if(h.ints&&h.ints.length||(h.ints=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.ints.push(e.int64());else h.ints.push(e.int64());break}case 9:{h.strings&&h.strings.length||(h.strings=[]),h.strings.push(e.bytes());break}case 10:{h.tensors&&h.tensors.length||(h.tensors=[]),h.tensors.push(a.onnx.TensorProto.decode(e,e.uint32()));break}case 11:{h.graphs&&h.graphs.length||(h.graphs=[]),h.graphs.push(a.onnx.GraphProto.decode(e,e.uint32()));break}case 23:{h.sparseTensors&&h.sparseTensors.length||(h.sparseTensors=[]),h.sparseTensors.push(a.onnx.SparseTensorProto.decode(e,e.uint32()));break}case 15:{h.typeProtos&&h.typeProtos.length||(h.typeProtos=[]),h.typeProtos.push(a.onnx.TypeProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.refAttrName!=null&&e.hasOwnProperty("refAttrName")&&!n.isString(e.refAttrName))return"refAttrName: string expected";if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.type!=null&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 11:case 13:case 6:case 7:case 8:case 9:case 10:case 12:case 14:break}if(e.f!=null&&e.hasOwnProperty("f")&&typeof e.f!="number")return"f: number expected";if(e.i!=null&&e.hasOwnProperty("i")&&!n.isInteger(e.i)&&!(e.i&&n.isInteger(e.i.low)&&n.isInteger(e.i.high)))return"i: integer|Long expected";if(e.s!=null&&e.hasOwnProperty("s")&&!(e.s&&typeof e.s.length=="number"||n.isString(e.s)))return"s: buffer expected";if(e.t!=null&&e.hasOwnProperty("t")){var l=a.onnx.TensorProto.verify(e.t);if(l)return"t."+l}if(e.g!=null&&e.hasOwnProperty("g")){var l=a.onnx.GraphProto.verify(e.g);if(l)return"g."+l}if(e.sparseTensor!=null&&e.hasOwnProperty("sparseTensor")){var l=a.onnx.SparseTensorProto.verify(e.sparseTensor);if(l)return"sparseTensor."+l}if(e.tp!=null&&e.hasOwnProperty("tp")){var l=a.onnx.TypeProto.verify(e.tp);if(l)return"tp."+l}if(e.floats!=null&&e.hasOwnProperty("floats")){if(!Array.isArray(e.floats))return"floats: array expected";for(var s=0;s<e.floats.length;++s)if(typeof e.floats[s]!="number")return"floats: number[] expected"}if(e.ints!=null&&e.hasOwnProperty("ints")){if(!Array.isArray(e.ints))return"ints: array expected";for(var s=0;s<e.ints.length;++s)if(!n.isInteger(e.ints[s])&&!(e.ints[s]&&n.isInteger(e.ints[s].low)&&n.isInteger(e.ints[s].high)))return"ints: integer|Long[] expected"}if(e.strings!=null&&e.hasOwnProperty("strings")){if(!Array.isArray(e.strings))return"strings: array expected";for(var s=0;s<e.strings.length;++s)if(!(e.strings[s]&&typeof e.strings[s].length=="number"||n.isString(e.strings[s])))return"strings: buffer[] expected"}if(e.tensors!=null&&e.hasOwnProperty("tensors")){if(!Array.isArray(e.tensors))return"tensors: array expected";for(var s=0;s<e.tensors.length;++s){var l=a.onnx.TensorProto.verify(e.tensors[s]);if(l)return"tensors."+l}}if(e.graphs!=null&&e.hasOwnProperty("graphs")){if(!Array.isArray(e.graphs))return"graphs: array expected";for(var s=0;s<e.graphs.length;++s){var l=a.onnx.GraphProto.verify(e.graphs[s]);if(l)return"graphs."+l}}if(e.sparseTensors!=null&&e.hasOwnProperty("sparseTensors")){if(!Array.isArray(e.sparseTensors))return"sparseTensors: array expected";for(var s=0;s<e.sparseTensors.length;++s){var l=a.onnx.SparseTensorProto.verify(e.sparseTensors[s]);if(l)return"sparseTensors."+l}}if(e.typeProtos!=null&&e.hasOwnProperty("typeProtos")){if(!Array.isArray(e.typeProtos))return"typeProtos: array expected";for(var s=0;s<e.typeProtos.length;++s){var l=a.onnx.TypeProto.verify(e.typeProtos[s]);if(l)return"typeProtos."+l}}return null},c.fromObject=function(e){if(e instanceof a.onnx.AttributeProto)return e;var l=new a.onnx.AttributeProto;switch(e.name!=null&&(l.name=String(e.name)),e.refAttrName!=null&&(l.refAttrName=String(e.refAttrName)),e.docString!=null&&(l.docString=String(e.docString)),e.type){default:if(typeof e.type=="number"){l.type=e.type;break}break;case"UNDEFINED":case 0:l.type=0;break;case"FLOAT":case 1:l.type=1;break;case"INT":case 2:l.type=2;break;case"STRING":case 3:l.type=3;break;case"TENSOR":case 4:l.type=4;break;case"GRAPH":case 5:l.type=5;break;case"SPARSE_TENSOR":case 11:l.type=11;break;case"TYPE_PROTO":case 13:l.type=13;break;case"FLOATS":case 6:l.type=6;break;case"INTS":case 7:l.type=7;break;case"STRINGS":case 8:l.type=8;break;case"TENSORS":case 9:l.type=9;break;case"GRAPHS":case 10:l.type=10;break;case"SPARSE_TENSORS":case 12:l.type=12;break;case"TYPE_PROTOS":case 14:l.type=14;break}if(e.f!=null&&(l.f=Number(e.f)),e.i!=null&&(n.Long?(l.i=n.Long.fromValue(e.i)).unsigned=!1:typeof e.i=="string"?l.i=parseInt(e.i,10):typeof e.i=="number"?l.i=e.i:typeof e.i=="object"&&(l.i=new n.LongBits(e.i.low>>>0,e.i.high>>>0).toNumber())),e.s!=null&&(typeof e.s=="string"?n.base64.decode(e.s,l.s=n.newBuffer(n.base64.length(e.s)),0):e.s.length>=0&&(l.s=e.s)),e.t!=null){if(typeof e.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");l.t=a.onnx.TensorProto.fromObject(e.t)}if(e.g!=null){if(typeof e.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");l.g=a.onnx.GraphProto.fromObject(e.g)}if(e.sparseTensor!=null){if(typeof e.sparseTensor!="object")throw TypeError(".onnx.AttributeProto.sparseTensor: object expected");l.sparseTensor=a.onnx.SparseTensorProto.fromObject(e.sparseTensor)}if(e.tp!=null){if(typeof e.tp!="object")throw TypeError(".onnx.AttributeProto.tp: object expected");l.tp=a.onnx.TypeProto.fromObject(e.tp)}if(e.floats){if(!Array.isArray(e.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");l.floats=[];for(var s=0;s<e.floats.length;++s)l.floats[s]=Number(e.floats[s])}if(e.ints){if(!Array.isArray(e.ints))throw TypeError(".onnx.AttributeProto.ints: array expected");l.ints=[];for(var s=0;s<e.ints.length;++s)n.Long?(l.ints[s]=n.Long.fromValue(e.ints[s])).unsigned=!1:typeof e.ints[s]=="string"?l.ints[s]=parseInt(e.ints[s],10):typeof e.ints[s]=="number"?l.ints[s]=e.ints[s]:typeof e.ints[s]=="object"&&(l.ints[s]=new n.LongBits(e.ints[s].low>>>0,e.ints[s].high>>>0).toNumber())}if(e.strings){if(!Array.isArray(e.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");l.strings=[];for(var s=0;s<e.strings.length;++s)typeof e.strings[s]=="string"?n.base64.decode(e.strings[s],l.strings[s]=n.newBuffer(n.base64.length(e.strings[s])),0):e.strings[s].length>=0&&(l.strings[s]=e.strings[s])}if(e.tensors){if(!Array.isArray(e.tensors))throw TypeError(".onnx.AttributeProto.tensors: array expected");l.tensors=[];for(var s=0;s<e.tensors.length;++s){if(typeof e.tensors[s]!="object")throw TypeError(".onnx.AttributeProto.tensors: object expected");l.tensors[s]=a.onnx.TensorProto.fromObject(e.tensors[s])}}if(e.graphs){if(!Array.isArray(e.graphs))throw TypeError(".onnx.AttributeProto.graphs: array expected");l.graphs=[];for(var s=0;s<e.graphs.length;++s){if(typeof e.graphs[s]!="object")throw TypeError(".onnx.AttributeProto.graphs: object expected");l.graphs[s]=a.onnx.GraphProto.fromObject(e.graphs[s])}}if(e.sparseTensors){if(!Array.isArray(e.sparseTensors))throw TypeError(".onnx.AttributeProto.sparseTensors: array expected");l.sparseTensors=[];for(var s=0;s<e.sparseTensors.length;++s){if(typeof e.sparseTensors[s]!="object")throw TypeError(".onnx.AttributeProto.sparseTensors: object expected");l.sparseTensors[s]=a.onnx.SparseTensorProto.fromObject(e.sparseTensors[s])}}if(e.typeProtos){if(!Array.isArray(e.typeProtos))throw TypeError(".onnx.AttributeProto.typeProtos: array expected");l.typeProtos=[];for(var s=0;s<e.typeProtos.length;++s){if(typeof e.typeProtos[s]!="object")throw TypeError(".onnx.AttributeProto.typeProtos: object expected");l.typeProtos[s]=a.onnx.TypeProto.fromObject(e.typeProtos[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.floats=[],s.ints=[],s.strings=[],s.tensors=[],s.graphs=[],s.typeProtos=[],s.sparseTensors=[]),l.defaults){if(s.name="",s.f=0,n.Long){var h=new n.Long(0,0,!1);s.i=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.i=l.longs===String?"0":0;l.bytes===String?s.s="":(s.s=[],l.bytes!==Array&&(s.s=n.newBuffer(s.s))),s.t=null,s.g=null,s.docString="",s.tp=null,s.type=l.enums===String?"UNDEFINED":0,s.refAttrName="",s.sparseTensor=null}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.f!=null&&e.hasOwnProperty("f")&&(s.f=l.json&&!isFinite(e.f)?String(e.f):e.f),e.i!=null&&e.hasOwnProperty("i")&&(typeof e.i=="number"?s.i=l.longs===String?String(e.i):e.i:s.i=l.longs===String?n.Long.prototype.toString.call(e.i):l.longs===Number?new n.LongBits(e.i.low>>>0,e.i.high>>>0).toNumber():e.i),e.s!=null&&e.hasOwnProperty("s")&&(s.s=l.bytes===String?n.base64.encode(e.s,0,e.s.length):l.bytes===Array?Array.prototype.slice.call(e.s):e.s),e.t!=null&&e.hasOwnProperty("t")&&(s.t=a.onnx.TensorProto.toObject(e.t,l)),e.g!=null&&e.hasOwnProperty("g")&&(s.g=a.onnx.GraphProto.toObject(e.g,l)),e.floats&&e.floats.length){s.floats=[];for(var f=0;f<e.floats.length;++f)s.floats[f]=l.json&&!isFinite(e.floats[f])?String(e.floats[f]):e.floats[f]}if(e.ints&&e.ints.length){s.ints=[];for(var f=0;f<e.ints.length;++f)typeof e.ints[f]=="number"?s.ints[f]=l.longs===String?String(e.ints[f]):e.ints[f]:s.ints[f]=l.longs===String?n.Long.prototype.toString.call(e.ints[f]):l.longs===Number?new n.LongBits(e.ints[f].low>>>0,e.ints[f].high>>>0).toNumber():e.ints[f]}if(e.strings&&e.strings.length){s.strings=[];for(var f=0;f<e.strings.length;++f)s.strings[f]=l.bytes===String?n.base64.encode(e.strings[f],0,e.strings[f].length):l.bytes===Array?Array.prototype.slice.call(e.strings[f]):e.strings[f]}if(e.tensors&&e.tensors.length){s.tensors=[];for(var f=0;f<e.tensors.length;++f)s.tensors[f]=a.onnx.TensorProto.toObject(e.tensors[f],l)}if(e.graphs&&e.graphs.length){s.graphs=[];for(var f=0;f<e.graphs.length;++f)s.graphs[f]=a.onnx.GraphProto.toObject(e.graphs[f],l)}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.tp!=null&&e.hasOwnProperty("tp")&&(s.tp=a.onnx.TypeProto.toObject(e.tp,l)),e.typeProtos&&e.typeProtos.length){s.typeProtos=[];for(var f=0;f<e.typeProtos.length;++f)s.typeProtos[f]=a.onnx.TypeProto.toObject(e.typeProtos[f],l)}if(e.type!=null&&e.hasOwnProperty("type")&&(s.type=l.enums===String?a.onnx.AttributeProto.AttributeType[e.type]===void 0?e.type:a.onnx.AttributeProto.AttributeType[e.type]:e.type),e.refAttrName!=null&&e.hasOwnProperty("refAttrName")&&(s.refAttrName=e.refAttrName),e.sparseTensor!=null&&e.hasOwnProperty("sparseTensor")&&(s.sparseTensor=a.onnx.SparseTensorProto.toObject(e.sparseTensor,l)),e.sparseTensors&&e.sparseTensors.length){s.sparseTensors=[];for(var f=0;f<e.sparseTensors.length;++f)s.sparseTensors[f]=a.onnx.SparseTensorProto.toObject(e.sparseTensors[f],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.AttributeProto"},c.AttributeType=function(){var e={},l=Object.create(e);return l[e[0]="UNDEFINED"]=0,l[e[1]="FLOAT"]=1,l[e[2]="INT"]=2,l[e[3]="STRING"]=3,l[e[4]="TENSOR"]=4,l[e[5]="GRAPH"]=5,l[e[11]="SPARSE_TENSOR"]=11,l[e[13]="TYPE_PROTO"]=13,l[e[6]="FLOATS"]=6,l[e[7]="INTS"]=7,l[e[8]="STRINGS"]=8,l[e[9]="TENSORS"]=9,l[e[10]="GRAPHS"]=10,l[e[12]="SPARSE_TENSORS"]=12,l[e[14]="TYPE_PROTOS"]=14,l}(),c}(),d.ValueInfoProto=function(){function c(e){if(e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.name="",c.prototype.type=null,c.prototype.docString="",c.create=function(e){return new c(e)},c.encode=function(e,l){return l||(l=u.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(10).string(e.name),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&a.onnx.TypeProto.encode(e.type,l.uint32(18).fork()).ldelim(),e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(26).string(e.docString),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.ValueInfoProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.name=e.string();break}case 2:{h.type=a.onnx.TypeProto.decode(e,e.uint32());break}case 3:{h.docString=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.type!=null&&e.hasOwnProperty("type")){var l=a.onnx.TypeProto.verify(e.type);if(l)return"type."+l}return e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString)?"docString: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.ValueInfoProto)return e;var l=new a.onnx.ValueInfoProto;if(e.name!=null&&(l.name=String(e.name)),e.type!=null){if(typeof e.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");l.type=a.onnx.TypeProto.fromObject(e.type)}return e.docString!=null&&(l.docString=String(e.docString)),l},c.toObject=function(e,l){l||(l={});var s={};return l.defaults&&(s.name="",s.type=null,s.docString=""),e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.type!=null&&e.hasOwnProperty("type")&&(s.type=a.onnx.TypeProto.toObject(e.type,l)),e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.ValueInfoProto"},c}(),d.NodeProto=function(){function c(e){if(this.input=[],this.output=[],this.attribute=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.input=n.emptyArray,c.prototype.output=n.emptyArray,c.prototype.name="",c.prototype.opType="",c.prototype.domain="",c.prototype.attribute=n.emptyArray,c.prototype.docString="",c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.input!=null&&e.input.length)for(var s=0;s<e.input.length;++s)l.uint32(10).string(e.input[s]);if(e.output!=null&&e.output.length)for(var s=0;s<e.output.length;++s)l.uint32(18).string(e.output[s]);if(e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(26).string(e.name),e.opType!=null&&Object.hasOwnProperty.call(e,"opType")&&l.uint32(34).string(e.opType),e.attribute!=null&&e.attribute.length)for(var s=0;s<e.attribute.length;++s)a.onnx.AttributeProto.encode(e.attribute[s],l.uint32(42).fork()).ldelim();return e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(50).string(e.docString),e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(58).string(e.domain),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.NodeProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.input&&h.input.length||(h.input=[]),h.input.push(e.string());break}case 2:{h.output&&h.output.length||(h.output=[]),h.output.push(e.string());break}case 3:{h.name=e.string();break}case 4:{h.opType=e.string();break}case 7:{h.domain=e.string();break}case 5:{h.attribute&&h.attribute.length||(h.attribute=[]),h.attribute.push(a.onnx.AttributeProto.decode(e,e.uint32()));break}case 6:{h.docString=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var l=0;l<e.input.length;++l)if(!n.isString(e.input[l]))return"input: string[] expected"}if(e.output!=null&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(var l=0;l<e.output.length;++l)if(!n.isString(e.output[l]))return"output: string[] expected"}if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.opType!=null&&e.hasOwnProperty("opType")&&!n.isString(e.opType))return"opType: string expected";if(e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain))return"domain: string expected";if(e.attribute!=null&&e.hasOwnProperty("attribute")){if(!Array.isArray(e.attribute))return"attribute: array expected";for(var l=0;l<e.attribute.length;++l){var s=a.onnx.AttributeProto.verify(e.attribute[l]);if(s)return"attribute."+s}}return e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString)?"docString: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.NodeProto)return e;var l=new a.onnx.NodeProto;if(e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.NodeProto.input: array expected");l.input=[];for(var s=0;s<e.input.length;++s)l.input[s]=String(e.input[s])}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.NodeProto.output: array expected");l.output=[];for(var s=0;s<e.output.length;++s)l.output[s]=String(e.output[s])}if(e.name!=null&&(l.name=String(e.name)),e.opType!=null&&(l.opType=String(e.opType)),e.domain!=null&&(l.domain=String(e.domain)),e.attribute){if(!Array.isArray(e.attribute))throw TypeError(".onnx.NodeProto.attribute: array expected");l.attribute=[];for(var s=0;s<e.attribute.length;++s){if(typeof e.attribute[s]!="object")throw TypeError(".onnx.NodeProto.attribute: object expected");l.attribute[s]=a.onnx.AttributeProto.fromObject(e.attribute[s])}}return e.docString!=null&&(l.docString=String(e.docString)),l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.input=[],s.output=[],s.attribute=[]),l.defaults&&(s.name="",s.opType="",s.docString="",s.domain=""),e.input&&e.input.length){s.input=[];for(var h=0;h<e.input.length;++h)s.input[h]=e.input[h]}if(e.output&&e.output.length){s.output=[];for(var h=0;h<e.output.length;++h)s.output[h]=e.output[h]}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.opType!=null&&e.hasOwnProperty("opType")&&(s.opType=e.opType),e.attribute&&e.attribute.length){s.attribute=[];for(var h=0;h<e.attribute.length;++h)s.attribute[h]=a.onnx.AttributeProto.toObject(e.attribute[h],l)}return e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.NodeProto"},c}(),d.TrainingInfoProto=function(){function c(e){if(this.initializationBinding=[],this.updateBinding=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.initialization=null,c.prototype.algorithm=null,c.prototype.initializationBinding=n.emptyArray,c.prototype.updateBinding=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.initialization!=null&&Object.hasOwnProperty.call(e,"initialization")&&a.onnx.GraphProto.encode(e.initialization,l.uint32(10).fork()).ldelim(),e.algorithm!=null&&Object.hasOwnProperty.call(e,"algorithm")&&a.onnx.GraphProto.encode(e.algorithm,l.uint32(18).fork()).ldelim(),e.initializationBinding!=null&&e.initializationBinding.length)for(var s=0;s<e.initializationBinding.length;++s)a.onnx.StringStringEntryProto.encode(e.initializationBinding[s],l.uint32(26).fork()).ldelim();if(e.updateBinding!=null&&e.updateBinding.length)for(var s=0;s<e.updateBinding.length;++s)a.onnx.StringStringEntryProto.encode(e.updateBinding[s],l.uint32(34).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TrainingInfoProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.initialization=a.onnx.GraphProto.decode(e,e.uint32());break}case 2:{h.algorithm=a.onnx.GraphProto.decode(e,e.uint32());break}case 3:{h.initializationBinding&&h.initializationBinding.length||(h.initializationBinding=[]),h.initializationBinding.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}case 4:{h.updateBinding&&h.updateBinding.length||(h.updateBinding=[]),h.updateBinding.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.initialization!=null&&e.hasOwnProperty("initialization")){var l=a.onnx.GraphProto.verify(e.initialization);if(l)return"initialization."+l}if(e.algorithm!=null&&e.hasOwnProperty("algorithm")){var l=a.onnx.GraphProto.verify(e.algorithm);if(l)return"algorithm."+l}if(e.initializationBinding!=null&&e.hasOwnProperty("initializationBinding")){if(!Array.isArray(e.initializationBinding))return"initializationBinding: array expected";for(var s=0;s<e.initializationBinding.length;++s){var l=a.onnx.StringStringEntryProto.verify(e.initializationBinding[s]);if(l)return"initializationBinding."+l}}if(e.updateBinding!=null&&e.hasOwnProperty("updateBinding")){if(!Array.isArray(e.updateBinding))return"updateBinding: array expected";for(var s=0;s<e.updateBinding.length;++s){var l=a.onnx.StringStringEntryProto.verify(e.updateBinding[s]);if(l)return"updateBinding."+l}}return null},c.fromObject=function(e){if(e instanceof a.onnx.TrainingInfoProto)return e;var l=new a.onnx.TrainingInfoProto;if(e.initialization!=null){if(typeof e.initialization!="object")throw TypeError(".onnx.TrainingInfoProto.initialization: object expected");l.initialization=a.onnx.GraphProto.fromObject(e.initialization)}if(e.algorithm!=null){if(typeof e.algorithm!="object")throw TypeError(".onnx.TrainingInfoProto.algorithm: object expected");l.algorithm=a.onnx.GraphProto.fromObject(e.algorithm)}if(e.initializationBinding){if(!Array.isArray(e.initializationBinding))throw TypeError(".onnx.TrainingInfoProto.initializationBinding: array expected");l.initializationBinding=[];for(var s=0;s<e.initializationBinding.length;++s){if(typeof e.initializationBinding[s]!="object")throw TypeError(".onnx.TrainingInfoProto.initializationBinding: object expected");l.initializationBinding[s]=a.onnx.StringStringEntryProto.fromObject(e.initializationBinding[s])}}if(e.updateBinding){if(!Array.isArray(e.updateBinding))throw TypeError(".onnx.TrainingInfoProto.updateBinding: array expected");l.updateBinding=[];for(var s=0;s<e.updateBinding.length;++s){if(typeof e.updateBinding[s]!="object")throw TypeError(".onnx.TrainingInfoProto.updateBinding: object expected");l.updateBinding[s]=a.onnx.StringStringEntryProto.fromObject(e.updateBinding[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.initializationBinding=[],s.updateBinding=[]),l.defaults&&(s.initialization=null,s.algorithm=null),e.initialization!=null&&e.hasOwnProperty("initialization")&&(s.initialization=a.onnx.GraphProto.toObject(e.initialization,l)),e.algorithm!=null&&e.hasOwnProperty("algorithm")&&(s.algorithm=a.onnx.GraphProto.toObject(e.algorithm,l)),e.initializationBinding&&e.initializationBinding.length){s.initializationBinding=[];for(var h=0;h<e.initializationBinding.length;++h)s.initializationBinding[h]=a.onnx.StringStringEntryProto.toObject(e.initializationBinding[h],l)}if(e.updateBinding&&e.updateBinding.length){s.updateBinding=[];for(var h=0;h<e.updateBinding.length;++h)s.updateBinding[h]=a.onnx.StringStringEntryProto.toObject(e.updateBinding[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TrainingInfoProto"},c}(),d.ModelProto=function(){function c(e){if(this.opsetImport=[],this.metadataProps=[],this.trainingInfo=[],this.functions=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.irVersion=n.Long?n.Long.fromBits(0,0,!1):0,c.prototype.opsetImport=n.emptyArray,c.prototype.producerName="",c.prototype.producerVersion="",c.prototype.domain="",c.prototype.modelVersion=n.Long?n.Long.fromBits(0,0,!1):0,c.prototype.docString="",c.prototype.graph=null,c.prototype.metadataProps=n.emptyArray,c.prototype.trainingInfo=n.emptyArray,c.prototype.functions=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.irVersion!=null&&Object.hasOwnProperty.call(e,"irVersion")&&l.uint32(8).int64(e.irVersion),e.producerName!=null&&Object.hasOwnProperty.call(e,"producerName")&&l.uint32(18).string(e.producerName),e.producerVersion!=null&&Object.hasOwnProperty.call(e,"producerVersion")&&l.uint32(26).string(e.producerVersion),e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(34).string(e.domain),e.modelVersion!=null&&Object.hasOwnProperty.call(e,"modelVersion")&&l.uint32(40).int64(e.modelVersion),e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(50).string(e.docString),e.graph!=null&&Object.hasOwnProperty.call(e,"graph")&&a.onnx.GraphProto.encode(e.graph,l.uint32(58).fork()).ldelim(),e.opsetImport!=null&&e.opsetImport.length)for(var s=0;s<e.opsetImport.length;++s)a.onnx.OperatorSetIdProto.encode(e.opsetImport[s],l.uint32(66).fork()).ldelim();if(e.metadataProps!=null&&e.metadataProps.length)for(var s=0;s<e.metadataProps.length;++s)a.onnx.StringStringEntryProto.encode(e.metadataProps[s],l.uint32(114).fork()).ldelim();if(e.trainingInfo!=null&&e.trainingInfo.length)for(var s=0;s<e.trainingInfo.length;++s)a.onnx.TrainingInfoProto.encode(e.trainingInfo[s],l.uint32(162).fork()).ldelim();if(e.functions!=null&&e.functions.length)for(var s=0;s<e.functions.length;++s)a.onnx.FunctionProto.encode(e.functions[s],l.uint32(202).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.ModelProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.irVersion=e.int64();break}case 8:{h.opsetImport&&h.opsetImport.length||(h.opsetImport=[]),h.opsetImport.push(a.onnx.OperatorSetIdProto.decode(e,e.uint32()));break}case 2:{h.producerName=e.string();break}case 3:{h.producerVersion=e.string();break}case 4:{h.domain=e.string();break}case 5:{h.modelVersion=e.int64();break}case 6:{h.docString=e.string();break}case 7:{h.graph=a.onnx.GraphProto.decode(e,e.uint32());break}case 14:{h.metadataProps&&h.metadataProps.length||(h.metadataProps=[]),h.metadataProps.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}case 20:{h.trainingInfo&&h.trainingInfo.length||(h.trainingInfo=[]),h.trainingInfo.push(a.onnx.TrainingInfoProto.decode(e,e.uint32()));break}case 25:{h.functions&&h.functions.length||(h.functions=[]),h.functions.push(a.onnx.FunctionProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.irVersion!=null&&e.hasOwnProperty("irVersion")&&!n.isInteger(e.irVersion)&&!(e.irVersion&&n.isInteger(e.irVersion.low)&&n.isInteger(e.irVersion.high)))return"irVersion: integer|Long expected";if(e.opsetImport!=null&&e.hasOwnProperty("opsetImport")){if(!Array.isArray(e.opsetImport))return"opsetImport: array expected";for(var l=0;l<e.opsetImport.length;++l){var s=a.onnx.OperatorSetIdProto.verify(e.opsetImport[l]);if(s)return"opsetImport."+s}}if(e.producerName!=null&&e.hasOwnProperty("producerName")&&!n.isString(e.producerName))return"producerName: string expected";if(e.producerVersion!=null&&e.hasOwnProperty("producerVersion")&&!n.isString(e.producerVersion))return"producerVersion: string expected";if(e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain))return"domain: string expected";if(e.modelVersion!=null&&e.hasOwnProperty("modelVersion")&&!n.isInteger(e.modelVersion)&&!(e.modelVersion&&n.isInteger(e.modelVersion.low)&&n.isInteger(e.modelVersion.high)))return"modelVersion: integer|Long expected";if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.graph!=null&&e.hasOwnProperty("graph")){var s=a.onnx.GraphProto.verify(e.graph);if(s)return"graph."+s}if(e.metadataProps!=null&&e.hasOwnProperty("metadataProps")){if(!Array.isArray(e.metadataProps))return"metadataProps: array expected";for(var l=0;l<e.metadataProps.length;++l){var s=a.onnx.StringStringEntryProto.verify(e.metadataProps[l]);if(s)return"metadataProps."+s}}if(e.trainingInfo!=null&&e.hasOwnProperty("trainingInfo")){if(!Array.isArray(e.trainingInfo))return"trainingInfo: array expected";for(var l=0;l<e.trainingInfo.length;++l){var s=a.onnx.TrainingInfoProto.verify(e.trainingInfo[l]);if(s)return"trainingInfo."+s}}if(e.functions!=null&&e.hasOwnProperty("functions")){if(!Array.isArray(e.functions))return"functions: array expected";for(var l=0;l<e.functions.length;++l){var s=a.onnx.FunctionProto.verify(e.functions[l]);if(s)return"functions."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.ModelProto)return e;var l=new a.onnx.ModelProto;if(e.irVersion!=null&&(n.Long?(l.irVersion=n.Long.fromValue(e.irVersion)).unsigned=!1:typeof e.irVersion=="string"?l.irVersion=parseInt(e.irVersion,10):typeof e.irVersion=="number"?l.irVersion=e.irVersion:typeof e.irVersion=="object"&&(l.irVersion=new n.LongBits(e.irVersion.low>>>0,e.irVersion.high>>>0).toNumber())),e.opsetImport){if(!Array.isArray(e.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");l.opsetImport=[];for(var s=0;s<e.opsetImport.length;++s){if(typeof e.opsetImport[s]!="object")throw TypeError(".onnx.ModelProto.opsetImport: object expected");l.opsetImport[s]=a.onnx.OperatorSetIdProto.fromObject(e.opsetImport[s])}}if(e.producerName!=null&&(l.producerName=String(e.producerName)),e.producerVersion!=null&&(l.producerVersion=String(e.producerVersion)),e.domain!=null&&(l.domain=String(e.domain)),e.modelVersion!=null&&(n.Long?(l.modelVersion=n.Long.fromValue(e.modelVersion)).unsigned=!1:typeof e.modelVersion=="string"?l.modelVersion=parseInt(e.modelVersion,10):typeof e.modelVersion=="number"?l.modelVersion=e.modelVersion:typeof e.modelVersion=="object"&&(l.modelVersion=new n.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber())),e.docString!=null&&(l.docString=String(e.docString)),e.graph!=null){if(typeof e.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");l.graph=a.onnx.GraphProto.fromObject(e.graph)}if(e.metadataProps){if(!Array.isArray(e.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");l.metadataProps=[];for(var s=0;s<e.metadataProps.length;++s){if(typeof e.metadataProps[s]!="object")throw TypeError(".onnx.ModelProto.metadataProps: object expected");l.metadataProps[s]=a.onnx.StringStringEntryProto.fromObject(e.metadataProps[s])}}if(e.trainingInfo){if(!Array.isArray(e.trainingInfo))throw TypeError(".onnx.ModelProto.trainingInfo: array expected");l.trainingInfo=[];for(var s=0;s<e.trainingInfo.length;++s){if(typeof e.trainingInfo[s]!="object")throw TypeError(".onnx.ModelProto.trainingInfo: object expected");l.trainingInfo[s]=a.onnx.TrainingInfoProto.fromObject(e.trainingInfo[s])}}if(e.functions){if(!Array.isArray(e.functions))throw TypeError(".onnx.ModelProto.functions: array expected");l.functions=[];for(var s=0;s<e.functions.length;++s){if(typeof e.functions[s]!="object")throw TypeError(".onnx.ModelProto.functions: object expected");l.functions[s]=a.onnx.FunctionProto.fromObject(e.functions[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.opsetImport=[],s.metadataProps=[],s.trainingInfo=[],s.functions=[]),l.defaults){if(n.Long){var h=new n.Long(0,0,!1);s.irVersion=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.irVersion=l.longs===String?"0":0;if(s.producerName="",s.producerVersion="",s.domain="",n.Long){var h=new n.Long(0,0,!1);s.modelVersion=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.modelVersion=l.longs===String?"0":0;s.docString="",s.graph=null}if(e.irVersion!=null&&e.hasOwnProperty("irVersion")&&(typeof e.irVersion=="number"?s.irVersion=l.longs===String?String(e.irVersion):e.irVersion:s.irVersion=l.longs===String?n.Long.prototype.toString.call(e.irVersion):l.longs===Number?new n.LongBits(e.irVersion.low>>>0,e.irVersion.high>>>0).toNumber():e.irVersion),e.producerName!=null&&e.hasOwnProperty("producerName")&&(s.producerName=e.producerName),e.producerVersion!=null&&e.hasOwnProperty("producerVersion")&&(s.producerVersion=e.producerVersion),e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),e.modelVersion!=null&&e.hasOwnProperty("modelVersion")&&(typeof e.modelVersion=="number"?s.modelVersion=l.longs===String?String(e.modelVersion):e.modelVersion:s.modelVersion=l.longs===String?n.Long.prototype.toString.call(e.modelVersion):l.longs===Number?new n.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber():e.modelVersion),e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.graph!=null&&e.hasOwnProperty("graph")&&(s.graph=a.onnx.GraphProto.toObject(e.graph,l)),e.opsetImport&&e.opsetImport.length){s.opsetImport=[];for(var f=0;f<e.opsetImport.length;++f)s.opsetImport[f]=a.onnx.OperatorSetIdProto.toObject(e.opsetImport[f],l)}if(e.metadataProps&&e.metadataProps.length){s.metadataProps=[];for(var f=0;f<e.metadataProps.length;++f)s.metadataProps[f]=a.onnx.StringStringEntryProto.toObject(e.metadataProps[f],l)}if(e.trainingInfo&&e.trainingInfo.length){s.trainingInfo=[];for(var f=0;f<e.trainingInfo.length;++f)s.trainingInfo[f]=a.onnx.TrainingInfoProto.toObject(e.trainingInfo[f],l)}if(e.functions&&e.functions.length){s.functions=[];for(var f=0;f<e.functions.length;++f)s.functions[f]=a.onnx.FunctionProto.toObject(e.functions[f],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.ModelProto"},c}(),d.StringStringEntryProto=function(){function c(e){if(e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.key="",c.prototype.value="",c.create=function(e){return new c(e)},c.encode=function(e,l){return l||(l=u.create()),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&l.uint32(10).string(e.key),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&l.uint32(18).string(e.value),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.StringStringEntryProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.key=e.string();break}case 2:{h.value=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){return typeof e!="object"||e===null?"object expected":e.key!=null&&e.hasOwnProperty("key")&&!n.isString(e.key)?"key: string expected":e.value!=null&&e.hasOwnProperty("value")&&!n.isString(e.value)?"value: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.StringStringEntryProto)return e;var l=new a.onnx.StringStringEntryProto;return e.key!=null&&(l.key=String(e.key)),e.value!=null&&(l.value=String(e.value)),l},c.toObject=function(e,l){l||(l={});var s={};return l.defaults&&(s.key="",s.value=""),e.key!=null&&e.hasOwnProperty("key")&&(s.key=e.key),e.value!=null&&e.hasOwnProperty("value")&&(s.value=e.value),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.StringStringEntryProto"},c}(),d.TensorAnnotation=function(){function c(e){if(this.quantParameterTensorNames=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.tensorName="",c.prototype.quantParameterTensorNames=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.tensorName!=null&&Object.hasOwnProperty.call(e,"tensorName")&&l.uint32(10).string(e.tensorName),e.quantParameterTensorNames!=null&&e.quantParameterTensorNames.length)for(var s=0;s<e.quantParameterTensorNames.length;++s)a.onnx.StringStringEntryProto.encode(e.quantParameterTensorNames[s],l.uint32(18).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TensorAnnotation;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.tensorName=e.string();break}case 2:{h.quantParameterTensorNames&&h.quantParameterTensorNames.length||(h.quantParameterTensorNames=[]),h.quantParameterTensorNames.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.tensorName!=null&&e.hasOwnProperty("tensorName")&&!n.isString(e.tensorName))return"tensorName: string expected";if(e.quantParameterTensorNames!=null&&e.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(e.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var l=0;l<e.quantParameterTensorNames.length;++l){var s=a.onnx.StringStringEntryProto.verify(e.quantParameterTensorNames[l]);if(s)return"quantParameterTensorNames."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.TensorAnnotation)return e;var l=new a.onnx.TensorAnnotation;if(e.tensorName!=null&&(l.tensorName=String(e.tensorName)),e.quantParameterTensorNames){if(!Array.isArray(e.quantParameterTensorNames))throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: array expected");l.quantParameterTensorNames=[];for(var s=0;s<e.quantParameterTensorNames.length;++s){if(typeof e.quantParameterTensorNames[s]!="object")throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: object expected");l.quantParameterTensorNames[s]=a.onnx.StringStringEntryProto.fromObject(e.quantParameterTensorNames[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.quantParameterTensorNames=[]),l.defaults&&(s.tensorName=""),e.tensorName!=null&&e.hasOwnProperty("tensorName")&&(s.tensorName=e.tensorName),e.quantParameterTensorNames&&e.quantParameterTensorNames.length){s.quantParameterTensorNames=[];for(var h=0;h<e.quantParameterTensorNames.length;++h)s.quantParameterTensorNames[h]=a.onnx.StringStringEntryProto.toObject(e.quantParameterTensorNames[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TensorAnnotation"},c}(),d.GraphProto=function(){function c(e){if(this.node=[],this.initializer=[],this.sparseInitializer=[],this.input=[],this.output=[],this.valueInfo=[],this.quantizationAnnotation=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.node=n.emptyArray,c.prototype.name="",c.prototype.initializer=n.emptyArray,c.prototype.sparseInitializer=n.emptyArray,c.prototype.docString="",c.prototype.input=n.emptyArray,c.prototype.output=n.emptyArray,c.prototype.valueInfo=n.emptyArray,c.prototype.quantizationAnnotation=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.node!=null&&e.node.length)for(var s=0;s<e.node.length;++s)a.onnx.NodeProto.encode(e.node[s],l.uint32(10).fork()).ldelim();if(e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(18).string(e.name),e.initializer!=null&&e.initializer.length)for(var s=0;s<e.initializer.length;++s)a.onnx.TensorProto.encode(e.initializer[s],l.uint32(42).fork()).ldelim();if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(82).string(e.docString),e.input!=null&&e.input.length)for(var s=0;s<e.input.length;++s)a.onnx.ValueInfoProto.encode(e.input[s],l.uint32(90).fork()).ldelim();if(e.output!=null&&e.output.length)for(var s=0;s<e.output.length;++s)a.onnx.ValueInfoProto.encode(e.output[s],l.uint32(98).fork()).ldelim();if(e.valueInfo!=null&&e.valueInfo.length)for(var s=0;s<e.valueInfo.length;++s)a.onnx.ValueInfoProto.encode(e.valueInfo[s],l.uint32(106).fork()).ldelim();if(e.quantizationAnnotation!=null&&e.quantizationAnnotation.length)for(var s=0;s<e.quantizationAnnotation.length;++s)a.onnx.TensorAnnotation.encode(e.quantizationAnnotation[s],l.uint32(114).fork()).ldelim();if(e.sparseInitializer!=null&&e.sparseInitializer.length)for(var s=0;s<e.sparseInitializer.length;++s)a.onnx.SparseTensorProto.encode(e.sparseInitializer[s],l.uint32(122).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.GraphProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.node&&h.node.length||(h.node=[]),h.node.push(a.onnx.NodeProto.decode(e,e.uint32()));break}case 2:{h.name=e.string();break}case 5:{h.initializer&&h.initializer.length||(h.initializer=[]),h.initializer.push(a.onnx.TensorProto.decode(e,e.uint32()));break}case 15:{h.sparseInitializer&&h.sparseInitializer.length||(h.sparseInitializer=[]),h.sparseInitializer.push(a.onnx.SparseTensorProto.decode(e,e.uint32()));break}case 10:{h.docString=e.string();break}case 11:{h.input&&h.input.length||(h.input=[]),h.input.push(a.onnx.ValueInfoProto.decode(e,e.uint32()));break}case 12:{h.output&&h.output.length||(h.output=[]),h.output.push(a.onnx.ValueInfoProto.decode(e,e.uint32()));break}case 13:{h.valueInfo&&h.valueInfo.length||(h.valueInfo=[]),h.valueInfo.push(a.onnx.ValueInfoProto.decode(e,e.uint32()));break}case 14:{h.quantizationAnnotation&&h.quantizationAnnotation.length||(h.quantizationAnnotation=[]),h.quantizationAnnotation.push(a.onnx.TensorAnnotation.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.node!=null&&e.hasOwnProperty("node")){if(!Array.isArray(e.node))return"node: array expected";for(var l=0;l<e.node.length;++l){var s=a.onnx.NodeProto.verify(e.node[l]);if(s)return"node."+s}}if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.initializer!=null&&e.hasOwnProperty("initializer")){if(!Array.isArray(e.initializer))return"initializer: array expected";for(var l=0;l<e.initializer.length;++l){var s=a.onnx.TensorProto.verify(e.initializer[l]);if(s)return"initializer."+s}}if(e.sparseInitializer!=null&&e.hasOwnProperty("sparseInitializer")){if(!Array.isArray(e.sparseInitializer))return"sparseInitializer: array expected";for(var l=0;l<e.sparseInitializer.length;++l){var s=a.onnx.SparseTensorProto.verify(e.sparseInitializer[l]);if(s)return"sparseInitializer."+s}}if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var l=0;l<e.input.length;++l){var s=a.onnx.ValueInfoProto.verify(e.input[l]);if(s)return"input."+s}}if(e.output!=null&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(var l=0;l<e.output.length;++l){var s=a.onnx.ValueInfoProto.verify(e.output[l]);if(s)return"output."+s}}if(e.valueInfo!=null&&e.hasOwnProperty("valueInfo")){if(!Array.isArray(e.valueInfo))return"valueInfo: array expected";for(var l=0;l<e.valueInfo.length;++l){var s=a.onnx.ValueInfoProto.verify(e.valueInfo[l]);if(s)return"valueInfo."+s}}if(e.quantizationAnnotation!=null&&e.hasOwnProperty("quantizationAnnotation")){if(!Array.isArray(e.quantizationAnnotation))return"quantizationAnnotation: array expected";for(var l=0;l<e.quantizationAnnotation.length;++l){var s=a.onnx.TensorAnnotation.verify(e.quantizationAnnotation[l]);if(s)return"quantizationAnnotation."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.GraphProto)return e;var l=new a.onnx.GraphProto;if(e.node){if(!Array.isArray(e.node))throw TypeError(".onnx.GraphProto.node: array expected");l.node=[];for(var s=0;s<e.node.length;++s){if(typeof e.node[s]!="object")throw TypeError(".onnx.GraphProto.node: object expected");l.node[s]=a.onnx.NodeProto.fromObject(e.node[s])}}if(e.name!=null&&(l.name=String(e.name)),e.initializer){if(!Array.isArray(e.initializer))throw TypeError(".onnx.GraphProto.initializer: array expected");l.initializer=[];for(var s=0;s<e.initializer.length;++s){if(typeof e.initializer[s]!="object")throw TypeError(".onnx.GraphProto.initializer: object expected");l.initializer[s]=a.onnx.TensorProto.fromObject(e.initializer[s])}}if(e.sparseInitializer){if(!Array.isArray(e.sparseInitializer))throw TypeError(".onnx.GraphProto.sparseInitializer: array expected");l.sparseInitializer=[];for(var s=0;s<e.sparseInitializer.length;++s){if(typeof e.sparseInitializer[s]!="object")throw TypeError(".onnx.GraphProto.sparseInitializer: object expected");l.sparseInitializer[s]=a.onnx.SparseTensorProto.fromObject(e.sparseInitializer[s])}}if(e.docString!=null&&(l.docString=String(e.docString)),e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.GraphProto.input: array expected");l.input=[];for(var s=0;s<e.input.length;++s){if(typeof e.input[s]!="object")throw TypeError(".onnx.GraphProto.input: object expected");l.input[s]=a.onnx.ValueInfoProto.fromObject(e.input[s])}}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.GraphProto.output: array expected");l.output=[];for(var s=0;s<e.output.length;++s){if(typeof e.output[s]!="object")throw TypeError(".onnx.GraphProto.output: object expected");l.output[s]=a.onnx.ValueInfoProto.fromObject(e.output[s])}}if(e.valueInfo){if(!Array.isArray(e.valueInfo))throw TypeError(".onnx.GraphProto.valueInfo: array expected");l.valueInfo=[];for(var s=0;s<e.valueInfo.length;++s){if(typeof e.valueInfo[s]!="object")throw TypeError(".onnx.GraphProto.valueInfo: object expected");l.valueInfo[s]=a.onnx.ValueInfoProto.fromObject(e.valueInfo[s])}}if(e.quantizationAnnotation){if(!Array.isArray(e.quantizationAnnotation))throw TypeError(".onnx.GraphProto.quantizationAnnotation: array expected");l.quantizationAnnotation=[];for(var s=0;s<e.quantizationAnnotation.length;++s){if(typeof e.quantizationAnnotation[s]!="object")throw TypeError(".onnx.GraphProto.quantizationAnnotation: object expected");l.quantizationAnnotation[s]=a.onnx.TensorAnnotation.fromObject(e.quantizationAnnotation[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.node=[],s.initializer=[],s.input=[],s.output=[],s.valueInfo=[],s.quantizationAnnotation=[],s.sparseInitializer=[]),l.defaults&&(s.name="",s.docString=""),e.node&&e.node.length){s.node=[];for(var h=0;h<e.node.length;++h)s.node[h]=a.onnx.NodeProto.toObject(e.node[h],l)}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.initializer&&e.initializer.length){s.initializer=[];for(var h=0;h<e.initializer.length;++h)s.initializer[h]=a.onnx.TensorProto.toObject(e.initializer[h],l)}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.input&&e.input.length){s.input=[];for(var h=0;h<e.input.length;++h)s.input[h]=a.onnx.ValueInfoProto.toObject(e.input[h],l)}if(e.output&&e.output.length){s.output=[];for(var h=0;h<e.output.length;++h)s.output[h]=a.onnx.ValueInfoProto.toObject(e.output[h],l)}if(e.valueInfo&&e.valueInfo.length){s.valueInfo=[];for(var h=0;h<e.valueInfo.length;++h)s.valueInfo[h]=a.onnx.ValueInfoProto.toObject(e.valueInfo[h],l)}if(e.quantizationAnnotation&&e.quantizationAnnotation.length){s.quantizationAnnotation=[];for(var h=0;h<e.quantizationAnnotation.length;++h)s.quantizationAnnotation[h]=a.onnx.TensorAnnotation.toObject(e.quantizationAnnotation[h],l)}if(e.sparseInitializer&&e.sparseInitializer.length){s.sparseInitializer=[];for(var h=0;h<e.sparseInitializer.length;++h)s.sparseInitializer[h]=a.onnx.SparseTensorProto.toObject(e.sparseInitializer[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.GraphProto"},c}(),d.TensorProto=function(){function c(e){if(this.dims=[],this.floatData=[],this.int32Data=[],this.stringData=[],this.int64Data=[],this.externalData=[],this.doubleData=[],this.uint64Data=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.dims=n.emptyArray,c.prototype.dataType=0,c.prototype.segment=null,c.prototype.floatData=n.emptyArray,c.prototype.int32Data=n.emptyArray,c.prototype.stringData=n.emptyArray,c.prototype.int64Data=n.emptyArray,c.prototype.name="",c.prototype.docString="",c.prototype.rawData=n.newBuffer([]),c.prototype.externalData=n.emptyArray,c.prototype.dataLocation=0,c.prototype.doubleData=n.emptyArray,c.prototype.uint64Data=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.dims!=null&&e.dims.length){l.uint32(10).fork();for(var s=0;s<e.dims.length;++s)l.int64(e.dims[s]);l.ldelim()}if(e.dataType!=null&&Object.hasOwnProperty.call(e,"dataType")&&l.uint32(16).int32(e.dataType),e.segment!=null&&Object.hasOwnProperty.call(e,"segment")&&a.onnx.TensorProto.Segment.encode(e.segment,l.uint32(26).fork()).ldelim(),e.floatData!=null&&e.floatData.length){l.uint32(34).fork();for(var s=0;s<e.floatData.length;++s)l.float(e.floatData[s]);l.ldelim()}if(e.int32Data!=null&&e.int32Data.length){l.uint32(42).fork();for(var s=0;s<e.int32Data.length;++s)l.int32(e.int32Data[s]);l.ldelim()}if(e.stringData!=null&&e.stringData.length)for(var s=0;s<e.stringData.length;++s)l.uint32(50).bytes(e.stringData[s]);if(e.int64Data!=null&&e.int64Data.length){l.uint32(58).fork();for(var s=0;s<e.int64Data.length;++s)l.int64(e.int64Data[s]);l.ldelim()}if(e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(66).string(e.name),e.rawData!=null&&Object.hasOwnProperty.call(e,"rawData")&&l.uint32(74).bytes(e.rawData),e.doubleData!=null&&e.doubleData.length){l.uint32(82).fork();for(var s=0;s<e.doubleData.length;++s)l.double(e.doubleData[s]);l.ldelim()}if(e.uint64Data!=null&&e.uint64Data.length){l.uint32(90).fork();for(var s=0;s<e.uint64Data.length;++s)l.uint64(e.uint64Data[s]);l.ldelim()}if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(98).string(e.docString),e.externalData!=null&&e.externalData.length)for(var s=0;s<e.externalData.length;++s)a.onnx.StringStringEntryProto.encode(e.externalData[s],l.uint32(106).fork()).ldelim();return e.dataLocation!=null&&Object.hasOwnProperty.call(e,"dataLocation")&&l.uint32(112).int32(e.dataLocation),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TensorProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{if(h.dims&&h.dims.length||(h.dims=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.dims.push(e.int64());else h.dims.push(e.int64());break}case 2:{h.dataType=e.int32();break}case 3:{h.segment=a.onnx.TensorProto.Segment.decode(e,e.uint32());break}case 4:{if(h.floatData&&h.floatData.length||(h.floatData=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.floatData.push(e.float());else h.floatData.push(e.float());break}case 5:{if(h.int32Data&&h.int32Data.length||(h.int32Data=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.int32Data.push(e.int32());else h.int32Data.push(e.int32());break}case 6:{h.stringData&&h.stringData.length||(h.stringData=[]),h.stringData.push(e.bytes());break}case 7:{if(h.int64Data&&h.int64Data.length||(h.int64Data=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.int64Data.push(e.int64());else h.int64Data.push(e.int64());break}case 8:{h.name=e.string();break}case 12:{h.docString=e.string();break}case 9:{h.rawData=e.bytes();break}case 13:{h.externalData&&h.externalData.length||(h.externalData=[]),h.externalData.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}case 14:{h.dataLocation=e.int32();break}case 10:{if(h.doubleData&&h.doubleData.length||(h.doubleData=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.doubleData.push(e.double());else h.doubleData.push(e.double());break}case 11:{if(h.uint64Data&&h.uint64Data.length||(h.uint64Data=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.uint64Data.push(e.uint64());else h.uint64Data.push(e.uint64());break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dims!=null&&e.hasOwnProperty("dims")){if(!Array.isArray(e.dims))return"dims: array expected";for(var l=0;l<e.dims.length;++l)if(!n.isInteger(e.dims[l])&&!(e.dims[l]&&n.isInteger(e.dims[l].low)&&n.isInteger(e.dims[l].high)))return"dims: integer|Long[] expected"}if(e.dataType!=null&&e.hasOwnProperty("dataType")&&!n.isInteger(e.dataType))return"dataType: integer expected";if(e.segment!=null&&e.hasOwnProperty("segment")){var s=a.onnx.TensorProto.Segment.verify(e.segment);if(s)return"segment."+s}if(e.floatData!=null&&e.hasOwnProperty("floatData")){if(!Array.isArray(e.floatData))return"floatData: array expected";for(var l=0;l<e.floatData.length;++l)if(typeof e.floatData[l]!="number")return"floatData: number[] expected"}if(e.int32Data!=null&&e.hasOwnProperty("int32Data")){if(!Array.isArray(e.int32Data))return"int32Data: array expected";for(var l=0;l<e.int32Data.length;++l)if(!n.isInteger(e.int32Data[l]))return"int32Data: integer[] expected"}if(e.stringData!=null&&e.hasOwnProperty("stringData")){if(!Array.isArray(e.stringData))return"stringData: array expected";for(var l=0;l<e.stringData.length;++l)if(!(e.stringData[l]&&typeof e.stringData[l].length=="number"||n.isString(e.stringData[l])))return"stringData: buffer[] expected"}if(e.int64Data!=null&&e.hasOwnProperty("int64Data")){if(!Array.isArray(e.int64Data))return"int64Data: array expected";for(var l=0;l<e.int64Data.length;++l)if(!n.isInteger(e.int64Data[l])&&!(e.int64Data[l]&&n.isInteger(e.int64Data[l].low)&&n.isInteger(e.int64Data[l].high)))return"int64Data: integer|Long[] expected"}if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.rawData!=null&&e.hasOwnProperty("rawData")&&!(e.rawData&&typeof e.rawData.length=="number"||n.isString(e.rawData)))return"rawData: buffer expected";if(e.externalData!=null&&e.hasOwnProperty("externalData")){if(!Array.isArray(e.externalData))return"externalData: array expected";for(var l=0;l<e.externalData.length;++l){var s=a.onnx.StringStringEntryProto.verify(e.externalData[l]);if(s)return"externalData."+s}}if(e.dataLocation!=null&&e.hasOwnProperty("dataLocation"))switch(e.dataLocation){default:return"dataLocation: enum value expected";case 0:case 1:break}if(e.doubleData!=null&&e.hasOwnProperty("doubleData")){if(!Array.isArray(e.doubleData))return"doubleData: array expected";for(var l=0;l<e.doubleData.length;++l)if(typeof e.doubleData[l]!="number")return"doubleData: number[] expected"}if(e.uint64Data!=null&&e.hasOwnProperty("uint64Data")){if(!Array.isArray(e.uint64Data))return"uint64Data: array expected";for(var l=0;l<e.uint64Data.length;++l)if(!n.isInteger(e.uint64Data[l])&&!(e.uint64Data[l]&&n.isInteger(e.uint64Data[l].low)&&n.isInteger(e.uint64Data[l].high)))return"uint64Data: integer|Long[] expected"}return null},c.fromObject=function(e){if(e instanceof a.onnx.TensorProto)return e;var l=new a.onnx.TensorProto;if(e.dims){if(!Array.isArray(e.dims))throw TypeError(".onnx.TensorProto.dims: array expected");l.dims=[];for(var s=0;s<e.dims.length;++s)n.Long?(l.dims[s]=n.Long.fromValue(e.dims[s])).unsigned=!1:typeof e.dims[s]=="string"?l.dims[s]=parseInt(e.dims[s],10):typeof e.dims[s]=="number"?l.dims[s]=e.dims[s]:typeof e.dims[s]=="object"&&(l.dims[s]=new n.LongBits(e.dims[s].low>>>0,e.dims[s].high>>>0).toNumber())}if(e.dataType!=null&&(l.dataType=e.dataType|0),e.segment!=null){if(typeof e.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");l.segment=a.onnx.TensorProto.Segment.fromObject(e.segment)}if(e.floatData){if(!Array.isArray(e.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");l.floatData=[];for(var s=0;s<e.floatData.length;++s)l.floatData[s]=Number(e.floatData[s])}if(e.int32Data){if(!Array.isArray(e.int32Data))throw TypeError(".onnx.TensorProto.int32Data: array expected");l.int32Data=[];for(var s=0;s<e.int32Data.length;++s)l.int32Data[s]=e.int32Data[s]|0}if(e.stringData){if(!Array.isArray(e.stringData))throw TypeError(".onnx.TensorProto.stringData: array expected");l.stringData=[];for(var s=0;s<e.stringData.length;++s)typeof e.stringData[s]=="string"?n.base64.decode(e.stringData[s],l.stringData[s]=n.newBuffer(n.base64.length(e.stringData[s])),0):e.stringData[s].length>=0&&(l.stringData[s]=e.stringData[s])}if(e.int64Data){if(!Array.isArray(e.int64Data))throw TypeError(".onnx.TensorProto.int64Data: array expected");l.int64Data=[];for(var s=0;s<e.int64Data.length;++s)n.Long?(l.int64Data[s]=n.Long.fromValue(e.int64Data[s])).unsigned=!1:typeof e.int64Data[s]=="string"?l.int64Data[s]=parseInt(e.int64Data[s],10):typeof e.int64Data[s]=="number"?l.int64Data[s]=e.int64Data[s]:typeof e.int64Data[s]=="object"&&(l.int64Data[s]=new n.LongBits(e.int64Data[s].low>>>0,e.int64Data[s].high>>>0).toNumber())}if(e.name!=null&&(l.name=String(e.name)),e.docString!=null&&(l.docString=String(e.docString)),e.rawData!=null&&(typeof e.rawData=="string"?n.base64.decode(e.rawData,l.rawData=n.newBuffer(n.base64.length(e.rawData)),0):e.rawData.length>=0&&(l.rawData=e.rawData)),e.externalData){if(!Array.isArray(e.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");l.externalData=[];for(var s=0;s<e.externalData.length;++s){if(typeof e.externalData[s]!="object")throw TypeError(".onnx.TensorProto.externalData: object expected");l.externalData[s]=a.onnx.StringStringEntryProto.fromObject(e.externalData[s])}}switch(e.dataLocation){default:if(typeof e.dataLocation=="number"){l.dataLocation=e.dataLocation;break}break;case"DEFAULT":case 0:l.dataLocation=0;break;case"EXTERNAL":case 1:l.dataLocation=1;break}if(e.doubleData){if(!Array.isArray(e.doubleData))throw TypeError(".onnx.TensorProto.doubleData: array expected");l.doubleData=[];for(var s=0;s<e.doubleData.length;++s)l.doubleData[s]=Number(e.doubleData[s])}if(e.uint64Data){if(!Array.isArray(e.uint64Data))throw TypeError(".onnx.TensorProto.uint64Data: array expected");l.uint64Data=[];for(var s=0;s<e.uint64Data.length;++s)n.Long?(l.uint64Data[s]=n.Long.fromValue(e.uint64Data[s])).unsigned=!0:typeof e.uint64Data[s]=="string"?l.uint64Data[s]=parseInt(e.uint64Data[s],10):typeof e.uint64Data[s]=="number"?l.uint64Data[s]=e.uint64Data[s]:typeof e.uint64Data[s]=="object"&&(l.uint64Data[s]=new n.LongBits(e.uint64Data[s].low>>>0,e.uint64Data[s].high>>>0).toNumber(!0))}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.dims=[],s.floatData=[],s.int32Data=[],s.stringData=[],s.int64Data=[],s.doubleData=[],s.uint64Data=[],s.externalData=[]),l.defaults&&(s.dataType=0,s.segment=null,s.name="",l.bytes===String?s.rawData="":(s.rawData=[],l.bytes!==Array&&(s.rawData=n.newBuffer(s.rawData))),s.docString="",s.dataLocation=l.enums===String?"DEFAULT":0),e.dims&&e.dims.length){s.dims=[];for(var h=0;h<e.dims.length;++h)typeof e.dims[h]=="number"?s.dims[h]=l.longs===String?String(e.dims[h]):e.dims[h]:s.dims[h]=l.longs===String?n.Long.prototype.toString.call(e.dims[h]):l.longs===Number?new n.LongBits(e.dims[h].low>>>0,e.dims[h].high>>>0).toNumber():e.dims[h]}if(e.dataType!=null&&e.hasOwnProperty("dataType")&&(s.dataType=e.dataType),e.segment!=null&&e.hasOwnProperty("segment")&&(s.segment=a.onnx.TensorProto.Segment.toObject(e.segment,l)),e.floatData&&e.floatData.length){s.floatData=[];for(var h=0;h<e.floatData.length;++h)s.floatData[h]=l.json&&!isFinite(e.floatData[h])?String(e.floatData[h]):e.floatData[h]}if(e.int32Data&&e.int32Data.length){s.int32Data=[];for(var h=0;h<e.int32Data.length;++h)s.int32Data[h]=e.int32Data[h]}if(e.stringData&&e.stringData.length){s.stringData=[];for(var h=0;h<e.stringData.length;++h)s.stringData[h]=l.bytes===String?n.base64.encode(e.stringData[h],0,e.stringData[h].length):l.bytes===Array?Array.prototype.slice.call(e.stringData[h]):e.stringData[h]}if(e.int64Data&&e.int64Data.length){s.int64Data=[];for(var h=0;h<e.int64Data.length;++h)typeof e.int64Data[h]=="number"?s.int64Data[h]=l.longs===String?String(e.int64Data[h]):e.int64Data[h]:s.int64Data[h]=l.longs===String?n.Long.prototype.toString.call(e.int64Data[h]):l.longs===Number?new n.LongBits(e.int64Data[h].low>>>0,e.int64Data[h].high>>>0).toNumber():e.int64Data[h]}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.rawData!=null&&e.hasOwnProperty("rawData")&&(s.rawData=l.bytes===String?n.base64.encode(e.rawData,0,e.rawData.length):l.bytes===Array?Array.prototype.slice.call(e.rawData):e.rawData),e.doubleData&&e.doubleData.length){s.doubleData=[];for(var h=0;h<e.doubleData.length;++h)s.doubleData[h]=l.json&&!isFinite(e.doubleData[h])?String(e.doubleData[h]):e.doubleData[h]}if(e.uint64Data&&e.uint64Data.length){s.uint64Data=[];for(var h=0;h<e.uint64Data.length;++h)typeof e.uint64Data[h]=="number"?s.uint64Data[h]=l.longs===String?String(e.uint64Data[h]):e.uint64Data[h]:s.uint64Data[h]=l.longs===String?n.Long.prototype.toString.call(e.uint64Data[h]):l.longs===Number?new n.LongBits(e.uint64Data[h].low>>>0,e.uint64Data[h].high>>>0).toNumber(!0):e.uint64Data[h]}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.externalData&&e.externalData.length){s.externalData=[];for(var h=0;h<e.externalData.length;++h)s.externalData[h]=a.onnx.StringStringEntryProto.toObject(e.externalData[h],l)}return e.dataLocation!=null&&e.hasOwnProperty("dataLocation")&&(s.dataLocation=l.enums===String?a.onnx.TensorProto.DataLocation[e.dataLocation]===void 0?e.dataLocation:a.onnx.TensorProto.DataLocation[e.dataLocation]:e.dataLocation),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TensorProto"},c.DataType=function(){var e={},l=Object.create(e);return l[e[0]="UNDEFINED"]=0,l[e[1]="FLOAT"]=1,l[e[2]="UINT8"]=2,l[e[3]="INT8"]=3,l[e[4]="UINT16"]=4,l[e[5]="INT16"]=5,l[e[6]="INT32"]=6,l[e[7]="INT64"]=7,l[e[8]="STRING"]=8,l[e[9]="BOOL"]=9,l[e[10]="FLOAT16"]=10,l[e[11]="DOUBLE"]=11,l[e[12]="UINT32"]=12,l[e[13]="UINT64"]=13,l[e[14]="COMPLEX64"]=14,l[e[15]="COMPLEX128"]=15,l[e[16]="BFLOAT16"]=16,l[e[17]="FLOAT8E4M3FN"]=17,l[e[18]="FLOAT8E4M3FNUZ"]=18,l[e[19]="FLOAT8E5M2"]=19,l[e[20]="FLOAT8E5M2FNUZ"]=20,l}(),c.Segment=function(){function e(l){if(l)for(var s=Object.keys(l),h=0;h<s.length;++h)l[s[h]]!=null&&(this[s[h]]=l[s[h]])}return e.prototype.begin=n.Long?n.Long.fromBits(0,0,!1):0,e.prototype.end=n.Long?n.Long.fromBits(0,0,!1):0,e.create=function(l){return new e(l)},e.encode=function(l,s){return s||(s=u.create()),l.begin!=null&&Object.hasOwnProperty.call(l,"begin")&&s.uint32(8).int64(l.begin),l.end!=null&&Object.hasOwnProperty.call(l,"end")&&s.uint32(16).int64(l.end),s},e.encodeDelimited=function(l,s){return this.encode(l,s).ldelim()},e.decode=function(l,s){l instanceof i||(l=i.create(l));for(var h=s===void 0?l.len:l.pos+s,f=new a.onnx.TensorProto.Segment;l.pos<h;){var m=l.uint32();switch(m>>>3){case 1:{f.begin=l.int64();break}case 2:{f.end=l.int64();break}default:l.skipType(m&7);break}}return f},e.decodeDelimited=function(l){return l instanceof i||(l=new i(l)),this.decode(l,l.uint32())},e.verify=function(l){return typeof l!="object"||l===null?"object expected":l.begin!=null&&l.hasOwnProperty("begin")&&!n.isInteger(l.begin)&&!(l.begin&&n.isInteger(l.begin.low)&&n.isInteger(l.begin.high))?"begin: integer|Long expected":l.end!=null&&l.hasOwnProperty("end")&&!n.isInteger(l.end)&&!(l.end&&n.isInteger(l.end.low)&&n.isInteger(l.end.high))?"end: integer|Long expected":null},e.fromObject=function(l){if(l instanceof a.onnx.TensorProto.Segment)return l;var s=new a.onnx.TensorProto.Segment;return l.begin!=null&&(n.Long?(s.begin=n.Long.fromValue(l.begin)).unsigned=!1:typeof l.begin=="string"?s.begin=parseInt(l.begin,10):typeof l.begin=="number"?s.begin=l.begin:typeof l.begin=="object"&&(s.begin=new n.LongBits(l.begin.low>>>0,l.begin.high>>>0).toNumber())),l.end!=null&&(n.Long?(s.end=n.Long.fromValue(l.end)).unsigned=!1:typeof l.end=="string"?s.end=parseInt(l.end,10):typeof l.end=="number"?s.end=l.end:typeof l.end=="object"&&(s.end=new n.LongBits(l.end.low>>>0,l.end.high>>>0).toNumber())),s},e.toObject=function(l,s){s||(s={});var h={};if(s.defaults){if(n.Long){var f=new n.Long(0,0,!1);h.begin=s.longs===String?f.toString():s.longs===Number?f.toNumber():f}else h.begin=s.longs===String?"0":0;if(n.Long){var f=new n.Long(0,0,!1);h.end=s.longs===String?f.toString():s.longs===Number?f.toNumber():f}else h.end=s.longs===String?"0":0}return l.begin!=null&&l.hasOwnProperty("begin")&&(typeof l.begin=="number"?h.begin=s.longs===String?String(l.begin):l.begin:h.begin=s.longs===String?n.Long.prototype.toString.call(l.begin):s.longs===Number?new n.LongBits(l.begin.low>>>0,l.begin.high>>>0).toNumber():l.begin),l.end!=null&&l.hasOwnProperty("end")&&(typeof l.end=="number"?h.end=s.longs===String?String(l.end):l.end:h.end=s.longs===String?n.Long.prototype.toString.call(l.end):s.longs===Number?new n.LongBits(l.end.low>>>0,l.end.high>>>0).toNumber():l.end),h},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.getTypeUrl=function(l){return l===void 0&&(l="type.googleapis.com"),l+"/onnx.TensorProto.Segment"},e}(),c.DataLocation=function(){var e={},l=Object.create(e);return l[e[0]="DEFAULT"]=0,l[e[1]="EXTERNAL"]=1,l}(),c}(),d.SparseTensorProto=function(){function c(e){if(this.dims=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.values=null,c.prototype.indices=null,c.prototype.dims=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.values!=null&&Object.hasOwnProperty.call(e,"values")&&a.onnx.TensorProto.encode(e.values,l.uint32(10).fork()).ldelim(),e.indices!=null&&Object.hasOwnProperty.call(e,"indices")&&a.onnx.TensorProto.encode(e.indices,l.uint32(18).fork()).ldelim(),e.dims!=null&&e.dims.length){l.uint32(26).fork();for(var s=0;s<e.dims.length;++s)l.int64(e.dims[s]);l.ldelim()}return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.SparseTensorProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.values=a.onnx.TensorProto.decode(e,e.uint32());break}case 2:{h.indices=a.onnx.TensorProto.decode(e,e.uint32());break}case 3:{if(h.dims&&h.dims.length||(h.dims=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.dims.push(e.int64());else h.dims.push(e.int64());break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.values!=null&&e.hasOwnProperty("values")){var l=a.onnx.TensorProto.verify(e.values);if(l)return"values."+l}if(e.indices!=null&&e.hasOwnProperty("indices")){var l=a.onnx.TensorProto.verify(e.indices);if(l)return"indices."+l}if(e.dims!=null&&e.hasOwnProperty("dims")){if(!Array.isArray(e.dims))return"dims: array expected";for(var s=0;s<e.dims.length;++s)if(!n.isInteger(e.dims[s])&&!(e.dims[s]&&n.isInteger(e.dims[s].low)&&n.isInteger(e.dims[s].high)))return"dims: integer|Long[] expected"}return null},c.fromObject=function(e){if(e instanceof a.onnx.SparseTensorProto)return e;var l=new a.onnx.SparseTensorProto;if(e.values!=null){if(typeof e.values!="object")throw TypeError(".onnx.SparseTensorProto.values: object expected");l.values=a.onnx.TensorProto.fromObject(e.values)}if(e.indices!=null){if(typeof e.indices!="object")throw TypeError(".onnx.SparseTensorProto.indices: object expected");l.indices=a.onnx.TensorProto.fromObject(e.indices)}if(e.dims){if(!Array.isArray(e.dims))throw TypeError(".onnx.SparseTensorProto.dims: array expected");l.dims=[];for(var s=0;s<e.dims.length;++s)n.Long?(l.dims[s]=n.Long.fromValue(e.dims[s])).unsigned=!1:typeof e.dims[s]=="string"?l.dims[s]=parseInt(e.dims[s],10):typeof e.dims[s]=="number"?l.dims[s]=e.dims[s]:typeof e.dims[s]=="object"&&(l.dims[s]=new n.LongBits(e.dims[s].low>>>0,e.dims[s].high>>>0).toNumber())}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.dims=[]),l.defaults&&(s.values=null,s.indices=null),e.values!=null&&e.hasOwnProperty("values")&&(s.values=a.onnx.TensorProto.toObject(e.values,l)),e.indices!=null&&e.hasOwnProperty("indices")&&(s.indices=a.onnx.TensorProto.toObject(e.indices,l)),e.dims&&e.dims.length){s.dims=[];for(var h=0;h<e.dims.length;++h)typeof e.dims[h]=="number"?s.dims[h]=l.longs===String?String(e.dims[h]):e.dims[h]:s.dims[h]=l.longs===String?n.Long.prototype.toString.call(e.dims[h]):l.longs===Number?new n.LongBits(e.dims[h].low>>>0,e.dims[h].high>>>0).toNumber():e.dims[h]}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.SparseTensorProto"},c}(),d.TensorShapeProto=function(){function c(e){if(this.dim=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.dim=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.dim!=null&&e.dim.length)for(var s=0;s<e.dim.length;++s)a.onnx.TensorShapeProto.Dimension.encode(e.dim[s],l.uint32(10).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TensorShapeProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.dim&&h.dim.length||(h.dim=[]),h.dim.push(a.onnx.TensorShapeProto.Dimension.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dim!=null&&e.hasOwnProperty("dim")){if(!Array.isArray(e.dim))return"dim: array expected";for(var l=0;l<e.dim.length;++l){var s=a.onnx.TensorShapeProto.Dimension.verify(e.dim[l]);if(s)return"dim."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.TensorShapeProto)return e;var l=new a.onnx.TensorShapeProto;if(e.dim){if(!Array.isArray(e.dim))throw TypeError(".onnx.TensorShapeProto.dim: array expected");l.dim=[];for(var s=0;s<e.dim.length;++s){if(typeof e.dim[s]!="object")throw TypeError(".onnx.TensorShapeProto.dim: object expected");l.dim[s]=a.onnx.TensorShapeProto.Dimension.fromObject(e.dim[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.dim=[]),e.dim&&e.dim.length){s.dim=[];for(var h=0;h<e.dim.length;++h)s.dim[h]=a.onnx.TensorShapeProto.Dimension.toObject(e.dim[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TensorShapeProto"},c.Dimension=function(){function e(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}e.prototype.dimValue=null,e.prototype.dimParam=null,e.prototype.denotation="";var l;return Object.defineProperty(e.prototype,"value",{get:n.oneOfGetter(l=["dimValue","dimParam"]),set:n.oneOfSetter(l)}),e.create=function(s){return new e(s)},e.encode=function(s,h){return h||(h=u.create()),s.dimValue!=null&&Object.hasOwnProperty.call(s,"dimValue")&&h.uint32(8).int64(s.dimValue),s.dimParam!=null&&Object.hasOwnProperty.call(s,"dimParam")&&h.uint32(18).string(s.dimParam),s.denotation!=null&&Object.hasOwnProperty.call(s,"denotation")&&h.uint32(26).string(s.denotation),h},e.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},e.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TensorShapeProto.Dimension;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.dimValue=s.int64();break}case 2:{m.dimParam=s.string();break}case 3:{m.denotation=s.string();break}default:s.skipType(v&7);break}}return m},e.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},e.verify=function(s){if(typeof s!="object"||s===null)return"object expected";var h={};if(s.dimValue!=null&&s.hasOwnProperty("dimValue")&&(h.value=1,!n.isInteger(s.dimValue)&&!(s.dimValue&&n.isInteger(s.dimValue.low)&&n.isInteger(s.dimValue.high))))return"dimValue: integer|Long expected";if(s.dimParam!=null&&s.hasOwnProperty("dimParam")){if(h.value===1)return"value: multiple values";if(h.value=1,!n.isString(s.dimParam))return"dimParam: string expected"}return s.denotation!=null&&s.hasOwnProperty("denotation")&&!n.isString(s.denotation)?"denotation: string expected":null},e.fromObject=function(s){if(s instanceof a.onnx.TensorShapeProto.Dimension)return s;var h=new a.onnx.TensorShapeProto.Dimension;return s.dimValue!=null&&(n.Long?(h.dimValue=n.Long.fromValue(s.dimValue)).unsigned=!1:typeof s.dimValue=="string"?h.dimValue=parseInt(s.dimValue,10):typeof s.dimValue=="number"?h.dimValue=s.dimValue:typeof s.dimValue=="object"&&(h.dimValue=new n.LongBits(s.dimValue.low>>>0,s.dimValue.high>>>0).toNumber())),s.dimParam!=null&&(h.dimParam=String(s.dimParam)),s.denotation!=null&&(h.denotation=String(s.denotation)),h},e.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.denotation=""),s.dimValue!=null&&s.hasOwnProperty("dimValue")&&(typeof s.dimValue=="number"?f.dimValue=h.longs===String?String(s.dimValue):s.dimValue:f.dimValue=h.longs===String?n.Long.prototype.toString.call(s.dimValue):h.longs===Number?new n.LongBits(s.dimValue.low>>>0,s.dimValue.high>>>0).toNumber():s.dimValue,h.oneofs&&(f.value="dimValue")),s.dimParam!=null&&s.hasOwnProperty("dimParam")&&(f.dimParam=s.dimParam,h.oneofs&&(f.value="dimParam")),s.denotation!=null&&s.hasOwnProperty("denotation")&&(f.denotation=s.denotation),f},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TensorShapeProto.Dimension"},e}(),c}(),d.TypeProto=function(){function c(l){if(l)for(var s=Object.keys(l),h=0;h<s.length;++h)l[s[h]]!=null&&(this[s[h]]=l[s[h]])}c.prototype.tensorType=null,c.prototype.sequenceType=null,c.prototype.mapType=null,c.prototype.optionalType=null,c.prototype.sparseTensorType=null,c.prototype.denotation="";var e;return Object.defineProperty(c.prototype,"value",{get:n.oneOfGetter(e=["tensorType","sequenceType","mapType","optionalType","sparseTensorType"]),set:n.oneOfSetter(e)}),c.create=function(l){return new c(l)},c.encode=function(l,s){return s||(s=u.create()),l.tensorType!=null&&Object.hasOwnProperty.call(l,"tensorType")&&a.onnx.TypeProto.Tensor.encode(l.tensorType,s.uint32(10).fork()).ldelim(),l.sequenceType!=null&&Object.hasOwnProperty.call(l,"sequenceType")&&a.onnx.TypeProto.Sequence.encode(l.sequenceType,s.uint32(34).fork()).ldelim(),l.mapType!=null&&Object.hasOwnProperty.call(l,"mapType")&&a.onnx.TypeProto.Map.encode(l.mapType,s.uint32(42).fork()).ldelim(),l.denotation!=null&&Object.hasOwnProperty.call(l,"denotation")&&s.uint32(50).string(l.denotation),l.sparseTensorType!=null&&Object.hasOwnProperty.call(l,"sparseTensorType")&&a.onnx.TypeProto.SparseTensor.encode(l.sparseTensorType,s.uint32(66).fork()).ldelim(),l.optionalType!=null&&Object.hasOwnProperty.call(l,"optionalType")&&a.onnx.TypeProto.Optional.encode(l.optionalType,s.uint32(74).fork()).ldelim(),s},c.encodeDelimited=function(l,s){return this.encode(l,s).ldelim()},c.decode=function(l,s){l instanceof i||(l=i.create(l));for(var h=s===void 0?l.len:l.pos+s,f=new a.onnx.TypeProto;l.pos<h;){var m=l.uint32();switch(m>>>3){case 1:{f.tensorType=a.onnx.TypeProto.Tensor.decode(l,l.uint32());break}case 4:{f.sequenceType=a.onnx.TypeProto.Sequence.decode(l,l.uint32());break}case 5:{f.mapType=a.onnx.TypeProto.Map.decode(l,l.uint32());break}case 9:{f.optionalType=a.onnx.TypeProto.Optional.decode(l,l.uint32());break}case 8:{f.sparseTensorType=a.onnx.TypeProto.SparseTensor.decode(l,l.uint32());break}case 6:{f.denotation=l.string();break}default:l.skipType(m&7);break}}return f},c.decodeDelimited=function(l){return l instanceof i||(l=new i(l)),this.decode(l,l.uint32())},c.verify=function(l){if(typeof l!="object"||l===null)return"object expected";var s={};if(l.tensorType!=null&&l.hasOwnProperty("tensorType")){s.value=1;{var h=a.onnx.TypeProto.Tensor.verify(l.tensorType);if(h)return"tensorType."+h}}if(l.sequenceType!=null&&l.hasOwnProperty("sequenceType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.Sequence.verify(l.sequenceType);if(h)return"sequenceType."+h}}if(l.mapType!=null&&l.hasOwnProperty("mapType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.Map.verify(l.mapType);if(h)return"mapType."+h}}if(l.optionalType!=null&&l.hasOwnProperty("optionalType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.Optional.verify(l.optionalType);if(h)return"optionalType."+h}}if(l.sparseTensorType!=null&&l.hasOwnProperty("sparseTensorType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.SparseTensor.verify(l.sparseTensorType);if(h)return"sparseTensorType."+h}}return l.denotation!=null&&l.hasOwnProperty("denotation")&&!n.isString(l.denotation)?"denotation: string expected":null},c.fromObject=function(l){if(l instanceof a.onnx.TypeProto)return l;var s=new a.onnx.TypeProto;if(l.tensorType!=null){if(typeof l.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");s.tensorType=a.onnx.TypeProto.Tensor.fromObject(l.tensorType)}if(l.sequenceType!=null){if(typeof l.sequenceType!="object")throw TypeError(".onnx.TypeProto.sequenceType: object expected");s.sequenceType=a.onnx.TypeProto.Sequence.fromObject(l.sequenceType)}if(l.mapType!=null){if(typeof l.mapType!="object")throw TypeError(".onnx.TypeProto.mapType: object expected");s.mapType=a.onnx.TypeProto.Map.fromObject(l.mapType)}if(l.optionalType!=null){if(typeof l.optionalType!="object")throw TypeError(".onnx.TypeProto.optionalType: object expected");s.optionalType=a.onnx.TypeProto.Optional.fromObject(l.optionalType)}if(l.sparseTensorType!=null){if(typeof l.sparseTensorType!="object")throw TypeError(".onnx.TypeProto.sparseTensorType: object expected");s.sparseTensorType=a.onnx.TypeProto.SparseTensor.fromObject(l.sparseTensorType)}return l.denotation!=null&&(s.denotation=String(l.denotation)),s},c.toObject=function(l,s){s||(s={});var h={};return s.defaults&&(h.denotation=""),l.tensorType!=null&&l.hasOwnProperty("tensorType")&&(h.tensorType=a.onnx.TypeProto.Tensor.toObject(l.tensorType,s),s.oneofs&&(h.value="tensorType")),l.sequenceType!=null&&l.hasOwnProperty("sequenceType")&&(h.sequenceType=a.onnx.TypeProto.Sequence.toObject(l.sequenceType,s),s.oneofs&&(h.value="sequenceType")),l.mapType!=null&&l.hasOwnProperty("mapType")&&(h.mapType=a.onnx.TypeProto.Map.toObject(l.mapType,s),s.oneofs&&(h.value="mapType")),l.denotation!=null&&l.hasOwnProperty("denotation")&&(h.denotation=l.denotation),l.sparseTensorType!=null&&l.hasOwnProperty("sparseTensorType")&&(h.sparseTensorType=a.onnx.TypeProto.SparseTensor.toObject(l.sparseTensorType,s),s.oneofs&&(h.value="sparseTensorType")),l.optionalType!=null&&l.hasOwnProperty("optionalType")&&(h.optionalType=a.onnx.TypeProto.Optional.toObject(l.optionalType,s),s.oneofs&&(h.value="optionalType")),h},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(l){return l===void 0&&(l="type.googleapis.com"),l+"/onnx.TypeProto"},c.Tensor=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=0,l.prototype.shape=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&h.uint32(8).int32(s.elemType),s.shape!=null&&Object.hasOwnProperty.call(s,"shape")&&a.onnx.TensorShapeProto.encode(s.shape,h.uint32(18).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Tensor;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=s.int32();break}case 2:{m.shape=a.onnx.TensorShapeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")&&!n.isInteger(s.elemType))return"elemType: integer expected";if(s.shape!=null&&s.hasOwnProperty("shape")){var h=a.onnx.TensorShapeProto.verify(s.shape);if(h)return"shape."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Tensor)return s;var h=new a.onnx.TypeProto.Tensor;if(s.elemType!=null&&(h.elemType=s.elemType|0),s.shape!=null){if(typeof s.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");h.shape=a.onnx.TensorShapeProto.fromObject(s.shape)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=0,f.shape=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=s.elemType),s.shape!=null&&s.hasOwnProperty("shape")&&(f.shape=a.onnx.TensorShapeProto.toObject(s.shape,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Tensor"},l}(),c.Sequence=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&a.onnx.TypeProto.encode(s.elemType,h.uint32(10).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Sequence;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=a.onnx.TypeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")){var h=a.onnx.TypeProto.verify(s.elemType);if(h)return"elemType."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Sequence)return s;var h=new a.onnx.TypeProto.Sequence;if(s.elemType!=null){if(typeof s.elemType!="object")throw TypeError(".onnx.TypeProto.Sequence.elemType: object expected");h.elemType=a.onnx.TypeProto.fromObject(s.elemType)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=a.onnx.TypeProto.toObject(s.elemType,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Sequence"},l}(),c.Map=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.keyType=0,l.prototype.valueType=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.keyType!=null&&Object.hasOwnProperty.call(s,"keyType")&&h.uint32(8).int32(s.keyType),s.valueType!=null&&Object.hasOwnProperty.call(s,"valueType")&&a.onnx.TypeProto.encode(s.valueType,h.uint32(18).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Map;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.keyType=s.int32();break}case 2:{m.valueType=a.onnx.TypeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.keyType!=null&&s.hasOwnProperty("keyType")&&!n.isInteger(s.keyType))return"keyType: integer expected";if(s.valueType!=null&&s.hasOwnProperty("valueType")){var h=a.onnx.TypeProto.verify(s.valueType);if(h)return"valueType."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Map)return s;var h=new a.onnx.TypeProto.Map;if(s.keyType!=null&&(h.keyType=s.keyType|0),s.valueType!=null){if(typeof s.valueType!="object")throw TypeError(".onnx.TypeProto.Map.valueType: object expected");h.valueType=a.onnx.TypeProto.fromObject(s.valueType)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.keyType=0,f.valueType=null),s.keyType!=null&&s.hasOwnProperty("keyType")&&(f.keyType=s.keyType),s.valueType!=null&&s.hasOwnProperty("valueType")&&(f.valueType=a.onnx.TypeProto.toObject(s.valueType,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Map"},l}(),c.Optional=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&a.onnx.TypeProto.encode(s.elemType,h.uint32(10).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Optional;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=a.onnx.TypeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")){var h=a.onnx.TypeProto.verify(s.elemType);if(h)return"elemType."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Optional)return s;var h=new a.onnx.TypeProto.Optional;if(s.elemType!=null){if(typeof s.elemType!="object")throw TypeError(".onnx.TypeProto.Optional.elemType: object expected");h.elemType=a.onnx.TypeProto.fromObject(s.elemType)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=a.onnx.TypeProto.toObject(s.elemType,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Optional"},l}(),c.SparseTensor=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=0,l.prototype.shape=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&h.uint32(8).int32(s.elemType),s.shape!=null&&Object.hasOwnProperty.call(s,"shape")&&a.onnx.TensorShapeProto.encode(s.shape,h.uint32(18).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.SparseTensor;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=s.int32();break}case 2:{m.shape=a.onnx.TensorShapeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")&&!n.isInteger(s.elemType))return"elemType: integer expected";if(s.shape!=null&&s.hasOwnProperty("shape")){var h=a.onnx.TensorShapeProto.verify(s.shape);if(h)return"shape."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.SparseTensor)return s;var h=new a.onnx.TypeProto.SparseTensor;if(s.elemType!=null&&(h.elemType=s.elemType|0),s.shape!=null){if(typeof s.shape!="object")throw TypeError(".onnx.TypeProto.SparseTensor.shape: object expected");h.shape=a.onnx.TensorShapeProto.fromObject(s.shape)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=0,f.shape=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=s.elemType),s.shape!=null&&s.hasOwnProperty("shape")&&(f.shape=a.onnx.TensorShapeProto.toObject(s.shape,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.SparseTensor"},l}(),c}(),d.OperatorSetIdProto=function(){function c(e){if(e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.domain="",c.prototype.version=n.Long?n.Long.fromBits(0,0,!1):0,c.create=function(e){return new c(e)},c.encode=function(e,l){return l||(l=u.create()),e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(10).string(e.domain),e.version!=null&&Object.hasOwnProperty.call(e,"version")&&l.uint32(16).int64(e.version),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.OperatorSetIdProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.domain=e.string();break}case 2:{h.version=e.int64();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){return typeof e!="object"||e===null?"object expected":e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain)?"domain: string expected":e.version!=null&&e.hasOwnProperty("version")&&!n.isInteger(e.version)&&!(e.version&&n.isInteger(e.version.low)&&n.isInteger(e.version.high))?"version: integer|Long expected":null},c.fromObject=function(e){if(e instanceof a.onnx.OperatorSetIdProto)return e;var l=new a.onnx.OperatorSetIdProto;return e.domain!=null&&(l.domain=String(e.domain)),e.version!=null&&(n.Long?(l.version=n.Long.fromValue(e.version)).unsigned=!1:typeof e.version=="string"?l.version=parseInt(e.version,10):typeof e.version=="number"?l.version=e.version:typeof e.version=="object"&&(l.version=new n.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber())),l},c.toObject=function(e,l){l||(l={});var s={};if(l.defaults)if(s.domain="",n.Long){var h=new n.Long(0,0,!1);s.version=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.version=l.longs===String?"0":0;return e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),e.version!=null&&e.hasOwnProperty("version")&&(typeof e.version=="number"?s.version=l.longs===String?String(e.version):e.version:s.version=l.longs===String?n.Long.prototype.toString.call(e.version):l.longs===Number?new n.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber():e.version),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.OperatorSetIdProto"},c}(),d.OperatorStatus=function(){var c={},e=Object.create(c);return e[c[0]="EXPERIMENTAL"]=0,e[c[1]="STABLE"]=1,e}(),d.FunctionProto=function(){function c(e){if(this.input=[],this.output=[],this.attribute=[],this.attributeProto=[],this.node=[],this.opsetImport=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.name="",c.prototype.input=n.emptyArray,c.prototype.output=n.emptyArray,c.prototype.attribute=n.emptyArray,c.prototype.attributeProto=n.emptyArray,c.prototype.node=n.emptyArray,c.prototype.docString="",c.prototype.opsetImport=n.emptyArray,c.prototype.domain="",c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(10).string(e.name),e.input!=null&&e.input.length)for(var s=0;s<e.input.length;++s)l.uint32(34).string(e.input[s]);if(e.output!=null&&e.output.length)for(var s=0;s<e.output.length;++s)l.uint32(42).string(e.output[s]);if(e.attribute!=null&&e.attribute.length)for(var s=0;s<e.attribute.length;++s)l.uint32(50).string(e.attribute[s]);if(e.node!=null&&e.node.length)for(var s=0;s<e.node.length;++s)a.onnx.NodeProto.encode(e.node[s],l.uint32(58).fork()).ldelim();if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(66).string(e.docString),e.opsetImport!=null&&e.opsetImport.length)for(var s=0;s<e.opsetImport.length;++s)a.onnx.OperatorSetIdProto.encode(e.opsetImport[s],l.uint32(74).fork()).ldelim();if(e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(82).string(e.domain),e.attributeProto!=null&&e.attributeProto.length)for(var s=0;s<e.attributeProto.length;++s)a.onnx.AttributeProto.encode(e.attributeProto[s],l.uint32(90).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.FunctionProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.name=e.string();break}case 4:{h.input&&h.input.length||(h.input=[]),h.input.push(e.string());break}case 5:{h.output&&h.output.length||(h.output=[]),h.output.push(e.string());break}case 6:{h.attribute&&h.attribute.length||(h.attribute=[]),h.attribute.push(e.string());break}case 11:{h.attributeProto&&h.attributeProto.length||(h.attributeProto=[]),h.attributeProto.push(a.onnx.AttributeProto.decode(e,e.uint32()));break}case 7:{h.node&&h.node.length||(h.node=[]),h.node.push(a.onnx.NodeProto.decode(e,e.uint32()));break}case 8:{h.docString=e.string();break}case 9:{h.opsetImport&&h.opsetImport.length||(h.opsetImport=[]),h.opsetImport.push(a.onnx.OperatorSetIdProto.decode(e,e.uint32()));break}case 10:{h.domain=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var l=0;l<e.input.length;++l)if(!n.isString(e.input[l]))return"input: string[] expected"}if(e.output!=null&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(var l=0;l<e.output.length;++l)if(!n.isString(e.output[l]))return"output: string[] expected"}if(e.attribute!=null&&e.hasOwnProperty("attribute")){if(!Array.isArray(e.attribute))return"attribute: array expected";for(var l=0;l<e.attribute.length;++l)if(!n.isString(e.attribute[l]))return"attribute: string[] expected"}if(e.attributeProto!=null&&e.hasOwnProperty("attributeProto")){if(!Array.isArray(e.attributeProto))return"attributeProto: array expected";for(var l=0;l<e.attributeProto.length;++l){var s=a.onnx.AttributeProto.verify(e.attributeProto[l]);if(s)return"attributeProto."+s}}if(e.node!=null&&e.hasOwnProperty("node")){if(!Array.isArray(e.node))return"node: array expected";for(var l=0;l<e.node.length;++l){var s=a.onnx.NodeProto.verify(e.node[l]);if(s)return"node."+s}}if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.opsetImport!=null&&e.hasOwnProperty("opsetImport")){if(!Array.isArray(e.opsetImport))return"opsetImport: array expected";for(var l=0;l<e.opsetImport.length;++l){var s=a.onnx.OperatorSetIdProto.verify(e.opsetImport[l]);if(s)return"opsetImport."+s}}return e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain)?"domain: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.FunctionProto)return e;var l=new a.onnx.FunctionProto;if(e.name!=null&&(l.name=String(e.name)),e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.FunctionProto.input: array expected");l.input=[];for(var s=0;s<e.input.length;++s)l.input[s]=String(e.input[s])}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.FunctionProto.output: array expected");l.output=[];for(var s=0;s<e.output.length;++s)l.output[s]=String(e.output[s])}if(e.attribute){if(!Array.isArray(e.attribute))throw TypeError(".onnx.FunctionProto.attribute: array expected");l.attribute=[];for(var s=0;s<e.attribute.length;++s)l.attribute[s]=String(e.attribute[s])}if(e.attributeProto){if(!Array.isArray(e.attributeProto))throw TypeError(".onnx.FunctionProto.attributeProto: array expected");l.attributeProto=[];for(var s=0;s<e.attributeProto.length;++s){if(typeof e.attributeProto[s]!="object")throw TypeError(".onnx.FunctionProto.attributeProto: object expected");l.attributeProto[s]=a.onnx.AttributeProto.fromObject(e.attributeProto[s])}}if(e.node){if(!Array.isArray(e.node))throw TypeError(".onnx.FunctionProto.node: array expected");l.node=[];for(var s=0;s<e.node.length;++s){if(typeof e.node[s]!="object")throw TypeError(".onnx.FunctionProto.node: object expected");l.node[s]=a.onnx.NodeProto.fromObject(e.node[s])}}if(e.docString!=null&&(l.docString=String(e.docString)),e.opsetImport){if(!Array.isArray(e.opsetImport))throw TypeError(".onnx.FunctionProto.opsetImport: array expected");l.opsetImport=[];for(var s=0;s<e.opsetImport.length;++s){if(typeof e.opsetImport[s]!="object")throw TypeError(".onnx.FunctionProto.opsetImport: object expected");l.opsetImport[s]=a.onnx.OperatorSetIdProto.fromObject(e.opsetImport[s])}}return e.domain!=null&&(l.domain=String(e.domain)),l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.input=[],s.output=[],s.attribute=[],s.node=[],s.opsetImport=[],s.attributeProto=[]),l.defaults&&(s.name="",s.docString="",s.domain=""),e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.input&&e.input.length){s.input=[];for(var h=0;h<e.input.length;++h)s.input[h]=e.input[h]}if(e.output&&e.output.length){s.output=[];for(var h=0;h<e.output.length;++h)s.output[h]=e.output[h]}if(e.attribute&&e.attribute.length){s.attribute=[];for(var h=0;h<e.attribute.length;++h)s.attribute[h]=e.attribute[h]}if(e.node&&e.node.length){s.node=[];for(var h=0;h<e.node.length;++h)s.node[h]=a.onnx.NodeProto.toObject(e.node[h],l)}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.opsetImport&&e.opsetImport.length){s.opsetImport=[];for(var h=0;h<e.opsetImport.length;++h)s.opsetImport[h]=a.onnx.OperatorSetIdProto.toObject(e.opsetImport[h],l)}if(e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),e.attributeProto&&e.attributeProto.length){s.attributeProto=[];for(var h=0;h<e.attributeProto.length;++h)s.attributeProto[h]=a.onnx.AttributeProto.toObject(e.attributeProto[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.FunctionProto"},c}(),d}(),r.exports=a});function ur(t,r){if(!t)throw new Error(typeof r=="string"?r:r())}function kr(t){return new TextDecoder().decode(t)}var ot,Me,ai,kt,Sn,At,Rt,B,$r,Ue,Ve,ze,Y=O(()=>{wn(),qo(),ot=rr(sr()),We(),Me=class{static arraysEqual(t,r){if(t.length!==r.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==r[o])return!1;return!0}},ai=class{static preprocessInputShapes(t,r){let o=t.length===1?[1,t[0]]:t,i=r.length===1?[r[0],1]:r;return[o,i]}static postprocessOutputShape(t,r,o){r===1&&t.splice(t.length-2,1),o===1&&t.pop()}static calcMatMulShape(t,r){return t[1]!==r[0]?void 0:[t[0],r[1]]}},kt=class Oe{static calcShape(r,o,i=!1){let u=r.length,n=o.length;if(u===0)return o;if(n===0)return r;let a=Math.max(r.length,o.length),d=new Array(a);if(i){if(u<2||n<2)return;let c=ai.calcMatMulShape([r[u-2],r[u-1]],[o[n-2],o[n-1]]);if(c===void 0)return;[d[a-2],d[a-1]]=c}for(let c=i?3:1;c<=a;c++){let e=u-c<0?1:r[u-c],l=n-c<0?1:o[n-c];if(e!==l&&e>1&&l>1)return;d[a-c]=Math.max(e,l)}return d}static index(r,o){let i=new Array(o.length);return Oe.fillIndex(r,o,i),i}static fillIndex(r,o,i){let u=r.length-o.length;for(let n=0;n<o.length;n++)i[n]=r[u+n]%o[n]}static calc(r,o,i,u,n){let a=Oe.calcShape(r.dims,o.dims);if(a){if(u&&!B.areEqual(a,r.dims))return;let d=B.size(a),c=u?r:new bt(a,n||r.type);if(a.length===0)c.set([],i(r.get([]),o.get([])));else{let e=new Array(a.length),l=new Array(r.dims.length),s=new Array(o.dims.length),h=0,f=0,m=!1,v=!1;r.dims.length===0&&(h=r.get([]),m=!0),o.dims.length===0&&(f=o.get([]),v=!0);let _;for(let I=0;I<d;I++){_=I;for(let T=a.length-1;T>=0;T--)e[T]=_%a[T],_=Math.floor(_/a[T]);m||(Oe.fillIndex(e,r.dims,l),h=r.get(l)),v||(Oe.fillIndex(e,o.dims,s),f=o.get(s)),c.set(e,i(h,f))}}return c}}static isValidBroadcast(r,o){let i=r.length,u=o.length;if(i>u)return!1;for(let n=1;n<=i;n++)if(r[i-n]!==1&&r[i-n]!==o[u-n])return!1;return!0}static getBroadcastDims(r,o){let i=r.length,u=[];for(let n=0;n<i;n++){let a=i-1-n,d=r[a]||1;(o[o.length-1-n]||1)>1&&d===1&&u.unshift(a)}return u}},Sn=class{static getShapeOfGemmResult(t,r,o,i,u){if(t.length!==2||o.length!==2)throw new Error("shape need to be of size 2");let n,a,d;r?(n=t[1],a=t[0]):(n=t[0],a=t[1]);let c=-1;if(i?(d=o[0],c=1):(d=o[1],c=0),o[c]!==a)throw new Error("dimension mismatch");if(n<=0||d<=0||a<=0)throw new Error("invalid shape specified");if(u&&!kt.isValidBroadcast(u,[n,d]))throw new Error("gemm: invalid bias shape for broadcast");return[n,d,a]}},At=class nn{static tensorDataTypeFromProto(r){switch(r){case ot.onnx.TensorProto.DataType.INT8:return"int8";case ot.onnx.TensorProto.DataType.UINT8:return"uint8";case ot.onnx.TensorProto.DataType.BOOL:return"bool";case ot.onnx.TensorProto.DataType.INT16:return"int16";case ot.onnx.TensorProto.DataType.UINT16:return"uint16";case ot.onnx.TensorProto.DataType.INT32:return"int32";case ot.onnx.TensorProto.DataType.UINT32:return"uint32";case ot.onnx.TensorProto.DataType.FLOAT:return"float32";case ot.onnx.TensorProto.DataType.DOUBLE:return"float64";case ot.onnx.TensorProto.DataType.STRING:return"string";case ot.onnx.TensorProto.DataType.INT64:return"int32";case ot.onnx.TensorProto.DataType.UINT64:return"uint32";default:throw new Error(`unsupported data type: ${ot.onnx.TensorProto.DataType[r]}`)}}static tensorDataTypeStringToEnum(r){switch(r){case"int8":return ot.onnx.TensorProto.DataType.INT8;case"uint8":return ot.onnx.TensorProto.DataType.UINT8;case"bool":return ot.onnx.TensorProto.DataType.BOOL;case"int16":return ot.onnx.TensorProto.DataType.INT16;case"uint16":return ot.onnx.TensorProto.DataType.UINT16;case"int32":return ot.onnx.TensorProto.DataType.INT32;case"uint32":return ot.onnx.TensorProto.DataType.UINT32;case"float32":return ot.onnx.TensorProto.DataType.FLOAT;case"float64":return ot.onnx.TensorProto.DataType.DOUBLE;case"string":return ot.onnx.TensorProto.DataType.STRING;case"int64":return ot.onnx.TensorProto.DataType.INT64;case"uint64":return ot.onnx.TensorProto.DataType.UINT64;default:throw new Error(`unsupported data type: ${r}`)}}static tensorDimsFromProto(r){return r.map(o=>xe.isLong(o)?o.toNumber():o)}static tensorValueTypeFromProto(r){return{tensorType:nn.tensorDataTypeFromProto(r.elemType),shape:{dims:nn.tensorDimsFromProto(r.shape.dim.map(o=>o.dimValue))}}}static tensorDimsFromORTFormat(r){let o=[];for(let i=0;i<r.dimsLength();i++)o.push(Rt.longToNumber(r.dims(i)));return o}static tensorAttributesFromORTFormat(r){let o=[];for(let i=0;i<r.attributesLength();i++)o.push(r.attributes(i));return o}},Rt=class{static longToNumber(t,r){return xe.isLong(t)?t.toNumber():t instanceof w.Long?xe.fromValue({low:t.low,high:t.high,unsigned:r??!1}).toNumber():t}static isLong(t){return xe.isLong(t)||t instanceof w.Long}},B=class re{static size(r){return re.getSizeFromDimensionRange(r,0,r.length)}static sizeFromDimension(r,o){if(o<0||o>r.length)throw new Error(`invalid dimension of ${o} for sizeFromDimension as Tensor has ${r.length} dimensions.`);return re.getSizeFromDimensionRange(r,o,r.length)}static sizeToDimension(r,o){if(o<0||o>r.length)throw new Error(`invalid dimension of ${o} for sizeToDimension as Tensor has ${r.length} dimensions.`);return re.getSizeFromDimensionRange(r,0,o)}static getSizeFromDimensionRange(r,o,i){let u=1;for(let n=o;n<i;n++){if(r[n]<=0)throw new Error("cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.");u*=r[n]}return u}static computeStrides(r){let o=r.length;if(o===0)return[];if(o===1)return[1];let i=new Array(o);i[o-1]=1,i[o-2]=r[o-1];for(let u=o-3;u>=0;--u)i[u]=i[u+1]*r[u+1];return i}static transpose(r){return r.slice().reverse()}static indicesToOffset(r,o,i){i===void 0&&(i=r.length);let u=0;for(let n=0;n<i;++n)u+=o[n]*r[n];return u}static offsetToIndices(r,o){let i=o.length;if(i===0)return[];if(i===1)return[r*o[0]];let u=new Array(o.length);for(let n=0;n<u.length-1;++n)u[n]=Math.floor(r/o[n]),r-=u[n]*o[n];return u[u.length-1]=r,u}static normalizeAxis(r,o){if(r<-o&&r>=o)throw new Error("unsupported axis for this operation.");return r<0?r+o:r}static normalizeAxes(r,o){return r.map(i=>this.normalizeAxis(i,o))}static incrementIndex(r,o,i){if(o.length===0||r.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(i===void 0)i=o.length;else if(i<=0||i>o.length)throw new Error("Incorrect axis to increment on");for(let u=i-1;u>=0&&(r[u]++,!(r[u]<o[u]));--u)r[u]=0}static calculateReshapedDims(r,o){if(o.length===0){if(r.length===0||re.size(r)===1)return[];throw new Error("cannot reshape to a scalar Tensor")}let i=o.length,u=new Array(i),n=-1,a=1;for(let c=0;c<i;c++){if(o[c]<-1)throw new Error("a dimension in shape hints cannot be less than -1");if(o[c]===-1){if(n!==-1)throw new Error("at most one dimension in shape hints can be -1");n=c}else{if(o[c]===0){if(c>=r.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");u[c]=r[c]}else u[c]=o[c];a*=u[c]}}let d=re.size(r);if(n!==-1){if(d%a!==0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${r}] Output shape: [${o}]`);u[n]=d/a}else if(a!==d)throw new Error("reshapedDims and originalDims don't have matching sizes");return u}static sortBasedOnPerm(r,o){return o?o.map(i=>r[i]):r.slice().reverse()}static padShape(r,o){let i=r.length;return r.map((u,n)=>u+o[n]+o[n+i])}static areEqual(r,o){return r.length!==o.length?!1:r.every((i,u)=>i===o[u])}static validateDimsAndCalcSize(r){if(r.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let o=1;for(let i of r){if(!Number.isInteger(i))throw new TypeError(`Invalid shape: ${i} is not an integer`);if(i<0||i>2147483647)throw new TypeError(`Invalid shape: length ${i} is not allowed`);o*=i}return o}static flattenShape(r,o){o<0&&(o+=r.length);let i=r.reduce((n,a)=>n*a,1),u=r.slice(o).reduce((n,a)=>n*a,1);return[i/u,u]}static squeezeShape(r,o){let i=new Array;o=re.normalizeAxes(o,r.length);for(let u=0;u<r.length;u++){let n=o.indexOf(u)>=0;if(n&&r[u]!==1)throw new Error("squeeze an axis of size different than 1");(o.length===0&&r[u]>1||o.length>0&&!n)&&i.push(r[u])}return i}static unsqueezeShape(r,o){let i=new Array(r.length+o.length);i.fill(0);for(let n=0;n<o.length;n++){let a=re.normalizeAxis(o[n],i.length);if(a>=i.length)throw new Error("'axes' has an out of range axis");if(i[a]!==0)throw new Error("'axes' has a duplicate axis");i[a]=1}let u=0;for(let n=0;n<i.length;n++)i[n]===0&&(i[n]=r[u++]);if(u!==r.length)throw new Error("the unsqueezed dimension could not be established");return i}},$r=class Ia{static splitShape(r,o,i,u){if(i.length===0){if(!u)throw new Error("need to know number of outputs when the 'split' attribute is not specified");Ia.determineSplit(r[o],u,i)}let n=[],a=[0];for(let d=0;d<i.length;++d){d!==0&&a.push(a[d-1]+i[d-1]);let c=r.slice();c[o]=i[d],n.push(c)}return[n,a]}static determineSplit(r,o,i){if(r%o!==0)throw new Error("cannot split tensor to equal sized parts");for(let u=0;u<o;++u)i.push(r/o)}},Ue=class Ie{static adjustPoolAttributes(r,o,i,u,n,a){if(!r&&i.length!==o.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(r)for(let d=0;d<o.length-2;d++)d>=i.length?i.push(o[d+2]):i[d]=o[d+2];for(let d=0;d<i.length;d++)if(d<u.length){if(u[d]<0)throw new Error("strides should be greater than or equal to 1")}else u.push(1);for(let d=0;d<i.length;d++)if(d<n.length){if(n[d]<0)throw new Error("dilations should be greater than or equal to 1")}else n.push(1);for(let d=0;d<i.length*2;d++)if(d<a.length){if(a[d]<0)throw new Error("pad should be greater than or equal to 1")}else a.push(0);for(let d=0;d<i.length;d++){if(i[d]<=0)throw new Error("kernel shapes need to be greater than 0");if(a[d]>=i[d]||a[d+i.length]>=i[d])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(r,o,i,u,n,a){if(a){if(n.length!==2*(r.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(o.length!==r.length-2)throw new Error("length of strides should be the length of data dimensions");if(u.length!==r.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let d=0;d<r.length-2;d++)Ie.adjustPadAndReturnShape(r[d+2],o[d],i[d],u[d],n,d,d+r.length-2,a)}}static computePoolOutputShape(r,o,i,u,n,a,d){if(o.length<=0)throw new Error("input shape must be of size greater than 0");let c=[o[0],o[1]];return Ie.computeShapeHelper(r,o,c,i,u,n,a,d),c}static computeConvOutputShape(r,o,i,u,n,a,d){if(r.length<=0||o.length<=0)throw new Error("invalid input tensor dims or invalid filter tensor dims");let c=[r[0],o[0]];return Ie.computeShapeHelper(!1,r,c,i,u,n,a,d),c}static computeShapeHelper(r,o,i,u,n,a,d,c){if(r)for(let e=0;e<o.length-2;e++)i.push(1);else for(let e=0;e<o.length-2;e++)i.push(Ie.adjustPadAndReturnShape(o[e+2],u[e],n[e],a[e],d,e,e+o.length-2,c))}static adjustPadAndReturnShape(r,o,i,u,n,a,d,c){let e=i*(u-1)+1;if(c&&c!=="NOTSET")switch(c){case"VALID":return n[a]=0,n[d]=0,Math.floor((r-e)/o+1);case"SAME_LOWER":case"SAME_UPPER":if(i!==1)throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{let l=((r+o-1)/o-1)*o+u-r;return n[a]=Math.floor(c==="SAME_LOWER"?(l+1)/2:l/2),n[d]=l-n[a],Math.floor((r+l-u)/o+1)}default:throw new Error("Unsupported AutoPad type")}else return Math.floor((r+n[a]+n[d]-e)/o+1)}},Ve=-34028234663852886e22,ze=34028234663852886e22});function hh(t){switch(t){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${t}`)}}function Wu(t){switch(t){case H.onnx.TensorProto.DataType.UINT8:case H.onnx.TensorProto.DataType.INT8:case H.onnx.TensorProto.DataType.BOOL:return 1;case H.onnx.TensorProto.DataType.UINT16:case H.onnx.TensorProto.DataType.INT16:return 2;case H.onnx.TensorProto.DataType.FLOAT:case H.onnx.TensorProto.DataType.INT32:case H.onnx.TensorProto.DataType.UINT32:return 4;case H.onnx.TensorProto.DataType.INT64:case H.onnx.TensorProto.DataType.DOUBLE:case H.onnx.TensorProto.DataType.UINT64:return 8;default:throw new Error(`cannot calculate sizeof() on type ${H.onnx.TensorProto.DataType[t]}`)}}function mh(t,r){return new(ju(r))(t)}function ju(t){switch(t){case"bool":case"uint8":return Uint8Array;case"int8":return Int8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"float32":return Float32Array;case"float64":return Float64Array;default:throw new Error("unspecified error")}}function ui(t,r){if(r===H.onnx.TensorProto.DataType.INT64||r===si.TensorDataType.INT64){if(t.greaterThanOrEqual(2147483648)||t.lessThan(-2147483648))throw new TypeError("int64 is not supported")}else if(r===H.onnx.TensorProto.DataType.UINT32||r===si.TensorDataType.UINT32||r===H.onnx.TensorProto.DataType.UINT64||r===si.TensorDataType.UINT64){if(t.greaterThanOrEqual(4294967296)||t.lessThan(0))throw new TypeError("uint64 is not supported")}else throw new TypeError(`not a LONG type: ${H.onnx.TensorProto.DataType[r]}`);return t.toNumber()}function Hu(t,r,o){switch(r){case H.onnx.TensorProto.DataType.BOOL:case H.onnx.TensorProto.DataType.UINT8:return t.getUint8(o);case H.onnx.TensorProto.DataType.INT8:return t.getInt8(o);case H.onnx.TensorProto.DataType.UINT16:return t.getUint16(o,!0);case H.onnx.TensorProto.DataType.INT16:return t.getInt16(o,!0);case H.onnx.TensorProto.DataType.FLOAT:return t.getFloat32(o,!0);case H.onnx.TensorProto.DataType.INT32:return t.getInt32(o,!0);case H.onnx.TensorProto.DataType.UINT32:return t.getUint32(o,!0);case H.onnx.TensorProto.DataType.INT64:return ui(xe.fromBits(t.getUint32(o,!0),t.getUint32(o+4,!0),!1),r);case H.onnx.TensorProto.DataType.DOUBLE:return t.getFloat64(o,!0);case H.onnx.TensorProto.DataType.UINT64:return ui(xe.fromBits(t.getUint32(o,!0),t.getUint32(o+4,!0),!0),r);default:throw new Error(`cannot read from DataView for type ${H.onnx.TensorProto.DataType[r]}`)}}var qu,H,si,bt,We=O(()=>{qu=rr(Fs()),qo(),Pr(),H=rr(sr()),Y(),si=F.experimental.fbs,bt=class vr{constructor(r,o,i,u,n,a=qu.Guid.create()){this.dims=r,this.type=o,this.dataProvider=i,this.asyncDataProvider=u,this.cache=n,this.dataId=a,this.size=B.validateDimsAndCalcSize(r);let d=this.size,c=i===void 0&&u===void 0&&n===void 0;if(n!==void 0&&n.length!==d)throw new RangeError("Input dims doesn't match data length.");if(o==="string"){if(n!==void 0&&(!Array.isArray(n)||!n.every(e=>typeof e=="string")))throw new TypeError("cache should be a string array");c&&(this.cache=new Array(d))}else{if(n!==void 0){let e=ju(o);if(!(n instanceof e))throw new TypeError(`cache should be type ${e.name}`)}if(c){let e=new ArrayBuffer(d*hh(o));this.cache=mh(e,o)}}}get data(){if(this.cache===void 0){let r=this.dataProvider(this.dataId);if(r.length!==this.size)throw new Error("Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.");this.cache=r}return this.cache}get stringData(){if(this.type!=="string")throw new TypeError("data type is not string");return this.data}get integerData(){switch(this.type){case"uint8":case"int8":case"uint16":case"int16":case"int32":case"uint32":case"bool":return this.data;default:throw new TypeError("data type is not integer (uint8, int8, uint16, int16, int32, uint32, bool)")}}get floatData(){switch(this.type){case"float32":case"float64":return this.data;default:throw new TypeError("data type is not float (float32, float64)")}}get numberData(){if(this.type!=="string")return this.data;throw new TypeError("type cannot be non-number (string)")}get(r){return this.data[B.indicesToOffset(r,this.strides)]}set(r,o){this.data[B.indicesToOffset(r,this.strides)]=o}async getData(){return this.cache===void 0&&(this.cache=await this.asyncDataProvider(this.dataId)),this.cache}get strides(){return this._strides||(this._strides=B.computeStrides(this.dims)),this._strides}static fromProto(r){if(!r)throw new Error("cannot construct Value from an empty tensor");let o=At.tensorDataTypeFromProto(r.dataType),i=At.tensorDimsFromProto(r.dims),u=new vr(i,o);if(o==="string")r.stringData.forEach((n,a)=>{u.data[a]=kr(n)});else if(r.rawData&&typeof r.rawData.byteLength=="number"&&r.rawData.byteLength>0){let n=u.data,a=new DataView(r.rawData.buffer,r.rawData.byteOffset,r.rawData.byteLength),d=Wu(r.dataType),c=r.rawData.byteLength/d;if(r.rawData.byteLength%d!==0)throw new Error("invalid buffer length");if(n.length!==c)throw new Error("buffer length mismatch");for(let e=0;e<c;e++){let l=Hu(a,r.dataType,e*d);n[e]=l}}else{let n;switch(r.dataType){case H.onnx.TensorProto.DataType.FLOAT:n=r.floatData;break;case H.onnx.TensorProto.DataType.INT32:case H.onnx.TensorProto.DataType.INT16:case H.onnx.TensorProto.DataType.UINT16:case H.onnx.TensorProto.DataType.INT8:case H.onnx.TensorProto.DataType.UINT8:case H.onnx.TensorProto.DataType.BOOL:n=r.int32Data;break;case H.onnx.TensorProto.DataType.INT64:n=r.int64Data;break;case H.onnx.TensorProto.DataType.DOUBLE:n=r.doubleData;break;case H.onnx.TensorProto.DataType.UINT32:case H.onnx.TensorProto.DataType.UINT64:n=r.uint64Data;break;default:throw new Error("unspecific error")}if(n==null)throw new Error("failed to populate data from a tensorproto value");let a=u.data;if(a.length!==n.length)throw new Error("array length mismatch");for(let d=0;d<n.length;d++){let c=n[d];xe.isLong(c)?a[d]=ui(c,r.dataType):a[d]=c}}return u}static fromData(r,o,i){return new vr(o,i,void 0,void 0,r)}static fromOrtTensor(r){if(!r)throw new Error("cannot construct Value from an empty tensor");let o=At.tensorDimsFromORTFormat(r),i=At.tensorDataTypeFromProto(r.dataType()),u=new vr(o,i);if(i==="string")for(let n=0;n<r.stringDataLength();n++)u.data[n]=r.stringData(n);else if(r.rawDataArray()&&typeof r.rawDataLength()=="number"&&r.rawDataLength()>0){let n=u.data,a=new DataView(r.rawDataArray().buffer,r.rawDataArray().byteOffset,r.rawDataLength()),d=Wu(r.dataType()),c=r.rawDataLength()/d;if(r.rawDataLength()%d!==0)throw new Error("invalid buffer length");if(n.length!==c)throw new Error("buffer length mismatch");for(let e=0;e<c;e++){let l=Hu(a,r.dataType(),e*d);n[e]=l}}return u}}});function G(t){return t===1?bh:gh}function Xu(t){let r=G(t);return`${r.version}
|
|
10
|
+
*/var Hd=Object.create,an=Object.defineProperty,qd=Object.getOwnPropertyDescriptor,jd=Object.getOwnPropertyNames,Xd=Object.getPrototypeOf,Kd=Object.prototype.hasOwnProperty,Co=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(r,o)=>(typeof require<"u"?require:r)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),O=(t,r)=>()=>(t&&(r=t(t=0)),r),mt=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),Or=(t,r)=>{for(var o in r)an(t,o,{get:r[o],enumerable:!0})},Qa=(t,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of jd(r))!Kd.call(t,u)&&u!==o&&an(t,u,{get:()=>r[u],enumerable:!(i=qd(r,u))||i.enumerable});return t},rr=(t,r,o)=>(o=t!=null?Hd(Xd(t)):{},Qa(!t||!t.__esModule?an(o,"default",{value:t,enumerable:!0}):o,t)),sn=t=>Qa(an({},"__esModule",{value:!0}),t),un,ke,nr,Jd,ln,fn=O(()=>{un=new Map,ke=[],nr=(t,r,o)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let i=un.get(t);if(i===void 0)un.set(t,{backend:r,priority:o});else{if(i.priority>o)return;if(i.priority===o&&i.backend!==r)throw new Error(`cannot register backend "${t}" using priority ${o}`)}if(o>=0){let u=ke.indexOf(t);u!==-1&&ke.splice(u,1);for(let n=0;n<ke.length;n++)if(un.get(ke[n]).priority<=o){ke.splice(n,0,t);return}ke.push(t)}return}throw new TypeError("not a valid backend")},Jd=async t=>{let r=un.get(t);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let o=!!r.initPromise;try{return o||(r.initPromise=r.backend.init(t)),await r.initPromise,r.initialized=!0,r.backend}catch(i){return o||(r.error=`${i}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},ln=async t=>{let r=t.executionProviders||[],o=r.map(c=>typeof c=="string"?c:c.name),i=o.length===0?ke:o,u,n=[],a=new Set;for(let c of i){let e=await Jd(c);typeof e=="string"?n.push({name:c,err:e}):(u||(u=e),u===e&&a.add(c))}if(!u)throw new Error(`no available backend found. ERR: ${n.map(c=>`[${c.name}] ${c.err}`).join(", ")}`);for(let{name:c,err:e}of n)o.includes(c)&&console.warn(`removing requested execution provider "${c}" from session options because it is not available: ${e}`);let d=r.filter(c=>a.has(typeof c=="string"?c:c.name));return[u,new Proxy(t,{get:(c,e)=>e==="executionProviders"?d:Reflect.get(c,e)})]}}),ts=O(()=>{fn()}),es,rs=O(()=>{es="1.20.1"}),ns,Gt,No=O(()=>{rs(),ns="warning",Gt={wasm:{},webgl:{},webgpu:{},versions:{common:es},set logLevel(t){if(t!==void 0){if(typeof t!="string"||["verbose","info","warning","error","fatal"].indexOf(t)===-1)throw new Error(`Unsupported logging level: ${t}`);ns=t}},get logLevel(){return ns}},Object.defineProperty(Gt,"logLevel",{enumerable:!0})}),z,os=O(()=>{No(),z=Gt}),is,as,ss=O(()=>{is=(t,r)=>{let o=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);o.width=t.dims[3],o.height=t.dims[2];let i=o.getContext("2d");if(i!=null){let u,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(u=t.dims[2],n=t.dims[3]):(u=t.dims[3],n=t.dims[2]);let a=(r==null?void 0:r.format)!==void 0?r.format:"RGB",d=r==null?void 0:r.norm,c,e;d===void 0||d.mean===void 0?c=[255,255,255,255]:typeof d.mean=="number"?c=[d.mean,d.mean,d.mean,d.mean]:(c=[d.mean[0],d.mean[1],d.mean[2],0],d.mean[3]!==void 0&&(c[3]=d.mean[3])),d===void 0||d.bias===void 0?e=[0,0,0,0]:typeof d.bias=="number"?e=[d.bias,d.bias,d.bias,d.bias]:(e=[d.bias[0],d.bias[1],d.bias[2],0],d.bias[3]!==void 0&&(e[3]=d.bias[3]));let l=n*u,s=0,h=l,f=l*2,m=-1;a==="RGBA"?(s=0,h=l,f=l*2,m=l*3):a==="RGB"?(s=0,h=l,f=l*2):a==="RBG"&&(s=0,f=l,h=l*2);for(let v=0;v<n;v++)for(let _=0;_<u;_++){let I=(t.data[s++]-e[0])*c[0],T=(t.data[h++]-e[1])*c[1],P=(t.data[f++]-e[2])*c[2],C=m===-1?255:(t.data[m++]-e[3])*c[3];i.fillStyle="rgba("+I+","+T+","+P+","+C+")",i.fillRect(_,v,1,1)}if("toDataURL"in o)return o.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},as=(t,r)=>{let o=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),i;if(o!=null){let u,n,a;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(u=t.dims[2],n=t.dims[1],a=t.dims[3]):(u=t.dims[3],n=t.dims[2],a=t.dims[1]);let d=r!==void 0&&r.format!==void 0?r.format:"RGB",c=r==null?void 0:r.norm,e,l;c===void 0||c.mean===void 0?e=[255,255,255,255]:typeof c.mean=="number"?e=[c.mean,c.mean,c.mean,c.mean]:(e=[c.mean[0],c.mean[1],c.mean[2],255],c.mean[3]!==void 0&&(e[3]=c.mean[3])),c===void 0||c.bias===void 0?l=[0,0,0,0]:typeof c.bias=="number"?l=[c.bias,c.bias,c.bias,c.bias]:(l=[c.bias[0],c.bias[1],c.bias[2],0],c.bias[3]!==void 0&&(l[3]=c.bias[3]));let s=n*u;if(r!==void 0&&(r.format!==void 0&&a===4&&r.format!=="RGBA"||a===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let h=4,f=0,m=1,v=2,_=3,I=0,T=s,P=s*2,C=-1;d==="RGBA"?(I=0,T=s,P=s*2,C=s*3):d==="RGB"?(I=0,T=s,P=s*2):d==="RBG"&&(I=0,P=s,T=s*2),i=o.createImageData(u,n);for(let R=0;R<n*u;f+=h,m+=h,v+=h,_+=h,R++)i.data[f]=(t.data[I++]-l[0])*e[0],i.data[m]=(t.data[T++]-l[1])*e[1],i.data[v]=(t.data[P++]-l[2])*e[2],i.data[_]=C===-1?255:(t.data[C++]-l[3])*e[3]}else throw new Error("Can not access image data");return i}}),Ro,us,ls,fs,cs,ps,ds=O(()=>{cn(),Ro=(t,r)=>{if(t===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:o,width:i}=r,u=r.norm??{mean:255,bias:0},n,a;typeof u.mean=="number"?n=[u.mean,u.mean,u.mean,u.mean]:n=[u.mean[0],u.mean[1],u.mean[2],u.mean[3]??255],typeof u.bias=="number"?a=[u.bias,u.bias,u.bias,u.bias]:a=[u.bias[0],u.bias[1],u.bias[2],u.bias[3]??0];let d=r.format!==void 0?r.format:"RGBA",c=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",e=o*i,l=c==="RGBA"?new Float32Array(e*4):new Float32Array(e*3),s=4,h=0,f=1,m=2,v=3,_=0,I=e,T=e*2,P=-1;d==="RGB"&&(s=3,h=0,f=1,m=2,v=-1),c==="RGBA"?P=e*3:c==="RBG"?(_=0,T=e,I=e*2):c==="BGR"&&(T=0,I=e,_=e*2);for(let C=0;C<e;C++,h+=s,m+=s,f+=s,v+=s)l[_++]=(t[h]+a[0])/n[0],l[I++]=(t[f]+a[1])/n[1],l[T++]=(t[m]+a[2])/n[2],P!==-1&&v!==-1&&(l[P++]=(t[v]+a[3])/n[3]);return c==="RGBA"?new St("float32",l,[1,4,o,i]):new St("float32",l,[1,3,o,i])},us=async(t,r)=>{let o=typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement,i=typeof ImageData<"u"&&t instanceof ImageData,u=typeof ImageBitmap<"u"&&t instanceof ImageBitmap,n=typeof t=="string",a,d=r??{},c=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},e=l=>typeof HTMLCanvasElement<"u"&&l instanceof HTMLCanvasElement||l instanceof OffscreenCanvas?l.getContext("2d"):null;if(o){let l=c();l.width=t.width,l.height=t.height;let s=e(l);if(s!=null){let h=t.height,f=t.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(h=r.resizedHeight,f=r.resizedWidth),r!==void 0){if(d=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");d.tensorFormat="RGBA",d.height=h,d.width=f}else d.tensorFormat="RGBA",d.height=h,d.width=f;s.drawImage(t,0,0),a=s.getImageData(0,0,f,h).data}else throw new Error("Can not access image data")}else if(i){let l,s;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(l=r.resizedHeight,s=r.resizedWidth):(l=t.height,s=t.width),r!==void 0&&(d=r),d.format="RGBA",d.height=l,d.width=s,r!==void 0){let h=c();h.width=s,h.height=l;let f=e(h);if(f!=null)f.putImageData(t,0,0),a=f.getImageData(0,0,s,l).data;else throw new Error("Can not access image data")}else a=t.data}else if(u){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let l=c();l.width=t.width,l.height=t.height;let s=e(l);if(s!=null){let h=t.height,f=t.width;return s.drawImage(t,0,0,f,h),a=s.getImageData(0,0,f,h).data,d.height=h,d.width=f,Ro(a,d)}else throw new Error("Can not access image data")}else{if(n)return new Promise((l,s)=>{let h=c(),f=e(h);if(!t||!f)return s();let m=new Image;m.crossOrigin="Anonymous",m.src=t,m.onload=()=>{h.width=m.width,h.height=m.height,f.drawImage(m,0,0,h.width,h.height);let v=f.getImageData(0,0,h.width,h.height);d.height=h.height,d.width=h.width,l(Ro(v.data,d))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(a!==void 0)return Ro(a,d);throw new Error("Input data provided is not supported - aborted tensor creation")},ls=(t,r)=>{let{width:o,height:i,download:u,dispose:n}=r,a=[1,i,o,4];return new St({location:"texture",type:"float32",texture:t,dims:a,download:u,dispose:n})},fs=(t,r)=>{let{dataType:o,dims:i,download:u,dispose:n}=r;return new St({location:"gpu-buffer",type:o??"float32",gpuBuffer:t,dims:i,download:u,dispose:n})},cs=(t,r)=>{let{dataType:o,dims:i,download:u,dispose:n}=r;return new St({location:"ml-tensor",type:o??"float32",mlTensor:t,dims:i,download:u,dispose:n})},ps=(t,r,o)=>new St({location:"cpu-pinned",type:t,data:r,dims:o??[r.length]})}),Be,Sr,hs,ms,bs=O(()=>{Be=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Sr=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),hs=!1,ms=()=>{if(!hs){hs=!0;let t=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,o=typeof Float16Array<"u"&&Float16Array.from;t&&(Be.set("int64",BigInt64Array),Sr.set(BigInt64Array,"int64")),r&&(Be.set("uint64",BigUint64Array),Sr.set(BigUint64Array,"uint64")),o?(Be.set("float16",Float16Array),Sr.set(Float16Array,"float16")):Be.set("float16",Uint16Array)}}}),gs,ys,xs=O(()=>{cn(),gs=t=>{let r=1;for(let o=0;o<t.length;o++){let i=t[o];if(typeof i!="number"||!Number.isSafeInteger(i))throw new TypeError(`dims[${o}] must be an integer, got: ${i}`);if(i<0)throw new RangeError(`dims[${o}] must be a non-negative integer, got: ${i}`);r*=i}return r},ys=(t,r)=>{switch(t.location){case"cpu":return new St(t.type,t.data,r);case"cpu-pinned":return new St({location:"cpu-pinned",data:t.data,type:t.type,dims:r});case"texture":return new St({location:"texture",texture:t.texture,type:t.type,dims:r});case"gpu-buffer":return new St({location:"gpu-buffer",gpuBuffer:t.gpuBuffer,type:t.type,dims:r});case"ml-tensor":return new St({location:"ml-tensor",mlTensor:t.mlTensor,type:t.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${t.location} is not supported`)}}}),St,cn=O(()=>{ss(),ds(),bs(),xs(),St=class{constructor(t,r,o){ms();let i,u;if(typeof t=="object"&&"location"in t)switch(this.dataLocation=t.location,i=t.type,u=t.dims,t.location){case"cpu-pinned":{let a=Be.get(i);if(!a)throw new TypeError(`unsupported type "${i}" to create tensor from pinned buffer`);if(!(t.data instanceof a))throw new TypeError(`buffer should be of type ${a.name}`);this.cpuData=t.data;break}case"texture":{if(i!=="float32")throw new TypeError(`unsupported type "${i}" to create tensor from texture`);this.gpuTextureData=t.texture,this.downloader=t.download,this.disposer=t.dispose;break}case"gpu-buffer":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from gpu buffer`);this.gpuBufferData=t.gpuBuffer,this.downloader=t.download,this.disposer=t.dispose;break}case"ml-tensor":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint64"&&i!=="int8"&&i!=="uint8"&&i!=="bool")throw new TypeError(`unsupported type "${i}" to create tensor from MLTensor`);this.mlTensorData=t.mlTensor,this.downloader=t.download,this.disposer=t.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,d;if(typeof t=="string")if(i=t,d=o,t==="string"){if(!Array.isArray(r))throw new TypeError("A string tensor's data must be a string array.");a=r}else{let c=Be.get(t);if(c===void 0)throw new TypeError(`Unsupported tensor type: ${t}.`);if(Array.isArray(r)){if(t==="float16"&&c===Uint16Array||t==="uint4"||t==="int4")throw new TypeError(`Creating a ${t} tensor from number array is not supported. Please use ${c.name} as data.`);t==="uint64"||t==="int64"?a=c.from(r,BigInt):a=c.from(r)}else if(r instanceof c)a=r;else if(r instanceof Uint8ClampedArray)if(t==="uint8")a=Uint8Array.from(r);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else throw new TypeError(`A ${i} tensor's data must be type of ${c}`)}else if(d=r,Array.isArray(t)){if(t.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let c=typeof t[0];if(c==="string")i="string",a=t;else if(c==="boolean")i="bool",a=Uint8Array.from(t);else throw new TypeError(`Invalid element type of data array: ${c}.`)}else if(t instanceof Uint8ClampedArray)i="uint8",a=Uint8Array.from(t);else{let c=Sr.get(t.constructor);if(c===void 0)throw new TypeError(`Unsupported type for tensor data: ${t.constructor}.`);i=c,a=t}if(d===void 0)d=[a.length];else if(!Array.isArray(d))throw new TypeError("A tensor's dims must be a number array");u=d,this.cpuData=a,this.dataLocation="cpu"}let n=gs(u);if(this.cpuData&&n!==this.cpuData.length&&!((i==="uint4"||i==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=i,this.dims=u,this.size=n}static async fromImage(t,r){return us(t,r)}static fromTexture(t,r){return ls(t,r)}static fromGpuBuffer(t,r){return fs(t,r)}static fromMLTensor(t,r){return cs(t,r)}static fromPinnedBuffer(t,r,o){return ps(t,r,o)}toDataURL(t){return is(this,t)}toImageData(t){return as(this,t)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(t){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let r=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=r,t&&this.disposer&&(this.disposer(),this.disposer=void 0),r}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(t){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return ys(this,t)}}}),yt,pn=O(()=>{cn(),yt=St}),Ts,ws,Fe,Ce,Go=O(()=>{No(),Ts=(t,r)=>{(typeof Gt.trace>"u"?!Gt.wasm.trace:!Gt.trace)||console.timeStamp(`${t}::ORT::${r}`)},ws=(t,r)=>{var u;let o=((u=new Error().stack)==null?void 0:u.split(/\r\n|\r|\n/g))||[],i=!1;for(let n=0;n<o.length;n++){if(i&&!o[n].includes("TRACE_FUNC")){let a=`FUNC_${t}::${o[n].trim().split(" ")[1]}`;r&&(a+=`::${r}`),Ts("CPU",a);return}o[n].includes("TRACE_FUNC")&&(i=!0)}},Fe=t=>{(typeof Gt.trace>"u"?!Gt.wasm.trace:!Gt.trace)||ws("BEGIN",t)},Ce=t=>{(typeof Gt.trace>"u"?!Gt.wasm.trace:!Gt.trace)||ws("END",t)}}),dn,vs=O(()=>{fn(),pn(),Go(),dn=class Oa{constructor(r){this.handler=r}async run(r,o,i){Fe();let u={},n={};if(typeof r!="object"||r===null||r instanceof yt||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let a=!0;if(typeof o=="object"){if(o===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(o instanceof yt)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(o)){if(o.length===0)throw new TypeError("'fetches' cannot be an empty array.");a=!1;for(let e of o){if(typeof e!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(e)===-1)throw new RangeError(`'fetches' contains invalid output name: ${e}.`);u[e]=null}if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else{let e=!1,l=Object.getOwnPropertyNames(o);for(let s of this.outputNames)if(l.indexOf(s)!==-1){let h=o[s];(h===null||h instanceof yt)&&(e=!0,a=!1,u[s]=h)}if(e){if(typeof i=="object"&&i!==null)n=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else n=o}}else if(typeof o<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let e of this.inputNames)if(typeof r[e]>"u")throw new Error(`input '${e}' is missing in 'feeds'.`);if(a)for(let e of this.outputNames)u[e]=null;let d=await this.handler.run(r,u,n),c={};for(let e in d)if(Object.hasOwnProperty.call(d,e)){let l=d[e];l instanceof yt?c[e]=l:c[e]=new yt(l.type,l.data,l.dims)}return Ce(),c}async release(){return this.handler.dispose()}static async create(r,o,i,u){Fe();let n,a={};if(typeof r=="string"){if(n=r,typeof o=="object"&&o!==null)a=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof o=="object"&&o!==null)a=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let l=r,s=0,h=r.byteLength;if(typeof o=="object"&&o!==null)a=o;else if(typeof o=="number"){if(s=o,!Number.isSafeInteger(s))throw new RangeError("'byteOffset' must be an integer.");if(s<0||s>=l.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${l.byteLength}).`);if(h=r.byteLength-s,typeof i=="number"){if(h=i,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||s+h>l.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${l.byteLength-s}].`);if(typeof u=="object"&&u!==null)a=u;else if(typeof u<"u")throw new TypeError("'options' must be an object.")}else if(typeof i<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof o<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(l,s,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[d,c]=await ln(a),e=await d.createInferenceSessionHandler(n,c);return Ce(),new Oa(e)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}}),Yd,Is=O(()=>{vs(),Yd=dn}),_s=O(()=>{}),Os=O(()=>{}),Ss=O(()=>{}),As=O(()=>{}),Zd,hn,Ps=O(()=>{fn(),pn(),Zd="Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.",hn=class Sa{constructor(r,o,i){this.handler=r,this.hasOptimizerModel=o,this.hasEvalModel=i}get trainingInputNames(){return this.handler.inputNames}get trainingOutputNames(){return this.handler.outputNames}get evalInputNames(){if(this.hasEvalModel)return this.handler.evalInputNames;throw new Error("This training session has no evalModel loaded.")}get evalOutputNames(){if(this.hasEvalModel)return this.handler.evalOutputNames;throw new Error("This training session has no evalModel loaded.")}static async create(r,o){let i=r.evalModel||"",u=r.optimizerModel||"",n=o||{},[a,d]=await ln(n);if(a.createTrainingSessionHandler){let c=await a.createTrainingSessionHandler(r.checkpointState,r.trainModel,i,u,d);return new Sa(c,!!r.optimizerModel,!!r.evalModel)}else throw new Error(Zd)}typeNarrowingForRunStep(r,o,i,u,n){let a={},d={};if(typeof i!="object"||i===null||i instanceof yt||Array.isArray(i))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let c=!0;if(typeof u=="object"){if(u===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(u instanceof yt)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(u)){if(u.length===0)throw new TypeError("'fetches' cannot be an empty array.");c=!1;for(let e of u){if(typeof e!="string")throw new TypeError("'fetches' must be a string array or an object.");if(o.indexOf(e)===-1)throw new RangeError(`'fetches' contains invalid output name: ${e}.`);a[e]=null}if(typeof n=="object"&&n!==null)d=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else{let e=!1,l=Object.getOwnPropertyNames(u);for(let s of o)if(l.indexOf(s)!==-1){let h=u[s];(h===null||h instanceof yt)&&(e=!0,c=!1,a[s]=h)}if(e){if(typeof n=="object"&&n!==null)d=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else d=u}}else if(typeof u<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let e of r)if(typeof i[e]>"u")throw new Error(`input '${e}' is missing in 'feeds'.`);if(c)for(let e of o)a[e]=null;return[a,d]}convertHandlerReturnTypeToMapOfTensors(r){let o={};for(let i in r)if(Object.hasOwnProperty.call(r,i)){let u=r[i];u instanceof yt?o[i]=u:o[i]=new yt(u.type,u.data,u.dims)}return o}async lazyResetGrad(){await this.handler.lazyResetGrad()}async runTrainStep(r,o,i){let[u,n]=this.typeNarrowingForRunStep(this.trainingInputNames,this.trainingOutputNames,r,o,i),a=await this.handler.runTrainStep(r,u,n);return this.convertHandlerReturnTypeToMapOfTensors(a)}async runOptimizerStep(r){if(this.hasOptimizerModel)await this.handler.runOptimizerStep(r||{});else throw new Error("This TrainingSession has no OptimizerModel loaded.")}async runEvalStep(r,o,i){if(this.hasEvalModel){let[u,n]=this.typeNarrowingForRunStep(this.evalInputNames,this.evalOutputNames,r,o,i),a=await this.handler.runEvalStep(r,u,n);return this.convertHandlerReturnTypeToMapOfTensors(a)}else throw new Error("This TrainingSession has no EvalModel loaded.")}async getParametersSize(r=!0){return this.handler.getParametersSize(r)}async loadParametersBuffer(r,o=!0){let i=await this.getParametersSize(o);if(r.length!==4*i)throw new Error("Size of the buffer passed into loadParametersBuffer must match the number of parameters in the model. Please use getParametersSize method to check.");return this.handler.loadParametersBuffer(r,o)}async getContiguousParameters(r=!0){return this.handler.getContiguousParameters(r)}async release(){return this.handler.dispose()}}}),Qd,Es=O(()=>{Ps(),Qd=hn}),Mo={};Or(Mo,{InferenceSession:()=>Yd,TRACE:()=>Ts,TRACE_FUNC_BEGIN:()=>Fe,TRACE_FUNC_END:()=>Ce,Tensor:()=>yt,TrainingSession:()=>Qd,env:()=>z,registerBackend:()=>nr});var Yt=O(()=>{ts(),os(),Is(),pn(),_s(),Os(),Go(),Ss(),As(),Es()});function _e(t,r,o,i){if(r===void 0)return eh(t);if(o===void 0)mn(t,r);else if(typeof o=="number"&&i===void 0)mn(t,r);else if(typeof o=="string"&&i===void 0)mn(t,o,1,r);else if(typeof o=="string"&&typeof i=="number")mn(t,o,i,r);else throw new TypeError("input is valid")}function eh(t){return{verbose:_e.verbose.bind(null,t),info:_e.info.bind(null,t),warning:_e.warning.bind(null,t),error:_e.error.bind(null,t),fatal:_e.fatal.bind(null,t)}}function mn(t,r,o,i){let u=Ar[i||""]||Ar[""];Ls[t]<Ls[u.minimalSeverity]||(u.logDateTime&&(r=`${new Date().toISOString()}|${r}`),u.logSourceLocation,th[u.provider].log(t,r,i))}var Uo,Vo,Ls,th,$s,Ar,tt,gn,yn,xn,bn,Ut=O(()=>{Uo=class{log(t,r,o){}},Vo=class{log(t,r,o){console.log(`${this.color(t)} ${o?"\x1B[35m"+o+"\x1B[0m ":""}${r}`)}color(t){switch(t){case"verbose":return"\x1B[34;40mv\x1B[0m";case"info":return"\x1B[32mi\x1B[0m";case"warning":return"\x1B[30;43mw\x1B[0m";case"error":return"\x1B[31;40me\x1B[0m";case"fatal":return"\x1B[101mf\x1B[0m";default:throw new Error(`unsupported severity: ${t}`)}}},Ls={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},th={none:new Uo,console:new Vo},$s={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1},Ar={"":$s},(t=>{function r(e,l){t("verbose",e,l)}t.verbose=r;function o(e,l){t("info",e,l)}t.info=o;function i(e,l){t("warning",e,l)}t.warning=i;function u(e,l){t("error",e,l)}t.error=u;function n(e,l){t("fatal",e,l)}t.fatal=n;function a(e){Ar={},d("",e||{})}t.reset=a;function d(e,l){if(e==="*")a(l);else{let s=Ar[e]||$s;Ar[e]={provider:l.provider||s.provider,minimalSeverity:l.minimalSeverity||s.minimalSeverity,logDateTime:l.logDateTime===void 0?s.logDateTime:l.logDateTime,logSourceLocation:l.logSourceLocation===void 0?s.logSourceLocation:l.logSourceLocation}}}t.set=d;function c(e){let l={};e.logLevel&&(l.minimalSeverity=e.logLevel),d("",l)}t.setWithEnv=c})(_e||(_e={})),tt=_e,gn=class{constructor(t,r,o,i,u,n){this.category=t,this.name=r,this.startTime=o,this.endCallback=i,this.timer=u,this.ctx=n}async end(){return this.endCallback(this)}async checkTimer(){if(this.ctx===void 0||this.timer===void 0)throw new Error("No webgl timer found");return this.ctx.endTimer(),this.ctx.waitForQueryAndGetTime(this.timer)}},yn=class{constructor(t,r,o,i){this.category=t,this.name=r,this.startTime=o,this.endTime=i}},xn=class{constructor(t,r,o){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=t===void 0?1e4:t,this._flushBatchSize=r===void 0?10:r,this._flushIntervalInMilliseconds=o===void 0?5e3:o}static create(t){return t===void 0?new this:new this(t.maxNumberEvents,t.flushBatchSize,t.flushIntervalInMilliseconds)}start(){this._started=!0,this._timingEvents=[],this._flushTime=bn(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer])}event(t,r,o,i){let u=this._started?this.begin(t,r,i):void 0,n=!1,a=o();if(a&&typeof a.then=="function")return n=!0,new Promise((d,c)=>{a.then(async e=>{u&&await u.end(),d(e)},async e=>{u&&await u.end(),c(e)})});if(!n&&u){let d=u.end();if(d&&typeof d.then=="function")return new Promise((c,e)=>{d.then(()=>{c(a)},l=>{e(l)})})}return a}begin(t,r,o){if(!this._started)throw new Error("profiler is not started yet");if(o===void 0){let i=bn();return this.flush(i),new gn(t,r,i,u=>this.endSync(u))}else{let i=o.beginTimer();return new gn(t,r,0,async u=>this.end(u),i,o)}}async end(t){let r=await t.checkTimer();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new yn(t.category,t.name,t.startTime,r)),this.flush(r))}endSync(t){let r=bn();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new yn(t.category,t.name,t.startTime,r)),this.flush(r))}logOneEvent(t){tt.verbose(`Profiler.${t.category}`,`${(t.endTime-t.startTime).toFixed(2)}ms on event '${t.name}' at ${t.endTime.toFixed(2)}`)}flush(t){if(this._timingEvents.length-this._flushPointer>=this._flushBatchSize||t-this._flushTime>=this._flushIntervalInMilliseconds){for(let r=this._flushPointer;this._flushPointer<r+this._flushBatchSize&&this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer]);this._flushTime=bn()}}get started(){return this._started}},bn=typeof performance<"u"&&performance.now?()=>performance.now():Date.now});function ks(t,r,o){for(let i of o){let u=i[0],n=i[1],a=i[2],d=i[3],c=i[4];if(t.opType===u){for(let e of r)if((e.domain===n||e.domain==="ai.onnx"&&n==="")&&rh(e.version,a))return{opImpl:d,opInit:c}}}throw new TypeError(`cannot resolve operator '${t.opType}' with opsets: ${r.map(i=>`${i.domain||"ai.onnx"} v${i.version}`).join(", ")}`)}function rh(t,r){if(r.endsWith("+")){let o=Number.parseInt(r.substring(0,r.length-1),10);return!isNaN(o)&&o<=t}else if(r.split("-").length===2){let o=r.split("-"),i=Number.parseInt(o[0],10),u=Number.parseInt(o[1],10);return!isNaN(i)&&!isNaN(u)&&i<=t&&t<=u}else return Number.parseInt(r,10)===t}var Bs=O(()=>{}),Fs=mt(t=>{t.__esModule=!0;var r=function(){function o(i){if(!i)throw new TypeError("Invalid argument; `value` has no value.");this.value=o.EMPTY,i&&o.isGuid(i)&&(this.value=i)}return o.isGuid=function(i){var u=i.toString();return i&&(i instanceof o||o.validator.test(u))},o.create=function(){return new o([o.gen(2),o.gen(1),o.gen(1),o.gen(1),o.gen(3)].join("-"))},o.createEmpty=function(){return new o("emptyguid")},o.parse=function(i){return new o(i)},o.raw=function(){return[o.gen(2),o.gen(1),o.gen(1),o.gen(1),o.gen(3)].join("-")},o.gen=function(i){for(var u="",n=0;n<i;n++)u+=((1+Math.random())*65536|0).toString(16).substring(1);return u},o.prototype.equals=function(i){return o.isGuid(i)&&this.value===i.toString()},o.prototype.isEmpty=function(){return this.value===o.EMPTY},o.prototype.toString=function(){return this.value},o.prototype.toJSON=function(){return{value:this.value}},o.validator=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i"),o.EMPTY="00000000-0000-0000-0000-000000000000",o}();t.Guid=r});function rt(t,r,o){this.low=t|0,this.high=r|0,this.unsigned=!!o}function Et(t){return(t&&t.__isLong__)===!0}function Cs(t){var r=Math.clz32(t&-t);return t?31-r:r}function Ne(t,r){var o,i,u;return r?(t>>>=0,(u=0<=t&&t<256)&&(i=Rs[t],i)?i:(o=J(t,0,!0),u&&(Rs[t]=o),o)):(t|=0,(u=-128<=t&&t<128)&&(i=Ns[t],i)?i:(o=J(t,t<0?-1:0,!1),u&&(Ns[t]=o),o))}function zt(t,r){if(isNaN(t))return r?ye:Zt;if(r){if(t<0)return ye;if(t>=Vs)return Hs}else{if(t<=-Ms)return Ct;if(t+1>=Ms)return Ws}return t<0?zt(-t,r).neg():J(t%ir|0,t/ir|0,r)}function J(t,r,o){return new rt(t,r,o)}function Ho(t,r,o){if(t.length===0)throw Error("empty string");if(typeof r=="number"?(o=r,r=!1):r=!!r,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return r?ye:Zt;if(o=o||10,o<2||36<o)throw RangeError("radix");var i;if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return Ho(t.substring(1),r,o).neg();for(var u=zt(Tn(o,8)),n=Zt,a=0;a<t.length;a+=8){var d=Math.min(8,t.length-a),c=parseInt(t.substring(a,a+d),o);if(d<8){var e=zt(Tn(o,d));n=n.mul(e).add(zt(c))}else n=n.mul(u),n=n.add(zt(c))}return n.unsigned=r,n}function Qt(t,r){return typeof t=="number"?zt(t,r):typeof t=="string"?Ho(t,r):J(t.low,t.high,typeof r=="boolean"?r:t.unsigned)}var Vt,Ns,Rs,Tn,Gs,oh,ir,Vs,Ms,Us,Zt,ye,or,zs,Wo,Ws,Hs,Ct,D,xe,qo=O(()=>{Vt=null;try{Vt=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{}rt.prototype.__isLong__,Object.defineProperty(rt.prototype,"__isLong__",{value:!0}),rt.isLong=Et,Ns={},Rs={},rt.fromInt=Ne,rt.fromNumber=zt,rt.fromBits=J,Tn=Math.pow,rt.fromString=Ho,rt.fromValue=Qt,Gs=65536,oh=1<<24,ir=Gs*Gs,Vs=ir*ir,Ms=Vs/2,Us=Ne(oh),Zt=Ne(0),rt.ZERO=Zt,ye=Ne(0,!0),rt.UZERO=ye,or=Ne(1),rt.ONE=or,zs=Ne(1,!0),rt.UONE=zs,Wo=Ne(-1),rt.NEG_ONE=Wo,Ws=J(-1,2147483647,!1),rt.MAX_VALUE=Ws,Hs=J(-1,-1,!0),rt.MAX_UNSIGNED_VALUE=Hs,Ct=J(0,-2147483648,!1),rt.MIN_VALUE=Ct,D=rt.prototype,D.toInt=function(){return this.unsigned?this.low>>>0:this.low},D.toNumber=function(){return this.unsigned?(this.high>>>0)*ir+(this.low>>>0):this.high*ir+(this.low>>>0)},D.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Ct)){var r=zt(t),o=this.div(r),i=o.mul(r).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var u=zt(Tn(t,6),this.unsigned),n=this,a="";;){var d=n.div(u),c=n.sub(d.mul(u)).toInt()>>>0,e=c.toString(t);if(n=d,n.isZero())return e+a;for(;e.length<6;)e="0"+e;a=""+e+a}},D.getHighBits=function(){return this.high},D.getHighBitsUnsigned=function(){return this.high>>>0},D.getLowBits=function(){return this.low},D.getLowBitsUnsigned=function(){return this.low>>>0},D.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ct)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1},D.isZero=function(){return this.high===0&&this.low===0},D.eqz=D.isZero,D.isNegative=function(){return!this.unsigned&&this.high<0},D.isPositive=function(){return this.unsigned||this.high>=0},D.isOdd=function(){return(this.low&1)===1},D.isEven=function(){return(this.low&1)===0},D.equals=function(t){return Et(t)||(t=Qt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low},D.eq=D.equals,D.notEquals=function(t){return!this.eq(t)},D.neq=D.notEquals,D.ne=D.notEquals,D.lessThan=function(t){return this.comp(t)<0},D.lt=D.lessThan,D.lessThanOrEqual=function(t){return this.comp(t)<=0},D.lte=D.lessThanOrEqual,D.le=D.lessThanOrEqual,D.greaterThan=function(t){return this.comp(t)>0},D.gt=D.greaterThan,D.greaterThanOrEqual=function(t){return this.comp(t)>=0},D.gte=D.greaterThanOrEqual,D.ge=D.greaterThanOrEqual,D.compare=function(t){if(Et(t)||(t=Qt(t)),this.eq(t))return 0;var r=this.isNegative(),o=t.isNegative();return r&&!o?-1:!r&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},D.comp=D.compare,D.negate=function(){return!this.unsigned&&this.eq(Ct)?Ct:this.not().add(or)},D.neg=D.negate,D.add=function(t){Et(t)||(t=Qt(t));var r=this.high>>>16,o=this.high&65535,i=this.low>>>16,u=this.low&65535,n=t.high>>>16,a=t.high&65535,d=t.low>>>16,c=t.low&65535,e=0,l=0,s=0,h=0;return h+=u+c,s+=h>>>16,h&=65535,s+=i+d,l+=s>>>16,s&=65535,l+=o+a,e+=l>>>16,l&=65535,e+=r+n,e&=65535,J(s<<16|h,e<<16|l,this.unsigned)},D.subtract=function(t){return Et(t)||(t=Qt(t)),this.add(t.neg())},D.sub=D.subtract,D.multiply=function(t){if(this.isZero())return this;if(Et(t)||(t=Qt(t)),Vt){var r=Vt.mul(this.low,this.high,t.low,t.high);return J(r,Vt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ye:Zt;if(this.eq(Ct))return t.isOdd()?Ct:Zt;if(t.eq(Ct))return this.isOdd()?Ct:Zt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(Us)&&t.lt(Us))return zt(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,u=this.low>>>16,n=this.low&65535,a=t.high>>>16,d=t.high&65535,c=t.low>>>16,e=t.low&65535,l=0,s=0,h=0,f=0;return f+=n*e,h+=f>>>16,f&=65535,h+=u*e,s+=h>>>16,h&=65535,h+=n*c,s+=h>>>16,h&=65535,s+=i*e,l+=s>>>16,s&=65535,s+=u*c,l+=s>>>16,s&=65535,s+=n*d,l+=s>>>16,s&=65535,l+=o*e+i*c+u*d+n*a,l&=65535,J(h<<16|f,l<<16|s,this.unsigned)},D.mul=D.multiply,D.divide=function(t){if(Et(t)||(t=Qt(t)),t.isZero())throw Error("division by zero");if(Vt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Vt.div_u:Vt.div_s)(this.low,this.high,t.low,t.high);return J(r,Vt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ye:Zt;var o,i,u;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ye;if(t.gt(this.shru(1)))return zs;u=ye}else{if(this.eq(Ct)){if(t.eq(or)||t.eq(Wo))return Ct;if(t.eq(Ct))return or;var n=this.shr(1);return o=n.div(t).shl(1),o.eq(Zt)?t.isNegative()?or:Wo:(i=this.sub(t.mul(o)),u=o.add(i.div(t)),u)}else if(t.eq(Ct))return this.unsigned?ye:Zt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();u=Zt}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(o)/Math.LN2),d=a<=48?1:Tn(2,a-48),c=zt(o),e=c.mul(t);e.isNegative()||e.gt(i);)o-=d,c=zt(o,this.unsigned),e=c.mul(t);c.isZero()&&(c=or),u=u.add(c),i=i.sub(e)}return u},D.div=D.divide,D.modulo=function(t){if(Et(t)||(t=Qt(t)),Vt){var r=(this.unsigned?Vt.rem_u:Vt.rem_s)(this.low,this.high,t.low,t.high);return J(r,Vt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},D.mod=D.modulo,D.rem=D.modulo,D.not=function(){return J(~this.low,~this.high,this.unsigned)},D.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},D.clz=D.countLeadingZeros,D.countTrailingZeros=function(){return this.low?Cs(this.low):Cs(this.high)+32},D.ctz=D.countTrailingZeros,D.and=function(t){return Et(t)||(t=Qt(t)),J(this.low&t.low,this.high&t.high,this.unsigned)},D.or=function(t){return Et(t)||(t=Qt(t)),J(this.low|t.low,this.high|t.high,this.unsigned)},D.xor=function(t){return Et(t)||(t=Qt(t)),J(this.low^t.low,this.high^t.high,this.unsigned)},D.shiftLeft=function(t){return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?J(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):J(0,this.low<<t-32,this.unsigned)},D.shl=D.shiftLeft,D.shiftRight=function(t){return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?J(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):J(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},D.shr=D.shiftRight,D.shiftRightUnsigned=function(t){return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?J(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?J(this.high,0,this.unsigned):J(this.high>>>t-32,0,this.unsigned)},D.shru=D.shiftRightUnsigned,D.shr_u=D.shiftRightUnsigned,D.rotateLeft=function(t){var r;return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?J(this.high,this.low,this.unsigned):t<32?(r=32-t,J(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,J(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))},D.rotl=D.rotateLeft,D.rotateRight=function(t){var r;return Et(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?J(this.high,this.low,this.unsigned):t<32?(r=32-t,J(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,J(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))},D.rotr=D.rotateRight,D.toSigned=function(){return this.unsigned?J(this.low,this.high,!1):this},D.toUnsigned=function(){return this.unsigned?this:J(this.low,this.high,!0)},D.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},D.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},D.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},rt.fromBytes=function(t,r,o){return o?rt.fromBytesLE(t,r):rt.fromBytesBE(t,r)},rt.fromBytesLE=function(t,r){return new rt(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)},rt.fromBytesBE=function(t,r){return new rt(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)},xe=rt}),w,wn=O(()=>{w={},w.Offset,w.Table,w.SIZEOF_SHORT=2,w.SIZEOF_INT=4,w.FILE_IDENTIFIER_LENGTH=4,w.SIZE_PREFIX_LENGTH=4,w.Encoding={UTF8_BYTES:1,UTF16_STRING:2},w.int32=new Int32Array(2),w.float32=new Float32Array(w.int32.buffer),w.float64=new Float64Array(w.int32.buffer),w.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,w.Long=function(t,r){this.low=t|0,this.high=r|0},w.Long.create=function(t,r){return t==0&&r==0?w.Long.ZERO:new w.Long(t,r)},w.Long.prototype.toFloat64=function(){return(this.low>>>0)+this.high*4294967296},w.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},w.Long.ZERO=new w.Long(0,0),w.Builder=function(t){if(t)var r=t;else var r=1024;this.bb=w.ByteBuffer.allocate(r),this.space=r,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},w.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},w.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},w.Builder.prototype.dataBuffer=function(){return this.bb},w.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},w.Builder.prototype.prep=function(t,r){t>this.minalign&&(this.minalign=t);for(var o=~(this.bb.capacity()-this.space+r)+1&t-1;this.space<o+t+r;){var i=this.bb.capacity();this.bb=w.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(o)},w.Builder.prototype.pad=function(t){for(var r=0;r<t;r++)this.bb.writeInt8(--this.space,0)},w.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},w.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},w.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},w.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},w.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},w.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},w.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},w.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},w.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},w.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},w.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},w.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},w.Builder.prototype.addFieldInt8=function(t,r,o){(this.force_defaults||r!=o)&&(this.addInt8(r),this.slot(t))},w.Builder.prototype.addFieldInt16=function(t,r,o){(this.force_defaults||r!=o)&&(this.addInt16(r),this.slot(t))},w.Builder.prototype.addFieldInt32=function(t,r,o){(this.force_defaults||r!=o)&&(this.addInt32(r),this.slot(t))},w.Builder.prototype.addFieldInt64=function(t,r,o){(this.force_defaults||!r.equals(o))&&(this.addInt64(r),this.slot(t))},w.Builder.prototype.addFieldFloat32=function(t,r,o){(this.force_defaults||r!=o)&&(this.addFloat32(r),this.slot(t))},w.Builder.prototype.addFieldFloat64=function(t,r,o){(this.force_defaults||r!=o)&&(this.addFloat64(r),this.slot(t))},w.Builder.prototype.addFieldOffset=function(t,r,o){(this.force_defaults||r!=o)&&(this.addOffset(r),this.slot(t))},w.Builder.prototype.addFieldStruct=function(t,r,o){r!=o&&(this.nested(r),this.slot(t))},w.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},w.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},w.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},w.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},w.Builder.growByteBuffer=function(t){var r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var o=r<<1,i=w.ByteBuffer.allocate(o);return i.setPosition(o-r),i.bytes().set(t.bytes(),o-r),i},w.Builder.prototype.addOffset=function(t){this.prep(w.SIZEOF_INT,0),this.writeInt32(this.offset()-t+w.SIZEOF_INT)},w.Builder.prototype.startObject=function(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(var r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()},w.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),r=this.vtable_in_use-1;r>=0&&this.vtable[r]==0;r--);for(var o=r+1;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);var i=2;this.addInt16(t-this.object_start);var u=(o+i)*w.SIZEOF_SHORT;this.addInt16(u);var n=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){var d=this.bb.capacity()-this.vtables[r];if(u==this.bb.readInt16(d)){for(var c=w.SIZEOF_SHORT;c<u;c+=w.SIZEOF_SHORT)if(this.bb.readInt16(a+c)!=this.bb.readInt16(d+c))continue t;n=this.vtables[r];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},w.Builder.prototype.finish=function(t,r,o){var i=o?w.SIZE_PREFIX_LENGTH:0;if(r){var u=r;if(this.prep(this.minalign,w.SIZEOF_INT+w.FILE_IDENTIFIER_LENGTH+i),u.length!=w.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+w.FILE_IDENTIFIER_LENGTH);for(var n=w.FILE_IDENTIFIER_LENGTH-1;n>=0;n--)this.writeInt8(u.charCodeAt(n))}this.prep(this.minalign,w.SIZEOF_INT+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},w.Builder.prototype.finishSizePrefixed=function(t,r){this.finish(t,r,!0)},w.Builder.prototype.requiredField=function(t,r){var o=this.bb.capacity()-t,i=o-this.bb.readInt32(o),u=this.bb.readInt16(i+r)!=0;if(!u)throw new Error("FlatBuffers: field "+r+" must be set")},w.Builder.prototype.startVector=function(t,r,o){this.notNested(),this.vector_num_elems=r,this.prep(w.SIZEOF_INT,t*r),this.prep(o,t*r)},w.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},w.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var r=t;else for(var r=[],o=0;o<t.length;){var i,u=t.charCodeAt(o++);if(u<55296||u>=56320)i=u;else{var n=t.charCodeAt(o++);i=(u<<10)+n+-56613888}i<128?r.push(i):(i<2048?r.push(i>>6&31|192):(i<65536?r.push(i>>12&15|224):r.push(i>>18&7|240,i>>12&63|128),r.push(i>>6&63|128)),r.push(i&63|128))}this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length);for(var o=0,a=this.space,d=this.bb.bytes();o<r.length;o++)d[a++]=r[o];return this.endVector()},w.Builder.prototype.createLong=function(t,r){return w.Long.create(t,r)},w.ByteBuffer=function(t){this.bytes_=t,this.position_=0},w.ByteBuffer.allocate=function(t){return new w.ByteBuffer(new Uint8Array(t))},w.ByteBuffer.prototype.clear=function(){this.position_=0},w.ByteBuffer.prototype.bytes=function(){return this.bytes_},w.ByteBuffer.prototype.position=function(){return this.position_},w.ByteBuffer.prototype.setPosition=function(t){this.position_=t},w.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},w.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},w.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},w.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},w.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},w.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},w.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},w.ByteBuffer.prototype.readInt64=function(t){return new w.Long(this.readInt32(t),this.readInt32(t+4))},w.ByteBuffer.prototype.readUint64=function(t){return new w.Long(this.readUint32(t),this.readUint32(t+4))},w.ByteBuffer.prototype.readFloat32=function(t){return w.int32[0]=this.readInt32(t),w.float32[0]},w.ByteBuffer.prototype.readFloat64=function(t){return w.int32[w.isLittleEndian?0:1]=this.readInt32(t),w.int32[w.isLittleEndian?1:0]=this.readInt32(t+4),w.float64[0]},w.ByteBuffer.prototype.writeInt8=function(t,r){this.bytes_[t]=r},w.ByteBuffer.prototype.writeUint8=function(t,r){this.bytes_[t]=r},w.ByteBuffer.prototype.writeInt16=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8},w.ByteBuffer.prototype.writeUint16=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8},w.ByteBuffer.prototype.writeInt32=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24},w.ByteBuffer.prototype.writeUint32=function(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24},w.ByteBuffer.prototype.writeInt64=function(t,r){this.writeInt32(t,r.low),this.writeInt32(t+4,r.high)},w.ByteBuffer.prototype.writeUint64=function(t,r){this.writeUint32(t,r.low),this.writeUint32(t+4,r.high)},w.ByteBuffer.prototype.writeFloat32=function(t,r){w.float32[0]=r,this.writeInt32(t,w.int32[0])},w.ByteBuffer.prototype.writeFloat64=function(t,r){w.float64[0]=r,this.writeInt32(t,w.int32[w.isLittleEndian?0:1]),this.writeInt32(t+4,w.int32[w.isLittleEndian?1:0])},w.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+w.SIZEOF_INT+w.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",r=0;r<w.FILE_IDENTIFIER_LENGTH;r++)t+=String.fromCharCode(this.readInt8(this.position_+w.SIZEOF_INT+r));return t},w.ByteBuffer.prototype.__offset=function(t,r){var o=t-this.readInt32(t);return r<this.readInt16(o)?this.readInt16(o+r):0},w.ByteBuffer.prototype.__union=function(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t},w.ByteBuffer.prototype.__string=function(t,r){t+=this.readInt32(t);var o=this.readInt32(t),i="",u=0;if(t+=w.SIZEOF_INT,r===w.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+o);for(;u<o;){var n,a=this.readUint8(t+u++);if(a<192)n=a;else{var d=this.readUint8(t+u++);if(a<224)n=(a&31)<<6|d&63;else{var c=this.readUint8(t+u++);if(a<240)n=(a&15)<<12|(d&63)<<6|c&63;else{var e=this.readUint8(t+u++);n=(a&7)<<18|(d&63)<<12|(c&63)<<6|e&63}}}n<65536?i+=String.fromCharCode(n):(n-=65536,i+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return i},w.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},w.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+w.SIZEOF_INT},w.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},w.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=w.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+w.FILE_IDENTIFIER_LENGTH);for(var r=0;r<w.FILE_IDENTIFIER_LENGTH;r++)if(t.charCodeAt(r)!=this.readInt8(this.position_+w.SIZEOF_INT+r))return!1;return!0},w.ByteBuffer.prototype.createLong=function(t,r){return w.Long.create(t,r)}}),F,Pr=O(()=>{wn(),(t=>{(r=>{(o=>{(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i.FLOAT=1]="FLOAT",i[i.INT=2]="INT",i[i.STRING=3]="STRING",i[i.TENSOR=4]="TENSOR",i[i.GRAPH=5]="GRAPH",i[i.FLOATS=6]="FLOATS",i[i.INTS=7]="INTS",i[i.STRINGS=8]="STRINGS",i[i.TENSORS=9]="TENSORS",i[i.GRAPHS=10]="GRAPHS",i[i.SPARSE_TENSOR=11]="SPARSE_TENSOR",i[i.SPARSE_TENSORS=12]="SPARSE_TENSORS"))(o.AttributeType||(o.AttributeType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VALUE=1]="VALUE",i[i.PARAM=2]="PARAM"))(o.DimensionValueType||(o.DimensionValueType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i.FLOAT=1]="FLOAT",i[i.UINT8=2]="UINT8",i[i.INT8=3]="INT8",i[i.UINT16=4]="UINT16",i[i.INT16=5]="INT16",i[i.INT32=6]="INT32",i[i.INT64=7]="INT64",i[i.STRING=8]="STRING",i[i.BOOL=9]="BOOL",i[i.FLOAT16=10]="FLOAT16",i[i.DOUBLE=11]="DOUBLE",i[i.UINT32=12]="UINT32",i[i.UINT64=13]="UINT64",i[i.COMPLEX64=14]="COMPLEX64",i[i.COMPLEX128=15]="COMPLEX128",i[i.BFLOAT16=16]="BFLOAT16",i[i.FLOAT8E4M3FN=17]="FLOAT8E4M3FN",i[i.FLOAT8E4M3FNUZ=18]="FLOAT8E4M3FNUZ",i[i.FLOAT8E5M2=19]="FLOAT8E5M2",i[i.FLOAT8E5M2FNUZ=20]="FLOAT8E5M2FNUZ"))(o.TensorDataType||(o.TensorDataType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.Primitive=0]="Primitive",i[i.Fused=1]="Fused"))(o.NodeType||(o.NodeType={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{(i=>(i[i.NONE=0]="NONE",i[i.tensor_type=1]="tensor_type",i[i.sequence_type=2]="sequence_type",i[i.map_type=3]="map_type"))(o.TypeInfoValue||(o.TypeInfoValue={}))})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsShape(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsShape(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}dim(n,a){let d=this.bb.__offset(this.bb_pos,4);return d?(a||new t.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static createDimVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startDimVector(n,a){n.startVector(4,a,4)}static endShape(n){return n.endObject()}static createShape(n,a){return i.startShape(n),i.addDim(n,a),i.endShape(n)}}o.Shape=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsDimension(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimension(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}value(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}denotation(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}static startDimension(n){n.startObject(2)}static addValue(n,a){n.addFieldOffset(0,a,0)}static addDenotation(n,a){n.addFieldOffset(1,a,0)}static endDimension(n){return n.endObject()}static createDimension(n,a,d){return i.startDimension(n),i.addValue(n,a),i.addDenotation(n,d),i.endDimension(n)}}o.Dimension=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsDimensionValue(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsDimensionValue(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}dimType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt8(this.bb_pos+n):0}dimValue(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}dimParam(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__string(this.bb_pos+a,n):null}static startDimensionValue(n){n.startObject(3)}static addDimType(n,a){n.addFieldInt8(0,a,0)}static addDimValue(n,a){n.addFieldInt64(1,a,n.createLong(0,0))}static addDimParam(n,a){n.addFieldOffset(2,a,0)}static endDimensionValue(n){return n.endObject()}static createDimensionValue(n,a,d,c){return i.startDimensionValue(n),i.addDimType(n,a),i.addDimValue(n,d),i.addDimParam(n,c),i.endDimensionValue(n)}}o.DimensionValue=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsTensorTypeAndShape(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensorTypeAndShape(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}elemType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt32(this.bb_pos+n):0}shape(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startTensorTypeAndShape(n){n.startObject(2)}static addElemType(n,a){n.addFieldInt32(0,a,0)}static addShape(n,a){n.addFieldOffset(1,a,0)}static endTensorTypeAndShape(n){return n.endObject()}static createTensorTypeAndShape(n,a,d){return i.startTensorTypeAndShape(n),i.addElemType(n,a),i.addShape(n,d),i.endTensorTypeAndShape(n)}}o.TensorTypeAndShape=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsMapType(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsMapType(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}keyType(){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.readInt32(this.bb_pos+n):0}valueType(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startMapType(n){n.startObject(2)}static addKeyType(n,a){n.addFieldInt32(0,a,0)}static addValueType(n,a){n.addFieldOffset(1,a,0)}static endMapType(n){return n.endObject()}static createMapType(n,a,d){return i.startMapType(n),i.addKeyType(n,a),i.addValueType(n,d),i.endMapType(n)}}o.MapType=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSequenceType(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSequenceType(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}elemType(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startSequenceType(n){n.startObject(1)}static addElemType(n,a){n.addFieldOffset(0,a,0)}static endSequenceType(n){return n.endObject()}static createSequenceType(n,a){return i.startSequenceType(n),i.addElemType(n,a),i.endSequenceType(n)}}o.SequenceType=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,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(n,a,d,c){return n.prep(4,12),n.writeInt32(c),n.writeInt32(d),n.writeInt32(a),n.offset()}}o.EdgeEnd=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsNodeEdge(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNodeEdge(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__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,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+d)+n*12,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,a){let d=this.bb.__offset(this.bb_pos,8);return d?(a||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+d)+n*12,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,a){n.addFieldInt32(0,a,0)}static addInputEdges(n,a){n.addFieldOffset(1,a,0)}static startInputEdgesVector(n,a){n.startVector(12,a,4)}static addOutputEdges(n,a){n.addFieldOffset(2,a,0)}static startOutputEdgesVector(n,a){n.startVector(12,a,4)}static endNodeEdge(n){return n.endObject()}static createNodeEdge(n,a,d,c){return i.startNodeEdge(n),i.addNodeIndex(n,a),i.addInputEdges(n,d),i.addOutputEdges(n,c),i.endNodeEdge(n)}}o.NodeEdge=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsNode(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsNode(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}domain(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__string(this.bb_pos+a,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 a=this.bb.__offset(this.bb_pos,14);return a?this.bb.__string(this.bb_pos+a,n):null}type(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.readInt32(this.bb_pos+n):0}executionProviderType(n){let a=this.bb.__offset(this.bb_pos,18);return a?this.bb.__string(this.bb_pos+a,n):null}inputs(n,a){let d=this.bb.__offset(this.bb_pos,20);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,20);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,a){let d=this.bb.__offset(this.bb_pos,22);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,22);return n?this.bb.__vector_len(this.bb_pos+n):0}attributes(n,a){let d=this.bb.__offset(this.bb_pos,24);return d?(a||new t.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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 a=this.bb.__offset(this.bb_pos,26);return a?this.bb.readInt32(this.bb.__vector(this.bb_pos+a)+n*4):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,a){let d=this.bb.__offset(this.bb_pos,28);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):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,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addDomain(n,a){n.addFieldOffset(2,a,0)}static addSinceVersion(n,a){n.addFieldInt32(3,a,0)}static addIndex(n,a){n.addFieldInt32(4,a,0)}static addOpType(n,a){n.addFieldOffset(5,a,0)}static addType(n,a){n.addFieldInt32(6,a,0)}static addExecutionProviderType(n,a){n.addFieldOffset(7,a,0)}static addInputs(n,a){n.addFieldOffset(8,a,0)}static createInputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startInputsVector(n,a){n.startVector(4,a,4)}static addOutputs(n,a){n.addFieldOffset(9,a,0)}static createOutputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startOutputsVector(n,a){n.startVector(4,a,4)}static addAttributes(n,a){n.addFieldOffset(10,a,0)}static createAttributesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startAttributesVector(n,a){n.startVector(4,a,4)}static addInputArgCounts(n,a){n.addFieldOffset(11,a,0)}static createInputArgCountsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addInt32(a[d]);return n.endVector()}static startInputArgCountsVector(n,a){n.startVector(4,a,4)}static addImplicitInputs(n,a){n.addFieldOffset(12,a,0)}static createImplicitInputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startImplicitInputsVector(n,a){n.startVector(4,a,4)}static endNode(n){return n.endObject()}static createNode(n,a,d,c,e,l,s,h,f,m,v,_,I,T){return i.startNode(n),i.addName(n,a),i.addDocString(n,d),i.addDomain(n,c),i.addSinceVersion(n,e),i.addIndex(n,l),i.addOpType(n,s),i.addType(n,h),i.addExecutionProviderType(n,f),i.addInputs(n,m),i.addOutputs(n,v),i.addAttributes(n,_),i.addInputArgCounts(n,I),i.addImplicitInputs(n,T),i.endNode(n)}}o.Node=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsValueInfo(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsValueInfo(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}type(n){let a=this.bb.__offset(this.bb_pos,8);return a?(n||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startValueInfo(n){n.startObject(3)}static addName(n,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addType(n,a){n.addFieldOffset(2,a,0)}static endValueInfo(n){return n.endObject()}static createValueInfo(n,a,d,c){return i.startValueInfo(n),i.addName(n,a),i.addDocString(n,d),i.addType(n,c),i.endValueInfo(n)}}o.ValueInfo=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsTypeInfo(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTypeInfo(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}denotation(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}valueType(){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readUint8(this.bb_pos+n):0}value(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__union(n,this.bb_pos+a):null}static startTypeInfo(n){n.startObject(3)}static addDenotation(n,a){n.addFieldOffset(0,a,0)}static addValueType(n,a){n.addFieldInt8(1,a,0)}static addValue(n,a){n.addFieldOffset(2,a,0)}static endTypeInfo(n){return n.endObject()}static createTypeInfo(n,a,d,c){return i.startTypeInfo(n),i.addDenotation(n,a),i.addValueType(n,d),i.addValue(n,c),i.endTypeInfo(n)}}o.TypeInfo=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsOperatorSetId(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsOperatorSetId(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}domain(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,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,a){n.addFieldOffset(0,a,0)}static addVersion(n,a){n.addFieldInt64(1,a,n.createLong(0,0))}static endOperatorSetId(n){return n.endObject()}static createOperatorSetId(n,a,d){return i.startOperatorSetId(n),i.addDomain(n,a),i.addVersion(n,d),i.endOperatorSetId(n)}}o.OperatorSetId=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsTensor(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsTensor(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}dims(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.readInt64(this.bb.__vector(this.bb_pos+a)+n*8):this.bb.createLong(0,0)}dimsLength(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__vector_len(this.bb_pos+n):0}dataType(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt32(this.bb_pos+n):0}rawData(n){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.readUint8(this.bb.__vector(this.bb_pos+a)+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,a){let d=this.bb.__offset(this.bb_pos,14);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):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,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addDims(n,a){n.addFieldOffset(2,a,0)}static createDimsVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startDimsVector(n,a){n.startVector(8,a,8)}static addDataType(n,a){n.addFieldInt32(3,a,0)}static addRawData(n,a){n.addFieldOffset(4,a,0)}static createRawDataVector(n,a){n.startVector(1,a.length,1);for(let d=a.length-1;d>=0;d--)n.addInt8(a[d]);return n.endVector()}static startRawDataVector(n,a){n.startVector(1,a,1)}static addStringData(n,a){n.addFieldOffset(5,a,0)}static createStringDataVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startStringDataVector(n,a){n.startVector(4,a,4)}static endTensor(n){return n.endObject()}static createTensor(n,a,d,c,e,l,s){return i.startTensor(n),i.addName(n,a),i.addDocString(n,d),i.addDims(n,c),i.addDataType(n,e),i.addRawData(n,l),i.addStringData(n,s),i.endTensor(n)}}o.Tensor=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSparseTensor(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSparseTensor(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}values(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}indices(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}dims(n){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.readInt64(this.bb.__vector(this.bb_pos+a)+n*8):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,a){n.addFieldOffset(0,a,0)}static addIndices(n,a){n.addFieldOffset(1,a,0)}static addDims(n,a){n.addFieldOffset(2,a,0)}static createDimsVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startDimsVector(n,a){n.startVector(8,a,8)}static endSparseTensor(n){return n.endObject()}static createSparseTensor(n,a,d,c){return i.startSparseTensor(n),i.addValues(n,a),i.addIndices(n,d),i.addDims(n,c),i.endSparseTensor(n)}}o.SparseTensor=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsAttribute(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsAttribute(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}name(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}docString(n){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__string(this.bb_pos+a,n):null}type(){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.readInt32(this.bb_pos+n):0}f(){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readFloat32(this.bb_pos+n):0}i(){let n=this.bb.__offset(this.bb_pos,12);return n?this.bb.readInt64(this.bb_pos+n):this.bb.createLong(0,0)}s(n){let a=this.bb.__offset(this.bb_pos,14);return a?this.bb.__string(this.bb_pos+a,n):null}t(n){let a=this.bb.__offset(this.bb_pos,16);return a?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}g(n){let a=this.bb.__offset(this.bb_pos,18);return a?(n||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}floats(n){let a=this.bb.__offset(this.bb_pos,20);return a?this.bb.readFloat32(this.bb.__vector(this.bb_pos+a)+n*4):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 a=this.bb.__offset(this.bb_pos,22);return a?this.bb.readInt64(this.bb.__vector(this.bb_pos+a)+n*8):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,a){let d=this.bb.__offset(this.bb_pos,24);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}stringsLength(){let n=this.bb.__offset(this.bb_pos,24);return n?this.bb.__vector_len(this.bb_pos+n):0}tensors(n,a){let d=this.bb.__offset(this.bb_pos,26);return d?(a||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,28);return d?(a||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static addDocString(n,a){n.addFieldOffset(1,a,0)}static addType(n,a){n.addFieldInt32(2,a,0)}static addF(n,a){n.addFieldFloat32(3,a,0)}static addI(n,a){n.addFieldInt64(4,a,n.createLong(0,0))}static addS(n,a){n.addFieldOffset(5,a,0)}static addT(n,a){n.addFieldOffset(6,a,0)}static addG(n,a){n.addFieldOffset(7,a,0)}static addFloats(n,a){n.addFieldOffset(8,a,0)}static createFloatsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addFloat32(a[d]);return n.endVector()}static startFloatsVector(n,a){n.startVector(4,a,4)}static addInts(n,a){n.addFieldOffset(9,a,0)}static createIntsVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startIntsVector(n,a){n.startVector(8,a,8)}static addStrings(n,a){n.addFieldOffset(10,a,0)}static createStringsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startStringsVector(n,a){n.startVector(4,a,4)}static addTensors(n,a){n.addFieldOffset(11,a,0)}static createTensorsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startTensorsVector(n,a){n.startVector(4,a,4)}static addGraphs(n,a){n.addFieldOffset(12,a,0)}static createGraphsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startGraphsVector(n,a){n.startVector(4,a,4)}static endAttribute(n){return n.endObject()}static createAttribute(n,a,d,c,e,l,s,h,f,m,v,_,I,T){return i.startAttribute(n),i.addName(n,a),i.addDocString(n,d),i.addType(n,c),i.addF(n,e),i.addI(n,l),i.addS(n,s),i.addT(n,h),i.addG(n,f),i.addFloats(n,m),i.addInts(n,v),i.addStrings(n,_),i.addTensors(n,I),i.addGraphs(n,T),i.endAttribute(n)}}o.Attribute=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsGraph(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsGraph(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}initializers(n,a){let d=this.bb.__offset(this.bb_pos,4);return d?(a||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,8);return d?(a||new t.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,12);return d?(a||new t.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){let d=this.bb.__offset(this.bb_pos,14);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}inputsLength(){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__vector_len(this.bb_pos+n):0}outputs(n,a){let d=this.bb.__offset(this.bb_pos,16);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+n*4,a):null}outputsLength(){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.__vector_len(this.bb_pos+n):0}sparseInitializers(n,a){let d=this.bb.__offset(this.bb_pos,18);return d?(a||new t.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static createInitializersVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startInitializersVector(n,a){n.startVector(4,a,4)}static addNodeArgs(n,a){n.addFieldOffset(1,a,0)}static createNodeArgsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startNodeArgsVector(n,a){n.startVector(4,a,4)}static addNodes(n,a){n.addFieldOffset(2,a,0)}static createNodesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startNodesVector(n,a){n.startVector(4,a,4)}static addMaxNodeIndex(n,a){n.addFieldInt32(3,a,0)}static addNodeEdges(n,a){n.addFieldOffset(4,a,0)}static createNodeEdgesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startNodeEdgesVector(n,a){n.startVector(4,a,4)}static addInputs(n,a){n.addFieldOffset(5,a,0)}static createInputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startInputsVector(n,a){n.startVector(4,a,4)}static addOutputs(n,a){n.addFieldOffset(6,a,0)}static createOutputsVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startOutputsVector(n,a){n.startVector(4,a,4)}static addSparseInitializers(n,a){n.addFieldOffset(7,a,0)}static createSparseInitializersVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startSparseInitializersVector(n,a){n.startVector(4,a,4)}static endGraph(n){return n.endObject()}static createGraph(n,a,d,c,e,l,s,h,f){return i.startGraph(n),i.addInitializers(n,a),i.addNodeArgs(n,d),i.addNodes(n,c),i.addMaxNodeIndex(n,e),i.addNodeEdges(n,l),i.addInputs(n,s),i.addOutputs(n,h),i.addSparseInitializers(n,f),i.endGraph(n)}}o.Graph=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsModel(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsModel(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__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,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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 a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__string(this.bb_pos+a,n):null}producerVersion(n){let a=this.bb.__offset(this.bb_pos,10);return a?this.bb.__string(this.bb_pos+a,n):null}domain(n){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.__string(this.bb_pos+a,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 a=this.bb.__offset(this.bb_pos,16);return a?this.bb.__string(this.bb_pos+a,n):null}graph(n){let a=this.bb.__offset(this.bb_pos,18);return a?(n||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}graphDocString(n){let a=this.bb.__offset(this.bb_pos,20);return a?this.bb.__string(this.bb_pos+a,n):null}static startModel(n){n.startObject(9)}static addIrVersion(n,a){n.addFieldInt64(0,a,n.createLong(0,0))}static addOpsetImport(n,a){n.addFieldOffset(1,a,0)}static createOpsetImportVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startOpsetImportVector(n,a){n.startVector(4,a,4)}static addProducerName(n,a){n.addFieldOffset(2,a,0)}static addProducerVersion(n,a){n.addFieldOffset(3,a,0)}static addDomain(n,a){n.addFieldOffset(4,a,0)}static addModelVersion(n,a){n.addFieldInt64(5,a,n.createLong(0,0))}static addDocString(n,a){n.addFieldOffset(6,a,0)}static addGraph(n,a){n.addFieldOffset(7,a,0)}static addGraphDocString(n,a){n.addFieldOffset(8,a,0)}static endModel(n){return n.endObject()}static createModel(n,a,d,c,e,l,s,h,f,m){return i.startModel(n),i.addIrVersion(n,a),i.addOpsetImport(n,d),i.addProducerName(n,c),i.addProducerVersion(n,e),i.addDomain(n,l),i.addModelVersion(n,s),i.addDocString(n,h),i.addGraph(n,f),i.addGraphDocString(n,m),i.endModel(n)}}o.Model=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsKernelCreateInfos(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsKernelCreateInfos(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}nodeIndices(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.readUint32(this.bb.__vector(this.bb_pos+a)+n*4):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 a=this.bb.__offset(this.bb_pos,6);return a?this.bb.readUint64(this.bb.__vector(this.bb_pos+a)+n*8):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,a){n.addFieldOffset(0,a,0)}static createNodeIndicesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addInt32(a[d]);return n.endVector()}static startNodeIndicesVector(n,a){n.startVector(4,a,4)}static addKernelDefHashes(n,a){n.addFieldOffset(1,a,0)}static createKernelDefHashesVector(n,a){n.startVector(8,a.length,8);for(let d=a.length-1;d>=0;d--)n.addInt64(a[d]);return n.endVector()}static startKernelDefHashesVector(n,a){n.startVector(8,a,8)}static endKernelCreateInfos(n){return n.endObject()}static createKernelCreateInfos(n,a,d){return i.startKernelCreateInfos(n),i.addNodeIndices(n,a),i.addKernelDefHashes(n,d),i.endKernelCreateInfos(n)}}o.KernelCreateInfos=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSubGraphSessionState(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSubGraphSessionState(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}graphId(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}sessionState(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startSubGraphSessionState(n){n.startObject(2)}static addGraphId(n,a){n.addFieldOffset(0,a,0)}static addSessionState(n,a){n.addFieldOffset(1,a,0)}static endSubGraphSessionState(n){let a=n.endObject();return n.requiredField(a,4),a}static createSubGraphSessionState(n,a,d){return i.startSubGraphSessionState(n),i.addGraphId(n,a),i.addSessionState(n,d),i.endSubGraphSessionState(n)}}o.SubGraphSessionState=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsSessionState(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsSessionState(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}kernels(n){let a=this.bb.__offset(this.bb_pos,4);return a?(n||new t.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}subGraphSessionStates(n,a){let d=this.bb.__offset(this.bb_pos,6);return d?(a||new t.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+n*4),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,a){n.addFieldOffset(0,a,0)}static addSubGraphSessionStates(n,a){n.addFieldOffset(1,a,0)}static createSubGraphSessionStatesVector(n,a){n.startVector(4,a.length,4);for(let d=a.length-1;d>=0;d--)n.addOffset(a[d]);return n.endVector()}static startSubGraphSessionStatesVector(n,a){n.startVector(4,a,4)}static endSessionState(n){return n.endObject()}static createSessionState(n,a,d){return i.startSessionState(n),i.addKernels(n,a),i.addSubGraphSessionStates(n,d),i.endSessionState(n)}}o.SessionState=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={})),(t=>{(r=>{(o=>{class i{constructor(){this.bb=null,this.bb_pos=0}__init(n,a){return this.bb_pos=n,this.bb=a,this}static getRootAsInferenceSession(n,a){return(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static getSizePrefixedRootAsInferenceSession(n,a){return n.setPosition(n.position()+w.SIZE_PREFIX_LENGTH),(a||new i).__init(n.readInt32(n.position())+n.position(),n)}static bufferHasIdentifier(n){return n.__has_identifier("ORTM")}ortVersion(n){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__string(this.bb_pos+a,n):null}model(n){let a=this.bb.__offset(this.bb_pos,6);return a?(n||new t.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}sessionState(n){let a=this.bb.__offset(this.bb_pos,8);return a?(n||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+a),this.bb):null}static startInferenceSession(n){n.startObject(3)}static addOrtVersion(n,a){n.addFieldOffset(0,a,0)}static addModel(n,a){n.addFieldOffset(1,a,0)}static addSessionState(n,a){n.addFieldOffset(2,a,0)}static endInferenceSession(n){return n.endObject()}static finishInferenceSessionBuffer(n,a){n.finish(a,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(n,a){n.finish(a,"ORTM",!0)}static createInferenceSession(n,a,d,c){return i.startInferenceSession(n),i.addOrtVersion(n,a),i.addModel(n,d),i.addSessionState(n,c),i.endInferenceSession(n)}}o.InferenceSession=i})(r.fbs||(r.fbs={}))})(t.experimental||(t.experimental={}))})(F||(F={}))}),js=mt((t,r)=>{r.exports=o;function o(i,u){for(var n=new Array(arguments.length-1),a=0,d=2,c=!0;d<arguments.length;)n[a++]=arguments[d++];return new Promise(function(e,l){n[a]=function(s){if(c)if(c=!1,s)l(s);else{for(var h=new Array(arguments.length-1),f=0;f<h.length;)h[f++]=arguments[f];e.apply(null,h)}};try{i.apply(u||null,n)}catch(s){c&&(c=!1,l(s))}})}}),Ys=mt(t=>{var r=t;r.length=function(a){var d=a.length;if(!d)return 0;for(var c=0;--d%4>1&&a.charAt(d)==="=";)++c;return Math.ceil(a.length*3)/4-c};var o=new Array(64),i=new Array(123);for(u=0;u<64;)i[o[u]=u<26?u+65:u<52?u+71:u<62?u-4:u-59|43]=u++;var u;r.encode=function(a,d,c){for(var e=null,l=[],s=0,h=0,f;d<c;){var m=a[d++];switch(h){case 0:l[s++]=o[m>>2],f=(m&3)<<4,h=1;break;case 1:l[s++]=o[f|m>>4],f=(m&15)<<2,h=2;break;case 2:l[s++]=o[f|m>>6],l[s++]=o[m&63],h=0;break}s>8191&&((e||(e=[])).push(String.fromCharCode.apply(String,l)),s=0)}return h&&(l[s++]=o[f],l[s++]=61,h===1&&(l[s++]=61)),e?(s&&e.push(String.fromCharCode.apply(String,l.slice(0,s))),e.join("")):String.fromCharCode.apply(String,l.slice(0,s))};var n="invalid encoding";r.decode=function(a,d,c){for(var e=c,l=0,s,h=0;h<a.length;){var f=a.charCodeAt(h++);if(f===61&&l>1)break;if((f=i[f])===void 0)throw Error(n);switch(l){case 0:s=f,l=1;break;case 1:d[c++]=s<<2|(f&48)>>4,s=f,l=2;break;case 2:d[c++]=(s&15)<<4|(f&60)>>2,s=f,l=3;break;case 3:d[c++]=(s&3)<<6|f,l=0;break}}if(l===1)throw Error(n);return c-e},r.test=function(a){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a)}}),Qs=mt((t,r)=>{r.exports=o;function o(){this._listeners={}}o.prototype.on=function(i,u,n){return(this._listeners[i]||(this._listeners[i]=[])).push({fn:u,ctx:n||this}),this},o.prototype.off=function(i,u){if(i===void 0)this._listeners={};else if(u===void 0)this._listeners[i]=[];else for(var n=this._listeners[i],a=0;a<n.length;)n[a].fn===u?n.splice(a,1):++a;return this},o.prototype.emit=function(i){var u=this._listeners[i];if(u){for(var n=[],a=1;a<arguments.length;)n.push(arguments[a++]);for(a=0;a<u.length;)u[a].fn.apply(u[a++].ctx,n)}return this}}),au=mt((t,r)=>{r.exports=o(o);function o(d){return typeof Float32Array<"u"?function(){var c=new Float32Array([-0]),e=new Uint8Array(c.buffer),l=e[3]===128;function s(v,_,I){c[0]=v,_[I]=e[0],_[I+1]=e[1],_[I+2]=e[2],_[I+3]=e[3]}function h(v,_,I){c[0]=v,_[I]=e[3],_[I+1]=e[2],_[I+2]=e[1],_[I+3]=e[0]}d.writeFloatLE=l?s:h,d.writeFloatBE=l?h:s;function f(v,_){return e[0]=v[_],e[1]=v[_+1],e[2]=v[_+2],e[3]=v[_+3],c[0]}function m(v,_){return e[3]=v[_],e[2]=v[_+1],e[1]=v[_+2],e[0]=v[_+3],c[0]}d.readFloatLE=l?f:m,d.readFloatBE=l?m:f}():function(){function c(l,s,h,f){var m=s<0?1:0;if(m&&(s=-s),s===0)l(1/s>0?0:2147483648,h,f);else if(isNaN(s))l(2143289344,h,f);else if(s>34028234663852886e22)l((m<<31|2139095040)>>>0,h,f);else if(s<11754943508222875e-54)l((m<<31|Math.round(s/1401298464324817e-60))>>>0,h,f);else{var v=Math.floor(Math.log(s)/Math.LN2),_=Math.round(s*Math.pow(2,-v)*8388608)&8388607;l((m<<31|v+127<<23|_)>>>0,h,f)}}d.writeFloatLE=c.bind(null,i),d.writeFloatBE=c.bind(null,u);function e(l,s,h){var f=l(s,h),m=(f>>31)*2+1,v=f>>>23&255,_=f&8388607;return v===255?_?NaN:m*(1/0):v===0?m*1401298464324817e-60*_:m*Math.pow(2,v-150)*(_+8388608)}d.readFloatLE=e.bind(null,n),d.readFloatBE=e.bind(null,a)}(),typeof Float64Array<"u"?function(){var c=new Float64Array([-0]),e=new Uint8Array(c.buffer),l=e[7]===128;function s(v,_,I){c[0]=v,_[I]=e[0],_[I+1]=e[1],_[I+2]=e[2],_[I+3]=e[3],_[I+4]=e[4],_[I+5]=e[5],_[I+6]=e[6],_[I+7]=e[7]}function h(v,_,I){c[0]=v,_[I]=e[7],_[I+1]=e[6],_[I+2]=e[5],_[I+3]=e[4],_[I+4]=e[3],_[I+5]=e[2],_[I+6]=e[1],_[I+7]=e[0]}d.writeDoubleLE=l?s:h,d.writeDoubleBE=l?h:s;function f(v,_){return e[0]=v[_],e[1]=v[_+1],e[2]=v[_+2],e[3]=v[_+3],e[4]=v[_+4],e[5]=v[_+5],e[6]=v[_+6],e[7]=v[_+7],c[0]}function m(v,_){return e[7]=v[_],e[6]=v[_+1],e[5]=v[_+2],e[4]=v[_+3],e[3]=v[_+4],e[2]=v[_+5],e[1]=v[_+6],e[0]=v[_+7],c[0]}d.readDoubleLE=l?f:m,d.readDoubleBE=l?m:f}():function(){function c(l,s,h,f,m,v){var _=f<0?1:0;if(_&&(f=-f),f===0)l(0,m,v+s),l(1/f>0?0:2147483648,m,v+h);else if(isNaN(f))l(0,m,v+s),l(2146959360,m,v+h);else if(f>17976931348623157e292)l(0,m,v+s),l((_<<31|2146435072)>>>0,m,v+h);else{var I;if(f<22250738585072014e-324)I=f/5e-324,l(I>>>0,m,v+s),l((_<<31|I/4294967296)>>>0,m,v+h);else{var T=Math.floor(Math.log(f)/Math.LN2);T===1024&&(T=1023),I=f*Math.pow(2,-T),l(I*4503599627370496>>>0,m,v+s),l((_<<31|T+1023<<20|I*1048576&1048575)>>>0,m,v+h)}}}d.writeDoubleLE=c.bind(null,i,0,4),d.writeDoubleBE=c.bind(null,u,4,0);function e(l,s,h,f,m){var v=l(f,m+s),_=l(f,m+h),I=(_>>31)*2+1,T=_>>>20&2047,P=4294967296*(_&1048575)+v;return T===2047?P?NaN:I*(1/0):T===0?I*5e-324*P:I*Math.pow(2,T-1075)*(P+4503599627370496)}d.readDoubleLE=e.bind(null,n,0,4),d.readDoubleBE=e.bind(null,a,4,0)}(),d}function i(d,c,e){c[e]=d&255,c[e+1]=d>>>8&255,c[e+2]=d>>>16&255,c[e+3]=d>>>24}function u(d,c,e){c[e]=d>>>24,c[e+1]=d>>>16&255,c[e+2]=d>>>8&255,c[e+3]=d&255}function n(d,c){return(d[c]|d[c+1]<<8|d[c+2]<<16|d[c+3]<<24)>>>0}function a(d,c){return(d[c]<<24|d[c+1]<<16|d[c+2]<<8|d[c+3])>>>0}}),su=mt((exports,module)=>{module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}}),lu=mt(t=>{var r=t;r.length=function(o){for(var i=0,u=0,n=0;n<o.length;++n)u=o.charCodeAt(n),u<128?i+=1:u<2048?i+=2:(u&64512)===55296&&(o.charCodeAt(n+1)&64512)===56320?(++n,i+=4):i+=3;return i},r.read=function(o,i,u){var n=u-i;if(n<1)return"";for(var a=null,d=[],c=0,e;i<u;)e=o[i++],e<128?d[c++]=e:e>191&&e<224?d[c++]=(e&31)<<6|o[i++]&63:e>239&&e<365?(e=((e&7)<<18|(o[i++]&63)<<12|(o[i++]&63)<<6|o[i++]&63)-65536,d[c++]=55296+(e>>10),d[c++]=56320+(e&1023)):d[c++]=(e&15)<<12|(o[i++]&63)<<6|o[i++]&63,c>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,d)),c=0);return a?(c&&a.push(String.fromCharCode.apply(String,d.slice(0,c))),a.join("")):String.fromCharCode.apply(String,d.slice(0,c))},r.write=function(o,i,u){for(var n=u,a,d,c=0;c<o.length;++c)a=o.charCodeAt(c),a<128?i[u++]=a:a<2048?(i[u++]=a>>6|192,i[u++]=a&63|128):(a&64512)===55296&&((d=o.charCodeAt(c+1))&64512)===56320?(a=65536+((a&1023)<<10)+(d&1023),++c,i[u++]=a>>18|240,i[u++]=a>>12&63|128,i[u++]=a>>6&63|128,i[u++]=a&63|128):(i[u++]=a>>12|224,i[u++]=a>>6&63|128,i[u++]=a&63|128);return u-n}}),cu=mt((t,r)=>{r.exports=o;function o(i,u,n){var a=n||8192,d=a>>>1,c=null,e=a;return function(l){if(l<1||l>d)return i(l);e+l>a&&(c=i(a),e=0);var s=u.call(c,e,e+=l);return e&7&&(e=(e|7)+1),s}}}),du=mt((t,r)=>{r.exports=i;var o=Se();function i(d,c){this.lo=d>>>0,this.hi=c>>>0}var u=i.zero=new i(0,0);u.toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1};var n=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(d){if(d===0)return u;var c=d<0;c&&(d=-d);var e=d>>>0,l=(d-e)/4294967296>>>0;return c&&(l=~l>>>0,e=~e>>>0,++e>4294967295&&(e=0,++l>4294967295&&(l=0))),new i(e,l)},i.from=function(d){if(typeof d=="number")return i.fromNumber(d);if(o.isString(d))if(o.Long)d=o.Long.fromString(d);else return i.fromNumber(parseInt(d,10));return d.low||d.high?new i(d.low>>>0,d.high>>>0):u},i.prototype.toNumber=function(d){if(!d&&this.hi>>>31){var c=~this.lo+1>>>0,e=~this.hi>>>0;return c||(e=e+1>>>0),-(c+e*4294967296)}return this.lo+this.hi*4294967296},i.prototype.toLong=function(d){return o.Long?new o.Long(this.lo|0,this.hi|0,!!d):{low:this.lo|0,high:this.hi|0,unsigned:!!d}};var a=String.prototype.charCodeAt;i.fromHash=function(d){return d===n?u:new i((a.call(d,0)|a.call(d,1)<<8|a.call(d,2)<<16|a.call(d,3)<<24)>>>0,(a.call(d,4)|a.call(d,5)<<8|a.call(d,6)<<16|a.call(d,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var d=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^d)>>>0,this.lo=(this.lo<<1^d)>>>0,this},i.prototype.zzDecode=function(){var d=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^d)>>>0,this.hi=(this.hi>>>1^d)>>>0,this},i.prototype.length=function(){var d=this.lo,c=(this.lo>>>28|this.hi<<4)>>>0,e=this.hi>>>24;return e===0?c===0?d<16384?d<128?1:2:d<2097152?3:4:c<16384?c<128?5:6:c<2097152?7:8:e<128?9:10}}),Se=mt(t=>{var r=t;r.asPromise=js(),r.base64=Ys(),r.EventEmitter=Qs(),r.float=au(),r.inquire=su(),r.utf8=lu(),r.pool=cu(),r.LongBits=du(),r.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node),r.global=r.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||t,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u},r.isString=function(u){return typeof u=="string"||u instanceof String},r.isObject=function(u){return u&&typeof u=="object"},r.isset=r.isSet=function(u,n){var a=u[n];return a!=null&&u.hasOwnProperty(n)?typeof a!="object"||(Array.isArray(a)?a.length:Object.keys(a).length)>0:!1},r.Buffer=function(){try{var u=r.inquire("buffer").Buffer;return u.prototype.utf8Write?u:null}catch{return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(u){return typeof u=="number"?r.Buffer?r._Buffer_allocUnsafe(u):new r.Array(u):r.Buffer?r._Buffer_from(u):typeof Uint8Array>"u"?u:new Uint8Array(u)},r.Array=typeof Uint8Array<"u"?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(u){return u?r.LongBits.from(u).toHash():r.LongBits.zeroHash},r.longFromHash=function(u,n){var a=r.LongBits.fromHash(u);return r.Long?r.Long.fromBits(a.lo,a.hi,n):a.toNumber(!!n)};function o(u,n,a){for(var d=Object.keys(n),c=0;c<d.length;++c)(u[d[c]]===void 0||!a)&&(u[d[c]]=n[d[c]]);return u}r.merge=o,r.lcFirst=function(u){return u.charAt(0).toLowerCase()+u.substring(1)};function i(u){function n(a,d){if(!(this instanceof n))return new n(a,d);Object.defineProperty(this,"message",{get:function(){return a}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:new Error().stack||""}),d&&o(this,d)}return n.prototype=Object.create(Error.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return u},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),n}r.newError=i,r.ProtocolError=i("ProtocolError"),r.oneOfGetter=function(u){for(var n={},a=0;a<u.length;++a)n[u[a]]=1;return function(){for(var d=Object.keys(this),c=d.length-1;c>-1;--c)if(n[d[c]]===1&&this[d[c]]!==void 0&&this[d[c]]!==null)return d[c]}},r.oneOfSetter=function(u){return function(n){for(var a=0;a<u.length;++a)u[a]!==n&&delete this[u[a]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var u=r.Buffer;if(!u){r._Buffer_from=r._Buffer_allocUnsafe=null;return}r._Buffer_from=u.from!==Uint8Array.from&&u.from||function(n,a){return new u(n,a)},r._Buffer_allocUnsafe=u.allocUnsafe||function(n){return new u(n)}}}),ei=mt((t,r)=>{r.exports=l;var o=Se(),i,u=o.LongBits,n=o.base64,a=o.utf8;function d(T,P,C){this.fn=T,this.len=P,this.next=void 0,this.val=C}function c(){}function e(T){this.head=T.head,this.tail=T.tail,this.len=T.len,this.next=T.states}function l(){this.len=0,this.head=new d(c,0,0),this.tail=this.head,this.states=null}var s=function(){return o.Buffer?function(){return(l.create=function(){return new i})()}:function(){return new l}};l.create=s(),l.alloc=function(T){return new o.Array(T)},o.Array!==Array&&(l.alloc=o.pool(l.alloc,o.Array.prototype.subarray)),l.prototype._push=function(T,P,C){return this.tail=this.tail.next=new d(T,P,C),this.len+=P,this};function h(T,P,C){P[C]=T&255}function f(T,P,C){for(;T>127;)P[C++]=T&127|128,T>>>=7;P[C]=T}function m(T,P){this.len=T,this.next=void 0,this.val=P}m.prototype=Object.create(d.prototype),m.prototype.fn=f,l.prototype.uint32=function(T){return this.len+=(this.tail=this.tail.next=new m((T=T>>>0)<128?1:T<16384?2:T<2097152?3:T<268435456?4:5,T)).len,this},l.prototype.int32=function(T){return T<0?this._push(v,10,u.fromNumber(T)):this.uint32(T)},l.prototype.sint32=function(T){return this.uint32((T<<1^T>>31)>>>0)};function v(T,P,C){for(;T.hi;)P[C++]=T.lo&127|128,T.lo=(T.lo>>>7|T.hi<<25)>>>0,T.hi>>>=7;for(;T.lo>127;)P[C++]=T.lo&127|128,T.lo=T.lo>>>7;P[C++]=T.lo}l.prototype.uint64=function(T){var P=u.from(T);return this._push(v,P.length(),P)},l.prototype.int64=l.prototype.uint64,l.prototype.sint64=function(T){var P=u.from(T).zzEncode();return this._push(v,P.length(),P)},l.prototype.bool=function(T){return this._push(h,1,T?1:0)};function _(T,P,C){P[C]=T&255,P[C+1]=T>>>8&255,P[C+2]=T>>>16&255,P[C+3]=T>>>24}l.prototype.fixed32=function(T){return this._push(_,4,T>>>0)},l.prototype.sfixed32=l.prototype.fixed32,l.prototype.fixed64=function(T){var P=u.from(T);return this._push(_,4,P.lo)._push(_,4,P.hi)},l.prototype.sfixed64=l.prototype.fixed64,l.prototype.float=function(T){return this._push(o.float.writeFloatLE,4,T)},l.prototype.double=function(T){return this._push(o.float.writeDoubleLE,8,T)};var I=o.Array.prototype.set?function(T,P,C){P.set(T,C)}:function(T,P,C){for(var R=0;R<T.length;++R)P[C+R]=T[R]};l.prototype.bytes=function(T){var P=T.length>>>0;if(!P)return this._push(h,1,0);if(o.isString(T)){var C=l.alloc(P=n.length(T));n.decode(T,C,0),T=C}return this.uint32(P)._push(I,P,T)},l.prototype.string=function(T){var P=a.length(T);return P?this.uint32(P)._push(a.write,P,T):this._push(h,1,0)},l.prototype.fork=function(){return this.states=new e(this),this.head=this.tail=new d(c,0,0),this.len=0,this},l.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 d(c,0,0),this.len=0),this},l.prototype.ldelim=function(){var T=this.head,P=this.tail,C=this.len;return this.reset().uint32(C),C&&(this.tail.next=T.next,this.tail=P,this.len+=C),this},l.prototype.finish=function(){for(var T=this.head.next,P=this.constructor.alloc(this.len),C=0;T;)T.fn(T.val,P,C),C+=T.len,T=T.next;return P},l._configure=function(T){i=T,l.create=s(),i._configure()}}),vu=mt((t,r)=>{r.exports=u;var o=ei();(u.prototype=Object.create(o.prototype)).constructor=u;var i=Se();function u(){o.call(this)}u._configure=function(){u.alloc=i._Buffer_allocUnsafe,u.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&i.Buffer.prototype.set.name==="set"?function(a,d,c){d.set(a,c)}:function(a,d,c){if(a.copy)a.copy(d,c,0,a.length);else for(var e=0;e<a.length;)d[c++]=a[e++]}},u.prototype.bytes=function(a){i.isString(a)&&(a=i._Buffer_from(a,"base64"));var d=a.length>>>0;return this.uint32(d),d&&this._push(u.writeBytesBuffer,d,a),this};function n(a,d,c){a.length<40?i.utf8.write(a,d,c):d.utf8Write?d.utf8Write(a,c):d.write(a,c)}u.prototype.string=function(a){var d=i.Buffer.byteLength(a);return this.uint32(d),d&&this._push(n,d,a),this},u._configure()}),oi=mt((t,r)=>{r.exports=d;var o=Se(),i,u=o.LongBits,n=o.utf8;function a(f,m){return RangeError("index out of range: "+f.pos+" + "+(m||1)+" > "+f.len)}function d(f){this.buf=f,this.pos=0,this.len=f.length}var c=typeof Uint8Array<"u"?function(f){if(f instanceof Uint8Array||Array.isArray(f))return new d(f);throw Error("illegal buffer")}:function(f){if(Array.isArray(f))return new d(f);throw Error("illegal buffer")},e=function(){return o.Buffer?function(f){return(d.create=function(m){return o.Buffer.isBuffer(m)?new i(m):c(m)})(f)}:c};d.create=e(),d.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,d.prototype.uint32=function(){var f=4294967295;return function(){if(f=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(f=(f|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(f=(f|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return f;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return f}}(),d.prototype.int32=function(){return this.uint32()|0},d.prototype.sint32=function(){var f=this.uint32();return f>>>1^-(f&1)|0};function l(){var f=new u(0,0),m=0;if(this.len-this.pos>4){for(;m<4;++m)if(f.lo=(f.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return f;if(f.lo=(f.lo|(this.buf[this.pos]&127)<<28)>>>0,f.hi=(f.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return f;m=0}else{for(;m<3;++m){if(this.pos>=this.len)throw a(this);if(f.lo=(f.lo|(this.buf[this.pos]&127)<<m*7)>>>0,this.buf[this.pos++]<128)return f}return f.lo=(f.lo|(this.buf[this.pos++]&127)<<m*7)>>>0,f}if(this.len-this.pos>4){for(;m<5;++m)if(f.hi=(f.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return f}else for(;m<5;++m){if(this.pos>=this.len)throw a(this);if(f.hi=(f.hi|(this.buf[this.pos]&127)<<m*7+3)>>>0,this.buf[this.pos++]<128)return f}throw Error("invalid varint encoding")}d.prototype.bool=function(){return this.uint32()!==0};function s(f,m){return(f[m-4]|f[m-3]<<8|f[m-2]<<16|f[m-1]<<24)>>>0}d.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return s(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return s(this.buf,this.pos+=4)|0};function h(){if(this.pos+8>this.len)throw a(this,8);return new u(s(this.buf,this.pos+=4),s(this.buf,this.pos+=4))}d.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var f=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,f},d.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var f=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,f},d.prototype.bytes=function(){var f=this.uint32(),m=this.pos,v=this.pos+f;if(v>this.len)throw a(this,f);if(this.pos+=f,Array.isArray(this.buf))return this.buf.slice(m,v);if(m===v){var _=o.Buffer;return _?_.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,m,v)},d.prototype.string=function(){var f=this.bytes();return n.read(f,0,f.length)},d.prototype.skip=function(f){if(typeof f=="number"){if(this.pos+f>this.len)throw a(this,f);this.pos+=f}else do if(this.pos>=this.len)throw a(this);while(this.buf[this.pos++]&128);return this},d.prototype.skipType=function(f){switch(f){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(f=this.uint32()&7)!==4;)this.skipType(f);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+f+" at offset "+this.pos)}return this},d._configure=function(f){i=f,d.create=e(),i._configure();var m=o.Long?"toLong":"toNumber";o.merge(d.prototype,{int64:function(){return l.call(this)[m](!1)},uint64:function(){return l.call(this)[m](!0)},sint64:function(){return l.call(this).zzDecode()[m](!1)},fixed64:function(){return h.call(this)[m](!0)},sfixed64:function(){return h.call(this)[m](!1)}})}}),Lu=mt((t,r)=>{r.exports=u;var o=oi();(u.prototype=Object.create(o.prototype)).constructor=u;var i=Se();function u(n){o.call(this,n)}u._configure=function(){i.Buffer&&(u.prototype._slice=i.Buffer.prototype.slice)},u.prototype.string=function(){var n=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+n,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+n,this.len))},u._configure()}),ku=mt((t,r)=>{r.exports=i;var o=Se();(i.prototype=Object.create(o.EventEmitter.prototype)).constructor=i;function i(u,n,a){if(typeof u!="function")throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=u,this.requestDelimited=!!n,this.responseDelimited=!!a}i.prototype.rpcCall=function u(n,a,d,c,e){if(!c)throw TypeError("request must be specified");var l=this;if(!e)return o.asPromise(u,l,n,a,d,c);if(!l.rpcImpl){setTimeout(function(){e(Error("already ended"))},0);return}try{return l.rpcImpl(n,a[l.requestDelimited?"encodeDelimited":"encode"](c).finish(),function(s,h){if(s)return l.emit("error",s,n),e(s);if(h===null){l.end(!0);return}if(!(h instanceof d))try{h=d[l.responseDelimited?"decodeDelimited":"decode"](h)}catch(f){return l.emit("error",f,n),e(f)}return l.emit("data",h,n),e(null,h)})}catch(s){l.emit("error",s,n),setTimeout(function(){e(s)},0);return}},i.prototype.end=function(u){return this.rpcImpl&&(u||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}}),Fu=mt(t=>{var r=t;r.Service=ku()}),Nu=mt((t,r)=>{r.exports={}}),Mu=mt(t=>{var r=t;r.build="minimal",r.Writer=ei(),r.BufferWriter=vu(),r.Reader=oi(),r.BufferReader=Lu(),r.util=Se(),r.rpc=Fu(),r.roots=Nu(),r.configure=o;function o(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}o()}),Vu=mt((t,r)=>{r.exports=Mu()}),sr=mt((t,r)=>{var o=Vu(),i=o.Reader,u=o.Writer,n=o.util,a=o.roots.default||(o.roots.default={});a.onnx=function(){var d={};return d.Version=function(){var c={},e=Object.create(c);return e[c[0]="_START_VERSION"]=0,e[c[1]="IR_VERSION_2017_10_10"]=1,e[c[2]="IR_VERSION_2017_10_30"]=2,e[c[3]="IR_VERSION_2017_11_3"]=3,e[c[4]="IR_VERSION_2019_1_22"]=4,e[c[5]="IR_VERSION_2019_3_18"]=5,e[c[6]="IR_VERSION_2019_9_19"]=6,e[c[7]="IR_VERSION_2020_5_8"]=7,e[c[8]="IR_VERSION_2021_7_30"]=8,e[c[9]="IR_VERSION"]=9,e}(),d.AttributeProto=function(){function c(e){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],this.sparseTensors=[],this.typeProtos=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.name="",c.prototype.refAttrName="",c.prototype.docString="",c.prototype.type=0,c.prototype.f=0,c.prototype.i=n.Long?n.Long.fromBits(0,0,!1):0,c.prototype.s=n.newBuffer([]),c.prototype.t=null,c.prototype.g=null,c.prototype.sparseTensor=null,c.prototype.tp=null,c.prototype.floats=n.emptyArray,c.prototype.ints=n.emptyArray,c.prototype.strings=n.emptyArray,c.prototype.tensors=n.emptyArray,c.prototype.graphs=n.emptyArray,c.prototype.sparseTensors=n.emptyArray,c.prototype.typeProtos=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(10).string(e.name),e.f!=null&&Object.hasOwnProperty.call(e,"f")&&l.uint32(21).float(e.f),e.i!=null&&Object.hasOwnProperty.call(e,"i")&&l.uint32(24).int64(e.i),e.s!=null&&Object.hasOwnProperty.call(e,"s")&&l.uint32(34).bytes(e.s),e.t!=null&&Object.hasOwnProperty.call(e,"t")&&a.onnx.TensorProto.encode(e.t,l.uint32(42).fork()).ldelim(),e.g!=null&&Object.hasOwnProperty.call(e,"g")&&a.onnx.GraphProto.encode(e.g,l.uint32(50).fork()).ldelim(),e.floats!=null&&e.floats.length){l.uint32(58).fork();for(var s=0;s<e.floats.length;++s)l.float(e.floats[s]);l.ldelim()}if(e.ints!=null&&e.ints.length){l.uint32(66).fork();for(var s=0;s<e.ints.length;++s)l.int64(e.ints[s]);l.ldelim()}if(e.strings!=null&&e.strings.length)for(var s=0;s<e.strings.length;++s)l.uint32(74).bytes(e.strings[s]);if(e.tensors!=null&&e.tensors.length)for(var s=0;s<e.tensors.length;++s)a.onnx.TensorProto.encode(e.tensors[s],l.uint32(82).fork()).ldelim();if(e.graphs!=null&&e.graphs.length)for(var s=0;s<e.graphs.length;++s)a.onnx.GraphProto.encode(e.graphs[s],l.uint32(90).fork()).ldelim();if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(106).string(e.docString),e.tp!=null&&Object.hasOwnProperty.call(e,"tp")&&a.onnx.TypeProto.encode(e.tp,l.uint32(114).fork()).ldelim(),e.typeProtos!=null&&e.typeProtos.length)for(var s=0;s<e.typeProtos.length;++s)a.onnx.TypeProto.encode(e.typeProtos[s],l.uint32(122).fork()).ldelim();if(e.type!=null&&Object.hasOwnProperty.call(e,"type")&&l.uint32(160).int32(e.type),e.refAttrName!=null&&Object.hasOwnProperty.call(e,"refAttrName")&&l.uint32(170).string(e.refAttrName),e.sparseTensor!=null&&Object.hasOwnProperty.call(e,"sparseTensor")&&a.onnx.SparseTensorProto.encode(e.sparseTensor,l.uint32(178).fork()).ldelim(),e.sparseTensors!=null&&e.sparseTensors.length)for(var s=0;s<e.sparseTensors.length;++s)a.onnx.SparseTensorProto.encode(e.sparseTensors[s],l.uint32(186).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.AttributeProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.name=e.string();break}case 21:{h.refAttrName=e.string();break}case 13:{h.docString=e.string();break}case 20:{h.type=e.int32();break}case 2:{h.f=e.float();break}case 3:{h.i=e.int64();break}case 4:{h.s=e.bytes();break}case 5:{h.t=a.onnx.TensorProto.decode(e,e.uint32());break}case 6:{h.g=a.onnx.GraphProto.decode(e,e.uint32());break}case 22:{h.sparseTensor=a.onnx.SparseTensorProto.decode(e,e.uint32());break}case 14:{h.tp=a.onnx.TypeProto.decode(e,e.uint32());break}case 7:{if(h.floats&&h.floats.length||(h.floats=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.floats.push(e.float());else h.floats.push(e.float());break}case 8:{if(h.ints&&h.ints.length||(h.ints=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.ints.push(e.int64());else h.ints.push(e.int64());break}case 9:{h.strings&&h.strings.length||(h.strings=[]),h.strings.push(e.bytes());break}case 10:{h.tensors&&h.tensors.length||(h.tensors=[]),h.tensors.push(a.onnx.TensorProto.decode(e,e.uint32()));break}case 11:{h.graphs&&h.graphs.length||(h.graphs=[]),h.graphs.push(a.onnx.GraphProto.decode(e,e.uint32()));break}case 23:{h.sparseTensors&&h.sparseTensors.length||(h.sparseTensors=[]),h.sparseTensors.push(a.onnx.SparseTensorProto.decode(e,e.uint32()));break}case 15:{h.typeProtos&&h.typeProtos.length||(h.typeProtos=[]),h.typeProtos.push(a.onnx.TypeProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.refAttrName!=null&&e.hasOwnProperty("refAttrName")&&!n.isString(e.refAttrName))return"refAttrName: string expected";if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.type!=null&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 11:case 13:case 6:case 7:case 8:case 9:case 10:case 12:case 14:break}if(e.f!=null&&e.hasOwnProperty("f")&&typeof e.f!="number")return"f: number expected";if(e.i!=null&&e.hasOwnProperty("i")&&!n.isInteger(e.i)&&!(e.i&&n.isInteger(e.i.low)&&n.isInteger(e.i.high)))return"i: integer|Long expected";if(e.s!=null&&e.hasOwnProperty("s")&&!(e.s&&typeof e.s.length=="number"||n.isString(e.s)))return"s: buffer expected";if(e.t!=null&&e.hasOwnProperty("t")){var l=a.onnx.TensorProto.verify(e.t);if(l)return"t."+l}if(e.g!=null&&e.hasOwnProperty("g")){var l=a.onnx.GraphProto.verify(e.g);if(l)return"g."+l}if(e.sparseTensor!=null&&e.hasOwnProperty("sparseTensor")){var l=a.onnx.SparseTensorProto.verify(e.sparseTensor);if(l)return"sparseTensor."+l}if(e.tp!=null&&e.hasOwnProperty("tp")){var l=a.onnx.TypeProto.verify(e.tp);if(l)return"tp."+l}if(e.floats!=null&&e.hasOwnProperty("floats")){if(!Array.isArray(e.floats))return"floats: array expected";for(var s=0;s<e.floats.length;++s)if(typeof e.floats[s]!="number")return"floats: number[] expected"}if(e.ints!=null&&e.hasOwnProperty("ints")){if(!Array.isArray(e.ints))return"ints: array expected";for(var s=0;s<e.ints.length;++s)if(!n.isInteger(e.ints[s])&&!(e.ints[s]&&n.isInteger(e.ints[s].low)&&n.isInteger(e.ints[s].high)))return"ints: integer|Long[] expected"}if(e.strings!=null&&e.hasOwnProperty("strings")){if(!Array.isArray(e.strings))return"strings: array expected";for(var s=0;s<e.strings.length;++s)if(!(e.strings[s]&&typeof e.strings[s].length=="number"||n.isString(e.strings[s])))return"strings: buffer[] expected"}if(e.tensors!=null&&e.hasOwnProperty("tensors")){if(!Array.isArray(e.tensors))return"tensors: array expected";for(var s=0;s<e.tensors.length;++s){var l=a.onnx.TensorProto.verify(e.tensors[s]);if(l)return"tensors."+l}}if(e.graphs!=null&&e.hasOwnProperty("graphs")){if(!Array.isArray(e.graphs))return"graphs: array expected";for(var s=0;s<e.graphs.length;++s){var l=a.onnx.GraphProto.verify(e.graphs[s]);if(l)return"graphs."+l}}if(e.sparseTensors!=null&&e.hasOwnProperty("sparseTensors")){if(!Array.isArray(e.sparseTensors))return"sparseTensors: array expected";for(var s=0;s<e.sparseTensors.length;++s){var l=a.onnx.SparseTensorProto.verify(e.sparseTensors[s]);if(l)return"sparseTensors."+l}}if(e.typeProtos!=null&&e.hasOwnProperty("typeProtos")){if(!Array.isArray(e.typeProtos))return"typeProtos: array expected";for(var s=0;s<e.typeProtos.length;++s){var l=a.onnx.TypeProto.verify(e.typeProtos[s]);if(l)return"typeProtos."+l}}return null},c.fromObject=function(e){if(e instanceof a.onnx.AttributeProto)return e;var l=new a.onnx.AttributeProto;switch(e.name!=null&&(l.name=String(e.name)),e.refAttrName!=null&&(l.refAttrName=String(e.refAttrName)),e.docString!=null&&(l.docString=String(e.docString)),e.type){default:if(typeof e.type=="number"){l.type=e.type;break}break;case"UNDEFINED":case 0:l.type=0;break;case"FLOAT":case 1:l.type=1;break;case"INT":case 2:l.type=2;break;case"STRING":case 3:l.type=3;break;case"TENSOR":case 4:l.type=4;break;case"GRAPH":case 5:l.type=5;break;case"SPARSE_TENSOR":case 11:l.type=11;break;case"TYPE_PROTO":case 13:l.type=13;break;case"FLOATS":case 6:l.type=6;break;case"INTS":case 7:l.type=7;break;case"STRINGS":case 8:l.type=8;break;case"TENSORS":case 9:l.type=9;break;case"GRAPHS":case 10:l.type=10;break;case"SPARSE_TENSORS":case 12:l.type=12;break;case"TYPE_PROTOS":case 14:l.type=14;break}if(e.f!=null&&(l.f=Number(e.f)),e.i!=null&&(n.Long?(l.i=n.Long.fromValue(e.i)).unsigned=!1:typeof e.i=="string"?l.i=parseInt(e.i,10):typeof e.i=="number"?l.i=e.i:typeof e.i=="object"&&(l.i=new n.LongBits(e.i.low>>>0,e.i.high>>>0).toNumber())),e.s!=null&&(typeof e.s=="string"?n.base64.decode(e.s,l.s=n.newBuffer(n.base64.length(e.s)),0):e.s.length>=0&&(l.s=e.s)),e.t!=null){if(typeof e.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");l.t=a.onnx.TensorProto.fromObject(e.t)}if(e.g!=null){if(typeof e.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");l.g=a.onnx.GraphProto.fromObject(e.g)}if(e.sparseTensor!=null){if(typeof e.sparseTensor!="object")throw TypeError(".onnx.AttributeProto.sparseTensor: object expected");l.sparseTensor=a.onnx.SparseTensorProto.fromObject(e.sparseTensor)}if(e.tp!=null){if(typeof e.tp!="object")throw TypeError(".onnx.AttributeProto.tp: object expected");l.tp=a.onnx.TypeProto.fromObject(e.tp)}if(e.floats){if(!Array.isArray(e.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");l.floats=[];for(var s=0;s<e.floats.length;++s)l.floats[s]=Number(e.floats[s])}if(e.ints){if(!Array.isArray(e.ints))throw TypeError(".onnx.AttributeProto.ints: array expected");l.ints=[];for(var s=0;s<e.ints.length;++s)n.Long?(l.ints[s]=n.Long.fromValue(e.ints[s])).unsigned=!1:typeof e.ints[s]=="string"?l.ints[s]=parseInt(e.ints[s],10):typeof e.ints[s]=="number"?l.ints[s]=e.ints[s]:typeof e.ints[s]=="object"&&(l.ints[s]=new n.LongBits(e.ints[s].low>>>0,e.ints[s].high>>>0).toNumber())}if(e.strings){if(!Array.isArray(e.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");l.strings=[];for(var s=0;s<e.strings.length;++s)typeof e.strings[s]=="string"?n.base64.decode(e.strings[s],l.strings[s]=n.newBuffer(n.base64.length(e.strings[s])),0):e.strings[s].length>=0&&(l.strings[s]=e.strings[s])}if(e.tensors){if(!Array.isArray(e.tensors))throw TypeError(".onnx.AttributeProto.tensors: array expected");l.tensors=[];for(var s=0;s<e.tensors.length;++s){if(typeof e.tensors[s]!="object")throw TypeError(".onnx.AttributeProto.tensors: object expected");l.tensors[s]=a.onnx.TensorProto.fromObject(e.tensors[s])}}if(e.graphs){if(!Array.isArray(e.graphs))throw TypeError(".onnx.AttributeProto.graphs: array expected");l.graphs=[];for(var s=0;s<e.graphs.length;++s){if(typeof e.graphs[s]!="object")throw TypeError(".onnx.AttributeProto.graphs: object expected");l.graphs[s]=a.onnx.GraphProto.fromObject(e.graphs[s])}}if(e.sparseTensors){if(!Array.isArray(e.sparseTensors))throw TypeError(".onnx.AttributeProto.sparseTensors: array expected");l.sparseTensors=[];for(var s=0;s<e.sparseTensors.length;++s){if(typeof e.sparseTensors[s]!="object")throw TypeError(".onnx.AttributeProto.sparseTensors: object expected");l.sparseTensors[s]=a.onnx.SparseTensorProto.fromObject(e.sparseTensors[s])}}if(e.typeProtos){if(!Array.isArray(e.typeProtos))throw TypeError(".onnx.AttributeProto.typeProtos: array expected");l.typeProtos=[];for(var s=0;s<e.typeProtos.length;++s){if(typeof e.typeProtos[s]!="object")throw TypeError(".onnx.AttributeProto.typeProtos: object expected");l.typeProtos[s]=a.onnx.TypeProto.fromObject(e.typeProtos[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.floats=[],s.ints=[],s.strings=[],s.tensors=[],s.graphs=[],s.typeProtos=[],s.sparseTensors=[]),l.defaults){if(s.name="",s.f=0,n.Long){var h=new n.Long(0,0,!1);s.i=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.i=l.longs===String?"0":0;l.bytes===String?s.s="":(s.s=[],l.bytes!==Array&&(s.s=n.newBuffer(s.s))),s.t=null,s.g=null,s.docString="",s.tp=null,s.type=l.enums===String?"UNDEFINED":0,s.refAttrName="",s.sparseTensor=null}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.f!=null&&e.hasOwnProperty("f")&&(s.f=l.json&&!isFinite(e.f)?String(e.f):e.f),e.i!=null&&e.hasOwnProperty("i")&&(typeof e.i=="number"?s.i=l.longs===String?String(e.i):e.i:s.i=l.longs===String?n.Long.prototype.toString.call(e.i):l.longs===Number?new n.LongBits(e.i.low>>>0,e.i.high>>>0).toNumber():e.i),e.s!=null&&e.hasOwnProperty("s")&&(s.s=l.bytes===String?n.base64.encode(e.s,0,e.s.length):l.bytes===Array?Array.prototype.slice.call(e.s):e.s),e.t!=null&&e.hasOwnProperty("t")&&(s.t=a.onnx.TensorProto.toObject(e.t,l)),e.g!=null&&e.hasOwnProperty("g")&&(s.g=a.onnx.GraphProto.toObject(e.g,l)),e.floats&&e.floats.length){s.floats=[];for(var f=0;f<e.floats.length;++f)s.floats[f]=l.json&&!isFinite(e.floats[f])?String(e.floats[f]):e.floats[f]}if(e.ints&&e.ints.length){s.ints=[];for(var f=0;f<e.ints.length;++f)typeof e.ints[f]=="number"?s.ints[f]=l.longs===String?String(e.ints[f]):e.ints[f]:s.ints[f]=l.longs===String?n.Long.prototype.toString.call(e.ints[f]):l.longs===Number?new n.LongBits(e.ints[f].low>>>0,e.ints[f].high>>>0).toNumber():e.ints[f]}if(e.strings&&e.strings.length){s.strings=[];for(var f=0;f<e.strings.length;++f)s.strings[f]=l.bytes===String?n.base64.encode(e.strings[f],0,e.strings[f].length):l.bytes===Array?Array.prototype.slice.call(e.strings[f]):e.strings[f]}if(e.tensors&&e.tensors.length){s.tensors=[];for(var f=0;f<e.tensors.length;++f)s.tensors[f]=a.onnx.TensorProto.toObject(e.tensors[f],l)}if(e.graphs&&e.graphs.length){s.graphs=[];for(var f=0;f<e.graphs.length;++f)s.graphs[f]=a.onnx.GraphProto.toObject(e.graphs[f],l)}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.tp!=null&&e.hasOwnProperty("tp")&&(s.tp=a.onnx.TypeProto.toObject(e.tp,l)),e.typeProtos&&e.typeProtos.length){s.typeProtos=[];for(var f=0;f<e.typeProtos.length;++f)s.typeProtos[f]=a.onnx.TypeProto.toObject(e.typeProtos[f],l)}if(e.type!=null&&e.hasOwnProperty("type")&&(s.type=l.enums===String?a.onnx.AttributeProto.AttributeType[e.type]===void 0?e.type:a.onnx.AttributeProto.AttributeType[e.type]:e.type),e.refAttrName!=null&&e.hasOwnProperty("refAttrName")&&(s.refAttrName=e.refAttrName),e.sparseTensor!=null&&e.hasOwnProperty("sparseTensor")&&(s.sparseTensor=a.onnx.SparseTensorProto.toObject(e.sparseTensor,l)),e.sparseTensors&&e.sparseTensors.length){s.sparseTensors=[];for(var f=0;f<e.sparseTensors.length;++f)s.sparseTensors[f]=a.onnx.SparseTensorProto.toObject(e.sparseTensors[f],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.AttributeProto"},c.AttributeType=function(){var e={},l=Object.create(e);return l[e[0]="UNDEFINED"]=0,l[e[1]="FLOAT"]=1,l[e[2]="INT"]=2,l[e[3]="STRING"]=3,l[e[4]="TENSOR"]=4,l[e[5]="GRAPH"]=5,l[e[11]="SPARSE_TENSOR"]=11,l[e[13]="TYPE_PROTO"]=13,l[e[6]="FLOATS"]=6,l[e[7]="INTS"]=7,l[e[8]="STRINGS"]=8,l[e[9]="TENSORS"]=9,l[e[10]="GRAPHS"]=10,l[e[12]="SPARSE_TENSORS"]=12,l[e[14]="TYPE_PROTOS"]=14,l}(),c}(),d.ValueInfoProto=function(){function c(e){if(e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.name="",c.prototype.type=null,c.prototype.docString="",c.create=function(e){return new c(e)},c.encode=function(e,l){return l||(l=u.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(10).string(e.name),e.type!=null&&Object.hasOwnProperty.call(e,"type")&&a.onnx.TypeProto.encode(e.type,l.uint32(18).fork()).ldelim(),e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(26).string(e.docString),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.ValueInfoProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.name=e.string();break}case 2:{h.type=a.onnx.TypeProto.decode(e,e.uint32());break}case 3:{h.docString=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.type!=null&&e.hasOwnProperty("type")){var l=a.onnx.TypeProto.verify(e.type);if(l)return"type."+l}return e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString)?"docString: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.ValueInfoProto)return e;var l=new a.onnx.ValueInfoProto;if(e.name!=null&&(l.name=String(e.name)),e.type!=null){if(typeof e.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");l.type=a.onnx.TypeProto.fromObject(e.type)}return e.docString!=null&&(l.docString=String(e.docString)),l},c.toObject=function(e,l){l||(l={});var s={};return l.defaults&&(s.name="",s.type=null,s.docString=""),e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.type!=null&&e.hasOwnProperty("type")&&(s.type=a.onnx.TypeProto.toObject(e.type,l)),e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.ValueInfoProto"},c}(),d.NodeProto=function(){function c(e){if(this.input=[],this.output=[],this.attribute=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.input=n.emptyArray,c.prototype.output=n.emptyArray,c.prototype.name="",c.prototype.opType="",c.prototype.domain="",c.prototype.attribute=n.emptyArray,c.prototype.docString="",c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.input!=null&&e.input.length)for(var s=0;s<e.input.length;++s)l.uint32(10).string(e.input[s]);if(e.output!=null&&e.output.length)for(var s=0;s<e.output.length;++s)l.uint32(18).string(e.output[s]);if(e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(26).string(e.name),e.opType!=null&&Object.hasOwnProperty.call(e,"opType")&&l.uint32(34).string(e.opType),e.attribute!=null&&e.attribute.length)for(var s=0;s<e.attribute.length;++s)a.onnx.AttributeProto.encode(e.attribute[s],l.uint32(42).fork()).ldelim();return e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(50).string(e.docString),e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(58).string(e.domain),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.NodeProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.input&&h.input.length||(h.input=[]),h.input.push(e.string());break}case 2:{h.output&&h.output.length||(h.output=[]),h.output.push(e.string());break}case 3:{h.name=e.string();break}case 4:{h.opType=e.string();break}case 7:{h.domain=e.string();break}case 5:{h.attribute&&h.attribute.length||(h.attribute=[]),h.attribute.push(a.onnx.AttributeProto.decode(e,e.uint32()));break}case 6:{h.docString=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var l=0;l<e.input.length;++l)if(!n.isString(e.input[l]))return"input: string[] expected"}if(e.output!=null&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(var l=0;l<e.output.length;++l)if(!n.isString(e.output[l]))return"output: string[] expected"}if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.opType!=null&&e.hasOwnProperty("opType")&&!n.isString(e.opType))return"opType: string expected";if(e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain))return"domain: string expected";if(e.attribute!=null&&e.hasOwnProperty("attribute")){if(!Array.isArray(e.attribute))return"attribute: array expected";for(var l=0;l<e.attribute.length;++l){var s=a.onnx.AttributeProto.verify(e.attribute[l]);if(s)return"attribute."+s}}return e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString)?"docString: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.NodeProto)return e;var l=new a.onnx.NodeProto;if(e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.NodeProto.input: array expected");l.input=[];for(var s=0;s<e.input.length;++s)l.input[s]=String(e.input[s])}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.NodeProto.output: array expected");l.output=[];for(var s=0;s<e.output.length;++s)l.output[s]=String(e.output[s])}if(e.name!=null&&(l.name=String(e.name)),e.opType!=null&&(l.opType=String(e.opType)),e.domain!=null&&(l.domain=String(e.domain)),e.attribute){if(!Array.isArray(e.attribute))throw TypeError(".onnx.NodeProto.attribute: array expected");l.attribute=[];for(var s=0;s<e.attribute.length;++s){if(typeof e.attribute[s]!="object")throw TypeError(".onnx.NodeProto.attribute: object expected");l.attribute[s]=a.onnx.AttributeProto.fromObject(e.attribute[s])}}return e.docString!=null&&(l.docString=String(e.docString)),l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.input=[],s.output=[],s.attribute=[]),l.defaults&&(s.name="",s.opType="",s.docString="",s.domain=""),e.input&&e.input.length){s.input=[];for(var h=0;h<e.input.length;++h)s.input[h]=e.input[h]}if(e.output&&e.output.length){s.output=[];for(var h=0;h<e.output.length;++h)s.output[h]=e.output[h]}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.opType!=null&&e.hasOwnProperty("opType")&&(s.opType=e.opType),e.attribute&&e.attribute.length){s.attribute=[];for(var h=0;h<e.attribute.length;++h)s.attribute[h]=a.onnx.AttributeProto.toObject(e.attribute[h],l)}return e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.NodeProto"},c}(),d.TrainingInfoProto=function(){function c(e){if(this.initializationBinding=[],this.updateBinding=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.initialization=null,c.prototype.algorithm=null,c.prototype.initializationBinding=n.emptyArray,c.prototype.updateBinding=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.initialization!=null&&Object.hasOwnProperty.call(e,"initialization")&&a.onnx.GraphProto.encode(e.initialization,l.uint32(10).fork()).ldelim(),e.algorithm!=null&&Object.hasOwnProperty.call(e,"algorithm")&&a.onnx.GraphProto.encode(e.algorithm,l.uint32(18).fork()).ldelim(),e.initializationBinding!=null&&e.initializationBinding.length)for(var s=0;s<e.initializationBinding.length;++s)a.onnx.StringStringEntryProto.encode(e.initializationBinding[s],l.uint32(26).fork()).ldelim();if(e.updateBinding!=null&&e.updateBinding.length)for(var s=0;s<e.updateBinding.length;++s)a.onnx.StringStringEntryProto.encode(e.updateBinding[s],l.uint32(34).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TrainingInfoProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.initialization=a.onnx.GraphProto.decode(e,e.uint32());break}case 2:{h.algorithm=a.onnx.GraphProto.decode(e,e.uint32());break}case 3:{h.initializationBinding&&h.initializationBinding.length||(h.initializationBinding=[]),h.initializationBinding.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}case 4:{h.updateBinding&&h.updateBinding.length||(h.updateBinding=[]),h.updateBinding.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.initialization!=null&&e.hasOwnProperty("initialization")){var l=a.onnx.GraphProto.verify(e.initialization);if(l)return"initialization."+l}if(e.algorithm!=null&&e.hasOwnProperty("algorithm")){var l=a.onnx.GraphProto.verify(e.algorithm);if(l)return"algorithm."+l}if(e.initializationBinding!=null&&e.hasOwnProperty("initializationBinding")){if(!Array.isArray(e.initializationBinding))return"initializationBinding: array expected";for(var s=0;s<e.initializationBinding.length;++s){var l=a.onnx.StringStringEntryProto.verify(e.initializationBinding[s]);if(l)return"initializationBinding."+l}}if(e.updateBinding!=null&&e.hasOwnProperty("updateBinding")){if(!Array.isArray(e.updateBinding))return"updateBinding: array expected";for(var s=0;s<e.updateBinding.length;++s){var l=a.onnx.StringStringEntryProto.verify(e.updateBinding[s]);if(l)return"updateBinding."+l}}return null},c.fromObject=function(e){if(e instanceof a.onnx.TrainingInfoProto)return e;var l=new a.onnx.TrainingInfoProto;if(e.initialization!=null){if(typeof e.initialization!="object")throw TypeError(".onnx.TrainingInfoProto.initialization: object expected");l.initialization=a.onnx.GraphProto.fromObject(e.initialization)}if(e.algorithm!=null){if(typeof e.algorithm!="object")throw TypeError(".onnx.TrainingInfoProto.algorithm: object expected");l.algorithm=a.onnx.GraphProto.fromObject(e.algorithm)}if(e.initializationBinding){if(!Array.isArray(e.initializationBinding))throw TypeError(".onnx.TrainingInfoProto.initializationBinding: array expected");l.initializationBinding=[];for(var s=0;s<e.initializationBinding.length;++s){if(typeof e.initializationBinding[s]!="object")throw TypeError(".onnx.TrainingInfoProto.initializationBinding: object expected");l.initializationBinding[s]=a.onnx.StringStringEntryProto.fromObject(e.initializationBinding[s])}}if(e.updateBinding){if(!Array.isArray(e.updateBinding))throw TypeError(".onnx.TrainingInfoProto.updateBinding: array expected");l.updateBinding=[];for(var s=0;s<e.updateBinding.length;++s){if(typeof e.updateBinding[s]!="object")throw TypeError(".onnx.TrainingInfoProto.updateBinding: object expected");l.updateBinding[s]=a.onnx.StringStringEntryProto.fromObject(e.updateBinding[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.initializationBinding=[],s.updateBinding=[]),l.defaults&&(s.initialization=null,s.algorithm=null),e.initialization!=null&&e.hasOwnProperty("initialization")&&(s.initialization=a.onnx.GraphProto.toObject(e.initialization,l)),e.algorithm!=null&&e.hasOwnProperty("algorithm")&&(s.algorithm=a.onnx.GraphProto.toObject(e.algorithm,l)),e.initializationBinding&&e.initializationBinding.length){s.initializationBinding=[];for(var h=0;h<e.initializationBinding.length;++h)s.initializationBinding[h]=a.onnx.StringStringEntryProto.toObject(e.initializationBinding[h],l)}if(e.updateBinding&&e.updateBinding.length){s.updateBinding=[];for(var h=0;h<e.updateBinding.length;++h)s.updateBinding[h]=a.onnx.StringStringEntryProto.toObject(e.updateBinding[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TrainingInfoProto"},c}(),d.ModelProto=function(){function c(e){if(this.opsetImport=[],this.metadataProps=[],this.trainingInfo=[],this.functions=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.irVersion=n.Long?n.Long.fromBits(0,0,!1):0,c.prototype.opsetImport=n.emptyArray,c.prototype.producerName="",c.prototype.producerVersion="",c.prototype.domain="",c.prototype.modelVersion=n.Long?n.Long.fromBits(0,0,!1):0,c.prototype.docString="",c.prototype.graph=null,c.prototype.metadataProps=n.emptyArray,c.prototype.trainingInfo=n.emptyArray,c.prototype.functions=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.irVersion!=null&&Object.hasOwnProperty.call(e,"irVersion")&&l.uint32(8).int64(e.irVersion),e.producerName!=null&&Object.hasOwnProperty.call(e,"producerName")&&l.uint32(18).string(e.producerName),e.producerVersion!=null&&Object.hasOwnProperty.call(e,"producerVersion")&&l.uint32(26).string(e.producerVersion),e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(34).string(e.domain),e.modelVersion!=null&&Object.hasOwnProperty.call(e,"modelVersion")&&l.uint32(40).int64(e.modelVersion),e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(50).string(e.docString),e.graph!=null&&Object.hasOwnProperty.call(e,"graph")&&a.onnx.GraphProto.encode(e.graph,l.uint32(58).fork()).ldelim(),e.opsetImport!=null&&e.opsetImport.length)for(var s=0;s<e.opsetImport.length;++s)a.onnx.OperatorSetIdProto.encode(e.opsetImport[s],l.uint32(66).fork()).ldelim();if(e.metadataProps!=null&&e.metadataProps.length)for(var s=0;s<e.metadataProps.length;++s)a.onnx.StringStringEntryProto.encode(e.metadataProps[s],l.uint32(114).fork()).ldelim();if(e.trainingInfo!=null&&e.trainingInfo.length)for(var s=0;s<e.trainingInfo.length;++s)a.onnx.TrainingInfoProto.encode(e.trainingInfo[s],l.uint32(162).fork()).ldelim();if(e.functions!=null&&e.functions.length)for(var s=0;s<e.functions.length;++s)a.onnx.FunctionProto.encode(e.functions[s],l.uint32(202).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.ModelProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.irVersion=e.int64();break}case 8:{h.opsetImport&&h.opsetImport.length||(h.opsetImport=[]),h.opsetImport.push(a.onnx.OperatorSetIdProto.decode(e,e.uint32()));break}case 2:{h.producerName=e.string();break}case 3:{h.producerVersion=e.string();break}case 4:{h.domain=e.string();break}case 5:{h.modelVersion=e.int64();break}case 6:{h.docString=e.string();break}case 7:{h.graph=a.onnx.GraphProto.decode(e,e.uint32());break}case 14:{h.metadataProps&&h.metadataProps.length||(h.metadataProps=[]),h.metadataProps.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}case 20:{h.trainingInfo&&h.trainingInfo.length||(h.trainingInfo=[]),h.trainingInfo.push(a.onnx.TrainingInfoProto.decode(e,e.uint32()));break}case 25:{h.functions&&h.functions.length||(h.functions=[]),h.functions.push(a.onnx.FunctionProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.irVersion!=null&&e.hasOwnProperty("irVersion")&&!n.isInteger(e.irVersion)&&!(e.irVersion&&n.isInteger(e.irVersion.low)&&n.isInteger(e.irVersion.high)))return"irVersion: integer|Long expected";if(e.opsetImport!=null&&e.hasOwnProperty("opsetImport")){if(!Array.isArray(e.opsetImport))return"opsetImport: array expected";for(var l=0;l<e.opsetImport.length;++l){var s=a.onnx.OperatorSetIdProto.verify(e.opsetImport[l]);if(s)return"opsetImport."+s}}if(e.producerName!=null&&e.hasOwnProperty("producerName")&&!n.isString(e.producerName))return"producerName: string expected";if(e.producerVersion!=null&&e.hasOwnProperty("producerVersion")&&!n.isString(e.producerVersion))return"producerVersion: string expected";if(e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain))return"domain: string expected";if(e.modelVersion!=null&&e.hasOwnProperty("modelVersion")&&!n.isInteger(e.modelVersion)&&!(e.modelVersion&&n.isInteger(e.modelVersion.low)&&n.isInteger(e.modelVersion.high)))return"modelVersion: integer|Long expected";if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.graph!=null&&e.hasOwnProperty("graph")){var s=a.onnx.GraphProto.verify(e.graph);if(s)return"graph."+s}if(e.metadataProps!=null&&e.hasOwnProperty("metadataProps")){if(!Array.isArray(e.metadataProps))return"metadataProps: array expected";for(var l=0;l<e.metadataProps.length;++l){var s=a.onnx.StringStringEntryProto.verify(e.metadataProps[l]);if(s)return"metadataProps."+s}}if(e.trainingInfo!=null&&e.hasOwnProperty("trainingInfo")){if(!Array.isArray(e.trainingInfo))return"trainingInfo: array expected";for(var l=0;l<e.trainingInfo.length;++l){var s=a.onnx.TrainingInfoProto.verify(e.trainingInfo[l]);if(s)return"trainingInfo."+s}}if(e.functions!=null&&e.hasOwnProperty("functions")){if(!Array.isArray(e.functions))return"functions: array expected";for(var l=0;l<e.functions.length;++l){var s=a.onnx.FunctionProto.verify(e.functions[l]);if(s)return"functions."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.ModelProto)return e;var l=new a.onnx.ModelProto;if(e.irVersion!=null&&(n.Long?(l.irVersion=n.Long.fromValue(e.irVersion)).unsigned=!1:typeof e.irVersion=="string"?l.irVersion=parseInt(e.irVersion,10):typeof e.irVersion=="number"?l.irVersion=e.irVersion:typeof e.irVersion=="object"&&(l.irVersion=new n.LongBits(e.irVersion.low>>>0,e.irVersion.high>>>0).toNumber())),e.opsetImport){if(!Array.isArray(e.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");l.opsetImport=[];for(var s=0;s<e.opsetImport.length;++s){if(typeof e.opsetImport[s]!="object")throw TypeError(".onnx.ModelProto.opsetImport: object expected");l.opsetImport[s]=a.onnx.OperatorSetIdProto.fromObject(e.opsetImport[s])}}if(e.producerName!=null&&(l.producerName=String(e.producerName)),e.producerVersion!=null&&(l.producerVersion=String(e.producerVersion)),e.domain!=null&&(l.domain=String(e.domain)),e.modelVersion!=null&&(n.Long?(l.modelVersion=n.Long.fromValue(e.modelVersion)).unsigned=!1:typeof e.modelVersion=="string"?l.modelVersion=parseInt(e.modelVersion,10):typeof e.modelVersion=="number"?l.modelVersion=e.modelVersion:typeof e.modelVersion=="object"&&(l.modelVersion=new n.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber())),e.docString!=null&&(l.docString=String(e.docString)),e.graph!=null){if(typeof e.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");l.graph=a.onnx.GraphProto.fromObject(e.graph)}if(e.metadataProps){if(!Array.isArray(e.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");l.metadataProps=[];for(var s=0;s<e.metadataProps.length;++s){if(typeof e.metadataProps[s]!="object")throw TypeError(".onnx.ModelProto.metadataProps: object expected");l.metadataProps[s]=a.onnx.StringStringEntryProto.fromObject(e.metadataProps[s])}}if(e.trainingInfo){if(!Array.isArray(e.trainingInfo))throw TypeError(".onnx.ModelProto.trainingInfo: array expected");l.trainingInfo=[];for(var s=0;s<e.trainingInfo.length;++s){if(typeof e.trainingInfo[s]!="object")throw TypeError(".onnx.ModelProto.trainingInfo: object expected");l.trainingInfo[s]=a.onnx.TrainingInfoProto.fromObject(e.trainingInfo[s])}}if(e.functions){if(!Array.isArray(e.functions))throw TypeError(".onnx.ModelProto.functions: array expected");l.functions=[];for(var s=0;s<e.functions.length;++s){if(typeof e.functions[s]!="object")throw TypeError(".onnx.ModelProto.functions: object expected");l.functions[s]=a.onnx.FunctionProto.fromObject(e.functions[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.opsetImport=[],s.metadataProps=[],s.trainingInfo=[],s.functions=[]),l.defaults){if(n.Long){var h=new n.Long(0,0,!1);s.irVersion=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.irVersion=l.longs===String?"0":0;if(s.producerName="",s.producerVersion="",s.domain="",n.Long){var h=new n.Long(0,0,!1);s.modelVersion=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.modelVersion=l.longs===String?"0":0;s.docString="",s.graph=null}if(e.irVersion!=null&&e.hasOwnProperty("irVersion")&&(typeof e.irVersion=="number"?s.irVersion=l.longs===String?String(e.irVersion):e.irVersion:s.irVersion=l.longs===String?n.Long.prototype.toString.call(e.irVersion):l.longs===Number?new n.LongBits(e.irVersion.low>>>0,e.irVersion.high>>>0).toNumber():e.irVersion),e.producerName!=null&&e.hasOwnProperty("producerName")&&(s.producerName=e.producerName),e.producerVersion!=null&&e.hasOwnProperty("producerVersion")&&(s.producerVersion=e.producerVersion),e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),e.modelVersion!=null&&e.hasOwnProperty("modelVersion")&&(typeof e.modelVersion=="number"?s.modelVersion=l.longs===String?String(e.modelVersion):e.modelVersion:s.modelVersion=l.longs===String?n.Long.prototype.toString.call(e.modelVersion):l.longs===Number?new n.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber():e.modelVersion),e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.graph!=null&&e.hasOwnProperty("graph")&&(s.graph=a.onnx.GraphProto.toObject(e.graph,l)),e.opsetImport&&e.opsetImport.length){s.opsetImport=[];for(var f=0;f<e.opsetImport.length;++f)s.opsetImport[f]=a.onnx.OperatorSetIdProto.toObject(e.opsetImport[f],l)}if(e.metadataProps&&e.metadataProps.length){s.metadataProps=[];for(var f=0;f<e.metadataProps.length;++f)s.metadataProps[f]=a.onnx.StringStringEntryProto.toObject(e.metadataProps[f],l)}if(e.trainingInfo&&e.trainingInfo.length){s.trainingInfo=[];for(var f=0;f<e.trainingInfo.length;++f)s.trainingInfo[f]=a.onnx.TrainingInfoProto.toObject(e.trainingInfo[f],l)}if(e.functions&&e.functions.length){s.functions=[];for(var f=0;f<e.functions.length;++f)s.functions[f]=a.onnx.FunctionProto.toObject(e.functions[f],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.ModelProto"},c}(),d.StringStringEntryProto=function(){function c(e){if(e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.key="",c.prototype.value="",c.create=function(e){return new c(e)},c.encode=function(e,l){return l||(l=u.create()),e.key!=null&&Object.hasOwnProperty.call(e,"key")&&l.uint32(10).string(e.key),e.value!=null&&Object.hasOwnProperty.call(e,"value")&&l.uint32(18).string(e.value),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.StringStringEntryProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.key=e.string();break}case 2:{h.value=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){return typeof e!="object"||e===null?"object expected":e.key!=null&&e.hasOwnProperty("key")&&!n.isString(e.key)?"key: string expected":e.value!=null&&e.hasOwnProperty("value")&&!n.isString(e.value)?"value: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.StringStringEntryProto)return e;var l=new a.onnx.StringStringEntryProto;return e.key!=null&&(l.key=String(e.key)),e.value!=null&&(l.value=String(e.value)),l},c.toObject=function(e,l){l||(l={});var s={};return l.defaults&&(s.key="",s.value=""),e.key!=null&&e.hasOwnProperty("key")&&(s.key=e.key),e.value!=null&&e.hasOwnProperty("value")&&(s.value=e.value),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.StringStringEntryProto"},c}(),d.TensorAnnotation=function(){function c(e){if(this.quantParameterTensorNames=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.tensorName="",c.prototype.quantParameterTensorNames=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.tensorName!=null&&Object.hasOwnProperty.call(e,"tensorName")&&l.uint32(10).string(e.tensorName),e.quantParameterTensorNames!=null&&e.quantParameterTensorNames.length)for(var s=0;s<e.quantParameterTensorNames.length;++s)a.onnx.StringStringEntryProto.encode(e.quantParameterTensorNames[s],l.uint32(18).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TensorAnnotation;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.tensorName=e.string();break}case 2:{h.quantParameterTensorNames&&h.quantParameterTensorNames.length||(h.quantParameterTensorNames=[]),h.quantParameterTensorNames.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.tensorName!=null&&e.hasOwnProperty("tensorName")&&!n.isString(e.tensorName))return"tensorName: string expected";if(e.quantParameterTensorNames!=null&&e.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(e.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var l=0;l<e.quantParameterTensorNames.length;++l){var s=a.onnx.StringStringEntryProto.verify(e.quantParameterTensorNames[l]);if(s)return"quantParameterTensorNames."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.TensorAnnotation)return e;var l=new a.onnx.TensorAnnotation;if(e.tensorName!=null&&(l.tensorName=String(e.tensorName)),e.quantParameterTensorNames){if(!Array.isArray(e.quantParameterTensorNames))throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: array expected");l.quantParameterTensorNames=[];for(var s=0;s<e.quantParameterTensorNames.length;++s){if(typeof e.quantParameterTensorNames[s]!="object")throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: object expected");l.quantParameterTensorNames[s]=a.onnx.StringStringEntryProto.fromObject(e.quantParameterTensorNames[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.quantParameterTensorNames=[]),l.defaults&&(s.tensorName=""),e.tensorName!=null&&e.hasOwnProperty("tensorName")&&(s.tensorName=e.tensorName),e.quantParameterTensorNames&&e.quantParameterTensorNames.length){s.quantParameterTensorNames=[];for(var h=0;h<e.quantParameterTensorNames.length;++h)s.quantParameterTensorNames[h]=a.onnx.StringStringEntryProto.toObject(e.quantParameterTensorNames[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TensorAnnotation"},c}(),d.GraphProto=function(){function c(e){if(this.node=[],this.initializer=[],this.sparseInitializer=[],this.input=[],this.output=[],this.valueInfo=[],this.quantizationAnnotation=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.node=n.emptyArray,c.prototype.name="",c.prototype.initializer=n.emptyArray,c.prototype.sparseInitializer=n.emptyArray,c.prototype.docString="",c.prototype.input=n.emptyArray,c.prototype.output=n.emptyArray,c.prototype.valueInfo=n.emptyArray,c.prototype.quantizationAnnotation=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.node!=null&&e.node.length)for(var s=0;s<e.node.length;++s)a.onnx.NodeProto.encode(e.node[s],l.uint32(10).fork()).ldelim();if(e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(18).string(e.name),e.initializer!=null&&e.initializer.length)for(var s=0;s<e.initializer.length;++s)a.onnx.TensorProto.encode(e.initializer[s],l.uint32(42).fork()).ldelim();if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(82).string(e.docString),e.input!=null&&e.input.length)for(var s=0;s<e.input.length;++s)a.onnx.ValueInfoProto.encode(e.input[s],l.uint32(90).fork()).ldelim();if(e.output!=null&&e.output.length)for(var s=0;s<e.output.length;++s)a.onnx.ValueInfoProto.encode(e.output[s],l.uint32(98).fork()).ldelim();if(e.valueInfo!=null&&e.valueInfo.length)for(var s=0;s<e.valueInfo.length;++s)a.onnx.ValueInfoProto.encode(e.valueInfo[s],l.uint32(106).fork()).ldelim();if(e.quantizationAnnotation!=null&&e.quantizationAnnotation.length)for(var s=0;s<e.quantizationAnnotation.length;++s)a.onnx.TensorAnnotation.encode(e.quantizationAnnotation[s],l.uint32(114).fork()).ldelim();if(e.sparseInitializer!=null&&e.sparseInitializer.length)for(var s=0;s<e.sparseInitializer.length;++s)a.onnx.SparseTensorProto.encode(e.sparseInitializer[s],l.uint32(122).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.GraphProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.node&&h.node.length||(h.node=[]),h.node.push(a.onnx.NodeProto.decode(e,e.uint32()));break}case 2:{h.name=e.string();break}case 5:{h.initializer&&h.initializer.length||(h.initializer=[]),h.initializer.push(a.onnx.TensorProto.decode(e,e.uint32()));break}case 15:{h.sparseInitializer&&h.sparseInitializer.length||(h.sparseInitializer=[]),h.sparseInitializer.push(a.onnx.SparseTensorProto.decode(e,e.uint32()));break}case 10:{h.docString=e.string();break}case 11:{h.input&&h.input.length||(h.input=[]),h.input.push(a.onnx.ValueInfoProto.decode(e,e.uint32()));break}case 12:{h.output&&h.output.length||(h.output=[]),h.output.push(a.onnx.ValueInfoProto.decode(e,e.uint32()));break}case 13:{h.valueInfo&&h.valueInfo.length||(h.valueInfo=[]),h.valueInfo.push(a.onnx.ValueInfoProto.decode(e,e.uint32()));break}case 14:{h.quantizationAnnotation&&h.quantizationAnnotation.length||(h.quantizationAnnotation=[]),h.quantizationAnnotation.push(a.onnx.TensorAnnotation.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.node!=null&&e.hasOwnProperty("node")){if(!Array.isArray(e.node))return"node: array expected";for(var l=0;l<e.node.length;++l){var s=a.onnx.NodeProto.verify(e.node[l]);if(s)return"node."+s}}if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.initializer!=null&&e.hasOwnProperty("initializer")){if(!Array.isArray(e.initializer))return"initializer: array expected";for(var l=0;l<e.initializer.length;++l){var s=a.onnx.TensorProto.verify(e.initializer[l]);if(s)return"initializer."+s}}if(e.sparseInitializer!=null&&e.hasOwnProperty("sparseInitializer")){if(!Array.isArray(e.sparseInitializer))return"sparseInitializer: array expected";for(var l=0;l<e.sparseInitializer.length;++l){var s=a.onnx.SparseTensorProto.verify(e.sparseInitializer[l]);if(s)return"sparseInitializer."+s}}if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var l=0;l<e.input.length;++l){var s=a.onnx.ValueInfoProto.verify(e.input[l]);if(s)return"input."+s}}if(e.output!=null&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(var l=0;l<e.output.length;++l){var s=a.onnx.ValueInfoProto.verify(e.output[l]);if(s)return"output."+s}}if(e.valueInfo!=null&&e.hasOwnProperty("valueInfo")){if(!Array.isArray(e.valueInfo))return"valueInfo: array expected";for(var l=0;l<e.valueInfo.length;++l){var s=a.onnx.ValueInfoProto.verify(e.valueInfo[l]);if(s)return"valueInfo."+s}}if(e.quantizationAnnotation!=null&&e.hasOwnProperty("quantizationAnnotation")){if(!Array.isArray(e.quantizationAnnotation))return"quantizationAnnotation: array expected";for(var l=0;l<e.quantizationAnnotation.length;++l){var s=a.onnx.TensorAnnotation.verify(e.quantizationAnnotation[l]);if(s)return"quantizationAnnotation."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.GraphProto)return e;var l=new a.onnx.GraphProto;if(e.node){if(!Array.isArray(e.node))throw TypeError(".onnx.GraphProto.node: array expected");l.node=[];for(var s=0;s<e.node.length;++s){if(typeof e.node[s]!="object")throw TypeError(".onnx.GraphProto.node: object expected");l.node[s]=a.onnx.NodeProto.fromObject(e.node[s])}}if(e.name!=null&&(l.name=String(e.name)),e.initializer){if(!Array.isArray(e.initializer))throw TypeError(".onnx.GraphProto.initializer: array expected");l.initializer=[];for(var s=0;s<e.initializer.length;++s){if(typeof e.initializer[s]!="object")throw TypeError(".onnx.GraphProto.initializer: object expected");l.initializer[s]=a.onnx.TensorProto.fromObject(e.initializer[s])}}if(e.sparseInitializer){if(!Array.isArray(e.sparseInitializer))throw TypeError(".onnx.GraphProto.sparseInitializer: array expected");l.sparseInitializer=[];for(var s=0;s<e.sparseInitializer.length;++s){if(typeof e.sparseInitializer[s]!="object")throw TypeError(".onnx.GraphProto.sparseInitializer: object expected");l.sparseInitializer[s]=a.onnx.SparseTensorProto.fromObject(e.sparseInitializer[s])}}if(e.docString!=null&&(l.docString=String(e.docString)),e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.GraphProto.input: array expected");l.input=[];for(var s=0;s<e.input.length;++s){if(typeof e.input[s]!="object")throw TypeError(".onnx.GraphProto.input: object expected");l.input[s]=a.onnx.ValueInfoProto.fromObject(e.input[s])}}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.GraphProto.output: array expected");l.output=[];for(var s=0;s<e.output.length;++s){if(typeof e.output[s]!="object")throw TypeError(".onnx.GraphProto.output: object expected");l.output[s]=a.onnx.ValueInfoProto.fromObject(e.output[s])}}if(e.valueInfo){if(!Array.isArray(e.valueInfo))throw TypeError(".onnx.GraphProto.valueInfo: array expected");l.valueInfo=[];for(var s=0;s<e.valueInfo.length;++s){if(typeof e.valueInfo[s]!="object")throw TypeError(".onnx.GraphProto.valueInfo: object expected");l.valueInfo[s]=a.onnx.ValueInfoProto.fromObject(e.valueInfo[s])}}if(e.quantizationAnnotation){if(!Array.isArray(e.quantizationAnnotation))throw TypeError(".onnx.GraphProto.quantizationAnnotation: array expected");l.quantizationAnnotation=[];for(var s=0;s<e.quantizationAnnotation.length;++s){if(typeof e.quantizationAnnotation[s]!="object")throw TypeError(".onnx.GraphProto.quantizationAnnotation: object expected");l.quantizationAnnotation[s]=a.onnx.TensorAnnotation.fromObject(e.quantizationAnnotation[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.node=[],s.initializer=[],s.input=[],s.output=[],s.valueInfo=[],s.quantizationAnnotation=[],s.sparseInitializer=[]),l.defaults&&(s.name="",s.docString=""),e.node&&e.node.length){s.node=[];for(var h=0;h<e.node.length;++h)s.node[h]=a.onnx.NodeProto.toObject(e.node[h],l)}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.initializer&&e.initializer.length){s.initializer=[];for(var h=0;h<e.initializer.length;++h)s.initializer[h]=a.onnx.TensorProto.toObject(e.initializer[h],l)}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.input&&e.input.length){s.input=[];for(var h=0;h<e.input.length;++h)s.input[h]=a.onnx.ValueInfoProto.toObject(e.input[h],l)}if(e.output&&e.output.length){s.output=[];for(var h=0;h<e.output.length;++h)s.output[h]=a.onnx.ValueInfoProto.toObject(e.output[h],l)}if(e.valueInfo&&e.valueInfo.length){s.valueInfo=[];for(var h=0;h<e.valueInfo.length;++h)s.valueInfo[h]=a.onnx.ValueInfoProto.toObject(e.valueInfo[h],l)}if(e.quantizationAnnotation&&e.quantizationAnnotation.length){s.quantizationAnnotation=[];for(var h=0;h<e.quantizationAnnotation.length;++h)s.quantizationAnnotation[h]=a.onnx.TensorAnnotation.toObject(e.quantizationAnnotation[h],l)}if(e.sparseInitializer&&e.sparseInitializer.length){s.sparseInitializer=[];for(var h=0;h<e.sparseInitializer.length;++h)s.sparseInitializer[h]=a.onnx.SparseTensorProto.toObject(e.sparseInitializer[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.GraphProto"},c}(),d.TensorProto=function(){function c(e){if(this.dims=[],this.floatData=[],this.int32Data=[],this.stringData=[],this.int64Data=[],this.externalData=[],this.doubleData=[],this.uint64Data=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.dims=n.emptyArray,c.prototype.dataType=0,c.prototype.segment=null,c.prototype.floatData=n.emptyArray,c.prototype.int32Data=n.emptyArray,c.prototype.stringData=n.emptyArray,c.prototype.int64Data=n.emptyArray,c.prototype.name="",c.prototype.docString="",c.prototype.rawData=n.newBuffer([]),c.prototype.externalData=n.emptyArray,c.prototype.dataLocation=0,c.prototype.doubleData=n.emptyArray,c.prototype.uint64Data=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.dims!=null&&e.dims.length){l.uint32(10).fork();for(var s=0;s<e.dims.length;++s)l.int64(e.dims[s]);l.ldelim()}if(e.dataType!=null&&Object.hasOwnProperty.call(e,"dataType")&&l.uint32(16).int32(e.dataType),e.segment!=null&&Object.hasOwnProperty.call(e,"segment")&&a.onnx.TensorProto.Segment.encode(e.segment,l.uint32(26).fork()).ldelim(),e.floatData!=null&&e.floatData.length){l.uint32(34).fork();for(var s=0;s<e.floatData.length;++s)l.float(e.floatData[s]);l.ldelim()}if(e.int32Data!=null&&e.int32Data.length){l.uint32(42).fork();for(var s=0;s<e.int32Data.length;++s)l.int32(e.int32Data[s]);l.ldelim()}if(e.stringData!=null&&e.stringData.length)for(var s=0;s<e.stringData.length;++s)l.uint32(50).bytes(e.stringData[s]);if(e.int64Data!=null&&e.int64Data.length){l.uint32(58).fork();for(var s=0;s<e.int64Data.length;++s)l.int64(e.int64Data[s]);l.ldelim()}if(e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(66).string(e.name),e.rawData!=null&&Object.hasOwnProperty.call(e,"rawData")&&l.uint32(74).bytes(e.rawData),e.doubleData!=null&&e.doubleData.length){l.uint32(82).fork();for(var s=0;s<e.doubleData.length;++s)l.double(e.doubleData[s]);l.ldelim()}if(e.uint64Data!=null&&e.uint64Data.length){l.uint32(90).fork();for(var s=0;s<e.uint64Data.length;++s)l.uint64(e.uint64Data[s]);l.ldelim()}if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(98).string(e.docString),e.externalData!=null&&e.externalData.length)for(var s=0;s<e.externalData.length;++s)a.onnx.StringStringEntryProto.encode(e.externalData[s],l.uint32(106).fork()).ldelim();return e.dataLocation!=null&&Object.hasOwnProperty.call(e,"dataLocation")&&l.uint32(112).int32(e.dataLocation),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TensorProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{if(h.dims&&h.dims.length||(h.dims=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.dims.push(e.int64());else h.dims.push(e.int64());break}case 2:{h.dataType=e.int32();break}case 3:{h.segment=a.onnx.TensorProto.Segment.decode(e,e.uint32());break}case 4:{if(h.floatData&&h.floatData.length||(h.floatData=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.floatData.push(e.float());else h.floatData.push(e.float());break}case 5:{if(h.int32Data&&h.int32Data.length||(h.int32Data=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.int32Data.push(e.int32());else h.int32Data.push(e.int32());break}case 6:{h.stringData&&h.stringData.length||(h.stringData=[]),h.stringData.push(e.bytes());break}case 7:{if(h.int64Data&&h.int64Data.length||(h.int64Data=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.int64Data.push(e.int64());else h.int64Data.push(e.int64());break}case 8:{h.name=e.string();break}case 12:{h.docString=e.string();break}case 9:{h.rawData=e.bytes();break}case 13:{h.externalData&&h.externalData.length||(h.externalData=[]),h.externalData.push(a.onnx.StringStringEntryProto.decode(e,e.uint32()));break}case 14:{h.dataLocation=e.int32();break}case 10:{if(h.doubleData&&h.doubleData.length||(h.doubleData=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.doubleData.push(e.double());else h.doubleData.push(e.double());break}case 11:{if(h.uint64Data&&h.uint64Data.length||(h.uint64Data=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.uint64Data.push(e.uint64());else h.uint64Data.push(e.uint64());break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dims!=null&&e.hasOwnProperty("dims")){if(!Array.isArray(e.dims))return"dims: array expected";for(var l=0;l<e.dims.length;++l)if(!n.isInteger(e.dims[l])&&!(e.dims[l]&&n.isInteger(e.dims[l].low)&&n.isInteger(e.dims[l].high)))return"dims: integer|Long[] expected"}if(e.dataType!=null&&e.hasOwnProperty("dataType")&&!n.isInteger(e.dataType))return"dataType: integer expected";if(e.segment!=null&&e.hasOwnProperty("segment")){var s=a.onnx.TensorProto.Segment.verify(e.segment);if(s)return"segment."+s}if(e.floatData!=null&&e.hasOwnProperty("floatData")){if(!Array.isArray(e.floatData))return"floatData: array expected";for(var l=0;l<e.floatData.length;++l)if(typeof e.floatData[l]!="number")return"floatData: number[] expected"}if(e.int32Data!=null&&e.hasOwnProperty("int32Data")){if(!Array.isArray(e.int32Data))return"int32Data: array expected";for(var l=0;l<e.int32Data.length;++l)if(!n.isInteger(e.int32Data[l]))return"int32Data: integer[] expected"}if(e.stringData!=null&&e.hasOwnProperty("stringData")){if(!Array.isArray(e.stringData))return"stringData: array expected";for(var l=0;l<e.stringData.length;++l)if(!(e.stringData[l]&&typeof e.stringData[l].length=="number"||n.isString(e.stringData[l])))return"stringData: buffer[] expected"}if(e.int64Data!=null&&e.hasOwnProperty("int64Data")){if(!Array.isArray(e.int64Data))return"int64Data: array expected";for(var l=0;l<e.int64Data.length;++l)if(!n.isInteger(e.int64Data[l])&&!(e.int64Data[l]&&n.isInteger(e.int64Data[l].low)&&n.isInteger(e.int64Data[l].high)))return"int64Data: integer|Long[] expected"}if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.rawData!=null&&e.hasOwnProperty("rawData")&&!(e.rawData&&typeof e.rawData.length=="number"||n.isString(e.rawData)))return"rawData: buffer expected";if(e.externalData!=null&&e.hasOwnProperty("externalData")){if(!Array.isArray(e.externalData))return"externalData: array expected";for(var l=0;l<e.externalData.length;++l){var s=a.onnx.StringStringEntryProto.verify(e.externalData[l]);if(s)return"externalData."+s}}if(e.dataLocation!=null&&e.hasOwnProperty("dataLocation"))switch(e.dataLocation){default:return"dataLocation: enum value expected";case 0:case 1:break}if(e.doubleData!=null&&e.hasOwnProperty("doubleData")){if(!Array.isArray(e.doubleData))return"doubleData: array expected";for(var l=0;l<e.doubleData.length;++l)if(typeof e.doubleData[l]!="number")return"doubleData: number[] expected"}if(e.uint64Data!=null&&e.hasOwnProperty("uint64Data")){if(!Array.isArray(e.uint64Data))return"uint64Data: array expected";for(var l=0;l<e.uint64Data.length;++l)if(!n.isInteger(e.uint64Data[l])&&!(e.uint64Data[l]&&n.isInteger(e.uint64Data[l].low)&&n.isInteger(e.uint64Data[l].high)))return"uint64Data: integer|Long[] expected"}return null},c.fromObject=function(e){if(e instanceof a.onnx.TensorProto)return e;var l=new a.onnx.TensorProto;if(e.dims){if(!Array.isArray(e.dims))throw TypeError(".onnx.TensorProto.dims: array expected");l.dims=[];for(var s=0;s<e.dims.length;++s)n.Long?(l.dims[s]=n.Long.fromValue(e.dims[s])).unsigned=!1:typeof e.dims[s]=="string"?l.dims[s]=parseInt(e.dims[s],10):typeof e.dims[s]=="number"?l.dims[s]=e.dims[s]:typeof e.dims[s]=="object"&&(l.dims[s]=new n.LongBits(e.dims[s].low>>>0,e.dims[s].high>>>0).toNumber())}if(e.dataType!=null&&(l.dataType=e.dataType|0),e.segment!=null){if(typeof e.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");l.segment=a.onnx.TensorProto.Segment.fromObject(e.segment)}if(e.floatData){if(!Array.isArray(e.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");l.floatData=[];for(var s=0;s<e.floatData.length;++s)l.floatData[s]=Number(e.floatData[s])}if(e.int32Data){if(!Array.isArray(e.int32Data))throw TypeError(".onnx.TensorProto.int32Data: array expected");l.int32Data=[];for(var s=0;s<e.int32Data.length;++s)l.int32Data[s]=e.int32Data[s]|0}if(e.stringData){if(!Array.isArray(e.stringData))throw TypeError(".onnx.TensorProto.stringData: array expected");l.stringData=[];for(var s=0;s<e.stringData.length;++s)typeof e.stringData[s]=="string"?n.base64.decode(e.stringData[s],l.stringData[s]=n.newBuffer(n.base64.length(e.stringData[s])),0):e.stringData[s].length>=0&&(l.stringData[s]=e.stringData[s])}if(e.int64Data){if(!Array.isArray(e.int64Data))throw TypeError(".onnx.TensorProto.int64Data: array expected");l.int64Data=[];for(var s=0;s<e.int64Data.length;++s)n.Long?(l.int64Data[s]=n.Long.fromValue(e.int64Data[s])).unsigned=!1:typeof e.int64Data[s]=="string"?l.int64Data[s]=parseInt(e.int64Data[s],10):typeof e.int64Data[s]=="number"?l.int64Data[s]=e.int64Data[s]:typeof e.int64Data[s]=="object"&&(l.int64Data[s]=new n.LongBits(e.int64Data[s].low>>>0,e.int64Data[s].high>>>0).toNumber())}if(e.name!=null&&(l.name=String(e.name)),e.docString!=null&&(l.docString=String(e.docString)),e.rawData!=null&&(typeof e.rawData=="string"?n.base64.decode(e.rawData,l.rawData=n.newBuffer(n.base64.length(e.rawData)),0):e.rawData.length>=0&&(l.rawData=e.rawData)),e.externalData){if(!Array.isArray(e.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");l.externalData=[];for(var s=0;s<e.externalData.length;++s){if(typeof e.externalData[s]!="object")throw TypeError(".onnx.TensorProto.externalData: object expected");l.externalData[s]=a.onnx.StringStringEntryProto.fromObject(e.externalData[s])}}switch(e.dataLocation){default:if(typeof e.dataLocation=="number"){l.dataLocation=e.dataLocation;break}break;case"DEFAULT":case 0:l.dataLocation=0;break;case"EXTERNAL":case 1:l.dataLocation=1;break}if(e.doubleData){if(!Array.isArray(e.doubleData))throw TypeError(".onnx.TensorProto.doubleData: array expected");l.doubleData=[];for(var s=0;s<e.doubleData.length;++s)l.doubleData[s]=Number(e.doubleData[s])}if(e.uint64Data){if(!Array.isArray(e.uint64Data))throw TypeError(".onnx.TensorProto.uint64Data: array expected");l.uint64Data=[];for(var s=0;s<e.uint64Data.length;++s)n.Long?(l.uint64Data[s]=n.Long.fromValue(e.uint64Data[s])).unsigned=!0:typeof e.uint64Data[s]=="string"?l.uint64Data[s]=parseInt(e.uint64Data[s],10):typeof e.uint64Data[s]=="number"?l.uint64Data[s]=e.uint64Data[s]:typeof e.uint64Data[s]=="object"&&(l.uint64Data[s]=new n.LongBits(e.uint64Data[s].low>>>0,e.uint64Data[s].high>>>0).toNumber(!0))}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.dims=[],s.floatData=[],s.int32Data=[],s.stringData=[],s.int64Data=[],s.doubleData=[],s.uint64Data=[],s.externalData=[]),l.defaults&&(s.dataType=0,s.segment=null,s.name="",l.bytes===String?s.rawData="":(s.rawData=[],l.bytes!==Array&&(s.rawData=n.newBuffer(s.rawData))),s.docString="",s.dataLocation=l.enums===String?"DEFAULT":0),e.dims&&e.dims.length){s.dims=[];for(var h=0;h<e.dims.length;++h)typeof e.dims[h]=="number"?s.dims[h]=l.longs===String?String(e.dims[h]):e.dims[h]:s.dims[h]=l.longs===String?n.Long.prototype.toString.call(e.dims[h]):l.longs===Number?new n.LongBits(e.dims[h].low>>>0,e.dims[h].high>>>0).toNumber():e.dims[h]}if(e.dataType!=null&&e.hasOwnProperty("dataType")&&(s.dataType=e.dataType),e.segment!=null&&e.hasOwnProperty("segment")&&(s.segment=a.onnx.TensorProto.Segment.toObject(e.segment,l)),e.floatData&&e.floatData.length){s.floatData=[];for(var h=0;h<e.floatData.length;++h)s.floatData[h]=l.json&&!isFinite(e.floatData[h])?String(e.floatData[h]):e.floatData[h]}if(e.int32Data&&e.int32Data.length){s.int32Data=[];for(var h=0;h<e.int32Data.length;++h)s.int32Data[h]=e.int32Data[h]}if(e.stringData&&e.stringData.length){s.stringData=[];for(var h=0;h<e.stringData.length;++h)s.stringData[h]=l.bytes===String?n.base64.encode(e.stringData[h],0,e.stringData[h].length):l.bytes===Array?Array.prototype.slice.call(e.stringData[h]):e.stringData[h]}if(e.int64Data&&e.int64Data.length){s.int64Data=[];for(var h=0;h<e.int64Data.length;++h)typeof e.int64Data[h]=="number"?s.int64Data[h]=l.longs===String?String(e.int64Data[h]):e.int64Data[h]:s.int64Data[h]=l.longs===String?n.Long.prototype.toString.call(e.int64Data[h]):l.longs===Number?new n.LongBits(e.int64Data[h].low>>>0,e.int64Data[h].high>>>0).toNumber():e.int64Data[h]}if(e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.rawData!=null&&e.hasOwnProperty("rawData")&&(s.rawData=l.bytes===String?n.base64.encode(e.rawData,0,e.rawData.length):l.bytes===Array?Array.prototype.slice.call(e.rawData):e.rawData),e.doubleData&&e.doubleData.length){s.doubleData=[];for(var h=0;h<e.doubleData.length;++h)s.doubleData[h]=l.json&&!isFinite(e.doubleData[h])?String(e.doubleData[h]):e.doubleData[h]}if(e.uint64Data&&e.uint64Data.length){s.uint64Data=[];for(var h=0;h<e.uint64Data.length;++h)typeof e.uint64Data[h]=="number"?s.uint64Data[h]=l.longs===String?String(e.uint64Data[h]):e.uint64Data[h]:s.uint64Data[h]=l.longs===String?n.Long.prototype.toString.call(e.uint64Data[h]):l.longs===Number?new n.LongBits(e.uint64Data[h].low>>>0,e.uint64Data[h].high>>>0).toNumber(!0):e.uint64Data[h]}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.externalData&&e.externalData.length){s.externalData=[];for(var h=0;h<e.externalData.length;++h)s.externalData[h]=a.onnx.StringStringEntryProto.toObject(e.externalData[h],l)}return e.dataLocation!=null&&e.hasOwnProperty("dataLocation")&&(s.dataLocation=l.enums===String?a.onnx.TensorProto.DataLocation[e.dataLocation]===void 0?e.dataLocation:a.onnx.TensorProto.DataLocation[e.dataLocation]:e.dataLocation),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TensorProto"},c.DataType=function(){var e={},l=Object.create(e);return l[e[0]="UNDEFINED"]=0,l[e[1]="FLOAT"]=1,l[e[2]="UINT8"]=2,l[e[3]="INT8"]=3,l[e[4]="UINT16"]=4,l[e[5]="INT16"]=5,l[e[6]="INT32"]=6,l[e[7]="INT64"]=7,l[e[8]="STRING"]=8,l[e[9]="BOOL"]=9,l[e[10]="FLOAT16"]=10,l[e[11]="DOUBLE"]=11,l[e[12]="UINT32"]=12,l[e[13]="UINT64"]=13,l[e[14]="COMPLEX64"]=14,l[e[15]="COMPLEX128"]=15,l[e[16]="BFLOAT16"]=16,l[e[17]="FLOAT8E4M3FN"]=17,l[e[18]="FLOAT8E4M3FNUZ"]=18,l[e[19]="FLOAT8E5M2"]=19,l[e[20]="FLOAT8E5M2FNUZ"]=20,l}(),c.Segment=function(){function e(l){if(l)for(var s=Object.keys(l),h=0;h<s.length;++h)l[s[h]]!=null&&(this[s[h]]=l[s[h]])}return e.prototype.begin=n.Long?n.Long.fromBits(0,0,!1):0,e.prototype.end=n.Long?n.Long.fromBits(0,0,!1):0,e.create=function(l){return new e(l)},e.encode=function(l,s){return s||(s=u.create()),l.begin!=null&&Object.hasOwnProperty.call(l,"begin")&&s.uint32(8).int64(l.begin),l.end!=null&&Object.hasOwnProperty.call(l,"end")&&s.uint32(16).int64(l.end),s},e.encodeDelimited=function(l,s){return this.encode(l,s).ldelim()},e.decode=function(l,s){l instanceof i||(l=i.create(l));for(var h=s===void 0?l.len:l.pos+s,f=new a.onnx.TensorProto.Segment;l.pos<h;){var m=l.uint32();switch(m>>>3){case 1:{f.begin=l.int64();break}case 2:{f.end=l.int64();break}default:l.skipType(m&7);break}}return f},e.decodeDelimited=function(l){return l instanceof i||(l=new i(l)),this.decode(l,l.uint32())},e.verify=function(l){return typeof l!="object"||l===null?"object expected":l.begin!=null&&l.hasOwnProperty("begin")&&!n.isInteger(l.begin)&&!(l.begin&&n.isInteger(l.begin.low)&&n.isInteger(l.begin.high))?"begin: integer|Long expected":l.end!=null&&l.hasOwnProperty("end")&&!n.isInteger(l.end)&&!(l.end&&n.isInteger(l.end.low)&&n.isInteger(l.end.high))?"end: integer|Long expected":null},e.fromObject=function(l){if(l instanceof a.onnx.TensorProto.Segment)return l;var s=new a.onnx.TensorProto.Segment;return l.begin!=null&&(n.Long?(s.begin=n.Long.fromValue(l.begin)).unsigned=!1:typeof l.begin=="string"?s.begin=parseInt(l.begin,10):typeof l.begin=="number"?s.begin=l.begin:typeof l.begin=="object"&&(s.begin=new n.LongBits(l.begin.low>>>0,l.begin.high>>>0).toNumber())),l.end!=null&&(n.Long?(s.end=n.Long.fromValue(l.end)).unsigned=!1:typeof l.end=="string"?s.end=parseInt(l.end,10):typeof l.end=="number"?s.end=l.end:typeof l.end=="object"&&(s.end=new n.LongBits(l.end.low>>>0,l.end.high>>>0).toNumber())),s},e.toObject=function(l,s){s||(s={});var h={};if(s.defaults){if(n.Long){var f=new n.Long(0,0,!1);h.begin=s.longs===String?f.toString():s.longs===Number?f.toNumber():f}else h.begin=s.longs===String?"0":0;if(n.Long){var f=new n.Long(0,0,!1);h.end=s.longs===String?f.toString():s.longs===Number?f.toNumber():f}else h.end=s.longs===String?"0":0}return l.begin!=null&&l.hasOwnProperty("begin")&&(typeof l.begin=="number"?h.begin=s.longs===String?String(l.begin):l.begin:h.begin=s.longs===String?n.Long.prototype.toString.call(l.begin):s.longs===Number?new n.LongBits(l.begin.low>>>0,l.begin.high>>>0).toNumber():l.begin),l.end!=null&&l.hasOwnProperty("end")&&(typeof l.end=="number"?h.end=s.longs===String?String(l.end):l.end:h.end=s.longs===String?n.Long.prototype.toString.call(l.end):s.longs===Number?new n.LongBits(l.end.low>>>0,l.end.high>>>0).toNumber():l.end),h},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.getTypeUrl=function(l){return l===void 0&&(l="type.googleapis.com"),l+"/onnx.TensorProto.Segment"},e}(),c.DataLocation=function(){var e={},l=Object.create(e);return l[e[0]="DEFAULT"]=0,l[e[1]="EXTERNAL"]=1,l}(),c}(),d.SparseTensorProto=function(){function c(e){if(this.dims=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.values=null,c.prototype.indices=null,c.prototype.dims=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.values!=null&&Object.hasOwnProperty.call(e,"values")&&a.onnx.TensorProto.encode(e.values,l.uint32(10).fork()).ldelim(),e.indices!=null&&Object.hasOwnProperty.call(e,"indices")&&a.onnx.TensorProto.encode(e.indices,l.uint32(18).fork()).ldelim(),e.dims!=null&&e.dims.length){l.uint32(26).fork();for(var s=0;s<e.dims.length;++s)l.int64(e.dims[s]);l.ldelim()}return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.SparseTensorProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.values=a.onnx.TensorProto.decode(e,e.uint32());break}case 2:{h.indices=a.onnx.TensorProto.decode(e,e.uint32());break}case 3:{if(h.dims&&h.dims.length||(h.dims=[]),(f&7)===2)for(var m=e.uint32()+e.pos;e.pos<m;)h.dims.push(e.int64());else h.dims.push(e.int64());break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.values!=null&&e.hasOwnProperty("values")){var l=a.onnx.TensorProto.verify(e.values);if(l)return"values."+l}if(e.indices!=null&&e.hasOwnProperty("indices")){var l=a.onnx.TensorProto.verify(e.indices);if(l)return"indices."+l}if(e.dims!=null&&e.hasOwnProperty("dims")){if(!Array.isArray(e.dims))return"dims: array expected";for(var s=0;s<e.dims.length;++s)if(!n.isInteger(e.dims[s])&&!(e.dims[s]&&n.isInteger(e.dims[s].low)&&n.isInteger(e.dims[s].high)))return"dims: integer|Long[] expected"}return null},c.fromObject=function(e){if(e instanceof a.onnx.SparseTensorProto)return e;var l=new a.onnx.SparseTensorProto;if(e.values!=null){if(typeof e.values!="object")throw TypeError(".onnx.SparseTensorProto.values: object expected");l.values=a.onnx.TensorProto.fromObject(e.values)}if(e.indices!=null){if(typeof e.indices!="object")throw TypeError(".onnx.SparseTensorProto.indices: object expected");l.indices=a.onnx.TensorProto.fromObject(e.indices)}if(e.dims){if(!Array.isArray(e.dims))throw TypeError(".onnx.SparseTensorProto.dims: array expected");l.dims=[];for(var s=0;s<e.dims.length;++s)n.Long?(l.dims[s]=n.Long.fromValue(e.dims[s])).unsigned=!1:typeof e.dims[s]=="string"?l.dims[s]=parseInt(e.dims[s],10):typeof e.dims[s]=="number"?l.dims[s]=e.dims[s]:typeof e.dims[s]=="object"&&(l.dims[s]=new n.LongBits(e.dims[s].low>>>0,e.dims[s].high>>>0).toNumber())}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.dims=[]),l.defaults&&(s.values=null,s.indices=null),e.values!=null&&e.hasOwnProperty("values")&&(s.values=a.onnx.TensorProto.toObject(e.values,l)),e.indices!=null&&e.hasOwnProperty("indices")&&(s.indices=a.onnx.TensorProto.toObject(e.indices,l)),e.dims&&e.dims.length){s.dims=[];for(var h=0;h<e.dims.length;++h)typeof e.dims[h]=="number"?s.dims[h]=l.longs===String?String(e.dims[h]):e.dims[h]:s.dims[h]=l.longs===String?n.Long.prototype.toString.call(e.dims[h]):l.longs===Number?new n.LongBits(e.dims[h].low>>>0,e.dims[h].high>>>0).toNumber():e.dims[h]}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.SparseTensorProto"},c}(),d.TensorShapeProto=function(){function c(e){if(this.dim=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.dim=n.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.dim!=null&&e.dim.length)for(var s=0;s<e.dim.length;++s)a.onnx.TensorShapeProto.Dimension.encode(e.dim[s],l.uint32(10).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.TensorShapeProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.dim&&h.dim.length||(h.dim=[]),h.dim.push(a.onnx.TensorShapeProto.Dimension.decode(e,e.uint32()));break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.dim!=null&&e.hasOwnProperty("dim")){if(!Array.isArray(e.dim))return"dim: array expected";for(var l=0;l<e.dim.length;++l){var s=a.onnx.TensorShapeProto.Dimension.verify(e.dim[l]);if(s)return"dim."+s}}return null},c.fromObject=function(e){if(e instanceof a.onnx.TensorShapeProto)return e;var l=new a.onnx.TensorShapeProto;if(e.dim){if(!Array.isArray(e.dim))throw TypeError(".onnx.TensorShapeProto.dim: array expected");l.dim=[];for(var s=0;s<e.dim.length;++s){if(typeof e.dim[s]!="object")throw TypeError(".onnx.TensorShapeProto.dim: object expected");l.dim[s]=a.onnx.TensorShapeProto.Dimension.fromObject(e.dim[s])}}return l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.dim=[]),e.dim&&e.dim.length){s.dim=[];for(var h=0;h<e.dim.length;++h)s.dim[h]=a.onnx.TensorShapeProto.Dimension.toObject(e.dim[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.TensorShapeProto"},c.Dimension=function(){function e(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}e.prototype.dimValue=null,e.prototype.dimParam=null,e.prototype.denotation="";var l;return Object.defineProperty(e.prototype,"value",{get:n.oneOfGetter(l=["dimValue","dimParam"]),set:n.oneOfSetter(l)}),e.create=function(s){return new e(s)},e.encode=function(s,h){return h||(h=u.create()),s.dimValue!=null&&Object.hasOwnProperty.call(s,"dimValue")&&h.uint32(8).int64(s.dimValue),s.dimParam!=null&&Object.hasOwnProperty.call(s,"dimParam")&&h.uint32(18).string(s.dimParam),s.denotation!=null&&Object.hasOwnProperty.call(s,"denotation")&&h.uint32(26).string(s.denotation),h},e.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},e.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TensorShapeProto.Dimension;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.dimValue=s.int64();break}case 2:{m.dimParam=s.string();break}case 3:{m.denotation=s.string();break}default:s.skipType(v&7);break}}return m},e.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},e.verify=function(s){if(typeof s!="object"||s===null)return"object expected";var h={};if(s.dimValue!=null&&s.hasOwnProperty("dimValue")&&(h.value=1,!n.isInteger(s.dimValue)&&!(s.dimValue&&n.isInteger(s.dimValue.low)&&n.isInteger(s.dimValue.high))))return"dimValue: integer|Long expected";if(s.dimParam!=null&&s.hasOwnProperty("dimParam")){if(h.value===1)return"value: multiple values";if(h.value=1,!n.isString(s.dimParam))return"dimParam: string expected"}return s.denotation!=null&&s.hasOwnProperty("denotation")&&!n.isString(s.denotation)?"denotation: string expected":null},e.fromObject=function(s){if(s instanceof a.onnx.TensorShapeProto.Dimension)return s;var h=new a.onnx.TensorShapeProto.Dimension;return s.dimValue!=null&&(n.Long?(h.dimValue=n.Long.fromValue(s.dimValue)).unsigned=!1:typeof s.dimValue=="string"?h.dimValue=parseInt(s.dimValue,10):typeof s.dimValue=="number"?h.dimValue=s.dimValue:typeof s.dimValue=="object"&&(h.dimValue=new n.LongBits(s.dimValue.low>>>0,s.dimValue.high>>>0).toNumber())),s.dimParam!=null&&(h.dimParam=String(s.dimParam)),s.denotation!=null&&(h.denotation=String(s.denotation)),h},e.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.denotation=""),s.dimValue!=null&&s.hasOwnProperty("dimValue")&&(typeof s.dimValue=="number"?f.dimValue=h.longs===String?String(s.dimValue):s.dimValue:f.dimValue=h.longs===String?n.Long.prototype.toString.call(s.dimValue):h.longs===Number?new n.LongBits(s.dimValue.low>>>0,s.dimValue.high>>>0).toNumber():s.dimValue,h.oneofs&&(f.value="dimValue")),s.dimParam!=null&&s.hasOwnProperty("dimParam")&&(f.dimParam=s.dimParam,h.oneofs&&(f.value="dimParam")),s.denotation!=null&&s.hasOwnProperty("denotation")&&(f.denotation=s.denotation),f},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TensorShapeProto.Dimension"},e}(),c}(),d.TypeProto=function(){function c(l){if(l)for(var s=Object.keys(l),h=0;h<s.length;++h)l[s[h]]!=null&&(this[s[h]]=l[s[h]])}c.prototype.tensorType=null,c.prototype.sequenceType=null,c.prototype.mapType=null,c.prototype.optionalType=null,c.prototype.sparseTensorType=null,c.prototype.denotation="";var e;return Object.defineProperty(c.prototype,"value",{get:n.oneOfGetter(e=["tensorType","sequenceType","mapType","optionalType","sparseTensorType"]),set:n.oneOfSetter(e)}),c.create=function(l){return new c(l)},c.encode=function(l,s){return s||(s=u.create()),l.tensorType!=null&&Object.hasOwnProperty.call(l,"tensorType")&&a.onnx.TypeProto.Tensor.encode(l.tensorType,s.uint32(10).fork()).ldelim(),l.sequenceType!=null&&Object.hasOwnProperty.call(l,"sequenceType")&&a.onnx.TypeProto.Sequence.encode(l.sequenceType,s.uint32(34).fork()).ldelim(),l.mapType!=null&&Object.hasOwnProperty.call(l,"mapType")&&a.onnx.TypeProto.Map.encode(l.mapType,s.uint32(42).fork()).ldelim(),l.denotation!=null&&Object.hasOwnProperty.call(l,"denotation")&&s.uint32(50).string(l.denotation),l.sparseTensorType!=null&&Object.hasOwnProperty.call(l,"sparseTensorType")&&a.onnx.TypeProto.SparseTensor.encode(l.sparseTensorType,s.uint32(66).fork()).ldelim(),l.optionalType!=null&&Object.hasOwnProperty.call(l,"optionalType")&&a.onnx.TypeProto.Optional.encode(l.optionalType,s.uint32(74).fork()).ldelim(),s},c.encodeDelimited=function(l,s){return this.encode(l,s).ldelim()},c.decode=function(l,s){l instanceof i||(l=i.create(l));for(var h=s===void 0?l.len:l.pos+s,f=new a.onnx.TypeProto;l.pos<h;){var m=l.uint32();switch(m>>>3){case 1:{f.tensorType=a.onnx.TypeProto.Tensor.decode(l,l.uint32());break}case 4:{f.sequenceType=a.onnx.TypeProto.Sequence.decode(l,l.uint32());break}case 5:{f.mapType=a.onnx.TypeProto.Map.decode(l,l.uint32());break}case 9:{f.optionalType=a.onnx.TypeProto.Optional.decode(l,l.uint32());break}case 8:{f.sparseTensorType=a.onnx.TypeProto.SparseTensor.decode(l,l.uint32());break}case 6:{f.denotation=l.string();break}default:l.skipType(m&7);break}}return f},c.decodeDelimited=function(l){return l instanceof i||(l=new i(l)),this.decode(l,l.uint32())},c.verify=function(l){if(typeof l!="object"||l===null)return"object expected";var s={};if(l.tensorType!=null&&l.hasOwnProperty("tensorType")){s.value=1;{var h=a.onnx.TypeProto.Tensor.verify(l.tensorType);if(h)return"tensorType."+h}}if(l.sequenceType!=null&&l.hasOwnProperty("sequenceType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.Sequence.verify(l.sequenceType);if(h)return"sequenceType."+h}}if(l.mapType!=null&&l.hasOwnProperty("mapType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.Map.verify(l.mapType);if(h)return"mapType."+h}}if(l.optionalType!=null&&l.hasOwnProperty("optionalType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.Optional.verify(l.optionalType);if(h)return"optionalType."+h}}if(l.sparseTensorType!=null&&l.hasOwnProperty("sparseTensorType")){if(s.value===1)return"value: multiple values";s.value=1;{var h=a.onnx.TypeProto.SparseTensor.verify(l.sparseTensorType);if(h)return"sparseTensorType."+h}}return l.denotation!=null&&l.hasOwnProperty("denotation")&&!n.isString(l.denotation)?"denotation: string expected":null},c.fromObject=function(l){if(l instanceof a.onnx.TypeProto)return l;var s=new a.onnx.TypeProto;if(l.tensorType!=null){if(typeof l.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");s.tensorType=a.onnx.TypeProto.Tensor.fromObject(l.tensorType)}if(l.sequenceType!=null){if(typeof l.sequenceType!="object")throw TypeError(".onnx.TypeProto.sequenceType: object expected");s.sequenceType=a.onnx.TypeProto.Sequence.fromObject(l.sequenceType)}if(l.mapType!=null){if(typeof l.mapType!="object")throw TypeError(".onnx.TypeProto.mapType: object expected");s.mapType=a.onnx.TypeProto.Map.fromObject(l.mapType)}if(l.optionalType!=null){if(typeof l.optionalType!="object")throw TypeError(".onnx.TypeProto.optionalType: object expected");s.optionalType=a.onnx.TypeProto.Optional.fromObject(l.optionalType)}if(l.sparseTensorType!=null){if(typeof l.sparseTensorType!="object")throw TypeError(".onnx.TypeProto.sparseTensorType: object expected");s.sparseTensorType=a.onnx.TypeProto.SparseTensor.fromObject(l.sparseTensorType)}return l.denotation!=null&&(s.denotation=String(l.denotation)),s},c.toObject=function(l,s){s||(s={});var h={};return s.defaults&&(h.denotation=""),l.tensorType!=null&&l.hasOwnProperty("tensorType")&&(h.tensorType=a.onnx.TypeProto.Tensor.toObject(l.tensorType,s),s.oneofs&&(h.value="tensorType")),l.sequenceType!=null&&l.hasOwnProperty("sequenceType")&&(h.sequenceType=a.onnx.TypeProto.Sequence.toObject(l.sequenceType,s),s.oneofs&&(h.value="sequenceType")),l.mapType!=null&&l.hasOwnProperty("mapType")&&(h.mapType=a.onnx.TypeProto.Map.toObject(l.mapType,s),s.oneofs&&(h.value="mapType")),l.denotation!=null&&l.hasOwnProperty("denotation")&&(h.denotation=l.denotation),l.sparseTensorType!=null&&l.hasOwnProperty("sparseTensorType")&&(h.sparseTensorType=a.onnx.TypeProto.SparseTensor.toObject(l.sparseTensorType,s),s.oneofs&&(h.value="sparseTensorType")),l.optionalType!=null&&l.hasOwnProperty("optionalType")&&(h.optionalType=a.onnx.TypeProto.Optional.toObject(l.optionalType,s),s.oneofs&&(h.value="optionalType")),h},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(l){return l===void 0&&(l="type.googleapis.com"),l+"/onnx.TypeProto"},c.Tensor=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=0,l.prototype.shape=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&h.uint32(8).int32(s.elemType),s.shape!=null&&Object.hasOwnProperty.call(s,"shape")&&a.onnx.TensorShapeProto.encode(s.shape,h.uint32(18).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Tensor;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=s.int32();break}case 2:{m.shape=a.onnx.TensorShapeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")&&!n.isInteger(s.elemType))return"elemType: integer expected";if(s.shape!=null&&s.hasOwnProperty("shape")){var h=a.onnx.TensorShapeProto.verify(s.shape);if(h)return"shape."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Tensor)return s;var h=new a.onnx.TypeProto.Tensor;if(s.elemType!=null&&(h.elemType=s.elemType|0),s.shape!=null){if(typeof s.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");h.shape=a.onnx.TensorShapeProto.fromObject(s.shape)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=0,f.shape=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=s.elemType),s.shape!=null&&s.hasOwnProperty("shape")&&(f.shape=a.onnx.TensorShapeProto.toObject(s.shape,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Tensor"},l}(),c.Sequence=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&a.onnx.TypeProto.encode(s.elemType,h.uint32(10).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Sequence;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=a.onnx.TypeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")){var h=a.onnx.TypeProto.verify(s.elemType);if(h)return"elemType."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Sequence)return s;var h=new a.onnx.TypeProto.Sequence;if(s.elemType!=null){if(typeof s.elemType!="object")throw TypeError(".onnx.TypeProto.Sequence.elemType: object expected");h.elemType=a.onnx.TypeProto.fromObject(s.elemType)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=a.onnx.TypeProto.toObject(s.elemType,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Sequence"},l}(),c.Map=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.keyType=0,l.prototype.valueType=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.keyType!=null&&Object.hasOwnProperty.call(s,"keyType")&&h.uint32(8).int32(s.keyType),s.valueType!=null&&Object.hasOwnProperty.call(s,"valueType")&&a.onnx.TypeProto.encode(s.valueType,h.uint32(18).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Map;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.keyType=s.int32();break}case 2:{m.valueType=a.onnx.TypeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.keyType!=null&&s.hasOwnProperty("keyType")&&!n.isInteger(s.keyType))return"keyType: integer expected";if(s.valueType!=null&&s.hasOwnProperty("valueType")){var h=a.onnx.TypeProto.verify(s.valueType);if(h)return"valueType."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Map)return s;var h=new a.onnx.TypeProto.Map;if(s.keyType!=null&&(h.keyType=s.keyType|0),s.valueType!=null){if(typeof s.valueType!="object")throw TypeError(".onnx.TypeProto.Map.valueType: object expected");h.valueType=a.onnx.TypeProto.fromObject(s.valueType)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.keyType=0,f.valueType=null),s.keyType!=null&&s.hasOwnProperty("keyType")&&(f.keyType=s.keyType),s.valueType!=null&&s.hasOwnProperty("valueType")&&(f.valueType=a.onnx.TypeProto.toObject(s.valueType,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Map"},l}(),c.Optional=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&a.onnx.TypeProto.encode(s.elemType,h.uint32(10).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.Optional;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=a.onnx.TypeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")){var h=a.onnx.TypeProto.verify(s.elemType);if(h)return"elemType."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.Optional)return s;var h=new a.onnx.TypeProto.Optional;if(s.elemType!=null){if(typeof s.elemType!="object")throw TypeError(".onnx.TypeProto.Optional.elemType: object expected");h.elemType=a.onnx.TypeProto.fromObject(s.elemType)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=a.onnx.TypeProto.toObject(s.elemType,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.Optional"},l}(),c.SparseTensor=function(){function l(s){if(s)for(var h=Object.keys(s),f=0;f<h.length;++f)s[h[f]]!=null&&(this[h[f]]=s[h[f]])}return l.prototype.elemType=0,l.prototype.shape=null,l.create=function(s){return new l(s)},l.encode=function(s,h){return h||(h=u.create()),s.elemType!=null&&Object.hasOwnProperty.call(s,"elemType")&&h.uint32(8).int32(s.elemType),s.shape!=null&&Object.hasOwnProperty.call(s,"shape")&&a.onnx.TensorShapeProto.encode(s.shape,h.uint32(18).fork()).ldelim(),h},l.encodeDelimited=function(s,h){return this.encode(s,h).ldelim()},l.decode=function(s,h){s instanceof i||(s=i.create(s));for(var f=h===void 0?s.len:s.pos+h,m=new a.onnx.TypeProto.SparseTensor;s.pos<f;){var v=s.uint32();switch(v>>>3){case 1:{m.elemType=s.int32();break}case 2:{m.shape=a.onnx.TensorShapeProto.decode(s,s.uint32());break}default:s.skipType(v&7);break}}return m},l.decodeDelimited=function(s){return s instanceof i||(s=new i(s)),this.decode(s,s.uint32())},l.verify=function(s){if(typeof s!="object"||s===null)return"object expected";if(s.elemType!=null&&s.hasOwnProperty("elemType")&&!n.isInteger(s.elemType))return"elemType: integer expected";if(s.shape!=null&&s.hasOwnProperty("shape")){var h=a.onnx.TensorShapeProto.verify(s.shape);if(h)return"shape."+h}return null},l.fromObject=function(s){if(s instanceof a.onnx.TypeProto.SparseTensor)return s;var h=new a.onnx.TypeProto.SparseTensor;if(s.elemType!=null&&(h.elemType=s.elemType|0),s.shape!=null){if(typeof s.shape!="object")throw TypeError(".onnx.TypeProto.SparseTensor.shape: object expected");h.shape=a.onnx.TensorShapeProto.fromObject(s.shape)}return h},l.toObject=function(s,h){h||(h={});var f={};return h.defaults&&(f.elemType=0,f.shape=null),s.elemType!=null&&s.hasOwnProperty("elemType")&&(f.elemType=s.elemType),s.shape!=null&&s.hasOwnProperty("shape")&&(f.shape=a.onnx.TensorShapeProto.toObject(s.shape,h)),f},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l.getTypeUrl=function(s){return s===void 0&&(s="type.googleapis.com"),s+"/onnx.TypeProto.SparseTensor"},l}(),c}(),d.OperatorSetIdProto=function(){function c(e){if(e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.domain="",c.prototype.version=n.Long?n.Long.fromBits(0,0,!1):0,c.create=function(e){return new c(e)},c.encode=function(e,l){return l||(l=u.create()),e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(10).string(e.domain),e.version!=null&&Object.hasOwnProperty.call(e,"version")&&l.uint32(16).int64(e.version),l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.OperatorSetIdProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.domain=e.string();break}case 2:{h.version=e.int64();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){return typeof e!="object"||e===null?"object expected":e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain)?"domain: string expected":e.version!=null&&e.hasOwnProperty("version")&&!n.isInteger(e.version)&&!(e.version&&n.isInteger(e.version.low)&&n.isInteger(e.version.high))?"version: integer|Long expected":null},c.fromObject=function(e){if(e instanceof a.onnx.OperatorSetIdProto)return e;var l=new a.onnx.OperatorSetIdProto;return e.domain!=null&&(l.domain=String(e.domain)),e.version!=null&&(n.Long?(l.version=n.Long.fromValue(e.version)).unsigned=!1:typeof e.version=="string"?l.version=parseInt(e.version,10):typeof e.version=="number"?l.version=e.version:typeof e.version=="object"&&(l.version=new n.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber())),l},c.toObject=function(e,l){l||(l={});var s={};if(l.defaults)if(s.domain="",n.Long){var h=new n.Long(0,0,!1);s.version=l.longs===String?h.toString():l.longs===Number?h.toNumber():h}else s.version=l.longs===String?"0":0;return e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),e.version!=null&&e.hasOwnProperty("version")&&(typeof e.version=="number"?s.version=l.longs===String?String(e.version):e.version:s.version=l.longs===String?n.Long.prototype.toString.call(e.version):l.longs===Number?new n.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber():e.version),s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.OperatorSetIdProto"},c}(),d.OperatorStatus=function(){var c={},e=Object.create(c);return e[c[0]="EXPERIMENTAL"]=0,e[c[1]="STABLE"]=1,e}(),d.FunctionProto=function(){function c(e){if(this.input=[],this.output=[],this.attribute=[],this.attributeProto=[],this.node=[],this.opsetImport=[],e)for(var l=Object.keys(e),s=0;s<l.length;++s)e[l[s]]!=null&&(this[l[s]]=e[l[s]])}return c.prototype.name="",c.prototype.input=n.emptyArray,c.prototype.output=n.emptyArray,c.prototype.attribute=n.emptyArray,c.prototype.attributeProto=n.emptyArray,c.prototype.node=n.emptyArray,c.prototype.docString="",c.prototype.opsetImport=n.emptyArray,c.prototype.domain="",c.create=function(e){return new c(e)},c.encode=function(e,l){if(l||(l=u.create()),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&l.uint32(10).string(e.name),e.input!=null&&e.input.length)for(var s=0;s<e.input.length;++s)l.uint32(34).string(e.input[s]);if(e.output!=null&&e.output.length)for(var s=0;s<e.output.length;++s)l.uint32(42).string(e.output[s]);if(e.attribute!=null&&e.attribute.length)for(var s=0;s<e.attribute.length;++s)l.uint32(50).string(e.attribute[s]);if(e.node!=null&&e.node.length)for(var s=0;s<e.node.length;++s)a.onnx.NodeProto.encode(e.node[s],l.uint32(58).fork()).ldelim();if(e.docString!=null&&Object.hasOwnProperty.call(e,"docString")&&l.uint32(66).string(e.docString),e.opsetImport!=null&&e.opsetImport.length)for(var s=0;s<e.opsetImport.length;++s)a.onnx.OperatorSetIdProto.encode(e.opsetImport[s],l.uint32(74).fork()).ldelim();if(e.domain!=null&&Object.hasOwnProperty.call(e,"domain")&&l.uint32(82).string(e.domain),e.attributeProto!=null&&e.attributeProto.length)for(var s=0;s<e.attributeProto.length;++s)a.onnx.AttributeProto.encode(e.attributeProto[s],l.uint32(90).fork()).ldelim();return l},c.encodeDelimited=function(e,l){return this.encode(e,l).ldelim()},c.decode=function(e,l){e instanceof i||(e=i.create(e));for(var s=l===void 0?e.len:e.pos+l,h=new a.onnx.FunctionProto;e.pos<s;){var f=e.uint32();switch(f>>>3){case 1:{h.name=e.string();break}case 4:{h.input&&h.input.length||(h.input=[]),h.input.push(e.string());break}case 5:{h.output&&h.output.length||(h.output=[]),h.output.push(e.string());break}case 6:{h.attribute&&h.attribute.length||(h.attribute=[]),h.attribute.push(e.string());break}case 11:{h.attributeProto&&h.attributeProto.length||(h.attributeProto=[]),h.attributeProto.push(a.onnx.AttributeProto.decode(e,e.uint32()));break}case 7:{h.node&&h.node.length||(h.node=[]),h.node.push(a.onnx.NodeProto.decode(e,e.uint32()));break}case 8:{h.docString=e.string();break}case 9:{h.opsetImport&&h.opsetImport.length||(h.opsetImport=[]),h.opsetImport.push(a.onnx.OperatorSetIdProto.decode(e,e.uint32()));break}case 10:{h.domain=e.string();break}default:e.skipType(f&7);break}}return h},c.decodeDelimited=function(e){return e instanceof i||(e=new i(e)),this.decode(e,e.uint32())},c.verify=function(e){if(typeof e!="object"||e===null)return"object expected";if(e.name!=null&&e.hasOwnProperty("name")&&!n.isString(e.name))return"name: string expected";if(e.input!=null&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var l=0;l<e.input.length;++l)if(!n.isString(e.input[l]))return"input: string[] expected"}if(e.output!=null&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(var l=0;l<e.output.length;++l)if(!n.isString(e.output[l]))return"output: string[] expected"}if(e.attribute!=null&&e.hasOwnProperty("attribute")){if(!Array.isArray(e.attribute))return"attribute: array expected";for(var l=0;l<e.attribute.length;++l)if(!n.isString(e.attribute[l]))return"attribute: string[] expected"}if(e.attributeProto!=null&&e.hasOwnProperty("attributeProto")){if(!Array.isArray(e.attributeProto))return"attributeProto: array expected";for(var l=0;l<e.attributeProto.length;++l){var s=a.onnx.AttributeProto.verify(e.attributeProto[l]);if(s)return"attributeProto."+s}}if(e.node!=null&&e.hasOwnProperty("node")){if(!Array.isArray(e.node))return"node: array expected";for(var l=0;l<e.node.length;++l){var s=a.onnx.NodeProto.verify(e.node[l]);if(s)return"node."+s}}if(e.docString!=null&&e.hasOwnProperty("docString")&&!n.isString(e.docString))return"docString: string expected";if(e.opsetImport!=null&&e.hasOwnProperty("opsetImport")){if(!Array.isArray(e.opsetImport))return"opsetImport: array expected";for(var l=0;l<e.opsetImport.length;++l){var s=a.onnx.OperatorSetIdProto.verify(e.opsetImport[l]);if(s)return"opsetImport."+s}}return e.domain!=null&&e.hasOwnProperty("domain")&&!n.isString(e.domain)?"domain: string expected":null},c.fromObject=function(e){if(e instanceof a.onnx.FunctionProto)return e;var l=new a.onnx.FunctionProto;if(e.name!=null&&(l.name=String(e.name)),e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.FunctionProto.input: array expected");l.input=[];for(var s=0;s<e.input.length;++s)l.input[s]=String(e.input[s])}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.FunctionProto.output: array expected");l.output=[];for(var s=0;s<e.output.length;++s)l.output[s]=String(e.output[s])}if(e.attribute){if(!Array.isArray(e.attribute))throw TypeError(".onnx.FunctionProto.attribute: array expected");l.attribute=[];for(var s=0;s<e.attribute.length;++s)l.attribute[s]=String(e.attribute[s])}if(e.attributeProto){if(!Array.isArray(e.attributeProto))throw TypeError(".onnx.FunctionProto.attributeProto: array expected");l.attributeProto=[];for(var s=0;s<e.attributeProto.length;++s){if(typeof e.attributeProto[s]!="object")throw TypeError(".onnx.FunctionProto.attributeProto: object expected");l.attributeProto[s]=a.onnx.AttributeProto.fromObject(e.attributeProto[s])}}if(e.node){if(!Array.isArray(e.node))throw TypeError(".onnx.FunctionProto.node: array expected");l.node=[];for(var s=0;s<e.node.length;++s){if(typeof e.node[s]!="object")throw TypeError(".onnx.FunctionProto.node: object expected");l.node[s]=a.onnx.NodeProto.fromObject(e.node[s])}}if(e.docString!=null&&(l.docString=String(e.docString)),e.opsetImport){if(!Array.isArray(e.opsetImport))throw TypeError(".onnx.FunctionProto.opsetImport: array expected");l.opsetImport=[];for(var s=0;s<e.opsetImport.length;++s){if(typeof e.opsetImport[s]!="object")throw TypeError(".onnx.FunctionProto.opsetImport: object expected");l.opsetImport[s]=a.onnx.OperatorSetIdProto.fromObject(e.opsetImport[s])}}return e.domain!=null&&(l.domain=String(e.domain)),l},c.toObject=function(e,l){l||(l={});var s={};if((l.arrays||l.defaults)&&(s.input=[],s.output=[],s.attribute=[],s.node=[],s.opsetImport=[],s.attributeProto=[]),l.defaults&&(s.name="",s.docString="",s.domain=""),e.name!=null&&e.hasOwnProperty("name")&&(s.name=e.name),e.input&&e.input.length){s.input=[];for(var h=0;h<e.input.length;++h)s.input[h]=e.input[h]}if(e.output&&e.output.length){s.output=[];for(var h=0;h<e.output.length;++h)s.output[h]=e.output[h]}if(e.attribute&&e.attribute.length){s.attribute=[];for(var h=0;h<e.attribute.length;++h)s.attribute[h]=e.attribute[h]}if(e.node&&e.node.length){s.node=[];for(var h=0;h<e.node.length;++h)s.node[h]=a.onnx.NodeProto.toObject(e.node[h],l)}if(e.docString!=null&&e.hasOwnProperty("docString")&&(s.docString=e.docString),e.opsetImport&&e.opsetImport.length){s.opsetImport=[];for(var h=0;h<e.opsetImport.length;++h)s.opsetImport[h]=a.onnx.OperatorSetIdProto.toObject(e.opsetImport[h],l)}if(e.domain!=null&&e.hasOwnProperty("domain")&&(s.domain=e.domain),e.attributeProto&&e.attributeProto.length){s.attributeProto=[];for(var h=0;h<e.attributeProto.length;++h)s.attributeProto[h]=a.onnx.AttributeProto.toObject(e.attributeProto[h],l)}return s},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/onnx.FunctionProto"},c}(),d}(),r.exports=a});function ur(t,r){if(!t)throw new Error(typeof r=="string"?r:r())}function kr(t){return new TextDecoder().decode(t)}var ot,Me,ai,kt,Sn,At,Rt,B,$r,Ue,Ve,ze,Y=O(()=>{wn(),qo(),ot=rr(sr()),We(),Me=class{static arraysEqual(t,r){if(t.length!==r.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==r[o])return!1;return!0}},ai=class{static preprocessInputShapes(t,r){let o=t.length===1?[1,t[0]]:t,i=r.length===1?[r[0],1]:r;return[o,i]}static postprocessOutputShape(t,r,o){r===1&&t.splice(t.length-2,1),o===1&&t.pop()}static calcMatMulShape(t,r){return t[1]!==r[0]?void 0:[t[0],r[1]]}},kt=class ve{static calcShape(r,o,i=!1){let u=r.length,n=o.length;if(u===0)return o;if(n===0)return r;let a=Math.max(r.length,o.length),d=new Array(a);if(i){if(u<2||n<2)return;let c=ai.calcMatMulShape([r[u-2],r[u-1]],[o[n-2],o[n-1]]);if(c===void 0)return;[d[a-2],d[a-1]]=c}for(let c=i?3:1;c<=a;c++){let e=u-c<0?1:r[u-c],l=n-c<0?1:o[n-c];if(e!==l&&e>1&&l>1)return;d[a-c]=Math.max(e,l)}return d}static index(r,o){let i=new Array(o.length);return ve.fillIndex(r,o,i),i}static fillIndex(r,o,i){let u=r.length-o.length;for(let n=0;n<o.length;n++)i[n]=r[u+n]%o[n]}static calc(r,o,i,u,n){let a=ve.calcShape(r.dims,o.dims);if(a){if(u&&!B.areEqual(a,r.dims))return;let d=B.size(a),c=u?r:new bt(a,n||r.type);if(a.length===0)c.set([],i(r.get([]),o.get([])));else{let e=new Array(a.length),l=new Array(r.dims.length),s=new Array(o.dims.length),h=0,f=0,m=!1,v=!1;r.dims.length===0&&(h=r.get([]),m=!0),o.dims.length===0&&(f=o.get([]),v=!0);let _;for(let I=0;I<d;I++){_=I;for(let T=a.length-1;T>=0;T--)e[T]=_%a[T],_=Math.floor(_/a[T]);m||(ve.fillIndex(e,r.dims,l),h=r.get(l)),v||(ve.fillIndex(e,o.dims,s),f=o.get(s)),c.set(e,i(h,f))}}return c}}static isValidBroadcast(r,o){let i=r.length,u=o.length;if(i>u)return!1;for(let n=1;n<=i;n++)if(r[i-n]!==1&&r[i-n]!==o[u-n])return!1;return!0}static getBroadcastDims(r,o){let i=r.length,u=[];for(let n=0;n<i;n++){let a=i-1-n,d=r[a]||1;(o[o.length-1-n]||1)>1&&d===1&&u.unshift(a)}return u}},Sn=class{static getShapeOfGemmResult(t,r,o,i,u){if(t.length!==2||o.length!==2)throw new Error("shape need to be of size 2");let n,a,d;r?(n=t[1],a=t[0]):(n=t[0],a=t[1]);let c=-1;if(i?(d=o[0],c=1):(d=o[1],c=0),o[c]!==a)throw new Error("dimension mismatch");if(n<=0||d<=0||a<=0)throw new Error("invalid shape specified");if(u&&!kt.isValidBroadcast(u,[n,d]))throw new Error("gemm: invalid bias shape for broadcast");return[n,d,a]}},At=class rn{static tensorDataTypeFromProto(r){switch(r){case ot.onnx.TensorProto.DataType.INT8:return"int8";case ot.onnx.TensorProto.DataType.UINT8:return"uint8";case ot.onnx.TensorProto.DataType.BOOL:return"bool";case ot.onnx.TensorProto.DataType.INT16:return"int16";case ot.onnx.TensorProto.DataType.UINT16:return"uint16";case ot.onnx.TensorProto.DataType.INT32:return"int32";case ot.onnx.TensorProto.DataType.UINT32:return"uint32";case ot.onnx.TensorProto.DataType.FLOAT:return"float32";case ot.onnx.TensorProto.DataType.DOUBLE:return"float64";case ot.onnx.TensorProto.DataType.STRING:return"string";case ot.onnx.TensorProto.DataType.INT64:return"int32";case ot.onnx.TensorProto.DataType.UINT64:return"uint32";default:throw new Error(`unsupported data type: ${ot.onnx.TensorProto.DataType[r]}`)}}static tensorDataTypeStringToEnum(r){switch(r){case"int8":return ot.onnx.TensorProto.DataType.INT8;case"uint8":return ot.onnx.TensorProto.DataType.UINT8;case"bool":return ot.onnx.TensorProto.DataType.BOOL;case"int16":return ot.onnx.TensorProto.DataType.INT16;case"uint16":return ot.onnx.TensorProto.DataType.UINT16;case"int32":return ot.onnx.TensorProto.DataType.INT32;case"uint32":return ot.onnx.TensorProto.DataType.UINT32;case"float32":return ot.onnx.TensorProto.DataType.FLOAT;case"float64":return ot.onnx.TensorProto.DataType.DOUBLE;case"string":return ot.onnx.TensorProto.DataType.STRING;case"int64":return ot.onnx.TensorProto.DataType.INT64;case"uint64":return ot.onnx.TensorProto.DataType.UINT64;default:throw new Error(`unsupported data type: ${r}`)}}static tensorDimsFromProto(r){return r.map(o=>xe.isLong(o)?o.toNumber():o)}static tensorValueTypeFromProto(r){return{tensorType:rn.tensorDataTypeFromProto(r.elemType),shape:{dims:rn.tensorDimsFromProto(r.shape.dim.map(o=>o.dimValue))}}}static tensorDimsFromORTFormat(r){let o=[];for(let i=0;i<r.dimsLength();i++)o.push(Rt.longToNumber(r.dims(i)));return o}static tensorAttributesFromORTFormat(r){let o=[];for(let i=0;i<r.attributesLength();i++)o.push(r.attributes(i));return o}},Rt=class{static longToNumber(t,r){return xe.isLong(t)?t.toNumber():t instanceof w.Long?xe.fromValue({low:t.low,high:t.high,unsigned:r??!1}).toNumber():t}static isLong(t){return xe.isLong(t)||t instanceof w.Long}},B=class ee{static size(r){return ee.getSizeFromDimensionRange(r,0,r.length)}static sizeFromDimension(r,o){if(o<0||o>r.length)throw new Error(`invalid dimension of ${o} for sizeFromDimension as Tensor has ${r.length} dimensions.`);return ee.getSizeFromDimensionRange(r,o,r.length)}static sizeToDimension(r,o){if(o<0||o>r.length)throw new Error(`invalid dimension of ${o} for sizeToDimension as Tensor has ${r.length} dimensions.`);return ee.getSizeFromDimensionRange(r,0,o)}static getSizeFromDimensionRange(r,o,i){let u=1;for(let n=o;n<i;n++){if(r[n]<=0)throw new Error("cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.");u*=r[n]}return u}static computeStrides(r){let o=r.length;if(o===0)return[];if(o===1)return[1];let i=new Array(o);i[o-1]=1,i[o-2]=r[o-1];for(let u=o-3;u>=0;--u)i[u]=i[u+1]*r[u+1];return i}static transpose(r){return r.slice().reverse()}static indicesToOffset(r,o,i){i===void 0&&(i=r.length);let u=0;for(let n=0;n<i;++n)u+=o[n]*r[n];return u}static offsetToIndices(r,o){let i=o.length;if(i===0)return[];if(i===1)return[r*o[0]];let u=new Array(o.length);for(let n=0;n<u.length-1;++n)u[n]=Math.floor(r/o[n]),r-=u[n]*o[n];return u[u.length-1]=r,u}static normalizeAxis(r,o){if(r<-o&&r>=o)throw new Error("unsupported axis for this operation.");return r<0?r+o:r}static normalizeAxes(r,o){return r.map(i=>this.normalizeAxis(i,o))}static incrementIndex(r,o,i){if(o.length===0||r.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(i===void 0)i=o.length;else if(i<=0||i>o.length)throw new Error("Incorrect axis to increment on");for(let u=i-1;u>=0&&(r[u]++,!(r[u]<o[u]));--u)r[u]=0}static calculateReshapedDims(r,o){if(o.length===0){if(r.length===0||ee.size(r)===1)return[];throw new Error("cannot reshape to a scalar Tensor")}let i=o.length,u=new Array(i),n=-1,a=1;for(let c=0;c<i;c++){if(o[c]<-1)throw new Error("a dimension in shape hints cannot be less than -1");if(o[c]===-1){if(n!==-1)throw new Error("at most one dimension in shape hints can be -1");n=c}else{if(o[c]===0){if(c>=r.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");u[c]=r[c]}else u[c]=o[c];a*=u[c]}}let d=ee.size(r);if(n!==-1){if(d%a!==0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${r}] Output shape: [${o}]`);u[n]=d/a}else if(a!==d)throw new Error("reshapedDims and originalDims don't have matching sizes");return u}static sortBasedOnPerm(r,o){return o?o.map(i=>r[i]):r.slice().reverse()}static padShape(r,o){let i=r.length;return r.map((u,n)=>u+o[n]+o[n+i])}static areEqual(r,o){return r.length!==o.length?!1:r.every((i,u)=>i===o[u])}static validateDimsAndCalcSize(r){if(r.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let o=1;for(let i of r){if(!Number.isInteger(i))throw new TypeError(`Invalid shape: ${i} is not an integer`);if(i<0||i>2147483647)throw new TypeError(`Invalid shape: length ${i} is not allowed`);o*=i}return o}static flattenShape(r,o){o<0&&(o+=r.length);let i=r.reduce((n,a)=>n*a,1),u=r.slice(o).reduce((n,a)=>n*a,1);return[i/u,u]}static squeezeShape(r,o){let i=new Array;o=ee.normalizeAxes(o,r.length);for(let u=0;u<r.length;u++){let n=o.indexOf(u)>=0;if(n&&r[u]!==1)throw new Error("squeeze an axis of size different than 1");(o.length===0&&r[u]>1||o.length>0&&!n)&&i.push(r[u])}return i}static unsqueezeShape(r,o){let i=new Array(r.length+o.length);i.fill(0);for(let n=0;n<o.length;n++){let a=ee.normalizeAxis(o[n],i.length);if(a>=i.length)throw new Error("'axes' has an out of range axis");if(i[a]!==0)throw new Error("'axes' has a duplicate axis");i[a]=1}let u=0;for(let n=0;n<i.length;n++)i[n]===0&&(i[n]=r[u++]);if(u!==r.length)throw new Error("the unsqueezed dimension could not be established");return i}},$r=class Ea{static splitShape(r,o,i,u){if(i.length===0){if(!u)throw new Error("need to know number of outputs when the 'split' attribute is not specified");Ea.determineSplit(r[o],u,i)}let n=[],a=[0];for(let d=0;d<i.length;++d){d!==0&&a.push(a[d-1]+i[d-1]);let c=r.slice();c[o]=i[d],n.push(c)}return[n,a]}static determineSplit(r,o,i){if(r%o!==0)throw new Error("cannot split tensor to equal sized parts");for(let u=0;u<o;++u)i.push(r/o)}},Ue=class Oe{static adjustPoolAttributes(r,o,i,u,n,a){if(!r&&i.length!==o.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(r)for(let d=0;d<o.length-2;d++)d>=i.length?i.push(o[d+2]):i[d]=o[d+2];for(let d=0;d<i.length;d++)if(d<u.length){if(u[d]<0)throw new Error("strides should be greater than or equal to 1")}else u.push(1);for(let d=0;d<i.length;d++)if(d<n.length){if(n[d]<0)throw new Error("dilations should be greater than or equal to 1")}else n.push(1);for(let d=0;d<i.length*2;d++)if(d<a.length){if(a[d]<0)throw new Error("pad should be greater than or equal to 1")}else a.push(0);for(let d=0;d<i.length;d++){if(i[d]<=0)throw new Error("kernel shapes need to be greater than 0");if(a[d]>=i[d]||a[d+i.length]>=i[d])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(r,o,i,u,n,a){if(a){if(n.length!==2*(r.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(o.length!==r.length-2)throw new Error("length of strides should be the length of data dimensions");if(u.length!==r.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let d=0;d<r.length-2;d++)Oe.adjustPadAndReturnShape(r[d+2],o[d],i[d],u[d],n,d,d+r.length-2,a)}}static computePoolOutputShape(r,o,i,u,n,a,d){if(o.length<=0)throw new Error("input shape must be of size greater than 0");let c=[o[0],o[1]];return Oe.computeShapeHelper(r,o,c,i,u,n,a,d),c}static computeConvOutputShape(r,o,i,u,n,a,d){if(r.length<=0||o.length<=0)throw new Error("invalid input tensor dims or invalid filter tensor dims");let c=[r[0],o[0]];return Oe.computeShapeHelper(!1,r,c,i,u,n,a,d),c}static computeShapeHelper(r,o,i,u,n,a,d,c){if(r)for(let e=0;e<o.length-2;e++)i.push(1);else for(let e=0;e<o.length-2;e++)i.push(Oe.adjustPadAndReturnShape(o[e+2],u[e],n[e],a[e],d,e,e+o.length-2,c))}static adjustPadAndReturnShape(r,o,i,u,n,a,d,c){let e=i*(u-1)+1;if(c&&c!=="NOTSET")switch(c){case"VALID":return n[a]=0,n[d]=0,Math.floor((r-e)/o+1);case"SAME_LOWER":case"SAME_UPPER":if(i!==1)throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{let l=((r+o-1)/o-1)*o+u-r;return n[a]=Math.floor(c==="SAME_LOWER"?(l+1)/2:l/2),n[d]=l-n[a],Math.floor((r+l-u)/o+1)}default:throw new Error("Unsupported AutoPad type")}else return Math.floor((r+n[a]+n[d]-e)/o+1)}},Ve=-34028234663852886e22,ze=34028234663852886e22});function hh(t){switch(t){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${t}`)}}function Wu(t){switch(t){case H.onnx.TensorProto.DataType.UINT8:case H.onnx.TensorProto.DataType.INT8:case H.onnx.TensorProto.DataType.BOOL:return 1;case H.onnx.TensorProto.DataType.UINT16:case H.onnx.TensorProto.DataType.INT16:return 2;case H.onnx.TensorProto.DataType.FLOAT:case H.onnx.TensorProto.DataType.INT32:case H.onnx.TensorProto.DataType.UINT32:return 4;case H.onnx.TensorProto.DataType.INT64:case H.onnx.TensorProto.DataType.DOUBLE:case H.onnx.TensorProto.DataType.UINT64:return 8;default:throw new Error(`cannot calculate sizeof() on type ${H.onnx.TensorProto.DataType[t]}`)}}function mh(t,r){return new(ju(r))(t)}function ju(t){switch(t){case"bool":case"uint8":return Uint8Array;case"int8":return Int8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"float32":return Float32Array;case"float64":return Float64Array;default:throw new Error("unspecified error")}}function ui(t,r){if(r===H.onnx.TensorProto.DataType.INT64||r===si.TensorDataType.INT64){if(t.greaterThanOrEqual(2147483648)||t.lessThan(-2147483648))throw new TypeError("int64 is not supported")}else if(r===H.onnx.TensorProto.DataType.UINT32||r===si.TensorDataType.UINT32||r===H.onnx.TensorProto.DataType.UINT64||r===si.TensorDataType.UINT64){if(t.greaterThanOrEqual(4294967296)||t.lessThan(0))throw new TypeError("uint64 is not supported")}else throw new TypeError(`not a LONG type: ${H.onnx.TensorProto.DataType[r]}`);return t.toNumber()}function Hu(t,r,o){switch(r){case H.onnx.TensorProto.DataType.BOOL:case H.onnx.TensorProto.DataType.UINT8:return t.getUint8(o);case H.onnx.TensorProto.DataType.INT8:return t.getInt8(o);case H.onnx.TensorProto.DataType.UINT16:return t.getUint16(o,!0);case H.onnx.TensorProto.DataType.INT16:return t.getInt16(o,!0);case H.onnx.TensorProto.DataType.FLOAT:return t.getFloat32(o,!0);case H.onnx.TensorProto.DataType.INT32:return t.getInt32(o,!0);case H.onnx.TensorProto.DataType.UINT32:return t.getUint32(o,!0);case H.onnx.TensorProto.DataType.INT64:return ui(xe.fromBits(t.getUint32(o,!0),t.getUint32(o+4,!0),!1),r);case H.onnx.TensorProto.DataType.DOUBLE:return t.getFloat64(o,!0);case H.onnx.TensorProto.DataType.UINT64:return ui(xe.fromBits(t.getUint32(o,!0),t.getUint32(o+4,!0),!0),r);default:throw new Error(`cannot read from DataView for type ${H.onnx.TensorProto.DataType[r]}`)}}var qu,H,si,bt,We=O(()=>{qu=rr(Fs()),qo(),Pr(),H=rr(sr()),Y(),si=F.experimental.fbs,bt=class wr{constructor(r,o,i,u,n,a=qu.Guid.create()){this.dims=r,this.type=o,this.dataProvider=i,this.asyncDataProvider=u,this.cache=n,this.dataId=a,this.size=B.validateDimsAndCalcSize(r);let d=this.size,c=i===void 0&&u===void 0&&n===void 0;if(n!==void 0&&n.length!==d)throw new RangeError("Input dims doesn't match data length.");if(o==="string"){if(n!==void 0&&(!Array.isArray(n)||!n.every(e=>typeof e=="string")))throw new TypeError("cache should be a string array");c&&(this.cache=new Array(d))}else{if(n!==void 0){let e=ju(o);if(!(n instanceof e))throw new TypeError(`cache should be type ${e.name}`)}if(c){let e=new ArrayBuffer(d*hh(o));this.cache=mh(e,o)}}}get data(){if(this.cache===void 0){let r=this.dataProvider(this.dataId);if(r.length!==this.size)throw new Error("Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.");this.cache=r}return this.cache}get stringData(){if(this.type!=="string")throw new TypeError("data type is not string");return this.data}get integerData(){switch(this.type){case"uint8":case"int8":case"uint16":case"int16":case"int32":case"uint32":case"bool":return this.data;default:throw new TypeError("data type is not integer (uint8, int8, uint16, int16, int32, uint32, bool)")}}get floatData(){switch(this.type){case"float32":case"float64":return this.data;default:throw new TypeError("data type is not float (float32, float64)")}}get numberData(){if(this.type!=="string")return this.data;throw new TypeError("type cannot be non-number (string)")}get(r){return this.data[B.indicesToOffset(r,this.strides)]}set(r,o){this.data[B.indicesToOffset(r,this.strides)]=o}async getData(){return this.cache===void 0&&(this.cache=await this.asyncDataProvider(this.dataId)),this.cache}get strides(){return this._strides||(this._strides=B.computeStrides(this.dims)),this._strides}static fromProto(r){if(!r)throw new Error("cannot construct Value from an empty tensor");let o=At.tensorDataTypeFromProto(r.dataType),i=At.tensorDimsFromProto(r.dims),u=new wr(i,o);if(o==="string")r.stringData.forEach((n,a)=>{u.data[a]=kr(n)});else if(r.rawData&&typeof r.rawData.byteLength=="number"&&r.rawData.byteLength>0){let n=u.data,a=new DataView(r.rawData.buffer,r.rawData.byteOffset,r.rawData.byteLength),d=Wu(r.dataType),c=r.rawData.byteLength/d;if(r.rawData.byteLength%d!==0)throw new Error("invalid buffer length");if(n.length!==c)throw new Error("buffer length mismatch");for(let e=0;e<c;e++){let l=Hu(a,r.dataType,e*d);n[e]=l}}else{let n;switch(r.dataType){case H.onnx.TensorProto.DataType.FLOAT:n=r.floatData;break;case H.onnx.TensorProto.DataType.INT32:case H.onnx.TensorProto.DataType.INT16:case H.onnx.TensorProto.DataType.UINT16:case H.onnx.TensorProto.DataType.INT8:case H.onnx.TensorProto.DataType.UINT8:case H.onnx.TensorProto.DataType.BOOL:n=r.int32Data;break;case H.onnx.TensorProto.DataType.INT64:n=r.int64Data;break;case H.onnx.TensorProto.DataType.DOUBLE:n=r.doubleData;break;case H.onnx.TensorProto.DataType.UINT32:case H.onnx.TensorProto.DataType.UINT64:n=r.uint64Data;break;default:throw new Error("unspecific error")}if(n==null)throw new Error("failed to populate data from a tensorproto value");let a=u.data;if(a.length!==n.length)throw new Error("array length mismatch");for(let d=0;d<n.length;d++){let c=n[d];xe.isLong(c)?a[d]=ui(c,r.dataType):a[d]=c}}return u}static fromData(r,o,i){return new wr(o,i,void 0,void 0,r)}static fromOrtTensor(r){if(!r)throw new Error("cannot construct Value from an empty tensor");let o=At.tensorDimsFromORTFormat(r),i=At.tensorDataTypeFromProto(r.dataType()),u=new wr(o,i);if(i==="string")for(let n=0;n<r.stringDataLength();n++)u.data[n]=r.stringData(n);else if(r.rawDataArray()&&typeof r.rawDataLength()=="number"&&r.rawDataLength()>0){let n=u.data,a=new DataView(r.rawDataArray().buffer,r.rawDataArray().byteOffset,r.rawDataLength()),d=Wu(r.dataType()),c=r.rawDataLength()/d;if(r.rawDataLength()%d!==0)throw new Error("invalid buffer length");if(n.length!==c)throw new Error("buffer length mismatch");for(let e=0;e<c;e++){let l=Hu(a,r.dataType(),e*d);n[e]=l}}return u}}});function G(t){return t===1?bh:gh}function Xu(t){let r=G(t);return`${r.version}
|
|
11
11
|
precision highp float;
|
|
12
12
|
${r.attribute} vec3 position;
|
|
13
13
|
${r.attribute} vec2 textureCoord;
|
|
@@ -330,20 +330,20 @@
|
|
|
330
330
|
vec4 result = ${o.name}(v1, v2);
|
|
331
331
|
${c.output} = result;
|
|
332
332
|
}
|
|
333
|
-
`;return{name:o.name,inputNames:["A","B"],inputTypes:[u,u],output:{dims:r[0].dims,type:i,textureType:u},shaderSource:e,hasMain:!0}},bl=(t,r)=>[t.run(qt(t,r,Bh()),r)],gl=(t,r)=>[t.run(qt(t,r,Uh(),"bool"),r)],yl=(t,r)=>[t.run(qt(t,r,Fh()),r)],xl=(t,r)=>[t.run(qt(t,r,Rh(),"bool"),r)],Tl=(t,r)=>[t.run(qt(t,r,Gh(),"bool"),r)],wl=(t,r)=>[t.run(qt(t,r,Mh(),"bool"),r)],vl=(t,r)=>[t.run(qt(t,r,Ch()),r)],Il=(t,r)=>[t.run(qt(t,r,Vh(),"bool"),r)],_l=(t,r)=>[t.run(qt(t,r,Wh()),r)],Ol=(t,r)=>[t.run(qt(t,r,Hh()),r)],Sl=(t,r)=>[t.run(qt(t,r,Nh()),r)],Al=(t,r)=>[t.run(qt(t,r,zh(),"bool"),r)]}),El,Dl,Kh,Ll=O(()=>{Y(),El=(t,r,o)=>(Kh(r),[t.cast(r[0],o)]),Dl=t=>At.tensorDataTypeFromProto(t.attributes.getInt("to")),Kh=t=>{if(!t||t.length!==1)throw new Error("Cast requires 1 input.");if(t[0].type==="string")throw new Error("Invalid input type.")}}),Jh,Yh,$l,kn,kl=O(()=>{ut(),j(),pe(),He(),Jh=(t,r)=>({name:"Concat (packed)",inputNames:Array.from({length:t},(o,i)=>`X${i}`),inputTypes:Array(t).fill(2),cacheHint:r}),Yh=(t,r,o,i)=>{let u=o[0].dims.slice();if(i>=u.length||i<-1*u.length)throw new Error("axis specified for concat doesn't match input dimensionality");i<0&&(i=u.length+i);let n=u.slice(0);for(let
|
|
333
|
+
`;return{name:o.name,inputNames:["A","B"],inputTypes:[u,u],output:{dims:r[0].dims,type:i,textureType:u},shaderSource:e,hasMain:!0}},bl=(t,r)=>[t.run(qt(t,r,Bh()),r)],gl=(t,r)=>[t.run(qt(t,r,Uh(),"bool"),r)],yl=(t,r)=>[t.run(qt(t,r,Fh()),r)],xl=(t,r)=>[t.run(qt(t,r,Rh(),"bool"),r)],Tl=(t,r)=>[t.run(qt(t,r,Gh(),"bool"),r)],wl=(t,r)=>[t.run(qt(t,r,Mh(),"bool"),r)],vl=(t,r)=>[t.run(qt(t,r,Ch()),r)],Il=(t,r)=>[t.run(qt(t,r,Vh(),"bool"),r)],_l=(t,r)=>[t.run(qt(t,r,Wh()),r)],Ol=(t,r)=>[t.run(qt(t,r,Hh()),r)],Sl=(t,r)=>[t.run(qt(t,r,Nh()),r)],Al=(t,r)=>[t.run(qt(t,r,zh(),"bool"),r)]}),El,Dl,Kh,Ll=O(()=>{Y(),El=(t,r,o)=>(Kh(r),[t.cast(r[0],o)]),Dl=t=>At.tensorDataTypeFromProto(t.attributes.getInt("to")),Kh=t=>{if(!t||t.length!==1)throw new Error("Cast requires 1 input.");if(t[0].type==="string")throw new Error("Invalid input type.")}}),Jh,Yh,$l,kn,kl=O(()=>{ut(),j(),pe(),He(),Jh=(t,r)=>({name:"Concat (packed)",inputNames:Array.from({length:t},(o,i)=>`X${i}`),inputTypes:Array(t).fill(2),cacheHint:r}),Yh=(t,r,o,i)=>{let u=o[0].dims.slice();if(i>=u.length||i<-1*u.length)throw new Error("axis specified for concat doesn't match input dimensionality");i<0&&(i=u.length+i);let n=u.slice(0);for(let R=1;R<o.length;R++){let ft=o[R].dims.slice();for(let lt=0;lt<u.length;lt++)if(lt===i)n[i]+=ft[lt];else if(u[lt]!==ft[lt])throw new Error("non concat dimensions must match")}let a=n.length,d=cr("coords",a),c=Bt(a),e=de(),l=o.map(R=>R.dims),s=ne(a),h=new Array(l.length-1);h[0]=l[0][i];for(let R=1;R<h.length;R++)h[R]=h[R-1]+l[R][i];let f=s[i],m=s.slice(-2),v=s.join(),_=`if (${f} < ${h[0]}) {
|
|
334
334
|
return getChannel(
|
|
335
335
|
getX0(${v}), vec2(${m.join()}));
|
|
336
|
-
}`;for(let
|
|
337
|
-
if (${f} < ${h[
|
|
336
|
+
}`;for(let R=1;R<h.length;R++){let ft=h[R-1];_+=`
|
|
337
|
+
if (${f} < ${h[R]} && ${f} >= ${h[R-1]}) {
|
|
338
338
|
return getChannel(
|
|
339
|
-
getX${
|
|
340
|
-
vec2(${kn(m,f,
|
|
339
|
+
getX${R}(${kn(s,f,ft)}),
|
|
340
|
+
vec2(${kn(m,f,ft)}));
|
|
341
341
|
}`}let I=h.length,T=h[h.length-1];_+=`
|
|
342
342
|
return getChannel(
|
|
343
343
|
getX${I}(${kn(s,f,T)}),
|
|
344
344
|
vec2(${kn(m,f,T)}));`;let P=G(t.session.backend.glContext.version),C=`
|
|
345
345
|
${e}
|
|
346
|
-
float getValue(${s.map(
|
|
346
|
+
float getValue(${s.map(R=>"int "+R)}) {
|
|
347
347
|
${_}
|
|
348
348
|
}
|
|
349
349
|
|
|
@@ -605,20 +605,20 @@ vec4 getBAtOutCoordsMatmul(int i) {
|
|
|
605
605
|
${_}
|
|
606
606
|
vec4 outputValue = getB(${n});
|
|
607
607
|
return outputValue;
|
|
608
|
-
}`}function Cm(t,r){let o="";for(let i=0;i<r-2;i++)o+=`rc.${t[i]}, `;return o+=`rc.${t[r-2]}, i*2`,o}function Nm(t,r){let o="";for(let i=0;i<r-2;i++)o+=`rc.${t[i]}, `;return o+=`i*2, rc.${t[r-1]}`,o}var km,Bm,Cn,vi=O(()=>{Y(),ut(),j(),pe(),qe(),Fn(),km=(t,r)=>({name:"MatMul (packed)",inputNames:t?["A","B","Bias"]:["A","B"],inputTypes:t?[2,2,2]:[2,2],cacheHint:r}),Bm=(t,r,o,i)=>{let u=o.length>2,n=u?"value += getBiasForMatmul();":"",a=o[0].dims,d=o[1].dims,c=kt.calcShape(a,d,!0),e=!B.areEqual(o[0].dims,o[1].dims);if(!c)throw new Error("Can't use matmul on the given tensors");let l=a[a.length-1],s=Math.ceil(l/2),h=a.length,f=d.length,m=G(t.session.backend.glContext.version),v=Bt(c.length),_=c.length,I=ne(),{activationFunction:T,applyActivation:P}=he(i),C=u?`${wi(v,I,o[2].dims,c,!0)}`:"",
|
|
608
|
+
}`}function Cm(t,r){let o="";for(let i=0;i<r-2;i++)o+=`rc.${t[i]}, `;return o+=`rc.${t[r-2]}, i*2`,o}function Nm(t,r){let o="";for(let i=0;i<r-2;i++)o+=`rc.${t[i]}, `;return o+=`i*2, rc.${t[r-1]}`,o}var km,Bm,Cn,vi=O(()=>{Y(),ut(),j(),pe(),qe(),Fn(),km=(t,r)=>({name:"MatMul (packed)",inputNames:t?["A","B","Bias"]:["A","B"],inputTypes:t?[2,2,2]:[2,2],cacheHint:r}),Bm=(t,r,o,i)=>{let u=o.length>2,n=u?"value += getBiasForMatmul();":"",a=o[0].dims,d=o[1].dims,c=kt.calcShape(a,d,!0),e=!B.areEqual(o[0].dims,o[1].dims);if(!c)throw new Error("Can't use matmul on the given tensors");let l=a[a.length-1],s=Math.ceil(l/2),h=a.length,f=d.length,m=G(t.session.backend.glContext.version),v=Bt(c.length),_=c.length,I=ne(),{activationFunction:T,applyActivation:P}=he(i),C=u?`${wi(v,I,o[2].dims,c,!0)}`:"",R=e?`${Fm(v,I,o,c)}`:"",ft=e?"getAAtOutCoordsMatmul(i)":`getA(${Cm(I,h)})`,lt=e?"getBAtOutCoordsMatmul(i)":`getB(${Nm(I,f)})`,Nt=e?"":`${v} rc =
|
|
609
609
|
getOutputCoords(); int lastDim = rc.${I[_-1]}; rc.${I[_-1]} =
|
|
610
610
|
rc.${I[_-2]}; rc.${I[_-2]} = lastDim;
|
|
611
|
-
`,
|
|
612
|
-
${
|
|
611
|
+
`,Q=`
|
|
612
|
+
${R}
|
|
613
613
|
${C}
|
|
614
614
|
${T}
|
|
615
615
|
void main() {
|
|
616
|
-
${
|
|
616
|
+
${Nt}
|
|
617
617
|
|
|
618
618
|
vec4 value = vec4(0);
|
|
619
619
|
for (int i = 0; i < ${s}; i++) {
|
|
620
|
-
vec4 a = ${
|
|
621
|
-
vec4 b = ${
|
|
620
|
+
vec4 a = ${ft};
|
|
621
|
+
vec4 b = ${lt};
|
|
622
622
|
|
|
623
623
|
value += (a.rrbb * b.rgrg);
|
|
624
624
|
value += (a.ggaa * b.baba);
|
|
@@ -626,7 +626,7 @@ vec4 getBAtOutCoordsMatmul(int i) {
|
|
|
626
626
|
${n}
|
|
627
627
|
${P}
|
|
628
628
|
${m.output} = value;
|
|
629
|
-
}`;return{...r,output:{dims:c,type:o[0].type,textureType:2},shaderSource:
|
|
629
|
+
}`;return{...r,output:{dims:c,type:o[0].type,textureType:2},shaderSource:Q,hasMain:!0}},Cn=(t,r,o)=>{let i=km(r.length>2,o.activationCacheKey);return{...i,get:()=>Bm(t,i,r,o)}}}),hf,mf=O(()=>{Bn(),cf(),vi(),hf=(t,r,o)=>{let i=r[0].dims,u=r[1].dims,n=dr(i,u,o.dilations,o.pads,o.strides),a=t.run(ff(t,r[0],r[1],n,o),[r[0]]),d=t.reshapePacked(r[1],[u[0],u[1]*u[2]*u[3]]),c=r.length===3?[d,a,r[2]]:[d,a],e=t.run(Cn(t,c,o),c);return t.reshapePacked(e,n)}}),Rm,Gm,bf,Ii,_i=O(()=>{j(),Rm=t=>({name:"Im2Col",inputNames:["X"],inputTypes:[0],cacheHint:t}),Gm=(t,r,o,i,u,n)=>{let a=o.dims,d=i.dims,c=u.length,e=Ii(a,d,u,4),l=`
|
|
630
630
|
const int XC = ${a[1]};
|
|
631
631
|
const int XH = ${a[2]};
|
|
632
632
|
const int XW = ${a[3]};
|
|
@@ -1484,13 +1484,13 @@ value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),bc=(t,r,o)=>Xe(
|
|
|
1484
1484
|
float sampleTexture(sampler2D textureSampler, vec2 uv) {
|
|
1485
1485
|
return ${o.texture2D}(textureSampler, uv).r;
|
|
1486
1486
|
}`),t}getInputsSamplingSnippets(){let t={},r=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((o,i)=>{let u=this.context.inputTextureLayouts[i],n=An(o);u.isPacked?t[n]=this.getPackedSamplerFromInput(n,o,u):t[n]=this.getUnpackedSamplerFromInput(n,o,u);let a=Yu(o);u.unpackedShape.length<=r.unpackedShape.length&&(u.isPacked?t[a]=this.getPackedSamplerAtOutputCoords(a,u,r,o):t[a]=this.getUnpackedSamplerAtOutputCoords(a,u,r,o))}),t}getPackedSamplerAtOutputCoords(t,r,o,i){let u=r.unpackedShape,n=o.unpackedShape,a=An(i),d=u.length,c=n.length,e=kt.getBroadcastDims(u,n),l=Bt(c),s=c-d,h,f=ne();d===0?h="":c<2&&e.length>=1?h="coords = 0;":h=e.map(C=>`coords.${f[C+s]} = 0;`).join(`
|
|
1487
|
-
`);let m="";c<2&&d>0?m="coords":m=u.map((C,
|
|
1487
|
+
`);let m="";c<2&&d>0?m="coords":m=u.map((C,R)=>`coords.${f[R+s]}`).join(", ");let v="return outputValue;",_=B.size(u)===1,I=B.size(n)===1;if(d===1&&!_&&!I)v=`
|
|
1488
1488
|
return vec4(outputValue.xy, outputValue.xy);
|
|
1489
1489
|
`;else if(_&&!I)c===1?v=`
|
|
1490
1490
|
return vec4(outputValue.x, outputValue.x, 0., 0.);
|
|
1491
1491
|
`:v=`
|
|
1492
1492
|
return vec4(outputValue.x);
|
|
1493
|
-
`;else if(e.length){let C=d-2,
|
|
1493
|
+
`;else if(e.length){let C=d-2,R=d-1;e.indexOf(C)>-1&&e.indexOf(R)>-1?v="return vec4(outputValue.x);":e.indexOf(C)>-1?v="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":e.indexOf(R)>-1&&(v="return vec4(outputValue.xx, outputValue.zz);")}let T=`
|
|
1494
1494
|
int lastDim = coords.${f[c-1]};
|
|
1495
1495
|
coords.${f[c-1]} = coords.${f[c-2]};
|
|
1496
1496
|
coords.${f[c-2]} = lastDim;
|
|
@@ -1667,13 +1667,13 @@ value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),bc=(t,r,o)=>Xe(
|
|
|
1667
1667
|
vec2 coords = offsetToCoords(offset, ${o}, ${i});
|
|
1668
1668
|
return ${a.texture2D}(${t}, coords);
|
|
1669
1669
|
}
|
|
1670
|
-
`}}}),zn,pp=O(()=>{Te(),zn=class
|
|
1670
|
+
`}}}),zn,pp=O(()=>{Te(),zn=class nn extends Ht{constructor(r){super(r)}getFunctions(){return{...this.encodeFloat32(),...this.decodeFloat32()}}getCustomTypes(){return{}}encodeFloat32(){return{encode:new k$1(`highp vec4 encode(highp float f) {
|
|
1671
1671
|
return vec4(f, 0.0, 0.0, 0.0);
|
|
1672
1672
|
}
|
|
1673
1673
|
`)}}decodeFloat32(){return{decode:new k$1(`highp float decode(highp vec4 rgba) {
|
|
1674
1674
|
return rgba.r;
|
|
1675
1675
|
}
|
|
1676
|
-
`)}}encodeUint8(){let r=
|
|
1676
|
+
`)}}encodeUint8(){let r=nn.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new k$1(`
|
|
1677
1677
|
highp vec4 encode(highp float f) {
|
|
1678
1678
|
highp float F = abs(f);
|
|
1679
1679
|
highp float Sign = step(0.0,-f);
|
|
@@ -1689,7 +1689,7 @@ value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),bc=(t,r,o)=>Xe(
|
|
|
1689
1689
|
rgba = rgba / 255.0; // values need to be normalized to [0,1]
|
|
1690
1690
|
return rgba;
|
|
1691
1691
|
}
|
|
1692
|
-
`)}}decodeUint8(){let r=
|
|
1692
|
+
`)}}decodeUint8(){let r=nn.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new k$1(`
|
|
1693
1693
|
highp float decode(highp vec4 rgba) {
|
|
1694
1694
|
rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255]
|
|
1695
1695
|
${r}
|
|
@@ -1707,7 +1707,7 @@ value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),bc=(t,r,o)=>Xe(
|
|
|
1707
1707
|
float getColorAsFloat(vec4 color) {
|
|
1708
1708
|
return decode(color);
|
|
1709
1709
|
}
|
|
1710
|
-
`,["encoding.decode"])}}}}),Hn,hp=O(()=>{Te(),Hn=class
|
|
1710
|
+
`,["encoding.decode"])}}}}),Hn,hp=O(()=>{Te(),Hn=class Ie extends Ht{constructor(r){super(r)}getFunctions(){return{...this.bcastIndex(),...this.bcastMatmulIndex(),...this.offsetToIndices(),...this.indicesToOffset(),...this.incrementIndices()}}getCustomTypes(){return{}}bcastIndex(){let r=this.context.outputTextureLayout.shape.length,o={};return this.context.programInfo.inputNames.forEach((i,u)=>{let n=this.context.inputTextureLayouts[u].unpackedShape;if(n.length<=r){let a=n.length,d=r-a,c=`bcastIndices_${i}`,e="";for(let s=0;s<a;++s)e+=`
|
|
1711
1711
|
realIndices[${s}] = int( mod(float(bcastedIndices[${d+s}]), ${n[s]}.0) );
|
|
1712
1712
|
`;let l=`
|
|
1713
1713
|
void ${c} (int bcastedIndices[${r}], out int realIndices[${a}]) {
|
|
@@ -1721,7 +1721,7 @@ value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),bc=(t,r,o)=>Xe(
|
|
|
1721
1721
|
realIndices[${a-1}] = bcastedIndices[${r-1}];
|
|
1722
1722
|
realIndices[${a-2}] = bcastedIndices[${r-2}];
|
|
1723
1723
|
}
|
|
1724
|
-
`;o[c]=new k$1(l)}}),o}indicesToOffset(){let r={};return this.context.programInfo.inputNames.forEach((o,i)=>{let u=this.context.inputTextureLayouts[i].shape,n=this.context.inputTextureLayouts[i].strides,a=u.length,d=`indicesToOffset_${o}`;r[d]=new k$1(
|
|
1724
|
+
`;o[c]=new k$1(l)}}),o}indicesToOffset(){let r={};return this.context.programInfo.inputNames.forEach((o,i)=>{let u=this.context.inputTextureLayouts[i].shape,n=this.context.inputTextureLayouts[i].strides,a=u.length,d=`indicesToOffset_${o}`;r[d]=new k$1(Ie.indexToOffsetSingle(d,a,n)),d=`indicesToOffset_${o}_T`,r[d]=new k$1(Ie.indexToOffsetSingle(d,a,n.slice().reverse()))}),r}static indexToOffsetSingle(r,o,i){let u="";for(let n=o-1;n>=0;--n)u+=`
|
|
1725
1725
|
offset += indices[${n}] * ${i[n]};
|
|
1726
1726
|
`;return`
|
|
1727
1727
|
int ${r}(int indices[${o}]) {
|
|
@@ -1729,7 +1729,7 @@ value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),bc=(t,r,o)=>Xe(
|
|
|
1729
1729
|
${u}
|
|
1730
1730
|
return offset;
|
|
1731
1731
|
}
|
|
1732
|
-
`}offsetToIndices(){let r={};return this.context.programInfo.inputNames.forEach((o,i)=>{let u=this.context.inputTextureLayouts[i].shape,n=this.context.inputTextureLayouts[i].strides,a=u.length,d=`offsetToIndices_${o}`;r[d]=new k$1(
|
|
1732
|
+
`}offsetToIndices(){let r={};return this.context.programInfo.inputNames.forEach((o,i)=>{let u=this.context.inputTextureLayouts[i].shape,n=this.context.inputTextureLayouts[i].strides,a=u.length,d=`offsetToIndices_${o}`;r[d]=new k$1(Ie.offsetToIndicesSingle(d,a,n)),d=`offsetToIndices_${o}_T`,r[d]=new k$1(Ie.offsetToIndicesSingle(d,a,n.slice().reverse()))}),r}static offsetToIndicesSingle(r,o,i){let u=[];for(let n=0;n<o-1;++n)u.push(`
|
|
1733
1733
|
indices[${n}] = offset / ${i[n]};`),u.push(`
|
|
1734
1734
|
offset -= indices[${n}] * ${i[n]};`);return u.push(`
|
|
1735
1735
|
indices[${o-1}] = offset;`),`
|
|
@@ -1802,11 +1802,11 @@ value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),bc=(t,r,o)=>Xe(
|
|
|
1802
1802
|
${t}
|
|
1803
1803
|
`);let r=this.glContext.compileShader(t,this.glContext.gl.FRAGMENT_SHADER),o=this.glContext.createProgram(this.vertexShader,r);return this.glContext.deleteShader(r),o}bindOutput(t){let r=t.width,o=t.height;tt.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${r}/${o}, shape=${t.shape}, type=${t.tensor.type}`),this.glContext.attachFramebuffer(t.texture,r,o)}bindAttributes(t){let r=t.position,o=t.textureCoord;this.glContext.setVertexAttributes(r,o),this.attributesBound=!0}bindUniforms(t,r,o){var n;let i=this.glContext.gl,u=0;for(let{name:a,type:d,location:c,arrayLength:e}of t){let l=(n=r.find(s=>s.name===a))==null?void 0:n.data;if(d!=="sampler2D"&&!l)throw new Error(`variable '${a}' does not have data defined in program info`);switch(d){case"sampler2D":this.bindTexture(o[u],c,u),u++;break;case"float":e?i.uniform1fv(c,l):i.uniform1f(c,l);break;case"int":e?i.uniform1iv(c,l):i.uniform1i(c,l);break;default:throw new Error(`Uniform not implemented: ${d}`)}}}bindTexture(t,r,o){this.glContext.bindTextureToUniform(t.texture,o,r)}getAttribLocations(t){return{position:this.getAttribLocation(t,"position"),textureCoord:this.getAttribLocation(t,"textureCoord")}}getUniformLocations(t,r,o){let i=[];if(r)for(let u of r)i.push({name:u,type:"sampler2D",location:this.getUniformLocation(t,u)});if(o)for(let u of o)i.push({...u,location:this.getUniformLocation(t,u.name)});return i}getUniformLocation(t,r){let o=this.glContext.gl.getUniformLocation(t,r);if(o===null)throw new Error(`Uniform ${r} not found.`);return o}getAttribLocation(t,r){return this.glContext.gl.getAttribLocation(t,r)}}}),Kn,xp=O(()=>{Ut(),Fr(),Kn=class{constructor(t,r,o,i){this.glContext=t,this.layoutStrategy=r,this.profiler=o,this.config=i,this.pendingRead=new Map,i.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(t,r,o,i){let u=this.toEncoderType(t),n=this.glContext.getEncoder(u,r.channels||1,i);if(r.isPacked&&i===1)throw new Error("not implemented");let a=r.width,d=r.height,c,e;if(this.config.reuseTextures){c=`${a}x${d}_${n.format}_${n.internalFormat}_${n.textureType}`,e=this.inUseTextures.get(c),e||(e=[],this.inUseTextures.set(c,e));let s=this.idleTextures.get(c);if(s&&s.length>0){let h=s.pop();return e.push(h),i===1&&this.glContext.updateTexture(h,a,d,n,this.toTextureData(t,o)),h}}tt.verbose("TextureManager",`Creating new texture of size ${r.width}x${r.height}`);let l=this.glContext.allocateTexture(a,d,n,this.toTextureData(t,o));return this.config.reuseTextures&&(e.push(l),this.textureLookup.set(l,c)),l}readTexture(t,r,o){return o||(o=1),this.profiler.event("backend","TextureManager.readTexture",()=>{let i=t.shape.reduce((n,a)=>n*a)*o,u=this.glContext.readTexture(t.texture,t.width,t.height,i,this.toEncoderType(r),o);return this.toTensorData(r,u)})}async readTextureAsync(t,r,o){let i=t.tensor.dataId;if(o||(o=1),this.pendingRead.has(i)){let u=this.pendingRead.get(i);return new Promise(n=>u==null?void 0:u.push(n))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(i,[]);let u=t.shape.reduce((c,e)=>c*e)*o;await this.glContext.createAndWaitForFence();let n=this.glContext.readTexture(t.texture,t.width,t.height,u,this.toEncoderType(r),o),a=this.toTensorData(r,n),d=this.pendingRead.get(i);return this.pendingRead.delete(i),d==null||d.forEach(c=>c(a)),a})}readUint8TextureAsFloat(t){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{let r=t.shape.reduce((i,u)=>i*u),o=this.glContext.readTexture(t.texture,t.width,t.height,r*4,"byte",4);return new Float32Array(o.buffer,o.byteOffset,r)})}releaseTexture(t,r){let o;if(this.config.reuseTextures&&(o=this.textureLookup.get(t.texture),o)){r&&this.textureLookup.delete(o);let i=this.inUseTextures.get(o);if(i){let u=i.indexOf(t.texture);if(u!==-1){i.splice(u,1);let n=this.idleTextures.get(o);n||(n=[],this.idleTextures.set(o,n)),n.push(t.texture)}}}(!o||r)&&(tt.verbose("TextureManager",`Deleting texture of size ${t.width}x${t.height}`),this.glContext.deleteTexture(t.texture))}toTensorData(t,r){switch(t){case"int16":return r instanceof Int16Array?r:Int16Array.from(r);case"int32":return r instanceof Int32Array?r:Int32Array.from(r);case"int8":return r instanceof Int8Array?r:Int8Array.from(r);case"uint16":return r instanceof Uint16Array?r:Uint16Array.from(r);case"uint32":return r instanceof Uint32Array?r:Uint32Array.from(r);case"uint8":case"bool":return r instanceof Uint8Array?r:Uint8Array.from(r);case"float32":return r instanceof Float32Array?r:Float32Array.from(r);case"float64":return r instanceof Float64Array?r:Float64Array.from(r);default:throw new Error(`TensorData type ${t} is not supported`)}}toTextureData(t,r){if(r)return r instanceof Float32Array?r:new Float32Array(r)}toEncoderType(t){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}}),Jn,Tp=O(()=>{Ut(),Bs(),cl(),ap(),yp(),Ni(),xp(),Jn=class{constructor(t,r){this.backend=t,this.context=r,this.layoutStrategy=new Un(t.glContext.maxTextureSize),this.programManager=new Xn(this.context.profiler,t.glContext,this.layoutStrategy),this.textureManager=new Kn(t.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:t.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=t.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new Dn(this)}onGraphInitialized(t){let r=t.getValues().filter(o=>o.from===-1&&o.tensor).map(o=>o.tensor.dataId);this.initializers=new Set(r)}isInitializer(t){return this.initializers?this.initializers.has(t):!1}addInitializer(t){this.initializers.add(t)}getTextureData(t,r){return r?this.packedTextureDataCache.get(t):this.unpackedTextureDataCache.get(t)}setTextureData(t,r,o=!1){tt.verbose("WebGLSessionHandler","Storing Texture data in cache"),o?this.packedTextureDataCache.set(t,r):this.unpackedTextureDataCache.set(t,r)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(t=>this.textureManager.releaseTexture(t,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(t=>this.textureManager.releaseTexture(t,!0)),this.unpackedTextureDataCache=new Map}resolve(t,r,o){let i=ks(t,r,ip);return{impl:i.opImpl,context:i.opInit?i.opInit(t,o):t}}}});function bg(t){let r=0;for(;r<t.length&&t[r]();++r);return r-1}var Mr,wp=O(()=>{Yt(),Fr(),Fr(),pe(),Mr=class{constructor(t,r){this.frameBufferBound=!1,this.itemsToPoll=[],this.gl=t,this.version=r,this.getExtensions(),this.vertexbuffer=this.createVertexbuffer(),this.framebuffer=this.createFramebuffer(),this.queryVitalParameters()}allocateTexture(t,r,o,i){let u=this.gl,n=u.createTexture();u.bindTexture(u.TEXTURE_2D,n),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE);let a=i?o.encode(i,t*r):null;return u.texImage2D(u.TEXTURE_2D,0,o.internalFormat,t,r,0,o.format,o.textureType,a),this.checkError(),n}updateTexture(t,r,o,i,u){let n=this.gl;n.bindTexture(n.TEXTURE_2D,t);let a=i.encode(u,r*o);n.texSubImage2D(n.TEXTURE_2D,0,0,0,r,o,i.format,i.textureType,a),this.checkError()}attachFramebuffer(t,r,o){let i=this.gl;i.bindTexture(i.TEXTURE_2D,t),i.bindFramebuffer(i.FRAMEBUFFER,this.framebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),this.checkError(),i.viewport(0,0,r,o),i.scissor(0,0,r,o)}readTexture(t,r,o,i,u,n){let a=this.gl;n||(n=1),this.frameBufferBound||this.attachFramebuffer(t,r,o);let d=this.getEncoder(u,n),c=d.allocate(r*o);return a.bindTexture(a.TEXTURE_2D,t),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,t,0),a.readPixels(0,0,r,o,a.RGBA,d.textureType,c),this.checkError(),d.decode(c,i)}isFramebufferReady(){return!0}getActiveTexture(){let t=this.gl;return`TEXTURE${t.getParameter(this.gl.ACTIVE_TEXTURE)-t.TEXTURE0}`}getTextureBinding(){return this.gl.getParameter(this.gl.TEXTURE_BINDING_2D)}getFramebufferBinding(){return this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING)}setVertexAttributes(t,r){let o=this.gl;o.vertexAttribPointer(t,3,o.FLOAT,!1,20,0),o.enableVertexAttribArray(t),r!==-1&&(o.vertexAttribPointer(r,2,o.FLOAT,!1,20,12),o.enableVertexAttribArray(r)),this.checkError()}createProgram(t,r){let o=this.gl,i=o.createProgram();return o.attachShader(i,t),o.attachShader(i,r),o.linkProgram(i),i}compileShader(t,r){let o=this.gl,i=o.createShader(r);if(!i)throw new Error(`createShader() returned null with type ${r}`);if(o.shaderSource(i,t),o.compileShader(i),o.getShaderParameter(i,o.COMPILE_STATUS)===!1)throw new Error(`Failed to compile shader: ${o.getShaderInfoLog(i)}
|
|
1804
1804
|
Shader source:
|
|
1805
|
-
${t}`);return i}deleteShader(t){this.gl.deleteShader(t)}bindTextureToUniform(t,r,o){let i=this.gl;i.activeTexture(i.TEXTURE0+r),this.checkError(),i.bindTexture(i.TEXTURE_2D,t),this.checkError(),i.uniform1i(o,r),this.checkError()}draw(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.checkError()}checkError(){if(z.debug){let t=this.gl,r=t.getError(),o="";switch(r){case t.NO_ERROR:return;case t.INVALID_ENUM:o="INVALID_ENUM";break;case t.INVALID_VALUE:o="INVALID_VALUE";break;case t.INVALID_OPERATION:o="INVALID_OPERATION";break;case t.INVALID_FRAMEBUFFER_OPERATION:o="INVALID_FRAMEBUFFER_OPERATION";break;case t.OUT_OF_MEMORY:o="OUT_OF_MEMORY";break;case t.CONTEXT_LOST_WEBGL:o="CONTEXT_LOST_WEBGL";break;default:o=`Unknown WebGL Error: ${r.toString(16)}`}throw new Error(o)}}deleteTexture(t){this.gl.deleteTexture(t)}deleteProgram(t){this.gl.deleteProgram(t)}getEncoder(t,r,o=0){if(this.version===2)return new Pn(this.gl,r);switch(t){case"float":return o===1||this.isRenderFloat32Supported?new Br(this.gl,r):new Br(this.gl,r,this.textureHalfFloatExtension.HALF_FLOAT_OES);case"int":throw new Error("not implemented");case"byte":return new En(this.gl,r);default:throw new Error(`Invalid dataType: ${t}`)}}clearActiveTextures(){let t=this.gl;for(let r=0;r<this.maxTextureImageUnits;++r)t.activeTexture(t.TEXTURE0+r),t.bindTexture(t.TEXTURE_2D,null)}dispose(){if(this.disposed)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(this.framebuffer),t.bindBuffer(t.ARRAY_BUFFER,null),t.deleteBuffer(this.vertexbuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null),t.finish(),this.disposed=!0}createDefaultGeometry(){return new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0])}createVertexbuffer(){let t=this.gl,r=t.createBuffer();if(!r)throw new Error("createBuffer() returned null");let o=this.createDefaultGeometry();return t.bindBuffer(t.ARRAY_BUFFER,r),t.bufferData(t.ARRAY_BUFFER,o,t.STATIC_DRAW),this.checkError(),r}createFramebuffer(){let t=this.gl.createFramebuffer();if(!t)throw new Error("createFramebuffer returned null");return t}queryVitalParameters(){let t=this.gl;if(this.isFloatTextureAttachableToFrameBuffer=this.checkFloatTextureAttachableToFrameBuffer(),this.isRenderFloat32Supported=this.checkRenderFloat32(),this.isFloat32DownloadSupported=this.checkFloat32Download(),this.version===1&&!this.textureHalfFloatExtension&&!this.isRenderFloat32Supported)throw new Error("both float32 and float16 TextureType are not supported");this.isBlendSupported=!this.isRenderFloat32Supported||this.checkFloat32Blend(),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxTextureImageUnits=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.version}getExtensions(){this.version===2?(this.colorBufferFloatExtension=this.gl.getExtension("EXT_color_buffer_float"),this.disjointTimerQueryWebgl2Extension=this.gl.getExtension("EXT_disjoint_timer_query_webgl2")):(this.textureFloatExtension=this.gl.getExtension("OES_texture_float"),this.textureHalfFloatExtension=this.gl.getExtension("OES_texture_half_float"))}checkFloatTextureAttachableToFrameBuffer(){let t=this.gl,r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let o=this.version===2?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,o,1,1,0,t.RGBA,t.FLOAT,null);let i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);let u=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(i),u}checkRenderFloat32(){if(this.version===2){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension)return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Download(){if(this.version===2){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension||!this.gl.getExtension("WEBGL_color_buffer_float"))return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Blend(){let t=this.gl,r,o,i,u,n;try{r=t.createTexture(),o=t.createFramebuffer(),t.bindTexture(t.TEXTURE_2D,r);let a=this.version===2?t.RGBA32F:t.RGBA;return t.texImage2D(t.TEXTURE_2D,0,a,1,1,0,t.RGBA,t.FLOAT,null),t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.enable(t.BLEND),i=t.createShader(t.VERTEX_SHADER),!i||(t.shaderSource(i,"void main(){}"),t.compileShader(i),u=t.createShader(t.FRAGMENT_SHADER),!u)||(t.shaderSource(u,"precision highp float;void main(){gl_FragColor=vec4(0.5);}"),t.compileShader(u),n=t.createProgram(),!n)?!1:(t.attachShader(n,i),t.attachShader(n,u),t.linkProgram(n),t.useProgram(n),t.drawArrays(t.POINTS,0,1),t.getError()===t.NO_ERROR)}finally{t.disable(t.BLEND),n&&t.deleteProgram(n),i&&t.deleteShader(i),u&&t.deleteShader(u),o&&(t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(o)),r&&(t.bindTexture(t.TEXTURE_2D,null),t.deleteTexture(r))}}beginTimer(){if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let t=this.gl,r=this.disjointTimerQueryWebgl2Extension,o=t.createQuery();return t.beginQuery(r.TIME_ELAPSED_EXT,o),o}else throw new Error("WebGL1 profiling currently not supported.")}endTimer(){if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let t=this.gl,r=this.disjointTimerQueryWebgl2Extension;t.endQuery(r.TIME_ELAPSED_EXT);return}else throw new Error("WebGL1 profiling currently not supported")}isTimerResultAvailable(t){let r=!1,o=!1;if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let i=this.gl,u=this.disjointTimerQueryWebgl2Extension;r=i.getQueryParameter(t,i.QUERY_RESULT_AVAILABLE),o=i.getParameter(u.GPU_DISJOINT_EXT)}else throw new Error("WebGL1 profiling currently not supported");return r&&!o}getTimerResult(t){let r=0;if(this.version===2){let o=this.gl;r=o.getQueryParameter(t,o.QUERY_RESULT),o.deleteQuery(t)}else throw new Error("WebGL1 profiling currently not supported");return r/1e6}async waitForQueryAndGetTime(t){return await li(()=>this.isTimerResultAvailable(t)),this.getTimerResult(t)}async createAndWaitForFence(){let t=this.createFence(this.gl);return this.pollFence(t)}createFence(t){let r,o=t,i=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);return t.flush(),i===null?r=()=>!0:r=()=>{let u=o.clientWaitSync(i,0,0);return u===o.ALREADY_SIGNALED||u===o.CONDITION_SATISFIED},{query:i,isFencePassed:r}}async pollFence(t){return new Promise(r=>{this.addItemToPoll(()=>t.isFencePassed(),()=>r())})}pollItems(){let t=bg(this.itemsToPoll.map(r=>r.isDoneFn));for(let r=0;r<=t;++r){let{resolveFn:o}=this.itemsToPoll[r];o()}this.itemsToPoll=this.itemsToPoll.slice(t+1)}async addItemToPoll(t,r){this.itemsToPoll.push({isDoneFn:t,resolveFn:r}),!(this.itemsToPoll.length>1)&&await li(()=>(this.pollItems(),this.itemsToPoll.length===0))}}});function Gi(t){let r;if((!t||t==="webgl2")&&"webgl2"in mr?r=mr.webgl2:(!t||t==="webgl")&&"webgl"in mr&&(r=mr.webgl),!r)try{let i=yg();r=vp(i,t)}catch{let i=gg();r=vp(i,t)}t=t||r.version===1?"webgl":"webgl2";let o=r.gl;return mr[t]=r,o.isContextLost()?(delete mr[t],Gi(t)):(o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.disable(o.BLEND),o.disable(o.DITHER),o.disable(o.POLYGON_OFFSET_FILL),o.disable(o.SAMPLE_COVERAGE),o.enable(o.SCISSOR_TEST),o.enable(o.CULL_FACE),o.cullFace(o.BACK),r)}function vp(t,r){let o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1},i,u=o;if((!r||r==="webgl2")&&(i=t.getContext("webgl2",u),i))try{return new Mr(i,2)}catch(n){tt.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${n}`)}if((!r||r==="webgl")&&(i=t.getContext("webgl",u)||t.getContext("experimental-webgl",u),i))try{return new Mr(i,1)}catch(n){tt.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${n}`)}throw new Error("WebGL is not supported")}function gg(){if(typeof document>"u")throw new TypeError("failed to create canvas: document is not supported");let t=document.createElement("canvas");return t.width=1,t.height=1,t}function yg(){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create offscreen canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}var mr,Ip=O(()=>{Ut(),wp(),mr={}}),Yn,_p=O(()=>{Yt(),Ut(),Tp(),Ip(),Yn=class{get contextId(){return z.webgl.contextId}set contextId(t){z.webgl.contextId=t}get matmulMaxBatchSize(){return z.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(t){z.webgl.matmulMaxBatchSize=t}get textureCacheMode(){return z.webgl.textureCacheMode}set textureCacheMode(t){z.webgl.textureCacheMode=t}get pack(){return z.webgl.pack}set pack(t){z.webgl.pack=t}get async(){return z.webgl.async}set async(t){z.webgl.async=t}initialize(){try{return this.glContext=Gi(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),tt.setWithEnv(z),z.webgl.context||Object.defineProperty(z.webgl,"context",{value:this.glContext.gl}),tt.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(t){return tt.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${t}`),!1}}createSessionHandler(t){return new Jn(this,t)}dispose(){this.glContext.dispose()}}});async function Mi(t){if(t){let r=typeof t=="string"?[t]:t;for(let o of r){let i=Op.get(o);if(i)return i;let u=await Tg(o);if(u)return u}}else return Mi(["webgl"]);throw new Error("no available backend to use")}async function Tg(t){let r=xg;if(typeof r[t]<"u"&&wg(r[t])){let o=r[t],i=o.initialize();if(typeof i=="object"&&"then"in i&&(i=await i),i)return Op.set(t,o),o}}function wg(t){let r=t;return"initialize"in r&&typeof r.initialize=="function"&&"createSessionHandler"in r&&typeof r.createSessionHandler=="function"&&"dispose"in r&&typeof r.dispose=="function"}var Op,xg,Sp=O(()=>{_p(),Op=new Map,xg={webgl:new Yn}}),Ui,Zn,Ap=O(()=>{Ut(),Ui=class{constructor(t,r){this.op=t,this.node=r}},Zn=class{constructor(t,r,o){this.graph=t,this.profiler=o,this.initialize(r)}initialize(t){this.profiler.event("session","ExecutionPlan.initialize",()=>{let r=this.graph.getNodes();if(r.length!==t.length)throw new Error("The size of nodes and OPs do not match.");this._ops=t.map((o,i)=>new Ui(o,r[i])),this.reset(),this._starter=[],this._ops.forEach((o,i)=>{let u=!0;for(let n of o.node.inputs)if(!this._values[n]&&this.graph.getInputIndices().indexOf(n)===-1){u=!1;break}u&&this._starter.push(i)})})}reset(){this._values=this.graph.getValues().map(t=>t.tensor)}async execute(t,r){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();let o=t.createInferenceHandler(),i=this.graph.getInputIndices();if(r.length!==i.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${r.length} expected: ${i.length}`);r.forEach((e,l)=>{let s=i[l];this._values[s]=e});let u=this._starter.slice(0),n=this.graph.getValues(),a=this.graph.getNodes(),d=0;for(;d<u.length;){let e=u[d++],l=this._ops[e],s=l.node.inputs.map(v=>this._values[v]);if(s.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${l.node}`);let h=s;tt.verbose("ExecPlan",`Running op:${l.node.name} (${h.map((v,_)=>`'${l.node.inputs[_]}': ${v.type}[${v.dims.join(",")}]`).join(", ")})`);let f=await this.profiler.event("node",l.node.name,async()=>l.op.impl(o,h,l.op.context));if(f.length!==l.node.outputs.length)throw new Error("the size of output does not match model definition.");f.forEach((v,_)=>{let I=l.node.outputs[_];if(this._values[I])throw new Error(`output [${I}] already has value: op:${l.node.name}`);this._values[I]=v});let m=new Set;f.forEach((v,_)=>{let I=l.node.outputs[_];for(let T of n[I].to){let P=a[T],C=!0;for(let V of P.inputs)if(!this._values[V]){C=!1;break}C&&m.add(T)}}),u.push(...m)}let c=[];for(let e=0;e<this.graph.getOutputIndices().length;e++){let l=this.graph.getOutputIndices()[e],s=this._values[l];if(s===void 0)throw new Error(`required output [${l}] does not have value`);l===0?await s.getData():s.data,c.push(s)}return tt.verbose("ExecPlan","disposing of inferenceHandler"),o.dispose(),c})}}}),q,Xt,Ur,Pp=O(()=>{Pr(),q=rr(sr()),We(),Y(),Xt=F.experimental.fbs,Ur=class Ae{constructor(r){if(this._attributes=new Map,r!=null){for(let o of r)o instanceof q.onnx.AttributeProto?this._attributes.set(o.name,[Ae.getValue(o),Ae.getType(o)]):o instanceof Xt.Attribute&&this._attributes.set(o.name(),[Ae.getValue(o),Ae.getType(o)]);if(this._attributes.size<r.length)throw new Error("duplicated attribute names")}}set(r,o,i){this._attributes.set(r,[i,o])}delete(r){this._attributes.delete(r)}getFloat(r,o){return this.get(r,"float",o)}getInt(r,o){return this.get(r,"int",o)}getString(r,o){return this.get(r,"string",o)}getTensor(r,o){return this.get(r,"tensor",o)}getFloats(r,o){return this.get(r,"floats",o)}getInts(r,o){return this.get(r,"ints",o)}getStrings(r,o){return this.get(r,"strings",o)}getTensors(r,o){return this.get(r,"tensors",o)}get(r,o,i){let u=this._attributes.get(r);if(u===void 0){if(i!==void 0)return i;throw new Error(`required attribute not found: ${r}`)}if(u[1]!==o)throw new Error(`type mismatch: expected ${o} but got ${u[1]}`);return u[0]}static getType(r){let o=r instanceof q.onnx.AttributeProto?r.type:r.type();switch(o){case q.onnx.AttributeProto.AttributeType.FLOAT:return"float";case q.onnx.AttributeProto.AttributeType.INT:return"int";case q.onnx.AttributeProto.AttributeType.STRING:return"string";case q.onnx.AttributeProto.AttributeType.TENSOR:return"tensor";case q.onnx.AttributeProto.AttributeType.FLOATS:return"floats";case q.onnx.AttributeProto.AttributeType.INTS:return"ints";case q.onnx.AttributeProto.AttributeType.STRINGS:return"strings";case q.onnx.AttributeProto.AttributeType.TENSORS:return"tensors";default:throw new Error(`attribute type is not supported yet: ${q.onnx.AttributeProto.AttributeType[o]}`)}}static getValue(r){let o=r instanceof q.onnx.AttributeProto?r.type:r.type();if(o===q.onnx.AttributeProto.AttributeType.GRAPH||o===q.onnx.AttributeProto.AttributeType.GRAPHS)throw new Error("graph attribute is not supported yet");let i=this.getValueNoCheck(r);if(o===q.onnx.AttributeProto.AttributeType.INT&&Rt.isLong(i))return Rt.longToNumber(i);if(o===q.onnx.AttributeProto.AttributeType.INTS){let u=i,n=new Array(u.length);for(let a=0;a<u.length;a++){let d=u[a];n[a]=Rt.longToNumber(d)}return n}if(o===q.onnx.AttributeProto.AttributeType.TENSOR)return r instanceof q.onnx.AttributeProto?bt.fromProto(i):bt.fromOrtTensor(i);if(o===q.onnx.AttributeProto.AttributeType.TENSORS){if(r instanceof q.onnx.AttributeProto)return i.map(u=>bt.fromProto(u));if(r instanceof Xt.Attribute)return i.map(u=>bt.fromOrtTensor(u))}return o===q.onnx.AttributeProto.AttributeType.STRING&&r instanceof q.onnx.AttributeProto?kr(i):o===q.onnx.AttributeProto.AttributeType.STRINGS&&r instanceof q.onnx.AttributeProto?i.map(kr):i}static getValueNoCheck(r){return r instanceof q.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(r):this.getValueNoCheckFromOrtFormat(r)}static getValueNoCheckFromOnnxFormat(r){switch(r.type){case q.onnx.AttributeProto.AttributeType.FLOAT:return r.f;case q.onnx.AttributeProto.AttributeType.INT:return r.i;case q.onnx.AttributeProto.AttributeType.STRING:return r.s;case q.onnx.AttributeProto.AttributeType.TENSOR:return r.t;case q.onnx.AttributeProto.AttributeType.GRAPH:return r.g;case q.onnx.AttributeProto.AttributeType.FLOATS:return r.floats;case q.onnx.AttributeProto.AttributeType.INTS:return r.ints;case q.onnx.AttributeProto.AttributeType.STRINGS:return r.strings;case q.onnx.AttributeProto.AttributeType.TENSORS:return r.tensors;case q.onnx.AttributeProto.AttributeType.GRAPHS:return r.graphs;default:throw new Error(`unsupported attribute type: ${q.onnx.AttributeProto.AttributeType[r.type]}`)}}static getValueNoCheckFromOrtFormat(r){switch(r.type()){case Xt.AttributeType.FLOAT:return r.f();case Xt.AttributeType.INT:return r.i();case Xt.AttributeType.STRING:return r.s();case Xt.AttributeType.TENSOR:return r.t();case Xt.AttributeType.GRAPH:return r.g();case Xt.AttributeType.FLOATS:return r.floatsArray();case Xt.AttributeType.INTS:{let o=[];for(let i=0;i<r.intsLength();i++)o.push(r.ints(i));return o}case Xt.AttributeType.STRINGS:{let o=[];for(let i=0;i<r.stringsLength();i++)o.push(r.strings(i));return o}case Xt.AttributeType.TENSORS:{let o=[];for(let i=0;i<r.tensorsLength();i++)o.push(r.tensors(i));return o}default:throw new Error(`unsupported attribute type: ${Xt.AttributeType[r.type()]}`)}}}}),zi,Qn,Wi,me,to,Vi,Ep=O(()=>{Pp(),Pr(),zi=rr(sr()),We(),Y(),Qn=F.experimental.fbs,Wi={from:(t,r)=>new Vi(t,r)},me=class{constructor(t){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,t&&(this.type=At.tensorValueTypeFromProto(t.type.tensorType))}get from(){return this._from}get to(){return this._to}},to=class{constructor(t,r){t instanceof zi.onnx.NodeProto?(this.name=t.name,this.opType=t.opType,this.attributes=new Ur(t.attribute)):t instanceof Qn.Node&&(this.name=r??t.name(),this.opType=t.opType(),this.attributes=new Ur(At.tensorAttributesFromORTFormat(t))),this.inputs=[],this.outputs=[],this.executeNode=!0}},Vi=class{constructor(t,r){if(!t)throw new TypeError("graph is empty");this.buildGraph(t),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(t){if(t instanceof zi.onnx.GraphProto)this.buildGraphFromOnnxFormat(t);else if(t instanceof Qn.Graph)this.buildGraphFromOrtFormat(t);else throw new TypeError("Graph type is not supported.")}buildGraphFromOnnxFormat(t){let r=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let o=new Map;if(!t.input)throw new Error("missing information in graph: input");let i=[];for(let u of t.input){if(r.has(u.name))throw new Error(`duplicated input name: ${u.name}`);let n=this._allData.push(new me(u))-1;r.set(u.name,n),i.push(u.name)}if(!t.initializer)throw new Error("missing information in graph: initializer");for(let u of t.initializer){let n=r.get(u.name);if(n===void 0){let a=new me;a.type={shape:{dims:At.tensorDimsFromProto(u.dims)},tensorType:At.tensorDataTypeFromProto(u.dataType)},n=this._allData.push(a)-1,r.set(u.name,n)}this._allData[n]._from=-1,this._allData[n].tensor=bt.fromProto(u)}for(let u=0;u<this._allData.length;u++)this._allData[u].tensor||(this._allInputIndices.push(u),this._allInputNames.push(i[u]));if(!t.output)throw new Error("missing information in graph: output");for(let u of t.output){if(r.has(u.name))throw new Error(`duplicated output name: ${u.name}`);let n=this._allData.push(new me(u))-1;r.set(u.name,n),this._allOutputIndices.push(n),this._allOutputNames.push(u.name)}if(!t.node)throw new Error("missing information in graph: node");for(let u of t.node){if(!u.name)for(let a=0;;a++){let d=`unnamed_${u.opType}_${a}`;if(!o.has(d)){u.name=d;break}}if(o.has(u.name))throw new Error(`duplicated node name: ${u.name}`);let n=this._nodes.push(new to(u))-1;o.set(u.name,n)}for(let u=0;u<this._nodes.length;u++){let n=this._nodes[u],a=t.node[u];if(!a.output)throw new Error(`missing output for node: ${a.name}`);for(let d of a.output){let c=r.get(d);if(typeof c>"u"&&(c=this._allData.push(new me)-1,r.set(d,c)),n.outputs.push(c),this._allData[c]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${c}`);if(this._allData[c]._from=u,a.opType==="Constant"){if(!a.attribute||a.attribute.length!==1||!a.attribute[0].t)throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(!a.output||a.output.length!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");n.outputs.pop(),n.executeNode=!1,this._allData[c]._from=-1,this._allData[c].tensor=bt.fromProto(a.attribute[0].t)}}}for(let u=0;u<this._nodes.length;u++){let n=this._nodes[u],a=t.node[u];if(!a.input)throw new Error(`missing input for node: ${a.name}`);for(let d of a.input){let c=r.get(d);if(typeof c>"u"){if(d===""&&(a.input.length===3||a.input.length===4)&&a.opType==="Resize")continue;throw new Error(`unrecognized input '${d}' for node: ${a.name}`)}n.inputs.push(c),this._allData[c]._to.push(u)}}return!0}buildGraphFromOrtFormat(t){var u,n,a;let r=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let o=new Map,i=[];for(let d=0;d<t.inputsLength();d++){let c=t.inputs(d);if(r.has(c))throw new Error(`duplicated input name: ${c}`);for(let e=0;e<t.nodeArgsLength();e++)if(((u=t.nodeArgs(e))==null?void 0:u.name())===c){let l=new me;if(((a=(n=t.nodeArgs(e))==null?void 0:n.type())==null?void 0:a.valueType())!==Qn.TypeInfoValue.tensor_type)throw new Error("Unexpected value type for the nodeArg.");let s=t.nodeArgs(e).type().value(new Qn.TensorTypeAndShape),h=At.tensorDataTypeFromProto(s.elemType()),f=s.shape(),m=[];for(let _=0;_<f.dimLength();_++)m.push(Rt.longToNumber(f.dim(_).value().dimValue()));l.type={shape:{dims:m},tensorType:h};let v=this._allData.push(l)-1;r.set(c,v),i.push(c)}}for(let d=0;d<t.initializersLength();d++){let c=t.initializers(d),e=r.get(c.name());if(e===void 0){let l=new me,s=At.tensorDimsFromORTFormat(c),h=At.tensorDataTypeFromProto(c.dataType());l.type={shape:{dims:s},tensorType:h},e=this._allData.push(l)-1,r.set(c.name(),e)}this._allData[e]._from=-1,this._allData[e].tensor=bt.fromOrtTensor(c)}for(let d=0;d<this._allData.length;d++)this._allData[d].tensor||(this._allInputIndices.push(d),this._allInputNames.push(i[d]));for(let d=0;d<t.outputsLength();d++){let c=t.outputs(d);if(r.has(c))throw new Error(`duplicated output name: ${c}`);let e=this._allData.push(new me)-1;r.set(c,e),this._allOutputIndices.push(e),this._allOutputNames.push(c)}if(!t.nodes)throw new Error("missing information in graph: node");for(let d=0;d<t.nodesLength();d++){let c=t.nodes(d),e=c.name();if(!e)for(let s=0;e=`unnamed_${c.opType()}_${s}`,!!o.has(e);s++);if(o.has(e))throw new Error(`duplicated node name: ${e}`);let l=this._nodes.push(new to(c,e))-1;o.set(e,l)}for(let d=0;d<this._nodes.length;d++){let c=this._nodes[d],e=t.nodes(d);if(e==null)throw new Error(`No node exists at index ${d}`);if((e==null?void 0:e.outputsLength())===0)throw new Error(`missing output for node: ${e.name}`);for(let l=0;l<(e==null?void 0:e.outputsLength());l++){let s=e==null?void 0:e.outputs(l),h=r.get(s);if(typeof h>"u"&&(h=this._allData.push(new me)-1,r.set(s,h)),c.outputs.push(h),this._allData[h]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${h}`);if(this._allData[h]._from=d,e.opType()==="Constant"){if(e.attributesLength()!==1||!e.attributes(0).t())throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(e.outputsLength()!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");c.outputs.pop(),c.executeNode=!1,this._allData[h]._from=-1,this._allData[h].tensor=bt.fromOrtTensor(e.attributes(0).t())}}}for(let d=0;d<this._nodes.length;d++){let c=this._nodes[d],e=t.nodes(d);if(e.inputsLength()===0)throw new Error(`missing input for node: ${e.name}`);for(let l=0;l<e.inputsLength();l++){let s=e.inputs(l),h=r.get(s);if(typeof h>"u")throw new Error(`unrecognized input '${s}' for node: ${e.name()}`);c.inputs.push(h),this._allData[h]._to.push(d)}}}checkIsAcyclic(){let t=new Set;this._allInputIndices.forEach(i=>{this._allData[i]._to.forEach(u=>{t.add(u)})});let r=Array.from(t),o=new Array(this._nodes.length).fill("white");for(;r.length>0;){let i=r.pop();o[i]==="gray"?o[i]="black":(r.push(i),o[i]="gray",this._nodes[i].outputs.forEach(u=>{let n=this._allData[u];if(typeof n.tensor<"u")throw new Error("node outputs should not be initialized");if(n._from!==i)throw new Error("from property of the Value object doesn't match index of Node being processed");n._to.forEach(a=>{if(o[a]==="gray")throw new Error("model graph is cyclic");o[a]==="white"&&r.push(a)})}))}}transformGraph(t){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),t&&t.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let t=0,r=new Array(this._nodes.length,0),o=0;for(let i=0;i<this._nodes.length;i++)r[i]=o,this._nodes[i].executeNode?(o!==i&&(this._nodes[o]=this._nodes[i]),o++):this._nodes[i].outputs.forEach(u=>{this._allData[u]._from=-2});this._nodes.splice(o,this._nodes.length-o);for(let i=0;i<this._allData.length;i++){let u=this._allData[i];u._from!==void 0&&u._from!==-1&&u._from!==-2&&(u._from=r[u._from]);for(let n=0;n<u._to.length;n++)if(u._to[n]>=0)u._to[n]=r[u._to[n]];else throw new Error("Trying to update a removed node")}t=0;for(let i=0;i<this._allData.length;i++){if(this._allData[i].from===-2&&this._allOutputIndices.indexOf(i+t)===-1){t++,this._allData.splice(i,1),i--;continue}if(t>0){let u=-1;this._allData[i].from!==void 0&&this._allData[i].from!==-1?(u=this._nodes[this._allData[i].from].outputs.indexOf(i+t),u!==-1&&(this._nodes[this._allData[i].from].outputs[u]=i)):(u=this._allInputIndices.indexOf(i+t),u!==-1&&(this._allInputIndices[u]=i)),this._allData[i].to.forEach(n=>{u=this._nodes[n].inputs.indexOf(i+t),u!==-1&&(this._nodes[n].inputs[u]=i)}),this._allData[i].to.length===0&&(u=this._allOutputIndices.indexOf(i+t),u!==-1&&(this._allOutputIndices[u]=i))}}}deleteNode(t){let r=this._nodes[t];if(r.outputs.length>1){for(let a=1;a<r.outputs.length;a++)if(this._allData[r.outputs[a]].to.length>0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}r.executeNode=!1;let o=r.inputs[0],i=r.outputs[0],u=this._allData[i].to;for(let a=0;a<r.inputs.length;a++){let d=this._allData[r.inputs[a]].to.indexOf(t);if(d===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[r.inputs[a]].to.splice(d,1)}this._allData[i]._to=[];let n=this._allOutputIndices.indexOf(i);if(n!==-1&&(this._allOutputIndices[n]=o),u&&u.length>0)for(let a of u){let d=this._nodes[a].inputs.indexOf(i);if(d===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[a].inputs[d]=o,this._allData[o].to.push(a)}}removeAllDropoutNodes(){let t=0;for(let 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(t)}t++}}removeAllIdentityNodes(){let t=0;for(let r of this._nodes)r.opType==="Identity"&&this.deleteNode(t),t++}isActivation(t){switch(t.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(let t of this._nodes)if(t.opType==="Conv"){let r=this._allData[t.outputs[0]]._to;if(r.length===1&&this.isActivation(this._nodes[r[0]])){let o=this._nodes[r[0]];if(o.opType==="Clip")if(o.inputs.length===1)try{t.attributes.set("activation_params","floats",[o.attributes.getFloat("min"),o.attributes.getFloat("max")])}catch{t.attributes.set("activation_params","floats",[Ve,ze])}else if(o.inputs.length>=3&&this._allData[o.inputs[1]].tensor!==void 0&&this._allData[o.inputs[2]].tensor!==void 0)t.attributes.set("activation_params","floats",[this._allData[o.inputs[1]].tensor.floatData[0],this._allData[o.inputs[2]].tensor.floatData[0]]);else continue;t.attributes.set("activation","string",o.opType),this.deleteNode(r[0])}}}}}),Dp,vg,eo,Lp=O(()=>{wn(),Ep(),Pr(),Dp=rr(sr()),Y(),vg=F.experimental.fbs,eo=class{constructor(){}load(t,r,o){let i;if(!o)try{this.loadFromOnnxFormat(t,r);return}catch(u){if(o!==void 0)throw u;i=u}try{this.loadFromOrtFormat(t,r)}catch(u){throw o!==void 0?u:new Error(`Failed to load model as ONNX format: ${i}
|
|
1806
|
-
as ORT format: ${u}`)}}loadFromOnnxFormat(t,r){let o=Dp.onnx.ModelProto.decode(t);if(Rt.longToNumber(o.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=o.opsetImport.map(i=>({domain:i.domain,version:Rt.longToNumber(i.version)})),this._graph=Wi.from(o.graph,r)}loadFromOrtFormat(t,r){let o=new w.ByteBuffer(t),i=vg.InferenceSession.getRootAsInferenceSession(o).model();if(Rt.longToNumber(i.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let u=0;u<i.opsetImportLength();u++){let n=i.opsetImport(u);this._opsets.push({domain:n==null?void 0:n.domain(),version:Rt.longToNumber(n.version())})}this._graph=Wi.from(i.graph(),r)}get graph(){return this._graph}get opsets(){return this._opsets}}}),ro,$p=O(()=>{Sp(),Ap(),Ut(),Lp(),ro=class{constructor(t={}){this._initialized=!1,this.backendHint=t.backendHint,this.profiler=xn.create(t.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(t,r,o){await this.profiler.event("session","Session.loadModel",async()=>{let i=await Mi(this.backendHint);if(this.sessionHandler=i.createSessionHandler(this.context),this._model=new eo,typeof t=="string"){let u=t.endsWith(".ort");{let n=await(await fetch(t)).arrayBuffer();this.initialize(new Uint8Array(n),u)}}else if(ArrayBuffer.isView(t))this.initialize(t);else{let u=new Uint8Array(t,r||0,o||t.byteLength);this.initialize(u)}})}initialize(t,r){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{let o=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(t,o,r),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new Zn(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(t){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{let r=this.normalizeAndValidateInputs(t),o=await this._executionPlan.execute(this.sessionHandler,r);return this.createOutput(o)})}normalizeAndValidateInputs(t){let r=this._model.graph.getInputNames();if(Array.isArray(t)){if(t.length!==r.length)throw new Error(`incorrect input array length: expected ${r.length} but got ${t.length}`)}else{if(t.size!==r.length)throw new Error(`incorrect input map size: expected ${r.length} but got ${t.size}`);let o=new Array(t.size),i=0;for(let u=0;u<r.length;++u){let n=t.get(r[u]);if(!n)throw new Error(`missing input tensor for: '${name}'`);o[i++]=n}t=o}if(!this.context.graphInputTypes||this.context.graphInputTypes.length===0||!this.context.graphInputDims||this.context.graphInputDims.length===0){let o=this._model.graph.getInputIndices(),i=this._model.graph.getValues(),u=new Array(o.length);for(let n=0;n<o.length;++n){let a=i[o[n]];u[n]=a.type.shape.dims,this.context.graphInputTypes.push(a.type.tensorType),this.context.graphInputDims.push(t[n].dims)}this.validateInputTensorDims(u,t,!0)}else this.validateInputTensorDims(this.context.graphInputDims,t,!1);return this.validateInputTensorTypes(this.context.graphInputTypes,t),t}validateInputTensorTypes(t,r){for(let o=0;o<r.length;o++){let i=t[o],u=r[o].type;if(i!==u)throw new Error(`input tensor[${o}] check failed: expected type '${i}' but got ${u}`)}}validateInputTensorDims(t,r,o){for(let i=0;i<r.length;i++){let u=t[i],n=r[i].dims;if(!this.compareTensorDims(u,n,o))throw new Error(`input tensor[${i}] check failed: expected shape '[${u.join(",")}]' but got [${n.join(",")}]`)}}compareTensorDims(t,r,o){if(t.length!==r.length)return!1;for(let i=0;i<t.length;++i)if(t[i]!==r[i]&&(!o||t[i]!==0))return!1;return!0}createOutput(t){let r=this._model.graph.getOutputNames();if(t.length!==r.length)throw new Error("expected number of outputs do not match number of generated outputs");let o=new Map;for(let i=0;i<r.length;++i)o.set(r[i],t[i]);return o}initializeOps(t){let r=t.getNodes();this._ops=new Array(r.length);for(let o=0;o<r.length;o++)this._ops[o]=this.sessionHandler.resolve(r[o],this._model.opsets,t)}}}),no,kp=O(()=>{Yt(),We(),no=class{constructor(t){this.session=t,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(t,r,o){let i=new Map;for(let a in t)if(Object.hasOwnProperty.call(t,a)){let d=t[a];i.set(a,new bt(d.dims,d.type,void 0,void 0,d.data))}let u=await this.session.run(i),n={};return u.forEach((a,d)=>{n[d]=new yt(a.type,a.data,a.dims)}),n}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}}),Bp={};Or(Bp,{onnxjsBackend:()=>Ig});var Hi,Ig,Fp=O(()=>{$p(),kp(),Hi=class{async init(){}async createInferenceSessionHandler(t,r){let o=new ro(r);return typeof t=="string"?await o.loadModel(t):await o.loadModel(t),new no(o)}},Ig=new Hi}),oo=O(()=>{}),Rp={};Or(Rp,{default:()=>_g});var Cp,Np,_g,Gp=O(()=>{var t;qi(),Ke(),Vr(),Cp="ort-wasm-proxy-worker",Np=((t=globalThis.self)==null?void 0:t.name)===Cp,Np&&(self.onmessage=r=>{let{type:o,in:i}=r.data;try{switch(o){case"init-wasm":io(i.wasm).then(()=>{ao(i).then(()=>{postMessage({type:o})},u=>{postMessage({type:o,err:u})})},u=>{postMessage({type:o,err:u})});break;case"init-ep":{let{epName:u,env:n}=i;so(n,u).then(()=>{postMessage({type:o})},a=>{postMessage({type:o,err:a})});break}case"copy-from":{let{buffer:u}=i,n=zr(u);postMessage({type:o,out:n});break}case"create":{let{model:u,options:n}=i;uo(u,n).then(a=>{postMessage({type:o,out:a})},a=>{postMessage({type:o,err:a})});break}case"release":lo(i),postMessage({type:o});break;case"run":{let{sessionId:u,inputIndices:n,inputs:a,outputIndices:d,options:c}=i;fo(u,n,a,d,new Array(d.length).fill(null),c).then(e=>{e.some(l=>l[3]!=="cpu")?postMessage({type:o,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:o,out:e},po([...a,...e]))},e=>{postMessage({type:o,err:e})});break}case"end-profiling":co(i),postMessage({type:o});break;default:}}catch(u){postMessage({type:o,err:u})}}),_g=Np?null:r=>new Worker(r??br,{type:"module",name:Cp})}),Up={};Or(Up,{default:()=>Og});var ji,Mp,Og,Vp=O(()=>{var t;Mp=(ji=_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("segmentation.js",document.baseURI).href,async function(r={}){function o(){return wt.buffer!=vt.buffer&&st(),vt}function i(){return wt.buffer!=vt.buffer&&st(),K}function u(){return wt.buffer!=vt.buffer&&st(),Jt}function n(){return wt.buffer!=vt.buffer&&st(),Re}function a(){return wt.buffer!=vt.buffer&&st(),le}var d,c,e=Object.assign({},r),l=new Promise((g,y)=>{d=g,c=y}),s=typeof window=="object",h=typeof importScripts=="function",f=h&&self.name=="em-pthread";e.mountExternalData=(g,y)=>{g.startsWith("./")&&(g=g.substring(2)),(e.Ua||(e.Ua=new Map)).set(g,y)},e.unmountExternalData=()=>{delete e.Ua};var m,v,_=globalThis.SharedArrayBuffer??new WebAssembly.Memory({initial:0,maximum:0,shared:!0}).buffer.constructor,I=Object.assign({},e),T="./this.program",P=(g,y)=>{throw y},C="";(s||h)&&(h?C=self.location.href:typeof document<"u"&&document.currentScript&&(C=document.currentScript.src),ji&&(C=ji),C=C.startsWith("blob:")?"":C.substr(0,C.replace(/[?#].*/,"").lastIndexOf("/")+1),h&&(v=g=>{var y=new XMLHttpRequest;return y.open("GET",g,!1),y.responseType="arraybuffer",y.send(null),new Uint8Array(y.response)}),m=(g,y,x)=>{var S=new XMLHttpRequest;S.open("GET",g,!0),S.responseType="arraybuffer",S.onload=()=>{S.status==200||S.status==0&&S.response?y(S.response):x()},S.onerror=x,S.send(null)});var V,gt=console.log.bind(console),pt=console.error.bind(console),Ft=gt,et=pt;if(Object.assign(e,I),I=null,f){let g=function(y){try{var x=y.data,S=x.cmd;if(S==="load"){let E=[];self.onmessage=N=>E.push(N),self.startWorker=()=>{postMessage({cmd:"loaded"});for(let N of E)g(N);self.onmessage=g};for(let N of x.handlers)e[N]&&!e[N].proxy||(e[N]=(...L)=>{postMessage({Za:"callHandler",kb:N,args:L})},N=="print"&&(Ft=e[N]),N=="printErr"&&(et=e[N]));wt=x.wasmMemory,st(),$t(x.wasmModule)}else if(S==="run"){Qr(x.pthread_ptr,0,0,1,0,0),Lr(x.pthread_ptr),$a(),So(),De||(De=!0);try{Aa(x.start_routine,x.arg)}catch(E){if(E!="unwind")throw E}}else S==="cancel"?ce()&&gr(-1):x.target!=="setimmediate"&&(S==="checkMailbox"?De&&tr():S&&(et(`worker: received unknown command ${S}`),et(x)))}catch(E){throw ba(),E}};var $t,De=!1;et=function(...y){y=y.join(" "),console.error(y)},self.alert=function(...y){postMessage({Za:"alert",text:y.join(" "),nb:ce()})},e.instantiateWasm=(y,x)=>new Promise(S=>{$t=E=>{E=new WebAssembly.Instance(E,vn()),x(E),S()}}),self.onunhandledrejection=y=>{throw y.reason||y},self.onmessage=g}e.wasmBinary&&(V=e.wasmBinary);var wt,Le,Lt,vt,K,Jt,Re,Ot,le,at=!1;function st(){var g=wt.buffer;e.HEAP8=vt=new Int8Array(g),e.HEAP16=new Int16Array(g),e.HEAPU8=K=new Uint8Array(g),e.HEAPU16=new Uint16Array(g),e.HEAP32=Jt=new Int32Array(g),e.HEAPU32=Re=new Uint32Array(g),e.HEAPF32=new Float32Array(g),e.HEAPF64=le=new Float64Array(g),e.HEAP64=Ot=new BigInt64Array(g),e.HEAPU64=new BigUint64Array(g)}if(!f){if(!((wt=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0})).buffer instanceof _))throw et("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"),Error("bad memory");st()}var oe=[],te=[],Ge=[],ie=0,Pt=null;function Dt(){if(--ie==0&&Pt){var g=Pt;Pt=null,g()}}function Mt(g){throw et(g="Aborted("+g+")"),at=!0,Lt=1,g=new WebAssembly.RuntimeError(g+". Build with -sASSERTIONS for more info."),c(g),g}var it,lt=g=>g.startsWith("data:application/octet-stream;base64,"),Wt=g=>g.startsWith("file://");function fe(g){if(g==it&&V)return new Uint8Array(V);if(v)return v(g);throw"both async and sync fetching of the wasm failed"}function Ye(g,y,x){return function(S){if(!V&&(s||h)){if(typeof fetch=="function"&&!Wt(S))return fetch(S,{credentials:"same-origin"}).then(E=>{if(!E.ok)throw`failed to load wasm binary file at '${S}'`;return E.arrayBuffer()}).catch(()=>fe(S));if(m)return new Promise((E,N)=>{m(S,L=>E(new Uint8Array(L)),N)})}return Promise.resolve().then(()=>fe(S))}(g).then(S=>WebAssembly.instantiate(S,y)).then(x,S=>{et(`failed to asynchronously prepare wasm: ${S}`),Mt(S)})}function vn(){return{a:{j:Pa,b:ka,E:Ao,g:Fo,V:Lo,A:zo,C:Xo,W:Ko,T:Jo,L:Yo,S:Zo,o:Qo,B:ti,y:ri,U:ni,z:ii,_:Na,Z:Fa,P:Ca,w:La,F:Ra,k:ja,O:Lr,Y:Ba,I:Va,J:za,K:Ma,G:na,H:oa,v:Ua,q:Ga,l:Ha,p:qa,e:Wa,X:Xa,x:Ka,d:ia,f:Ja,i:Ya,u:Za,t:qs,s:Xs,Q:la,R:ua,D:Dr,h:pa,n:da,M:ca,m:ha,a:wt,r:Ir,N:ma,c:Zs}}}var _n={837620:(g,y,x,S,E)=>{if(e===void 0||!e.Ua)return 1;if((g=be(g>>>0)).startsWith("./")&&(g=g.substring(2)),!(g=e.Ua.get(g)))return 2;if(S>>>=0,(y>>>=0)+(x>>>=0)>g.byteLength)return 3;try{let N=g.subarray(y,y+x);switch(E){case 0:i().set(N,S>>>0);break;case 1:e.mb(S,N);break;default:return 4}return 0}catch{return 4}},838303:()=>typeof wasmOffsetConverter<"u"};function Pa(){return typeof wasmOffsetConverter<"u"}function _r(g){this.name="ExitStatus",this.message=`Program terminated with exit(${g})`,this.status=g}var Er=g=>{g.terminate(),g.onmessage=()=>{}},On=g=>{ee.length==0&&(Io(),Eo(ee[0]));var y=ee.pop();if(!y)return 6;ae.push(y),Nt[g.Ra]=y,y.Ra=g.Ra;var x={cmd:"run",start_routine:g.cb,arg:g.ab,pthread_ptr:g.Ra};return y.postMessage(x,g.ib),0},ge=0,Q=(g,y,...x)=>{for(var S=2*x.length,E=rn(),N=en(8*S),L=N>>>3,Z=0;Z<x.length;Z++){var ct=x[Z];typeof ct=="bigint"?(Ot[L+2*Z]=1n,Ot[L+2*Z+1]=ct):(Ot[L+2*Z]=0n,a()[L+2*Z+1>>>0]=ct)}return g=ya(g,0,S,N,y),wr(E),g};function Ir(g){if(f)return Q(0,1,g);if(Lt=g,!(0<ge)){for(var y of ae)Er(y);for(y of ee)Er(y);ee=[],ae=[],Nt=[],at=!0}P(g,new _r(g))}function In(g){if(f)return Q(1,0,g);Dr(g)}var Dr=g=>{if(Lt=g,f)throw In(g),"unwind";Ir(g)},ee=[],ae=[],_o=[],Nt={},Oo=g=>{var y=g.Ra;delete Nt[y],ee.push(g),ae.splice(ae.indexOf(g),1),g.Ra=0,tn(y)};function So(){_o.forEach(g=>g())}var Eo=g=>new Promise(y=>{g.onmessage=E=>{var N=(E=E.data).cmd;if(E.targetThread&&E.targetThread!=ce()){var L=Nt[E.targetThread];L?L.postMessage(E,E.transferList):et(`Internal error! Worker sent a message "${N}" to target pthread ${E.targetThread}, but that thread no longer exists!`)}else N==="checkMailbox"?tr():N==="spawnThread"?On(E):N==="cleanupThread"?Oo(Nt[E.thread]):N==="killThread"?(E=E.thread,N=Nt[E],delete Nt[E],Er(N),tn(E),ae.splice(ae.indexOf(N),1),N.Ra=0):N==="cancelThread"?Nt[E.thread].postMessage({cmd:"cancel"}):N==="loaded"?(g.loaded=!0,y(g)):N==="alert"?alert(`Thread ${E.threadId}: ${E.text}`):E.target==="setimmediate"?g.postMessage(E):N==="callHandler"?e[E.handler](...E.args):N&&et(`worker sent an unknown command ${N}`)},g.onerror=E=>{throw et(`worker sent an error! ${E.filename}:${E.lineno}: ${E.message}`),E};var x,S=[];for(x of[])e.hasOwnProperty(x)&&S.push(x);g.postMessage({cmd:"load",handlers:S,wasmMemory:wt,wasmModule:Le})});function Io(){var g=new Worker(new URL(_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("segmentation.js",document.baseURI).href),{type:"module",workerData:"em-pthread",name:"em-pthread"});ee.push(g)}var Po,Ze=g=>{for(;0<g.length;)g.shift()(e)},$a=()=>{var g=ce(),y=n()[g+52>>>2>>>0];g=n()[g+56>>>2>>>0],va(y,y-g),wr(y)},Qe=[],Aa=(g,y)=>{ge=0;var x=Qe[g];x||(g>=Qe.length&&(Qe.length=g+1),Qe[g]=x=Po.get(g)),g=x(y),0<ge?Lt=g:gr(g)};class Da{constructor(y){this.Xa=y-24}}function ka(g,y,x){var S=new Da(g>>>=0);throw y>>>=0,x>>>=0,n()[S.Xa+16>>>2>>>0]=0,n()[S.Xa+4>>>2>>>0]=y,n()[S.Xa+8>>>2>>>0]=x,g}function $o(g,y,x,S){return f?Q(2,1,g,y,x,S):Ao(g,y,x,S)}function Ao(g,y,x,S){if(g>>>=0,y>>>=0,x>>>=0,S>>>=0,_===void 0)return et("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var E=[];return f&&E.length===0?$o(g,y,x,S):(g={cb:x,Ra:g,ab:S,ib:E},f?(g.Za="spawnThread",postMessage(g,E),0):On(g))}var Do=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ko=(g,y,x)=>{var S=(y>>>=0)+x;for(x=y;g[x]&&!(x>=S);)++x;if(16<x-y&&g.buffer&&Do)return Do.decode(g.buffer instanceof _?g.slice(y,x):g.subarray(y,x));for(S="";y<x;){var E=g[y++];if(128&E){var N=63&g[y++];if((224&E)==192)S+=String.fromCharCode((31&E)<<6|N);else{var L=63&g[y++];65536>(E=(240&E)==224?(15&E)<<12|N<<6|L:(7&E)<<18|N<<12|L<<6|63&g[y++])?S+=String.fromCharCode(E):(E-=65536,S+=String.fromCharCode(55296|E>>10,56320|1023&E))}}else S+=String.fromCharCode(E)}return S},be=(g,y)=>(g>>>=0)?ko(i(),g,y):"";function Fo(g,y,x){return f?Q(3,1,g,y,x):0}function Lo(g,y){if(f)return Q(4,1,g,y)}var jo=g=>{for(var y=0,x=0;x<g.length;++x){var S=g.charCodeAt(x);127>=S?y++:2047>=S?y+=2:55296<=S&&57343>=S?(y+=4,++x):y+=3}return y},Bo=(g,y,x,S)=>{if(!(0<S))return 0;var E=x>>>=0;S=x+S-1;for(var N=0;N<g.length;++N){var L=g.charCodeAt(N);if(55296<=L&&57343>=L&&(L=65536+((1023&L)<<10)|1023&g.charCodeAt(++N)),127>=L){if(x>=S)break;y[x++>>>0]=L}else{if(2047>=L){if(x+1>=S)break;y[x++>>>0]=192|L>>6}else{if(65535>=L){if(x+2>=S)break;y[x++>>>0]=224|L>>12}else{if(x+3>=S)break;y[x++>>>0]=240|L>>18,y[x++>>>0]=128|L>>12&63}y[x++>>>0]=128|L>>6&63}y[x++>>>0]=128|63&L}}return y[x>>>0]=0,x-E},we=(g,y,x)=>Bo(g,i(),y,x);function zo(g,y){if(f)return Q(5,1,g,y)}function Xo(g,y,x){if(f)return Q(6,1,g,y,x)}function Ko(g,y,x){return f?Q(7,1,g,y,x):0}function Jo(g,y){if(f)return Q(8,1,g,y)}function Yo(g,y,x){if(f)return Q(9,1,g,y,x)}function Zo(g,y,x,S){if(f)return Q(10,1,g,y,x,S)}function Qo(g,y,x,S){if(f)return Q(11,1,g,y,x,S)}function ti(g,y,x,S){if(f)return Q(12,1,g,y,x,S)}function ri(g){if(f)return Q(13,1,g)}function ni(g,y){if(f)return Q(14,1,g,y)}function ii(g,y,x){if(f)return Q(15,1,g,y,x)}var Na=()=>{Mt("")},Fa=()=>1;function Ca(g){Qr(g>>>0,!h,1,!s,131072,!1),So()}function Lr(g){g>>>=0,typeof Atomics.jb=="function"&&(Atomics.jb(u(),g>>>2,g).value.then(tr),g+=128,Atomics.store(u(),g>>>2,1))}var tr=()=>{var g=ce();if(g&&(Lr(g),g=wa,!at))try{if(g(),!(0<ge))try{f?gr(Lt):Dr(Lt)}catch(y){y instanceof _r||y=="unwind"||P(1,y)}}catch(y){y instanceof _r||y=="unwind"||P(1,y)}};function La(g,y){(g>>>=0)==y>>>0?setTimeout(tr):f?postMessage({targetThread:g,cmd:"checkMailbox"}):(g=Nt[g])&&g.postMessage({cmd:"checkMailbox"})}var Kr=[];function Ra(g,y,x,S,E){for(y>>>=0,S/=2,Kr.length=S,x=E>>>0>>>3,E=0;E<S;E++)Kr[E]=Ot[x+2*E]?Ot[x+2*E+1]:a()[x+2*E+1>>>0];return(y?_n[y]:fl[g])(...Kr)}function ja(g){g>>>=0,f?postMessage({cmd:"cleanupThread",thread:g}):Oo(Nt[g])}function Ba(g){}function Va(g,y){g=-9007199254740992>g||9007199254740992<g?NaN:Number(g),y>>>=0,g=new Date(1e3*g),u()[y>>>2>>>0]=g.getUTCSeconds(),u()[y+4>>>2>>>0]=g.getUTCMinutes(),u()[y+8>>>2>>>0]=g.getUTCHours(),u()[y+12>>>2>>>0]=g.getUTCDate(),u()[y+16>>>2>>>0]=g.getUTCMonth(),u()[y+20>>>2>>>0]=g.getUTCFullYear()-1900,u()[y+24>>>2>>>0]=g.getUTCDay(),g=(g.getTime()-Date.UTC(g.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,u()[y+28>>>2>>>0]=g}var ue=g=>g%4==0&&(g%100!=0||g%400==0),ea=[0,31,60,91,121,152,182,213,244,274,305,335],ra=[0,31,59,90,120,151,181,212,243,273,304,334];function za(g,y){g=-9007199254740992>g||9007199254740992<g?NaN:Number(g),y>>>=0,g=new Date(1e3*g),u()[y>>>2>>>0]=g.getSeconds(),u()[y+4>>>2>>>0]=g.getMinutes(),u()[y+8>>>2>>>0]=g.getHours(),u()[y+12>>>2>>>0]=g.getDate(),u()[y+16>>>2>>>0]=g.getMonth(),u()[y+20>>>2>>>0]=g.getFullYear()-1900,u()[y+24>>>2>>>0]=g.getDay();var x=(ue(g.getFullYear())?ea:ra)[g.getMonth()]+g.getDate()-1|0;u()[y+28>>>2>>>0]=x,u()[y+36>>>2>>>0]=-60*g.getTimezoneOffset(),x=new Date(g.getFullYear(),6,1).getTimezoneOffset();var S=new Date(g.getFullYear(),0,1).getTimezoneOffset();g=0|(x!=S&&g.getTimezoneOffset()==Math.min(S,x)),u()[y+32>>>2>>>0]=g}function Ma(g){g>>>=0;var y=new Date(u()[g+20>>>2>>>0]+1900,u()[g+16>>>2>>>0],u()[g+12>>>2>>>0],u()[g+8>>>2>>>0],u()[g+4>>>2>>>0],u()[g>>>2>>>0],0),x=u()[g+32>>>2>>>0],S=y.getTimezoneOffset(),E=new Date(y.getFullYear(),6,1).getTimezoneOffset(),N=new Date(y.getFullYear(),0,1).getTimezoneOffset(),L=Math.min(N,E);return 0>x?u()[g+32>>>2>>>0]=+(E!=N&&L==S):0<x!=(L==S)&&(E=Math.max(N,E),y.setTime(y.getTime()+6e4*((0<x?L:E)-S))),u()[g+24>>>2>>>0]=y.getDay(),x=(ue(y.getFullYear())?ea:ra)[y.getMonth()]+y.getDate()-1|0,u()[g+28>>>2>>>0]=x,u()[g>>>2>>>0]=y.getSeconds(),u()[g+4>>>2>>>0]=y.getMinutes(),u()[g+8>>>2>>>0]=y.getHours(),u()[g+12>>>2>>>0]=y.getDate(),u()[g+16>>>2>>>0]=y.getMonth(),u()[g+20>>>2>>>0]=y.getYear(),g=y.getTime(),BigInt(isNaN(g)?-1:g/1e3)}function na(g,y,x,S,E,N,L){return f?Q(16,1,g,y,x,S,E,N,L):-52}function oa(g,y,x,S,E,N){if(f)return Q(17,1,g,y,x,S,E,N)}function Ua(g,y,x,S){g>>>=0,y>>>=0,x>>>=0,S>>>=0;var E=new Date().getFullYear(),N=new Date(E,0,1),L=new Date(E,6,1);E=N.getTimezoneOffset();var Z=L.getTimezoneOffset(),ct=Math.max(E,Z);n()[g>>>2>>>0]=60*ct,u()[y>>>2>>>0]=+(E!=Z),N=(g=ft=>ft.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1])(N),L=g(L),Z<E?(we(N,x,17),we(L,S,17)):(we(N,S,17),we(L,x,17))}var Jr=[];function Ga(g,y,x){g>>>=0,y>>>=0,x>>>=0,Jr.length=0;for(var S;S=i()[y++>>>0];){var E=S!=105;x+=(E&=S!=112)&&x%8?4:0,Jr.push(S==112?n()[x>>>2>>>0]:S==106?Ot[x>>>3]:S==105?u()[x>>>2>>>0]:a()[x>>>3>>>0]),x+=E?8:4}return _n[g](...Jr)}var Ha=()=>{},qa=()=>Date.now();function Wa(g,y){return et(be(g>>>0,y>>>0))}var ia,Xa=()=>{throw ge+=1,"unwind"};function Ka(){return 4294901760}ia=()=>performance.timeOrigin+performance.now();var Ja=()=>navigator.hardwareConcurrency;function Ya(){return Mt("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER"),0}function Za(g){g>>>=0;var y=i().length;if(g<=y||4294901760<g)return!1;for(var x=1;4>=x;x*=2){var S=y*(1+.2/x);S=Math.min(S,g+100663296);var E=Math;S=Math.max(g,S);t:{E=(E.min.call(E,4294901760,S+(65536-S%65536)%65536)-wt.buffer.byteLength+65535)/65536;try{wt.grow(E),st();var N=1;break t}catch{}N=void 0}if(N)return!0}return!1}var er=()=>(Mt("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER"),0),ve={},aa=g=>{g.forEach(y=>{er()})};function qs(){var g=Error().stack.toString().split(`
|
|
1807
|
-
`);return g[0]=="Error"&&g.shift(),
|
|
1808
|
-
`))[0]=="Error"&&S.shift(),
|
|
1809
|
-
`,"%p":$=>0<=$.Va&&12>$.Va?"AM":"PM","%S":$=>N($.gb,2),"%t":()=>" ","%u":$=>$.Qa||7,"%U":$=>N(Math.floor(($.Sa+7-$.Qa)/7),2),"%V":$=>{var X=Math.floor(($.Sa+7-($.Qa+6)%7)/7);if(2>=($.Qa+371-$.Sa-2)%7&&X++,X)X==53&&((nt=($.Qa+371-$.Sa)%7)==4||nt==3&&ue($.Ta)||(X=1));else{X=52;var nt=($.Qa+7-$.Sa-1)%7;(nt==4||nt==5&&ue($.Ta%400-1))&&X++}return N(X,2)},"%w":$=>$.Qa,"%W":$=>N(Math.floor(($.Sa+7-($.Qa+6)%7)/7),2),"%y":$=>($.Ta+1900).toString().substring(2),"%Y":$=>$.Ta+1900,"%z":$=>{var X=0<=($=$.eb);return $=Math.abs($)/60,(X?"+":"-")+("0000"+($/60*100+$%60)).slice(-4)},"%Z":$=>$.hb,"%%":()=>"%"},x=x.replace(/%%/g,"\0\0"),ft)x.includes(_t)&&(x=x.replace(new RegExp(_t,"g"),ft[_t](S)));return _t=function($){var X=Array(jo($)+1);return Bo($,X,0,X.length),X}(x=x.replace(/\0\0/g,"%")),_t.length>y?0:(Js(_t,g),_t.length-1)}function Zs(g,y,x,S){return ma(g>>>0,y>>>0,x>>>0,S>>>0)}f||function(){for(var g=e.numThreads-1;g--;)Io();oe.unshift(()=>{ie++,function(y){f?y():Promise.all(ee.map(Eo)).then(y)}(()=>Dt())})}();var fl=[Ir,In,$o,Fo,Lo,zo,Xo,Ko,Jo,Yo,Zo,Qo,ti,ri,ni,ii,na,oa,la,ua,pa,da,ca,ha],M=function(){function g(x,S){return M=x.exports,M=function(){var E=M,N=Z=>()=>Z()>>>0,L=Z=>ct=>Z(ct)>>>0;return(E=Object.assign({},E)).Ba=N(E.Ba),E.Ca=L(E.Ca),E.emscripten_main_runtime_thread_id=N(E.emscripten_main_runtime_thread_id),E.Oa=L(E.Oa),E.Pa=N(E.Pa),E}(),_o.push(M.Ea),Po=M.Fa,te.unshift(M.$),Le=S,Dt(),M}var y=vn();if(ie++,e.instantiateWasm)try{return e.instantiateWasm(y,g)}catch(x){et(`Module.instantiateWasm callback failed with error: ${x}`),c(x)}return it||(it=e.locateFile?lt("ort-wasm-simd-threaded.wasm")?"ort-wasm-simd-threaded.wasm":e.locateFile?e.locateFile("ort-wasm-simd-threaded.wasm",C):C+"ort-wasm-simd-threaded.wasm":""),function(x,S){var E=it;return V||typeof WebAssembly.instantiateStreaming!="function"||lt(E)||Wt(E)||typeof fetch!="function"?Ye(E,x,S):fetch(E,{credentials:"same-origin"}).then(N=>WebAssembly.instantiateStreaming(N,x).then(S,function(L){return et(`wasm streaming compile failed: ${L}`),et("falling back to ArrayBuffer instantiation"),Ye(E,x,S)}))}(y,function(x){g(x.instance,x.module)}).catch(c),{}}();e._OrtInit=(g,y)=>(e._OrtInit=M.aa)(g,y),e._OrtGetLastError=(g,y)=>(e._OrtGetLastError=M.ba)(g,y),e._OrtCreateSessionOptions=(g,y,x,S,E,N,L,Z,ct,ft)=>(e._OrtCreateSessionOptions=M.ca)(g,y,x,S,E,N,L,Z,ct,ft),e._OrtAppendExecutionProvider=(g,y)=>(e._OrtAppendExecutionProvider=M.da)(g,y),e._OrtAddFreeDimensionOverride=(g,y,x)=>(e._OrtAddFreeDimensionOverride=M.ea)(g,y,x),e._OrtAddSessionConfigEntry=(g,y,x)=>(e._OrtAddSessionConfigEntry=M.fa)(g,y,x),e._OrtReleaseSessionOptions=g=>(e._OrtReleaseSessionOptions=M.ga)(g),e._OrtCreateSession=(g,y,x)=>(e._OrtCreateSession=M.ha)(g,y,x),e._OrtReleaseSession=g=>(e._OrtReleaseSession=M.ia)(g),e._OrtGetInputOutputCount=(g,y,x)=>(e._OrtGetInputOutputCount=M.ja)(g,y,x),e._OrtGetInputName=(g,y)=>(e._OrtGetInputName=M.ka)(g,y),e._OrtGetOutputName=(g,y)=>(e._OrtGetOutputName=M.la)(g,y),e._OrtFree=g=>(e._OrtFree=M.ma)(g),e._OrtCreateTensor=(g,y,x,S,E,N)=>(e._OrtCreateTensor=M.na)(g,y,x,S,E,N),e._OrtGetTensorData=(g,y,x,S,E)=>(e._OrtGetTensorData=M.oa)(g,y,x,S,E),e._OrtReleaseTensor=g=>(e._OrtReleaseTensor=M.pa)(g),e._OrtCreateRunOptions=(g,y,x,S)=>(e._OrtCreateRunOptions=M.qa)(g,y,x,S),e._OrtAddRunConfigEntry=(g,y,x)=>(e._OrtAddRunConfigEntry=M.ra)(g,y,x),e._OrtReleaseRunOptions=g=>(e._OrtReleaseRunOptions=M.sa)(g),e._OrtCreateBinding=g=>(e._OrtCreateBinding=M.ta)(g),e._OrtBindInput=(g,y,x)=>(e._OrtBindInput=M.ua)(g,y,x),e._OrtBindOutput=(g,y,x,S)=>(e._OrtBindOutput=M.va)(g,y,x,S),e._OrtClearBoundOutputs=g=>(e._OrtClearBoundOutputs=M.wa)(g),e._OrtReleaseBinding=g=>(e._OrtReleaseBinding=M.xa)(g),e._OrtRunWithBinding=(g,y,x,S,E)=>(e._OrtRunWithBinding=M.ya)(g,y,x,S,E),e._OrtRun=(g,y,x,S,E,N,L,Z)=>(e._OrtRun=M.za)(g,y,x,S,E,N,L,Z),e._OrtEndProfiling=g=>(e._OrtEndProfiling=M.Aa)(g);var ce=()=>(ce=M.Ba)();e._malloc=g=>(e._malloc=M.Ca)(g),e._free=g=>(e._free=M.Da)(g);var ar,Qr=(g,y,x,S,E,N)=>(Qr=M.Ga)(g,y,x,S,E,N),ba=()=>(ba=M.Ha)(),ya=(g,y,x,S,E)=>(ya=M.Ia)(g,y,x,S,E),tn=g=>(tn=M.Ja)(g),gr=g=>(gr=M.Ka)(g),wa=()=>(wa=M.La)(),va=(g,y)=>(va=M.Ma)(g,y),wr=g=>(wr=M.Na)(g),en=g=>(en=M.Oa)(g),rn=()=>(rn=M.Pa)();function xa(){0<ie||(f?(d(e),f||Ze(te),startWorker(e)):(Ze(oe),0<ie||ar||(ar=!0,e.calledRun=!0,at||(f||Ze(te),d(e),f||Ze(Ge)))))}return e.___start_em_js=838360,e.___stop_em_js=838421,e.stackSave=()=>rn(),e.stackRestore=g=>wr(g),e.stackAlloc=g=>en(g),e.UTF8ToString=be,e.stringToUTF8=we,e.lengthBytesUTF8=jo,Pt=function g(){ar||xa(),ar||(Pt=g)},xa(),l}),Og=Mp,((t=globalThis.self)==null?void 0:t.name)==="em-pthread"&&Mp()}),br,Sg,Ag,Pg,zp,Wp,Eg,Hp,Vr=O(()=>{var t,r;oo(),br=(_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("segmentation.js",document.baseURI).href)??(typeof document<"u"?(t=document.currentScript)==null?void 0:t.src:typeof self<"u"?(r=self.location)==null?void 0:r.href:void 0),Sg=typeof location>"u"?void 0:location.origin,Ag=(o,i)=>{try{let u=i??br;return(u?new URL(o,u):new URL(o)).origin===Sg}catch{return!1}},Pg=async o=>{let i=await(await fetch(o,{credentials:"same-origin"})).blob();return URL.createObjectURL(i)},zp=(Gp(),sn(Rp)).default,Wp=async()=>{if(!br)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(Ag(br))return[void 0,zp()];let o=await Pg(br);return[o,zp(o)]},Eg=(Vp(),sn(Up)).default,Hp=async(o,i,u)=>[void 0,Eg]}),Xi,Ki,ho,qp,Dg,Lg,io,xt,Ke=O(()=>{Vr(),Ki=!1,ho=!1,qp=!1,Dg=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},Lg=()=>{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}},io=async t=>{if(Ki)return Promise.resolve();if(ho)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(qp)throw new Error("previous call to 'initializeWebAssembly()' failed.");ho=!0;let r=t.initTimeout,o=t.numThreads;if(!Lg())throw new Error("WebAssembly SIMD is not supported in the current environment.");let i=Dg();o>1&&!i&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+o+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),t.numThreads=o=1);let u=t.wasmPaths,n=typeof u=="string"?u:void 0,a=u==null?void 0:u.mjs,d=(a==null?void 0:a.href)??a,c=u==null?void 0:u.wasm,e=(c==null?void 0:c.href)??c,l=t.wasmBinary,[s,h]=await Hp(d,n,o>1),f=!1,m=[];if(r>0&&m.push(new Promise(v=>{setTimeout(()=>{f=!0,v()},r)})),m.push(new Promise((v,_)=>{let I={numThreads:o};l?I.wasmBinary=l:(e||n)&&(I.locateFile=(T,P)=>e??(n??P)+T),h(I).then(T=>{ho=!1,Ki=!0,Xi=T,v(),s&&URL.revokeObjectURL(s)},T=>{ho=!1,qp=!0,_(T)})})),await Promise.race(m),f)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},xt=()=>{if(Ki&&Xi)return Xi;throw new Error("WebAssembly is not initialized yet.")}}),Tt,Wr,ht,mo=O(()=>{Ke(),Tt=(t,r)=>{let o=xt(),i=o.lengthBytesUTF8(t)+1,u=o._malloc(i);return o.stringToUTF8(t,u,i),r.push(u),u},Wr=(t,r,o,i)=>{if(typeof t=="object"&&t!==null){if(o.has(t))throw new Error("Circular reference in options");o.add(t)}Object.entries(t).forEach(([u,n])=>{let a=r?r+u:u;if(typeof n=="object")Wr(n,a+".",o,i);else if(typeof n=="string"||typeof n=="number")i(a,n.toString());else if(typeof n=="boolean")i(a,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},ht=t=>{let r=xt(),o=r.stackSave();try{let i=r.stackAlloc(8);r._OrtGetLastError(i,i+4);let u=r.HEAP32[i/4],n=r.HEAPU32[i/4+1],a=n?r.UTF8ToString(n):"";throw new Error(`${t} ERROR_CODE: ${u}, ERROR_MESSAGE: ${a}`)}finally{r.stackRestore(o)}}}),jp,Xp=O(()=>{Ke(),mo(),jp=t=>{let r=xt(),o=0,i=[],u=t||{};try{if((t==null?void 0:t.logSeverityLevel)===void 0)u.logSeverityLevel=2;else if(typeof t.logSeverityLevel!="number"||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if((t==null?void 0:t.logVerbosityLevel)===void 0)u.logVerbosityLevel=0;else if(typeof t.logVerbosityLevel!="number"||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);(t==null?void 0:t.terminate)===void 0&&(u.terminate=!1);let n=0;return(t==null?void 0:t.tag)!==void 0&&(n=Tt(t.tag,i)),o=r._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,n),o===0&&ht("Can't create run options."),(t==null?void 0:t.extra)!==void 0&&Wr(t.extra,"",new WeakSet,(a,d)=>{let c=Tt(a,i),e=Tt(d,i);r._OrtAddRunConfigEntry(o,c,e)!==0&&ht(`Can't set a run config entry: ${a} - ${d}.`)}),[o,i]}catch(n){throw o!==0&&r._OrtReleaseRunOptions(o),i.forEach(a=>r._free(a)),n}}}),$g,kg,Bg,Fg,Kp,Jp=O(()=>{Ke(),mo(),$g=t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}},kg=t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}},Bg=t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});let r=t.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),t.executionProviders&&t.executionProviders.some(o=>(typeof o=="string"?o:o.name)==="webgpu")&&(t.enableMemPattern=!1)},Fg=(t,r,o)=>{for(let i of r){let u=typeof i=="string"?i:i.name;switch(u){case"webnn":if(u="WEBNN",typeof i!="string"){let a=i==null?void 0:i.deviceType;if(a){let d=Tt("deviceType",o),c=Tt(a,o);xt()._OrtAddSessionConfigEntry(t,d,c)!==0&&ht(`Can't set a session config entry: 'deviceType' - ${a}.`)}}break;case"webgpu":if(u="JS",typeof i!="string"){let a=i;if(a!=null&&a.preferredLayout){if(a.preferredLayout!=="NCHW"&&a.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${a.preferredLayout}`);let d=Tt("preferredLayout",o),c=Tt(a.preferredLayout,o);xt()._OrtAddSessionConfigEntry(t,d,c)!==0&&ht(`Can't set a session config entry: 'preferredLayout' - ${a.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${u}`)}let n=Tt(u,o);xt()._OrtAppendExecutionProvider(t,n)!==0&&ht(`Can't append execution provider: ${u}.`)}},Kp=t=>{let r=xt(),o=0,i=[],u=t||{};Bg(u);try{let n=$g(u.graphOptimizationLevel??"all"),a=kg(u.executionMode??"sequential"),d=typeof u.logId=="string"?Tt(u.logId,i):0,c=u.logSeverityLevel??2;if(!Number.isInteger(c)||c<0||c>4)throw new Error(`log serverity level is not valid: ${c}`);let e=u.logVerbosityLevel??0;if(!Number.isInteger(e)||e<0||e>4)throw new Error(`log verbosity level is not valid: ${e}`);let l=typeof u.optimizedModelFilePath=="string"?Tt(u.optimizedModelFilePath,i):0;if(o=r._OrtCreateSessionOptions(n,!!u.enableCpuMemArena,!!u.enableMemPattern,a,!!u.enableProfiling,0,d,c,e,l),o===0&&ht("Can't create session options."),u.executionProviders&&Fg(o,u.executionProviders,i),u.enableGraphCapture!==void 0){if(typeof u.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${u.enableGraphCapture}`);let s=Tt("enableGraphCapture",i),h=Tt(u.enableGraphCapture.toString(),i);r._OrtAddSessionConfigEntry(o,s,h)!==0&&ht(`Can't set a session config entry: 'enableGraphCapture' - ${u.enableGraphCapture}.`)}if(u.freeDimensionOverrides)for(let[s,h]of Object.entries(u.freeDimensionOverrides)){if(typeof s!="string")throw new Error(`free dimension override name must be a string: ${s}`);if(typeof h!="number"||!Number.isInteger(h)||h<0)throw new Error(`free dimension override value must be a non-negative integer: ${h}`);let f=Tt(s,i);r._OrtAddFreeDimensionOverride(o,f,h)!==0&&ht(`Can't set a free dimension override: ${s} - ${h}.`)}return u.extra!==void 0&&Wr(u.extra,"",new WeakSet,(s,h)=>{let f=Tt(s,i),m=Tt(h,i);r._OrtAddSessionConfigEntry(o,f,m)!==0&&ht(`Can't set a session config entry: ${s} - ${h}.`)}),[o,i]}catch(n){throw o!==0&&r._OrtReleaseSessionOptions(o),i.forEach(a=>r._free(a)),n}}}),Hr,Yp,qr,Zp,Qp,bo,go,td,Ji=O(()=>{Hr=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${t}`)}},Yp=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${t}`)}},qr=(t,r)=>{let o=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][t],i=typeof r=="number"?r:r.reduce((u,n)=>u*n,1);return o>0?Math.ceil(i*o):void 0},Zp=t=>{switch(t){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}},Qp=t=>{switch(t){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${t}`)}},bo=t=>t==="float32"||t==="float16"||t==="int32"||t==="int64"||t==="uint32"||t==="uint8"||t==="bool"||t==="uint4"||t==="int4",go=t=>t==="float32"||t==="float16"||t==="int32"||t==="int64"||t==="uint32"||t==="uint64"||t==="int8"||t==="uint8"||t==="bool",td=t=>{switch(t){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${t}`)}}}),jr,Yi=O(()=>{oo(),jr=async t=>{if(typeof t=="string"){let r=await fetch(t);if(!r.ok)throw new Error(`failed to load external data file: ${t}`);let o=r.headers.get("Content-Length"),i=o?parseInt(o,10):0;if(i<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${t}, no response body.`);let u=r.body.getReader(),n;try{n=new ArrayBuffer(i)}catch(d){if(d instanceof RangeError){let c=Math.ceil(i/65536);n=new WebAssembly.Memory({initial:c,maximum:c}).buffer}else throw d}let a=0;for(;;){let{done:d,value:c}=await u.read();if(d)break;let e=c.byteLength;new Uint8Array(n,a,e).set(c),a+=e}return new Uint8Array(n,0,i)}}else return t instanceof Blob?new Uint8Array(await t.arrayBuffer()):t instanceof Uint8Array?t:new Uint8Array(t)}}),Cg,ao,so,yr,Ng,zr,uo,lo,ed,fo,co,po,qi=O(()=>{Xp(),Jp(),Ji(),Ke(),mo(),Yi(),Cg=(t,r)=>{xt()._OrtInit(t,r)!==0&&ht("Can't initialize onnxruntime.")},ao=async t=>{Cg(t.wasm.numThreads,Qp(t.logLevel))},so=async(t,r)=>{},yr=new Map,Ng=t=>{let r=xt(),o=r.stackSave();try{let i=r.stackAlloc(8);return r._OrtGetInputOutputCount(t,i,i+4)!==0&&ht("Can't get session input/output count."),[r.HEAP32[i/4],r.HEAP32[i/4+1]]}finally{r.stackRestore(o)}},zr=t=>{let r=xt(),o=r._malloc(t.byteLength);if(o===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${t.byteLength}.`);return r.HEAPU8.set(t,o),[o,t.byteLength]},uo=async(t,r)=>{var l;let o,i,u=xt();Array.isArray(t)?[o,i]=t:t.buffer===u.HEAPU8.buffer?[o,i]=[t.byteOffset,t.byteLength]:[o,i]=zr(t);let n=0,a=0,d=[],c=[],e=[];try{if([a,d]=Kp(r),(r==null?void 0:r.externalData)&&u.mountExternalData){let T=[];for(let P of r.externalData){let C=typeof P=="string"?P:P.path;T.push(jr(typeof P=="string"?P:P.data).then(V=>{u.mountExternalData(C,V)}))}await Promise.all(T)}for(let T of(r==null?void 0:r.executionProviders)??[])if((typeof T=="string"?T:T.name)==="webnn"){if(u.shouldTransferToMLTensor=!1,u.currentContext)throw new Error("WebNN execution provider is already set.");if(typeof T!="string"){let P=T,C=P==null?void 0:P.context,V=P==null?void 0:P.gpuDevice,gt=P==null?void 0:P.deviceType,pt=P==null?void 0:P.numThreads,Ft=P==null?void 0:P.powerPreference;C?u.currentContext=C:V?u.currentContext=await navigator.ml.createContext(V):u.currentContext=await navigator.ml.createContext({deviceType:gt,numThreads:pt,powerPreference:Ft})}else u.currentContext=await navigator.ml.createContext();break}n=await u._OrtCreateSession(o,i,a),n===0&&ht("Can't create a session."),u.currentContext&&(u.jsepRegisterMLContext(n,u.currentContext),u.currentContext=void 0,u.shouldTransferToMLTensor=!0);let[s,h]=Ng(n),f=!!(r!=null&&r.enableGraphCapture),m=[],v=[],_=[];for(let T=0;T<s;T++){let P=u._OrtGetInputName(n,T);P===0&&ht("Can't get an input name."),c.push(P),m.push(u.UTF8ToString(P))}for(let T=0;T<h;T++){let P=u._OrtGetOutputName(n,T);P===0&&ht("Can't get an output name."),e.push(P);let C=u.UTF8ToString(P);v.push(C)}return yr.set(n,[n,c,e,null,f,!1]),[n,m,v]}catch(s){throw c.forEach(h=>u._OrtFree(h)),e.forEach(h=>u._OrtFree(h)),n!==0&&u._OrtReleaseSession(n),s}finally{u._free(o),a!==0&&u._OrtReleaseSessionOptions(a),d.forEach(s=>u._free(s)),(l=u.unmountExternalData)==null||l.call(u)}},lo=t=>{var c;let r=xt(),o=yr.get(t);if(!o)throw new Error(`cannot release session. invalid session id: ${t}`);let[i,u,n,a,d]=o;a&&(d&&r._OrtClearBoundOutputs(a.handle),r._OrtReleaseBinding(a.handle)),(c=r.jsepOnReleaseSession)==null||c.call(r,t),u.forEach(e=>r._OrtFree(e)),n.forEach(e=>r._OrtFree(e)),r._OrtReleaseSession(i),yr.delete(t)},ed=(t,r,o,i,u,n=!1)=>{if(!t){r.push(0);return}let a=xt(),d=t[0],c=t[1],e=t[3],l,s;if(d==="string"&&(e==="gpu-buffer"||e==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(n&&e!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${u} when enableGraphCapture is true.`);if(e==="gpu-buffer"){let m=t[2].gpuBuffer;s=qr(Hr(d),c);let v=a.jsepRegisterBuffer;if(!v)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');l=v(i,u,m,s)}else if(e==="ml-tensor"){let m=t[2].mlTensor;s=qr(Hr(d),c);let v=a.jsepRegisterMLTensor;if(!v)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');l=v(m,Hr(d),c)}else{let m=t[2];if(Array.isArray(m)){s=4*m.length,l=a._malloc(s),o.push(l);let v=l/4;for(let _=0;_<m.length;_++){if(typeof m[_]!="string")throw new TypeError(`tensor data at index ${_} is not a string`);a.HEAPU32[v++]=Tt(m[_],o)}}else s=m.byteLength,l=a._malloc(s),o.push(l),a.HEAPU8.set(new Uint8Array(m.buffer,m.byteOffset,s),l)}let h=a.stackSave(),f=a.stackAlloc(4*c.length);try{let m=f/4;c.forEach(_=>a.HEAP32[m++]=_);let v=a._OrtCreateTensor(Hr(d),l,s,f,c.length,td(e));v===0&&ht(`Can't create tensor for input/output. session=${i}, index=${u}.`),r.push(v)}finally{a.stackRestore(h)}},fo=async(t,r,o,i,u,n)=>{var et;let a=xt(),d=yr.get(t);if(!d)throw new Error(`cannot run inference. invalid session id: ${t}`);let c=d[0],e=d[1],l=d[2],s=d[3],h=d[4];d[5];let f=r.length,m=i.length,v=0,_=[],I=[],T=[],P=[],C=a.stackSave(),V=a.stackAlloc(f*4),gt=a.stackAlloc(f*4),pt=a.stackAlloc(m*4),Ft=a.stackAlloc(m*4);try{(et=a.jsepOnRunStart)==null||et.call(a,c),[v,_]=jp(n);for(let K=0;K<f;K++)ed(o[K],I,P,t,r[K],h);for(let K=0;K<m;K++)ed(u[K],T,P,t,f+i[K],h);let $t=V/4,De=gt/4,wt=pt/4,Le=Ft/4;for(let K=0;K<f;K++)a.HEAPU32[$t++]=I[K],a.HEAPU32[De++]=e[r[K]];for(let K=0;K<m;K++)a.HEAPU32[wt++]=T[K],a.HEAPU32[Le++]=l[i[K]];let Lt;Lt=await a._OrtRun(c,gt,V,f,Ft,m,pt,v),Lt!==0&&ht("failed to call OrtRun().");let vt=[];for(let K=0;K<m;K++){let Jt=a.HEAPU32[pt/4+K];if(Jt===T[K]){vt.push(u[K]);continue}let Re=a.stackSave(),Ot=a.stackAlloc(4*4),le=!1,at,st=0;try{a._OrtGetTensorData(Jt,Ot,Ot+4,Ot+8,Ot+12)!==0&&ht(`Can't access output tensor data on index ${K}.`);let oe=Ot/4,te=a.HEAPU32[oe++];st=a.HEAPU32[oe++];let Ge=a.HEAPU32[oe++],ie=a.HEAPU32[oe++],Pt=[];for(let it=0;it<ie;it++)Pt.push(a.HEAPU32[Ge/4+it]);a._OrtFree(Ge);let Dt=Pt.reduce((it,lt)=>it*lt,1);at=Yp(te);let Mt=s==null?void 0:s.outputPreferredLocations[i[K]];if(at==="string"){if(Mt==="gpu-buffer"||Mt==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let it=[],lt=st/4;for(let Wt=0;Wt<Dt;Wt++){let fe=a.HEAPU32[lt++],Ye=Wt===Dt-1?void 0:a.HEAPU32[lt]-fe;it.push(a.UTF8ToString(fe,Ye))}vt.push([at,Pt,it,"cpu"])}else if(Mt==="gpu-buffer"&&Dt>0){let it=a.jsepGetBuffer;if(!it)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let lt=it(st),Wt=qr(te,Dt);if(Wt===void 0||!bo(at))throw new Error(`Unsupported data type: ${at}`);le=!0,vt.push([at,Pt,{gpuBuffer:lt,download:a.jsepCreateDownloader(lt,Wt,at),dispose:()=>{a._OrtReleaseTensor(Jt)}},"gpu-buffer"])}else if(Mt==="ml-tensor"&&Dt>0){let it=a.jsepEnsureTensor;if(!it)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(qr(te,Dt)===void 0||!go(at))throw new Error(`Unsupported data type: ${at}`);let lt=await it(st,te,Pt,!1);le=!0,vt.push([at,Pt,{mlTensor:lt,download:a.jsepCreateMLTensorDownloader(st,at),dispose:()=>{a.jsepReleaseTensorId(st),a._OrtReleaseTensor(Jt)}},"ml-tensor"])}else{let it=Zp(at),lt=new it(Dt);new Uint8Array(lt.buffer,lt.byteOffset,lt.byteLength).set(a.HEAPU8.subarray(st,st+lt.byteLength)),vt.push([at,Pt,lt,"cpu"])}}finally{a.stackRestore(Re),at==="string"&&st&&a._free(st),le||a._OrtReleaseTensor(Jt)}}return s&&!h&&(a._OrtClearBoundOutputs(s.handle),yr.set(t,[c,e,l,s,h,!1])),vt}finally{a.stackRestore(C),I.forEach($t=>a._OrtReleaseTensor($t)),T.forEach($t=>a._OrtReleaseTensor($t)),P.forEach($t=>a._free($t)),v!==0&&a._OrtReleaseRunOptions(v),_.forEach($t=>a._free($t))}},co=t=>{let r=xt(),o=yr.get(t);if(!o)throw new Error("invalid session id");let i=o[0],u=r._OrtEndProfiling(i);u===0&&ht("Can't get an profile file name."),r._OrtFree(u)},po=t=>{let r=[];for(let o of t){let i=o[2];!Array.isArray(i)&&"buffer"in i&&r.push(i.buffer)}return r}}),Je,Kt,Xr,xo,To,yo,Zi,Qi,xr,Tr,Gg,rd,nd,od,id,ad,sd,ud,ta=O(()=>{Yt(),qi(),Ke(),Vr(),Je=()=>!!z.wasm.proxy&&typeof document<"u",Xr=!1,xo=!1,To=!1,Qi=new Map,xr=(t,r)=>{let o=Qi.get(t);o?o.push(r):Qi.set(t,[r])},Tr=()=>{if(Xr||!xo||To||!Kt)throw new Error("worker not ready")},Gg=t=>{switch(t.data.type){case"init-wasm":Xr=!1,t.data.err?(To=!0,Zi[1](t.data.err)):(xo=!0,Zi[0]()),yo&&(URL.revokeObjectURL(yo),yo=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=Qi.get(t.data.type);t.data.err?r.shift()[1](t.data.err):r.shift()[0](t.data.out);break}}},rd=async()=>{if(!xo){if(Xr)throw new Error("multiple calls to 'initWasm()' detected.");if(To)throw new Error("previous call to 'initWasm()' failed.");if(Xr=!0,Je())return new Promise((t,r)=>{Kt==null||Kt.terminate(),Wp().then(([o,i])=>{try{Kt=i,Kt.onerror=n=>r(n),Kt.onmessage=Gg,Zi=[t,r];let u={type:"init-wasm",in:z};Kt.postMessage(u),yo=o}catch(u){r(u)}},r)});try{await io(z.wasm),await ao(z),xo=!0}catch(t){throw To=!0,t}finally{Xr=!1}}},nd=async t=>{if(Je())return Tr(),new Promise((r,o)=>{xr("init-ep",[r,o]);let i={type:"init-ep",in:{epName:t,env:z}};Kt.postMessage(i)});await so(z,t)},od=async t=>Je()?(Tr(),new Promise((r,o)=>{xr("copy-from",[r,o]);let i={type:"copy-from",in:{buffer:t}};Kt.postMessage(i,[t.buffer])})):zr(t),id=async(t,r)=>{if(Je()){if(r!=null&&r.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return Tr(),new Promise((o,i)=>{xr("create",[o,i]);let u={type:"create",in:{model:t,options:{...r}}},n=[];t instanceof Uint8Array&&n.push(t.buffer),Kt.postMessage(u,n)})}else return uo(t,r)},ad=async t=>{if(Je())return Tr(),new Promise((r,o)=>{xr("release",[r,o]);let i={type:"release",in:t};Kt.postMessage(i)});lo(t)},sd=async(t,r,o,i,u,n)=>{if(Je()){if(o.some(a=>a[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(u.some(a=>a))throw new Error("pre-allocated output tensor is not supported for proxy.");return Tr(),new Promise((a,d)=>{xr("run",[a,d]);let c=o,e={type:"run",in:{sessionId:t,inputIndices:r,inputs:c,outputIndices:i,options:n}};Kt.postMessage(e,po(c))})}else return fo(t,r,o,i,u,n)},ud=async t=>{if(Je())return Tr(),new Promise((r,o)=>{xr("end-profiling",[r,o]);let i={type:"end-profiling",in:t};Kt.postMessage(i)});co(t)}}),ld,Mg,wo,fd=O(()=>{Yt(),ta(),Ji(),oo(),Yi(),ld=(t,r)=>{switch(t.location){case"cpu":return[t.type,t.dims,t.data,"cpu"];case"gpu-buffer":return[t.type,t.dims,{gpuBuffer:t.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[t.type,t.dims,{mlTensor:t.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${t.location} for ${r()}`)}},Mg=t=>{switch(t[3]){case"cpu":return new yt(t[0],t[2],t[1]);case"gpu-buffer":{let r=t[0];if(!bo(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:o,download:i,dispose:u}=t[2];return yt.fromGpuBuffer(o,{dataType:r,dims:t[1],download:i,dispose:u})}case"ml-tensor":{let r=t[0];if(!go(r))throw new Error(`not supported data type: ${r} for deserializing MLTensor tensor`);let{mlTensor:o,download:i,dispose:u}=t[2];return yt.fromMLTensor(o,{dataType:r,dims:t[1],download:i,dispose:u})}default:throw new Error(`invalid data location: ${t[3]}`)}},wo=class{async fetchModelAndCopyToWasmMemory(t){return od(await jr(t))}async loadModel(t,r){Fe();let o;typeof t=="string"?o=await this.fetchModelAndCopyToWasmMemory(t):o=t,[this.sessionId,this.inputNames,this.outputNames]=await id(o,r),Ce()}async dispose(){return ad(this.sessionId)}async run(t,r,o){Fe();let i=[],u=[];Object.entries(t).forEach(s=>{let h=s[0],f=s[1],m=this.inputNames.indexOf(h);if(m===-1)throw new Error(`invalid input '${h}'`);i.push(f),u.push(m)});let n=[],a=[];Object.entries(r).forEach(s=>{let h=s[0],f=s[1],m=this.outputNames.indexOf(h);if(m===-1)throw new Error(`invalid output '${h}'`);n.push(f),a.push(m)});let d=i.map((s,h)=>ld(s,()=>`input "${this.inputNames[u[h]]}"`)),c=n.map((s,h)=>s?ld(s,()=>`output "${this.outputNames[a[h]]}"`):null),e=await sd(this.sessionId,u,d,a,c,o),l={};for(let s=0;s<e.length;s++)l[this.outputNames[a[s]]]=n[s]??Mg(e[s]);return Ce(),l}startProfiling(){}endProfiling(){ud(this.sessionId)}}}),pd={};Or(pd,{OnnxruntimeWebAssemblyBackend:()=>vo,initializeFlags:()=>cd,wasmBackend:()=>Ug});var cd,vo,Ug,dd=O(()=>{Yt(),ta(),fd(),Vr(),cd=()=>{if((typeof z.wasm.initTimeout!="number"||z.wasm.initTimeout<0)&&(z.wasm.initTimeout=0),z.wasm.simd===!1&&console.warn('Deprecated property "env.wasm.simd" is set to false. non-SIMD build is no longer provided, and this setting will be ignored.'),typeof z.wasm.proxy!="boolean"&&(z.wasm.proxy=!1),typeof z.wasm.trace!="boolean"&&(z.wasm.trace=!1),typeof z.wasm.numThreads!="number"||!Number.isInteger(z.wasm.numThreads)||z.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)z.wasm.numThreads=1;else{let t=typeof navigator>"u"?Co("node:os").cpus().length:navigator.hardwareConcurrency;z.wasm.numThreads=Math.min(4,Math.ceil((t||1)/2))}},vo=class{async init(t){cd(),await rd(),await nd(t)}async createInferenceSessionHandler(t,r){let o=new wo;return await o.loadModel(t,r),Promise.resolve(o)}},Ug=new vo});Yt(),Yt(),Yt();var Ds="1.20.1";{let t=(Fp(),sn(Bp)).onnxjsBackend;nr("webgl",t,-10)}{let t=(dd(),sn(pd)).wasmBackend;nr("cpu",t,10),nr("wasm",t,10)}Object.defineProperty(z.versions,"web",{value:Ds,enumerable:!0});/*! Bundled license information:
|
|
1805
|
+
${t}`);return i}deleteShader(t){this.gl.deleteShader(t)}bindTextureToUniform(t,r,o){let i=this.gl;i.activeTexture(i.TEXTURE0+r),this.checkError(),i.bindTexture(i.TEXTURE_2D,t),this.checkError(),i.uniform1i(o,r),this.checkError()}draw(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.checkError()}checkError(){if(z.debug){let t=this.gl,r=t.getError(),o="";switch(r){case t.NO_ERROR:return;case t.INVALID_ENUM:o="INVALID_ENUM";break;case t.INVALID_VALUE:o="INVALID_VALUE";break;case t.INVALID_OPERATION:o="INVALID_OPERATION";break;case t.INVALID_FRAMEBUFFER_OPERATION:o="INVALID_FRAMEBUFFER_OPERATION";break;case t.OUT_OF_MEMORY:o="OUT_OF_MEMORY";break;case t.CONTEXT_LOST_WEBGL:o="CONTEXT_LOST_WEBGL";break;default:o=`Unknown WebGL Error: ${r.toString(16)}`}throw new Error(o)}}deleteTexture(t){this.gl.deleteTexture(t)}deleteProgram(t){this.gl.deleteProgram(t)}getEncoder(t,r,o=0){if(this.version===2)return new Pn(this.gl,r);switch(t){case"float":return o===1||this.isRenderFloat32Supported?new Br(this.gl,r):new Br(this.gl,r,this.textureHalfFloatExtension.HALF_FLOAT_OES);case"int":throw new Error("not implemented");case"byte":return new En(this.gl,r);default:throw new Error(`Invalid dataType: ${t}`)}}clearActiveTextures(){let t=this.gl;for(let r=0;r<this.maxTextureImageUnits;++r)t.activeTexture(t.TEXTURE0+r),t.bindTexture(t.TEXTURE_2D,null)}dispose(){if(this.disposed)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(this.framebuffer),t.bindBuffer(t.ARRAY_BUFFER,null),t.deleteBuffer(this.vertexbuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null),t.finish(),this.disposed=!0}createDefaultGeometry(){return new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0])}createVertexbuffer(){let t=this.gl,r=t.createBuffer();if(!r)throw new Error("createBuffer() returned null");let o=this.createDefaultGeometry();return t.bindBuffer(t.ARRAY_BUFFER,r),t.bufferData(t.ARRAY_BUFFER,o,t.STATIC_DRAW),this.checkError(),r}createFramebuffer(){let t=this.gl.createFramebuffer();if(!t)throw new Error("createFramebuffer returned null");return t}queryVitalParameters(){let t=this.gl;if(this.isFloatTextureAttachableToFrameBuffer=this.checkFloatTextureAttachableToFrameBuffer(),this.isRenderFloat32Supported=this.checkRenderFloat32(),this.isFloat32DownloadSupported=this.checkFloat32Download(),this.version===1&&!this.textureHalfFloatExtension&&!this.isRenderFloat32Supported)throw new Error("both float32 and float16 TextureType are not supported");this.isBlendSupported=!this.isRenderFloat32Supported||this.checkFloat32Blend(),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxTextureImageUnits=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.version}getExtensions(){this.version===2?(this.colorBufferFloatExtension=this.gl.getExtension("EXT_color_buffer_float"),this.disjointTimerQueryWebgl2Extension=this.gl.getExtension("EXT_disjoint_timer_query_webgl2")):(this.textureFloatExtension=this.gl.getExtension("OES_texture_float"),this.textureHalfFloatExtension=this.gl.getExtension("OES_texture_half_float"))}checkFloatTextureAttachableToFrameBuffer(){let t=this.gl,r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let o=this.version===2?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,o,1,1,0,t.RGBA,t.FLOAT,null);let i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);let u=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(i),u}checkRenderFloat32(){if(this.version===2){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension)return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Download(){if(this.version===2){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension||!this.gl.getExtension("WEBGL_color_buffer_float"))return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Blend(){let t=this.gl,r,o,i,u,n;try{r=t.createTexture(),o=t.createFramebuffer(),t.bindTexture(t.TEXTURE_2D,r);let a=this.version===2?t.RGBA32F:t.RGBA;return t.texImage2D(t.TEXTURE_2D,0,a,1,1,0,t.RGBA,t.FLOAT,null),t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.enable(t.BLEND),i=t.createShader(t.VERTEX_SHADER),!i||(t.shaderSource(i,"void main(){}"),t.compileShader(i),u=t.createShader(t.FRAGMENT_SHADER),!u)||(t.shaderSource(u,"precision highp float;void main(){gl_FragColor=vec4(0.5);}"),t.compileShader(u),n=t.createProgram(),!n)?!1:(t.attachShader(n,i),t.attachShader(n,u),t.linkProgram(n),t.useProgram(n),t.drawArrays(t.POINTS,0,1),t.getError()===t.NO_ERROR)}finally{t.disable(t.BLEND),n&&t.deleteProgram(n),i&&t.deleteShader(i),u&&t.deleteShader(u),o&&(t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteFramebuffer(o)),r&&(t.bindTexture(t.TEXTURE_2D,null),t.deleteTexture(r))}}beginTimer(){if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let t=this.gl,r=this.disjointTimerQueryWebgl2Extension,o=t.createQuery();return t.beginQuery(r.TIME_ELAPSED_EXT,o),o}else throw new Error("WebGL1 profiling currently not supported.")}endTimer(){if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let t=this.gl,r=this.disjointTimerQueryWebgl2Extension;t.endQuery(r.TIME_ELAPSED_EXT);return}else throw new Error("WebGL1 profiling currently not supported")}isTimerResultAvailable(t){let r=!1,o=!1;if(this.version===2&&this.disjointTimerQueryWebgl2Extension){let i=this.gl,u=this.disjointTimerQueryWebgl2Extension;r=i.getQueryParameter(t,i.QUERY_RESULT_AVAILABLE),o=i.getParameter(u.GPU_DISJOINT_EXT)}else throw new Error("WebGL1 profiling currently not supported");return r&&!o}getTimerResult(t){let r=0;if(this.version===2){let o=this.gl;r=o.getQueryParameter(t,o.QUERY_RESULT),o.deleteQuery(t)}else throw new Error("WebGL1 profiling currently not supported");return r/1e6}async waitForQueryAndGetTime(t){return await li(()=>this.isTimerResultAvailable(t)),this.getTimerResult(t)}async createAndWaitForFence(){let t=this.createFence(this.gl);return this.pollFence(t)}createFence(t){let r,o=t,i=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);return t.flush(),i===null?r=()=>!0:r=()=>{let u=o.clientWaitSync(i,0,0);return u===o.ALREADY_SIGNALED||u===o.CONDITION_SATISFIED},{query:i,isFencePassed:r}}async pollFence(t){return new Promise(r=>{this.addItemToPoll(()=>t.isFencePassed(),()=>r())})}pollItems(){let t=bg(this.itemsToPoll.map(r=>r.isDoneFn));for(let r=0;r<=t;++r){let{resolveFn:o}=this.itemsToPoll[r];o()}this.itemsToPoll=this.itemsToPoll.slice(t+1)}async addItemToPoll(t,r){this.itemsToPoll.push({isDoneFn:t,resolveFn:r}),!(this.itemsToPoll.length>1)&&await li(()=>(this.pollItems(),this.itemsToPoll.length===0))}}});function Gi(t){let r;if((!t||t==="webgl2")&&"webgl2"in mr?r=mr.webgl2:(!t||t==="webgl")&&"webgl"in mr&&(r=mr.webgl),!r)try{let i=yg();r=vp(i,t)}catch{let i=gg();r=vp(i,t)}t=t||r.version===1?"webgl":"webgl2";let o=r.gl;return mr[t]=r,o.isContextLost()?(delete mr[t],Gi(t)):(o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.disable(o.BLEND),o.disable(o.DITHER),o.disable(o.POLYGON_OFFSET_FILL),o.disable(o.SAMPLE_COVERAGE),o.enable(o.SCISSOR_TEST),o.enable(o.CULL_FACE),o.cullFace(o.BACK),r)}function vp(t,r){let o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1},i,u=o;if((!r||r==="webgl2")&&(i=t.getContext("webgl2",u),i))try{return new Mr(i,2)}catch(n){tt.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${n}`)}if((!r||r==="webgl")&&(i=t.getContext("webgl",u)||t.getContext("experimental-webgl",u),i))try{return new Mr(i,1)}catch(n){tt.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${n}`)}throw new Error("WebGL is not supported")}function gg(){if(typeof document>"u")throw new TypeError("failed to create canvas: document is not supported");let t=document.createElement("canvas");return t.width=1,t.height=1,t}function yg(){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create offscreen canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}var mr,Ip=O(()=>{Ut(),wp(),mr={}}),Yn,_p=O(()=>{Yt(),Ut(),Tp(),Ip(),Yn=class{get contextId(){return z.webgl.contextId}set contextId(t){z.webgl.contextId=t}get matmulMaxBatchSize(){return z.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(t){z.webgl.matmulMaxBatchSize=t}get textureCacheMode(){return z.webgl.textureCacheMode}set textureCacheMode(t){z.webgl.textureCacheMode=t}get pack(){return z.webgl.pack}set pack(t){z.webgl.pack=t}get async(){return z.webgl.async}set async(t){z.webgl.async=t}initialize(){try{return this.glContext=Gi(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),tt.setWithEnv(z),z.webgl.context||Object.defineProperty(z.webgl,"context",{value:this.glContext.gl}),tt.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(t){return tt.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${t}`),!1}}createSessionHandler(t){return new Jn(this,t)}dispose(){this.glContext.dispose()}}});async function Mi(t){if(t){let r=typeof t=="string"?[t]:t;for(let o of r){let i=Op.get(o);if(i)return i;let u=await Tg(o);if(u)return u}}else return Mi(["webgl"]);throw new Error("no available backend to use")}async function Tg(t){let r=xg;if(typeof r[t]<"u"&&wg(r[t])){let o=r[t],i=o.initialize();if(typeof i=="object"&&"then"in i&&(i=await i),i)return Op.set(t,o),o}}function wg(t){let r=t;return"initialize"in r&&typeof r.initialize=="function"&&"createSessionHandler"in r&&typeof r.createSessionHandler=="function"&&"dispose"in r&&typeof r.dispose=="function"}var Op,xg,Sp=O(()=>{_p(),Op=new Map,xg={webgl:new Yn}}),Ui,Zn,Ap=O(()=>{Ut(),Ui=class{constructor(t,r){this.op=t,this.node=r}},Zn=class{constructor(t,r,o){this.graph=t,this.profiler=o,this.initialize(r)}initialize(t){this.profiler.event("session","ExecutionPlan.initialize",()=>{let r=this.graph.getNodes();if(r.length!==t.length)throw new Error("The size of nodes and OPs do not match.");this._ops=t.map((o,i)=>new Ui(o,r[i])),this.reset(),this._starter=[],this._ops.forEach((o,i)=>{let u=!0;for(let n of o.node.inputs)if(!this._values[n]&&this.graph.getInputIndices().indexOf(n)===-1){u=!1;break}u&&this._starter.push(i)})})}reset(){this._values=this.graph.getValues().map(t=>t.tensor)}async execute(t,r){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();let o=t.createInferenceHandler(),i=this.graph.getInputIndices();if(r.length!==i.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${r.length} expected: ${i.length}`);r.forEach((e,l)=>{let s=i[l];this._values[s]=e});let u=this._starter.slice(0),n=this.graph.getValues(),a=this.graph.getNodes(),d=0;for(;d<u.length;){let e=u[d++],l=this._ops[e],s=l.node.inputs.map(v=>this._values[v]);if(s.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${l.node}`);let h=s;tt.verbose("ExecPlan",`Running op:${l.node.name} (${h.map((v,_)=>`'${l.node.inputs[_]}': ${v.type}[${v.dims.join(",")}]`).join(", ")})`);let f=await this.profiler.event("node",l.node.name,async()=>l.op.impl(o,h,l.op.context));if(f.length!==l.node.outputs.length)throw new Error("the size of output does not match model definition.");f.forEach((v,_)=>{let I=l.node.outputs[_];if(this._values[I])throw new Error(`output [${I}] already has value: op:${l.node.name}`);this._values[I]=v});let m=new Set;f.forEach((v,_)=>{let I=l.node.outputs[_];for(let T of n[I].to){let P=a[T],C=!0;for(let R of P.inputs)if(!this._values[R]){C=!1;break}C&&m.add(T)}}),u.push(...m)}let c=[];for(let e=0;e<this.graph.getOutputIndices().length;e++){let l=this.graph.getOutputIndices()[e],s=this._values[l];if(s===void 0)throw new Error(`required output [${l}] does not have value`);l===0?await s.getData():s.data,c.push(s)}return tt.verbose("ExecPlan","disposing of inferenceHandler"),o.dispose(),c})}}}),q,Xt,Ur,Pp=O(()=>{Pr(),q=rr(sr()),We(),Y(),Xt=F.experimental.fbs,Ur=class $e{constructor(r){if(this._attributes=new Map,r!=null){for(let o of r)o instanceof q.onnx.AttributeProto?this._attributes.set(o.name,[$e.getValue(o),$e.getType(o)]):o instanceof Xt.Attribute&&this._attributes.set(o.name(),[$e.getValue(o),$e.getType(o)]);if(this._attributes.size<r.length)throw new Error("duplicated attribute names")}}set(r,o,i){this._attributes.set(r,[i,o])}delete(r){this._attributes.delete(r)}getFloat(r,o){return this.get(r,"float",o)}getInt(r,o){return this.get(r,"int",o)}getString(r,o){return this.get(r,"string",o)}getTensor(r,o){return this.get(r,"tensor",o)}getFloats(r,o){return this.get(r,"floats",o)}getInts(r,o){return this.get(r,"ints",o)}getStrings(r,o){return this.get(r,"strings",o)}getTensors(r,o){return this.get(r,"tensors",o)}get(r,o,i){let u=this._attributes.get(r);if(u===void 0){if(i!==void 0)return i;throw new Error(`required attribute not found: ${r}`)}if(u[1]!==o)throw new Error(`type mismatch: expected ${o} but got ${u[1]}`);return u[0]}static getType(r){let o=r instanceof q.onnx.AttributeProto?r.type:r.type();switch(o){case q.onnx.AttributeProto.AttributeType.FLOAT:return"float";case q.onnx.AttributeProto.AttributeType.INT:return"int";case q.onnx.AttributeProto.AttributeType.STRING:return"string";case q.onnx.AttributeProto.AttributeType.TENSOR:return"tensor";case q.onnx.AttributeProto.AttributeType.FLOATS:return"floats";case q.onnx.AttributeProto.AttributeType.INTS:return"ints";case q.onnx.AttributeProto.AttributeType.STRINGS:return"strings";case q.onnx.AttributeProto.AttributeType.TENSORS:return"tensors";default:throw new Error(`attribute type is not supported yet: ${q.onnx.AttributeProto.AttributeType[o]}`)}}static getValue(r){let o=r instanceof q.onnx.AttributeProto?r.type:r.type();if(o===q.onnx.AttributeProto.AttributeType.GRAPH||o===q.onnx.AttributeProto.AttributeType.GRAPHS)throw new Error("graph attribute is not supported yet");let i=this.getValueNoCheck(r);if(o===q.onnx.AttributeProto.AttributeType.INT&&Rt.isLong(i))return Rt.longToNumber(i);if(o===q.onnx.AttributeProto.AttributeType.INTS){let u=i,n=new Array(u.length);for(let a=0;a<u.length;a++){let d=u[a];n[a]=Rt.longToNumber(d)}return n}if(o===q.onnx.AttributeProto.AttributeType.TENSOR)return r instanceof q.onnx.AttributeProto?bt.fromProto(i):bt.fromOrtTensor(i);if(o===q.onnx.AttributeProto.AttributeType.TENSORS){if(r instanceof q.onnx.AttributeProto)return i.map(u=>bt.fromProto(u));if(r instanceof Xt.Attribute)return i.map(u=>bt.fromOrtTensor(u))}return o===q.onnx.AttributeProto.AttributeType.STRING&&r instanceof q.onnx.AttributeProto?kr(i):o===q.onnx.AttributeProto.AttributeType.STRINGS&&r instanceof q.onnx.AttributeProto?i.map(kr):i}static getValueNoCheck(r){return r instanceof q.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(r):this.getValueNoCheckFromOrtFormat(r)}static getValueNoCheckFromOnnxFormat(r){switch(r.type){case q.onnx.AttributeProto.AttributeType.FLOAT:return r.f;case q.onnx.AttributeProto.AttributeType.INT:return r.i;case q.onnx.AttributeProto.AttributeType.STRING:return r.s;case q.onnx.AttributeProto.AttributeType.TENSOR:return r.t;case q.onnx.AttributeProto.AttributeType.GRAPH:return r.g;case q.onnx.AttributeProto.AttributeType.FLOATS:return r.floats;case q.onnx.AttributeProto.AttributeType.INTS:return r.ints;case q.onnx.AttributeProto.AttributeType.STRINGS:return r.strings;case q.onnx.AttributeProto.AttributeType.TENSORS:return r.tensors;case q.onnx.AttributeProto.AttributeType.GRAPHS:return r.graphs;default:throw new Error(`unsupported attribute type: ${q.onnx.AttributeProto.AttributeType[r.type]}`)}}static getValueNoCheckFromOrtFormat(r){switch(r.type()){case Xt.AttributeType.FLOAT:return r.f();case Xt.AttributeType.INT:return r.i();case Xt.AttributeType.STRING:return r.s();case Xt.AttributeType.TENSOR:return r.t();case Xt.AttributeType.GRAPH:return r.g();case Xt.AttributeType.FLOATS:return r.floatsArray();case Xt.AttributeType.INTS:{let o=[];for(let i=0;i<r.intsLength();i++)o.push(r.ints(i));return o}case Xt.AttributeType.STRINGS:{let o=[];for(let i=0;i<r.stringsLength();i++)o.push(r.strings(i));return o}case Xt.AttributeType.TENSORS:{let o=[];for(let i=0;i<r.tensorsLength();i++)o.push(r.tensors(i));return o}default:throw new Error(`unsupported attribute type: ${Xt.AttributeType[r.type()]}`)}}}}),zi,Qn,Wi,me,to,Vi,Ep=O(()=>{Pp(),Pr(),zi=rr(sr()),We(),Y(),Qn=F.experimental.fbs,Wi={from:(t,r)=>new Vi(t,r)},me=class{constructor(t){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,t&&(this.type=At.tensorValueTypeFromProto(t.type.tensorType))}get from(){return this._from}get to(){return this._to}},to=class{constructor(t,r){t instanceof zi.onnx.NodeProto?(this.name=t.name,this.opType=t.opType,this.attributes=new Ur(t.attribute)):t instanceof Qn.Node&&(this.name=r??t.name(),this.opType=t.opType(),this.attributes=new Ur(At.tensorAttributesFromORTFormat(t))),this.inputs=[],this.outputs=[],this.executeNode=!0}},Vi=class{constructor(t,r){if(!t)throw new TypeError("graph is empty");this.buildGraph(t),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(t){if(t instanceof zi.onnx.GraphProto)this.buildGraphFromOnnxFormat(t);else if(t instanceof Qn.Graph)this.buildGraphFromOrtFormat(t);else throw new TypeError("Graph type is not supported.")}buildGraphFromOnnxFormat(t){let r=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let o=new Map;if(!t.input)throw new Error("missing information in graph: input");let i=[];for(let u of t.input){if(r.has(u.name))throw new Error(`duplicated input name: ${u.name}`);let n=this._allData.push(new me(u))-1;r.set(u.name,n),i.push(u.name)}if(!t.initializer)throw new Error("missing information in graph: initializer");for(let u of t.initializer){let n=r.get(u.name);if(n===void 0){let a=new me;a.type={shape:{dims:At.tensorDimsFromProto(u.dims)},tensorType:At.tensorDataTypeFromProto(u.dataType)},n=this._allData.push(a)-1,r.set(u.name,n)}this._allData[n]._from=-1,this._allData[n].tensor=bt.fromProto(u)}for(let u=0;u<this._allData.length;u++)this._allData[u].tensor||(this._allInputIndices.push(u),this._allInputNames.push(i[u]));if(!t.output)throw new Error("missing information in graph: output");for(let u of t.output){if(r.has(u.name))throw new Error(`duplicated output name: ${u.name}`);let n=this._allData.push(new me(u))-1;r.set(u.name,n),this._allOutputIndices.push(n),this._allOutputNames.push(u.name)}if(!t.node)throw new Error("missing information in graph: node");for(let u of t.node){if(!u.name)for(let a=0;;a++){let d=`unnamed_${u.opType}_${a}`;if(!o.has(d)){u.name=d;break}}if(o.has(u.name))throw new Error(`duplicated node name: ${u.name}`);let n=this._nodes.push(new to(u))-1;o.set(u.name,n)}for(let u=0;u<this._nodes.length;u++){let n=this._nodes[u],a=t.node[u];if(!a.output)throw new Error(`missing output for node: ${a.name}`);for(let d of a.output){let c=r.get(d);if(typeof c>"u"&&(c=this._allData.push(new me)-1,r.set(d,c)),n.outputs.push(c),this._allData[c]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${c}`);if(this._allData[c]._from=u,a.opType==="Constant"){if(!a.attribute||a.attribute.length!==1||!a.attribute[0].t)throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(!a.output||a.output.length!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");n.outputs.pop(),n.executeNode=!1,this._allData[c]._from=-1,this._allData[c].tensor=bt.fromProto(a.attribute[0].t)}}}for(let u=0;u<this._nodes.length;u++){let n=this._nodes[u],a=t.node[u];if(!a.input)throw new Error(`missing input for node: ${a.name}`);for(let d of a.input){let c=r.get(d);if(typeof c>"u"){if(d===""&&(a.input.length===3||a.input.length===4)&&a.opType==="Resize")continue;throw new Error(`unrecognized input '${d}' for node: ${a.name}`)}n.inputs.push(c),this._allData[c]._to.push(u)}}return!0}buildGraphFromOrtFormat(t){var u,n,a;let r=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let o=new Map,i=[];for(let d=0;d<t.inputsLength();d++){let c=t.inputs(d);if(r.has(c))throw new Error(`duplicated input name: ${c}`);for(let e=0;e<t.nodeArgsLength();e++)if(((u=t.nodeArgs(e))==null?void 0:u.name())===c){let l=new me;if(((a=(n=t.nodeArgs(e))==null?void 0:n.type())==null?void 0:a.valueType())!==Qn.TypeInfoValue.tensor_type)throw new Error("Unexpected value type for the nodeArg.");let s=t.nodeArgs(e).type().value(new Qn.TensorTypeAndShape),h=At.tensorDataTypeFromProto(s.elemType()),f=s.shape(),m=[];for(let _=0;_<f.dimLength();_++)m.push(Rt.longToNumber(f.dim(_).value().dimValue()));l.type={shape:{dims:m},tensorType:h};let v=this._allData.push(l)-1;r.set(c,v),i.push(c)}}for(let d=0;d<t.initializersLength();d++){let c=t.initializers(d),e=r.get(c.name());if(e===void 0){let l=new me,s=At.tensorDimsFromORTFormat(c),h=At.tensorDataTypeFromProto(c.dataType());l.type={shape:{dims:s},tensorType:h},e=this._allData.push(l)-1,r.set(c.name(),e)}this._allData[e]._from=-1,this._allData[e].tensor=bt.fromOrtTensor(c)}for(let d=0;d<this._allData.length;d++)this._allData[d].tensor||(this._allInputIndices.push(d),this._allInputNames.push(i[d]));for(let d=0;d<t.outputsLength();d++){let c=t.outputs(d);if(r.has(c))throw new Error(`duplicated output name: ${c}`);let e=this._allData.push(new me)-1;r.set(c,e),this._allOutputIndices.push(e),this._allOutputNames.push(c)}if(!t.nodes)throw new Error("missing information in graph: node");for(let d=0;d<t.nodesLength();d++){let c=t.nodes(d),e=c.name();if(!e)for(let s=0;e=`unnamed_${c.opType()}_${s}`,!!o.has(e);s++);if(o.has(e))throw new Error(`duplicated node name: ${e}`);let l=this._nodes.push(new to(c,e))-1;o.set(e,l)}for(let d=0;d<this._nodes.length;d++){let c=this._nodes[d],e=t.nodes(d);if(e==null)throw new Error(`No node exists at index ${d}`);if((e==null?void 0:e.outputsLength())===0)throw new Error(`missing output for node: ${e.name}`);for(let l=0;l<(e==null?void 0:e.outputsLength());l++){let s=e==null?void 0:e.outputs(l),h=r.get(s);if(typeof h>"u"&&(h=this._allData.push(new me)-1,r.set(s,h)),c.outputs.push(h),this._allData[h]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${h}`);if(this._allData[h]._from=d,e.opType()==="Constant"){if(e.attributesLength()!==1||!e.attributes(0).t())throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(e.outputsLength()!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");c.outputs.pop(),c.executeNode=!1,this._allData[h]._from=-1,this._allData[h].tensor=bt.fromOrtTensor(e.attributes(0).t())}}}for(let d=0;d<this._nodes.length;d++){let c=this._nodes[d],e=t.nodes(d);if(e.inputsLength()===0)throw new Error(`missing input for node: ${e.name}`);for(let l=0;l<e.inputsLength();l++){let s=e.inputs(l),h=r.get(s);if(typeof h>"u")throw new Error(`unrecognized input '${s}' for node: ${e.name()}`);c.inputs.push(h),this._allData[h]._to.push(d)}}}checkIsAcyclic(){let t=new Set;this._allInputIndices.forEach(i=>{this._allData[i]._to.forEach(u=>{t.add(u)})});let r=Array.from(t),o=new Array(this._nodes.length).fill("white");for(;r.length>0;){let i=r.pop();o[i]==="gray"?o[i]="black":(r.push(i),o[i]="gray",this._nodes[i].outputs.forEach(u=>{let n=this._allData[u];if(typeof n.tensor<"u")throw new Error("node outputs should not be initialized");if(n._from!==i)throw new Error("from property of the Value object doesn't match index of Node being processed");n._to.forEach(a=>{if(o[a]==="gray")throw new Error("model graph is cyclic");o[a]==="white"&&r.push(a)})}))}}transformGraph(t){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),t&&t.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let t=0,r=new Array(this._nodes.length,0),o=0;for(let i=0;i<this._nodes.length;i++)r[i]=o,this._nodes[i].executeNode?(o!==i&&(this._nodes[o]=this._nodes[i]),o++):this._nodes[i].outputs.forEach(u=>{this._allData[u]._from=-2});this._nodes.splice(o,this._nodes.length-o);for(let i=0;i<this._allData.length;i++){let u=this._allData[i];u._from!==void 0&&u._from!==-1&&u._from!==-2&&(u._from=r[u._from]);for(let n=0;n<u._to.length;n++)if(u._to[n]>=0)u._to[n]=r[u._to[n]];else throw new Error("Trying to update a removed node")}t=0;for(let i=0;i<this._allData.length;i++){if(this._allData[i].from===-2&&this._allOutputIndices.indexOf(i+t)===-1){t++,this._allData.splice(i,1),i--;continue}if(t>0){let u=-1;this._allData[i].from!==void 0&&this._allData[i].from!==-1?(u=this._nodes[this._allData[i].from].outputs.indexOf(i+t),u!==-1&&(this._nodes[this._allData[i].from].outputs[u]=i)):(u=this._allInputIndices.indexOf(i+t),u!==-1&&(this._allInputIndices[u]=i)),this._allData[i].to.forEach(n=>{u=this._nodes[n].inputs.indexOf(i+t),u!==-1&&(this._nodes[n].inputs[u]=i)}),this._allData[i].to.length===0&&(u=this._allOutputIndices.indexOf(i+t),u!==-1&&(this._allOutputIndices[u]=i))}}}deleteNode(t){let r=this._nodes[t];if(r.outputs.length>1){for(let a=1;a<r.outputs.length;a++)if(this._allData[r.outputs[a]].to.length>0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}r.executeNode=!1;let o=r.inputs[0],i=r.outputs[0],u=this._allData[i].to;for(let a=0;a<r.inputs.length;a++){let d=this._allData[r.inputs[a]].to.indexOf(t);if(d===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[r.inputs[a]].to.splice(d,1)}this._allData[i]._to=[];let n=this._allOutputIndices.indexOf(i);if(n!==-1&&(this._allOutputIndices[n]=o),u&&u.length>0)for(let a of u){let d=this._nodes[a].inputs.indexOf(i);if(d===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[a].inputs[d]=o,this._allData[o].to.push(a)}}removeAllDropoutNodes(){let t=0;for(let 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(t)}t++}}removeAllIdentityNodes(){let t=0;for(let r of this._nodes)r.opType==="Identity"&&this.deleteNode(t),t++}isActivation(t){switch(t.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(let t of this._nodes)if(t.opType==="Conv"){let r=this._allData[t.outputs[0]]._to;if(r.length===1&&this.isActivation(this._nodes[r[0]])){let o=this._nodes[r[0]];if(o.opType==="Clip")if(o.inputs.length===1)try{t.attributes.set("activation_params","floats",[o.attributes.getFloat("min"),o.attributes.getFloat("max")])}catch{t.attributes.set("activation_params","floats",[Ve,ze])}else if(o.inputs.length>=3&&this._allData[o.inputs[1]].tensor!==void 0&&this._allData[o.inputs[2]].tensor!==void 0)t.attributes.set("activation_params","floats",[this._allData[o.inputs[1]].tensor.floatData[0],this._allData[o.inputs[2]].tensor.floatData[0]]);else continue;t.attributes.set("activation","string",o.opType),this.deleteNode(r[0])}}}}}),Dp,vg,eo,Lp=O(()=>{wn(),Ep(),Pr(),Dp=rr(sr()),Y(),vg=F.experimental.fbs,eo=class{constructor(){}load(t,r,o){let i;if(!o)try{this.loadFromOnnxFormat(t,r);return}catch(u){if(o!==void 0)throw u;i=u}try{this.loadFromOrtFormat(t,r)}catch(u){throw o!==void 0?u:new Error(`Failed to load model as ONNX format: ${i}
|
|
1806
|
+
as ORT format: ${u}`)}}loadFromOnnxFormat(t,r){let o=Dp.onnx.ModelProto.decode(t);if(Rt.longToNumber(o.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=o.opsetImport.map(i=>({domain:i.domain,version:Rt.longToNumber(i.version)})),this._graph=Wi.from(o.graph,r)}loadFromOrtFormat(t,r){let o=new w.ByteBuffer(t),i=vg.InferenceSession.getRootAsInferenceSession(o).model();if(Rt.longToNumber(i.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let u=0;u<i.opsetImportLength();u++){let n=i.opsetImport(u);this._opsets.push({domain:n==null?void 0:n.domain(),version:Rt.longToNumber(n.version())})}this._graph=Wi.from(i.graph(),r)}get graph(){return this._graph}get opsets(){return this._opsets}}}),ro,$p=O(()=>{Sp(),Ap(),Ut(),Lp(),ro=class{constructor(t={}){this._initialized=!1,this.backendHint=t.backendHint,this.profiler=xn.create(t.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(t,r,o){await this.profiler.event("session","Session.loadModel",async()=>{let i=await Mi(this.backendHint);if(this.sessionHandler=i.createSessionHandler(this.context),this._model=new eo,typeof t=="string"){let u=t.endsWith(".ort");{let n=await(await fetch(t)).arrayBuffer();this.initialize(new Uint8Array(n),u)}}else if(ArrayBuffer.isView(t))this.initialize(t);else{let u=new Uint8Array(t,r||0,o||t.byteLength);this.initialize(u)}})}initialize(t,r){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{let o=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(t,o,r),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new Zn(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(t){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{let r=this.normalizeAndValidateInputs(t),o=await this._executionPlan.execute(this.sessionHandler,r);return this.createOutput(o)})}normalizeAndValidateInputs(t){let r=this._model.graph.getInputNames();if(Array.isArray(t)){if(t.length!==r.length)throw new Error(`incorrect input array length: expected ${r.length} but got ${t.length}`)}else{if(t.size!==r.length)throw new Error(`incorrect input map size: expected ${r.length} but got ${t.size}`);let o=new Array(t.size),i=0;for(let u=0;u<r.length;++u){let n=t.get(r[u]);if(!n)throw new Error(`missing input tensor for: '${name}'`);o[i++]=n}t=o}if(!this.context.graphInputTypes||this.context.graphInputTypes.length===0||!this.context.graphInputDims||this.context.graphInputDims.length===0){let o=this._model.graph.getInputIndices(),i=this._model.graph.getValues(),u=new Array(o.length);for(let n=0;n<o.length;++n){let a=i[o[n]];u[n]=a.type.shape.dims,this.context.graphInputTypes.push(a.type.tensorType),this.context.graphInputDims.push(t[n].dims)}this.validateInputTensorDims(u,t,!0)}else this.validateInputTensorDims(this.context.graphInputDims,t,!1);return this.validateInputTensorTypes(this.context.graphInputTypes,t),t}validateInputTensorTypes(t,r){for(let o=0;o<r.length;o++){let i=t[o],u=r[o].type;if(i!==u)throw new Error(`input tensor[${o}] check failed: expected type '${i}' but got ${u}`)}}validateInputTensorDims(t,r,o){for(let i=0;i<r.length;i++){let u=t[i],n=r[i].dims;if(!this.compareTensorDims(u,n,o))throw new Error(`input tensor[${i}] check failed: expected shape '[${u.join(",")}]' but got [${n.join(",")}]`)}}compareTensorDims(t,r,o){if(t.length!==r.length)return!1;for(let i=0;i<t.length;++i)if(t[i]!==r[i]&&(!o||t[i]!==0))return!1;return!0}createOutput(t){let r=this._model.graph.getOutputNames();if(t.length!==r.length)throw new Error("expected number of outputs do not match number of generated outputs");let o=new Map;for(let i=0;i<r.length;++i)o.set(r[i],t[i]);return o}initializeOps(t){let r=t.getNodes();this._ops=new Array(r.length);for(let o=0;o<r.length;o++)this._ops[o]=this.sessionHandler.resolve(r[o],this._model.opsets,t)}}}),no,kp=O(()=>{Yt(),We(),no=class{constructor(t){this.session=t,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(t,r,o){let i=new Map;for(let a in t)if(Object.hasOwnProperty.call(t,a)){let d=t[a];i.set(a,new bt(d.dims,d.type,void 0,void 0,d.data))}let u=await this.session.run(i),n={};return u.forEach((a,d)=>{n[d]=new yt(a.type,a.data,a.dims)}),n}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}}),Bp={};Or(Bp,{onnxjsBackend:()=>Ig});var Hi,Ig,Fp=O(()=>{$p(),kp(),Hi=class{async init(){}async createInferenceSessionHandler(t,r){let o=new ro(r);return typeof t=="string"?await o.loadModel(t):await o.loadModel(t),new no(o)}},Ig=new Hi}),oo=O(()=>{}),Rp={};Or(Rp,{default:()=>_g});var Cp,Np,_g,Gp=O(()=>{var t;qi(),Ke(),Vr(),Cp="ort-wasm-proxy-worker",Np=((t=globalThis.self)==null?void 0:t.name)===Cp,Np&&(self.onmessage=r=>{let{type:o,in:i}=r.data;try{switch(o){case"init-wasm":io(i.wasm).then(()=>{ao(i).then(()=>{postMessage({type:o})},u=>{postMessage({type:o,err:u})})},u=>{postMessage({type:o,err:u})});break;case"init-ep":{let{epName:u,env:n}=i;so(n,u).then(()=>{postMessage({type:o})},a=>{postMessage({type:o,err:a})});break}case"copy-from":{let{buffer:u}=i,n=zr(u);postMessage({type:o,out:n});break}case"create":{let{model:u,options:n}=i;uo(u,n).then(a=>{postMessage({type:o,out:a})},a=>{postMessage({type:o,err:a})});break}case"release":lo(i),postMessage({type:o});break;case"run":{let{sessionId:u,inputIndices:n,inputs:a,outputIndices:d,options:c}=i;fo(u,n,a,d,new Array(d.length).fill(null),c).then(e=>{e.some(l=>l[3]!=="cpu")?postMessage({type:o,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:o,out:e},po([...a,...e]))},e=>{postMessage({type:o,err:e})});break}case"end-profiling":co(i),postMessage({type:o});break;default:}}catch(u){postMessage({type:o,err:u})}}),_g=Np?null:r=>new Worker(r??br,{type:"module",name:Cp})}),Up={};Or(Up,{default:()=>Og});var ji,Mp,Og,Vp=O(()=>{var t;Mp=(ji=_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("segmentation.js",document.baseURI).href,async function(r={}){function o(){return gt.buffer!=wt.buffer&&at(),wt}function i(){return gt.buffer!=wt.buffer&&at(),X}function u(){return gt.buffer!=wt.buffer&&at(),Wt}function n(){return gt.buffer!=wt.buffer&&at(),Le}function a(){return gt.buffer!=wt.buffer&&at(),se}var d,c,e=Object.assign({},r),l=new Promise((g,y)=>{d=g,c=y}),s=typeof window=="object",h=typeof importScripts=="function",f=h&&self.name=="em-pthread";e.mountExternalData=(g,y)=>{g.startsWith("./")&&(g=g.substring(2)),(e.Ua||(e.Ua=new Map)).set(g,y)},e.unmountExternalData=()=>{delete e.Ua};var m,v,_=globalThis.SharedArrayBuffer??new WebAssembly.Memory({initial:0,maximum:0,shared:!0}).buffer.constructor,I=Object.assign({},e),T="./this.program",P=(g,y)=>{throw y},C="";(s||h)&&(h?C=self.location.href:typeof document<"u"&&document.currentScript&&(C=document.currentScript.src),ji&&(C=ji),C=C.startsWith("blob:")?"":C.substr(0,C.replace(/[?#].*/,"").lastIndexOf("/")+1),h&&(v=g=>{var y=new XMLHttpRequest;return y.open("GET",g,!1),y.responseType="arraybuffer",y.send(null),new Uint8Array(y.response)}),m=(g,y,x)=>{var S=new XMLHttpRequest;S.open("GET",g,!0),S.responseType="arraybuffer",S.onload=()=>{S.status==200||S.status==0&&S.response?y(S.response):x()},S.onerror=x,S.send(null)});var R,ft=console.log.bind(console),lt=console.error.bind(console),Nt=ft,Q=lt;if(Object.assign(e,I),I=null,f){let g=function(y){try{var x=y.data,S=x.cmd;if(S==="load"){let E=[];self.onmessage=N=>E.push(N),self.startWorker=()=>{postMessage({cmd:"loaded"});for(let N of E)g(N);self.onmessage=g};for(let N of x.handlers)e[N]&&!e[N].proxy||(e[N]=(...L)=>{postMessage({Za:"callHandler",kb:N,args:L})},N=="print"&&(Nt=e[N]),N=="printErr"&&(Q=e[N]));gt=x.wasmMemory,at(),Pt(x.wasmModule)}else if(S==="run"){Zr(x.pthread_ptr,0,0,1,0,0),Dr(x.pthread_ptr),Pa(),Oo(),Ae||(Ae=!0);try{$a(x.start_routine,x.arg)}catch(E){if(E!="unwind")throw E}}else S==="cancel"?ue()&&ar(-1):x.target!=="setimmediate"&&(S==="checkMailbox"?Ae&&Qe():S&&(Q(`worker: received unknown command ${S}`),Q(x)))}catch(E){throw ma(),E}};var Pt,Ae=!1;Q=function(...y){y=y.join(" "),console.error(y)},self.alert=function(...y){postMessage({Za:"alert",text:y.join(" "),nb:ue()})},e.instantiateWasm=(y,x)=>new Promise(S=>{Pt=E=>{E=new WebAssembly.Instance(E,on()),x(E),S()}}),self.onunhandledrejection=y=>{throw y.reason||y},self.onmessage=g}e.wasmBinary&&(R=e.wasmBinary);var gt,De,Ft,wt,X,Wt,Le,_t,se,it=!1;function at(){var g=gt.buffer;e.HEAP8=wt=new Int8Array(g),e.HEAP16=new Int16Array(g),e.HEAPU8=X=new Uint8Array(g),e.HEAPU16=new Uint16Array(g),e.HEAP32=Wt=new Int32Array(g),e.HEAPU32=Le=new Uint32Array(g),e.HEAPF32=new Float32Array(g),e.HEAPF64=se=new Float64Array(g),e.HEAP64=_t=new BigInt64Array(g),e.HEAPU64=new BigUint64Array(g)}if(!f){if(!((gt=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0})).buffer instanceof _))throw Q("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"),Error("bad memory");at()}var re=[],Jt=[],Re=[],oe=0,Ot=null;function $t(){if(--oe==0&&Ot){var g=Ot;Ot=null,g()}}function Lt(g){throw Q(g="Aborted("+g+")"),it=!0,Ft=1,g=new WebAssembly.RuntimeError(g+". Build with -sASSERTIONS for more info."),c(g),g}var nt,st=g=>g.startsWith("data:application/octet-stream;base64,"),Mt=g=>g.startsWith("file://");function ce(g){if(g==nt&&R)return new Uint8Array(R);if(v)return v(g);throw"both async and sync fetching of the wasm failed"}function Ge(g,y,x){return function(S){if(!R&&(s||h)){if(typeof fetch=="function"&&!Mt(S))return fetch(S,{credentials:"same-origin"}).then(E=>{if(!E.ok)throw`failed to load wasm binary file at '${S}'`;return E.arrayBuffer()}).catch(()=>ce(S));if(m)return new Promise((E,N)=>{m(S,L=>E(new Uint8Array(L)),N)})}return Promise.resolve().then(()=>ce(S))}(g).then(S=>WebAssembly.instantiate(S,y)).then(x,S=>{Q(`failed to asynchronously prepare wasm: ${S}`),Lt(S)})}function on(){return{a:{j:Ia,b:Da,E:$o,g:ko,V:Fo,A:Bo,C:zo,W:Xo,T:Ko,L:Jo,S:Yo,o:Zo,B:Qo,y:ti,U:ri,z:ni,_:ka,Z:Na,P:Fa,w:Ca,F:La,k:Ra,O:Dr,Y:ja,I:Ba,J:Va,K:za,G:ra,H:na,v:Ma,q:Ua,l:Ga,p:Ha,e:qa,X:Wa,x:Xa,d:oa,f:Ka,i:Ja,u:Ya,t:Za,s:qs,Q:sa,R:la,D:Ir,h:ua,n:pa,M:da,m:ca,a:gt,r:Er,N:ga,c:Js}}}var vn={837620:(g,y,x,S,E)=>{if(e===void 0||!e.Ua)return 1;if((g=ge(g>>>0)).startsWith("./")&&(g=g.substring(2)),!(g=e.Ua.get(g)))return 2;if(S>>>=0,(y>>>=0)+(x>>>=0)>g.byteLength)return 3;try{let N=g.subarray(y,y+x);switch(E){case 0:i().set(N,S>>>0);break;case 1:e.mb(S,N);break;default:return 4}return 0}catch{return 4}},838303:()=>typeof wasmOffsetConverter<"u"};function Ia(){return typeof wasmOffsetConverter<"u"}function vr(g){this.name="ExitStatus",this.message=`Program terminated with exit(${g})`,this.status=g}var _r=g=>{g.terminate(),g.onmessage=()=>{}},_n=g=>{te.length==0&&(Eo(),So(te[0]));var y=te.pop();if(!y)return 6;ie.push(y),Dt[g.Ra]=y,y.Ra=g.Ra;var x={cmd:"run",start_routine:g.cb,arg:g.ab,pthread_ptr:g.Ra};return y.postMessage(x,g.ib),0},fe=0,Z=(g,y,...x)=>{for(var S=2*x.length,E=en(),N=tn(8*S),L=N>>>3,K=0;K<x.length;K++){var pt=x[K];typeof pt=="bigint"?(_t[L+2*K]=1n,_t[L+2*K+1]=pt):(_t[L+2*K]=0n,a()[L+2*K+1>>>0]=pt)}return g=ba(g,0,S,N,y),gr(E),g};function Er(g){if(f)return Z(0,1,g);if(Ft=g,!(0<fe)){for(var y of ie)_r(y);for(y of te)_r(y);te=[],ie=[],Dt=[],it=!0}P(g,new vr(g))}function On(g){if(f)return Z(1,0,g);Ir(g)}var Ir=g=>{if(Ft=g,f)throw On(g),"unwind";Er(g)},te=[],ie=[],In=[],Dt={},_o=g=>{var y=g.Ra;delete Dt[y],te.push(g),ie.splice(ie.indexOf(g),1),g.Ra=0,Qr(y)};function Oo(){In.forEach(g=>g())}var So=g=>new Promise(y=>{g.onmessage=E=>{var N=(E=E.data).cmd;if(E.targetThread&&E.targetThread!=ue()){var L=Dt[E.targetThread];L?L.postMessage(E,E.transferList):Q(`Internal error! Worker sent a message "${N}" to target pthread ${E.targetThread}, but that thread no longer exists!`)}else N==="checkMailbox"?Qe():N==="spawnThread"?_n(E):N==="cleanupThread"?_o(Dt[E.thread]):N==="killThread"?(E=E.thread,N=Dt[E],delete Dt[E],_r(N),Qr(E),ie.splice(ie.indexOf(N),1),N.Ra=0):N==="cancelThread"?Dt[E.thread].postMessage({cmd:"cancel"}):N==="loaded"?(g.loaded=!0,y(g)):N==="alert"?alert(`Thread ${E.threadId}: ${E.text}`):E.target==="setimmediate"?g.postMessage(E):N==="callHandler"?e[E.handler](...E.args):N&&Q(`worker sent an unknown command ${N}`)},g.onerror=E=>{throw Q(`worker sent an error! ${E.filename}:${E.lineno}: ${E.message}`),E};var x,S=[];for(x of[])e.hasOwnProperty(x)&&S.push(x);g.postMessage({cmd:"load",handlers:S,wasmMemory:gt,wasmModule:De})});function Eo(){var g=new Worker(new URL(_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("segmentation.js",document.baseURI).href),{type:"module",workerData:"em-pthread",name:"em-pthread"});te.push(g)}var Io,Ye=g=>{for(;0<g.length;)g.shift()(e)},Pa=()=>{var g=ue(),y=n()[g+52>>>2>>>0];g=n()[g+56>>>2>>>0],wa(y,y-g),gr(y)},Ze=[],$a=(g,y)=>{fe=0;var x=Ze[g];x||(g>=Ze.length&&(Ze.length=g+1),Ze[g]=x=Io.get(g)),g=x(y),0<fe?Ft=g:ar(g)};class Aa{constructor(y){this.Xa=y-24}}function Da(g,y,x){var S=new Aa(g>>>=0);throw y>>>=0,x>>>=0,n()[S.Xa+16>>>2>>>0]=0,n()[S.Xa+4>>>2>>>0]=y,n()[S.Xa+8>>>2>>>0]=x,g}function Po(g,y,x,S){return f?Z(2,1,g,y,x,S):$o(g,y,x,S)}function $o(g,y,x,S){if(g>>>=0,y>>>=0,x>>>=0,S>>>=0,_===void 0)return Q("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var E=[];return f&&E.length===0?Po(g,y,x,S):(g={cb:x,Ra:g,ab:S,ib:E},f?(g.Za="spawnThread",postMessage(g,E),0):_n(g))}var Ao=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Do=(g,y,x)=>{var S=(y>>>=0)+x;for(x=y;g[x]&&!(x>=S);)++x;if(16<x-y&&g.buffer&&Ao)return Ao.decode(g.buffer instanceof _?g.slice(y,x):g.subarray(y,x));for(S="";y<x;){var E=g[y++];if(128&E){var N=63&g[y++];if((224&E)==192)S+=String.fromCharCode((31&E)<<6|N);else{var L=63&g[y++];65536>(E=(240&E)==224?(15&E)<<12|N<<6|L:(7&E)<<18|N<<12|L<<6|63&g[y++])?S+=String.fromCharCode(E):(E-=65536,S+=String.fromCharCode(55296|E>>10,56320|1023&E))}}else S+=String.fromCharCode(E)}return S},ge=(g,y)=>(g>>>=0)?Do(i(),g,y):"";function ko(g,y,x){return f?Z(3,1,g,y,x):0}function Fo(g,y){if(f)return Z(4,1,g,y)}var Lo=g=>{for(var y=0,x=0;x<g.length;++x){var S=g.charCodeAt(x);127>=S?y++:2047>=S?y+=2:55296<=S&&57343>=S?(y+=4,++x):y+=3}return y},jo=(g,y,x,S)=>{if(!(0<S))return 0;var E=x>>>=0;S=x+S-1;for(var N=0;N<g.length;++N){var L=g.charCodeAt(N);if(55296<=L&&57343>=L&&(L=65536+((1023&L)<<10)|1023&g.charCodeAt(++N)),127>=L){if(x>=S)break;y[x++>>>0]=L}else{if(2047>=L){if(x+1>=S)break;y[x++>>>0]=192|L>>6}else{if(65535>=L){if(x+2>=S)break;y[x++>>>0]=224|L>>12}else{if(x+3>=S)break;y[x++>>>0]=240|L>>18,y[x++>>>0]=128|L>>12&63}y[x++>>>0]=128|L>>6&63}y[x++>>>0]=128|63&L}}return y[x>>>0]=0,x-E},be=(g,y,x)=>jo(g,i(),y,x);function Bo(g,y){if(f)return Z(5,1,g,y)}function zo(g,y,x){if(f)return Z(6,1,g,y,x)}function Xo(g,y,x){return f?Z(7,1,g,y,x):0}function Ko(g,y){if(f)return Z(8,1,g,y)}function Jo(g,y,x){if(f)return Z(9,1,g,y,x)}function Yo(g,y,x,S){if(f)return Z(10,1,g,y,x,S)}function Zo(g,y,x,S){if(f)return Z(11,1,g,y,x,S)}function Qo(g,y,x,S){if(f)return Z(12,1,g,y,x,S)}function ti(g){if(f)return Z(13,1,g)}function ri(g,y){if(f)return Z(14,1,g,y)}function ni(g,y,x){if(f)return Z(15,1,g,y,x)}var ka=()=>{Lt("")},Na=()=>1;function Fa(g){Zr(g>>>0,!h,1,!s,131072,!1),Oo()}function Dr(g){g>>>=0,typeof Atomics.jb=="function"&&(Atomics.jb(u(),g>>>2,g).value.then(Qe),g+=128,Atomics.store(u(),g>>>2,1))}var Qe=()=>{var g=ue();if(g&&(Dr(g),g=ya,!it))try{if(g(),!(0<fe))try{f?ar(Ft):Ir(Ft)}catch(y){y instanceof vr||y=="unwind"||P(1,y)}}catch(y){y instanceof vr||y=="unwind"||P(1,y)}};function Ca(g,y){(g>>>=0)==y>>>0?setTimeout(Qe):f?postMessage({targetThread:g,cmd:"checkMailbox"}):(g=Dt[g])&&g.postMessage({cmd:"checkMailbox"})}var Lr=[];function La(g,y,x,S,E){for(y>>>=0,S/=2,Lr.length=S,x=E>>>0>>>3,E=0;E<S;E++)Lr[E]=_t[x+2*E]?_t[x+2*E+1]:a()[x+2*E+1>>>0];return(y?vn[y]:Zs[g])(...Lr)}function Ra(g){g>>>=0,f?postMessage({cmd:"cleanupThread",thread:g}):_o(Dt[g])}function ja(g){}function Ba(g,y){g=-9007199254740992>g||9007199254740992<g?NaN:Number(g),y>>>=0,g=new Date(1e3*g),u()[y>>>2>>>0]=g.getUTCSeconds(),u()[y+4>>>2>>>0]=g.getUTCMinutes(),u()[y+8>>>2>>>0]=g.getUTCHours(),u()[y+12>>>2>>>0]=g.getUTCDate(),u()[y+16>>>2>>>0]=g.getUTCMonth(),u()[y+20>>>2>>>0]=g.getUTCFullYear()-1900,u()[y+24>>>2>>>0]=g.getUTCDay(),g=(g.getTime()-Date.UTC(g.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,u()[y+28>>>2>>>0]=g}var le=g=>g%4==0&&(g%100!=0||g%400==0),ii=[0,31,60,91,121,152,182,213,244,274,305,335],ea=[0,31,59,90,120,151,181,212,243,273,304,334];function Va(g,y){g=-9007199254740992>g||9007199254740992<g?NaN:Number(g),y>>>=0,g=new Date(1e3*g),u()[y>>>2>>>0]=g.getSeconds(),u()[y+4>>>2>>>0]=g.getMinutes(),u()[y+8>>>2>>>0]=g.getHours(),u()[y+12>>>2>>>0]=g.getDate(),u()[y+16>>>2>>>0]=g.getMonth(),u()[y+20>>>2>>>0]=g.getFullYear()-1900,u()[y+24>>>2>>>0]=g.getDay();var x=(le(g.getFullYear())?ii:ea)[g.getMonth()]+g.getDate()-1|0;u()[y+28>>>2>>>0]=x,u()[y+36>>>2>>>0]=-60*g.getTimezoneOffset(),x=new Date(g.getFullYear(),6,1).getTimezoneOffset();var S=new Date(g.getFullYear(),0,1).getTimezoneOffset();g=0|(x!=S&&g.getTimezoneOffset()==Math.min(S,x)),u()[y+32>>>2>>>0]=g}function za(g){g>>>=0;var y=new Date(u()[g+20>>>2>>>0]+1900,u()[g+16>>>2>>>0],u()[g+12>>>2>>>0],u()[g+8>>>2>>>0],u()[g+4>>>2>>>0],u()[g>>>2>>>0],0),x=u()[g+32>>>2>>>0],S=y.getTimezoneOffset(),E=new Date(y.getFullYear(),6,1).getTimezoneOffset(),N=new Date(y.getFullYear(),0,1).getTimezoneOffset(),L=Math.min(N,E);return 0>x?u()[g+32>>>2>>>0]=+(E!=N&&L==S):0<x!=(L==S)&&(E=Math.max(N,E),y.setTime(y.getTime()+6e4*((0<x?L:E)-S))),u()[g+24>>>2>>>0]=y.getDay(),x=(le(y.getFullYear())?ii:ea)[y.getMonth()]+y.getDate()-1|0,u()[g+28>>>2>>>0]=x,u()[g>>>2>>>0]=y.getSeconds(),u()[g+4>>>2>>>0]=y.getMinutes(),u()[g+8>>>2>>>0]=y.getHours(),u()[g+12>>>2>>>0]=y.getDate(),u()[g+16>>>2>>>0]=y.getMonth(),u()[g+20>>>2>>>0]=y.getYear(),g=y.getTime(),BigInt(isNaN(g)?-1:g/1e3)}function ra(g,y,x,S,E,N,L){return f?Z(16,1,g,y,x,S,E,N,L):-52}function na(g,y,x,S,E,N){if(f)return Z(17,1,g,y,x,S,E,N)}function Ma(g,y,x,S){g>>>=0,y>>>=0,x>>>=0,S>>>=0;var E=new Date().getFullYear(),N=new Date(E,0,1),L=new Date(E,6,1);E=N.getTimezoneOffset();var K=L.getTimezoneOffset(),pt=Math.max(E,K);n()[g>>>2>>>0]=60*pt,u()[y>>>2>>>0]=+(E!=K),N=(g=ct=>ct.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1])(N),L=g(L),K<E?(be(N,x,17),be(L,S,17)):(be(N,S,17),be(L,x,17))}var Kr=[];function Ua(g,y,x){g>>>=0,y>>>=0,x>>>=0,Kr.length=0;for(var S;S=i()[y++>>>0];){var E=S!=105;x+=(E&=S!=112)&&x%8?4:0,Kr.push(S==112?n()[x>>>2>>>0]:S==106?_t[x>>>3]:S==105?u()[x>>>2>>>0]:a()[x>>>3>>>0]),x+=E?8:4}return vn[g](...Kr)}var Ga=()=>{},Ha=()=>Date.now();function qa(g,y){return Q(ge(g>>>0,y>>>0))}var oa,Wa=()=>{throw fe+=1,"unwind"};function Xa(){return 4294901760}oa=()=>performance.timeOrigin+performance.now();var Ka=()=>navigator.hardwareConcurrency;function Ja(){return Lt("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER"),0}function Ya(g){g>>>=0;var y=i().length;if(g<=y||4294901760<g)return!1;for(var x=1;4>=x;x*=2){var S=y*(1+.2/x);S=Math.min(S,g+100663296);var E=Math;S=Math.max(g,S);t:{E=(E.min.call(E,4294901760,S+(65536-S%65536)%65536)-gt.buffer.byteLength+65535)/65536;try{gt.grow(E),at();var N=1;break t}catch{}N=void 0}if(N)return!0}return!1}var tr=()=>(Lt("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER"),0),we={},ia=g=>{g.forEach(y=>{tr()})};function Za(){var g=Error().stack.toString().split(`
|
|
1807
|
+
`);return g[0]=="Error"&&g.shift(),ia(g),we.$a=tr(),we.bb=g,we.$a}function qs(g,y,x){if(g>>>=0,y>>>=0,we.$a==g)var S=we.bb;else(S=Error().stack.toString().split(`
|
|
1808
|
+
`))[0]=="Error"&&S.shift(),ia(S);for(var E=3;S[E]&&tr()!=g;)++E;for(g=0;g<x&&S[g+E];++g)u()[y+4*g>>>2>>>0]=tr();return g}var Jr,Yr={},aa=()=>{if(!Jr){var g,y={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",_:T};for(g in Yr)Yr[g]===void 0?delete y[g]:y[g]=Yr[g];var x=[];for(g in y)x.push(`${g}=${y[g]}`);Jr=x}return Jr};function sa(g,y){if(f)return Z(18,1,g,y);g>>>=0,y>>>=0;var x=0;return aa().forEach((S,E)=>{var N=y+x;for(E=n()[g+4*E>>>2>>>0]=N,N=0;N<S.length;++N)o()[E++>>>0]=S.charCodeAt(N);o()[E>>>0]=0,x+=S.length+1}),0}function la(g,y){if(f)return Z(19,1,g,y);g>>>=0,y>>>=0;var x=aa();n()[g>>>2>>>0]=x.length;var S=0;return x.forEach(E=>S+=E.length+1),n()[y>>>2>>>0]=S,0}function ua(g){return f?Z(20,1,g):52}function pa(g,y,x,S){return f?Z(21,1,g,y,x,S):52}function da(g,y,x,S){return f?Z(22,1,g,y,x,S):70}var Xs=[null,[],[]];function ca(g,y,x,S){if(f)return Z(23,1,g,y,x,S);y>>>=0,x>>>=0,S>>>=0;for(var E=0,N=0;N<x;N++){var L=n()[y>>>2>>>0],K=n()[y+4>>>2>>>0];y+=8;for(var pt=0;pt<K;pt++){var ct=i()[L+pt>>>0],vt=Xs[g];ct===0||ct===10?((g===1?Nt:Q)(Do(vt,0)),vt.length=0):vt.push(ct)}E+=K}return n()[S>>>2>>>0]=E,0}var ha=[31,29,31,30,31,30,31,31,30,31,30,31],fa=[31,28,31,30,31,30,31,31,30,31,30,31],Ks=(g,y)=>{o().set(g,y>>>0)};function ga(g,y,x,S){function E($,M,et){for($=typeof $=="number"?$.toString():$||"";$.length<M;)$=et[0]+$;return $}function N($,M){return E($,M,"0")}function L($,M){function et(_a){return 0>_a?-1:0<_a?1:0}var ae;return(ae=et($.getFullYear()-M.getFullYear()))===0&&(ae=et($.getMonth()-M.getMonth()))===0&&(ae=et($.getDate()-M.getDate())),ae}function K($){switch($.getDay()){case 0:return new Date($.getFullYear()-1,11,29);case 1:return $;case 2:return new Date($.getFullYear(),0,3);case 3:return new Date($.getFullYear(),0,2);case 4:return new Date($.getFullYear(),0,1);case 5:return new Date($.getFullYear()-1,11,31);case 6:return new Date($.getFullYear()-1,11,30)}}function pt($){var M=$.Sa;for($=new Date(new Date($.Ta+1900,0,1).getTime());0<M;){var et=$.getMonth(),ae=(le($.getFullYear())?ha:fa)[et];if(!(M>ae-$.getDate())){$.setDate($.getDate()+M);break}M-=ae-$.getDate()+1,$.setDate(1),11>et?$.setMonth(et+1):($.setMonth(0),$.setFullYear($.getFullYear()+1))}return et=new Date($.getFullYear()+1,0,4),M=K(new Date($.getFullYear(),0,4)),et=K(et),0>=L(M,$)?0>=L(et,$)?$.getFullYear()+1:$.getFullYear():$.getFullYear()-1}g>>>=0,y>>>=0,x>>>=0,S>>>=0;var ct=n()[S+40>>>2>>>0];for(var vt in S={gb:u()[S>>>2>>>0],fb:u()[S+4>>>2>>>0],Va:u()[S+8>>>2>>>0],Ya:u()[S+12>>>2>>>0],Wa:u()[S+16>>>2>>>0],Ta:u()[S+20>>>2>>>0],Qa:u()[S+24>>>2>>>0],Sa:u()[S+28>>>2>>>0],ob:u()[S+32>>>2>>>0],eb:u()[S+36>>>2>>>0],hb:ct?ge(ct):""},x=ge(x),ct={"%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"})x=x.replace(new RegExp(vt,"g"),ct[vt]);var xa="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Ta="January February March April May June July August September October November December".split(" ");for(vt in ct={"%a":$=>xa[$.Qa].substring(0,3),"%A":$=>xa[$.Qa],"%b":$=>Ta[$.Wa].substring(0,3),"%B":$=>Ta[$.Wa],"%C":$=>N(($.Ta+1900)/100|0,2),"%d":$=>N($.Ya,2),"%e":$=>E($.Ya,2," "),"%g":$=>pt($).toString().substring(2),"%G":pt,"%H":$=>N($.Va,2),"%I":$=>(($=$.Va)==0?$=12:12<$&&($-=12),N($,2)),"%j":$=>{for(var M=0,et=0;et<=$.Wa-1;M+=(le($.Ta+1900)?ha:fa)[et++]);return N($.Ya+M,3)},"%m":$=>N($.Wa+1,2),"%M":$=>N($.fb,2),"%n":()=>`
|
|
1809
|
+
`,"%p":$=>0<=$.Va&&12>$.Va?"AM":"PM","%S":$=>N($.gb,2),"%t":()=>" ","%u":$=>$.Qa||7,"%U":$=>N(Math.floor(($.Sa+7-$.Qa)/7),2),"%V":$=>{var M=Math.floor(($.Sa+7-($.Qa+6)%7)/7);if(2>=($.Qa+371-$.Sa-2)%7&&M++,M)M==53&&((et=($.Qa+371-$.Sa)%7)==4||et==3&&le($.Ta)||(M=1));else{M=52;var et=($.Qa+7-$.Sa-1)%7;(et==4||et==5&&le($.Ta%400-1))&&M++}return N(M,2)},"%w":$=>$.Qa,"%W":$=>N(Math.floor(($.Sa+7-($.Qa+6)%7)/7),2),"%y":$=>($.Ta+1900).toString().substring(2),"%Y":$=>$.Ta+1900,"%z":$=>{var M=0<=($=$.eb);return $=Math.abs($)/60,(M?"+":"-")+("0000"+($/60*100+$%60)).slice(-4)},"%Z":$=>$.hb,"%%":()=>"%"},x=x.replace(/%%/g,"\0\0"),ct)x.includes(vt)&&(x=x.replace(new RegExp(vt,"g"),ct[vt](S)));return vt=function($){var M=Array(Lo($)+1);return jo($,M,0,M.length),M}(x=x.replace(/\0\0/g,"%")),vt.length>y?0:(Ks(vt,g),vt.length-1)}function Js(g,y,x,S){return ga(g>>>0,y>>>0,x>>>0,S>>>0)}f||function(){for(var g=e.numThreads-1;g--;)Eo();re.unshift(()=>{oe++,function(y){f?y():Promise.all(te.map(So)).then(y)}(()=>$t())})}();var Zs=[Er,On,Po,ko,Fo,Bo,zo,Xo,Ko,Jo,Yo,Zo,Qo,ti,ri,ni,ra,na,sa,la,ua,pa,da,ca],V=function(){function g(x,S){return V=x.exports,V=function(){var E=V,N=K=>()=>K()>>>0,L=K=>pt=>K(pt)>>>0;return(E=Object.assign({},E)).Ba=N(E.Ba),E.Ca=L(E.Ca),E.emscripten_main_runtime_thread_id=N(E.emscripten_main_runtime_thread_id),E.Oa=L(E.Oa),E.Pa=N(E.Pa),E}(),In.push(V.Ea),Io=V.Fa,Jt.unshift(V.$),De=S,$t(),V}var y=on();if(oe++,e.instantiateWasm)try{return e.instantiateWasm(y,g)}catch(x){Q(`Module.instantiateWasm callback failed with error: ${x}`),c(x)}return nt||(nt=e.locateFile?st("ort-wasm-simd-threaded.wasm")?"ort-wasm-simd-threaded.wasm":e.locateFile?e.locateFile("ort-wasm-simd-threaded.wasm",C):C+"ort-wasm-simd-threaded.wasm":""),function(x,S){var E=nt;return R||typeof WebAssembly.instantiateStreaming!="function"||st(E)||Mt(E)||typeof fetch!="function"?Ge(E,x,S):fetch(E,{credentials:"same-origin"}).then(N=>WebAssembly.instantiateStreaming(N,x).then(S,function(L){return Q(`wasm streaming compile failed: ${L}`),Q("falling back to ArrayBuffer instantiation"),Ge(E,x,S)}))}(y,function(x){g(x.instance,x.module)}).catch(c),{}}();e._OrtInit=(g,y)=>(e._OrtInit=V.aa)(g,y),e._OrtGetLastError=(g,y)=>(e._OrtGetLastError=V.ba)(g,y),e._OrtCreateSessionOptions=(g,y,x,S,E,N,L,K,pt,ct)=>(e._OrtCreateSessionOptions=V.ca)(g,y,x,S,E,N,L,K,pt,ct),e._OrtAppendExecutionProvider=(g,y)=>(e._OrtAppendExecutionProvider=V.da)(g,y),e._OrtAddFreeDimensionOverride=(g,y,x)=>(e._OrtAddFreeDimensionOverride=V.ea)(g,y,x),e._OrtAddSessionConfigEntry=(g,y,x)=>(e._OrtAddSessionConfigEntry=V.fa)(g,y,x),e._OrtReleaseSessionOptions=g=>(e._OrtReleaseSessionOptions=V.ga)(g),e._OrtCreateSession=(g,y,x)=>(e._OrtCreateSession=V.ha)(g,y,x),e._OrtReleaseSession=g=>(e._OrtReleaseSession=V.ia)(g),e._OrtGetInputOutputCount=(g,y,x)=>(e._OrtGetInputOutputCount=V.ja)(g,y,x),e._OrtGetInputName=(g,y)=>(e._OrtGetInputName=V.ka)(g,y),e._OrtGetOutputName=(g,y)=>(e._OrtGetOutputName=V.la)(g,y),e._OrtFree=g=>(e._OrtFree=V.ma)(g),e._OrtCreateTensor=(g,y,x,S,E,N)=>(e._OrtCreateTensor=V.na)(g,y,x,S,E,N),e._OrtGetTensorData=(g,y,x,S,E)=>(e._OrtGetTensorData=V.oa)(g,y,x,S,E),e._OrtReleaseTensor=g=>(e._OrtReleaseTensor=V.pa)(g),e._OrtCreateRunOptions=(g,y,x,S)=>(e._OrtCreateRunOptions=V.qa)(g,y,x,S),e._OrtAddRunConfigEntry=(g,y,x)=>(e._OrtAddRunConfigEntry=V.ra)(g,y,x),e._OrtReleaseRunOptions=g=>(e._OrtReleaseRunOptions=V.sa)(g),e._OrtCreateBinding=g=>(e._OrtCreateBinding=V.ta)(g),e._OrtBindInput=(g,y,x)=>(e._OrtBindInput=V.ua)(g,y,x),e._OrtBindOutput=(g,y,x,S)=>(e._OrtBindOutput=V.va)(g,y,x,S),e._OrtClearBoundOutputs=g=>(e._OrtClearBoundOutputs=V.wa)(g),e._OrtReleaseBinding=g=>(e._OrtReleaseBinding=V.xa)(g),e._OrtRunWithBinding=(g,y,x,S,E)=>(e._OrtRunWithBinding=V.ya)(g,y,x,S,E),e._OrtRun=(g,y,x,S,E,N,L,K)=>(e._OrtRun=V.za)(g,y,x,S,E,N,L,K),e._OrtEndProfiling=g=>(e._OrtEndProfiling=V.Aa)(g);var ue=()=>(ue=V.Ba)();e._malloc=g=>(e._malloc=V.Ca)(g),e._free=g=>(e._free=V.Da)(g);var er,Zr=(g,y,x,S,E,N)=>(Zr=V.Ga)(g,y,x,S,E,N),ma=()=>(ma=V.Ha)(),ba=(g,y,x,S,E)=>(ba=V.Ia)(g,y,x,S,E),Qr=g=>(Qr=V.Ja)(g),ar=g=>(ar=V.Ka)(g),ya=()=>(ya=V.La)(),wa=(g,y)=>(wa=V.Ma)(g,y),gr=g=>(gr=V.Na)(g),tn=g=>(tn=V.Oa)(g),en=()=>(en=V.Pa)();function va(){0<oe||(f?(d(e),f||Ye(Jt),startWorker(e)):(Ye(re),0<oe||er||(er=!0,e.calledRun=!0,it||(f||Ye(Jt),d(e),f||Ye(Re)))))}return e.___start_em_js=838360,e.___stop_em_js=838421,e.stackSave=()=>en(),e.stackRestore=g=>gr(g),e.stackAlloc=g=>tn(g),e.UTF8ToString=ge,e.stringToUTF8=be,e.lengthBytesUTF8=Lo,Ot=function g(){er||va(),er||(Ot=g)},va(),l}),Og=Mp,((t=globalThis.self)==null?void 0:t.name)==="em-pthread"&&Mp()}),br,Sg,Ag,Pg,zp,Wp,Eg,Hp,Vr=O(()=>{var t,r;oo(),br=(_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("segmentation.js",document.baseURI).href)??(typeof document<"u"?(t=document.currentScript)==null?void 0:t.src:typeof self<"u"?(r=self.location)==null?void 0:r.href:void 0),Sg=typeof location>"u"?void 0:location.origin,Ag=(o,i)=>{try{let u=i??br;return(u?new URL(o,u):new URL(o)).origin===Sg}catch{return!1}},Pg=async o=>{let i=await(await fetch(o,{credentials:"same-origin"})).blob();return URL.createObjectURL(i)},zp=(Gp(),sn(Rp)).default,Wp=async()=>{if(!br)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(Ag(br))return[void 0,zp()];let o=await Pg(br);return[o,zp(o)]},Eg=(Vp(),sn(Up)).default,Hp=async(o,i,u)=>[void 0,Eg]}),Xi,Ki,ho,qp,Dg,Lg,io,xt,Ke=O(()=>{Vr(),Ki=!1,ho=!1,qp=!1,Dg=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},Lg=()=>{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}},io=async t=>{if(Ki)return Promise.resolve();if(ho)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(qp)throw new Error("previous call to 'initializeWebAssembly()' failed.");ho=!0;let r=t.initTimeout,o=t.numThreads;if(!Lg())throw new Error("WebAssembly SIMD is not supported in the current environment.");let i=Dg();o>1&&!i&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+o+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),t.numThreads=o=1);let u=t.wasmPaths,n=typeof u=="string"?u:void 0,a=u==null?void 0:u.mjs,d=(a==null?void 0:a.href)??a,c=u==null?void 0:u.wasm,e=(c==null?void 0:c.href)??c,l=t.wasmBinary,[s,h]=await Hp(d,n,o>1),f=!1,m=[];if(r>0&&m.push(new Promise(v=>{setTimeout(()=>{f=!0,v()},r)})),m.push(new Promise((v,_)=>{let I={numThreads:o};l?I.wasmBinary=l:(e||n)&&(I.locateFile=(T,P)=>e??(n??P)+T),h(I).then(T=>{ho=!1,Ki=!0,Xi=T,v(),s&&URL.revokeObjectURL(s)},T=>{ho=!1,qp=!0,_(T)})})),await Promise.race(m),f)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},xt=()=>{if(Ki&&Xi)return Xi;throw new Error("WebAssembly is not initialized yet.")}}),Tt,Wr,ht,mo=O(()=>{Ke(),Tt=(t,r)=>{let o=xt(),i=o.lengthBytesUTF8(t)+1,u=o._malloc(i);return o.stringToUTF8(t,u,i),r.push(u),u},Wr=(t,r,o,i)=>{if(typeof t=="object"&&t!==null){if(o.has(t))throw new Error("Circular reference in options");o.add(t)}Object.entries(t).forEach(([u,n])=>{let a=r?r+u:u;if(typeof n=="object")Wr(n,a+".",o,i);else if(typeof n=="string"||typeof n=="number")i(a,n.toString());else if(typeof n=="boolean")i(a,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},ht=t=>{let r=xt(),o=r.stackSave();try{let i=r.stackAlloc(8);r._OrtGetLastError(i,i+4);let u=r.HEAP32[i/4],n=r.HEAPU32[i/4+1],a=n?r.UTF8ToString(n):"";throw new Error(`${t} ERROR_CODE: ${u}, ERROR_MESSAGE: ${a}`)}finally{r.stackRestore(o)}}}),jp,Xp=O(()=>{Ke(),mo(),jp=t=>{let r=xt(),o=0,i=[],u=t||{};try{if((t==null?void 0:t.logSeverityLevel)===void 0)u.logSeverityLevel=2;else if(typeof t.logSeverityLevel!="number"||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if((t==null?void 0:t.logVerbosityLevel)===void 0)u.logVerbosityLevel=0;else if(typeof t.logVerbosityLevel!="number"||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);(t==null?void 0:t.terminate)===void 0&&(u.terminate=!1);let n=0;return(t==null?void 0:t.tag)!==void 0&&(n=Tt(t.tag,i)),o=r._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,n),o===0&&ht("Can't create run options."),(t==null?void 0:t.extra)!==void 0&&Wr(t.extra,"",new WeakSet,(a,d)=>{let c=Tt(a,i),e=Tt(d,i);r._OrtAddRunConfigEntry(o,c,e)!==0&&ht(`Can't set a run config entry: ${a} - ${d}.`)}),[o,i]}catch(n){throw o!==0&&r._OrtReleaseRunOptions(o),i.forEach(a=>r._free(a)),n}}}),$g,kg,Bg,Fg,Kp,Jp=O(()=>{Ke(),mo(),$g=t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}},kg=t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}},Bg=t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});let r=t.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),t.executionProviders&&t.executionProviders.some(o=>(typeof o=="string"?o:o.name)==="webgpu")&&(t.enableMemPattern=!1)},Fg=(t,r,o)=>{for(let i of r){let u=typeof i=="string"?i:i.name;switch(u){case"webnn":if(u="WEBNN",typeof i!="string"){let a=i==null?void 0:i.deviceType;if(a){let d=Tt("deviceType",o),c=Tt(a,o);xt()._OrtAddSessionConfigEntry(t,d,c)!==0&&ht(`Can't set a session config entry: 'deviceType' - ${a}.`)}}break;case"webgpu":if(u="JS",typeof i!="string"){let a=i;if(a!=null&&a.preferredLayout){if(a.preferredLayout!=="NCHW"&&a.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${a.preferredLayout}`);let d=Tt("preferredLayout",o),c=Tt(a.preferredLayout,o);xt()._OrtAddSessionConfigEntry(t,d,c)!==0&&ht(`Can't set a session config entry: 'preferredLayout' - ${a.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${u}`)}let n=Tt(u,o);xt()._OrtAppendExecutionProvider(t,n)!==0&&ht(`Can't append execution provider: ${u}.`)}},Kp=t=>{let r=xt(),o=0,i=[],u=t||{};Bg(u);try{let n=$g(u.graphOptimizationLevel??"all"),a=kg(u.executionMode??"sequential"),d=typeof u.logId=="string"?Tt(u.logId,i):0,c=u.logSeverityLevel??2;if(!Number.isInteger(c)||c<0||c>4)throw new Error(`log serverity level is not valid: ${c}`);let e=u.logVerbosityLevel??0;if(!Number.isInteger(e)||e<0||e>4)throw new Error(`log verbosity level is not valid: ${e}`);let l=typeof u.optimizedModelFilePath=="string"?Tt(u.optimizedModelFilePath,i):0;if(o=r._OrtCreateSessionOptions(n,!!u.enableCpuMemArena,!!u.enableMemPattern,a,!!u.enableProfiling,0,d,c,e,l),o===0&&ht("Can't create session options."),u.executionProviders&&Fg(o,u.executionProviders,i),u.enableGraphCapture!==void 0){if(typeof u.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${u.enableGraphCapture}`);let s=Tt("enableGraphCapture",i),h=Tt(u.enableGraphCapture.toString(),i);r._OrtAddSessionConfigEntry(o,s,h)!==0&&ht(`Can't set a session config entry: 'enableGraphCapture' - ${u.enableGraphCapture}.`)}if(u.freeDimensionOverrides)for(let[s,h]of Object.entries(u.freeDimensionOverrides)){if(typeof s!="string")throw new Error(`free dimension override name must be a string: ${s}`);if(typeof h!="number"||!Number.isInteger(h)||h<0)throw new Error(`free dimension override value must be a non-negative integer: ${h}`);let f=Tt(s,i);r._OrtAddFreeDimensionOverride(o,f,h)!==0&&ht(`Can't set a free dimension override: ${s} - ${h}.`)}return u.extra!==void 0&&Wr(u.extra,"",new WeakSet,(s,h)=>{let f=Tt(s,i),m=Tt(h,i);r._OrtAddSessionConfigEntry(o,f,m)!==0&&ht(`Can't set a session config entry: ${s} - ${h}.`)}),[o,i]}catch(n){throw o!==0&&r._OrtReleaseSessionOptions(o),i.forEach(a=>r._free(a)),n}}}),Hr,Yp,qr,Zp,Qp,bo,go,td,Ji=O(()=>{Hr=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${t}`)}},Yp=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${t}`)}},qr=(t,r)=>{let o=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][t],i=typeof r=="number"?r:r.reduce((u,n)=>u*n,1);return o>0?Math.ceil(i*o):void 0},Zp=t=>{switch(t){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}},Qp=t=>{switch(t){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${t}`)}},bo=t=>t==="float32"||t==="float16"||t==="int32"||t==="int64"||t==="uint32"||t==="uint8"||t==="bool"||t==="uint4"||t==="int4",go=t=>t==="float32"||t==="float16"||t==="int32"||t==="int64"||t==="uint32"||t==="uint64"||t==="int8"||t==="uint8"||t==="bool",td=t=>{switch(t){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${t}`)}}}),jr,Yi=O(()=>{oo(),jr=async t=>{if(typeof t=="string"){let r=await fetch(t);if(!r.ok)throw new Error(`failed to load external data file: ${t}`);let o=r.headers.get("Content-Length"),i=o?parseInt(o,10):0;if(i<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${t}, no response body.`);let u=r.body.getReader(),n;try{n=new ArrayBuffer(i)}catch(d){if(d instanceof RangeError){let c=Math.ceil(i/65536);n=new WebAssembly.Memory({initial:c,maximum:c}).buffer}else throw d}let a=0;for(;;){let{done:d,value:c}=await u.read();if(d)break;let e=c.byteLength;new Uint8Array(n,a,e).set(c),a+=e}return new Uint8Array(n,0,i)}}else return t instanceof Blob?new Uint8Array(await t.arrayBuffer()):t instanceof Uint8Array?t:new Uint8Array(t)}}),Cg,ao,so,yr,Ng,zr,uo,lo,ed,fo,co,po,qi=O(()=>{Xp(),Jp(),Ji(),Ke(),mo(),Yi(),Cg=(t,r)=>{xt()._OrtInit(t,r)!==0&&ht("Can't initialize onnxruntime.")},ao=async t=>{Cg(t.wasm.numThreads,Qp(t.logLevel))},so=async(t,r)=>{},yr=new Map,Ng=t=>{let r=xt(),o=r.stackSave();try{let i=r.stackAlloc(8);return r._OrtGetInputOutputCount(t,i,i+4)!==0&&ht("Can't get session input/output count."),[r.HEAP32[i/4],r.HEAP32[i/4+1]]}finally{r.stackRestore(o)}},zr=t=>{let r=xt(),o=r._malloc(t.byteLength);if(o===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${t.byteLength}.`);return r.HEAPU8.set(t,o),[o,t.byteLength]},uo=async(t,r)=>{var l;let o,i,u=xt();Array.isArray(t)?[o,i]=t:t.buffer===u.HEAPU8.buffer?[o,i]=[t.byteOffset,t.byteLength]:[o,i]=zr(t);let n=0,a=0,d=[],c=[],e=[];try{if([a,d]=Kp(r),(r==null?void 0:r.externalData)&&u.mountExternalData){let T=[];for(let P of r.externalData){let C=typeof P=="string"?P:P.path;T.push(jr(typeof P=="string"?P:P.data).then(R=>{u.mountExternalData(C,R)}))}await Promise.all(T)}for(let T of(r==null?void 0:r.executionProviders)??[])if((typeof T=="string"?T:T.name)==="webnn"){if(u.shouldTransferToMLTensor=!1,u.currentContext)throw new Error("WebNN execution provider is already set.");if(typeof T!="string"){let P=T,C=P==null?void 0:P.context,R=P==null?void 0:P.gpuDevice,ft=P==null?void 0:P.deviceType,lt=P==null?void 0:P.numThreads,Nt=P==null?void 0:P.powerPreference;C?u.currentContext=C:R?u.currentContext=await navigator.ml.createContext(R):u.currentContext=await navigator.ml.createContext({deviceType:ft,numThreads:lt,powerPreference:Nt})}else u.currentContext=await navigator.ml.createContext();break}n=await u._OrtCreateSession(o,i,a),n===0&&ht("Can't create a session."),u.currentContext&&(u.jsepRegisterMLContext(n,u.currentContext),u.currentContext=void 0,u.shouldTransferToMLTensor=!0);let[s,h]=Ng(n),f=!!(r!=null&&r.enableGraphCapture),m=[],v=[],_=[];for(let T=0;T<s;T++){let P=u._OrtGetInputName(n,T);P===0&&ht("Can't get an input name."),c.push(P),m.push(u.UTF8ToString(P))}for(let T=0;T<h;T++){let P=u._OrtGetOutputName(n,T);P===0&&ht("Can't get an output name."),e.push(P);let C=u.UTF8ToString(P);v.push(C)}return yr.set(n,[n,c,e,null,f,!1]),[n,m,v]}catch(s){throw c.forEach(h=>u._OrtFree(h)),e.forEach(h=>u._OrtFree(h)),n!==0&&u._OrtReleaseSession(n),s}finally{u._free(o),a!==0&&u._OrtReleaseSessionOptions(a),d.forEach(s=>u._free(s)),(l=u.unmountExternalData)==null||l.call(u)}},lo=t=>{var c;let r=xt(),o=yr.get(t);if(!o)throw new Error(`cannot release session. invalid session id: ${t}`);let[i,u,n,a,d]=o;a&&(d&&r._OrtClearBoundOutputs(a.handle),r._OrtReleaseBinding(a.handle)),(c=r.jsepOnReleaseSession)==null||c.call(r,t),u.forEach(e=>r._OrtFree(e)),n.forEach(e=>r._OrtFree(e)),r._OrtReleaseSession(i),yr.delete(t)},ed=(t,r,o,i,u,n=!1)=>{if(!t){r.push(0);return}let a=xt(),d=t[0],c=t[1],e=t[3],l,s;if(d==="string"&&(e==="gpu-buffer"||e==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(n&&e!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${u} when enableGraphCapture is true.`);if(e==="gpu-buffer"){let m=t[2].gpuBuffer;s=qr(Hr(d),c);let v=a.jsepRegisterBuffer;if(!v)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');l=v(i,u,m,s)}else if(e==="ml-tensor"){let m=t[2].mlTensor;s=qr(Hr(d),c);let v=a.jsepRegisterMLTensor;if(!v)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');l=v(m,Hr(d),c)}else{let m=t[2];if(Array.isArray(m)){s=4*m.length,l=a._malloc(s),o.push(l);let v=l/4;for(let _=0;_<m.length;_++){if(typeof m[_]!="string")throw new TypeError(`tensor data at index ${_} is not a string`);a.HEAPU32[v++]=Tt(m[_],o)}}else s=m.byteLength,l=a._malloc(s),o.push(l),a.HEAPU8.set(new Uint8Array(m.buffer,m.byteOffset,s),l)}let h=a.stackSave(),f=a.stackAlloc(4*c.length);try{let m=f/4;c.forEach(_=>a.HEAP32[m++]=_);let v=a._OrtCreateTensor(Hr(d),l,s,f,c.length,td(e));v===0&&ht(`Can't create tensor for input/output. session=${i}, index=${u}.`),r.push(v)}finally{a.stackRestore(h)}},fo=async(t,r,o,i,u,n)=>{var Q;let a=xt(),d=yr.get(t);if(!d)throw new Error(`cannot run inference. invalid session id: ${t}`);let c=d[0],e=d[1],l=d[2],s=d[3],h=d[4];d[5];let f=r.length,m=i.length,v=0,_=[],I=[],T=[],P=[],C=a.stackSave(),R=a.stackAlloc(f*4),ft=a.stackAlloc(f*4),lt=a.stackAlloc(m*4),Nt=a.stackAlloc(m*4);try{(Q=a.jsepOnRunStart)==null||Q.call(a,c),[v,_]=jp(n);for(let X=0;X<f;X++)ed(o[X],I,P,t,r[X],h);for(let X=0;X<m;X++)ed(u[X],T,P,t,f+i[X],h);let Pt=R/4,Ae=ft/4,gt=lt/4,De=Nt/4;for(let X=0;X<f;X++)a.HEAPU32[Pt++]=I[X],a.HEAPU32[Ae++]=e[r[X]];for(let X=0;X<m;X++)a.HEAPU32[gt++]=T[X],a.HEAPU32[De++]=l[i[X]];let Ft;Ft=await a._OrtRun(c,ft,R,f,Nt,m,lt,v),Ft!==0&&ht("failed to call OrtRun().");let wt=[];for(let X=0;X<m;X++){let Wt=a.HEAPU32[lt/4+X];if(Wt===T[X]){wt.push(u[X]);continue}let Le=a.stackSave(),_t=a.stackAlloc(4*4),se=!1,it,at=0;try{a._OrtGetTensorData(Wt,_t,_t+4,_t+8,_t+12)!==0&&ht(`Can't access output tensor data on index ${X}.`);let re=_t/4,Jt=a.HEAPU32[re++];at=a.HEAPU32[re++];let Re=a.HEAPU32[re++],oe=a.HEAPU32[re++],Ot=[];for(let nt=0;nt<oe;nt++)Ot.push(a.HEAPU32[Re/4+nt]);a._OrtFree(Re);let $t=Ot.reduce((nt,st)=>nt*st,1);it=Yp(Jt);let Lt=s==null?void 0:s.outputPreferredLocations[i[X]];if(it==="string"){if(Lt==="gpu-buffer"||Lt==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let nt=[],st=at/4;for(let Mt=0;Mt<$t;Mt++){let ce=a.HEAPU32[st++],Ge=Mt===$t-1?void 0:a.HEAPU32[st]-ce;nt.push(a.UTF8ToString(ce,Ge))}wt.push([it,Ot,nt,"cpu"])}else if(Lt==="gpu-buffer"&&$t>0){let nt=a.jsepGetBuffer;if(!nt)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let st=nt(at),Mt=qr(Jt,$t);if(Mt===void 0||!bo(it))throw new Error(`Unsupported data type: ${it}`);se=!0,wt.push([it,Ot,{gpuBuffer:st,download:a.jsepCreateDownloader(st,Mt,it),dispose:()=>{a._OrtReleaseTensor(Wt)}},"gpu-buffer"])}else if(Lt==="ml-tensor"&&$t>0){let nt=a.jsepEnsureTensor;if(!nt)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(qr(Jt,$t)===void 0||!go(it))throw new Error(`Unsupported data type: ${it}`);let st=await nt(at,Jt,Ot,!1);se=!0,wt.push([it,Ot,{mlTensor:st,download:a.jsepCreateMLTensorDownloader(at,it),dispose:()=>{a.jsepReleaseTensorId(at),a._OrtReleaseTensor(Wt)}},"ml-tensor"])}else{let nt=Zp(it),st=new nt($t);new Uint8Array(st.buffer,st.byteOffset,st.byteLength).set(a.HEAPU8.subarray(at,at+st.byteLength)),wt.push([it,Ot,st,"cpu"])}}finally{a.stackRestore(Le),it==="string"&&at&&a._free(at),se||a._OrtReleaseTensor(Wt)}}return s&&!h&&(a._OrtClearBoundOutputs(s.handle),yr.set(t,[c,e,l,s,h,!1])),wt}finally{a.stackRestore(C),I.forEach(Pt=>a._OrtReleaseTensor(Pt)),T.forEach(Pt=>a._OrtReleaseTensor(Pt)),P.forEach(Pt=>a._free(Pt)),v!==0&&a._OrtReleaseRunOptions(v),_.forEach(Pt=>a._free(Pt))}},co=t=>{let r=xt(),o=yr.get(t);if(!o)throw new Error("invalid session id");let i=o[0],u=r._OrtEndProfiling(i);u===0&&ht("Can't get an profile file name."),r._OrtFree(u)},po=t=>{let r=[];for(let o of t){let i=o[2];!Array.isArray(i)&&"buffer"in i&&r.push(i.buffer)}return r}}),Je,Kt,Xr,xo,To,yo,Zi,Qi,xr,Tr,Gg,rd,nd,od,id,ad,sd,ud,ta=O(()=>{Yt(),qi(),Ke(),Vr(),Je=()=>!!z.wasm.proxy&&typeof document<"u",Xr=!1,xo=!1,To=!1,Qi=new Map,xr=(t,r)=>{let o=Qi.get(t);o?o.push(r):Qi.set(t,[r])},Tr=()=>{if(Xr||!xo||To||!Kt)throw new Error("worker not ready")},Gg=t=>{switch(t.data.type){case"init-wasm":Xr=!1,t.data.err?(To=!0,Zi[1](t.data.err)):(xo=!0,Zi[0]()),yo&&(URL.revokeObjectURL(yo),yo=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=Qi.get(t.data.type);t.data.err?r.shift()[1](t.data.err):r.shift()[0](t.data.out);break}}},rd=async()=>{if(!xo){if(Xr)throw new Error("multiple calls to 'initWasm()' detected.");if(To)throw new Error("previous call to 'initWasm()' failed.");if(Xr=!0,Je())return new Promise((t,r)=>{Kt==null||Kt.terminate(),Wp().then(([o,i])=>{try{Kt=i,Kt.onerror=n=>r(n),Kt.onmessage=Gg,Zi=[t,r];let u={type:"init-wasm",in:z};Kt.postMessage(u),yo=o}catch(u){r(u)}},r)});try{await io(z.wasm),await ao(z),xo=!0}catch(t){throw To=!0,t}finally{Xr=!1}}},nd=async t=>{if(Je())return Tr(),new Promise((r,o)=>{xr("init-ep",[r,o]);let i={type:"init-ep",in:{epName:t,env:z}};Kt.postMessage(i)});await so(z,t)},od=async t=>Je()?(Tr(),new Promise((r,o)=>{xr("copy-from",[r,o]);let i={type:"copy-from",in:{buffer:t}};Kt.postMessage(i,[t.buffer])})):zr(t),id=async(t,r)=>{if(Je()){if(r!=null&&r.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return Tr(),new Promise((o,i)=>{xr("create",[o,i]);let u={type:"create",in:{model:t,options:{...r}}},n=[];t instanceof Uint8Array&&n.push(t.buffer),Kt.postMessage(u,n)})}else return uo(t,r)},ad=async t=>{if(Je())return Tr(),new Promise((r,o)=>{xr("release",[r,o]);let i={type:"release",in:t};Kt.postMessage(i)});lo(t)},sd=async(t,r,o,i,u,n)=>{if(Je()){if(o.some(a=>a[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(u.some(a=>a))throw new Error("pre-allocated output tensor is not supported for proxy.");return Tr(),new Promise((a,d)=>{xr("run",[a,d]);let c=o,e={type:"run",in:{sessionId:t,inputIndices:r,inputs:c,outputIndices:i,options:n}};Kt.postMessage(e,po(c))})}else return fo(t,r,o,i,u,n)},ud=async t=>{if(Je())return Tr(),new Promise((r,o)=>{xr("end-profiling",[r,o]);let i={type:"end-profiling",in:t};Kt.postMessage(i)});co(t)}}),ld,Mg,wo,fd=O(()=>{Yt(),ta(),Ji(),oo(),Yi(),ld=(t,r)=>{switch(t.location){case"cpu":return[t.type,t.dims,t.data,"cpu"];case"gpu-buffer":return[t.type,t.dims,{gpuBuffer:t.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[t.type,t.dims,{mlTensor:t.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${t.location} for ${r()}`)}},Mg=t=>{switch(t[3]){case"cpu":return new yt(t[0],t[2],t[1]);case"gpu-buffer":{let r=t[0];if(!bo(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:o,download:i,dispose:u}=t[2];return yt.fromGpuBuffer(o,{dataType:r,dims:t[1],download:i,dispose:u})}case"ml-tensor":{let r=t[0];if(!go(r))throw new Error(`not supported data type: ${r} for deserializing MLTensor tensor`);let{mlTensor:o,download:i,dispose:u}=t[2];return yt.fromMLTensor(o,{dataType:r,dims:t[1],download:i,dispose:u})}default:throw new Error(`invalid data location: ${t[3]}`)}},wo=class{async fetchModelAndCopyToWasmMemory(t){return od(await jr(t))}async loadModel(t,r){Fe();let o;typeof t=="string"?o=await this.fetchModelAndCopyToWasmMemory(t):o=t,[this.sessionId,this.inputNames,this.outputNames]=await id(o,r),Ce()}async dispose(){return ad(this.sessionId)}async run(t,r,o){Fe();let i=[],u=[];Object.entries(t).forEach(s=>{let h=s[0],f=s[1],m=this.inputNames.indexOf(h);if(m===-1)throw new Error(`invalid input '${h}'`);i.push(f),u.push(m)});let n=[],a=[];Object.entries(r).forEach(s=>{let h=s[0],f=s[1],m=this.outputNames.indexOf(h);if(m===-1)throw new Error(`invalid output '${h}'`);n.push(f),a.push(m)});let d=i.map((s,h)=>ld(s,()=>`input "${this.inputNames[u[h]]}"`)),c=n.map((s,h)=>s?ld(s,()=>`output "${this.outputNames[a[h]]}"`):null),e=await sd(this.sessionId,u,d,a,c,o),l={};for(let s=0;s<e.length;s++)l[this.outputNames[a[s]]]=n[s]??Mg(e[s]);return Ce(),l}startProfiling(){}endProfiling(){ud(this.sessionId)}}}),pd={};Or(pd,{OnnxruntimeWebAssemblyBackend:()=>vo,initializeFlags:()=>cd,wasmBackend:()=>Ug});var cd,vo,Ug,dd=O(()=>{Yt(),ta(),fd(),Vr(),cd=()=>{if((typeof z.wasm.initTimeout!="number"||z.wasm.initTimeout<0)&&(z.wasm.initTimeout=0),z.wasm.simd===!1&&console.warn('Deprecated property "env.wasm.simd" is set to false. non-SIMD build is no longer provided, and this setting will be ignored.'),typeof z.wasm.proxy!="boolean"&&(z.wasm.proxy=!1),typeof z.wasm.trace!="boolean"&&(z.wasm.trace=!1),typeof z.wasm.numThreads!="number"||!Number.isInteger(z.wasm.numThreads)||z.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)z.wasm.numThreads=1;else{let t=typeof navigator>"u"?Co("node:os").cpus().length:navigator.hardwareConcurrency;z.wasm.numThreads=Math.min(4,Math.ceil((t||1)/2))}},vo=class{async init(t){cd(),await rd(),await nd(t)}async createInferenceSessionHandler(t,r){let o=new wo;return await o.loadModel(t,r),Promise.resolve(o)}},Ug=new vo});Yt(),Yt(),Yt();var Ds="1.20.1";{let t=(Fp(),sn(Bp)).onnxjsBackend;nr("webgl",t,-10)}{let t=(dd(),sn(pd)).wasmBackend;nr("cpu",t,10),nr("wasm",t,10)}Object.defineProperty(z.versions,"web",{value:Ds,enumerable:!0});/*! Bundled license information:
|
|
1810
1810
|
|
|
1811
1811
|
long/index.js:
|
|
1812
1812
|
(**
|
|
@@ -1828,5 +1828,5 @@ as ORT format: ${u}`)}}loadFromOnnxFormat(t,r){let o=Dp.onnx.ModelProto.decode(t
|
|
|
1828
1828
|
*
|
|
1829
1829
|
* SPDX-License-Identifier: Apache-2.0
|
|
1830
1830
|
*)
|
|
1831
|
-
*/const A=(t,r)=>!r||t.startsWith("http")?new URL(t).href:t?r.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):r;function b(t){if(t.startsWith("blob:"))return!0;try{return new URL(t),!0}catch{return!1}}async function U$1(t){const r=await caches.open("ladon-cache"),o=await r.match(t);if(o)return o.arrayBuffer();const i=await fetch(t);if(!i.ok)throw new Error(`Failed to fetch file: ${t}`);const u=i.headers.get("Content-Type")||"application/octet-stream";if(!u.includes("application/wasm")&&!u.includes("binary/octet-stream"))throw new Error(`Unexpected MIME type: ${u} for ${t}`);const n=await i.arrayBuffer(),a=new Response(n,{headers:{"Content-Type":u,"Content-Length":n.byteLength.toString()}});return await r.put(t,a),n}const k="ort-wasm-simd-threaded.wasm";class U{constructor(){this.modelSessions={},this.resolvedUriCache=new Map}async initializeWorker(r){if(typeof Worker>"u")throw new Error("[ladon-ts] web workers are not supported in this environment");const o=await this.resolveUri(r,r.mask.workerUri),i=await(await fetch(o,{cache:"force-cache"})).text();return this.workerUrl=URL.createObjectURL(new Blob([i],{type:"text/javascript"})),new Worker(this.workerUrl,{type:"module"})}terminateWorker(){this.worker&&(this.worker.terminate(),this.worker=void 0)}async loadModel(r){const{mask:o,executionProviders:i}=r;z.wasm.numThreads=1;const u=await this.resolveUri(r,r.wasmUri);if(u)try{z.wasm.wasmBinary=await U$1(u+k)}catch(d){console.warn("Failed to load or cache WASM file. Using WASM paths.",d),z.wasm.wasmPaths=u}const n=await this.resolveUri(r,o.modelUri);let a=this.modelSessions[n];if(!a){const d={executionProviders:i!=null&&i.length?i:["wasm"]};try{const c=await U$1(n);a=await Yd.create(c,d)}catch(c){console.warn("Failed to load or cache model file. Using model URL.",c),a=await Yd.create(n,d)}}return this.modelSessions[n]=a,await this.warmupModel(a,o.inputSize,o.modelRank),a}async preloadWorker(r){const o=await this.prepareWorkerConfig(r);this.worker=await this.initializeWorker(o),this.worker.postMessage({type:"preload",config:o})}async warmupModel(r,o={width:1280,height:720},i=3,u="float32"){const n=o.height*o.width,a=new Float32Array(i*n).fill(0),d=new yt(u,a,[1,i,o.height,o.width]),c={[r.inputNames[0]]:d};if(i===3){const e=new Float32Array(n).fill(0),l=new yt(u,e,[1,1,o.height,o.width]);c[r.inputNames[1]]=l}await r.run(c)}getModelSession(r){return this.modelSessions[r]}async resolveUri(r,o){if(!o)throw new Error("Asset URI is undefined.");if(this.resolvedUriCache.has(o))return this.resolvedUriCache.get(o);let i;if(b(o)?i=o:o.match(/\.[a-z0-9]+$/i)?typeof r.assetUrlResolver=="function"&&(i=await r.assetUrlResolver(o,r)):i=A(o,r.baseUrl),!i)throw new Error(`Failed to resolve asset URI: ${o}`);return this.resolvedUriCache.set(o,i),i}getWorker(){return this.worker}getWorkerUrl(){return this.workerUrl}async prepareWorkerConfig(r){const o={...r,mask:{...r.mask,modelUri:await this.resolveUri(r,r.mask.modelUri),workerUri:await this.resolveUri(r,r.mask.workerUri)},wasmUri:await this.resolveUri(r,r.wasmUri),assetUrlResolver:void 0};return JSON.parse(JSON.stringify(o))}}const p=new U;
|
|
1831
|
+
*/const A=(t,r)=>!r||t.startsWith("http")?new URL(t).href:t?r.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):r;function b(t){if(t.startsWith("blob:"))return!0;try{return new URL(t),!0}catch{return!1}}async function U$1(t){const r=await caches.open("ladon-cache"),o=await r.match(t);if(o)return o.arrayBuffer();const i=await fetch(t);if(!i.ok)throw new Error(`Failed to fetch file: ${t}`);const u=i.headers.get("Content-Type")||"application/octet-stream";if(!u.includes("application/wasm")&&!u.includes("binary/octet-stream"))throw new Error(`Unexpected MIME type: ${u} for ${t}`);const n=await i.arrayBuffer(),a=new Response(n,{headers:{"Content-Type":u,"Content-Length":n.byteLength.toString()}});return await r.put(t,a),n}const k="ort-wasm-simd-threaded.wasm";class U{constructor(){this.modelSessions={},this.resolvedUriCache=new Map}async initializeWorker(r){if(typeof Worker>"u")throw new Error("[ladon-ts] web workers are not supported in this environment");const o=await this.resolveUri(r,r.mask.workerUri),i=await(await fetch(o,{cache:"force-cache"})).text();return this.workerUrl=URL.createObjectURL(new Blob([i],{type:"text/javascript"})),new Worker(this.workerUrl,{type:"module"})}terminateWorker(){this.worker&&(this.worker.terminate(),this.worker=void 0)}async loadModel(r){const{mask:o,executionProviders:i}=r;z.wasm.numThreads=1;const u=await this.resolveUri(r,r.wasmUri);if(u)try{z.wasm.wasmBinary=await U$1(u+k)}catch(d){console.warn("Failed to load or cache WASM file. Using WASM paths.",d),z.wasm.wasmPaths=u}const n=await this.resolveUri(r,o.modelUri);let a=this.modelSessions[n];if(!a){const d={executionProviders:i!=null&&i.length?i:["wasm"]};try{const c=await U$1(n);a=await Yd.create(c,d)}catch(c){console.warn("Failed to load or cache model file. Using model URL.",c),a=await Yd.create(n,d)}}return this.modelSessions[n]=a,await this.warmupModel(a,o.inputSize,o.modelRank),a}async preloadWorker(r){const o=await this.prepareWorkerConfig(r);this.worker=await this.initializeWorker(o),this.worker.postMessage({type:"preload",config:o})}async warmupModel(r,o={width:1280,height:720},i=3,u="float32"){const n=o.height*o.width,a=new Float32Array(i*n).fill(0),d=new yt(u,a,[1,i,o.height,o.width]),c={[r.inputNames[0]]:d};if(i===3){const e=new Float32Array(n).fill(0),l=new yt(u,e,[1,1,o.height,o.width]);c[r.inputNames[1]]=l}await r.run(c)}getModelSession(r){return this.modelSessions[r]}async resolveUri(r,o){if(!o)throw new Error("Asset URI is undefined.");if(this.resolvedUriCache.has(o))return this.resolvedUriCache.get(o);let i;if(b(o)?i=o:o.match(/\.[a-z0-9]+$/i)?typeof r.assetUrlResolver=="function"&&(i=await r.assetUrlResolver(o,r)):i=A(o,r.baseUrl),!i)throw new Error(`Failed to resolve asset URI: ${o}`);return this.resolvedUriCache.set(o,i),i}getWorker(){return this.worker}getWorkerUrl(){return this.workerUrl}async prepareWorkerConfig(r){const o={...r,mask:{...r.mask,modelUri:await this.resolveUri(r,r.mask.modelUri),workerUri:await this.resolveUri(r,r.mask.workerUri)},wasmUri:await this.resolveUri(r,r.wasmUri),assetUrlResolver:void 0};return JSON.parse(JSON.stringify(o))}}const p=new U;let R$1=class{constructor(r){this.config=r,this.lastMaskGenerationTime=0;const{height:o,width:i}=this.config.mask.outputSize;this.lastMask=new yt("float32",new Float32Array(o*i),[1,1,o,i]),this.lastResult={data:this.lastMask.data,facesAndLandmarks:{data:new Float32Array(0),dims:[]},gesture:new Float32Array(0),motion:0,timestamp:0,warm:!1}}preprocess(r,o){const{modelRank:i,inputSize:u,outputSize:n}=this.config.mask,{height:a,width:d}=u,c=a*d;this.output??(this.output=new Float32Array(c*i));const e=r.length/4;for(let h=0;h<3;h++)for(let f=0;f<e;f++)this.output[f+h*c]=r[f*4+(2-h)];const l=n.width/d,s=n.height/a;for(let h=0;h<d;h++){const f=Math.floor(h*l);for(let m=0;m<a;m++){const v=Math.floor(m*s),_=f+v*n.width,I=h+m*d+3*c,T=Math.min(Math.max(o[_],0),255);this.output[I]=T}}return this.output}getTimeSinceLastGeneration(){return Date.now()-this.lastMaskGenerationTime}async getLadonOutput(r,o){var i,u,n,a;if(!this.maskModel)throw new Error("[ladon-ts] - mask model not loaded.");if(this.getTimeSinceLastGeneration()<this.config.mask.generationIntervalMs)return{data:this.lastMask.data,facesAndLandmarks:this.lastResult.facesAndLandmarks,gesture:this.lastResult.gesture,motion:this.lastResult.motion,timestamp:this.lastResult.timestamp,warm:!1};this.lastMaskGenerationTime=Date.now();const d=new yt("float32",this.preprocess(r,this.lastMask.data),[1,this.config.mask.modelRank,this.config.mask.inputSize.height,this.config.mask.inputSize.width]),c=await this.maskModel.run({input:d});return this.lastMask=c.segmentation,this.lastResult={data:this.lastMask.data??new Float32Array(0),facesAndLandmarks:{data:((i=c.faces_and_landmarks)==null?void 0:i.data)??new Float32Array(0),dims:((u=c.faces_and_landmarks)==null?void 0:u.dims)??[]},gesture:((n=c.gesture)==null?void 0:n.data)??new Float32Array(0),motion:((a=c.motion)==null?void 0:a.data[0])??0,timestamp:o,warm:!0},this.lastResult}async load(){const r=await p.resolveUri(this.config,this.config.mask.modelUri);if(this.maskModel=p.getModelSession(r),this.maskModel??(this.maskModel=await p.loadModel(this.config)),!this.maskModel)throw new Error("Failed to load the ONNX model.")}isLoaded(){return!!this.maskModel}async postRender(r){}destroy(){}},generator,busy=!1;self.addEventListener("message",async t=>{const{type:r,config:o,image:i,timestamp:u}=t.data;try{switch(r){case"preload":o&&await handlePreload(o);break;case"init":o&&await handleInit(o);break;case"generate":i&&await handleGenerate(i,u);break;default:console.warn(`[ladon-ts] - worker generator - unknown message: ${JSON.stringify(t.data)}`)}}catch(n){console.error(`[ladon-ts] - worker generator - error handling message: ${n}`)}});async function handlePreload(t){await p.loadModel(t),postMessage({status:"preloaded"})}async function handleInit(t){generator=new R$1(t),await generator.load(),postMessage({status:"initialized"})}async function handleGenerate(t,r){if(busy)return;if(!generator||!generator.isLoaded()){console.warn("[ladon-ts] - Generator is not initialized");return}if(busy=!0,!t){console.warn("[ladon-ts] - No valid input provided for generation"),busy=!1;return}const o=await generator.getLadonOutput(t,r);o.warm&&postMessage({facesAndLandmarks:o.facesAndLandmarks,gesture:o.gesture,mask:o.data,motion:o.motion,timestamp:o.timestamp,status:"generated"}),setTimeout(()=>{busy=!1},0)}})();
|
|
1832
1832
|
//# sourceMappingURL=segmentation.js.map
|