Yang Gu commited on
Commit
821b652
1 Parent(s): eccf3fa

Add ort-phi3 dist

Browse files
demo/ort-phi3/dist/esm/ort.all.min.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.all.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.min.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.training.wasm.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.training.wasm.min.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.training.wasm.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.wasm-core.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.wasm-core.min.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * ONNX Runtime Web v1.18.0
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ var Je=Object.defineProperty;var Xr=Object.getOwnPropertyDescriptor;var Jr=Object.getOwnPropertyNames;var Kr=Object.prototype.hasOwnProperty;var B=(r,t)=>()=>(r&&(t=r(r=0)),t);var Zr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Re=(r,t)=>{for(var e in t)Je(r,e,{get:t[e],enumerable:!0})},Qr=(r,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jr(t))!Kr.call(r,o)&&o!==e&&Je(r,o,{get:()=>t[o],enumerable:!(a=Xr(t,o))||a.enumerable});return r};var Ke=r=>Qr(Je({},"__esModule",{value:!0}),r);var Ue,fe,Ae,en,Le,Fe=B(()=>{"use strict";Ue=new Map,fe=[],Ae=(r,t,e)=>{if(t&&typeof t.init=="function"&&typeof t.createInferenceSessionHandler=="function"){let a=Ue.get(r);if(a===void 0)Ue.set(r,{backend:t,priority:e});else{if(a.priority>e)return;if(a.priority===e&&a.backend!==t)throw new Error(`cannot register backend "${r}" using priority ${e}`)}if(e>=0){let o=fe.indexOf(r);o!==-1&&fe.splice(o,1);for(let d=0;d<fe.length;d++)if(Ue.get(fe[d]).priority<=e){fe.splice(d,0,r);return}fe.push(r)}return}throw new TypeError("not a valid backend")},en=async r=>{let t=Ue.get(r);if(!t)return"backend not found.";if(t.initialized)return t.backend;if(t.aborted)return t.error;{let e=!!t.initPromise;try{return e||(t.initPromise=t.backend.init(r)),await t.initPromise,t.initialized=!0,t.backend}catch(a){return e||(t.error=`${a}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},Le=async r=>{let t=r.executionProviders||[],e=t.map(f=>typeof f=="string"?f:f.name),a=e.length===0?fe:e,o,d=[],i=new Set;for(let f of a){let l=await en(f);typeof l=="string"?d.push({name:f,err:l}):(o||(o=l),o===l&&i.add(f))}if(!o)throw new Error(`no available backend found. ERR: ${d.map(f=>`[${f.name}] ${f.err}`).join(", ")}`);for(let{name:f,err:l}of d)e.includes(f)&&console.warn(`removing requested execution provider "${f}" from session options because it is not available: ${l}`);let c=t.filter(f=>i.has(typeof f=="string"?f:f.name));return[o,new Proxy(r,{get:(f,l)=>l==="executionProviders"?c:Reflect.get(f,l)})]}});var Bt=B(()=>{"use strict";Fe()});var Ct,_t=B(()=>{"use strict";Ct="1.18.0"});var Dt,V,Ze=B(()=>{"use strict";_t();Dt="warning",V={wasm:{},webgl:{},webgpu:{},versions:{common:Ct},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}`);Dt=r}},get logLevel(){return Dt}};Object.defineProperty(V,"logLevel",{enumerable:!0})});var k,Rt=B(()=>{"use strict";Ze();k=V});var Ut,Lt,Ft=B(()=>{"use strict";Ut=(r,t)=>{let e=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);e.width=r.dims[3],e.height=r.dims[2];let a=e.getContext("2d");if(a!=null){let o,d;t?.tensorLayout!==void 0&&t.tensorLayout==="NHWC"?(o=r.dims[2],d=r.dims[3]):(o=r.dims[3],d=r.dims[2]);let i=t?.format!==void 0?t.format:"RGB",c=t?.norm,f,l;c===void 0||c.mean===void 0?f=[255,255,255,255]:typeof c.mean=="number"?f=[c.mean,c.mean,c.mean,c.mean]:(f=[c.mean[0],c.mean[1],c.mean[2],0],c.mean[3]!==void 0&&(f[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 y=d*o,w=0,h=y,b=y*2,E=-1;i==="RGBA"?(w=0,h=y,b=y*2,E=y*3):i==="RGB"?(w=0,h=y,b=y*2):i==="RBG"&&(w=0,b=y,h=y*2);for(let A=0;A<d;A++)for(let S=0;S<o;S++){let _=(r.data[w++]-l[0])*f[0],x=(r.data[h++]-l[1])*f[1],C=(r.data[b++]-l[2])*f[2],N=E===-1?255:(r.data[E++]-l[3])*f[3];a.fillStyle="rgba("+_+","+x+","+C+","+N+")",a.fillRect(S,A,1,1)}if("toDataURL"in e)return e.toDataURL();throw new Error("toDataURL is not supported")}else throw new Error("Can not access image data")},Lt=(r,t)=>{let e=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),a;if(e!=null){let o,d,i;t?.tensorLayout!==void 0&&t.tensorLayout==="NHWC"?(o=r.dims[2],d=r.dims[1],i=r.dims[3]):(o=r.dims[3],d=r.dims[2],i=r.dims[1]);let c=t!==void 0&&t.format!==void 0?t.format:"RGB",f=t?.norm,l,y;f===void 0||f.mean===void 0?l=[255,255,255,255]:typeof f.mean=="number"?l=[f.mean,f.mean,f.mean,f.mean]:(l=[f.mean[0],f.mean[1],f.mean[2],255],f.mean[3]!==void 0&&(l[3]=f.mean[3])),f===void 0||f.bias===void 0?y=[0,0,0,0]:typeof f.bias=="number"?y=[f.bias,f.bias,f.bias,f.bias]:(y=[f.bias[0],f.bias[1],f.bias[2],0],f.bias[3]!==void 0&&(y[3]=f.bias[3]));let w=d*o;if(t!==void 0&&(t.format!==void 0&&i===4&&t.format!=="RGBA"||i===3&&t.format!=="RGB"&&t.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let h=4,b=0,E=1,A=2,S=3,_=0,x=w,C=w*2,N=-1;c==="RGBA"?(_=0,x=w,C=w*2,N=w*3):c==="RGB"?(_=0,x=w,C=w*2):c==="RBG"&&(_=0,C=w,x=w*2),a=e.createImageData(o,d);for(let O=0;O<d*o;b+=h,E+=h,A+=h,S+=h,O++)a.data[b]=(r.data[_++]-y[0])*l[0],a.data[E]=(r.data[x++]-y[1])*l[1],a.data[A]=(r.data[C++]-y[2])*l[2],a.data[S]=N===-1?255:(r.data[N++]-y[3])*l[3]}else throw new Error("Can not access image data");return a}});var Qe,kt,Mt,Nt,Wt,Gt=B(()=>{"use strict";ke();Qe=(r,t)=>{if(r===void 0)throw new Error("Image buffer must be defined");if(t.height===void 0||t.width===void 0)throw new Error("Image height and width must be defined");if(t.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:e,width:a}=t,o=t.norm??{mean:255,bias:0},d,i;typeof o.mean=="number"?d=[o.mean,o.mean,o.mean,o.mean]:d=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?i=[o.bias,o.bias,o.bias,o.bias]:i=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];let c=t.format!==void 0?t.format:"RGBA",f=t.tensorFormat!==void 0&&t.tensorFormat!==void 0?t.tensorFormat:"RGB",l=e*a,y=f==="RGBA"?new Float32Array(l*4):new Float32Array(l*3),w=4,h=0,b=1,E=2,A=3,S=0,_=l,x=l*2,C=-1;c==="RGB"&&(w=3,h=0,b=1,E=2,A=-1),f==="RGBA"?C=l*3:f==="RBG"?(S=0,x=l,_=l*2):f==="BGR"&&(x=0,_=l,S=l*2);for(let O=0;O<l;O++,h+=w,E+=w,b+=w,A+=w)y[S++]=(r[h]+i[0])/d[0],y[_++]=(r[b]+i[1])/d[1],y[x++]=(r[E]+i[2])/d[2],C!==-1&&A!==-1&&(y[C++]=(r[A]+i[3])/d[3]);return f==="RGBA"?new j("float32",y,[1,4,e,a]):new j("float32",y,[1,3,e,a])},kt=async(r,t)=>{let e=typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement,a=typeof ImageData<"u"&&r instanceof ImageData,o=typeof ImageBitmap<"u"&&r instanceof ImageBitmap,d=typeof r=="string",i,c=t??{},f=()=>{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=y=>y instanceof HTMLCanvasElement||y instanceof OffscreenCanvas?y.getContext("2d"):null;if(e){let y=f();y.width=r.width,y.height=r.height;let w=l(y);if(w!=null){let h=r.height,b=r.width;if(t!==void 0&&t.resizedHeight!==void 0&&t.resizedWidth!==void 0&&(h=t.resizedHeight,b=t.resizedWidth),t!==void 0){if(c=t,t.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");c.tensorFormat="RGBA",c.height=h,c.width=b}else c.tensorFormat="RGBA",c.height=h,c.width=b;w.drawImage(r,0,0),i=w.getImageData(0,0,b,h).data}else throw new Error("Can not access image data")}else if(a){let y,w;if(t!==void 0&&t.resizedWidth!==void 0&&t.resizedHeight!==void 0?(y=t.resizedHeight,w=t.resizedWidth):(y=r.height,w=r.width),t!==void 0&&(c=t),c.format="RGBA",c.height=y,c.width=w,t!==void 0){let h=f();h.width=w,h.height=y;let b=l(h);if(b!=null)b.putImageData(r,0,0),i=b.getImageData(0,0,w,y).data;else throw new Error("Can not access image data")}else i=r.data}else if(o){if(t===void 0)throw new Error("Please provide image config with format for Imagebitmap");let y=f();y.width=r.width,y.height=r.height;let w=l(y);if(w!=null){let h=r.height,b=r.width;return w.drawImage(r,0,0,b,h),i=w.getImageData(0,0,b,h).data,c.height=h,c.width=b,Qe(i,c)}else throw new Error("Can not access image data")}else{if(d)return new Promise((y,w)=>{let h=f(),b=l(h);if(!r||!b)return w();let E=new Image;E.crossOrigin="Anonymous",E.src=r,E.onload=()=>{h.width=E.width,h.height=E.height,b.drawImage(E,0,0,h.width,h.height);let A=b.getImageData(0,0,h.width,h.height);c.height=h.height,c.width=h.width,y(Qe(A.data,c))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(i!==void 0)return Qe(i,c);throw new Error("Input data provided is not supported - aborted tensor creation")},Mt=(r,t)=>{let{width:e,height:a,download:o,dispose:d}=t,i=[1,a,e,4];return new j({location:"texture",type:"float32",texture:r,dims:i,download:o,dispose:d})},Nt=(r,t)=>{let{dataType:e,dims:a,download:o,dispose:d}=t;return new j({location:"gpu-buffer",type:e??"float32",gpuBuffer:r,dims:a,download:o,dispose:d})},Wt=(r,t,e)=>new j({location:"cpu-pinned",type:r,data:t,dims:e??[t.length]})});var ce,Se,Ht,$t,zt=B(()=>{"use strict";ce=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),Se=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),Ht=!1,$t=()=>{if(!Ht){Ht=!0;let r=typeof BigInt64Array<"u"&&BigInt64Array.from,t=typeof BigUint64Array<"u"&&BigUint64Array.from,e=typeof Float16Array<"u"&&Float16Array.from;r&&(ce.set("int64",BigInt64Array),Se.set(BigInt64Array,"int64")),t&&(ce.set("uint64",BigUint64Array),Se.set(BigUint64Array,"uint64")),e?(ce.set("float16",Float16Array),Se.set(Float16Array,"float16")):ce.set("float16",Uint16Array)}}});var jt,Yt,qt=B(()=>{"use strict";ke();jt=r=>{let t=1;for(let e=0;e<r.length;e++){let a=r[e];if(typeof a!="number"||!Number.isSafeInteger(a))throw new TypeError(`dims[${e}] must be an integer, got: ${a}`);if(a<0)throw new RangeError(`dims[${e}] must be a non-negative integer, got: ${a}`);t*=a}return t},Yt=(r,t)=>{switch(r.location){case"cpu":return new j(r.type,r.data,t);case"cpu-pinned":return new j({location:"cpu-pinned",data:r.data,type:r.type,dims:t});case"texture":return new j({location:"texture",texture:r.texture,type:r.type,dims:t});case"gpu-buffer":return new j({location:"gpu-buffer",gpuBuffer:r.gpuBuffer,type:r.type,dims:t});default:throw new Error(`tensorReshape: tensor location ${r.location} is not supported`)}}});var j,ke=B(()=>{"use strict";Ft();Gt();zt();qt();j=class{constructor(t,e,a){$t();let o,d;if(typeof t=="object"&&"location"in t)switch(this.dataLocation=t.location,o=t.type,d=t.dims,t.location){case"cpu-pinned":{let c=ce.get(o);if(!c)throw new TypeError(`unsupported type "${o}" to create tensor from pinned buffer`);if(!(t.data instanceof c))throw new TypeError(`buffer should be of type ${c.name}`);this.cpuData=t.data;break}case"texture":{if(o!=="float32")throw new TypeError(`unsupported type "${o}" to create tensor from texture`);this.gpuTextureData=t.texture,this.downloader=t.download,this.disposer=t.dispose;break}case"gpu-buffer":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint8"&&o!=="bool")throw new TypeError(`unsupported type "${o}" to create tensor from gpu buffer`);this.gpuBufferData=t.gpuBuffer,this.downloader=t.download,this.disposer=t.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let c,f;if(typeof t=="string")if(o=t,f=a,t==="string"){if(!Array.isArray(e))throw new TypeError("A string tensor's data must be a string array.");c=e}else{let l=ce.get(t);if(l===void 0)throw new TypeError(`Unsupported tensor type: ${t}.`);if(Array.isArray(e)){if(t==="float16"&&l===Uint16Array)throw new TypeError("Creating a float16 tensor from number array is not supported. Please use Uint16Array as data.");t==="uint64"||t==="int64"?c=l.from(e,BigInt):c=l.from(e)}else if(e instanceof l)c=e;else throw new TypeError(`A ${o} tensor's data must be type of ${l}`)}else if(f=e,Array.isArray(t)){if(t.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let l=typeof t[0];if(l==="string")o="string",c=t;else if(l==="boolean")o="bool",c=Uint8Array.from(t);else throw new TypeError(`Invalid element type of data array: ${l}.`)}else{let l=Se.get(t.constructor);if(l===void 0)throw new TypeError(`Unsupported type for tensor data: ${t.constructor}.`);o=l,c=t}if(f===void 0)f=[c.length];else if(!Array.isArray(f))throw new TypeError("A tensor's dims must be a number array");d=f,this.cpuData=c,this.dataLocation="cpu"}let i=jt(d);if(this.cpuData&&i!==this.cpuData.length)throw new Error(`Tensor's size(${i}) does not match data length(${this.cpuData.length}).`);this.type=o,this.dims=d,this.size=i}static async fromImage(t,e){return kt(t,e)}static fromTexture(t,e){return Mt(t,e)}static fromGpuBuffer(t,e){return Nt(t,e)}static fromPinnedBuffer(t,e,a){return Wt(t,e,a)}toDataURL(t){return Ut(this,t)}toImageData(t){return Lt(this,t)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}async getData(t){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let e=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=e,t&&this.disposer&&(this.disposer(),this.disposer=void 0),e}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(t){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Yt(this,t)}}});var H,Me=B(()=>{"use strict";ke();H=j});var Vt,Xt,le,de,et=B(()=>{"use strict";Ze();Vt=(r,t)=>{(typeof V.trace>"u"?!V.wasm.trace:!V.trace)||console.timeStamp(`${r}::ORT::${t}`)},Xt=(r,t)=>{let e=new Error().stack?.split(/\r\n|\r|\n/g)||[],a=!1;for(let o=0;o<e.length;o++){if(a&&!e[o].includes("TRACE_FUNC")){let d=`FUNC_${r}::${e[o].trim().split(" ")[1]}`;t&&(d+=`::${t}`),Vt("CPU",d);return}e[o].includes("TRACE_FUNC")&&(a=!0)}},le=r=>{(typeof V.trace>"u"?!V.wasm.trace:!V.trace)||Xt("BEGIN",r)},de=r=>{(typeof V.trace>"u"?!V.wasm.trace:!V.trace)||Xt("END",r)}});var Ne,Jt=B(()=>{"use strict";Fe();Me();et();Ne=class r{constructor(t){this.handler=t}async run(t,e,a){le();let o={},d={};if(typeof t!="object"||t===null||t instanceof H||Array.isArray(t))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let i=!0;if(typeof e=="object"){if(e===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(e instanceof H)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(e)){if(e.length===0)throw new TypeError("'fetches' cannot be an empty array.");i=!1;for(let l of e){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 a=="object"&&a!==null)d=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else{let l=!1,y=Object.getOwnPropertyNames(e);for(let w of this.outputNames)if(y.indexOf(w)!==-1){let h=e[w];(h===null||h instanceof H)&&(l=!0,i=!1,o[w]=h)}if(l){if(typeof a=="object"&&a!==null)d=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else d=e}}else if(typeof e<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let l of this.inputNames)if(typeof t[l]>"u")throw new Error(`input '${l}' is missing in 'feeds'.`);if(i)for(let l of this.outputNames)o[l]=null;let c=await this.handler.run(t,o,d),f={};for(let l in c)if(Object.hasOwnProperty.call(c,l)){let y=c[l];y instanceof H?f[l]=y:f[l]=new H(y.type,y.data,y.dims)}return de(),f}async release(){return this.handler.dispose()}static async create(t,e,a,o){le();let d,i={};if(typeof t=="string"){if(d=t,typeof e=="object"&&e!==null)i=e;else if(typeof e<"u")throw new TypeError("'options' must be an object.")}else if(t instanceof Uint8Array){if(d=t,typeof e=="object"&&e!==null)i=e;else if(typeof e<"u")throw new TypeError("'options' must be an object.")}else if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer){let y=t,w=0,h=t.byteLength;if(typeof e=="object"&&e!==null)i=e;else if(typeof e=="number"){if(w=e,!Number.isSafeInteger(w))throw new RangeError("'byteOffset' must be an integer.");if(w<0||w>=y.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${y.byteLength}).`);if(h=t.byteLength-w,typeof a=="number"){if(h=a,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||w+h>y.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${y.byteLength-w}].`);if(typeof o=="object"&&o!==null)i=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof a<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof e<"u")throw new TypeError("'options' must be an object.");d=new Uint8Array(y,w,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[c,f]=await Le(i),l=await c.createInferenceSessionHandler(d,f);return de(),new r(l)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}});var tn,Kt=B(()=>{"use strict";Jt();tn=Ne});var Zt=B(()=>{"use strict"});var Qt=B(()=>{"use strict"});var er=B(()=>{"use strict"});var tr=B(()=>{"use strict"});var rn,We,rr=B(()=>{"use strict";Fe();Me();rn="Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.",We=class r{constructor(t,e,a){this.handler=t,this.hasOptimizerModel=e,this.hasEvalModel=a}get trainingInputNames(){return this.handler.inputNames}get trainingOutputNames(){return this.handler.outputNames}get evalInputNames(){if(this.hasEvalModel)return this.handler.evalInputNames;throw new Error("This training session has no evalModel loaded.")}get evalOutputNames(){if(this.hasEvalModel)return this.handler.evalOutputNames;throw new Error("This training session has no evalModel loaded.")}static async create(t,e){let a=t.evalModel||"",o=t.optimizerModel||"",d=e||{},[i,c]=await Le(d);if(i.createTrainingSessionHandler){let f=await i.createTrainingSessionHandler(t.checkpointState,t.trainModel,a,o,c);return new r(f,!!t.optimizerModel,!!t.evalModel)}else throw new Error(rn)}typeNarrowingForRunStep(t,e,a,o,d){let i={},c={};if(typeof a!="object"||a===null||a instanceof H||Array.isArray(a))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let f=!0;if(typeof o=="object"){if(o===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(o instanceof H)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.");f=!1;for(let l of o){if(typeof l!="string")throw new TypeError("'fetches' must be a string array or an object.");if(e.indexOf(l)===-1)throw new RangeError(`'fetches' contains invalid output name: ${l}.`);i[l]=null}if(typeof d=="object"&&d!==null)c=d;else if(typeof d<"u")throw new TypeError("'options' must be an object.")}else{let l=!1,y=Object.getOwnPropertyNames(o);for(let w of e)if(y.indexOf(w)!==-1){let h=o[w];(h===null||h instanceof H)&&(l=!0,f=!1,i[w]=h)}if(l){if(typeof d=="object"&&d!==null)c=d;else if(typeof d<"u")throw new TypeError("'options' must be an object.")}else c=o}}else if(typeof o<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let l of t)if(typeof a[l]>"u")throw new Error(`input '${l}' is missing in 'feeds'.`);if(f)for(let l of e)i[l]=null;return[i,c]}convertHandlerReturnTypeToMapOfTensors(t){let e={};for(let a in t)if(Object.hasOwnProperty.call(t,a)){let o=t[a];o instanceof H?e[a]=o:e[a]=new H(o.type,o.data,o.dims)}return e}async lazyResetGrad(){await this.handler.lazyResetGrad()}async runTrainStep(t,e,a){let[o,d]=this.typeNarrowingForRunStep(this.trainingInputNames,this.trainingOutputNames,t,e,a),i=await this.handler.runTrainStep(t,o,d);return this.convertHandlerReturnTypeToMapOfTensors(i)}async runOptimizerStep(t){if(this.hasOptimizerModel)await this.handler.runOptimizerStep(t||{});else throw new Error("This TrainingSession has no OptimizerModel loaded.")}async runEvalStep(t,e,a){if(this.hasEvalModel){let[o,d]=this.typeNarrowingForRunStep(this.evalInputNames,this.evalOutputNames,t,e,a),i=await this.handler.runEvalStep(t,o,d);return this.convertHandlerReturnTypeToMapOfTensors(i)}else throw new Error("This TrainingSession has no EvalModel loaded.")}async getParametersSize(t=!0){return this.handler.getParametersSize(t)}async loadParametersBuffer(t,e=!0){let a=await this.getParametersSize(e);if(t.length!==4*a)throw new Error("Size of the buffer passed into loadParametersBuffer must match the number of parameters in the model. Please use getParametersSize method to check.");return this.handler.loadParametersBuffer(t,e)}async getContiguousParameters(t=!0){return this.handler.getContiguousParameters(t)}async release(){return this.handler.dispose()}}});var nn,nr=B(()=>{"use strict";rr();nn=We});var tt={};Re(tt,{InferenceSession:()=>tn,TRACE:()=>Vt,TRACE_FUNC_BEGIN:()=>le,TRACE_FUNC_END:()=>de,Tensor:()=>H,TrainingSession:()=>nn,env:()=>k,registerBackend:()=>Ae});var pe=B(()=>{"use strict";Bt();Rt();Kt();Me();Zt();Qt();et();er();tr();nr()});var ar={};Re(ar,{createReadStream:()=>sr,readFile:()=>on,readFileSync:()=>sn});var on,sn,sr,ir=B(()=>{on=void 0,sn=void 0,sr=void 0});var ur={};Re(ur,{join:()=>an});var an,fr=B(()=>{an=void 0});var dr=Zr((lr,rt)=>{"use strict";var cr=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(t={}){var e=t,a,o;e.ready=new Promise((n,s)=>{a=n,o=s});var d=Object.assign({},e),i="./this.program",c=typeof window=="object",f=typeof importScripts=="function",l=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",y="",w,h,b;if(l){var E=(ir(),Ke(ar)),A=(fr(),Ke(ur));y=f?A.dirname(y)+"/":__dirname+"/",w=(n,s)=>(n=n.startsWith("file://")?new URL(n):A.normalize(n),E.readFileSync(n,s?void 0:"utf8")),b=n=>(n=w(n,!0),n.buffer||(n=new Uint8Array(n)),n),h=(n,s,u,m=!0)=>{n=n.startsWith("file://")?new URL(n):A.normalize(n),E.readFile(n,m?void 0:"utf8",(g,T)=>{g?u(g):s(m?T.buffer:T)})},!e.thisProgram&&1<process.argv.length&&(i=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),e.inspect=()=>"[Emscripten Module object]"}else(c||f)&&(f?y=self.location.href:typeof document<"u"&&document.currentScript&&(y=document.currentScript.src),r&&(y=r),y.indexOf("blob:")!==0?y=y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):y="",w=n=>{var s=new XMLHttpRequest;return s.open("GET",n,!1),s.send(null),s.responseText},f&&(b=n=>{var s=new XMLHttpRequest;return s.open("GET",n,!1),s.responseType="arraybuffer",s.send(null),new Uint8Array(s.response)}),h=(n,s,u)=>{var m=new XMLHttpRequest;m.open("GET",n,!0),m.responseType="arraybuffer",m.onload=()=>{m.status==200||m.status==0&&m.response?s(m.response):u()},m.onerror=u,m.send(null)});var S=e.print||console.log.bind(console),_=e.printErr||console.error.bind(console);Object.assign(e,d),d=null,e.thisProgram&&(i=e.thisProgram);var x;e.wasmBinary&&(x=e.wasmBinary);var C=e.noExitRuntime||!0;typeof WebAssembly!="object"&&Z("no native wasm support detected");var N,O,be=!1,oe,K,v,R;function Pe(){var n=N.buffer;e.HEAP8=oe=new Int8Array(n),e.HEAP16=new Int16Array(n),e.HEAP32=v=new Int32Array(n),e.HEAPU8=K=new Uint8Array(n),e.HEAPU16=new Uint16Array(n),e.HEAPU32=R=new Uint32Array(n),e.HEAPF32=new Float32Array(n),e.HEAPF64=new Float64Array(n)}var Be=[],Ce=[],Ee=[];function se(){var n=e.preRun.shift();Be.unshift(n)}var I=0,Q=null,re=null;function Z(n){throw e.onAbort&&e.onAbort(n),n="Aborted("+n+")",_(n),be=!0,n=new WebAssembly.RuntimeError(n+". Build with -sASSERTIONS for more info."),o(n),n}function ae(n){return n.startsWith("data:application/octet-stream;base64,")}var W;if(W="ort-wasm.wasm",!ae(W)){var X=W;W=e.locateFile?e.locateFile(X,y):y+X}function Ye(n){if(n==W&&x)return new Uint8Array(x);if(b)return b(n);throw"both async and sync fetching of the wasm failed"}function me(n){if(!x&&(c||f)){if(typeof fetch=="function"&&!n.startsWith("file://"))return fetch(n,{credentials:"same-origin"}).then(s=>{if(!s.ok)throw"failed to load wasm binary file at '"+n+"'";return s.arrayBuffer()}).catch(()=>Ye(n));if(h)return new Promise((s,u)=>{h(n,m=>s(new Uint8Array(m)),u)})}return Promise.resolve().then(()=>Ye(n))}function ve(n,s,u){return me(n).then(m=>WebAssembly.instantiate(m,s)).then(m=>m).then(u,m=>{_("failed to asynchronously prepare wasm: "+m),Z(m)})}function _e(n,s){var u=W;return x||typeof WebAssembly.instantiateStreaming!="function"||ae(u)||u.startsWith("file://")||l||typeof fetch!="function"?ve(u,n,s):fetch(u,{credentials:"same-origin"}).then(m=>WebAssembly.instantiateStreaming(m,n).then(s,function(g){return _("wasm streaming compile failed: "+g),_("falling back to ArrayBuffer instantiation"),ve(u,n,s)}))}var ne,ee=n=>{for(;0<n.length;)n.shift()(e)};function ie(n){this.va=n-24,this.Ea=function(s){R[this.va+4>>2>>>0]=s},this.za=function(s){R[this.va+8>>2>>>0]=s},this.xa=function(s,u){this.ya(),this.Ea(s),this.za(u)},this.ya=function(){R[this.va+16>>2>>>0]=0}}var Te=0,$=0,G=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,te=(n,s,u)=>{s>>>=0;var m=s+u;for(u=s;n[u]&&!(u>=m);)++u;if(16<u-s&&n.buffer&&G)return G.decode(n.subarray(s,u));for(m="";s<u;){var g=n[s++];if(g&128){var T=n[s++]&63;if((g&224)==192)m+=String.fromCharCode((g&31)<<6|T);else{var P=n[s++]&63;g=(g&240)==224?(g&15)<<12|T<<6|P:(g&7)<<18|T<<12|P<<6|n[s++]&63,65536>g?m+=String.fromCharCode(g):(g-=65536,m+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else m+=String.fromCharCode(g)}return m},he=(n,s)=>(n>>>=0)?te(K,n,s):"",Oe=n=>{for(var s=0,u=0;u<n.length;++u){var m=n.charCodeAt(u);127>=m?s++:2047>=m?s+=2:55296<=m&&57343>=m?(s+=4,++u):s+=3}return s},qe=(n,s,u,m)=>{if(u>>>=0,!(0<m))return 0;var g=u;m=u+m-1;for(var T=0;T<n.length;++T){var P=n.charCodeAt(T);if(55296<=P&&57343>=P){var z=n.charCodeAt(++T);P=65536+((P&1023)<<10)|z&1023}if(127>=P){if(u>=m)break;s[u++>>>0]=P}else{if(2047>=P){if(u+1>=m)break;s[u++>>>0]=192|P>>6}else{if(65535>=P){if(u+2>=m)break;s[u++>>>0]=224|P>>12}else{if(u+3>=m)break;s[u++>>>0]=240|P>>18,s[u++>>>0]=128|P>>12&63}s[u++>>>0]=128|P>>6&63}s[u++>>>0]=128|P&63}}return s[u>>>0]=0,u-g},ye=n=>n%4===0&&(n%100!==0||n%400===0),pt=[0,31,60,91,121,152,182,213,244,274,305,335],mt=[0,31,59,90,120,151,181,212,243,273,304,334],ht=n=>{var s=Oe(n)+1,u=Et(s);return u&&qe(n,K,u,s),u},Ve={},yt=()=>{if(!Xe){var n={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",_:i||"./this.program"},s;for(s in Ve)Ve[s]===void 0?delete n[s]:n[s]=Ve[s];var u=[];for(s in n)u.push(`${s}=${n[s]}`);Xe=u}return Xe},Xe,jr=[null,[],[]],wt=[31,29,31,30,31,30,31,31,30,31,30,31],gt=[31,28,31,30,31,30,31,31,30,31,30,31];function Yr(n){var s=Array(Oe(n)+1);return qe(n,s,0,s.length),s}function bt(n,s,u,m){function g(p,D,F){for(p=typeof p=="number"?p.toString():p||"";p.length<D;)p=F[0]+p;return p}function T(p,D){return g(p,D,"0")}function P(p,D){function F(Pt){return 0>Pt?-1:0<Pt?1:0}var ue;return(ue=F(p.getFullYear()-D.getFullYear()))===0&&(ue=F(p.getMonth()-D.getMonth()))===0&&(ue=F(p.getDate()-D.getDate())),ue}function z(p){switch(p.getDay()){case 0:return new Date(p.getFullYear()-1,11,29);case 1:return p;case 2:return new Date(p.getFullYear(),0,3);case 3:return new Date(p.getFullYear(),0,2);case 4:return new Date(p.getFullYear(),0,1);case 5:return new Date(p.getFullYear()-1,11,31);case 6:return new Date(p.getFullYear()-1,11,30)}}function J(p){var D=p.ra;for(p=new Date(new Date(p.sa+1900,0,1).getTime());0<D;){var F=p.getMonth(),ue=(ye(p.getFullYear())?wt:gt)[F];if(D>ue-p.getDate())D-=ue-p.getDate()+1,p.setDate(1),11>F?p.setMonth(F+1):(p.setMonth(0),p.setFullYear(p.getFullYear()+1));else{p.setDate(p.getDate()+D);break}}return F=new Date(p.getFullYear()+1,0,4),D=z(new Date(p.getFullYear(),0,4)),F=z(F),0>=P(D,p)?0>=P(F,p)?p.getFullYear()+1:p.getFullYear():p.getFullYear()-1}n>>>=0,s>>>=0,u>>>=0,m>>>=0;var Y=v[m+40>>2>>>0];m={Ca:v[m>>2>>>0],Ba:v[m+4>>2>>>0],ta:v[m+8>>2>>>0],wa:v[m+12>>2>>>0],ua:v[m+16>>2>>>0],sa:v[m+20>>2>>>0],ma:v[m+24>>2>>>0],ra:v[m+28>>2>>>0],Fa:v[m+32>>2>>>0],Aa:v[m+36>>2>>>0],Da:Y?he(Y):""},u=he(u),Y={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var q in Y)u=u.replace(new RegExp(q,"g"),Y[q]);var xt="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),It="January February March April May June July August September October November December".split(" ");Y={"%a":p=>xt[p.ma].substring(0,3),"%A":p=>xt[p.ma],"%b":p=>It[p.ua].substring(0,3),"%B":p=>It[p.ua],"%C":p=>T((p.sa+1900)/100|0,2),"%d":p=>T(p.wa,2),"%e":p=>g(p.wa,2," "),"%g":p=>J(p).toString().substring(2),"%G":p=>J(p),"%H":p=>T(p.ta,2),"%I":p=>(p=p.ta,p==0?p=12:12<p&&(p-=12),T(p,2)),"%j":p=>{for(var D=0,F=0;F<=p.ua-1;D+=(ye(p.sa+1900)?wt:gt)[F++]);return T(p.wa+D,3)},"%m":p=>T(p.ua+1,2),"%M":p=>T(p.Ba,2),"%n":()=>`
7
+ `,"%p":p=>0<=p.ta&&12>p.ta?"AM":"PM","%S":p=>T(p.Ca,2),"%t":()=>" ","%u":p=>p.ma||7,"%U":p=>T(Math.floor((p.ra+7-p.ma)/7),2),"%V":p=>{var D=Math.floor((p.ra+7-(p.ma+6)%7)/7);if(2>=(p.ma+371-p.ra-2)%7&&D++,D)D==53&&(F=(p.ma+371-p.ra)%7,F==4||F==3&&ye(p.sa)||(D=1));else{D=52;var F=(p.ma+7-p.ra-1)%7;(F==4||F==5&&ye(p.sa%400-1))&&D++}return T(D,2)},"%w":p=>p.ma,"%W":p=>T(Math.floor((p.ra+7-(p.ma+6)%7)/7),2),"%y":p=>(p.sa+1900).toString().substring(2),"%Y":p=>p.sa+1900,"%z":p=>{p=p.Aa;var D=0<=p;return p=Math.abs(p)/60,(D?"+":"-")+("0000"+(p/60*100+p%60)).slice(-4)},"%Z":p=>p.Da,"%%":()=>"%"},u=u.replace(/%%/g,"\0\0");for(q in Y)u.includes(q)&&(u=u.replace(new RegExp(q,"g"),Y[q](m)));return u=u.replace(/\0\0/g,"%"),q=Yr(u),q.length>s?0:(oe.set(q,n>>>0),q.length-1)}var qr={a:function(n,s,u){throw n>>>=0,new ie(n).xa(s>>>0,u>>>0),Te=n,$++,Te},e:function(){return 0},H:function(){},x:function(){},z:function(){},k:function(){return 0},F:function(){},B:function(){},E:function(){},g:function(){},y:function(){},v:function(){},G:function(){},w:function(){},l:()=>!0,o:function(n,s,u){n=s+2097152>>>0<4194305-!!n?(n>>>0)+4294967296*s:NaN,u>>>=0,n=new Date(1e3*n),v[u>>2>>>0]=n.getUTCSeconds(),v[u+4>>2>>>0]=n.getUTCMinutes(),v[u+8>>2>>>0]=n.getUTCHours(),v[u+12>>2>>>0]=n.getUTCDate(),v[u+16>>2>>>0]=n.getUTCMonth(),v[u+20>>2>>>0]=n.getUTCFullYear()-1900,v[u+24>>2>>>0]=n.getUTCDay(),v[u+28>>2>>>0]=(n.getTime()-Date.UTC(n.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},p:function(n,s,u){n=s+2097152>>>0<4194305-!!n?(n>>>0)+4294967296*s:NaN,u>>>=0,n=new Date(1e3*n),v[u>>2>>>0]=n.getSeconds(),v[u+4>>2>>>0]=n.getMinutes(),v[u+8>>2>>>0]=n.getHours(),v[u+12>>2>>>0]=n.getDate(),v[u+16>>2>>>0]=n.getMonth(),v[u+20>>2>>>0]=n.getFullYear()-1900,v[u+24>>2>>>0]=n.getDay(),v[u+28>>2>>>0]=(ye(n.getFullYear())?pt:mt)[n.getMonth()]+n.getDate()-1|0,v[u+36>>2>>>0]=-(60*n.getTimezoneOffset()),s=new Date(n.getFullYear(),6,1).getTimezoneOffset();var m=new Date(n.getFullYear(),0,1).getTimezoneOffset();v[u+32>>2>>>0]=(s!=m&&n.getTimezoneOffset()==Math.min(m,s))|0},q:function(n){n>>>=0;var s=new Date(v[n+20>>2>>>0]+1900,v[n+16>>2>>>0],v[n+12>>2>>>0],v[n+8>>2>>>0],v[n+4>>2>>>0],v[n>>2>>>0],0),u=v[n+32>>2>>>0],m=s.getTimezoneOffset(),g=new Date(s.getFullYear(),6,1).getTimezoneOffset(),T=new Date(s.getFullYear(),0,1).getTimezoneOffset(),P=Math.min(T,g);return 0>u?v[n+32>>2>>>0]=+(g!=T&&P==m):0<u!=(P==m)&&(g=Math.max(T,g),s.setTime(s.getTime()+6e4*((0<u?P:g)-m))),v[n+24>>2>>>0]=s.getDay(),v[n+28>>2>>>0]=(ye(s.getFullYear())?pt:mt)[s.getMonth()]+s.getDate()-1|0,v[n>>2>>>0]=s.getSeconds(),v[n+4>>2>>>0]=s.getMinutes(),v[n+8>>2>>>0]=s.getHours(),v[n+12>>2>>>0]=s.getDate(),v[n+16>>2>>>0]=s.getMonth(),v[n+20>>2>>>0]=s.getYear(),n=s.getTime()/1e3,vt((ne=n,1<=+Math.abs(ne)?0<ne?+Math.floor(ne/4294967296)>>>0:~~+Math.ceil((ne-+(~~ne>>>0))/4294967296)>>>0:0)),n>>>0},m:function(){return-52},n:function(){},t:function(n,s,u){function m(J){return(J=J.toTimeString().match(/\(([A-Za-z ]+)\)$/))?J[1]:"GMT"}u>>>=0;var g=new Date().getFullYear(),T=new Date(g,0,1),P=new Date(g,6,1);g=T.getTimezoneOffset();var z=P.getTimezoneOffset();R[n>>>0>>2>>>0]=60*Math.max(g,z),v[s>>>0>>2>>>0]=+(g!=z),n=m(T),s=m(P),n=ht(n),s=ht(s),z<g?(R[u>>2>>>0]=n,R[u+4>>2>>>0]=s):(R[u>>2>>>0]=s,R[u+4>>2>>>0]=n)},d:()=>{Z("")},h:function(){return Date.now()},u:function(){return 4294901760},b:()=>performance.now(),I:function(n,s,u){return s>>>=0,K.copyWithin(n>>>0>>>0,s>>>0,s+(u>>>0)>>>0)},s:function(n){n>>>=0;var s=K.length;if(4294901760<n)return!1;for(var u=1;4>=u;u*=2){var m=s*(1+.2/u);m=Math.min(m,n+100663296);var g=Math;m=Math.max(n,m);e:{g=g.min.call(g,4294901760,m+(65536-m%65536)%65536)-N.buffer.byteLength+65535>>>16;try{N.grow(g),Pe();var T=1;break e}catch{}T=void 0}if(T)return!0}return!1},C:function(n,s){n>>>=0,s>>>=0;var u=0;return yt().forEach(function(m,g){var T=s+u;for(g=R[n+4*g>>2>>>0]=T,T=0;T<m.length;++T)oe[g++>>0>>>0]=m.charCodeAt(T);oe[g>>0>>>0]=0,u+=m.length+1}),0},D:function(n,s){n>>>=0,s>>>=0;var u=yt();R[n>>2>>>0]=u.length;var m=0;return u.forEach(function(g){m+=g.length+1}),R[s>>2>>>0]=m,0},f:()=>52,j:function(){return 52},r:function(){return 70},i:function(n,s,u,m){s>>>=0,u>>>=0,m>>>=0;for(var g=0,T=0;T<u;T++){var P=R[s>>2>>>0],z=R[s+4>>2>>>0];s+=8;for(var J=0;J<z;J++){var Y=K[P+J>>>0],q=jr[n];Y===0||Y===10?((n===1?S:_)(te(q,0)),q.length=0):q.push(Y)}g+=z}return R[m>>2>>>0]=g,0},A:bt,c:function(n,s,u,m){return bt(n>>>0,s>>>0,u>>>0,m>>>0)}};(function(){function n(u){if(u=u.exports,O=u=Vr(u),N=O.J,Pe(),Ce.unshift(O.K),I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),I==0&&(Q!==null&&(clearInterval(Q),Q=null),re)){var m=re;re=null,m()}return u}var s={a:qr};if(I++,e.monitorRunDependencies&&e.monitorRunDependencies(I),e.instantiateWasm)try{return e.instantiateWasm(s,n)}catch(u){_("Module.instantiateWasm callback failed with error: "+u),o(u)}return _e(s,function(u){n(u.instance)}).catch(o),{}})(),e._OrtInit=(n,s)=>(e._OrtInit=O.L)(n,s),e._OrtGetLastError=(n,s)=>(e._OrtGetLastError=O.M)(n,s),e._OrtCreateSessionOptions=(n,s,u,m,g,T,P,z,J,Y)=>(e._OrtCreateSessionOptions=O.N)(n,s,u,m,g,T,P,z,J,Y),e._OrtAppendExecutionProvider=(n,s)=>(e._OrtAppendExecutionProvider=O.O)(n,s),e._OrtAddFreeDimensionOverride=(n,s,u)=>(e._OrtAddFreeDimensionOverride=O.P)(n,s,u),e._OrtAddSessionConfigEntry=(n,s,u)=>(e._OrtAddSessionConfigEntry=O.Q)(n,s,u),e._OrtReleaseSessionOptions=n=>(e._OrtReleaseSessionOptions=O.R)(n),e._OrtCreateSession=(n,s,u)=>(e._OrtCreateSession=O.S)(n,s,u),e._OrtReleaseSession=n=>(e._OrtReleaseSession=O.T)(n),e._OrtGetInputOutputCount=(n,s,u)=>(e._OrtGetInputOutputCount=O.U)(n,s,u),e._OrtGetInputName=(n,s)=>(e._OrtGetInputName=O.V)(n,s),e._OrtGetOutputName=(n,s)=>(e._OrtGetOutputName=O.W)(n,s),e._OrtFree=n=>(e._OrtFree=O.X)(n),e._OrtCreateTensor=(n,s,u,m,g,T)=>(e._OrtCreateTensor=O.Y)(n,s,u,m,g,T),e._OrtGetTensorData=(n,s,u,m,g)=>(e._OrtGetTensorData=O.Z)(n,s,u,m,g),e._OrtReleaseTensor=n=>(e._OrtReleaseTensor=O._)(n),e._OrtCreateRunOptions=(n,s,u,m)=>(e._OrtCreateRunOptions=O.$)(n,s,u,m),e._OrtAddRunConfigEntry=(n,s,u)=>(e._OrtAddRunConfigEntry=O.aa)(n,s,u),e._OrtReleaseRunOptions=n=>(e._OrtReleaseRunOptions=O.ba)(n),e._OrtCreateBinding=n=>(e._OrtCreateBinding=O.ca)(n),e._OrtBindInput=(n,s,u)=>(e._OrtBindInput=O.da)(n,s,u),e._OrtBindOutput=(n,s,u,m)=>(e._OrtBindOutput=O.ea)(n,s,u,m),e._OrtClearBoundOutputs=n=>(e._OrtClearBoundOutputs=O.fa)(n),e._OrtReleaseBinding=n=>(e._OrtReleaseBinding=O.ga)(n),e._OrtRunWithBinding=(n,s,u,m,g)=>(e._OrtRunWithBinding=O.ha)(n,s,u,m,g),e._OrtRun=(n,s,u,m,g,T,P,z)=>(e._OrtRun=O.ia)(n,s,u,m,g,T,P,z),e._OrtEndProfiling=n=>(e._OrtEndProfiling=O.ja)(n);var Et=e._malloc=n=>(Et=e._malloc=O.ka)(n);e._free=n=>(e._free=O.la)(n);var vt=n=>(vt=O.na)(n),Tt=()=>(Tt=O.oa)(),Ot=n=>(Ot=O.pa)(n),At=n=>(At=O.qa)(n);function Vr(n){n=Object.assign({},n);var s=m=>()=>m()>>>0,u=m=>g=>m(g)>>>0;return n.__errno_location=s(n.__errno_location),n.malloc=u(n.malloc),n.stackSave=s(n.stackSave),n.stackAlloc=u(n.stackAlloc),n}e.stackAlloc=At,e.stackSave=Tt,e.stackRestore=Ot,e.UTF8ToString=he,e.stringToUTF8=(n,s,u)=>qe(n,K,s,u),e.lengthBytesUTF8=Oe;var De;re=function n(){De||St(),De||(re=n)};function St(){function n(){if(!De&&(De=!0,e.calledRun=!0,!be)){if(ee(Ce),a(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;){var s=e.postRun.shift();Ee.unshift(s)}ee(Ee)}}if(!(0<I)){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)se();ee(Be),0<I||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),n()},1)):n())}}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return St(),t.ready}})();typeof lr=="object"&&typeof rt=="object"?rt.exports=cr:typeof define=="function"&&define.amd&&define([],()=>cr)});var st,un,nt,ot,Ge,pr,fn,cn,ln,mr,M,we=B(()=>{"use strict";st=dr();un=st,ot=!1,Ge=!1,pr=!1,fn=r=>{if(r===1)return!1;if(typeof SharedArrayBuffer>"u")return typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+r+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),!1;typeof process<"u"&&process.versions&&process.versions.node&&console.warn("env.wasm.numThreads is set to "+r+", however, currently onnxruntime-web does not support multi-threads in Node.js. Please consider using onnxruntime-node for performance critical scenarios.");try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},cn=()=>{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}},ln=(r,t)=>r?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-simd.wasm":t?"ort-wasm-threaded.wasm":"ort-wasm.wasm",mr=async r=>{if(ot)return Promise.resolve();if(Ge)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(pr)throw new Error("previous call to 'initializeWebAssembly()' failed.");Ge=!0;let t=r.initTimeout,e=r.numThreads,a=r.simd,o=fn(e),d=a&&cn(),i=r.wasmPaths,c=typeof i=="string"?i:void 0,f=ln(d,o),l=typeof i=="object"?i[f]:void 0,y=!1,w=[];if(t>0&&w.push(new Promise(h=>{setTimeout(()=>{y=!0,h()},t)})),w.push(new Promise((h,b)=>{(o?un:st)({locateFile:(S,_)=>S.endsWith(".wasm")?l||(c??_)+f:_+S}).then(S=>{Ge=!1,ot=!0,nt=S,h()},S=>{Ge=!1,pr=!0,b(S)})})),await Promise.race(w),y)throw new Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},M=()=>{if(ot&&nt)return nt;throw new Error("WebAssembly is not initialized yet.")}});var U,xe,L,He=B(()=>{"use strict";we();U=(r,t)=>{let e=M(),a=e.lengthBytesUTF8(r)+1,o=e._malloc(a);return e.stringToUTF8(r,o,a),t.push(o),o},xe=(r,t,e,a)=>{if(typeof r=="object"&&r!==null){if(e.has(r))throw new Error("Circular reference in options");e.add(r)}Object.entries(r).forEach(([o,d])=>{let i=t?t+o:o;if(typeof d=="object")xe(d,i+".",e,a);else if(typeof d=="string"||typeof d=="number")a(i,d.toString());else if(typeof d=="boolean")a(i,d?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof d}`)})},L=r=>{let t=M(),e=t.stackSave();try{let a=t.stackAlloc(8);t._OrtGetLastError(a,a+4);let o=t.HEAP32[a/4],d=t.HEAPU32[a/4+1],i=d?t.UTF8ToString(d):"";throw new Error(`${r} ERROR_CODE: ${o}, ERROR_MESSAGE: ${i}`)}finally{t.stackRestore(e)}}});var hr,yr=B(()=>{"use strict";we();He();hr=r=>{let t=M(),e=0,a=[],o=r||{};try{if(r?.logSeverityLevel===void 0)o.logSeverityLevel=2;else if(typeof r.logSeverityLevel!="number"||!Number.isInteger(r.logSeverityLevel)||r.logSeverityLevel<0||r.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${r.logSeverityLevel}`);if(r?.logVerbosityLevel===void 0)o.logVerbosityLevel=0;else if(typeof r.logVerbosityLevel!="number"||!Number.isInteger(r.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${r.logVerbosityLevel}`);r?.terminate===void 0&&(o.terminate=!1);let d=0;return r?.tag!==void 0&&(d=U(r.tag,a)),e=t._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,d),e===0&&L("Can't create run options."),r?.extra!==void 0&&xe(r.extra,"",new WeakSet,(i,c)=>{let f=U(i,a),l=U(c,a);t._OrtAddRunConfigEntry(e,f,l)!==0&&L(`Can't set a run config entry: ${i} - ${c}.`)}),[e,a]}catch(d){throw e!==0&&t._OrtReleaseRunOptions(e),a.forEach(i=>t._free(i)),d}}});var dn,pn,mn,hn,wr,gr=B(()=>{"use strict";we();He();dn=r=>{switch(r){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${r}`)}},pn=r=>{switch(r){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${r}`)}},mn=r=>{r.extra||(r.extra={}),r.extra.session||(r.extra.session={});let t=r.extra.session;t.use_ort_model_bytes_directly||(t.use_ort_model_bytes_directly="1"),r.executionProviders&&r.executionProviders.some(e=>(typeof e=="string"?e:e.name)==="webgpu")&&(r.enableMemPattern=!1)},hn=(r,t,e)=>{for(let a of t){let o=typeof a=="string"?a:a.name;switch(o){case"webnn":if(o="WEBNN",typeof a!="string"){let i=a;if(i?.deviceType){let c=U("deviceType",e),f=U(i.deviceType,e);M()._OrtAddSessionConfigEntry(r,c,f)!==0&&L(`Can't set a session config entry: 'deviceType' - ${i.deviceType}.`)}if(i?.numThreads){let c=i.numThreads;(typeof c!="number"||!Number.isInteger(c)||c<0)&&(c=0);let f=U("numThreads",e),l=U(c.toString(),e);M()._OrtAddSessionConfigEntry(r,f,l)!==0&&L(`Can't set a session config entry: 'numThreads' - ${i.numThreads}.`)}if(i?.powerPreference){let c=U("powerPreference",e),f=U(i.powerPreference,e);M()._OrtAddSessionConfigEntry(r,c,f)!==0&&L(`Can't set a session config entry: 'powerPreference' - ${i.powerPreference}.`)}}break;case"webgpu":if(o="JS",typeof a!="string"){let i=a;if(i?.preferredLayout){if(i.preferredLayout!=="NCHW"&&i.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${i.preferredLayout}`);let c=U("preferredLayout",e),f=U(i.preferredLayout,e);M()._OrtAddSessionConfigEntry(r,c,f)!==0&&L(`Can't set a session config entry: 'preferredLayout' - ${i.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${o}`)}let d=U(o,e);M()._OrtAppendExecutionProvider(r,d)!==0&&L(`Can't append execution provider: ${o}.`)}},wr=r=>{let t=M(),e=0,a=[],o=r||{};mn(o);try{let d=dn(o.graphOptimizationLevel??"all"),i=pn(o.executionMode??"sequential"),c=typeof o.logId=="string"?U(o.logId,a):0,f=o.logSeverityLevel??2;if(!Number.isInteger(f)||f<0||f>4)throw new Error(`log serverity level is not valid: ${f}`);let l=o.logVerbosityLevel??0;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log verbosity level is not valid: ${l}`);let y=typeof o.optimizedModelFilePath=="string"?U(o.optimizedModelFilePath,a):0;if(e=t._OrtCreateSessionOptions(d,!!o.enableCpuMemArena,!!o.enableMemPattern,i,!!o.enableProfiling,0,c,f,l,y),e===0&&L("Can't create session options."),o.executionProviders&&hn(e,o.executionProviders,a),o.enableGraphCapture!==void 0){if(typeof o.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${o.enableGraphCapture}`);let w=U("enableGraphCapture",a),h=U(o.enableGraphCapture.toString(),a);t._OrtAddSessionConfigEntry(e,w,h)!==0&&L(`Can't set a session config entry: 'enableGraphCapture' - ${o.enableGraphCapture}.`)}if(o.freeDimensionOverrides)for(let[w,h]of Object.entries(o.freeDimensionOverrides)){if(typeof w!="string")throw new Error(`free dimension override name must be a string: ${w}`);if(typeof h!="number"||!Number.isInteger(h)||h<0)throw new Error(`free dimension override value must be a non-negative integer: ${h}`);let b=U(w,a);t._OrtAddFreeDimensionOverride(e,b,h)!==0&&L(`Can't set a free dimension override: ${w} - ${h}.`)}return o.extra!==void 0&&xe(o.extra,"",new WeakSet,(w,h)=>{let b=U(w,a),E=U(h,a);t._OrtAddSessionConfigEntry(e,b,E)!==0&&L(`Can't set a session config entry: ${w} - ${h}.`)}),[e,a]}catch(d){throw e!==0&&t._OrtReleaseSessionOptions(e),a.forEach(i=>t._free(i)),d}}});var at,br,it,Er,vr,$e,Tr,ut=B(()=>{"use strict";at=r=>{switch(r){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${r}`)}},br=r=>{switch(r){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${r}`)}},it=r=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][r],Er=r=>{switch(r){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: ${r}`)}},vr=r=>{switch(r){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: ${r}`)}},$e=r=>r==="float32"||r==="float16"||r==="int32"||r==="int64"||r==="uint32"||r==="uint8"||r==="bool",Tr=r=>{switch(r){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;default:throw new Error(`unsupported data location: ${r}`)}}});var Ie,ft=B(()=>{"use strict";Ie=async r=>{if(typeof r=="string")if(typeof process<"u"&&process.versions&&process.versions.node)try{return new Uint8Array(await(void 0)(r))}catch(t){if(t.code==="ERR_FS_FILE_TOO_LARGE"){let e=(void 0)(r),a=[];for await(let o of e)a.push(o);return new Uint8Array(Buffer.concat(a))}throw t}else{let t=await fetch(r);if(!t.ok)throw new Error(`failed to load external data file: ${r}`);let e=t.headers.get("Content-Length"),a=e?parseInt(e,10):0;if(a<1073741824)return new Uint8Array(await t.arrayBuffer());{if(!t.body)throw new Error(`failed to load external data file: ${r}, no response body.`);let o=t.body.getReader(),d;try{d=new ArrayBuffer(a)}catch(c){if(c instanceof RangeError){let f=Math.ceil(a/65536);d=new WebAssembly.Memory({initial:f,maximum:f}).buffer}else throw c}let i=0;for(;;){let{done:c,value:f}=await o.read();if(c)break;let l=f.byteLength;new Uint8Array(d,i,l).set(f),i+=l}return new Uint8Array(d,0,a)}}else return r instanceof Blob?new Uint8Array(await r.arrayBuffer()):r instanceof Uint8Array?r:new Uint8Array(r)}});var yn,Ar,Sr,ge,wn,ct,xr,Ir,Or,Pr,Br,Cr=B(()=>{"use strict";yr();gr();ut();we();He();ft();yn=(r,t)=>{M()._OrtInit(r,t)!==0&&L("Can't initialize onnxruntime.")},Ar=async r=>{yn(r.wasm.numThreads,vr(r.logLevel))},Sr=async(r,t)=>{},ge=new Map,wn=r=>{let t=M(),e=t.stackSave();try{let a=t.stackAlloc(8);return t._OrtGetInputOutputCount(r,a,a+4)!==0&&L("Can't get session input/output count."),[t.HEAP32[a/4],t.HEAP32[a/4+1]]}finally{t.stackRestore(e)}},ct=r=>{let t=M(),e=t._malloc(r.byteLength);if(e===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${r.byteLength}.`);return t.HEAPU8.set(r,e),[e,r.byteLength]},xr=async(r,t)=>{let e,a,o=M();Array.isArray(r)?[e,a]=r:r.buffer===o.HEAPU8.buffer?[e,a]=[r.byteOffset,r.byteLength]:[e,a]=ct(r);let d=0,i=0,c=0,f=[],l=[],y=[];try{if([i,f]=wr(t),t?.externalData&&o.mountExternalData){let x=[];for(let C of t.externalData){let N=typeof C=="string"?C:C.path;x.push(Ie(typeof C=="string"?C:C.data).then(O=>{o.mountExternalData(N,O)}))}await Promise.all(x)}d=await o._OrtCreateSession(e,a,i),d===0&&L("Can't create a session.");let[w,h]=wn(d),b=!!t?.enableGraphCapture,E=[],A=[],S=[];for(let x=0;x<w;x++){let C=o._OrtGetInputName(d,x);C===0&&L("Can't get an input name."),l.push(C),E.push(o.UTF8ToString(C))}for(let x=0;x<h;x++){let C=o._OrtGetOutputName(d,x);C===0&&L("Can't get an output name."),y.push(C);let N=o.UTF8ToString(C);A.push(N)}let _=null;return ge.set(d,[d,l,y,_,b,!1]),[d,E,A]}catch(w){throw l.forEach(h=>o._OrtFree(h)),y.forEach(h=>o._OrtFree(h)),c!==0&&o._OrtReleaseBinding(c),d!==0&&o._OrtReleaseSession(d),w}finally{o._free(e),i!==0&&o._OrtReleaseSessionOptions(i),f.forEach(w=>o._free(w)),o.unmountExternalData?.()}},Ir=r=>{let t=M(),e=ge.get(r);if(!e)throw new Error(`cannot release session. invalid session id: ${r}`);let[a,o,d,i,c]=e;i&&(c&&t._OrtClearBoundOutputs(i.handle),t._OrtReleaseBinding(i.handle)),t.jsepOnReleaseSession?.(r),o.forEach(f=>t._OrtFree(f)),d.forEach(f=>t._OrtFree(f)),t._OrtReleaseSession(a),ge.delete(r)},Or=(r,t,e,a,o,d=!1)=>{if(!r){t.push(0);return}let i=M(),c=r[0],f=r[1],l=r[3],y,w;if(c==="string"&&l==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");if(d&&l!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${o} when enableGraphCapture is true.`);if(l==="gpu-buffer"){let E=r[2].gpuBuffer,A=it(at(c));w=f.reduce((_,x)=>_*x,1)*A;let S=i.jsepRegisterBuffer;if(!S)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');y=S(a,o,E,w)}else{let E=r[2];if(Array.isArray(E)){w=4*E.length,y=i._malloc(w),e.push(y);let A=y/4;for(let S=0;S<E.length;S++){if(typeof E[S]!="string")throw new TypeError(`tensor data at index ${S} is not a string`);i.HEAPU32[A++]=U(E[S],e)}}else w=E.byteLength,y=i._malloc(w),e.push(y),i.HEAPU8.set(new Uint8Array(E.buffer,E.byteOffset,w),y)}let h=i.stackSave(),b=i.stackAlloc(4*f.length);try{let E=b/4;f.forEach(S=>i.HEAP32[E++]=S);let A=i._OrtCreateTensor(at(c),y,w,b,f.length,Tr(l));A===0&&L(`Can't create tensor for input/output. session=${a}, index=${o}.`),t.push(A)}finally{i.stackRestore(h)}},Pr=async(r,t,e,a,o,d)=>{let i=M(),c=ge.get(r);if(!c)throw new Error(`cannot run inference. invalid session id: ${r}`);let f=c[0],l=c[1],y=c[2],w=c[3],h=c[4],b=c[5],E=t.length,A=a.length,S=0,_=[],x=[],C=[],N=[],O=i.stackSave(),be=i.stackAlloc(E*4),oe=i.stackAlloc(E*4),K=i.stackAlloc(A*4),v=i.stackAlloc(A*4);try{[S,_]=hr(d);for(let I=0;I<E;I++)Or(e[I],x,N,r,t[I],h);for(let I=0;I<A;I++)Or(o[I],C,N,r,E+a[I],h);let R=be/4,Pe=oe/4,Be=K/4,Ce=v/4;for(let I=0;I<E;I++)i.HEAPU32[R++]=x[I],i.HEAPU32[Pe++]=l[t[I]];for(let I=0;I<A;I++)i.HEAPU32[Be++]=C[I],i.HEAPU32[Ce++]=y[a[I]];i.jsepOnRunStart?.(f);let Ee;Ee=await i._OrtRun(f,oe,be,E,v,A,K,S),Ee!==0&&L("failed to call OrtRun().");let se=[];for(let I=0;I<A;I++){let Q=i.HEAPU32[K/4+I];if(Q===C[I]){se.push(o[I]);continue}let re=i.stackSave(),Z=i.stackAlloc(4*4),ae=!1,W,X=0;try{i._OrtGetTensorData(Q,Z,Z+4,Z+8,Z+12)!==0&&L(`Can't access output tensor data on index ${I}.`);let me=Z/4,ve=i.HEAPU32[me++];X=i.HEAPU32[me++];let _e=i.HEAPU32[me++],ne=i.HEAPU32[me++],ee=[];for(let $=0;$<ne;$++)ee.push(i.HEAPU32[_e/4+$]);i._OrtFree(_e);let ie=ee.reduce(($,G)=>$*G,1);W=br(ve);let Te=w?.outputPreferredLocations[a[I]];if(W==="string"){if(Te==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");let $=[],G=X/4;for(let te=0;te<ie;te++){let he=i.HEAPU32[G++],Oe=te===ie-1?void 0:i.HEAPU32[G]-he;$.push(i.UTF8ToString(he,Oe))}se.push([W,ee,$,"cpu"])}else if(Te==="gpu-buffer"&&ie>0){let $=i.jsepGetBuffer;if(!$)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let G=$(X),te=it(ve);if(te===void 0||!$e(W))throw new Error(`Unsupported data type: ${W}`);ae=!0,se.push([W,ee,{gpuBuffer:G,download:i.jsepCreateDownloader(G,ie*te,W),dispose:()=>{i._OrtReleaseTensor(Q)}},"gpu-buffer"])}else{let $=Er(W),G=new $(ie);new Uint8Array(G.buffer,G.byteOffset,G.byteLength).set(i.HEAPU8.subarray(X,X+G.byteLength)),se.push([W,ee,G,"cpu"])}}finally{i.stackRestore(re),W==="string"&&X&&i._free(X),ae||i._OrtReleaseTensor(Q)}}return w&&!h&&(i._OrtClearBoundOutputs(w.handle),ge.set(r,[f,l,y,w,h,!1])),se}finally{i.stackRestore(O),x.forEach(R=>i._OrtReleaseTensor(R)),C.forEach(R=>i._OrtReleaseTensor(R)),N.forEach(R=>i._free(R)),S!==0&&i._OrtReleaseRunOptions(S),_.forEach(R=>i._free(R))}},Br=r=>{let t=M(),e=ge.get(r);if(!e)throw new Error("invalid session id");let a=e[0],o=t._OrtEndProfiling(a);o===0&&L("Can't get an profile file name."),t._OrtFree(o)}});var lt,_r,Dr,ko,Rr,Ur,Lr,Fr,kr,Mr,Nr,dt=B(()=>{"use strict";pe();Cr();we();lt=!1,_r=!1,Dr=!1,ko=typeof document<"u"?document?.currentScript?.src:void 0,Rr=async()=>{if(!_r){if(lt)throw new Error("multiple calls to 'initWasm()' detected.");if(Dr)throw new Error("previous call to 'initWasm()' failed.");lt=!0;try{await mr(k.wasm),await Ar(k),_r=!0}catch(r){throw Dr=!0,r}finally{lt=!1}}},Ur=async r=>{await Sr(k,r)},Lr=async r=>ct(r),Fr=async(r,t)=>xr(r,t),kr=async r=>{Ir(r)},Mr=async(r,t,e,a,o,d)=>Pr(r,t,e,a,o,d),Nr=async r=>{Br(r)}});var Wr,bn,ze,Gr=B(()=>{"use strict";pe();dt();ut();ft();Wr=(r,t)=>{switch(r.location){case"cpu":return[r.type,r.dims,r.data,"cpu"];case"gpu-buffer":return[r.type,r.dims,{gpuBuffer:r.gpuBuffer},"gpu-buffer"];default:throw new Error(`invalid data location: ${r.location} for ${t()}`)}},bn=r=>{switch(r[3]){case"cpu":return new H(r[0],r[2],r[1]);case"gpu-buffer":{let t=r[0];if(!$e(t))throw new Error(`not supported data type: ${t} for deserializing GPU tensor`);let{gpuBuffer:e,download:a,dispose:o}=r[2];return H.fromGpuBuffer(e,{dataType:t,dims:r[1],download:a,dispose:o})}default:throw new Error(`invalid data location: ${r[3]}`)}},ze=class{async fetchModelAndCopyToWasmMemory(t){return Lr(await Ie(t))}async loadModel(t,e){le();let a;typeof t=="string"?typeof process<"u"&&process.versions&&process.versions.node?a=await Ie(t):a=await this.fetchModelAndCopyToWasmMemory(t):a=t,[this.sessionId,this.inputNames,this.outputNames]=await Fr(a,e),de()}async dispose(){return kr(this.sessionId)}async run(t,e,a){le();let o=[],d=[];Object.entries(t).forEach(h=>{let b=h[0],E=h[1],A=this.inputNames.indexOf(b);if(A===-1)throw new Error(`invalid input '${b}'`);o.push(E),d.push(A)});let i=[],c=[];Object.entries(e).forEach(h=>{let b=h[0],E=h[1],A=this.outputNames.indexOf(b);if(A===-1)throw new Error(`invalid output '${b}'`);i.push(E),c.push(A)});let f=o.map((h,b)=>Wr(h,()=>`input "${this.inputNames[d[b]]}"`)),l=i.map((h,b)=>h?Wr(h,()=>`output "${this.outputNames[c[b]]}"`):null),y=await Mr(this.sessionId,d,f,c,l,a),w={};for(let h=0;h<y.length;h++)w[this.outputNames[c[h]]]=i[h]??bn(y[h]);return de(),w}startProfiling(){}endProfiling(){Nr(this.sessionId)}}});var En,je,Hr=B(()=>{"use strict";pe();dt();Gr();En=()=>{if((typeof k.wasm.initTimeout!="number"||k.wasm.initTimeout<0)&&(k.wasm.initTimeout=0),typeof k.wasm.simd!="boolean"&&(k.wasm.simd=!0),typeof k.wasm.proxy!="boolean"&&(k.wasm.proxy=!1),typeof k.wasm.trace!="boolean"&&(k.wasm.trace=!1),typeof k.wasm.numThreads!="number"||!Number.isInteger(k.wasm.numThreads)||k.wasm.numThreads<=0){(typeof self<"u"&&!self.crossOriginIsolated||typeof process<"u"&&process.versions&&process.versions.node)&&(k.wasm.numThreads=1);let r=typeof navigator>"u"?(void 0)().length:navigator.hardwareConcurrency;k.wasm.numThreads=Math.min(4,Math.ceil((r||1)/2))}},je=class{async init(t){En(),await Rr(),await Ur(t)}async createInferenceSessionHandler(t,e){let a=new ze;return await a.loadModel(t,e),Promise.resolve(a)}}});var $r={};Re($r,{wasmBackend:()=>vn});var vn,zr=B(()=>{"use strict";Hr();vn=new je});pe();pe();pe();var or="1.18.0";var rs=tt;{let r=(zr(),Ke($r)).wasmBackend;Ae("cpu",r,10),Ae("wasm",r,10)}Object.defineProperty(k.versions,"web",{value:or,enumerable:!0});export{tn as InferenceSession,Vt as TRACE,le as TRACE_FUNC_BEGIN,de as TRACE_FUNC_END,H as Tensor,nn as TrainingSession,rs as default,k as env,Ae as registerBackend};
8
+ //# sourceMappingURL=ort.wasm-core.min.js.map
demo/ort-phi3/dist/esm/ort.wasm-core.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.wasm.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.wasm.min.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.wasm.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.webgl.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.webgl.min.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.webgl.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.webgpu.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.webgpu.min.js ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/ort.webgpu.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
demo/ort-phi3/dist/esm/package.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"type": "module"}
demo/ort-phi3/dist/ort-wasm-simd.jsep.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:452154aba6c53a058ce074924671bb937a7997f6ea9f05864d656e02f58f87c2
3
+ size 24559442