UNPKG

onnxruntime-web

Version:

A Javascript library for running ONNX models on browsers

6 lines 792 kB
/*! * ONNX Runtime Web v1.24.3 * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ var $x=Object.create;var uo=Object.defineProperty;var Ax=Object.getOwnPropertyDescriptor;var Px=Object.getOwnPropertyNames;var Ox=Object.getPrototypeOf,Ex=Object.prototype.hasOwnProperty;var ua=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var $=(r,e)=>()=>(r&&(e=r(r=0)),e);var G=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),dr=(r,e)=>{for(var n in e)uo(r,n,{get:e[n],enumerable:!0})},$l=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Px(e))!Ex.call(r,o)&&o!==n&&uo(r,o,{get:()=>e[o],enumerable:!(t=Ax(e,o))||t.enumerable});return r};var se=(r,e,n)=>(n=r!=null?$x(Ox(r)):{},$l(e||!r||!r.__esModule?uo(n,"default",{value:r,enumerable:!0}):n,r)),Er=r=>$l(uo({},"__esModule",{value:!0}),r);var lo,Wn,An,Cx,Al,la=$(()=>{"use strict";lo=new Map,Wn=[],An=(r,e,n)=>{if(e&&typeof e.init=="function"&&typeof e.createInferenceSessionHandler=="function"){let t=lo.get(r);if(t===void 0)lo.set(r,{backend:e,priority:n});else{if(t.priority>n)return;if(t.priority===n&&t.backend!==e)throw new Error(`cannot register backend "${r}" using priority ${n}`)}if(n>=0){let o=Wn.indexOf(r);o!==-1&&Wn.splice(o,1);for(let i=0;i<Wn.length;i++)if(lo.get(Wn[i]).priority<=n){Wn.splice(i,0,r);return}Wn.push(r)}return}throw new TypeError("not a valid backend")},Cx=async r=>{let e=lo.get(r);if(!e)return"backend not found.";if(e.initialized)return e.backend;if(e.aborted)return e.error;{let n=!!e.initPromise;try{return n||(e.initPromise=e.backend.init(r)),await e.initPromise,e.initialized=!0,e.backend}catch(t){return n||(e.error=`${t}`,e.aborted=!0),e.error}finally{delete e.initPromise}}},Al=async r=>{let e=r.executionProviders||[],n=e.map(u=>typeof u=="string"?u:u.name),t=n.length===0?Wn:n,o,i=[],a=new Set;for(let u of t){let l=await Cx(u);typeof l=="string"?i.push({name:u,err:l}):(o||(o=l),o===l&&a.add(u))}if(!o)throw new Error(`no available backend found. ERR: ${i.map(u=>`[${u.name}] ${u.err}`).join(", ")}`);for(let{name:u,err:l}of i)n.includes(u)&&console.warn(`removing requested execution provider "${u}" from session options because it is not available: ${l}`);let s=e.filter(u=>a.has(typeof u=="string"?u:u.name));return[o,new Proxy(r,{get:(u,l)=>l==="executionProviders"?s:Reflect.get(u,l)})]}});var Pl=$(()=>{"use strict";la()});var Ol,El=$(()=>{"use strict";Ol="1.24.3"});var Cl,Be,ca=$(()=>{"use strict";El();Cl="warning",Be={wasm:{},webgl:{},webgpu:{},versions:{common:Ol},set logLevel(r){if(r!==void 0){if(typeof r!="string"||["verbose","info","warning","error","fatal"].indexOf(r)===-1)throw new Error(`Unsupported logging level: ${r}`);Cl=r}},get logLevel(){return Cl}};Object.defineProperty(Be,"logLevel",{enumerable:!0})});var te,Dl=$(()=>{"use strict";ca();te=Be});var kl,Ll,Rl=$(()=>{"use strict";kl=(r,e)=>{let n=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);n.width=r.dims[3],n.height=r.dims[2];let t=n.getContext("2d");if(t!=null){let o,i;e?.tensorLayout!==void 0&&e.tensorLayout==="NHWC"?(o=r.dims[2],i=r.dims[3]):(o=r.dims[3],i=r.dims[2]);let a=e?.format!==void 0?e.format:"RGB",s=e?.norm,u,l;s===void 0||s.mean===void 0?u=[255,255,255,255]:typeof s.mean=="number"?u=[s.mean,s.mean,s.mean,s.mean]:(u=[s.mean[0],s.mean[1],s.mean[2],0],s.mean[3]!==void 0&&(u[3]=s.mean[3])),s===void 0||s.bias===void 0?l=[0,0,0,0]:typeof s.bias=="number"?l=[s.bias,s.bias,s.bias,s.bias]:(l=[s.bias[0],s.bias[1],s.bias[2],0],s.bias[3]!==void 0&&(l[3]=s.bias[3]));let c=i*o,d=0,p=c,f=c*2,h=-1;a==="RGBA"?(d=0,p=c,f=c*2,h=c*3):a==="RGB"?(d=0,p=c,f=c*2):a==="RBG"&&(d=0,f=c,p=c*2);for(let m=0;m<i;m++)for(let y=0;y<o;y++){let g=(r.data[d++]-l[0])*u[0],b=(r.data[p++]-l[1])*u[1],x=(r.data[f++]-l[2])*u[2],w=h===-1?255:(r.data[h++]-l[3])*u[3];t.fillStyle="rgba("+g+","+b+","+x+","+w+")",t.fillRect(y,m,1,1)}if("toDataURL"in n)return n.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},Ll=(r,e)=>{let n=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),t;if(n!=null){let o,i,a;e?.tensorLayout!==void 0&&e.tensorLayout==="NHWC"?(o=r.dims[2],i=r.dims[1],a=r.dims[3]):(o=r.dims[3],i=r.dims[2],a=r.dims[1]);let s=e!==void 0&&e.format!==void 0?e.format:"RGB",u=e?.norm,l,c;u===void 0||u.mean===void 0?l=[255,255,255,255]:typeof u.mean=="number"?l=[u.mean,u.mean,u.mean,u.mean]:(l=[u.mean[0],u.mean[1],u.mean[2],255],u.mean[3]!==void 0&&(l[3]=u.mean[3])),u===void 0||u.bias===void 0?c=[0,0,0,0]:typeof u.bias=="number"?c=[u.bias,u.bias,u.bias,u.bias]:(c=[u.bias[0],u.bias[1],u.bias[2],0],u.bias[3]!==void 0&&(c[3]=u.bias[3]));let d=i*o;if(e!==void 0&&(e.format!==void 0&&a===4&&e.format!=="RGBA"||a===3&&e.format!=="RGB"&&e.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let p=4,f=0,h=1,m=2,y=3,g=0,b=d,x=d*2,w=-1;s==="RGBA"?(g=0,b=d,x=d*2,w=d*3):s==="RGB"?(g=0,b=d,x=d*2):s==="RBG"&&(g=0,x=d,b=d*2),t=n.createImageData(o,i);for(let v=0;v<i*o;f+=p,h+=p,m+=p,y+=p,v++)t.data[f]=(r.data[g++]-c[0])*l[0],t.data[h]=(r.data[b++]-c[1])*l[1],t.data[m]=(r.data[x++]-c[2])*l[2],t.data[y]=w===-1?255:(r.data[w++]-c[3])*l[3]}else throw new Error("Can not access image data");return t}});var da,Nl,zl,Ml,Bl,Vl,Fl=$(()=>{"use strict";co();da=(r,e)=>{if(r===void 0)throw new Error("Image buffer must be defined");if(e.height===void 0||e.width===void 0)throw new Error("Image height and width must be defined");if(e.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:n,width:t}=e,o=e.norm??{mean:255,bias:0},i,a;typeof o.mean=="number"?i=[o.mean,o.mean,o.mean,o.mean]:i=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?a=[o.bias,o.bias,o.bias,o.bias]:a=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];let s=e.format!==void 0?e.format:"RGBA",u=e.tensorFormat!==void 0&&e.tensorFormat!==void 0?e.tensorFormat:"RGB",l=n*t,c=u==="RGBA"?new Float32Array(l*4):new Float32Array(l*3),d=4,p=0,f=1,h=2,m=3,y=0,g=l,b=l*2,x=-1;s==="RGB"&&(d=3,p=0,f=1,h=2,m=-1),u==="RGBA"?x=l*3:u==="RBG"?(y=0,b=l,g=l*2):u==="BGR"&&(b=0,g=l,y=l*2);for(let v=0;v<l;v++,p+=d,h+=d,f+=d,m+=d)c[y++]=(r[p]+a[0])/i[0],c[g++]=(r[f]+a[1])/i[1],c[b++]=(r[h]+a[2])/i[2],x!==-1&&m!==-1&&(c[x++]=(r[m]+a[3])/i[3]);return u==="RGBA"?new He("float32",c,[1,4,n,t]):new He("float32",c,[1,3,n,t])},Nl=async(r,e)=>{let n=typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement,t=typeof ImageData<"u"&&r instanceof ImageData,o=typeof ImageBitmap<"u"&&r instanceof ImageBitmap,i=typeof r=="string",a,s=e??{},u=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},l=c=>typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement||c instanceof OffscreenCanvas?c.getContext("2d"):null;if(n){let c=u();c.width=r.width,c.height=r.height;let d=l(c);if(d!=null){let p=r.height,f=r.width;if(e!==void 0&&e.resizedHeight!==void 0&&e.resizedWidth!==void 0&&(p=e.resizedHeight,f=e.resizedWidth),e!==void 0){if(s=e,e.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");s.tensorFormat="RGBA",s.height=p,s.width=f}else s.tensorFormat="RGBA",s.height=p,s.width=f;d.drawImage(r,0,0),a=d.getImageData(0,0,f,p).data}else throw new Error("Can not access image data")}else if(t){let c,d;if(e!==void 0&&e.resizedWidth!==void 0&&e.resizedHeight!==void 0?(c=e.resizedHeight,d=e.resizedWidth):(c=r.height,d=r.width),e!==void 0&&(s=e),s.format="RGBA",s.height=c,s.width=d,e!==void 0){let p=u();p.width=d,p.height=c;let f=l(p);if(f!=null)f.putImageData(r,0,0),a=f.getImageData(0,0,d,c).data;else throw new Error("Can not access image data")}else a=r.data}else if(o){if(e===void 0)throw new Error("Please provide image config with format for Imagebitmap");let c=u();c.width=r.width,c.height=r.height;let d=l(c);if(d!=null){let p=r.height,f=r.width;return d.drawImage(r,0,0,f,p),a=d.getImageData(0,0,f,p).data,s.height=p,s.width=f,da(a,s)}else throw new Error("Can not access image data")}else{if(i)return new Promise((c,d)=>{let p=u(),f=l(p);if(!r||!f)return d();let h=new Image;h.crossOrigin="Anonymous",h.src=r,h.onload=()=>{p.width=h.width,p.height=h.height,f.drawImage(h,0,0,p.width,p.height);let m=f.getImageData(0,0,p.width,p.height);s.height=p.height,s.width=p.width,c(da(m.data,s))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(a!==void 0)return da(a,s);throw new Error("Input data provided is not supported - aborted tensor creation")},zl=(r,e)=>{let{width:n,height:t,download:o,dispose:i}=e,a=[1,t,n,4];return new He({location:"texture",type:"float32",texture:r,dims:a,download:o,dispose:i})},Ml=(r,e)=>{let{dataType:n,dims:t,download:o,dispose:i}=e;return new He({location:"gpu-buffer",type:n??"float32",gpuBuffer:r,dims:t,download:o,dispose:i})},Bl=(r,e)=>{let{dataType:n,dims:t,download:o,dispose:i}=e;return new He({location:"ml-tensor",type:n??"float32",mlTensor:r,dims:t,download:o,dispose:i})},Vl=(r,e,n)=>new He({location:"cpu-pinned",type:r,data:e,dims:n??[e.length]})});var Hn,Cr,Gl,Ul,Wl=$(()=>{"use strict";Hn=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Cr=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),Gl=!1,Ul=()=>{if(!Gl){Gl=!0;let r=typeof BigInt64Array<"u"&&BigInt64Array.from,e=typeof BigUint64Array<"u"&&BigUint64Array.from,n=globalThis.Float16Array,t=typeof n<"u"&&n.from;r&&(Hn.set("int64",BigInt64Array),Cr.set(BigInt64Array,"int64")),e&&(Hn.set("uint64",BigUint64Array),Cr.set(BigUint64Array,"uint64")),t?(Hn.set("float16",n),Cr.set(n,"float16")):Hn.set("float16",Uint16Array)}}});var Hl,ql,jl=$(()=>{"use strict";co();Hl=r=>{let e=1;for(let n=0;n<r.length;n++){let t=r[n];if(typeof t!="number"||!Number.isSafeInteger(t))throw new TypeError(`dims[${n}] must be an integer, got: ${t}`);if(t<0)throw new RangeError(`dims[${n}] must be a non-negative integer, got: ${t}`);e*=t}return e},ql=(r,e)=>{switch(r.location){case"cpu":return new He(r.type,r.data,e);case"cpu-pinned":return new He({location:"cpu-pinned",data:r.data,type:r.type,dims:e});case"texture":return new He({location:"texture",texture:r.texture,type:r.type,dims:e});case"gpu-buffer":return new He({location:"gpu-buffer",gpuBuffer:r.gpuBuffer,type:r.type,dims:e});case"ml-tensor":return new He({location:"ml-tensor",mlTensor:r.mlTensor,type:r.type,dims:e});default:throw new Error(`tensorReshape: tensor location ${r.location} is not supported`)}}});var He,co=$(()=>{"use strict";Rl();Fl();Wl();jl();He=class{constructor(e,n,t){Ul();let o,i;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,o=e.type,i=e.dims,e.location){case"cpu-pinned":{let s=Hn.get(o);if(!s)throw new TypeError(`unsupported type "${o}" to create tensor from pinned buffer`);if(!(e.data instanceof s))throw new TypeError(`buffer should be of type ${s.name}`);this.cpuData=e.data;break}case"texture":{if(o!=="float32")throw new TypeError(`unsupported type "${o}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint64"&&o!=="int8"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let s,u;if(typeof e=="string")if(o=e,u=t,e==="string"){if(!Array.isArray(n))throw new TypeError("A string tensor's data must be a string array.");s=n}else{let l=Hn.get(e);if(l===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(n)){if(e==="float16"&&l===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${l.name} as data.`);e==="uint64"||e==="int64"?s=l.from(n,BigInt):s=l.from(n)}else if(n instanceof l)s=n;else if(n instanceof Uint8ClampedArray)if(e==="uint8")s=Uint8Array.from(n);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&n instanceof Uint16Array&&l!==Uint16Array)s=new globalThis.Float16Array(n.buffer,n.byteOffset,n.length);else throw new TypeError(`A ${o} tensor's data must be type of ${l}`)}else if(u=n,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let l=typeof e[0];if(l==="string")o="string",s=e;else if(l==="boolean")o="bool",s=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${l}.`)}else if(e instanceof Uint8ClampedArray)o="uint8",s=Uint8Array.from(e);else{let l=Cr.get(e.constructor);if(l===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);o=l,s=e}if(u===void 0)u=[s.length];else if(!Array.isArray(u))throw new TypeError("A tensor's dims must be a number array");i=u,this.cpuData=s,this.dataLocation="cpu"}let a=Hl(i);if(this.cpuData&&a!==this.cpuData.length&&!((o==="uint4"||o==="int4")&&Math.ceil(a/2)===this.cpuData.length))throw new Error(`Tensor's size(${a}) does not match data length(${this.cpuData.length}).`);this.type=o,this.dims=i,this.size=a}static async fromImage(e,n){return Nl(e,n)}static fromTexture(e,n){return zl(e,n)}static fromGpuBuffer(e,n){return Ml(e,n)}static fromMLTensor(e,n){return Bl(e,n)}static fromPinnedBuffer(e,n,t){return Vl(e,n,t)}toDataURL(e){return kl(this,e)}toImageData(e){return Ll(this,e)}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(e){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 n=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=n,e&&this.disposer&&(this.disposer(),this.disposer=void 0),n}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(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return ql(this,e)}}});var ot,pa=$(()=>{"use strict";co();ot=He});var po,Kl,it,Qe,Pn,On,fa=$(()=>{"use strict";ca();po=(r,e)=>{(typeof Be.trace>"u"?!Be.wasm.trace:!Be.trace)||console.timeStamp(`${r}::ORT::${e}`)},Kl=(r,e)=>{let n=new Error().stack?.split(/\r\n|\r|\n/g)||[],t=!1;for(let o=0;o<n.length;o++){if(t&&!n[o].includes("TRACE_FUNC")){let i=`FUNC_${r}::${n[o].trim().split(" ")[1]}`;e&&(i+=`::${e}`),po("CPU",i);return}n[o].includes("TRACE_FUNC")&&(t=!0)}},it=r=>{(typeof Be.trace>"u"?!Be.wasm.trace:!Be.trace)||Kl("BEGIN",r)},Qe=r=>{(typeof Be.trace>"u"?!Be.wasm.trace:!Be.trace)||Kl("END",r)},Pn=r=>{(typeof Be.trace>"u"?!Be.wasm.trace:!Be.trace)||console.time(`ORT::${r}`)},On=r=>{(typeof Be.trace>"u"?!Be.wasm.trace:!Be.trace)||console.timeEnd(`ORT::${r}`)}});var fo,Xl=$(()=>{"use strict";la();pa();fa();fo=class r{constructor(e){this.handler=e}async run(e,n,t){it(),Pn("InferenceSession.run");let o={},i={};if(typeof e!="object"||e===null||e instanceof ot||Array.isArray(e))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let a=!0;if(typeof n=="object"){if(n===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(n instanceof ot)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(n)){if(n.length===0)throw new TypeError("'fetches' cannot be an empty array.");a=!1;for(let l of n){if(typeof l!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(l)===-1)throw new RangeError(`'fetches' contains invalid output name: ${l}.`);o[l]=null}if(typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else{let l=!1,c=Object.getOwnPropertyNames(n);for(let d of this.outputNames)if(c.indexOf(d)!==-1){let p=n[d];(p===null||p instanceof ot)&&(l=!0,a=!1,o[d]=p)}if(l){if(typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else i=n}}else if(typeof n<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let l of this.inputNames)if(typeof e[l]>"u")throw new Error(`input '${l}' is missing in 'feeds'.`);if(a)for(let l of this.outputNames)o[l]=null;let s=await this.handler.run(e,o,i),u={};for(let l in s)if(Object.hasOwnProperty.call(s,l)){let c=s[l];c instanceof ot?u[l]=c:u[l]=new ot(c.type,c.data,c.dims)}return On("InferenceSession.run"),Qe(),u}async release(){return this.handler.dispose()}static async create(e,n,t,o){it(),Pn("InferenceSession.create");let i,a={};if(typeof e=="string"){if(i=e,typeof n=="object"&&n!==null)a=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else if(e instanceof Uint8Array){if(i=e,typeof n=="object"&&n!==null)a=n;else if(typeof n<"u")throw new TypeError("'options' must be an object.")}else if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer){let c=e,d=0,p=e.byteLength;if(typeof n=="object"&&n!==null)a=n;else if(typeof n=="number"){if(d=n,!Number.isSafeInteger(d))throw new RangeError("'byteOffset' must be an integer.");if(d<0||d>=c.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${c.byteLength}).`);if(p=e.byteLength-d,typeof t=="number"){if(p=t,!Number.isSafeInteger(p))throw new RangeError("'byteLength' must be an integer.");if(p<=0||d+p>c.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${c.byteLength-d}].`);if(typeof o=="object"&&o!==null)a=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof t<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof n<"u")throw new TypeError("'options' must be an object.");i=new Uint8Array(c,d,p)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[s,u]=await Al(a),l=await s.createInferenceSessionHandler(i,u);return On("InferenceSession.create"),Qe(),new r(l)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}});var Dx,Zl=$(()=>{"use strict";Xl();Dx=fo});var Jl=$(()=>{"use strict"});var Ql=$(()=>{"use strict"});var Yl=$(()=>{"use strict"});var ec=$(()=>{"use strict"});var ha={};dr(ha,{InferenceSession:()=>Dx,TRACE:()=>po,TRACE_EVENT_BEGIN:()=>Pn,TRACE_EVENT_END:()=>On,TRACE_FUNC_BEGIN:()=>it,TRACE_FUNC_END:()=>Qe,Tensor:()=>ot,env:()=>te,registerBackend:()=>An});var qe=$(()=>{"use strict";Pl();Dl();Zl();pa();Jl();Ql();fa();Yl();ec()});function En(r,e,n,t){if(e===void 0)return Lx(r);if(n===void 0)ho(r,e,1);else if(typeof n=="number"&&t===void 0)ho(r,e,n);else if(typeof n=="string"&&t===void 0)ho(r,n,1,e);else if(typeof n=="string"&&typeof t=="number")ho(r,n,t,e);else throw new TypeError("input is valid")}function Lx(r){return{verbose:En.verbose.bind(null,r),info:En.info.bind(null,r),warning:En.warning.bind(null,r),error:En.error.bind(null,r),fatal:En.fatal.bind(null,r)}}function ho(r,e,n,t){let o=Dr[t||""]||Dr[""];nc[r]<nc[o.minimalSeverity]||(o.logDateTime&&(e=`${new Date().toISOString()}|${e}`),o.logSourceLocation,kx[o.provider].log(r,e,t))}var ma,ga,nc,kx,rc,Dr,Te,go,bo,yo,mo,ct=$(()=>{"use strict";ma=class{log(e,n,t){}},ga=class{log(e,n,t){console.log(`${this.color(e)} ${t?"\x1B[35m"+t+"\x1B[0m ":""}${n}`)}color(e){switch(e){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: ${e}`)}}},nc={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},kx={none:new ma,console:new ga},rc={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1},Dr={"":rc};(u=>{function r(l,c){u("verbose",l,c)}u.verbose=r;function e(l,c){u("info",l,c)}u.info=e;function n(l,c){u("warning",l,c)}u.warning=n;function t(l,c){u("error",l,c)}u.error=t;function o(l,c){u("fatal",l,c)}u.fatal=o;function i(l){Dr={},a("",l||{})}u.reset=i;function a(l,c){if(l==="*")i(c);else{let d=Dr[l]||rc;Dr[l]={provider:c.provider||d.provider,minimalSeverity:c.minimalSeverity||d.minimalSeverity,logDateTime:c.logDateTime===void 0?d.logDateTime:c.logDateTime,logSourceLocation:c.logSourceLocation===void 0?d.logSourceLocation:c.logSourceLocation}}}u.set=a;function s(l){let c={};l.logLevel&&(c.minimalSeverity=l.logLevel),a("",c)}u.setWithEnv=s})(En||={});Te=En,go=class{constructor(e,n,t,o,i,a){this.category=e;this.name=n;this.startTime=t;this.endCallback=o;this.timer=i;this.ctx=a}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)}},bo=class{constructor(e,n,t,o){this.category=e;this.name=n;this.startTime=t;this.endTime=o}},yo=class{constructor(e,n,t){this._started=!1;this._flushPointer=0;this._started=!1,this._maxNumberEvents=e===void 0?1e4:e,this._flushBatchSize=n===void 0?10:n,this._flushIntervalInMilliseconds=t===void 0?5e3:t}static create(e){return e===void 0?new this:new this(e.maxNumberEvents,e.flushBatchSize,e.flushIntervalInMilliseconds)}start(){this._started=!0,this._timingEvents=[],this._flushTime=mo(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer])}event(e,n,t,o){let i=this._started?this.begin(e,n,o):void 0,a=!1,s=t();if(s&&typeof s.then=="function")return a=!0,new Promise((u,l)=>{s.then(async c=>{i&&await i.end(),u(c)},async c=>{i&&await i.end(),l(c)})});if(!a&&i){let u=i.end();if(u&&typeof u.then=="function")return new Promise((l,c)=>{u.then(()=>{l(s)},d=>{c(d)})})}return s}begin(e,n,t){if(!this._started)throw new Error("profiler is not started yet");if(t===void 0){let o=mo();return this.flush(o),new go(e,n,o,i=>this.endSync(i))}else{let o=t.beginTimer();return new go(e,n,0,async i=>this.end(i),o,t)}}async end(e){let n=await e.checkTimer();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new bo(e.category,e.name,e.startTime,n)),this.flush(n))}endSync(e){let n=mo();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new bo(e.category,e.name,e.startTime,n)),this.flush(n))}logOneEvent(e){Te.verbose(`Profiler.${e.category}`,`${(e.endTime-e.startTime).toFixed(2)}ms on event '${e.name}' at ${e.endTime.toFixed(2)}`)}flush(e){if(this._timingEvents.length-this._flushPointer>=this._flushBatchSize||e-this._flushTime>=this._flushIntervalInMilliseconds){for(let n=this._flushPointer;this._flushPointer<n+this._flushBatchSize&&this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer]);this._flushTime=mo()}}get started(){return this._started}},mo=typeof performance<"u"&&performance.now?()=>performance.now():Date.now});function oc(r,e,n){for(let t of n){let o=t[0],i=t[1],a=t[2],s=t[3],u=t[4];if(r.opType===o){for(let l of e)if((l.domain===i||l.domain==="ai.onnx"&&i==="")&&Rx(l.version,a))return{opImpl:s,opInit:u}}}throw new TypeError(`cannot resolve operator '${r.opType}' with opsets: ${e.map(t=>`${t.domain||"ai.onnx"} v${t.version}`).join(", ")}`)}function Rx(r,e){if(e.endsWith("+")){let n=Number.parseInt(e.substring(0,e.length-1),10);return!isNaN(n)&&n<=r}else if(e.split("-").length===2){let n=e.split("-"),t=Number.parseInt(n[0],10),o=Number.parseInt(n[1],10);return!isNaN(t)&&!isNaN(o)&&t<=r&&r<=o}else return Number.parseInt(e,10)===r}var ic=$(()=>{"use strict"});var ac=G(ba=>{"use strict";ba.__esModule=!0;var Nx=function(){function r(e){if(!e)throw new TypeError("Invalid argument; `value` has no value.");this.value=r.EMPTY,e&&r.isGuid(e)&&(this.value=e)}return r.isGuid=function(e){var n=e.toString();return e&&(e instanceof r||r.validator.test(n))},r.create=function(){return new r([r.gen(2),r.gen(1),r.gen(1),r.gen(1),r.gen(3)].join("-"))},r.createEmpty=function(){return new r("emptyguid")},r.parse=function(e){return new r(e)},r.raw=function(){return[r.gen(2),r.gen(1),r.gen(1),r.gen(1),r.gen(3)].join("-")},r.gen=function(e){for(var n="",t=0;t<e;t++)n+=((1+Math.random())*65536|0).toString(16).substring(1);return n},r.prototype.equals=function(e){return r.isGuid(e)&&this.value===e.toString()},r.prototype.isEmpty=function(){return this.value===r.EMPTY},r.prototype.toString=function(){return this.value},r.prototype.toJSON=function(){return{value:this.value}},r.validator=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i"),r.EMPTY="00000000-0000-0000-0000-000000000000",r}();ba.Guid=Nx});function Se(r,e,n){this.low=r|0,this.high=e|0,this.unsigned=!!n}function Ke(r){return(r&&r.__isLong__)===!0}function sc(r){var e=Math.clz32(r&-r);return r?31-e:e}function qn(r,e){var n,t,o;return e?(r>>>=0,(o=0<=r&&r<256)&&(t=lc[r],t)?t:(n=ye(r,0,!0),o&&(lc[r]=n),n)):(r|=0,(o=-128<=r&&r<128)&&(t=uc[r],t)?t:(n=ye(r,r<0?-1:0,!1),o&&(uc[r]=n),n))}function pt(r,e){if(isNaN(r))return e?Tn:xt;if(e){if(r<0)return Tn;if(r>=fc)return gc}else{if(r<=-dc)return Ye;if(r+1>=dc)return mc}return r<0?pt(-r,e).neg():ye(r%fr|0,r/fr|0,e)}function ye(r,e,n){return new Se(r,e,n)}function _a(r,e,n){if(r.length===0)throw Error("empty string");if(typeof e=="number"?(n=e,e=!1):e=!!e,r==="NaN"||r==="Infinity"||r==="+Infinity"||r==="-Infinity")return e?Tn:xt;if(n=n||10,n<2||36<n)throw RangeError("radix");var t;if((t=r.indexOf("-"))>0)throw Error("interior hyphen");if(t===0)return _a(r.substring(1),e,n).neg();for(var o=pt(_o(n,8)),i=xt,a=0;a<r.length;a+=8){var s=Math.min(8,r.length-a),u=parseInt(r.substring(a,a+s),n);if(s<8){var l=pt(_o(n,s));i=i.mul(l).add(pt(u))}else i=i.mul(o),i=i.add(pt(u))}return i.unsigned=e,i}function wt(r,e){return typeof r=="number"?pt(r,e):typeof r=="string"?_a(r,e):ye(r.low,r.high,typeof e=="boolean"?e:r.unsigned)}var dt,uc,lc,_o,cc,zx,fr,fc,dc,pc,xt,Tn,pr,hc,ya,mc,gc,Ye,L,Cn,xa=$(()=>{dt=null;try{dt=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{}Se.prototype.__isLong__;Object.defineProperty(Se.prototype,"__isLong__",{value:!0});Se.isLong=Ke;uc={},lc={};Se.fromInt=qn;Se.fromNumber=pt;Se.fromBits=ye;_o=Math.pow;Se.fromString=_a;Se.fromValue=wt;cc=65536,zx=1<<24,fr=cc*cc,fc=fr*fr,dc=fc/2,pc=qn(zx),xt=qn(0);Se.ZERO=xt;Tn=qn(0,!0);Se.UZERO=Tn;pr=qn(1);Se.ONE=pr;hc=qn(1,!0);Se.UONE=hc;ya=qn(-1);Se.NEG_ONE=ya;mc=ye(-1,2147483647,!1);Se.MAX_VALUE=mc;gc=ye(-1,-1,!0);Se.MAX_UNSIGNED_VALUE=gc;Ye=ye(0,-2147483648,!1);Se.MIN_VALUE=Ye;L=Se.prototype;L.toInt=function(){return this.unsigned?this.low>>>0:this.low};L.toNumber=function(){return this.unsigned?(this.high>>>0)*fr+(this.low>>>0):this.high*fr+(this.low>>>0)};L.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Ye)){var n=pt(e),t=this.div(n),o=t.mul(n).sub(this);return t.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=pt(_o(e,6),this.unsigned),a=this,s="";;){var u=a.div(i),l=a.sub(u.mul(i)).toInt()>>>0,c=l.toString(e);if(a=u,a.isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}};L.getHighBits=function(){return this.high};L.getHighBitsUnsigned=function(){return this.high>>>0};L.getLowBits=function(){return this.low};L.getLowBitsUnsigned=function(){return this.low>>>0};L.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ye)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&(e&1<<n)==0;n--);return this.high!=0?n+33:n+1};L.isZero=function(){return this.high===0&&this.low===0};L.eqz=L.isZero;L.isNegative=function(){return!this.unsigned&&this.high<0};L.isPositive=function(){return this.unsigned||this.high>=0};L.isOdd=function(){return(this.low&1)===1};L.isEven=function(){return(this.low&1)===0};L.equals=function(e){return Ke(e)||(e=wt(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};L.eq=L.equals;L.notEquals=function(e){return!this.eq(e)};L.neq=L.notEquals;L.ne=L.notEquals;L.lessThan=function(e){return this.comp(e)<0};L.lt=L.lessThan;L.lessThanOrEqual=function(e){return this.comp(e)<=0};L.lte=L.lessThanOrEqual;L.le=L.lessThanOrEqual;L.greaterThan=function(e){return this.comp(e)>0};L.gt=L.greaterThan;L.greaterThanOrEqual=function(e){return this.comp(e)>=0};L.gte=L.greaterThanOrEqual;L.ge=L.greaterThanOrEqual;L.compare=function(e){if(Ke(e)||(e=wt(e)),this.eq(e))return 0;var n=this.isNegative(),t=e.isNegative();return n&&!t?-1:!n&&t?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};L.comp=L.compare;L.negate=function(){return!this.unsigned&&this.eq(Ye)?Ye:this.not().add(pr)};L.neg=L.negate;L.add=function(e){Ke(e)||(e=wt(e));var n=this.high>>>16,t=this.high&65535,o=this.low>>>16,i=this.low&65535,a=e.high>>>16,s=e.high&65535,u=e.low>>>16,l=e.low&65535,c=0,d=0,p=0,f=0;return f+=i+l,p+=f>>>16,f&=65535,p+=o+u,d+=p>>>16,p&=65535,d+=t+s,c+=d>>>16,d&=65535,c+=n+a,c&=65535,ye(p<<16|f,c<<16|d,this.unsigned)};L.subtract=function(e){return Ke(e)||(e=wt(e)),this.add(e.neg())};L.sub=L.subtract;L.multiply=function(e){if(this.isZero())return this;if(Ke(e)||(e=wt(e)),dt){var n=dt.mul(this.low,this.high,e.low,e.high);return ye(n,dt.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?Tn:xt;if(this.eq(Ye))return e.isOdd()?Ye:xt;if(e.eq(Ye))return this.isOdd()?Ye:xt;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(pc)&&e.lt(pc))return pt(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,o=this.high&65535,i=this.low>>>16,a=this.low&65535,s=e.high>>>16,u=e.high&65535,l=e.low>>>16,c=e.low&65535,d=0,p=0,f=0,h=0;return h+=a*c,f+=h>>>16,h&=65535,f+=i*c,p+=f>>>16,f&=65535,f+=a*l,p+=f>>>16,f&=65535,p+=o*c,d+=p>>>16,p&=65535,p+=i*l,d+=p>>>16,p&=65535,p+=a*u,d+=p>>>16,p&=65535,d+=t*c+o*l+i*u+a*s,d&=65535,ye(f<<16|h,d<<16|p,this.unsigned)};L.mul=L.multiply;L.divide=function(e){if(Ke(e)||(e=wt(e)),e.isZero())throw Error("division by zero");if(dt){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?dt.div_u:dt.div_s)(this.low,this.high,e.low,e.high);return ye(n,dt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Tn:xt;var t,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Tn;if(e.gt(this.shru(1)))return hc;i=Tn}else{if(this.eq(Ye)){if(e.eq(pr)||e.eq(ya))return Ye;if(e.eq(Ye))return pr;var a=this.shr(1);return t=a.div(e).shl(1),t.eq(xt)?e.isNegative()?pr:ya:(o=this.sub(e.mul(t)),i=t.add(o.div(e)),i)}else if(e.eq(Ye))return this.unsigned?Tn:xt;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=xt}for(o=this;o.gte(e);){t=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(t)/Math.LN2),u=s<=48?1:_o(2,s-48),l=pt(t),c=l.mul(e);c.isNegative()||c.gt(o);)t-=u,l=pt(t,this.unsigned),c=l.mul(e);l.isZero()&&(l=pr),i=i.add(l),o=o.sub(c)}return i};L.div=L.divide;L.modulo=function(e){if(Ke(e)||(e=wt(e)),dt){var n=(this.unsigned?dt.rem_u:dt.rem_s)(this.low,this.high,e.low,e.high);return ye(n,dt.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};L.mod=L.modulo;L.rem=L.modulo;L.not=function(){return ye(~this.low,~this.high,this.unsigned)};L.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};L.clz=L.countLeadingZeros;L.countTrailingZeros=function(){return this.low?sc(this.low):sc(this.high)+32};L.ctz=L.countTrailingZeros;L.and=function(e){return Ke(e)||(e=wt(e)),ye(this.low&e.low,this.high&e.high,this.unsigned)};L.or=function(e){return Ke(e)||(e=wt(e)),ye(this.low|e.low,this.high|e.high,this.unsigned)};L.xor=function(e){return Ke(e)||(e=wt(e)),ye(this.low^e.low,this.high^e.high,this.unsigned)};L.shiftLeft=function(e){return Ke(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?ye(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):ye(0,this.low<<e-32,this.unsigned)};L.shl=L.shiftLeft;L.shiftRight=function(e){return Ke(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?ye(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):ye(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};L.shr=L.shiftRight;L.shiftRightUnsigned=function(e){return Ke(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?ye(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?ye(this.high,0,this.unsigned):ye(this.high>>>e-32,0,this.unsigned)};L.shru=L.shiftRightUnsigned;L.shr_u=L.shiftRightUnsigned;L.rotateLeft=function(e){var n;return Ke(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?ye(this.high,this.low,this.unsigned):e<32?(n=32-e,ye(this.low<<e|this.high>>>n,this.high<<e|this.low>>>n,this.unsigned)):(e-=32,n=32-e,ye(this.high<<e|this.low>>>n,this.low<<e|this.high>>>n,this.unsigned))};L.rotl=L.rotateLeft;L.rotateRight=function(e){var n;return Ke(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?ye(this.high,this.low,this.unsigned):e<32?(n=32-e,ye(this.high<<n|this.low>>>e,this.low<<n|this.high>>>e,this.unsigned)):(e-=32,n=32-e,ye(this.low<<n|this.high>>>e,this.high<<n|this.low>>>e,this.unsigned))};L.rotr=L.rotateRight;L.toSigned=function(){return this.unsigned?ye(this.low,this.high,!1):this};L.toUnsigned=function(){return this.unsigned?this:ye(this.low,this.high,!0)};L.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};L.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};L.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};Se.fromBytes=function(e,n,t){return t?Se.fromBytesLE(e,n):Se.fromBytesBE(e,n)};Se.fromBytesLE=function(e,n){return new Se(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};Se.fromBytesBE=function(e,n){return new Se(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)};Cn=Se});var wa=G(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.ArgType=void 0;var bc;(function(r){r[r.INPUT=0]="INPUT",r[r.OUTPUT=1]="OUTPUT"})(bc||(xo.ArgType=bc={}))});var jn=G(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.SIZE_PREFIX_LENGTH=Et.FILE_IDENTIFIER_LENGTH=Et.SIZEOF_INT=Et.SIZEOF_SHORT=void 0;Et.SIZEOF_SHORT=2;Et.SIZEOF_INT=4;Et.FILE_IDENTIFIER_LENGTH=4;Et.SIZE_PREFIX_LENGTH=4});var Ta=G(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.isLittleEndian=ft.float64=ft.float32=ft.int32=void 0;ft.int32=new Int32Array(2);ft.float32=new Float32Array(ft.int32.buffer);ft.float64=new Float64Array(ft.int32.buffer);ft.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var va=G(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.Encoding=void 0;var yc;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(yc||(wo.Encoding=yc={}))});var Sa=G(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.ByteBuffer=void 0;var Ct=jn(),et=Ta(),Mx=va(),Ia=class r{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new r(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return et.int32[0]=this.readInt32(e),et.float32[0]}readFloat64(e){return et.int32[et.isLittleEndian?0:1]=this.readInt32(e),et.int32[et.isLittleEndian?1:0]=this.readInt32(e+4),et.float64[0]}writeInt8(e,n){this.bytes_[e]=n}writeUint8(e,n){this.bytes_[e]=n}writeInt16(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8}writeUint16(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8}writeInt32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeUint32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeInt64(e,n){this.writeInt32(e,Number(BigInt.asIntN(32,n))),this.writeInt32(e+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(e,n){this.writeUint32(e,Number(BigInt.asUintN(32,n))),this.writeUint32(e+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(e,n){et.float32[0]=n,this.writeInt32(e,et.int32[0])}writeFloat64(e,n){et.float64[0]=n,this.writeInt32(e,et.int32[et.isLittleEndian?0:1]),this.writeInt32(e+4,et.int32[et.isLittleEndian?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Ct.SIZEOF_INT+Ct.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let n=0;n<Ct.FILE_IDENTIFIER_LENGTH;n++)e+=String.fromCharCode(this.readInt8(this.position_+Ct.SIZEOF_INT+n));return e}__offset(e,n){let t=e-this.readInt32(e);return n<this.readInt16(t)?this.readInt16(t+n):0}__union(e,n){return e.bb_pos=n+this.readInt32(n),e.bb=this,e}__string(e,n){e+=this.readInt32(e);let t=this.readInt32(e);e+=Ct.SIZEOF_INT;let o=this.bytes_.subarray(e,e+t);return n===Mx.Encoding.UTF8_BYTES?o:this.text_decoder_.decode(o)}__union_with_string(e,n){return typeof e=="string"?this.__string(n):this.__union(e,n)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+Ct.SIZEOF_INT}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=Ct.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+Ct.FILE_IDENTIFIER_LENGTH);for(let n=0;n<Ct.FILE_IDENTIFIER_LENGTH;n++)if(e.charCodeAt(n)!=this.readInt8(this.position()+Ct.SIZEOF_INT+n))return!1;return!0}createScalarList(e,n){let t=[];for(let o=0;o<n;++o){let i=e(o);i!==null&&t.push(i)}return t}createObjList(e,n){let t=[];for(let o=0;o<n;++o){let i=e(o);i!==null&&t.push(i.unpack())}return t}};To.ByteBuffer=Ia});var xc=G(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.Builder=void 0;var _c=Sa(),at=jn(),$a=class r{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;e?n=e:n=1024,this.bb=_c.ByteBuffer.allocate(n),this.space=n}clear(){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,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,n){e>this.minalign&&(this.minalign=e);let t=~(this.bb.capacity()-this.space+n)+1&e-1;for(;this.space<t+e+n;){let o=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-o}this.pad(t)}pad(e){for(let n=0;n<e;n++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,n,t){(this.force_defaults||n!=t)&&(this.addInt8(n),this.slot(e))}addFieldInt16(e,n,t){(this.force_defaults||n!=t)&&(this.addInt16(n),this.slot(e))}addFieldInt32(e,n,t){(this.force_defaults||n!=t)&&(this.addInt32(n),this.slot(e))}addFieldInt64(e,n,t){(this.force_defaults||n!==t)&&(this.addInt64(n),this.slot(e))}addFieldFloat32(e,n,t){(this.force_defaults||n!=t)&&(this.addFloat32(n),this.slot(e))}addFieldFloat64(e,n,t){(this.force_defaults||n!=t)&&(this.addFloat64(n),this.slot(e))}addFieldOffset(e,n,t){(this.force_defaults||n!=t)&&(this.addOffset(n),this.slot(e))}addFieldStruct(e,n,t){n!=t&&(this.nested(n),this.slot(e))}nested(e){if(e!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let n=e.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let t=n<<1,o=_c.ByteBuffer.allocate(t);return o.setPosition(t-n),o.bytes().set(e.bytes(),t-n),o}addOffset(e){this.prep(at.SIZEOF_INT,0),this.writeInt32(this.offset()-e+at.SIZEOF_INT)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let n=0;n<e;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let e=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let t=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?e-this.vtable[n]:0);let o=2;this.addInt16(e-this.object_start);let i=(t+o)*at.SIZEOF_SHORT;this.addInt16(i);let a=0,s=this.space;e:for(n=0;n<this.vtables.length;n++){let u=this.bb.capacity()-this.vtables[n];if(i==this.bb.readInt16(u)){for(let l=at.SIZEOF_SHORT;l<i;l+=at.SIZEOF_SHORT)if(this.bb.readInt16(s+l)!=this.bb.readInt16(u+l))continue e;a=this.vtables[n];break}}return a?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,a-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,n,t){let o=t?at.SIZE_PREFIX_LENGTH:0;if(n){let i=n;if(this.prep(this.minalign,at.SIZEOF_INT+at.FILE_IDENTIFIER_LENGTH+o),i.length!=at.FILE_IDENTIFIER_LENGTH)throw new TypeError("FlatBuffers: file identifier must be length "+at.FILE_IDENTIFIER_LENGTH);for(let a=at.FILE_IDENTIFIER_LENGTH-1;a>=0;a--)this.writeInt8(i.charCodeAt(a))}this.prep(this.minalign,at.SIZEOF_INT+o),this.addOffset(e),o&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,n){this.finish(e,n,!0)}requiredField(e,n){let t=this.bb.capacity()-e,o=t-this.bb.readInt32(t);if(!(n<this.bb.readInt16(o)&&this.bb.readInt16(o+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(e,n,t){this.notNested(),this.vector_num_elems=n,this.prep(at.SIZEOF_INT,e*n),this.prep(t,e*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);let n=this.createString(e);return this.string_maps.set(e,n),n}createString(e){if(e==null)return 0;let n;return e instanceof Uint8Array?n=e:n=this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length),this.bb.bytes().set(n,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){let n=[];for(let t=0;t<e.length;++t){let o=e[t];if(o!==null)n.push(this.createObjectOffset(o));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(e,n){return n(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}};vo.Builder=$a});var _e=G(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ByteBuffer=Pe.Builder=Pe.Encoding=Pe.isLittleEndian=Pe.float64=Pe.float32=Pe.int32=Pe.SIZE_PREFIX_LENGTH=Pe.FILE_IDENTIFIER_LENGTH=Pe.SIZEOF_INT=Pe.SIZEOF_SHORT=void 0;var Bx=jn();Object.defineProperty(Pe,"SIZEOF_SHORT",{enumerable:!0,get:function(){return Bx.SIZEOF_SHORT}});var Vx=jn();Object.defineProperty(Pe,"SIZEOF_INT",{enumerable:!0,get:function(){return Vx.SIZEOF_INT}});var Fx=jn();Object.defineProperty(Pe,"FILE_IDENTIFIER_LENGTH",{enumerable:!0,get:function(){return Fx.FILE_IDENTIFIER_LENGTH}});var Gx=jn();Object.defineProperty(Pe,"SIZE_PREFIX_LENGTH",{enumerable:!0,get:function(){return Gx.SIZE_PREFIX_LENGTH}});var Io=Ta();Object.defineProperty(Pe,"int32",{enumerable:!0,get:function(){return Io.int32}});Object.defineProperty(Pe,"float32",{enumerable:!0,get:function(){return Io.float32}});Object.defineProperty(Pe,"float64",{enumerable:!0,get:function(){return Io.float64}});Object.defineProperty(Pe,"isLittleEndian",{enumerable:!0,get:function(){return Io.isLittleEndian}});var Ux=va();Object.defineProperty(Pe,"Encoding",{enumerable:!0,get:function(){return Ux.Encoding}});var Wx=xc();Object.defineProperty(Pe,"Builder",{enumerable:!0,get:function(){return Wx.Builder}});var Hx=Sa();Object.defineProperty(Pe,"ByteBuffer",{enumerable:!0,get:function(){return Hx.ByteBuffer}})});var Pa=G(Dt=>{"use strict";var qx=Dt&&Dt.__createBinding||(Object.create?function(r,e,n,t){t===void 0&&(t=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(r,t,o)}:function(r,e,n,t){t===void 0&&(t=n),r[t]=e[n]}),jx=Dt&&Dt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Kx=Dt&&Dt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var n in r)n!=="default"&&Object.prototype.hasOwnProperty.call(r,n)&&qx(e,r,n);return jx(e,r),e};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.ArgTypeAndIndex=void 0;var Xx=Kx(_e()),wc=wa(),Aa=class r{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsArgTypeAndIndex(e,n){return(n||new r).__init(e.readInt32