diff --git "a/demo/ort-phi3/dist/esm/ort.training.wasm.min.js" "b/demo/ort-phi3/dist/esm/ort.training.wasm.min.js" new file mode 100644--- /dev/null +++ "b/demo/ort-phi3/dist/esm/ort.training.wasm.min.js" @@ -0,0 +1,12 @@ +/*! + * ONNX Runtime Web v1.18.0 + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ +var yr=Object.defineProperty;var Va=Object.getOwnPropertyDescriptor;var qa=Object.getOwnPropertyNames;var Xa=Object.prototype.hasOwnProperty;var W=(n,r)=>()=>(n&&(r=n(n=0)),r);var st=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),St=(n,r)=>{for(var e in r)yr(n,e,{get:r[e],enumerable:!0})},Ja=(n,r,e,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of qa(r))!Xa.call(n,a)&&a!==e&&yr(n,a,{get:()=>r[a],enumerable:!(u=Va(r,a))||u.enumerable});return n};var ut=n=>Ja(yr({},"__esModule",{value:!0}),n);var Wt,Ye,At,Qa,Gt,zt=W(()=>{"use strict";Wt=new Map,Ye=[],At=(n,r,e)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let u=Wt.get(n);if(u===void 0)Wt.set(n,{backend:r,priority:e});else{if(u.priority>e)return;if(u.priority===e&&u.backend!==r)throw new Error(`cannot register backend "${n}" using priority ${e}`)}if(e>=0){let a=Ye.indexOf(n);a!==-1&&Ye.splice(a,1);for(let c=0;c{let r=Wt.get(n);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let e=!!r.initPromise;try{return e||(r.initPromise=r.backend.init(n)),await r.initPromise,r.initialized=!0,r.backend}catch(u){return e||(r.error=`${u}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},Gt=async n=>{let r=n.executionProviders||[],e=r.map(m=>typeof m=="string"?m:m.name),u=e.length===0?Ye:e,a,c=[],f=new Set;for(let m of u){let h=await Qa(m);typeof h=="string"?c.push({name:m,err:h}):(a||(a=h),a===h&&f.add(m))}if(!a)throw new Error(`no available backend found. ERR: ${c.map(m=>`[${m.name}] ${m.err}`).join(", ")}`);for(let{name:m,err:h}of c)e.includes(m)&&console.warn(`removing requested execution provider "${m}" from session options because it is not available: ${h}`);let o=r.filter(m=>f.has(typeof m=="string"?m:m.name));return[a,new Proxy(n,{get:(m,h)=>h==="executionProviders"?o:Reflect.get(m,h)})]}});var gn=W(()=>{"use strict";zt()});var yn,wn=W(()=>{"use strict";yn="1.18.0"});var bn,Ee,wr=W(()=>{"use strict";wn();bn="warning",Ee={wasm:{},webgl:{},webgpu:{},versions:{common:yn},set logLevel(n){if(n!==void 0){if(typeof n!="string"||["verbose","info","warning","error","fatal"].indexOf(n)===-1)throw new Error(`Unsupported logging level: ${n}`);bn=n}},get logLevel(){return bn}};Object.defineProperty(Ee,"logLevel",{enumerable:!0})});var V,On=W(()=>{"use strict";wr();V=Ee});var vn,_n,Tn=W(()=>{"use strict";vn=(n,r)=>{let e=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);e.width=n.dims[3],e.height=n.dims[2];let u=e.getContext("2d");if(u!=null){let a,c;r?.tensorLayout!==void 0&&r.tensorLayout==="NHWC"?(a=n.dims[2],c=n.dims[3]):(a=n.dims[3],c=n.dims[2]);let f=r?.format!==void 0?r.format:"RGB",o=r?.norm,m,h;o===void 0||o.mean===void 0?m=[255,255,255,255]:typeof o.mean=="number"?m=[o.mean,o.mean,o.mean,o.mean]:(m=[o.mean[0],o.mean[1],o.mean[2],0],o.mean[3]!==void 0&&(m[3]=o.mean[3])),o===void 0||o.bias===void 0?h=[0,0,0,0]:typeof o.bias=="number"?h=[o.bias,o.bias,o.bias,o.bias]:(h=[o.bias[0],o.bias[1],o.bias[2],0],o.bias[3]!==void 0&&(h[3]=o.bias[3]));let g=c*a,b=0,w=g,M=g*2,C=-1;f==="RGBA"?(b=0,w=g,M=g*2,C=g*3):f==="RGB"?(b=0,w=g,M=g*2):f==="RBG"&&(b=0,M=g,w=g*2);for(let S=0;S{let e=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),u;if(e!=null){let a,c,f;r?.tensorLayout!==void 0&&r.tensorLayout==="NHWC"?(a=n.dims[2],c=n.dims[1],f=n.dims[3]):(a=n.dims[3],c=n.dims[2],f=n.dims[1]);let o=r!==void 0&&r.format!==void 0?r.format:"RGB",m=r?.norm,h,g;m===void 0||m.mean===void 0?h=[255,255,255,255]:typeof m.mean=="number"?h=[m.mean,m.mean,m.mean,m.mean]:(h=[m.mean[0],m.mean[1],m.mean[2],255],m.mean[3]!==void 0&&(h[3]=m.mean[3])),m===void 0||m.bias===void 0?g=[0,0,0,0]:typeof m.bias=="number"?g=[m.bias,m.bias,m.bias,m.bias]:(g=[m.bias[0],m.bias[1],m.bias[2],0],m.bias[3]!==void 0&&(g[3]=m.bias[3]));let b=c*a;if(r!==void 0&&(r.format!==void 0&&f===4&&r.format!=="RGBA"||f===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let w=4,M=0,C=1,S=2,E=3,F=0,L=b,k=b*2,z=-1;o==="RGBA"?(F=0,L=b,k=b*2,z=b*3):o==="RGB"?(F=0,L=b,k=b*2):o==="RBG"&&(F=0,k=b,L=b*2),u=e.createImageData(a,c);for(let P=0;P{"use strict";jt();br=(n,r)=>{if(n===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:e,width:u}=r,a=r.norm??{mean:255,bias:0},c,f;typeof a.mean=="number"?c=[a.mean,a.mean,a.mean,a.mean]:c=[a.mean[0],a.mean[1],a.mean[2],a.mean[3]??255],typeof a.bias=="number"?f=[a.bias,a.bias,a.bias,a.bias]:f=[a.bias[0],a.bias[1],a.bias[2],a.bias[3]??0];let o=r.format!==void 0?r.format:"RGBA",m=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",h=e*u,g=m==="RGBA"?new Float32Array(h*4):new Float32Array(h*3),b=4,w=0,M=1,C=2,S=3,E=0,F=h,L=h*2,k=-1;o==="RGB"&&(b=3,w=0,M=1,C=2,S=-1),m==="RGBA"?k=h*3:m==="RBG"?(E=0,L=h,F=h*2):m==="BGR"&&(L=0,F=h,E=h*2);for(let P=0;P{let e=typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement,u=typeof ImageData<"u"&&n instanceof ImageData,a=typeof ImageBitmap<"u"&&n instanceof ImageBitmap,c=typeof n=="string",f,o=r??{},m=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},h=g=>g instanceof HTMLCanvasElement||g instanceof OffscreenCanvas?g.getContext("2d"):null;if(e){let g=m();g.width=n.width,g.height=n.height;let b=h(g);if(b!=null){let w=n.height,M=n.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(w=r.resizedHeight,M=r.resizedWidth),r!==void 0){if(o=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");o.tensorFormat="RGBA",o.height=w,o.width=M}else o.tensorFormat="RGBA",o.height=w,o.width=M;b.drawImage(n,0,0),f=b.getImageData(0,0,M,w).data}else throw new Error("Can not access image data")}else if(u){let g,b;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(g=r.resizedHeight,b=r.resizedWidth):(g=n.height,b=n.width),r!==void 0&&(o=r),o.format="RGBA",o.height=g,o.width=b,r!==void 0){let w=m();w.width=b,w.height=g;let M=h(w);if(M!=null)M.putImageData(n,0,0),f=M.getImageData(0,0,b,g).data;else throw new Error("Can not access image data")}else f=n.data}else if(a){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let g=m();g.width=n.width,g.height=n.height;let b=h(g);if(b!=null){let w=n.height,M=n.width;return b.drawImage(n,0,0,M,w),f=b.getImageData(0,0,M,w).data,o.height=w,o.width=M,br(f,o)}else throw new Error("Can not access image data")}else{if(c)return new Promise((g,b)=>{let w=m(),M=h(w);if(!n||!M)return b();let C=new Image;C.crossOrigin="Anonymous",C.src=n,C.onload=()=>{w.width=C.width,w.height=C.height,M.drawImage(C,0,0,w.width,w.height);let S=M.getImageData(0,0,w.width,w.height);o.height=w.height,o.width=w.width,g(br(S.data,o))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(f!==void 0)return br(f,o);throw new Error("Input data provided is not supported - aborted tensor creation")},Sn=(n,r)=>{let{width:e,height:u,download:a,dispose:c}=r,f=[1,u,e,4];return new me({location:"texture",type:"float32",texture:n,dims:f,download:a,dispose:c})},An=(n,r)=>{let{dataType:e,dims:u,download:a,dispose:c}=r;return new me({location:"gpu-buffer",type:e??"float32",gpuBuffer:n,dims:u,download:a,dispose:c})},Mn=(n,r,e)=>new me({location:"cpu-pinned",type:n,data:r,dims:e??[r.length]})});var Ve,Mt,Cn,Pn,xn=W(()=>{"use strict";Ve=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),Mt=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),Cn=!1,Pn=()=>{if(!Cn){Cn=!0;let n=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,e=typeof Float16Array<"u"&&Float16Array.from;n&&(Ve.set("int64",BigInt64Array),Mt.set(BigInt64Array,"int64")),r&&(Ve.set("uint64",BigUint64Array),Mt.set(BigUint64Array,"uint64")),e?(Ve.set("float16",Float16Array),Mt.set(Float16Array,"float16")):Ve.set("float16",Uint16Array)}}});var In,Dn,Un=W(()=>{"use strict";jt();In=n=>{let r=1;for(let e=0;e{switch(n.location){case"cpu":return new me(n.type,n.data,r);case"cpu-pinned":return new me({location:"cpu-pinned",data:n.data,type:n.type,dims:r});case"texture":return new me({location:"texture",texture:n.texture,type:n.type,dims:r});case"gpu-buffer":return new me({location:"gpu-buffer",gpuBuffer:n.gpuBuffer,type:n.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${n.location} is not supported`)}}});var me,jt=W(()=>{"use strict";Tn();Rn();xn();Un();me=class{constructor(r,e,u){Pn();let a,c;if(typeof r=="object"&&"location"in r)switch(this.dataLocation=r.location,a=r.type,c=r.dims,r.location){case"cpu-pinned":{let o=Ve.get(a);if(!o)throw new TypeError(`unsupported type "${a}" to create tensor from pinned buffer`);if(!(r.data instanceof o))throw new TypeError(`buffer should be of type ${o.name}`);this.cpuData=r.data;break}case"texture":{if(a!=="float32")throw new TypeError(`unsupported type "${a}" to create tensor from texture`);this.gpuTextureData=r.texture,this.downloader=r.download,this.disposer=r.dispose;break}case"gpu-buffer":{if(a!=="float32"&&a!=="float16"&&a!=="int32"&&a!=="int64"&&a!=="uint32"&&a!=="uint8"&&a!=="bool")throw new TypeError(`unsupported type "${a}" to create tensor from gpu buffer`);this.gpuBufferData=r.gpuBuffer,this.downloader=r.download,this.disposer=r.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let o,m;if(typeof r=="string")if(a=r,m=u,r==="string"){if(!Array.isArray(e))throw new TypeError("A string tensor's data must be a string array.");o=e}else{let h=Ve.get(r);if(h===void 0)throw new TypeError(`Unsupported tensor type: ${r}.`);if(Array.isArray(e)){if(r==="float16"&&h===Uint16Array)throw new TypeError("Creating a float16 tensor from number array is not supported. Please use Uint16Array as data.");r==="uint64"||r==="int64"?o=h.from(e,BigInt):o=h.from(e)}else if(e instanceof h)o=e;else throw new TypeError(`A ${a} tensor's data must be type of ${h}`)}else if(m=e,Array.isArray(r)){if(r.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let h=typeof r[0];if(h==="string")a="string",o=r;else if(h==="boolean")a="bool",o=Uint8Array.from(r);else throw new TypeError(`Invalid element type of data array: ${h}.`)}else{let h=Mt.get(r.constructor);if(h===void 0)throw new TypeError(`Unsupported type for tensor data: ${r.constructor}.`);a=h,o=r}if(m===void 0)m=[o.length];else if(!Array.isArray(m))throw new TypeError("A tensor's dims must be a number array");c=m,this.cpuData=o,this.dataLocation="cpu"}let f=In(c);if(this.cpuData&&f!==this.cpuData.length)throw new Error(`Tensor's size(${f}) does not match data length(${this.cpuData.length}).`);this.type=a,this.dims=c,this.size=f}static async fromImage(r,e){return En(r,e)}static fromTexture(r,e){return Sn(r,e)}static fromGpuBuffer(r,e){return An(r,e)}static fromPinnedBuffer(r,e,u){return Mn(r,e,u)}toDataURL(r){return vn(this,r)}toImageData(r){return _n(this,r)}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(r){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,r&&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(r){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Dn(this,r)}}});var le,$t=W(()=>{"use strict";jt();le=me});var Fn,Bn,qe,Xe,Or=W(()=>{"use strict";wr();Fn=(n,r)=>{(typeof Ee.trace>"u"?!Ee.wasm.trace:!Ee.trace)||console.timeStamp(`${n}::ORT::${r}`)},Bn=(n,r)=>{let e=new Error().stack?.split(/\r\n|\r|\n/g)||[],u=!1;for(let a=0;a{(typeof Ee.trace>"u"?!Ee.wasm.trace:!Ee.trace)||Bn("BEGIN",n)},Xe=n=>{(typeof Ee.trace>"u"?!Ee.wasm.trace:!Ee.trace)||Bn("END",n)}});var Yt,kn=W(()=>{"use strict";zt();$t();Or();Yt=class n{constructor(r){this.handler=r}async run(r,e,u){qe();let a={},c={};if(typeof r!="object"||r===null||r instanceof le||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let f=!0;if(typeof e=="object"){if(e===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(e instanceof le)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.");f=!1;for(let h of e){if(typeof h!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(h)===-1)throw new RangeError(`'fetches' contains invalid output name: ${h}.`);a[h]=null}if(typeof u=="object"&&u!==null)c=u;else if(typeof u<"u")throw new TypeError("'options' must be an object.")}else{let h=!1,g=Object.getOwnPropertyNames(e);for(let b of this.outputNames)if(g.indexOf(b)!==-1){let w=e[b];(w===null||w instanceof le)&&(h=!0,f=!1,a[b]=w)}if(h){if(typeof u=="object"&&u!==null)c=u;else if(typeof u<"u")throw new TypeError("'options' must be an object.")}else c=e}}else if(typeof e<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let h of this.inputNames)if(typeof r[h]>"u")throw new Error(`input '${h}' is missing in 'feeds'.`);if(f)for(let h of this.outputNames)a[h]=null;let o=await this.handler.run(r,a,c),m={};for(let h in o)if(Object.hasOwnProperty.call(o,h)){let g=o[h];g instanceof le?m[h]=g:m[h]=new le(g.type,g.data,g.dims)}return Xe(),m}async release(){return this.handler.dispose()}static async create(r,e,u,a){qe();let c,f={};if(typeof r=="string"){if(c=r,typeof e=="object"&&e!==null)f=e;else if(typeof e<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(c=r,typeof e=="object"&&e!==null)f=e;else if(typeof e<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let g=r,b=0,w=r.byteLength;if(typeof e=="object"&&e!==null)f=e;else if(typeof e=="number"){if(b=e,!Number.isSafeInteger(b))throw new RangeError("'byteOffset' must be an integer.");if(b<0||b>=g.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${g.byteLength}).`);if(w=r.byteLength-b,typeof u=="number"){if(w=u,!Number.isSafeInteger(w))throw new RangeError("'byteLength' must be an integer.");if(w<=0||b+w>g.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${g.byteLength-b}].`);if(typeof a=="object"&&a!==null)f=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else if(typeof u<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof e<"u")throw new TypeError("'options' must be an object.");c=new Uint8Array(g,b,w)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[o,m]=await Gt(f),h=await o.createInferenceSessionHandler(c,m);return Xe(),new n(h)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}});var Za,Ln=W(()=>{"use strict";kn();Za=Yt});var Nn=W(()=>{"use strict"});var Hn=W(()=>{"use strict"});var Wn=W(()=>{"use strict"});var Gn=W(()=>{"use strict"});var Ka,Vt,zn=W(()=>{"use strict";zt();$t();Ka="Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.",Vt=class n{constructor(r,e,u){this.handler=r,this.hasOptimizerModel=e,this.hasEvalModel=u}get trainingInputNames(){return this.handler.inputNames}get trainingOutputNames(){return this.handler.outputNames}get evalInputNames(){if(this.hasEvalModel)return this.handler.evalInputNames;throw new Error("This training session has no evalModel loaded.")}get evalOutputNames(){if(this.hasEvalModel)return this.handler.evalOutputNames;throw new Error("This training session has no evalModel loaded.")}static async create(r,e){let u=r.evalModel||"",a=r.optimizerModel||"",c=e||{},[f,o]=await Gt(c);if(f.createTrainingSessionHandler){let m=await f.createTrainingSessionHandler(r.checkpointState,r.trainModel,u,a,o);return new n(m,!!r.optimizerModel,!!r.evalModel)}else throw new Error(Ka)}typeNarrowingForRunStep(r,e,u,a,c){let f={},o={};if(typeof u!="object"||u===null||u instanceof le||Array.isArray(u))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let m=!0;if(typeof a=="object"){if(a===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(a instanceof le)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(a)){if(a.length===0)throw new TypeError("'fetches' cannot be an empty array.");m=!1;for(let h of a){if(typeof h!="string")throw new TypeError("'fetches' must be a string array or an object.");if(e.indexOf(h)===-1)throw new RangeError(`'fetches' contains invalid output name: ${h}.`);f[h]=null}if(typeof c=="object"&&c!==null)o=c;else if(typeof c<"u")throw new TypeError("'options' must be an object.")}else{let h=!1,g=Object.getOwnPropertyNames(a);for(let b of e)if(g.indexOf(b)!==-1){let w=a[b];(w===null||w instanceof le)&&(h=!0,m=!1,f[b]=w)}if(h){if(typeof c=="object"&&c!==null)o=c;else if(typeof c<"u")throw new TypeError("'options' must be an object.")}else o=a}}else if(typeof a<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let h of r)if(typeof u[h]>"u")throw new Error(`input '${h}' is missing in 'feeds'.`);if(m)for(let h of e)f[h]=null;return[f,o]}convertHandlerReturnTypeToMapOfTensors(r){let e={};for(let u in r)if(Object.hasOwnProperty.call(r,u)){let a=r[u];a instanceof le?e[u]=a:e[u]=new le(a.type,a.data,a.dims)}return e}async lazyResetGrad(){await this.handler.lazyResetGrad()}async runTrainStep(r,e,u){let[a,c]=this.typeNarrowingForRunStep(this.trainingInputNames,this.trainingOutputNames,r,e,u),f=await this.handler.runTrainStep(r,a,c);return this.convertHandlerReturnTypeToMapOfTensors(f)}async runOptimizerStep(r){if(this.hasOptimizerModel)await this.handler.runOptimizerStep(r||{});else throw new Error("This TrainingSession has no OptimizerModel loaded.")}async runEvalStep(r,e,u){if(this.hasEvalModel){let[a,c]=this.typeNarrowingForRunStep(this.evalInputNames,this.evalOutputNames,r,e,u),f=await this.handler.runEvalStep(r,a,c);return this.convertHandlerReturnTypeToMapOfTensors(f)}else throw new Error("This TrainingSession has no EvalModel loaded.")}async getParametersSize(r=!0){return this.handler.getParametersSize(r)}async loadParametersBuffer(r,e=!0){let u=await this.getParametersSize(e);if(r.length!==4*u)throw new Error("Size of the buffer passed into loadParametersBuffer must match the number of parameters in the model. Please use getParametersSize method to check.");return this.handler.loadParametersBuffer(r,e)}async getContiguousParameters(r=!0){return this.handler.getContiguousParameters(r)}async release(){return this.handler.dispose()}}});var eo,jn=W(()=>{"use strict";zn();eo=Vt});var vr={};St(vr,{InferenceSession:()=>Za,TRACE:()=>Fn,TRACE_FUNC_BEGIN:()=>qe,TRACE_FUNC_END:()=>Xe,Tensor:()=>le,TrainingSession:()=>eo,env:()=>V,registerBackend:()=>At});var Je=W(()=>{"use strict";gn();On();Ln();$t();Nn();Hn();Or();Wn();Gn();jn()});var _r={};St(_r,{createReadStream:()=>Yn,readFile:()=>to,readFileSync:()=>ro});var to,ro,Yn,Tr=W(()=>{to=void 0,ro=void 0,Yn=void 0});var Er={};St(Er,{join:()=>no});var no,Sr=W(()=>{no=void 0});var Xn=st((qn,Ar)=>{"use strict";var Vn=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(n=n||__filename),function(r={}){var e=r,u,a;e.ready=new Promise((i,d)=>{u=i,a=d});var c=Object.assign({},e),f="./this.program",o=typeof window=="object",m=typeof importScripts=="function",h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",g="",b,w,M;if(h){var C=(Tr(),ut(_r)),S=(Sr(),ut(Er));g=m?S.dirname(g)+"/":__dirname+"/",b=(i,d)=>(i=i.startsWith("file://")?new URL(i):S.normalize(i),C.readFileSync(i,d?void 0:"utf8")),M=i=>(i=b(i,!0),i.buffer||(i=new Uint8Array(i)),i),w=(i,d,p,v=!0)=>{i=i.startsWith("file://")?new URL(i):S.normalize(i),C.readFile(i,v?void 0:"utf8",(R,I)=>{R?p(R):d(v?I.buffer:I)})},!e.thisProgram&&1"[Emscripten Module object]"}else(o||m)&&(m?g=self.location.href:typeof document<"u"&&document.currentScript&&(g=document.currentScript.src),n&&(g=n),g.indexOf("blob:")!==0?g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):g="",b=i=>{var d=new XMLHttpRequest;return d.open("GET",i,!1),d.send(null),d.responseText},m&&(M=i=>{var d=new XMLHttpRequest;return d.open("GET",i,!1),d.responseType="arraybuffer",d.send(null),new Uint8Array(d.response)}),w=(i,d,p)=>{var v=new XMLHttpRequest;v.open("GET",i,!0),v.responseType="arraybuffer",v.onload=()=>{v.status==200||v.status==0&&v.response?d(v.response):p()},v.onerror=p,v.send(null)});var E=e.print||console.log.bind(console),F=e.printErr||console.error.bind(console);Object.assign(e,c),c=null,e.thisProgram&&(f=e.thisProgram);var L;e.wasmBinary&&(L=e.wasmBinary);var k=e.noExitRuntime||!0;typeof WebAssembly!="object"&&oe("no native wasm support detected");var z,P,Oe=!1,ve,he,U,$;function se(){var i=z.buffer;e.HEAP8=ve=new Int8Array(i),e.HEAP16=new Int16Array(i),e.HEAP32=U=new Int32Array(i),e.HEAPU8=he=new Uint8Array(i),e.HEAPU16=new Uint16Array(i),e.HEAPU32=$=new Uint32Array(i),e.HEAPF32=new Float32Array(i),e.HEAPF64=new Float64Array(i)}var Pe=[],He=[],K=[];function D(){var i=e.preRun.shift();Pe.unshift(i)}var N=0,ge=null,ce=null;function oe(i){throw e.onAbort&&e.onAbort(i),i="Aborted("+i+")",F(i),Oe=!0,i=new WebAssembly.RuntimeError(i+". Build with -sASSERTIONS for more info."),a(i),i}function xe(i){return i.startsWith("data:application/octet-stream;base64,")}var ee;if(ee="ort-training-wasm-simd.wasm",!xe(ee)){var de=ee;ee=e.locateFile?e.locateFile(de,g):g+de}function et(i){if(i==ee&&L)return new Uint8Array(L);if(M)return M(i);throw"both async and sync fetching of the wasm failed"}function ye(i){if(!L&&(o||m)){if(typeof fetch=="function"&&!i.startsWith("file://"))return fetch(i,{credentials:"same-origin"}).then(d=>{if(!d.ok)throw"failed to load wasm binary file at '"+i+"'";return d.arrayBuffer()}).catch(()=>et(i));if(w)return new Promise((d,p)=>{w(i,v=>d(new Uint8Array(v)),p)})}return Promise.resolve().then(()=>et(i))}function Ie(i,d,p){return ye(i).then(v=>WebAssembly.instantiate(v,d)).then(v=>v).then(p,v=>{F("failed to asynchronously prepare wasm: "+v),oe(v)})}function We(i,d){var p=ee;return L||typeof WebAssembly.instantiateStreaming!="function"||xe(p)||p.startsWith("file://")||h||typeof fetch!="function"?Ie(p,i,d):fetch(p,{credentials:"same-origin"}).then(v=>WebAssembly.instantiateStreaming(v,i).then(d,function(R){return F("wasm streaming compile failed: "+R),F("falling back to ArrayBuffer instantiation"),Ie(p,i,d)}))}var Se,_e=i=>{for(;0>2>>>0]=d},this.Ka=function(d){$[this.Ha+8>>2>>>0]=d},this.Ia=function(d,p){this.Ja(),this.La(d),this.Ka(p)},this.Ja=function(){$[this.Ha+16>>2>>>0]=0}}var ke=0,ae=0,J=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Te=(i,d,p)=>{d>>>=0;var v=d+p;for(p=d;i[p]&&!(p>=v);)++p;if(16R?v+=String.fromCharCode(R):(R-=65536,v+=String.fromCharCode(55296|R>>10,56320|R&1023))}}else v+=String.fromCharCode(R)}return v},Ae=(i,d)=>(i>>>=0)?Te(he,i,d):"",Le=i=>{for(var d=0,p=0;p=v?d++:2047>=v?d+=2:55296<=v&&57343>=v?(d+=4,++p):d+=3}return d},tt=(i,d,p,v)=>{if(p>>>=0,!(0=H){var ne=i.charCodeAt(++I);H=65536+((H&1023)<<10)|ne&1023}if(127>=H){if(p>=v)break;d[p++>>>0]=H}else{if(2047>=H){if(p+1>=v)break;d[p++>>>0]=192|H>>6}else{if(65535>=H){if(p+2>=v)break;d[p++>>>0]=224|H>>12}else{if(p+3>=v)break;d[p++>>>0]=240|H>>18,d[p++>>>0]=128|H>>12&63}d[p++>>>0]=128|H>>6&63}d[p++>>>0]=128|H&63}}return d[p>>>0]=0,p-R},Me=i=>i%4===0&&(i%100!==0||i%400===0),mt=[0,31,60,91,121,152,182,213,244,274,305,335],Be=[0,31,59,90,120,151,181,212,243,273,304,334],ht=i=>{var d=Le(i)+1,p=Ot(d);return p&&tt(i,he,p,d),p},gt={},yt=()=>{if(!wt){var i={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",_:f||"./this.program"},d;for(d in gt)gt[d]===void 0?delete i[d]:i[d]=gt[d];var p=[];for(d in i)p.push(`${d}=${i[d]}`);wt=p}return wt},wt,Ne=[null,[],[]],Ge=[31,29,31,30,31,30,31,31,30,31,30,31],rt=[31,28,31,30,31,30,31,31,30,31,30,31];function Ft(i){var d=Array(Le(i)+1);return tt(i,d,0,d.length),d}function bt(i,d,p,v){function R(O,j,X){for(O=typeof O=="number"?O.toString():O||"";O.lengthEt?-1:0Ue-O.getDate())j-=Ue-O.getDate()+1,O.setDate(1),11>X?O.setMonth(X+1):(O.setMonth(0),O.setFullYear(O.getFullYear()+1));else{O.setDate(O.getDate()+j);break}}return X=new Date(O.getFullYear()+1,0,4),j=ne(new Date(O.getFullYear(),0,4)),X=ne(X),0>=H(j,O)?0>=H(X,O)?O.getFullYear()+1:O.getFullYear():O.getFullYear()-1}i>>>=0,d>>>=0,p>>>=0,v>>>=0;var ue=U[v+40>>2>>>0];v={Oa:U[v>>2>>>0],Na:U[v+4>>2>>>0],Ea:U[v+8>>2>>>0],Ga:U[v+12>>2>>>0],Fa:U[v+16>>2>>>0],Da:U[v+20>>2>>>0],xa:U[v+24>>2>>>0],Ca:U[v+28>>2>>>0],Qa:U[v+32>>2>>>0],Ma:U[v+36>>2>>>0],Pa:ue?Ae(ue):""},p=Ae(p),ue={"%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 fe in ue)p=p.replace(new RegExp(fe,"g"),ue[fe]);var _t="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Tt="January February March April May June July August September October November December".split(" ");ue={"%a":O=>_t[O.xa].substring(0,3),"%A":O=>_t[O.xa],"%b":O=>Tt[O.Fa].substring(0,3),"%B":O=>Tt[O.Fa],"%C":O=>I((O.Da+1900)/100|0,2),"%d":O=>I(O.Ga,2),"%e":O=>R(O.Ga,2," "),"%g":O=>pe(O).toString().substring(2),"%G":O=>pe(O),"%H":O=>I(O.Ea,2),"%I":O=>(O=O.Ea,O==0?O=12:12{for(var j=0,X=0;X<=O.Fa-1;j+=(Me(O.Da+1900)?Ge:rt)[X++]);return I(O.Ga+j,3)},"%m":O=>I(O.Fa+1,2),"%M":O=>I(O.Na,2),"%n":()=>` +`,"%p":O=>0<=O.Ea&&12>O.Ea?"AM":"PM","%S":O=>I(O.Oa,2),"%t":()=>" ","%u":O=>O.xa||7,"%U":O=>I(Math.floor((O.Ca+7-O.xa)/7),2),"%V":O=>{var j=Math.floor((O.Ca+7-(O.xa+6)%7)/7);if(2>=(O.xa+371-O.Ca-2)%7&&j++,j)j==53&&(X=(O.xa+371-O.Ca)%7,X==4||X==3&&Me(O.Da)||(j=1));else{j=52;var X=(O.xa+7-O.Ca-1)%7;(X==4||X==5&&Me(O.Da%400-1))&&j++}return I(j,2)},"%w":O=>O.xa,"%W":O=>I(Math.floor((O.Ca+7-(O.xa+6)%7)/7),2),"%y":O=>(O.Da+1900).toString().substring(2),"%Y":O=>O.Da+1900,"%z":O=>{O=O.Ma;var j=0<=O;return O=Math.abs(O)/60,(j?"+":"-")+("0000"+(O/60*100+O%60)).slice(-4)},"%Z":O=>O.Pa,"%%":()=>"%"},p=p.replace(/%%/g,"\0\0");for(fe in ue)p.includes(fe)&&(p=p.replace(new RegExp(fe,"g"),ue[fe](v)));return p=p.replace(/\0\0/g,"%"),fe=Ft(p),fe.length>d?0:(ve.set(fe,i>>>0),fe.length-1)}var Bt={a:function(i,d,p){throw i>>>=0,new De(i).Ia(d>>>0,p>>>0),ke=i,ae++,ke},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(i,d,p){i=d+2097152>>>0<4194305-!!i?(i>>>0)+4294967296*d:NaN,p>>>=0,i=new Date(1e3*i),U[p>>2>>>0]=i.getUTCSeconds(),U[p+4>>2>>>0]=i.getUTCMinutes(),U[p+8>>2>>>0]=i.getUTCHours(),U[p+12>>2>>>0]=i.getUTCDate(),U[p+16>>2>>>0]=i.getUTCMonth(),U[p+20>>2>>>0]=i.getUTCFullYear()-1900,U[p+24>>2>>>0]=i.getUTCDay(),U[p+28>>2>>>0]=(i.getTime()-Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},p:function(i,d,p){i=d+2097152>>>0<4194305-!!i?(i>>>0)+4294967296*d:NaN,p>>>=0,i=new Date(1e3*i),U[p>>2>>>0]=i.getSeconds(),U[p+4>>2>>>0]=i.getMinutes(),U[p+8>>2>>>0]=i.getHours(),U[p+12>>2>>>0]=i.getDate(),U[p+16>>2>>>0]=i.getMonth(),U[p+20>>2>>>0]=i.getFullYear()-1900,U[p+24>>2>>>0]=i.getDay(),U[p+28>>2>>>0]=(Me(i.getFullYear())?mt:Be)[i.getMonth()]+i.getDate()-1|0,U[p+36>>2>>>0]=-(60*i.getTimezoneOffset()),d=new Date(i.getFullYear(),6,1).getTimezoneOffset();var v=new Date(i.getFullYear(),0,1).getTimezoneOffset();U[p+32>>2>>>0]=(d!=v&&i.getTimezoneOffset()==Math.min(v,d))|0},q:function(i){i>>>=0;var d=new Date(U[i+20>>2>>>0]+1900,U[i+16>>2>>>0],U[i+12>>2>>>0],U[i+8>>2>>>0],U[i+4>>2>>>0],U[i>>2>>>0],0),p=U[i+32>>2>>>0],v=d.getTimezoneOffset(),R=new Date(d.getFullYear(),6,1).getTimezoneOffset(),I=new Date(d.getFullYear(),0,1).getTimezoneOffset(),H=Math.min(I,R);return 0>p?U[i+32>>2>>>0]=+(R!=I&&H==v):0>2>>>0]=d.getDay(),U[i+28>>2>>>0]=(Me(d.getFullYear())?mt:Be)[d.getMonth()]+d.getDate()-1|0,U[i>>2>>>0]=d.getSeconds(),U[i+4>>2>>>0]=d.getMinutes(),U[i+8>>2>>>0]=d.getHours(),U[i+12>>2>>>0]=d.getDate(),U[i+16>>2>>>0]=d.getMonth(),U[i+20>>2>>>0]=d.getYear(),i=d.getTime()/1e3,nt((Se=i,1<=+Math.abs(Se)?0>>0:~~+Math.ceil((Se-+(~~Se>>>0))/4294967296)>>>0:0)),i>>>0},m:function(){return-52},n:function(){},t:function(i,d,p){function v(pe){return(pe=pe.toTimeString().match(/\(([A-Za-z ]+)\)$/))?pe[1]:"GMT"}p>>>=0;var R=new Date().getFullYear(),I=new Date(R,0,1),H=new Date(R,6,1);R=I.getTimezoneOffset();var ne=H.getTimezoneOffset();$[i>>>0>>2>>>0]=60*Math.max(R,ne),U[d>>>0>>2>>>0]=+(R!=ne),i=v(I),d=v(H),i=ht(i),d=ht(d),ne>2>>>0]=i,$[p+4>>2>>>0]=d):($[p>>2>>>0]=d,$[p+4>>2>>>0]=i)},d:()=>{oe("")},h:function(){return Date.now()},u:function(){return 4294901760},b:()=>performance.now(),I:function(i,d,p){return d>>>=0,he.copyWithin(i>>>0>>>0,d>>>0,d+(p>>>0)>>>0)},s:function(i){i>>>=0;var d=he.length;if(4294901760=p;p*=2){var v=d*(1+.2/p);v=Math.min(v,i+100663296);var R=Math;v=Math.max(i,v);e:{R=R.min.call(R,4294901760,v+(65536-v%65536)%65536)-z.buffer.byteLength+65535>>>16;try{z.grow(R),se();var I=1;break e}catch{}I=void 0}if(I)return!0}return!1},C:function(i,d){i>>>=0,d>>>=0;var p=0;return yt().forEach(function(v,R){var I=d+p;for(R=$[i+4*R>>2>>>0]=I,I=0;I>0>>>0]=v.charCodeAt(I);ve[R>>0>>>0]=0,p+=v.length+1}),0},D:function(i,d){i>>>=0,d>>>=0;var p=yt();$[i>>2>>>0]=p.length;var v=0;return p.forEach(function(R){v+=R.length+1}),$[d>>2>>>0]=v,0},f:()=>52,j:function(){return 52},r:function(){return 70},i:function(i,d,p,v){d>>>=0,p>>>=0,v>>>=0;for(var R=0,I=0;I>2>>>0],ne=$[d+4>>2>>>0];d+=8;for(var pe=0;pe>>0],fe=Ne[i];ue===0||ue===10?((i===1?E:F)(Te(fe,0)),fe.length=0):fe.push(ue)}R+=ne}return $[v>>2>>>0]=R,0},A:bt,c:function(i,d,p,v){return bt(i>>>0,d>>>0,p>>>0,v>>>0)}};(function(){function i(p){if(p=p.exports,P=p=ot(p),z=P.J,se(),He.unshift(P.K),N--,e.monitorRunDependencies&&e.monitorRunDependencies(N),N==0&&(ge!==null&&(clearInterval(ge),ge=null),ce)){var v=ce;ce=null,v()}return p}var d={a:Bt};if(N++,e.monitorRunDependencies&&e.monitorRunDependencies(N),e.instantiateWasm)try{return e.instantiateWasm(d,i)}catch(p){F("Module.instantiateWasm callback failed with error: "+p),a(p)}return We(d,function(p){i(p.instance)}).catch(a),{}})(),e._OrtInit=(i,d)=>(e._OrtInit=P.L)(i,d),e._OrtGetLastError=(i,d)=>(e._OrtGetLastError=P.M)(i,d),e._OrtCreateSessionOptions=(i,d,p,v,R,I,H,ne,pe,ue)=>(e._OrtCreateSessionOptions=P.N)(i,d,p,v,R,I,H,ne,pe,ue),e._OrtAppendExecutionProvider=(i,d)=>(e._OrtAppendExecutionProvider=P.O)(i,d),e._OrtAddFreeDimensionOverride=(i,d,p)=>(e._OrtAddFreeDimensionOverride=P.P)(i,d,p),e._OrtAddSessionConfigEntry=(i,d,p)=>(e._OrtAddSessionConfigEntry=P.Q)(i,d,p),e._OrtReleaseSessionOptions=i=>(e._OrtReleaseSessionOptions=P.R)(i),e._OrtCreateSession=(i,d,p)=>(e._OrtCreateSession=P.S)(i,d,p),e._OrtReleaseSession=i=>(e._OrtReleaseSession=P.T)(i),e._OrtGetInputOutputCount=(i,d,p)=>(e._OrtGetInputOutputCount=P.U)(i,d,p),e._OrtGetInputName=(i,d)=>(e._OrtGetInputName=P.V)(i,d),e._OrtGetOutputName=(i,d)=>(e._OrtGetOutputName=P.W)(i,d),e._OrtFree=i=>(e._OrtFree=P.X)(i),e._OrtCreateTensor=(i,d,p,v,R,I)=>(e._OrtCreateTensor=P.Y)(i,d,p,v,R,I),e._OrtGetTensorData=(i,d,p,v,R)=>(e._OrtGetTensorData=P.Z)(i,d,p,v,R),e._OrtReleaseTensor=i=>(e._OrtReleaseTensor=P._)(i),e._OrtCreateRunOptions=(i,d,p,v)=>(e._OrtCreateRunOptions=P.$)(i,d,p,v),e._OrtAddRunConfigEntry=(i,d,p)=>(e._OrtAddRunConfigEntry=P.aa)(i,d,p),e._OrtReleaseRunOptions=i=>(e._OrtReleaseRunOptions=P.ba)(i),e._OrtCreateBinding=i=>(e._OrtCreateBinding=P.ca)(i),e._OrtBindInput=(i,d,p)=>(e._OrtBindInput=P.da)(i,d,p),e._OrtBindOutput=(i,d,p,v)=>(e._OrtBindOutput=P.ea)(i,d,p,v),e._OrtClearBoundOutputs=i=>(e._OrtClearBoundOutputs=P.fa)(i),e._OrtReleaseBinding=i=>(e._OrtReleaseBinding=P.ga)(i),e._OrtRunWithBinding=(i,d,p,v,R)=>(e._OrtRunWithBinding=P.ha)(i,d,p,v,R),e._OrtRun=(i,d,p,v,R,I,H,ne)=>(e._OrtRun=P.ia)(i,d,p,v,R,I,H,ne),e._OrtEndProfiling=i=>(e._OrtEndProfiling=P.ja)(i),e._OrtTrainingLoadCheckpoint=(i,d)=>(e._OrtTrainingLoadCheckpoint=P.ka)(i,d),e._OrtTrainingReleaseCheckpoint=i=>(e._OrtTrainingReleaseCheckpoint=P.la)(i),e._OrtTrainingCreateSession=(i,d,p,v,R,I,H,ne)=>(e._OrtTrainingCreateSession=P.ma)(i,d,p,v,R,I,H,ne),e._OrtTrainingLazyResetGrad=i=>(e._OrtTrainingLazyResetGrad=P.na)(i),e._OrtTrainingRunTrainStep=(i,d,p,v,R,I)=>(e._OrtTrainingRunTrainStep=P.oa)(i,d,p,v,R,I),e._OrtTrainingOptimizerStep=(i,d)=>(e._OrtTrainingOptimizerStep=P.pa)(i,d),e._OrtTrainingEvalStep=(i,d,p,v,R,I)=>(e._OrtTrainingEvalStep=P.qa)(i,d,p,v,R,I),e._OrtTrainingGetParametersSize=(i,d,p)=>(e._OrtTrainingGetParametersSize=P.ra)(i,d,p),e._OrtTrainingCopyParametersToBuffer=(i,d,p,v)=>(e._OrtTrainingCopyParametersToBuffer=P.sa)(i,d,p,v),e._OrtTrainingCopyParametersFromBuffer=(i,d,p,v)=>(e._OrtTrainingCopyParametersFromBuffer=P.ta)(i,d,p,v),e._OrtTrainingReleaseSession=i=>(e._OrtTrainingReleaseSession=P.ua)(i);var Ot=e._malloc=i=>(Ot=e._malloc=P.va)(i);e._free=i=>(e._free=P.wa)(i);var nt=i=>(nt=P.ya)(i),vt=()=>(vt=P.za)(),at=i=>(at=P.Aa)(i),B=i=>(B=P.Ba)(i);function ot(i){i=Object.assign({},i);var d=v=>()=>v()>>>0,p=v=>R=>v(R)>>>0;return i.__errno_location=d(i.__errno_location),i.malloc=p(i.malloc),i.stackSave=d(i.stackSave),i.stackAlloc=p(i.stackAlloc),i}e.stackAlloc=B,e.stackSave=vt,e.stackRestore=at,e.UTF8ToString=Ae,e.stringToUTF8=(i,d,p)=>tt(i,he,d,p),e.lengthBytesUTF8=Le;var ze;ce=function i(){ze||je(),ze||(ce=i)};function je(){function i(){if(!ze&&(ze=!0,e.calledRun=!0,!Oe)){if(_e(He),u(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;){var d=e.postRun.shift();K.unshift(d)}_e(K)}}if(!(0Vn)});var Jn=st(()=>{});var Qn=st(()=>{});var Zn={};St(Zn,{cpus:()=>ao});var ao,Kn=W(()=>{ao=void 0});var ra=st((ta,Mr)=>{"use strict";var ea=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(n=n||__filename),function(r={}){function e(){return K.buffer!=oe.buffer&&ye(),oe}function u(){return K.buffer!=oe.buffer&&ye(),xe}function a(){return K.buffer!=oe.buffer&&ye(),ee}function c(){return K.buffer!=oe.buffer&&ye(),de}function f(){return K.buffer!=oe.buffer&&ye(),et}var o=r,m,h;o.ready=new Promise((t,s)=>{m=t,h=s});var g=Object.assign({},o),b="./this.program",w=(t,s)=>{throw s},M=typeof window=="object",C=typeof importScripts=="function",S=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",E=o.ENVIRONMENT_IS_PTHREAD||!1,F="";function L(t){return o.locateFile?o.locateFile(t,F):F+t}var k,z,P;if(S){var Oe=(Tr(),ut(_r)),ve=(Sr(),ut(Er));F=C?ve.dirname(F)+"/":__dirname+"/",k=(s,l)=>(s=s.startsWith("file://")?new URL(s):ve.normalize(s),Oe.readFileSync(s,l?void 0:"utf8")),P=s=>(s=k(s,!0),s.buffer||(s=new Uint8Array(s)),s),z=(s,l,y,A=!0)=>{s=s.startsWith("file://")?new URL(s):ve.normalize(s),Oe.readFile(s,A?void 0:"utf8",(T,x)=>{T?y(T):l(A?x.buffer:x)})},!o.thisProgram&&1{throw process.exitCode=s,l},o.inspect=()=>"[Emscripten Module object]";let t;try{t=Jn()}catch(s){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),s}global.Worker=t.Worker}else(M||C)&&(C?F=self.location.href:typeof document<"u"&&document.currentScript&&(F=document.currentScript.src),typeof n<"u"&&n&&(F=n),F.indexOf("blob:")!==0?F=F.substr(0,F.replace(/[?#].*/,"").lastIndexOf("/")+1):F="",S||(k=t=>{var s=new XMLHttpRequest;return s.open("GET",t,!1),s.send(null),s.responseText},C&&(P=t=>{var s=new XMLHttpRequest;return s.open("GET",t,!1),s.responseType="arraybuffer",s.send(null),new Uint8Array(s.response)}),z=(t,s,l)=>{var y=new XMLHttpRequest;y.open("GET",t,!0),y.responseType="arraybuffer",y.onload=()=>{y.status==200||y.status==0&&y.response?s(y.response):l()},y.onerror=l,y.send(null)}));S&&typeof performance>"u"&&(global.performance=Qn().performance);var he=console.log.bind(console),U=console.error.bind(console);S&&(he=(...t)=>Oe.writeSync(1,t.join(" ")+` +`),U=(...t)=>Oe.writeSync(2,t.join(" ")+` +`));var $=o.print||he,se=o.printErr||U;Object.assign(o,g),g=null,o.thisProgram&&(b=o.thisProgram),o.quit&&(w=o.quit);var Pe;o.wasmBinary&&(Pe=o.wasmBinary);var He=o.noExitRuntime||!0;typeof WebAssembly!="object"&&Me("no native wasm support detected");var K,D,N,ge=!1,ce,oe,xe,ee,de,et;function ye(){var t=K.buffer;o.HEAP8=oe=new Int8Array(t),o.HEAP16=new Int16Array(t),o.HEAP32=ee=new Int32Array(t),o.HEAPU8=xe=new Uint8Array(t),o.HEAPU16=new Uint16Array(t),o.HEAPU32=de=new Uint32Array(t),o.HEAPF32=new Float32Array(t),o.HEAPF64=et=new Float64Array(t)}var Ie=o.INITIAL_MEMORY||16777216;if(5242880<=Ie||Me("INITIAL_MEMORY should be larger than STACK_SIZE, was "+Ie+"! (STACK_SIZE=5242880)"),E)K=o.wasmMemory;else if(o.wasmMemory)K=o.wasmMemory;else if(K=new WebAssembly.Memory({initial:Ie/65536,maximum:65536,shared:!0}),!(K.buffer instanceof SharedArrayBuffer))throw se("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),S&&se("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");ye(),Ie=K.buffer.byteLength;var We,Se=[],_e=[],De=[],ke=0;function ae(){return He||0{if(!s.ok)throw"failed to load wasm binary file at '"+t+"'";return s.arrayBuffer()}).catch(()=>ht(t));if(z)return new Promise((s,l)=>{z(t,y=>s(new Uint8Array(y)),l)})}return Promise.resolve().then(()=>ht(t))}function yt(t,s,l){return gt(t).then(y=>WebAssembly.instantiate(y,s)).then(y=>y).then(l,y=>{se("failed to asynchronously prepare wasm: "+y),Me(y)})}function wt(t,s){var l=Be;return Pe||typeof WebAssembly.instantiateStreaming!="function"||mt(l)||l.startsWith("file://")||S||typeof fetch!="function"?yt(l,t,s):fetch(l,{credentials:"same-origin"}).then(y=>WebAssembly.instantiateStreaming(y,t).then(s,function(A){return se("wasm streaming compile failed: "+A),se("falling back to ArrayBuffer instantiation"),yt(l,t,s)}))}var Ne;function Ge(t){this.name="ExitStatus",this.message=`Program terminated with exit(${t})`,this.status=t}function rt(t){t.terminate(),t.onmessage=()=>{}}function Ft(t){(t=B.La[t])||Me(),B.lb(t)}function bt(t){var s=B.fb();if(!s)return 6;B.Oa.push(s),B.La[t.Na]=s,s.Na=t.Na;var l={cmd:"run",start_routine:t.mb,arg:t.eb,pthread_ptr:t.Na};return S&&s.unref(),s.postMessage(l,t.sb),0}var Bt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Ot=(t,s,l)=>{s>>>=0;var y=s+l;for(l=s;t[l]&&!(l>=y);)++l;if(16A?y+=String.fromCharCode(A):(A-=65536,y+=String.fromCharCode(55296|A>>10,56320|A&1023))}}else y+=String.fromCharCode(A)}return y},nt=(t,s)=>(t>>>=0)?Ot(u(),t,s):"";function vt(t){if(E)return Q(1,1,t);ce=t,ae()||(B.nb(),o.onExit&&o.onExit(t),ge=!0),w(t,new Ge(t))}var at=t=>{if(ce=t,E)throw ze(t),"unwind";vt(t)},B={Ra:[],Oa:[],Za:[],La:{},Va:function(){E?B.hb():B.gb()},gb:function(){Se.unshift(()=>{Le(),B.ib(()=>tt())})},hb:function(){B.receiveObjectTransfer=B.kb,B.threadInitTLS=B.Ya,B.setExitStatus=B.Xa,He=!1},Xa:function(t){ce=t},xb:["$terminateWorker"],nb:function(){for(var t of B.Oa)rt(t);for(t of B.Ra)rt(t);B.Ra=[],B.Oa=[],B.La=[]},lb:function(t){var s=t.Na;delete B.La[s],B.Ra.push(t),B.Oa.splice(B.Oa.indexOf(t),1),t.Na=0,pr(s)},kb:function(){},Ya:function(){B.Za.forEach(t=>t())},jb:t=>new Promise(s=>{t.onmessage=T=>{T=T.data;var x=T.cmd;if(T.targetThread&&T.targetThread!=Lt()){var te=B.La[T.wb];te?te.postMessage(T,T.transferList):se('Internal error! Worker sent a message "'+x+'" to target pthread '+T.targetThread+", but that thread no longer exists!")}else x==="checkMailbox"?kt():x==="spawnThread"?bt(T):x==="cleanupThread"?Ft(T.thread):x==="killThread"?(T=T.thread,x=B.La[T],delete B.La[T],rt(x),pr(T),B.Oa.splice(B.Oa.indexOf(x),1),x.Na=0):x==="cancelThread"?B.La[T.thread].postMessage({cmd:"cancel"}):x==="loaded"?(t.loaded=!0,s(t)):x==="alert"?alert("Thread "+T.threadId+": "+T.text):T.target==="setimmediate"?t.postMessage(T):x==="callHandler"?o[T.handler](...T.args):x&&se("worker sent an unknown command "+x)},t.onerror=T=>{throw se("worker sent an error! "+T.filename+":"+T.lineno+": "+T.message),T},S&&(t.on("message",function(T){t.onmessage({data:T})}),t.on("error",function(T){t.onerror(T)}));var l=[],y=["onExit","onAbort","print","printErr"],A;for(A of y)o.hasOwnProperty(A)&&l.push(A);t.postMessage({cmd:"load",handlers:l,urlOrBlob:o.mainScriptUrlOrBlob||n,wasmMemory:K,wasmModule:N})}),ib:function(t){t()},cb:function(){var t=L("ort-wasm-threaded.worker.js");t=new Worker(t),B.Ra.push(t)},fb:function(){return B.Ra.length==0&&(B.cb(),B.jb(B.Ra[0])),B.Ra.pop()}};o.PThread=B;var ot=t=>{for(;0>2>>>0];t=a()[t+56>>2>>>0],cn(s,s-t),Nt(s)};function ze(t){if(E)return Q(2,0,t);at(t)}var je=[];o.invokeEntryPoint=function(t,s){var l=je[t];l||(t>=je.length&&(je.length=t+1),je[t]=l=We.get(t)),t=l(s),ae()?B.Xa(t):mr(t)};function i(t){this.Ua=t-24,this.bb=function(s){c()[this.Ua+4>>2>>>0]=s},this.ab=function(s){c()[this.Ua+8>>2>>>0]=s},this.Va=function(s,l){this.$a(),this.bb(s),this.ab(l)},this.$a=function(){c()[this.Ua+16>>2>>>0]=0}}var d=0,p=0;function v(t,s,l,y){return E?Q(3,1,t,s,l,y):R(t,s,l,y)}function R(t,s,l,y){if(t>>>=0,s>>>=0,l>>>=0,y>>>=0,typeof SharedArrayBuffer>"u")return se("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var A=[];return E&&A.length===0?v(t,s,l,y):(t={mb:l,Na:t,eb:y,sb:A},E?(t.ub="spawnThread",postMessage(t,A),0):bt(t))}function I(t,s,l){return E?Q(4,1,t,s,l):0}function H(t,s){if(E)return Q(5,1,t,s)}var ne=t=>{for(var s=0,l=0;l=y?s++:2047>=y?s+=2:55296<=y&&57343>=y?(s+=4,++l):s+=3}return s},pe=(t,s,l,y)=>{if(l>>>=0,!(0=x){var te=t.charCodeAt(++T);x=65536+((x&1023)<<10)|te&1023}if(127>=x){if(l>=y)break;s[l++>>>0]=x}else{if(2047>=x){if(l+1>=y)break;s[l++>>>0]=192|x>>6}else{if(65535>=x){if(l+2>=y)break;s[l++>>>0]=224|x>>12}else{if(l+3>=y)break;s[l++>>>0]=240|x>>18,s[l++>>>0]=128|x>>12&63}s[l++>>>0]=128|x>>6&63}s[l++>>>0]=128|x&63}}return s[l>>>0]=0,l-A},ue=(t,s,l)=>pe(t,u(),s,l);function fe(t,s){if(E)return Q(6,1,t,s)}function _t(t,s,l){if(E)return Q(7,1,t,s,l)}function Tt(t,s,l){return E?Q(8,1,t,s,l):0}function O(t,s){if(E)return Q(9,1,t,s)}function j(t,s,l){if(E)return Q(10,1,t,s,l)}function X(t,s,l,y){if(E)return Q(11,1,t,s,l,y)}function Ue(t,s,l,y){if(E)return Q(12,1,t,s,l,y)}function Et(t,s,l,y){if(E)return Q(13,1,t,s,l,y)}function Wr(t){if(E)return Q(14,1,t)}function Gr(t,s){if(E)return Q(15,1,t,s)}function zr(t,s,l){if(E)return Q(16,1,t,s,l)}var Na=t=>{if(!ge)try{if(t(),!ae())try{E?mr(ce):at(ce)}catch(s){s instanceof Ge||s=="unwind"||w(1,s)}}catch(s){s instanceof Ge||s=="unwind"||w(1,s)}};function fr(t){t>>>=0,typeof Atomics.tb=="function"&&(Atomics.tb(a(),t>>2,t).value.then(kt),t+=128,Atomics.store(a(),t>>2,1))}o.__emscripten_thread_mailbox_await=fr;function kt(){var t=Lt();t&&(fr(t),Na(()=>fn()))}o.checkMailbox=kt;var it=t=>t%4===0&&(t%100!==0||t%400===0),jr=[0,31,60,91,121,152,182,213,244,274,305,335],$r=[0,31,59,90,120,151,181,212,243,273,304,334];function Yr(t,s,l,y,A,T,x,te){return E?Q(17,1,t,s,l,y,A,T,x,te):-52}function Vr(t,s,l,y,A,T,x){if(E)return Q(18,1,t,s,l,y,A,T,x)}var qr=t=>{var s=ne(t)+1,l=on(s);return l&&ue(t,l,s),l},Ha=t=>{var s=hr();return t=t(),Nt(s),t};function Q(t,s){var l=arguments.length-2,y=arguments;return Ha(()=>{for(var A=gr(8*l),T=A>>3,x=0;x>>0]=te}return un(t,l,A,s)})}var lr=[],cr={},Xr=()=>{if(!dr){var t={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",_:b||"./this.program"},s;for(s in cr)cr[s]===void 0?delete t[s]:t[s]=cr[s];var l=[];for(s in t)l.push(`${s}=${t[s]}`);dr=l}return dr},dr;function Jr(t,s){if(E)return Q(19,1,t,s);t>>>=0,s>>>=0;var l=0;return Xr().forEach(function(y,A){var T=s+l;for(A=c()[t+4*A>>2>>>0]=T,T=0;T>0>>>0]=y.charCodeAt(T);e()[A>>0>>>0]=0,l+=y.length+1}),0}function Qr(t,s){if(E)return Q(20,1,t,s);t>>>=0,s>>>=0;var l=Xr();c()[t>>2>>>0]=l.length;var y=0;return l.forEach(function(A){y+=A.length+1}),c()[s>>2>>>0]=y,0}function Zr(t){return E?Q(21,1,t):52}function Kr(t,s,l,y){return E?Q(22,1,t,s,l,y):52}function en(t,s,l,y,A){return E?Q(23,1,t,s,l,y,A):70}var Wa=[null,[],[]];function tn(t,s,l,y){if(E)return Q(24,1,t,s,l,y);s>>>=0,l>>>=0,y>>>=0;for(var A=0,T=0;T>2>>>0],te=c()[s+4>>2>>>0];s+=8;for(var Fe=0;Fe>>0],we=Wa[t];ie===0||ie===10?((t===1?$:se)(Ot(we,0)),we.length=0):we.push(ie)}A+=te}return c()[y>>2>>>0]=A,0}var rn=[31,29,31,30,31,30,31,31,30,31,30,31],nn=[31,28,31,30,31,30,31,31,30,31,30,31];function Ga(t){var s=Array(ne(t)+1);return pe(t,s,0,s.length),s}var za=(t,s)=>{e().set(t,s>>>0)};function an(t,s,l,y){function A(_,Y,re){for(_=typeof _=="number"?_.toString():_||"";_.lengthhn?-1:0$e-_.getDate())Y-=$e-_.getDate()+1,_.setDate(1),11>re?_.setMonth(re+1):(_.setMonth(0),_.setFullYear(_.getFullYear()+1));else{_.setDate(_.getDate()+Y);break}}return re=new Date(_.getFullYear()+1,0,4),Y=te(new Date(_.getFullYear(),0,4)),re=te(re),0>=x(Y,_)?0>=x(re,_)?_.getFullYear()+1:_.getFullYear():_.getFullYear()-1}t>>>=0,s>>>=0,l>>>=0,y>>>=0;var ie=a()[y+40>>2>>>0];y={qb:a()[y>>2>>>0],pb:a()[y+4>>2>>>0],Sa:a()[y+8>>2>>>0],Wa:a()[y+12>>2>>>0],Ta:a()[y+16>>2>>>0],Qa:a()[y+20>>2>>>0],Ma:a()[y+24>>2>>>0],Pa:a()[y+28>>2>>>0],yb:a()[y+32>>2>>>0],ob:a()[y+36>>2>>>0],rb:ie?nt(ie):""},l=nt(l),ie={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var we in ie)l=l.replace(new RegExp(we,"g"),ie[we]);var pn="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),mn="January February March April May June July August September October November December".split(" ");ie={"%a":_=>pn[_.Ma].substring(0,3),"%A":_=>pn[_.Ma],"%b":_=>mn[_.Ta].substring(0,3),"%B":_=>mn[_.Ta],"%C":_=>T((_.Qa+1900)/100|0,2),"%d":_=>T(_.Wa,2),"%e":_=>A(_.Wa,2," "),"%g":_=>Fe(_).toString().substring(2),"%G":_=>Fe(_),"%H":_=>T(_.Sa,2),"%I":_=>(_=_.Sa,_==0?_=12:12<_&&(_-=12),T(_,2)),"%j":_=>{for(var Y=0,re=0;re<=_.Ta-1;Y+=(it(_.Qa+1900)?rn:nn)[re++]);return T(_.Wa+Y,3)},"%m":_=>T(_.Ta+1,2),"%M":_=>T(_.pb,2),"%n":()=>` +`,"%p":_=>0<=_.Sa&&12>_.Sa?"AM":"PM","%S":_=>T(_.qb,2),"%t":()=>" ","%u":_=>_.Ma||7,"%U":_=>T(Math.floor((_.Pa+7-_.Ma)/7),2),"%V":_=>{var Y=Math.floor((_.Pa+7-(_.Ma+6)%7)/7);if(2>=(_.Ma+371-_.Pa-2)%7&&Y++,Y)Y==53&&(re=(_.Ma+371-_.Pa)%7,re==4||re==3&&it(_.Qa)||(Y=1));else{Y=52;var re=(_.Ma+7-_.Pa-1)%7;(re==4||re==5&&it(_.Qa%400-1))&&Y++}return T(Y,2)},"%w":_=>_.Ma,"%W":_=>T(Math.floor((_.Pa+7-(_.Ma+6)%7)/7),2),"%y":_=>(_.Qa+1900).toString().substring(2),"%Y":_=>_.Qa+1900,"%z":_=>{_=_.ob;var Y=0<=_;return _=Math.abs(_)/60,(Y?"+":"-")+("0000"+(_/60*100+_%60)).slice(-4)},"%Z":_=>_.rb,"%%":()=>"%"},l=l.replace(/%%/g,"\0\0");for(we in ie)l.includes(we)&&(l=l.replace(new RegExp(we,"g"),ie[we](y)));return l=l.replace(/\0\0/g,"%"),we=Ga(l),we.length>s?0:(za(we,t),we.length-1)}B.Va();var ja=[null,vt,ze,v,I,H,fe,_t,Tt,O,j,X,Ue,Et,Wr,Gr,zr,Yr,Vr,Jr,Qr,Zr,Kr,en,tn],$a={b:function(t,s,l){throw t>>>=0,new i(t).Va(s>>>0,l>>>0),d=t,p++,d},N:function(t){sn(t>>>0,!C,1,!M,131072,!1),B.Ya()},j:function(t){t>>>=0,E?postMessage({cmd:"cleanupThread",thread:t}):Ft(t)},I:R,h:I,T:H,D:fe,F:_t,U:Tt,R:O,J:j,Q:X,n:Ue,E:Et,B:Wr,S:Gr,C:zr,q:()=>!0,z:function(t,s){t>>>=0,t==s>>>0?setTimeout(()=>kt()):E?postMessage({targetThread:t,cmd:"checkMailbox"}):(t=B.La[t])&&t.postMessage({cmd:"checkMailbox"})},L:function(){return-1},M:fr,p:function(t){S&&B.La[t>>>0].ref()},t:function(t,s,l){t=s+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*s:NaN,l>>>=0,t=new Date(1e3*t),a()[l>>2>>>0]=t.getUTCSeconds(),a()[l+4>>2>>>0]=t.getUTCMinutes(),a()[l+8>>2>>>0]=t.getUTCHours(),a()[l+12>>2>>>0]=t.getUTCDate(),a()[l+16>>2>>>0]=t.getUTCMonth(),a()[l+20>>2>>>0]=t.getUTCFullYear()-1900,a()[l+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[l+28>>2>>>0]=t},u:function(t,s,l){t=s+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*s:NaN,l>>>=0,t=new Date(1e3*t),a()[l>>2>>>0]=t.getSeconds(),a()[l+4>>2>>>0]=t.getMinutes(),a()[l+8>>2>>>0]=t.getHours(),a()[l+12>>2>>>0]=t.getDate(),a()[l+16>>2>>>0]=t.getMonth(),a()[l+20>>2>>>0]=t.getFullYear()-1900,a()[l+24>>2>>>0]=t.getDay(),s=(it(t.getFullYear())?jr:$r)[t.getMonth()]+t.getDate()-1|0,a()[l+28>>2>>>0]=s,a()[l+36>>2>>>0]=-(60*t.getTimezoneOffset()),s=new Date(t.getFullYear(),6,1).getTimezoneOffset();var y=new Date(t.getFullYear(),0,1).getTimezoneOffset();t=(s!=y&&t.getTimezoneOffset()==Math.min(y,s))|0,a()[l+32>>2>>>0]=t},v:function(t){t>>>=0;var s=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),l=a()[t+32>>2>>>0],y=s.getTimezoneOffset(),A=new Date(s.getFullYear(),6,1).getTimezoneOffset(),T=new Date(s.getFullYear(),0,1).getTimezoneOffset(),x=Math.min(T,A);return 0>l?a()[t+32>>2>>>0]=+(A!=T&&x==y):0>2>>>0]=s.getDay(),l=(it(s.getFullYear())?jr:$r)[s.getMonth()]+s.getDate()-1|0,a()[t+28>>2>>>0]=l,a()[t>>2>>>0]=s.getSeconds(),a()[t+4>>2>>>0]=s.getMinutes(),a()[t+8>>2>>>0]=s.getHours(),a()[t+12>>2>>>0]=s.getDate(),a()[t+16>>2>>>0]=s.getMonth(),a()[t+20>>2>>>0]=s.getYear(),t=s.getTime()/1e3,ln((Ne=t,1<=+Math.abs(Ne)?0>>0:~~+Math.ceil((Ne-+(~~Ne>>>0))/4294967296)>>>0:0)),t>>>0},r:Yr,s:Vr,y:function(t,s,l){function y(ie){return(ie=ie.toTimeString().match(/\(([A-Za-z ]+)\)$/))?ie[1]:"GMT"}t>>>=0,s>>>=0,l>>>=0;var A=new Date().getFullYear(),T=new Date(A,0,1),x=new Date(A,6,1);A=T.getTimezoneOffset();var te=x.getTimezoneOffset(),Fe=Math.max(A,te);c()[t>>2>>>0]=60*Fe,a()[s>>2>>>0]=+(A!=te),t=y(T),s=y(x),t=qr(t),s=qr(s),te>2>>>0]=t,c()[l+4>>2>>>0]=s):(c()[l>>2>>>0]=s,c()[l+4>>2>>>0]=t)},c:()=>{Me("")},k:function(){},i:function(){return Date.now()},o:()=>{throw ke+=1,"unwind"},A:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:function(){return S?(Kn(),ut(Zn)).cpus().length:navigator.hardwareConcurrency},K:function(t,s,l,y){for(B.vb=s>>>0,lr.length=l,s=y>>>0>>3,y=0;y>>0];return ja[t].apply(null,lr)},x:function(t){t>>>=0;var s=u().length;if(t<=s||4294901760=l;l*=2){var y=s*(1+.2/l);y=Math.min(y,t+100663296);var A=Math;y=Math.max(t,y);e:{A=A.min.call(A,4294901760,y+(65536-y%65536)%65536)-K.buffer.byteLength+65535>>>16;try{K.grow(A),ye();var T=1;break e}catch{}T=void 0}if(T)return!0}return!1},O:Jr,P:Qr,H:at,g:Zr,m:Kr,w:en,l:tn,a:K||o.wasmMemory,G:an,d:function(t,s,l,y){return an(t>>>0,s>>>0,l>>>0,y>>>0)}};(function(){function t(l,y){return l=l.exports,D=l=Ya(l),B.Za.push(D.ya),We=D.za,_e.unshift(D.V),N=y,tt(),l}var s={a:$a};if(Le(),o.instantiateWasm)try{return o.instantiateWasm(s,t)}catch(l){se("Module.instantiateWasm callback failed with error: "+l),h(l)}return wt(s,function(l){t(l.instance,l.module)}).catch(h),{}})(),o._OrtInit=(t,s)=>(o._OrtInit=D.W)(t,s),o._OrtGetLastError=(t,s)=>(o._OrtGetLastError=D.X)(t,s),o._OrtCreateSessionOptions=(t,s,l,y,A,T,x,te,Fe,ie)=>(o._OrtCreateSessionOptions=D.Y)(t,s,l,y,A,T,x,te,Fe,ie),o._OrtAppendExecutionProvider=(t,s)=>(o._OrtAppendExecutionProvider=D.Z)(t,s),o._OrtAddFreeDimensionOverride=(t,s,l)=>(o._OrtAddFreeDimensionOverride=D._)(t,s,l),o._OrtAddSessionConfigEntry=(t,s,l)=>(o._OrtAddSessionConfigEntry=D.$)(t,s,l),o._OrtReleaseSessionOptions=t=>(o._OrtReleaseSessionOptions=D.aa)(t),o._OrtCreateSession=(t,s,l)=>(o._OrtCreateSession=D.ba)(t,s,l),o._OrtReleaseSession=t=>(o._OrtReleaseSession=D.ca)(t),o._OrtGetInputOutputCount=(t,s,l)=>(o._OrtGetInputOutputCount=D.da)(t,s,l),o._OrtGetInputName=(t,s)=>(o._OrtGetInputName=D.ea)(t,s),o._OrtGetOutputName=(t,s)=>(o._OrtGetOutputName=D.fa)(t,s),o._OrtFree=t=>(o._OrtFree=D.ga)(t),o._OrtCreateTensor=(t,s,l,y,A,T)=>(o._OrtCreateTensor=D.ha)(t,s,l,y,A,T),o._OrtGetTensorData=(t,s,l,y,A)=>(o._OrtGetTensorData=D.ia)(t,s,l,y,A),o._OrtReleaseTensor=t=>(o._OrtReleaseTensor=D.ja)(t),o._OrtCreateRunOptions=(t,s,l,y)=>(o._OrtCreateRunOptions=D.ka)(t,s,l,y),o._OrtAddRunConfigEntry=(t,s,l)=>(o._OrtAddRunConfigEntry=D.la)(t,s,l),o._OrtReleaseRunOptions=t=>(o._OrtReleaseRunOptions=D.ma)(t),o._OrtCreateBinding=t=>(o._OrtCreateBinding=D.na)(t),o._OrtBindInput=(t,s,l)=>(o._OrtBindInput=D.oa)(t,s,l),o._OrtBindOutput=(t,s,l,y)=>(o._OrtBindOutput=D.pa)(t,s,l,y),o._OrtClearBoundOutputs=t=>(o._OrtClearBoundOutputs=D.qa)(t),o._OrtReleaseBinding=t=>(o._OrtReleaseBinding=D.ra)(t),o._OrtRunWithBinding=(t,s,l,y,A)=>(o._OrtRunWithBinding=D.sa)(t,s,l,y,A),o._OrtRun=(t,s,l,y,A,T,x,te)=>(o._OrtRun=D.ta)(t,s,l,y,A,T,x,te),o._OrtEndProfiling=t=>(o._OrtEndProfiling=D.ua)(t);var Lt=o._pthread_self=()=>(Lt=o._pthread_self=D.va)(),on=o._malloc=t=>(on=o._malloc=D.wa)(t);o._free=t=>(o._free=D.xa)(t),o.__emscripten_tls_init=()=>(o.__emscripten_tls_init=D.ya)();var sn=o.__emscripten_thread_init=(t,s,l,y,A,T)=>(sn=o.__emscripten_thread_init=D.Aa)(t,s,l,y,A,T);o.__emscripten_thread_crashed=()=>(o.__emscripten_thread_crashed=D.Ba)();var un=(t,s,l,y)=>(un=D.Ca)(t,s,l,y),pr=t=>(pr=D.Da)(t),mr=o.__emscripten_thread_exit=t=>(mr=o.__emscripten_thread_exit=D.Ea)(t),fn=o.__emscripten_check_mailbox=()=>(fn=o.__emscripten_check_mailbox=D.Fa)(),ln=t=>(ln=D.Ga)(t),cn=(t,s)=>(cn=D.Ha)(t,s),hr=()=>(hr=D.Ia)(),Nt=t=>(Nt=D.Ja)(t),gr=t=>(gr=D.Ka)(t);function Ya(t){t=Object.assign({},t);var s=y=>()=>y()>>>0,l=y=>A=>y(A)>>>0;return t.__errno_location=s(t.__errno_location),t.pthread_self=s(t.pthread_self),t.malloc=l(t.malloc),t.stackSave=s(t.stackSave),t.stackAlloc=l(t.stackAlloc),t}o.keepRuntimeAlive=ae,o.wasmMemory=K,o.stackAlloc=gr,o.stackSave=hr,o.stackRestore=Nt,o.UTF8ToString=nt,o.stringToUTF8=ue,o.lengthBytesUTF8=ne,o.ExitStatus=Ge,o.PThread=B;var Ht;Ae=function t(){Ht||dn(),Ht||(Ae=t)};function dn(){function t(){if(!Ht&&(Ht=!0,o.calledRun=!0,!ge)&&(E||ot(_e),m(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),!E)){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;){var s=o.postRun.shift();De.unshift(s)}ot(De)}}if(!(0ea)});var na=st((bi,oo)=>{oo.exports='"use strict";var Module={},ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads"),parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",e=>onmessage({data:e}));var fs=require("fs");Object.assign(global,{self:global,require,Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:e=>(0,eval)(fs.readFileSync(e,"utf8")+"//# sourceURL="+e),postMessage:e=>parentPort.postMessage(e),performance:global.performance||{now:Date.now}})}var initializedJS=!1;function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,e+`\n`);return}console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var a=Module.wasmModule;Module.wasmModule=null;var r=new WebAssembly.Instance(a,e);return t(r)},self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let a=[];self.onmessage=r=>a.push(r),self.startWorker=r=>{Module=r,postMessage({cmd:"loaded"});for(let s of a)handleMessage(s);self.onmessage=handleMessage},Module.wasmModule=e.data.wasmModule;for(const r of e.data.handlers)Module[r]=(...s)=>{postMessage({cmd:"callHandler",handler:r,args:s})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,typeof e.data.urlOrBlob=="string")importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(Module)}else if(e.data.cmd==="run"){Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.__emscripten_thread_mailbox_await(e.data.pthread_ptr),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(a){if(a!="unwind")throw a}}else e.data.cmd==="cancel"?Module._pthread_self()&&Module.__emscripten_thread_exit(-1):e.data.target==="setimmediate"||(e.data.cmd==="checkMailbox"?initializedJS&&Module.checkMailbox():e.data.cmd&&(err("worker.js received unknown command "+e.data.cmd),err(e.data)))}catch(a){throw Module.__emscripten_thread_crashed&&Module.__emscripten_thread_crashed(),a}}self.onmessage=handleMessage;\n'});var oa,io,Rr,Cr,qt,aa,so,uo,fo,ia,G,Qe=W(()=>{"use strict";oa=Xn();io=ra(),Cr=!1,qt=!1,aa=!1,so=n=>{if(n===1)return!1;if(typeof SharedArrayBuffer>"u")return typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+n+", 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 "+n+", 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}},uo=()=>{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}},fo=(n,r)=>n?"ort-training-wasm-simd.wasm":r?"ort-wasm-threaded.wasm":"ort-wasm.wasm",ia=async n=>{if(Cr)return Promise.resolve();if(qt)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(aa)throw new Error("previous call to 'initializeWebAssembly()' failed.");qt=!0;let r=n.initTimeout,e=n.numThreads,u=n.simd,a=so(e),c=u&&uo(),f=n.wasmPaths,o=typeof f=="string"?f:void 0,m=fo(c,a),h=typeof f=="object"?f[m]:void 0,g=!1,b=[];if(r>0&&b.push(new Promise(w=>{setTimeout(()=>{g=!0,w()},r)})),b.push(new Promise((w,M)=>{let C=a?io:oa,S={locateFile:(E,F)=>a&&E.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([na()],{type:"text/javascript"})):E.endsWith(".wasm")?h||(o??F)+m:F+E};if(a)if(S.numThreads=e,typeof Blob>"u")S.mainScriptUrlOrBlob=(void 0)(__dirname,"ort-wasm-threaded.js");else{let E=`var ortWasmThreaded=${C.toString()};`;S.mainScriptUrlOrBlob=new Blob([E],{type:"text/javascript"})}C(S).then(E=>{qt=!1,Cr=!0,Rr=E,w()},E=>{qt=!1,aa=!0,M(E)})})),await Promise.race(b),g)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},G=()=>{if(Cr&&Rr)return Rr;throw new Error("WebAssembly is not initialized yet.")}});var Z,Rt,q,Ct=W(()=>{"use strict";Qe();Z=(n,r)=>{let e=G(),u=e.lengthBytesUTF8(n)+1,a=e._malloc(u);return e.stringToUTF8(n,a,u),r.push(a),a},Rt=(n,r,e,u)=>{if(typeof n=="object"&&n!==null){if(e.has(n))throw new Error("Circular reference in options");e.add(n)}Object.entries(n).forEach(([a,c])=>{let f=r?r+a:a;if(typeof c=="object")Rt(c,f+".",e,u);else if(typeof c=="string"||typeof c=="number")u(f,c.toString());else if(typeof c=="boolean")u(f,c?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof c}`)})},q=n=>{let r=G(),e=r.stackSave();try{let u=r.stackAlloc(8);r._OrtGetLastError(u,u+4);let a=r.HEAP32[u/4],c=r.HEAPU32[u/4+1],f=c?r.UTF8ToString(c):"";throw new Error(`${n} ERROR_CODE: ${a}, ERROR_MESSAGE: ${f}`)}finally{r.stackRestore(e)}}});var ft,Pr=W(()=>{"use strict";Qe();Ct();ft=n=>{let r=G(),e=0,u=[],a=n||{};try{if(n?.logSeverityLevel===void 0)a.logSeverityLevel=2;else if(typeof n.logSeverityLevel!="number"||!Number.isInteger(n.logSeverityLevel)||n.logSeverityLevel<0||n.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${n.logSeverityLevel}`);if(n?.logVerbosityLevel===void 0)a.logVerbosityLevel=0;else if(typeof n.logVerbosityLevel!="number"||!Number.isInteger(n.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${n.logVerbosityLevel}`);n?.terminate===void 0&&(a.terminate=!1);let c=0;return n?.tag!==void 0&&(c=Z(n.tag,u)),e=r._OrtCreateRunOptions(a.logSeverityLevel,a.logVerbosityLevel,!!a.terminate,c),e===0&&q("Can't create run options."),n?.extra!==void 0&&Rt(n.extra,"",new WeakSet,(f,o)=>{let m=Z(f,u),h=Z(o,u);r._OrtAddRunConfigEntry(e,m,h)!==0&&q(`Can't set a run config entry: ${f} - ${o}.`)}),[e,u]}catch(c){throw e!==0&&r._OrtReleaseRunOptions(e),u.forEach(f=>r._free(f)),c}}});var lo,co,po,mo,Xt,xr=W(()=>{"use strict";Qe();Ct();lo=n=>{switch(n){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${n}`)}},co=n=>{switch(n){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${n}`)}},po=n=>{n.extra||(n.extra={}),n.extra.session||(n.extra.session={});let r=n.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),n.executionProviders&&n.executionProviders.some(e=>(typeof e=="string"?e:e.name)==="webgpu")&&(n.enableMemPattern=!1)},mo=(n,r,e)=>{for(let u of r){let a=typeof u=="string"?u:u.name;switch(a){case"webnn":if(a="WEBNN",typeof u!="string"){let f=u;if(f?.deviceType){let o=Z("deviceType",e),m=Z(f.deviceType,e);G()._OrtAddSessionConfigEntry(n,o,m)!==0&&q(`Can't set a session config entry: 'deviceType' - ${f.deviceType}.`)}if(f?.numThreads){let o=f.numThreads;(typeof o!="number"||!Number.isInteger(o)||o<0)&&(o=0);let m=Z("numThreads",e),h=Z(o.toString(),e);G()._OrtAddSessionConfigEntry(n,m,h)!==0&&q(`Can't set a session config entry: 'numThreads' - ${f.numThreads}.`)}if(f?.powerPreference){let o=Z("powerPreference",e),m=Z(f.powerPreference,e);G()._OrtAddSessionConfigEntry(n,o,m)!==0&&q(`Can't set a session config entry: 'powerPreference' - ${f.powerPreference}.`)}}break;case"webgpu":if(a="JS",typeof u!="string"){let f=u;if(f?.preferredLayout){if(f.preferredLayout!=="NCHW"&&f.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${f.preferredLayout}`);let o=Z("preferredLayout",e),m=Z(f.preferredLayout,e);G()._OrtAddSessionConfigEntry(n,o,m)!==0&&q(`Can't set a session config entry: 'preferredLayout' - ${f.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${a}`)}let c=Z(a,e);G()._OrtAppendExecutionProvider(n,c)!==0&&q(`Can't append execution provider: ${a}.`)}},Xt=n=>{let r=G(),e=0,u=[],a=n||{};po(a);try{let c=lo(a.graphOptimizationLevel??"all"),f=co(a.executionMode??"sequential"),o=typeof a.logId=="string"?Z(a.logId,u):0,m=a.logSeverityLevel??2;if(!Number.isInteger(m)||m<0||m>4)throw new Error(`log serverity level is not valid: ${m}`);let h=a.logVerbosityLevel??0;if(!Number.isInteger(h)||h<0||h>4)throw new Error(`log verbosity level is not valid: ${h}`);let g=typeof a.optimizedModelFilePath=="string"?Z(a.optimizedModelFilePath,u):0;if(e=r._OrtCreateSessionOptions(c,!!a.enableCpuMemArena,!!a.enableMemPattern,f,!!a.enableProfiling,0,o,m,h,g),e===0&&q("Can't create session options."),a.executionProviders&&mo(e,a.executionProviders,u),a.enableGraphCapture!==void 0){if(typeof a.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${a.enableGraphCapture}`);let b=Z("enableGraphCapture",u),w=Z(a.enableGraphCapture.toString(),u);r._OrtAddSessionConfigEntry(e,b,w)!==0&&q(`Can't set a session config entry: 'enableGraphCapture' - ${a.enableGraphCapture}.`)}if(a.freeDimensionOverrides)for(let[b,w]of Object.entries(a.freeDimensionOverrides)){if(typeof b!="string")throw new Error(`free dimension override name must be a string: ${b}`);if(typeof w!="number"||!Number.isInteger(w)||w<0)throw new Error(`free dimension override value must be a non-negative integer: ${w}`);let M=Z(b,u);r._OrtAddFreeDimensionOverride(e,M,w)!==0&&q(`Can't set a free dimension override: ${b} - ${w}.`)}return a.extra!==void 0&&Rt(a.extra,"",new WeakSet,(b,w)=>{let M=Z(b,u),C=Z(w,u);r._OrtAddSessionConfigEntry(e,M,C)!==0&&q(`Can't set a session config entry: ${b} - ${w}.`)}),[e,u]}catch(c){throw e!==0&&r._OrtReleaseSessionOptions(e),u.forEach(f=>r._free(f)),c}}});var lt,Jt,Ir,Pt,sa,Qt,xt,Zt=W(()=>{"use strict";lt=n=>{switch(n){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: ${n}`)}},Jt=n=>{switch(n){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: ${n}`)}},Ir=n=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][n],Pt=n=>{switch(n){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: ${n}`)}},sa=n=>{switch(n){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: ${n}`)}},Qt=n=>n==="float32"||n==="float16"||n==="int32"||n==="int64"||n==="uint32"||n==="uint8"||n==="bool",xt=n=>{switch(n){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: ${n}`)}}});var It,Dr=W(()=>{"use strict";It=async n=>{if(typeof n=="string")if(typeof process<"u"&&process.versions&&process.versions.node)try{return new Uint8Array(await(void 0)(n))}catch(r){if(r.code==="ERR_FS_FILE_TOO_LARGE"){let e=(void 0)(n),u=[];for await(let a of e)u.push(a);return new Uint8Array(Buffer.concat(u))}throw r}else{let r=await fetch(n);if(!r.ok)throw new Error(`failed to load external data file: ${n}`);let e=r.headers.get("Content-Length"),u=e?parseInt(e,10):0;if(u<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${n}, no response body.`);let a=r.body.getReader(),c;try{c=new ArrayBuffer(u)}catch(o){if(o instanceof RangeError){let m=Math.ceil(u/65536);c=new WebAssembly.Memory({initial:m,maximum:m}).buffer}else throw o}let f=0;for(;;){let{done:o,value:m}=await a.read();if(o)break;let h=m.byteLength;new Uint8Array(c,f,h).set(m),f+=h}return new Uint8Array(c,0,u)}}else return n instanceof Blob?new Uint8Array(await n.arrayBuffer()):n instanceof Uint8Array?n:new Uint8Array(n)}});var ho,ua,fa,ct,go,Dt,la,ca,Kt,da,pa,ma,er=W(()=>{"use strict";Pr();xr();Zt();Qe();Ct();Dr();ho=(n,r)=>{G()._OrtInit(n,r)!==0&&q("Can't initialize onnxruntime.")},ua=async n=>{ho(n.wasm.numThreads,sa(n.logLevel))},fa=async(n,r)=>{},ct=new Map,go=n=>{let r=G(),e=r.stackSave();try{let u=r.stackAlloc(8);return r._OrtGetInputOutputCount(n,u,u+4)!==0&&q("Can't get session input/output count."),[r.HEAP32[u/4],r.HEAP32[u/4+1]]}finally{r.stackRestore(e)}},Dt=n=>{let r=G(),e=r._malloc(n.byteLength);if(e===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${n.byteLength}.`);return r.HEAPU8.set(n,e),[e,n.byteLength]},la=async(n,r)=>{let e,u,a=G();Array.isArray(n)?[e,u]=n:n.buffer===a.HEAPU8.buffer?[e,u]=[n.byteOffset,n.byteLength]:[e,u]=Dt(n);let c=0,f=0,o=0,m=[],h=[],g=[];try{if([f,m]=Xt(r),r?.externalData&&a.mountExternalData){let L=[];for(let k of r.externalData){let z=typeof k=="string"?k:k.path;L.push(It(typeof k=="string"?k:k.data).then(P=>{a.mountExternalData(z,P)}))}await Promise.all(L)}c=await a._OrtCreateSession(e,u,f),c===0&&q("Can't create a session.");let[b,w]=go(c),M=!!r?.enableGraphCapture,C=[],S=[],E=[];for(let L=0;La._OrtFree(w)),g.forEach(w=>a._OrtFree(w)),o!==0&&a._OrtReleaseBinding(o),c!==0&&a._OrtReleaseSession(c),b}finally{a._free(e),f!==0&&a._OrtReleaseSessionOptions(f),m.forEach(b=>a._free(b)),a.unmountExternalData?.()}},ca=n=>{let r=G(),e=ct.get(n);if(!e)throw new Error(`cannot release session. invalid session id: ${n}`);let[u,a,c,f,o]=e;f&&(o&&r._OrtClearBoundOutputs(f.handle),r._OrtReleaseBinding(f.handle)),r.jsepOnReleaseSession?.(n),a.forEach(m=>r._OrtFree(m)),c.forEach(m=>r._OrtFree(m)),r._OrtReleaseSession(u),ct.delete(n)},Kt=(n,r,e,u,a,c=!1)=>{if(!n){r.push(0);return}let f=G(),o=n[0],m=n[1],h=n[3],g,b;if(o==="string"&&h==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");if(c&&h!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${a} when enableGraphCapture is true.`);if(h==="gpu-buffer"){let C=n[2].gpuBuffer,S=Ir(lt(o));b=m.reduce((F,L)=>F*L,1)*S;let E=f.jsepRegisterBuffer;if(!E)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');g=E(u,a,C,b)}else{let C=n[2];if(Array.isArray(C)){b=4*C.length,g=f._malloc(b),e.push(g);let S=g/4;for(let E=0;Ef.HEAP32[C++]=E);let S=f._OrtCreateTensor(lt(o),g,b,M,m.length,xt(h));S===0&&q(`Can't create tensor for input/output. session=${u}, index=${a}.`),r.push(S)}finally{f.stackRestore(w)}},da=async(n,r,e,u,a,c)=>{let f=G(),o=ct.get(n);if(!o)throw new Error(`cannot run inference. invalid session id: ${n}`);let m=o[0],h=o[1],g=o[2],b=o[3],w=o[4],M=o[5],C=r.length,S=u.length,E=0,F=[],L=[],k=[],z=[],P=f.stackSave(),Oe=f.stackAlloc(C*4),ve=f.stackAlloc(C*4),he=f.stackAlloc(S*4),U=f.stackAlloc(S*4);try{[E,F]=ft(c);for(let N=0;Nae*J,1);ee=Jt(Ie);let ke=b?.outputPreferredLocations[u[N]];if(ee==="string"){if(ke==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");let ae=[],J=de/4;for(let Te=0;Te0){let ae=f.jsepGetBuffer;if(!ae)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let J=ae(de),Te=Ir(Ie);if(Te===void 0||!Qt(ee))throw new Error(`Unsupported data type: ${ee}`);xe=!0,D.push([ee,_e,{gpuBuffer:J,download:f.jsepCreateDownloader(J,De*Te,ee),dispose:()=>{f._OrtReleaseTensor(ge)}},"gpu-buffer"])}else{let ae=Pt(ee),J=new ae(De);new Uint8Array(J.buffer,J.byteOffset,J.byteLength).set(f.HEAPU8.subarray(de,de+J.byteLength)),D.push([ee,_e,J,"cpu"])}}finally{f.stackRestore(ce),ee==="string"&&de&&f._free(de),xe||f._OrtReleaseTensor(ge)}}return b&&!w&&(f._OrtClearBoundOutputs(b.handle),ct.set(n,[m,h,g,b,w,!1])),D}finally{f.stackRestore(P),L.forEach($=>f._OrtReleaseTensor($)),k.forEach($=>f._OrtReleaseTensor($)),z.forEach($=>f._free($)),E!==0&&f._OrtReleaseRunOptions(E),F.forEach($=>f._free($))}},pa=n=>{let r=G(),e=ct.get(n);if(!e)throw new Error("invalid session id");let u=e[0],a=r._OrtEndProfiling(u);a===0&&q("Can't get an profile file name."),r._OrtFree(a)},ma=n=>{let r=[];for(let e of n){let u=e[2];!Array.isArray(u)&&"buffer"in u&&r.push(u.buffer)}return r}});var ha=st((Ni,wo)=>{wo.exports='/*!\n * ONNX Runtime Web v1.18.0\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n"use strict";(()=>{var vt=Object.defineProperty;var Vr=Object.getOwnPropertyDescriptor;var Jr=Object.getOwnPropertyNames;var Xr=Object.prototype.hasOwnProperty;var _t=(u,c)=>()=>(u&&(c=u(u=0)),c);var nt=(u,c)=>()=>(c||u((c={exports:{}}).exports,c),c.exports),Et=(u,c)=>{for(var n in c)vt(u,n,{get:c[n],enumerable:!0})},Qr=(u,c,n,h)=>{if(c&&typeof c=="object"||typeof c=="function")for(let f of Jr(c))!Xr.call(u,f)&&f!==n&&vt(u,f,{get:()=>c[f],enumerable:!(h=Vr(c,f))||h.enumerable});return u};var at=u=>Qr(vt({},"__esModule",{value:!0}),u);var St={};Et(St,{createReadStream:()=>fr,readFile:()=>Zr,readFileSync:()=>Kr});var Zr,Kr,fr,Tt=_t(()=>{Zr=void 0,Kr=void 0,fr=void 0});var At={};Et(At,{join:()=>en});var en,Mt=_t(()=>{en=void 0});var dr=nt((cr,Ct)=>{"use strict";var lr=(()=>{var u=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(u=u||__filename),function(c={}){var n=c,h,f;n.ready=new Promise((t,i)=>{h=t,f=i});var w=Object.assign({},n),g="./this.program",o=typeof window=="object",T=typeof importScripts=="function",P=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",I="",R,D,ee;if(P){var U=(Tt(),at(St)),L=(Mt(),at(At));I=T?L.dirname(I)+"/":__dirname+"/",R=(t,i)=>(t=t.startsWith("file://")?new URL(t):L.normalize(t),U.readFileSync(t,i?void 0:"utf8")),ee=t=>(t=R(t,!0),t.buffer||(t=new Uint8Array(t)),t),D=(t,i,s,p=!0)=>{t=t.startsWith("file://")?new URL(t):L.normalize(t),U.readFile(t,p?void 0:"utf8",(O,S)=>{O?s(O):i(p?S.buffer:S)})},!n.thisProgram&&1"[Emscripten Module object]"}else(o||T)&&(T?I=self.location.href:typeof document<"u"&&document.currentScript&&(I=document.currentScript.src),u&&(I=u),I.indexOf("blob:")!==0?I=I.substr(0,I.replace(/[?#].*/,"").lastIndexOf("/")+1):I="",R=t=>{var i=new XMLHttpRequest;return i.open("GET",t,!1),i.send(null),i.responseText},T&&(ee=t=>{var i=new XMLHttpRequest;return i.open("GET",t,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),D=(t,i,s)=>{var p=new XMLHttpRequest;p.open("GET",t,!0),p.responseType="arraybuffer",p.onload=()=>{p.status==200||p.status==0&&p.response?i(p.response):s()},p.onerror=s,p.send(null)});var v=n.print||console.log.bind(console),k=n.printErr||console.error.bind(console);Object.assign(n,w),w=null,n.thisProgram&&(g=n.thisProgram);var W;n.wasmBinary&&(W=n.wasmBinary);var z=n.noExitRuntime||!0;typeof WebAssembly!="object"&&re("no native wasm support detected");var ae,E,ve=!1,Oe,ce,M,N;function oe(){var t=ae.buffer;n.HEAP8=Oe=new Int8Array(t),n.HEAP16=new Int16Array(t),n.HEAP32=M=new Int32Array(t),n.HEAPU8=ce=new Uint8Array(t),n.HEAPU16=new Uint16Array(t),n.HEAPU32=N=new Uint32Array(t),n.HEAPF32=new Float32Array(t),n.HEAPF64=new Float64Array(t)}var _e=[],Fe=[],V=[];function A(){var t=n.preRun.shift();_e.unshift(t)}var x=0,de=null,ue=null;function re(t){throw n.onAbort&&n.onAbort(t),t="Aborted("+t+")",k(t),ve=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),f(t),t}function Ee(t){return t.startsWith("data:application/octet-stream;base64,")}var J;if(J="ort-training-wasm-simd.wasm",!Ee(J)){var fe=J;J=n.locateFile?n.locateFile(fe,I):I+fe}function ke(t){if(t==J&&W)return new Uint8Array(W);if(ee)return ee(t);throw"both async and sync fetching of the wasm failed"}function pe(t){if(!W&&(o||T)){if(typeof fetch=="function"&&!t.startsWith("file://"))return fetch(t,{credentials:"same-origin"}).then(i=>{if(!i.ok)throw"failed to load wasm binary file at \'"+t+"\'";return i.arrayBuffer()}).catch(()=>ke(t));if(D)return new Promise((i,s)=>{D(t,p=>i(new Uint8Array(p)),s)})}return Promise.resolve().then(()=>ke(t))}function Se(t,i,s){return pe(t).then(p=>WebAssembly.instantiate(p,i)).then(p=>p).then(s,p=>{k("failed to asynchronously prepare wasm: "+p),re(p)})}function Pe(t,i){var s=J;return W||typeof WebAssembly.instantiateStreaming!="function"||Ee(s)||s.startsWith("file://")||P||typeof fetch!="function"?Se(s,t,i):fetch(s,{credentials:"same-origin"}).then(p=>WebAssembly.instantiateStreaming(p,t).then(i,function(O){return k("wasm streaming compile failed: "+O),k("falling back to ArrayBuffer instantiation"),Se(s,t,i)}))}var ye,ge=t=>{for(;0>2>>>0]=i},this.Ka=function(i){N[this.Ha+8>>2>>>0]=i},this.Ia=function(i,s){this.Ja(),this.La(i),this.Ka(s)},this.Ja=function(){N[this.Ha+16>>2>>>0]=0}}var Re=0,te=0,j=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,he=(t,i,s)=>{i>>>=0;var p=i+s;for(s=i;t[s]&&!(s>=p);)++s;if(16O?p+=String.fromCharCode(O):(O-=65536,p+=String.fromCharCode(55296|O>>10,56320|O&1023))}}else p+=String.fromCharCode(O)}return p},be=(t,i)=>(t>>>=0)?he(ce,t,i):"",De=t=>{for(var i=0,s=0;s=p?i++:2047>=p?i+=2:55296<=p&&57343>=p?(i+=4,++s):i+=3}return i},We=(t,i,s,p)=>{if(s>>>=0,!(0=F){var Z=t.charCodeAt(++S);F=65536+((F&1023)<<10)|Z&1023}if(127>=F){if(s>=p)break;i[s++>>>0]=F}else{if(2047>=F){if(s+1>=p)break;i[s++>>>0]=192|F>>6}else{if(65535>=F){if(s+2>=p)break;i[s++>>>0]=224|F>>12}else{if(s+3>=p)break;i[s++>>>0]=240|F>>18,i[s++>>>0]=128|F>>12&63}i[s++>>>0]=128|F>>6&63}i[s++>>>0]=128|F&63}}return i[s>>>0]=0,s-O},we=t=>t%4===0&&(t%100!==0||t%400===0),$e=[0,31,60,91,121,152,182,213,244,274,305,335],Ce=[0,31,59,90,120,151,181,212,243,273,304,334],qe=t=>{var i=De(t)+1,s=Ze(i);return s&&We(t,ce,s,i),s},Ve={},Je=()=>{if(!Xe){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"},i;for(i in Ve)Ve[i]===void 0?delete t[i]:t[i]=Ve[i];var s=[];for(i in t)s.push(`${i}=${t[i]}`);Xe=s}return Xe},Xe,xe=[null,[],[]],Ie=[31,29,31,30,31,30,31,31,30,31,30,31],Ne=[31,28,31,30,31,30,31,31,30,31,30,31];function it(t){var i=Array(De(t)+1);return We(t,i,0,i.length),i}function Qe(t,i,s,p){function O(d,B,G){for(d=typeof d=="number"?d.toString():d||"";d.lengthrt?-1:0Ae-d.getDate())B-=Ae-d.getDate()+1,d.setDate(1),11>G?d.setMonth(G+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else{d.setDate(d.getDate()+B);break}}return G=new Date(d.getFullYear()+1,0,4),B=Z(new Date(d.getFullYear(),0,4)),G=Z(G),0>=F(B,d)?0>=F(G,d)?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}t>>>=0,i>>>=0,s>>>=0,p>>>=0;var ie=M[p+40>>2>>>0];p={Oa:M[p>>2>>>0],Na:M[p+4>>2>>>0],Ea:M[p+8>>2>>>0],Ga:M[p+12>>2>>>0],Fa:M[p+16>>2>>>0],Da:M[p+20>>2>>>0],xa:M[p+24>>2>>>0],Ca:M[p+28>>2>>>0],Qa:M[p+32>>2>>>0],Ma:M[p+36>>2>>>0],Pa:ie?be(ie):""},s=be(s),ie={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var se in ie)s=s.replace(new RegExp(se,"g"),ie[se]);var et="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),tt="January February March April May June July August September October November December".split(" ");ie={"%a":d=>et[d.xa].substring(0,3),"%A":d=>et[d.xa],"%b":d=>tt[d.Fa].substring(0,3),"%B":d=>tt[d.Fa],"%C":d=>S((d.Da+1900)/100|0,2),"%d":d=>S(d.Ga,2),"%e":d=>O(d.Ga,2," "),"%g":d=>le(d).toString().substring(2),"%G":d=>le(d),"%H":d=>S(d.Ea,2),"%I":d=>(d=d.Ea,d==0?d=12:12{for(var B=0,G=0;G<=d.Fa-1;B+=(we(d.Da+1900)?Ie:Ne)[G++]);return S(d.Ga+B,3)},"%m":d=>S(d.Fa+1,2),"%M":d=>S(d.Na,2),"%n":()=>`\n`,"%p":d=>0<=d.Ea&&12>d.Ea?"AM":"PM","%S":d=>S(d.Oa,2),"%t":()=>" ","%u":d=>d.xa||7,"%U":d=>S(Math.floor((d.Ca+7-d.xa)/7),2),"%V":d=>{var B=Math.floor((d.Ca+7-(d.xa+6)%7)/7);if(2>=(d.xa+371-d.Ca-2)%7&&B++,B)B==53&&(G=(d.xa+371-d.Ca)%7,G==4||G==3&&we(d.Da)||(B=1));else{B=52;var G=(d.xa+7-d.Ca-1)%7;(G==4||G==5&&we(d.Da%400-1))&&B++}return S(B,2)},"%w":d=>d.xa,"%W":d=>S(Math.floor((d.Ca+7-(d.xa+6)%7)/7),2),"%y":d=>(d.Da+1900).toString().substring(2),"%Y":d=>d.Da+1900,"%z":d=>{d=d.Ma;var B=0<=d;return d=Math.abs(d)/60,(B?"+":"-")+("0000"+(d/60*100+d%60)).slice(-4)},"%Z":d=>d.Pa,"%%":()=>"%"},s=s.replace(/%%/g,"\\0\\0");for(se in ie)s.includes(se)&&(s=s.replace(new RegExp(se,"g"),ie[se](p)));return s=s.replace(/\\0\\0/g,"%"),se=it(s),se.length>i?0:(Oe.set(se,t>>>0),se.length-1)}var st={a:function(t,i,s){throw t>>>=0,new Te(t).Ia(i>>>0,s>>>0),Re=t,te++,Re},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(t,i,s){t=i+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*i:NaN,s>>>=0,t=new Date(1e3*t),M[s>>2>>>0]=t.getUTCSeconds(),M[s+4>>2>>>0]=t.getUTCMinutes(),M[s+8>>2>>>0]=t.getUTCHours(),M[s+12>>2>>>0]=t.getUTCDate(),M[s+16>>2>>>0]=t.getUTCMonth(),M[s+20>>2>>>0]=t.getUTCFullYear()-1900,M[s+24>>2>>>0]=t.getUTCDay(),M[s+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},p:function(t,i,s){t=i+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*i:NaN,s>>>=0,t=new Date(1e3*t),M[s>>2>>>0]=t.getSeconds(),M[s+4>>2>>>0]=t.getMinutes(),M[s+8>>2>>>0]=t.getHours(),M[s+12>>2>>>0]=t.getDate(),M[s+16>>2>>>0]=t.getMonth(),M[s+20>>2>>>0]=t.getFullYear()-1900,M[s+24>>2>>>0]=t.getDay(),M[s+28>>2>>>0]=(we(t.getFullYear())?$e:Ce)[t.getMonth()]+t.getDate()-1|0,M[s+36>>2>>>0]=-(60*t.getTimezoneOffset()),i=new Date(t.getFullYear(),6,1).getTimezoneOffset();var p=new Date(t.getFullYear(),0,1).getTimezoneOffset();M[s+32>>2>>>0]=(i!=p&&t.getTimezoneOffset()==Math.min(p,i))|0},q:function(t){t>>>=0;var i=new Date(M[t+20>>2>>>0]+1900,M[t+16>>2>>>0],M[t+12>>2>>>0],M[t+8>>2>>>0],M[t+4>>2>>>0],M[t>>2>>>0],0),s=M[t+32>>2>>>0],p=i.getTimezoneOffset(),O=new Date(i.getFullYear(),6,1).getTimezoneOffset(),S=new Date(i.getFullYear(),0,1).getTimezoneOffset(),F=Math.min(S,O);return 0>s?M[t+32>>2>>>0]=+(O!=S&&F==p):0>2>>>0]=i.getDay(),M[t+28>>2>>>0]=(we(i.getFullYear())?$e:Ce)[i.getMonth()]+i.getDate()-1|0,M[t>>2>>>0]=i.getSeconds(),M[t+4>>2>>>0]=i.getMinutes(),M[t+8>>2>>>0]=i.getHours(),M[t+12>>2>>>0]=i.getDate(),M[t+16>>2>>>0]=i.getMonth(),M[t+20>>2>>>0]=i.getYear(),t=i.getTime()/1e3,He((ye=t,1<=+Math.abs(ye)?0>>0:~~+Math.ceil((ye-+(~~ye>>>0))/4294967296)>>>0:0)),t>>>0},m:function(){return-52},n:function(){},t:function(t,i,s){function p(le){return(le=le.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?le[1]:"GMT"}s>>>=0;var O=new Date().getFullYear(),S=new Date(O,0,1),F=new Date(O,6,1);O=S.getTimezoneOffset();var Z=F.getTimezoneOffset();N[t>>>0>>2>>>0]=60*Math.max(O,Z),M[i>>>0>>2>>>0]=+(O!=Z),t=p(S),i=p(F),t=qe(t),i=qe(i),Z>2>>>0]=t,N[s+4>>2>>>0]=i):(N[s>>2>>>0]=i,N[s+4>>2>>>0]=t)},d:()=>{re("")},h:function(){return Date.now()},u:function(){return 4294901760},b:()=>performance.now(),I:function(t,i,s){return i>>>=0,ce.copyWithin(t>>>0>>>0,i>>>0,i+(s>>>0)>>>0)},s:function(t){t>>>=0;var i=ce.length;if(4294901760=s;s*=2){var p=i*(1+.2/s);p=Math.min(p,t+100663296);var O=Math;p=Math.max(t,p);e:{O=O.min.call(O,4294901760,p+(65536-p%65536)%65536)-ae.buffer.byteLength+65535>>>16;try{ae.grow(O),oe();var S=1;break e}catch{}S=void 0}if(S)return!0}return!1},C:function(t,i){t>>>=0,i>>>=0;var s=0;return Je().forEach(function(p,O){var S=i+s;for(O=N[t+4*O>>2>>>0]=S,S=0;S>0>>>0]=p.charCodeAt(S);Oe[O>>0>>>0]=0,s+=p.length+1}),0},D:function(t,i){t>>>=0,i>>>=0;var s=Je();N[t>>2>>>0]=s.length;var p=0;return s.forEach(function(O){p+=O.length+1}),N[i>>2>>>0]=p,0},f:()=>52,j:function(){return 52},r:function(){return 70},i:function(t,i,s,p){i>>>=0,s>>>=0,p>>>=0;for(var O=0,S=0;S>2>>>0],Z=N[i+4>>2>>>0];i+=8;for(var le=0;le>>0],se=xe[t];ie===0||ie===10?((t===1?v:k)(he(se,0)),se.length=0):se.push(ie)}O+=Z}return N[p>>2>>>0]=O,0},A:Qe,c:function(t,i,s,p){return Qe(t>>>0,i>>>0,s>>>0,p>>>0)}};(function(){function t(s){if(s=s.exports,E=s=ze(s),ae=E.J,oe(),Fe.unshift(E.K),x--,n.monitorRunDependencies&&n.monitorRunDependencies(x),x==0&&(de!==null&&(clearInterval(de),de=null),ue)){var p=ue;ue=null,p()}return s}var i={a:st};if(x++,n.monitorRunDependencies&&n.monitorRunDependencies(x),n.instantiateWasm)try{return n.instantiateWasm(i,t)}catch(s){k("Module.instantiateWasm callback failed with error: "+s),f(s)}return Pe(i,function(s){t(s.instance)}).catch(f),{}})(),n._OrtInit=(t,i)=>(n._OrtInit=E.L)(t,i),n._OrtGetLastError=(t,i)=>(n._OrtGetLastError=E.M)(t,i),n._OrtCreateSessionOptions=(t,i,s,p,O,S,F,Z,le,ie)=>(n._OrtCreateSessionOptions=E.N)(t,i,s,p,O,S,F,Z,le,ie),n._OrtAppendExecutionProvider=(t,i)=>(n._OrtAppendExecutionProvider=E.O)(t,i),n._OrtAddFreeDimensionOverride=(t,i,s)=>(n._OrtAddFreeDimensionOverride=E.P)(t,i,s),n._OrtAddSessionConfigEntry=(t,i,s)=>(n._OrtAddSessionConfigEntry=E.Q)(t,i,s),n._OrtReleaseSessionOptions=t=>(n._OrtReleaseSessionOptions=E.R)(t),n._OrtCreateSession=(t,i,s)=>(n._OrtCreateSession=E.S)(t,i,s),n._OrtReleaseSession=t=>(n._OrtReleaseSession=E.T)(t),n._OrtGetInputOutputCount=(t,i,s)=>(n._OrtGetInputOutputCount=E.U)(t,i,s),n._OrtGetInputName=(t,i)=>(n._OrtGetInputName=E.V)(t,i),n._OrtGetOutputName=(t,i)=>(n._OrtGetOutputName=E.W)(t,i),n._OrtFree=t=>(n._OrtFree=E.X)(t),n._OrtCreateTensor=(t,i,s,p,O,S)=>(n._OrtCreateTensor=E.Y)(t,i,s,p,O,S),n._OrtGetTensorData=(t,i,s,p,O)=>(n._OrtGetTensorData=E.Z)(t,i,s,p,O),n._OrtReleaseTensor=t=>(n._OrtReleaseTensor=E._)(t),n._OrtCreateRunOptions=(t,i,s,p)=>(n._OrtCreateRunOptions=E.$)(t,i,s,p),n._OrtAddRunConfigEntry=(t,i,s)=>(n._OrtAddRunConfigEntry=E.aa)(t,i,s),n._OrtReleaseRunOptions=t=>(n._OrtReleaseRunOptions=E.ba)(t),n._OrtCreateBinding=t=>(n._OrtCreateBinding=E.ca)(t),n._OrtBindInput=(t,i,s)=>(n._OrtBindInput=E.da)(t,i,s),n._OrtBindOutput=(t,i,s,p)=>(n._OrtBindOutput=E.ea)(t,i,s,p),n._OrtClearBoundOutputs=t=>(n._OrtClearBoundOutputs=E.fa)(t),n._OrtReleaseBinding=t=>(n._OrtReleaseBinding=E.ga)(t),n._OrtRunWithBinding=(t,i,s,p,O)=>(n._OrtRunWithBinding=E.ha)(t,i,s,p,O),n._OrtRun=(t,i,s,p,O,S,F,Z)=>(n._OrtRun=E.ia)(t,i,s,p,O,S,F,Z),n._OrtEndProfiling=t=>(n._OrtEndProfiling=E.ja)(t),n._OrtTrainingLoadCheckpoint=(t,i)=>(n._OrtTrainingLoadCheckpoint=E.ka)(t,i),n._OrtTrainingReleaseCheckpoint=t=>(n._OrtTrainingReleaseCheckpoint=E.la)(t),n._OrtTrainingCreateSession=(t,i,s,p,O,S,F,Z)=>(n._OrtTrainingCreateSession=E.ma)(t,i,s,p,O,S,F,Z),n._OrtTrainingLazyResetGrad=t=>(n._OrtTrainingLazyResetGrad=E.na)(t),n._OrtTrainingRunTrainStep=(t,i,s,p,O,S)=>(n._OrtTrainingRunTrainStep=E.oa)(t,i,s,p,O,S),n._OrtTrainingOptimizerStep=(t,i)=>(n._OrtTrainingOptimizerStep=E.pa)(t,i),n._OrtTrainingEvalStep=(t,i,s,p,O,S)=>(n._OrtTrainingEvalStep=E.qa)(t,i,s,p,O,S),n._OrtTrainingGetParametersSize=(t,i,s)=>(n._OrtTrainingGetParametersSize=E.ra)(t,i,s),n._OrtTrainingCopyParametersToBuffer=(t,i,s,p)=>(n._OrtTrainingCopyParametersToBuffer=E.sa)(t,i,s,p),n._OrtTrainingCopyParametersFromBuffer=(t,i,s,p)=>(n._OrtTrainingCopyParametersFromBuffer=E.ta)(t,i,s,p),n._OrtTrainingReleaseSession=t=>(n._OrtTrainingReleaseSession=E.ua)(t);var Ze=n._malloc=t=>(Ze=n._malloc=E.va)(t);n._free=t=>(n._free=E.wa)(t);var He=t=>(He=E.ya)(t),Ke=()=>(Ke=E.za)(),Ge=t=>(Ge=E.Aa)(t),C=t=>(C=E.Ba)(t);function ze(t){t=Object.assign({},t);var i=p=>()=>p()>>>0,s=p=>O=>p(O)>>>0;return t.__errno_location=i(t.__errno_location),t.malloc=s(t.malloc),t.stackSave=i(t.stackSave),t.stackAlloc=s(t.stackAlloc),t}n.stackAlloc=C,n.stackSave=Ke,n.stackRestore=Ge,n.UTF8ToString=be,n.stringToUTF8=(t,i,s)=>We(t,ce,i,s),n.lengthBytesUTF8=De;var Ue;ue=function t(){Ue||Le(),Ue||(ue=t)};function Le(){function t(){if(!Ue&&(Ue=!0,n.calledRun=!0,!ve)){if(ge(Fe),h(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var i=n.postRun.shift();V.unshift(i)}ge(V)}}if(!(0lr)});var pr=nt(()=>{});var mr=nt(()=>{});var gr={};Et(gr,{cpus:()=>tn});var tn,hr=_t(()=>{tn=void 0});var wr=nt((br,Rt)=>{"use strict";var yr=(()=>{var u=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(u=u||__filename),function(c={}){function n(){return V.buffer!=re.buffer&&pe(),re}function h(){return V.buffer!=re.buffer&&pe(),Ee}function f(){return V.buffer!=re.buffer&&pe(),J}function w(){return V.buffer!=re.buffer&&pe(),fe}function g(){return V.buffer!=re.buffer&&pe(),ke}var o=c,T,P;o.ready=new Promise((e,r)=>{T=e,P=r});var I=Object.assign({},o),R="./this.program",D=(e,r)=>{throw r},ee=typeof window=="object",U=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",v=o.ENVIRONMENT_IS_PTHREAD||!1,k="";function W(e){return o.locateFile?o.locateFile(e,k):k+e}var z,ae,E;if(L){var ve=(Tt(),at(St)),Oe=(Mt(),at(At));k=U?Oe.dirname(k)+"/":__dirname+"/",z=(r,a)=>(r=r.startsWith("file://")?new URL(r):Oe.normalize(r),ve.readFileSync(r,a?void 0:"utf8")),E=r=>(r=z(r,!0),r.buffer||(r=new Uint8Array(r)),r),ae=(r,a,l,b=!0)=>{r=r.startsWith("file://")?new URL(r):Oe.normalize(r),ve.readFile(r,b?void 0:"utf8",(y,_)=>{y?l(y):a(b?_.buffer:_)})},!o.thisProgram&&1{throw process.exitCode=r,a},o.inspect=()=>"[Emscripten Module object]";let e;try{e=pr()}catch(r){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),r}global.Worker=e.Worker}else(ee||U)&&(U?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),typeof u<"u"&&u&&(k=u),k.indexOf("blob:")!==0?k=k.substr(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1):k="",L||(z=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},U&&(E=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),ae=(e,r,a)=>{var l=new XMLHttpRequest;l.open("GET",e,!0),l.responseType="arraybuffer",l.onload=()=>{l.status==200||l.status==0&&l.response?r(l.response):a()},l.onerror=a,l.send(null)}));L&&typeof performance>"u"&&(global.performance=mr().performance);var ce=console.log.bind(console),M=console.error.bind(console);L&&(ce=(...e)=>ve.writeSync(1,e.join(" ")+`\n`),M=(...e)=>ve.writeSync(2,e.join(" ")+`\n`));var N=o.print||ce,oe=o.printErr||M;Object.assign(o,I),I=null,o.thisProgram&&(R=o.thisProgram),o.quit&&(D=o.quit);var _e;o.wasmBinary&&(_e=o.wasmBinary);var Fe=o.noExitRuntime||!0;typeof WebAssembly!="object"&&we("no native wasm support detected");var V,A,x,de=!1,ue,re,Ee,J,fe,ke;function pe(){var e=V.buffer;o.HEAP8=re=new Int8Array(e),o.HEAP16=new Int16Array(e),o.HEAP32=J=new Int32Array(e),o.HEAPU8=Ee=new Uint8Array(e),o.HEAPU16=new Uint16Array(e),o.HEAPU32=fe=new Uint32Array(e),o.HEAPF32=new Float32Array(e),o.HEAPF64=ke=new Float64Array(e)}var Se=o.INITIAL_MEMORY||16777216;if(5242880<=Se||we("INITIAL_MEMORY should be larger than STACK_SIZE, was "+Se+"! (STACK_SIZE=5242880)"),v)V=o.wasmMemory;else if(o.wasmMemory)V=o.wasmMemory;else if(V=new WebAssembly.Memory({initial:Se/65536,maximum:65536,shared:!0}),!(V.buffer instanceof SharedArrayBuffer))throw oe("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),L&&oe("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");pe(),Se=V.buffer.byteLength;var Pe,ye=[],ge=[],Te=[],Re=0;function te(){return Fe||0{if(!r.ok)throw"failed to load wasm binary file at \'"+e+"\'";return r.arrayBuffer()}).catch(()=>qe(e));if(ae)return new Promise((r,a)=>{ae(e,l=>r(new Uint8Array(l)),a)})}return Promise.resolve().then(()=>qe(e))}function Je(e,r,a){return Ve(e).then(l=>WebAssembly.instantiate(l,r)).then(l=>l).then(a,l=>{oe("failed to asynchronously prepare wasm: "+l),we(l)})}function Xe(e,r){var a=Ce;return _e||typeof WebAssembly.instantiateStreaming!="function"||$e(a)||a.startsWith("file://")||L||typeof fetch!="function"?Je(a,e,r):fetch(a,{credentials:"same-origin"}).then(l=>WebAssembly.instantiateStreaming(l,e).then(r,function(b){return oe("wasm streaming compile failed: "+b),oe("falling back to ArrayBuffer instantiation"),Je(a,e,r)}))}var xe;function Ie(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}function Ne(e){e.terminate(),e.onmessage=()=>{}}function it(e){(e=C.La[e])||we(),C.lb(e)}function Qe(e){var r=C.fb();if(!r)return 6;C.Oa.push(r),C.La[e.Na]=r,r.Na=e.Na;var a={cmd:"run",start_routine:e.mb,arg:e.eb,pthread_ptr:e.Na};return L&&r.unref(),r.postMessage(a,e.sb),0}var st=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Ze=(e,r,a)=>{r>>>=0;var l=r+a;for(a=r;e[a]&&!(a>=l);)++a;if(16b?l+=String.fromCharCode(b):(b-=65536,l+=String.fromCharCode(55296|b>>10,56320|b&1023))}}else l+=String.fromCharCode(b)}return l},He=(e,r)=>(e>>>=0)?Ze(h(),e,r):"";function Ke(e){if(v)return Y(1,1,e);ue=e,te()||(C.nb(),o.onExit&&o.onExit(e),de=!0),D(e,new Ie(e))}var Ge=e=>{if(ue=e,v)throw Ue(e),"unwind";Ke(e)},C={Ra:[],Oa:[],Za:[],La:{},Va:function(){v?C.hb():C.gb()},gb:function(){ye.unshift(()=>{De(),C.ib(()=>We())})},hb:function(){C.receiveObjectTransfer=C.kb,C.threadInitTLS=C.Ya,C.setExitStatus=C.Xa,Fe=!1},Xa:function(e){ue=e},xb:["$terminateWorker"],nb:function(){for(var e of C.Oa)Ne(e);for(e of C.Ra)Ne(e);C.Ra=[],C.Oa=[],C.La=[]},lb:function(e){var r=e.Na;delete C.La[r],C.Ra.push(e),C.Oa.splice(C.Oa.indexOf(e),1),e.Na=0,yt(r)},kb:function(){},Ya:function(){C.Za.forEach(e=>e())},jb:e=>new Promise(r=>{e.onmessage=y=>{y=y.data;var _=y.cmd;if(y.targetThread&&y.targetThread!=ft()){var X=C.La[y.wb];X?X.postMessage(y,y.transferList):oe(\'Internal error! Worker sent a message "\'+_+\'" to target pthread \'+y.targetThread+", but that thread no longer exists!")}else _==="checkMailbox"?ut():_==="spawnThread"?Qe(y):_==="cleanupThread"?it(y.thread):_==="killThread"?(y=y.thread,_=C.La[y],delete C.La[y],Ne(_),yt(y),C.Oa.splice(C.Oa.indexOf(_),1),_.Na=0):_==="cancelThread"?C.La[y.thread].postMessage({cmd:"cancel"}):_==="loaded"?(e.loaded=!0,r(e)):_==="alert"?alert("Thread "+y.threadId+": "+y.text):y.target==="setimmediate"?e.postMessage(y):_==="callHandler"?o[y.handler](...y.args):_&&oe("worker sent an unknown command "+_)},e.onerror=y=>{throw oe("worker sent an error! "+y.filename+":"+y.lineno+": "+y.message),y},L&&(e.on("message",function(y){e.onmessage({data:y})}),e.on("error",function(y){e.onerror(y)}));var a=[],l=["onExit","onAbort","print","printErr"],b;for(b of l)o.hasOwnProperty(b)&&a.push(b);e.postMessage({cmd:"load",handlers:a,urlOrBlob:o.mainScriptUrlOrBlob||u,wasmMemory:V,wasmModule:x})}),ib:function(e){e()},cb:function(){var e=W("ort-wasm-threaded.worker.js");e=new Worker(e),C.Ra.push(e)},fb:function(){return C.Ra.length==0&&(C.cb(),C.jb(C.Ra[0])),C.Ra.pop()}};o.PThread=C;var ze=e=>{for(;0>2>>>0];e=f()[e+56>>2>>>0],ar(r,r-e),lt(r)};function Ue(e){if(v)return Y(2,0,e);Ge(e)}var Le=[];o.invokeEntryPoint=function(e,r){var a=Le[e];a||(e>=Le.length&&(Le.length=e+1),Le[e]=a=Pe.get(e)),e=a(r),te()?C.Xa(e):bt(e)};function t(e){this.Ua=e-24,this.bb=function(r){w()[this.Ua+4>>2>>>0]=r},this.ab=function(r){w()[this.Ua+8>>2>>>0]=r},this.Va=function(r,a){this.$a(),this.bb(r),this.ab(a)},this.$a=function(){w()[this.Ua+16>>2>>>0]=0}}var i=0,s=0;function p(e,r,a,l){return v?Y(3,1,e,r,a,l):O(e,r,a,l)}function O(e,r,a,l){if(e>>>=0,r>>>=0,a>>>=0,l>>>=0,typeof SharedArrayBuffer>"u")return oe("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var b=[];return v&&b.length===0?p(e,r,a,l):(e={mb:a,Na:e,eb:l,sb:b},v?(e.ub="spawnThread",postMessage(e,b),0):Qe(e))}function S(e,r,a){return v?Y(4,1,e,r,a):0}function F(e,r){if(v)return Y(5,1,e,r)}var Z=e=>{for(var r=0,a=0;a=l?r++:2047>=l?r+=2:55296<=l&&57343>=l?(r+=4,++a):r+=3}return r},le=(e,r,a,l)=>{if(a>>>=0,!(0=_){var X=e.charCodeAt(++y);_=65536+((_&1023)<<10)|X&1023}if(127>=_){if(a>=l)break;r[a++>>>0]=_}else{if(2047>=_){if(a+1>=l)break;r[a++>>>0]=192|_>>6}else{if(65535>=_){if(a+2>=l)break;r[a++>>>0]=224|_>>12}else{if(a+3>=l)break;r[a++>>>0]=240|_>>18,r[a++>>>0]=128|_>>12&63}r[a++>>>0]=128|_>>6&63}r[a++>>>0]=128|_&63}}return r[a>>>0]=0,a-b},ie=(e,r,a)=>le(e,h(),r,a);function se(e,r){if(v)return Y(6,1,e,r)}function et(e,r,a){if(v)return Y(7,1,e,r,a)}function tt(e,r,a){return v?Y(8,1,e,r,a):0}function d(e,r){if(v)return Y(9,1,e,r)}function B(e,r,a){if(v)return Y(10,1,e,r,a)}function G(e,r,a,l){if(v)return Y(11,1,e,r,a,l)}function Ae(e,r,a,l){if(v)return Y(12,1,e,r,a,l)}function rt(e,r,a,l){if(v)return Y(13,1,e,r,a,l)}function Ut(e){if(v)return Y(14,1,e)}function Lt(e,r){if(v)return Y(15,1,e,r)}function Bt(e,r,a){if(v)return Y(16,1,e,r,a)}var Nr=e=>{if(!de)try{if(e(),!te())try{v?bt(ue):Ge(ue)}catch(r){r instanceof Ie||r=="unwind"||D(1,r)}}catch(r){r instanceof Ie||r=="unwind"||D(1,r)}};function pt(e){e>>>=0,typeof Atomics.tb=="function"&&(Atomics.tb(f(),e>>2,e).value.then(ut),e+=128,Atomics.store(f(),e>>2,1))}o.__emscripten_thread_mailbox_await=pt;function ut(){var e=ft();e&&(pt(e),Nr(()=>rr()))}o.checkMailbox=ut;var je=e=>e%4===0&&(e%100!==0||e%400===0),kt=[0,31,60,91,121,152,182,213,244,274,305,335],Wt=[0,31,59,90,120,151,181,212,243,273,304,334];function Nt(e,r,a,l,b,y,_,X){return v?Y(17,1,e,r,a,l,b,y,_,X):-52}function Ht(e,r,a,l,b,y,_){if(v)return Y(18,1,e,r,a,l,b,y,_)}var Gt=e=>{var r=Z(e)+1,a=Kt(r);return a&&ie(e,a,r),a},Hr=e=>{var r=wt();return e=e(),lt(r),e};function Y(e,r){var a=arguments.length-2,l=arguments;return Hr(()=>{for(var b=Ot(8*a),y=b>>3,_=0;_>>0]=X}return tr(e,a,b,r)})}var mt=[],gt={},zt=()=>{if(!ht){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:R||"./this.program"},r;for(r in gt)gt[r]===void 0?delete e[r]:e[r]=gt[r];var a=[];for(r in e)a.push(`${r}=${e[r]}`);ht=a}return ht},ht;function jt(e,r){if(v)return Y(19,1,e,r);e>>>=0,r>>>=0;var a=0;return zt().forEach(function(l,b){var y=r+a;for(b=w()[e+4*b>>2>>>0]=y,y=0;y>0>>>0]=l.charCodeAt(y);n()[b>>0>>>0]=0,a+=l.length+1}),0}function Yt(e,r){if(v)return Y(20,1,e,r);e>>>=0,r>>>=0;var a=zt();w()[e>>2>>>0]=a.length;var l=0;return a.forEach(function(b){l+=b.length+1}),w()[r>>2>>>0]=l,0}function $t(e){return v?Y(21,1,e):52}function qt(e,r,a,l){return v?Y(22,1,e,r,a,l):52}function Vt(e,r,a,l,b){return v?Y(23,1,e,r,a,l,b):70}var Gr=[null,[],[]];function Jt(e,r,a,l){if(v)return Y(24,1,e,r,a,l);r>>>=0,a>>>=0,l>>>=0;for(var b=0,y=0;y>2>>>0],X=w()[r+4>>2>>>0];r+=8;for(var Me=0;Me>>0],me=Gr[e];ne===0||ne===10?((e===1?N:oe)(Ze(me,0)),me.length=0):me.push(ne)}b+=X}return w()[l>>2>>>0]=b,0}var Xt=[31,29,31,30,31,30,31,31,30,31,30,31],Qt=[31,28,31,30,31,30,31,31,30,31,30,31];function zr(e){var r=Array(Z(e)+1);return le(e,r,0,r.length),r}var jr=(e,r)=>{n().set(e,r>>>0)};function Zt(e,r,a,l){function b(m,H,Q){for(m=typeof m=="number"?m.toString():m||"";m.lengthur?-1:0Be-m.getDate())H-=Be-m.getDate()+1,m.setDate(1),11>Q?m.setMonth(Q+1):(m.setMonth(0),m.setFullYear(m.getFullYear()+1));else{m.setDate(m.getDate()+H);break}}return Q=new Date(m.getFullYear()+1,0,4),H=X(new Date(m.getFullYear(),0,4)),Q=X(Q),0>=_(H,m)?0>=_(Q,m)?m.getFullYear()+1:m.getFullYear():m.getFullYear()-1}e>>>=0,r>>>=0,a>>>=0,l>>>=0;var ne=f()[l+40>>2>>>0];l={qb:f()[l>>2>>>0],pb:f()[l+4>>2>>>0],Sa:f()[l+8>>2>>>0],Wa:f()[l+12>>2>>>0],Ta:f()[l+16>>2>>>0],Qa:f()[l+20>>2>>>0],Ma:f()[l+24>>2>>>0],Pa:f()[l+28>>2>>>0],yb:f()[l+32>>2>>>0],ob:f()[l+36>>2>>>0],rb:ne?He(ne):""},a=He(a),ne={"%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 me in ne)a=a.replace(new RegExp(me,"g"),ne[me]);var ir="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),sr="January February March April May June July August September October November December".split(" ");ne={"%a":m=>ir[m.Ma].substring(0,3),"%A":m=>ir[m.Ma],"%b":m=>sr[m.Ta].substring(0,3),"%B":m=>sr[m.Ta],"%C":m=>y((m.Qa+1900)/100|0,2),"%d":m=>y(m.Wa,2),"%e":m=>b(m.Wa,2," "),"%g":m=>Me(m).toString().substring(2),"%G":m=>Me(m),"%H":m=>y(m.Sa,2),"%I":m=>(m=m.Sa,m==0?m=12:12{for(var H=0,Q=0;Q<=m.Ta-1;H+=(je(m.Qa+1900)?Xt:Qt)[Q++]);return y(m.Wa+H,3)},"%m":m=>y(m.Ta+1,2),"%M":m=>y(m.pb,2),"%n":()=>`\n`,"%p":m=>0<=m.Sa&&12>m.Sa?"AM":"PM","%S":m=>y(m.qb,2),"%t":()=>" ","%u":m=>m.Ma||7,"%U":m=>y(Math.floor((m.Pa+7-m.Ma)/7),2),"%V":m=>{var H=Math.floor((m.Pa+7-(m.Ma+6)%7)/7);if(2>=(m.Ma+371-m.Pa-2)%7&&H++,H)H==53&&(Q=(m.Ma+371-m.Pa)%7,Q==4||Q==3&&je(m.Qa)||(H=1));else{H=52;var Q=(m.Ma+7-m.Pa-1)%7;(Q==4||Q==5&&je(m.Qa%400-1))&&H++}return y(H,2)},"%w":m=>m.Ma,"%W":m=>y(Math.floor((m.Pa+7-(m.Ma+6)%7)/7),2),"%y":m=>(m.Qa+1900).toString().substring(2),"%Y":m=>m.Qa+1900,"%z":m=>{m=m.ob;var H=0<=m;return m=Math.abs(m)/60,(H?"+":"-")+("0000"+(m/60*100+m%60)).slice(-4)},"%Z":m=>m.rb,"%%":()=>"%"},a=a.replace(/%%/g,"\\0\\0");for(me in ne)a.includes(me)&&(a=a.replace(new RegExp(me,"g"),ne[me](l)));return a=a.replace(/\\0\\0/g,"%"),me=zr(a),me.length>r?0:(jr(me,e),me.length-1)}C.Va();var Yr=[null,Ke,Ue,p,S,F,se,et,tt,d,B,G,Ae,rt,Ut,Lt,Bt,Nt,Ht,jt,Yt,$t,qt,Vt,Jt],$r={b:function(e,r,a){throw e>>>=0,new t(e).Va(r>>>0,a>>>0),i=e,s++,i},N:function(e){er(e>>>0,!U,1,!ee,131072,!1),C.Ya()},j:function(e){e>>>=0,v?postMessage({cmd:"cleanupThread",thread:e}):it(e)},I:O,h:S,T:F,D:se,F:et,U:tt,R:d,J:B,Q:G,n:Ae,E:rt,B:Ut,S:Lt,C:Bt,q:()=>!0,z:function(e,r){e>>>=0,e==r>>>0?setTimeout(()=>ut()):v?postMessage({targetThread:e,cmd:"checkMailbox"}):(e=C.La[e])&&e.postMessage({cmd:"checkMailbox"})},L:function(){return-1},M:pt,p:function(e){L&&C.La[e>>>0].ref()},t:function(e,r,a){e=r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,a>>>=0,e=new Date(1e3*e),f()[a>>2>>>0]=e.getUTCSeconds(),f()[a+4>>2>>>0]=e.getUTCMinutes(),f()[a+8>>2>>>0]=e.getUTCHours(),f()[a+12>>2>>>0]=e.getUTCDate(),f()[a+16>>2>>>0]=e.getUTCMonth(),f()[a+20>>2>>>0]=e.getUTCFullYear()-1900,f()[a+24>>2>>>0]=e.getUTCDay(),e=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,f()[a+28>>2>>>0]=e},u:function(e,r,a){e=r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,a>>>=0,e=new Date(1e3*e),f()[a>>2>>>0]=e.getSeconds(),f()[a+4>>2>>>0]=e.getMinutes(),f()[a+8>>2>>>0]=e.getHours(),f()[a+12>>2>>>0]=e.getDate(),f()[a+16>>2>>>0]=e.getMonth(),f()[a+20>>2>>>0]=e.getFullYear()-1900,f()[a+24>>2>>>0]=e.getDay(),r=(je(e.getFullYear())?kt:Wt)[e.getMonth()]+e.getDate()-1|0,f()[a+28>>2>>>0]=r,f()[a+36>>2>>>0]=-(60*e.getTimezoneOffset()),r=new Date(e.getFullYear(),6,1).getTimezoneOffset();var l=new Date(e.getFullYear(),0,1).getTimezoneOffset();e=(r!=l&&e.getTimezoneOffset()==Math.min(l,r))|0,f()[a+32>>2>>>0]=e},v:function(e){e>>>=0;var r=new Date(f()[e+20>>2>>>0]+1900,f()[e+16>>2>>>0],f()[e+12>>2>>>0],f()[e+8>>2>>>0],f()[e+4>>2>>>0],f()[e>>2>>>0],0),a=f()[e+32>>2>>>0],l=r.getTimezoneOffset(),b=new Date(r.getFullYear(),6,1).getTimezoneOffset(),y=new Date(r.getFullYear(),0,1).getTimezoneOffset(),_=Math.min(y,b);return 0>a?f()[e+32>>2>>>0]=+(b!=y&&_==l):0>2>>>0]=r.getDay(),a=(je(r.getFullYear())?kt:Wt)[r.getMonth()]+r.getDate()-1|0,f()[e+28>>2>>>0]=a,f()[e>>2>>>0]=r.getSeconds(),f()[e+4>>2>>>0]=r.getMinutes(),f()[e+8>>2>>>0]=r.getHours(),f()[e+12>>2>>>0]=r.getDate(),f()[e+16>>2>>>0]=r.getMonth(),f()[e+20>>2>>>0]=r.getYear(),e=r.getTime()/1e3,nr((xe=e,1<=+Math.abs(xe)?0>>0:~~+Math.ceil((xe-+(~~xe>>>0))/4294967296)>>>0:0)),e>>>0},r:Nt,s:Ht,y:function(e,r,a){function l(ne){return(ne=ne.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?ne[1]:"GMT"}e>>>=0,r>>>=0,a>>>=0;var b=new Date().getFullYear(),y=new Date(b,0,1),_=new Date(b,6,1);b=y.getTimezoneOffset();var X=_.getTimezoneOffset(),Me=Math.max(b,X);w()[e>>2>>>0]=60*Me,f()[r>>2>>>0]=+(b!=X),e=l(y),r=l(_),e=Gt(e),r=Gt(r),X>2>>>0]=e,w()[a+4>>2>>>0]=r):(w()[a>>2>>>0]=r,w()[a+4>>2>>>0]=e)},c:()=>{we("")},k:function(){},i:function(){return Date.now()},o:()=>{throw Re+=1,"unwind"},A:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:function(){return L?(hr(),at(gr)).cpus().length:navigator.hardwareConcurrency},K:function(e,r,a,l){for(C.vb=r>>>0,mt.length=a,r=l>>>0>>3,l=0;l>>0];return Yr[e].apply(null,mt)},x:function(e){e>>>=0;var r=h().length;if(e<=r||4294901760=a;a*=2){var l=r*(1+.2/a);l=Math.min(l,e+100663296);var b=Math;l=Math.max(e,l);e:{b=b.min.call(b,4294901760,l+(65536-l%65536)%65536)-V.buffer.byteLength+65535>>>16;try{V.grow(b),pe();var y=1;break e}catch{}y=void 0}if(y)return!0}return!1},O:jt,P:Yt,H:Ge,g:$t,m:qt,w:Vt,l:Jt,a:V||o.wasmMemory,G:Zt,d:function(e,r,a,l){return Zt(e>>>0,r>>>0,a>>>0,l>>>0)}};(function(){function e(a,l){return a=a.exports,A=a=qr(a),C.Za.push(A.ya),Pe=A.za,ge.unshift(A.V),x=l,We(),a}var r={a:$r};if(De(),o.instantiateWasm)try{return o.instantiateWasm(r,e)}catch(a){oe("Module.instantiateWasm callback failed with error: "+a),P(a)}return Xe(r,function(a){e(a.instance,a.module)}).catch(P),{}})(),o._OrtInit=(e,r)=>(o._OrtInit=A.W)(e,r),o._OrtGetLastError=(e,r)=>(o._OrtGetLastError=A.X)(e,r),o._OrtCreateSessionOptions=(e,r,a,l,b,y,_,X,Me,ne)=>(o._OrtCreateSessionOptions=A.Y)(e,r,a,l,b,y,_,X,Me,ne),o._OrtAppendExecutionProvider=(e,r)=>(o._OrtAppendExecutionProvider=A.Z)(e,r),o._OrtAddFreeDimensionOverride=(e,r,a)=>(o._OrtAddFreeDimensionOverride=A._)(e,r,a),o._OrtAddSessionConfigEntry=(e,r,a)=>(o._OrtAddSessionConfigEntry=A.$)(e,r,a),o._OrtReleaseSessionOptions=e=>(o._OrtReleaseSessionOptions=A.aa)(e),o._OrtCreateSession=(e,r,a)=>(o._OrtCreateSession=A.ba)(e,r,a),o._OrtReleaseSession=e=>(o._OrtReleaseSession=A.ca)(e),o._OrtGetInputOutputCount=(e,r,a)=>(o._OrtGetInputOutputCount=A.da)(e,r,a),o._OrtGetInputName=(e,r)=>(o._OrtGetInputName=A.ea)(e,r),o._OrtGetOutputName=(e,r)=>(o._OrtGetOutputName=A.fa)(e,r),o._OrtFree=e=>(o._OrtFree=A.ga)(e),o._OrtCreateTensor=(e,r,a,l,b,y)=>(o._OrtCreateTensor=A.ha)(e,r,a,l,b,y),o._OrtGetTensorData=(e,r,a,l,b)=>(o._OrtGetTensorData=A.ia)(e,r,a,l,b),o._OrtReleaseTensor=e=>(o._OrtReleaseTensor=A.ja)(e),o._OrtCreateRunOptions=(e,r,a,l)=>(o._OrtCreateRunOptions=A.ka)(e,r,a,l),o._OrtAddRunConfigEntry=(e,r,a)=>(o._OrtAddRunConfigEntry=A.la)(e,r,a),o._OrtReleaseRunOptions=e=>(o._OrtReleaseRunOptions=A.ma)(e),o._OrtCreateBinding=e=>(o._OrtCreateBinding=A.na)(e),o._OrtBindInput=(e,r,a)=>(o._OrtBindInput=A.oa)(e,r,a),o._OrtBindOutput=(e,r,a,l)=>(o._OrtBindOutput=A.pa)(e,r,a,l),o._OrtClearBoundOutputs=e=>(o._OrtClearBoundOutputs=A.qa)(e),o._OrtReleaseBinding=e=>(o._OrtReleaseBinding=A.ra)(e),o._OrtRunWithBinding=(e,r,a,l,b)=>(o._OrtRunWithBinding=A.sa)(e,r,a,l,b),o._OrtRun=(e,r,a,l,b,y,_,X)=>(o._OrtRun=A.ta)(e,r,a,l,b,y,_,X),o._OrtEndProfiling=e=>(o._OrtEndProfiling=A.ua)(e);var ft=o._pthread_self=()=>(ft=o._pthread_self=A.va)(),Kt=o._malloc=e=>(Kt=o._malloc=A.wa)(e);o._free=e=>(o._free=A.xa)(e),o.__emscripten_tls_init=()=>(o.__emscripten_tls_init=A.ya)();var er=o.__emscripten_thread_init=(e,r,a,l,b,y)=>(er=o.__emscripten_thread_init=A.Aa)(e,r,a,l,b,y);o.__emscripten_thread_crashed=()=>(o.__emscripten_thread_crashed=A.Ba)();var tr=(e,r,a,l)=>(tr=A.Ca)(e,r,a,l),yt=e=>(yt=A.Da)(e),bt=o.__emscripten_thread_exit=e=>(bt=o.__emscripten_thread_exit=A.Ea)(e),rr=o.__emscripten_check_mailbox=()=>(rr=o.__emscripten_check_mailbox=A.Fa)(),nr=e=>(nr=A.Ga)(e),ar=(e,r)=>(ar=A.Ha)(e,r),wt=()=>(wt=A.Ia)(),lt=e=>(lt=A.Ja)(e),Ot=e=>(Ot=A.Ka)(e);function qr(e){e=Object.assign({},e);var r=l=>()=>l()>>>0,a=l=>b=>l(b)>>>0;return e.__errno_location=r(e.__errno_location),e.pthread_self=r(e.pthread_self),e.malloc=a(e.malloc),e.stackSave=r(e.stackSave),e.stackAlloc=a(e.stackAlloc),e}o.keepRuntimeAlive=te,o.wasmMemory=V,o.stackAlloc=Ot,o.stackSave=wt,o.stackRestore=lt,o.UTF8ToString=He,o.stringToUTF8=ie,o.lengthBytesUTF8=Z,o.ExitStatus=Ie,o.PThread=C;var ct;be=function e(){ct||or(),ct||(be=e)};function or(){function e(){if(!ct&&(ct=!0,o.calledRun=!0,!de)&&(v||ze(ge),T(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),!v)){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;){var r=o.postRun.shift();Te.unshift(r)}ze(Te)}}if(!(0yr)});var Or=nt((wn,rn)=>{rn.exports=\'"use strict";var Module={},ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads"),parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",e=>onmessage({data:e}));var fs=require("fs");Object.assign(global,{self:global,require,Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:e=>(0,eval)(fs.readFileSync(e,"utf8")+"//# sourceURL="+e),postMessage:e=>parentPort.postMessage(e),performance:global.performance||{now:Date.now}})}var initializedJS=!1;function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,e+`\\n`);return}console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var a=Module.wasmModule;Module.wasmModule=null;var r=new WebAssembly.Instance(a,e);return t(r)},self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let a=[];self.onmessage=r=>a.push(r),self.startWorker=r=>{Module=r,postMessage({cmd:"loaded"});for(let s of a)handleMessage(s);self.onmessage=handleMessage},Module.wasmModule=e.data.wasmModule;for(const r of e.data.handlers)Module[r]=(...s)=>{postMessage({cmd:"callHandler",handler:r,args:s})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,typeof e.data.urlOrBlob=="string")importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(Module)}else if(e.data.cmd==="run"){Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.__emscripten_thread_mailbox_await(e.data.pthread_ptr),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(a){if(a!="unwind")throw a}}else e.data.cmd==="cancel"?Module._pthread_self()&&Module.__emscripten_thread_exit(-1):e.data.target==="setimmediate"||(e.data.cmd==="checkMailbox"?initializedJS&&Module.checkMailbox():e.data.cmd&&(err("worker.js received unknown command "+e.data.cmd),err(e.data)))}catch(a){throw Module.__emscripten_thread_crashed&&Module.__emscripten_thread_crashed(),a}}self.onmessage=handleMessage;\\n\'});var _r;_r=dr();var nn=wr(),Dt,xt=!1,dt=!1,vr=!1,an=u=>{if(u===1)return!1;if(typeof SharedArrayBuffer>"u")return typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+u+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),!1;typeof process<"u"&&process.versions&&process.versions.node&&console.warn("env.wasm.numThreads is set to "+u+", however, currently onnxruntime-web does not support multi-threads in Node.js. Please consider using onnxruntime-node for performance critical scenarios.");try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},on=()=>{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}},sn=(u,c)=>u?"ort-training-wasm-simd.wasm":c?"ort-wasm-threaded.wasm":"ort-wasm.wasm",Er=async u=>{if(xt)return Promise.resolve();if(dt)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(vr)throw new Error("previous call to \'initializeWebAssembly()\' failed.");dt=!0;let c=u.initTimeout,n=u.numThreads,h=u.simd,f=an(n),w=h&&on(),g=u.wasmPaths,o=typeof g=="string"?g:void 0,T=sn(w,f),P=typeof g=="object"?g[T]:void 0,I=!1,R=[];if(c>0&&R.push(new Promise(D=>{setTimeout(()=>{I=!0,D()},c)})),R.push(new Promise((D,ee)=>{let U=f?nn:_r,L={locateFile:(v,k)=>f&&v.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([Or()],{type:"text/javascript"})):v.endsWith(".wasm")?P||(o??k)+T:k+v};if(f)if(L.numThreads=n,typeof Blob>"u")L.mainScriptUrlOrBlob=(void 0)(__dirname,"ort-wasm-threaded.js");else{let v=`var ortWasmThreaded=${U.toString()};`;L.mainScriptUrlOrBlob=new Blob([v],{type:"text/javascript"})}U(L).then(v=>{dt=!1,xt=!0,Dt=v,D()},v=>{dt=!1,vr=!0,ee(v)})})),await Promise.race(R),I)throw new Error(`WebAssembly backend initializing failed due to timeout: ${c}ms`)},K=()=>{if(xt&&Dt)return Dt;throw new Error("WebAssembly is not initialized yet.")};var $=(u,c)=>{let n=K(),h=n.lengthBytesUTF8(u)+1,f=n._malloc(h);return n.stringToUTF8(u,f,h),c.push(f),f},ot=(u,c,n,h)=>{if(typeof u=="object"&&u!==null){if(n.has(u))throw new Error("Circular reference in options");n.add(u)}Object.entries(u).forEach(([f,w])=>{let g=c?c+f:f;if(typeof w=="object")ot(w,g+".",n,h);else if(typeof w=="string"||typeof w=="number")h(g,w.toString());else if(typeof w=="boolean")h(g,w?"1":"0");else throw new Error(`Can\'t handle extra config type: ${typeof w}`)})},q=u=>{let c=K(),n=c.stackSave();try{let h=c.stackAlloc(8);c._OrtGetLastError(h,h+4);let f=c.HEAP32[h/4],w=c.HEAPU32[h/4+1],g=w?c.UTF8ToString(w):"";throw new Error(`${u} ERROR_CODE: ${f}, ERROR_MESSAGE: ${g}`)}finally{c.stackRestore(n)}};var Sr=u=>{let c=K(),n=0,h=[],f=u||{};try{if(u?.logSeverityLevel===void 0)f.logSeverityLevel=2;else if(typeof u.logSeverityLevel!="number"||!Number.isInteger(u.logSeverityLevel)||u.logSeverityLevel<0||u.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${u.logSeverityLevel}`);if(u?.logVerbosityLevel===void 0)f.logVerbosityLevel=0;else if(typeof u.logVerbosityLevel!="number"||!Number.isInteger(u.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${u.logVerbosityLevel}`);u?.terminate===void 0&&(f.terminate=!1);let w=0;return u?.tag!==void 0&&(w=$(u.tag,h)),n=c._OrtCreateRunOptions(f.logSeverityLevel,f.logVerbosityLevel,!!f.terminate,w),n===0&&q("Can\'t create run options."),u?.extra!==void 0&&ot(u.extra,"",new WeakSet,(g,o)=>{let T=$(g,h),P=$(o,h);c._OrtAddRunConfigEntry(n,T,P)!==0&&q(`Can\'t set a run config entry: ${g} - ${o}.`)}),[n,h]}catch(w){throw n!==0&&c._OrtReleaseRunOptions(n),h.forEach(g=>c._free(g)),w}};var un=u=>{switch(u){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${u}`)}},fn=u=>{switch(u){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${u}`)}},ln=u=>{u.extra||(u.extra={}),u.extra.session||(u.extra.session={});let c=u.extra.session;c.use_ort_model_bytes_directly||(c.use_ort_model_bytes_directly="1"),u.executionProviders&&u.executionProviders.some(n=>(typeof n=="string"?n:n.name)==="webgpu")&&(u.enableMemPattern=!1)},cn=(u,c,n)=>{for(let h of c){let f=typeof h=="string"?h:h.name;switch(f){case"webnn":if(f="WEBNN",typeof h!="string"){let g=h;if(g?.deviceType){let o=$("deviceType",n),T=$(g.deviceType,n);K()._OrtAddSessionConfigEntry(u,o,T)!==0&&q(`Can\'t set a session config entry: \'deviceType\' - ${g.deviceType}.`)}if(g?.numThreads){let o=g.numThreads;(typeof o!="number"||!Number.isInteger(o)||o<0)&&(o=0);let T=$("numThreads",n),P=$(o.toString(),n);K()._OrtAddSessionConfigEntry(u,T,P)!==0&&q(`Can\'t set a session config entry: \'numThreads\' - ${g.numThreads}.`)}if(g?.powerPreference){let o=$("powerPreference",n),T=$(g.powerPreference,n);K()._OrtAddSessionConfigEntry(u,o,T)!==0&&q(`Can\'t set a session config entry: \'powerPreference\' - ${g.powerPreference}.`)}}break;case"webgpu":if(f="JS",typeof h!="string"){let g=h;if(g?.preferredLayout){if(g.preferredLayout!=="NCHW"&&g.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either \'NCHW\' or \'NHWC\': ${g.preferredLayout}`);let o=$("preferredLayout",n),T=$(g.preferredLayout,n);K()._OrtAddSessionConfigEntry(u,o,T)!==0&&q(`Can\'t set a session config entry: \'preferredLayout\' - ${g.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${f}`)}let w=$(f,n);K()._OrtAppendExecutionProvider(u,w)!==0&&q(`Can\'t append execution provider: ${f}.`)}},Tr=u=>{let c=K(),n=0,h=[],f=u||{};ln(f);try{let w=un(f.graphOptimizationLevel??"all"),g=fn(f.executionMode??"sequential"),o=typeof f.logId=="string"?$(f.logId,h):0,T=f.logSeverityLevel??2;if(!Number.isInteger(T)||T<0||T>4)throw new Error(`log serverity level is not valid: ${T}`);let P=f.logVerbosityLevel??0;if(!Number.isInteger(P)||P<0||P>4)throw new Error(`log verbosity level is not valid: ${P}`);let I=typeof f.optimizedModelFilePath=="string"?$(f.optimizedModelFilePath,h):0;if(n=c._OrtCreateSessionOptions(w,!!f.enableCpuMemArena,!!f.enableMemPattern,g,!!f.enableProfiling,0,o,T,P,I),n===0&&q("Can\'t create session options."),f.executionProviders&&cn(n,f.executionProviders,h),f.enableGraphCapture!==void 0){if(typeof f.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${f.enableGraphCapture}`);let R=$("enableGraphCapture",h),D=$(f.enableGraphCapture.toString(),h);c._OrtAddSessionConfigEntry(n,R,D)!==0&&q(`Can\'t set a session config entry: \'enableGraphCapture\' - ${f.enableGraphCapture}.`)}if(f.freeDimensionOverrides)for(let[R,D]of Object.entries(f.freeDimensionOverrides)){if(typeof R!="string")throw new Error(`free dimension override name must be a string: ${R}`);if(typeof D!="number"||!Number.isInteger(D)||D<0)throw new Error(`free dimension override value must be a non-negative integer: ${D}`);let ee=$(R,h);c._OrtAddFreeDimensionOverride(n,ee,D)!==0&&q(`Can\'t set a free dimension override: ${R} - ${D}.`)}return f.extra!==void 0&&ot(f.extra,"",new WeakSet,(R,D)=>{let ee=$(R,h),U=$(D,h);c._OrtAddSessionConfigEntry(n,ee,U)!==0&&q(`Can\'t set a session config entry: ${R} - ${D}.`)}),[n,h]}catch(w){throw n!==0&&c._OrtReleaseSessionOptions(n),h.forEach(g=>c._free(g)),w}};var Ft=u=>{switch(u){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: ${u}`)}},Ar=u=>{switch(u){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${u}`)}},Pt=u=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][u],Mr=u=>{switch(u){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${u}`)}},Cr=u=>{switch(u){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${u}`)}},Rr=u=>u==="float32"||u==="float16"||u==="int32"||u==="int64"||u==="uint32"||u==="uint8"||u==="bool",Dr=u=>{switch(u){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;default:throw new Error(`unsupported data location: ${u}`)}};var xr=async u=>{if(typeof u=="string")if(typeof process<"u"&&process.versions&&process.versions.node)try{return new Uint8Array(await(void 0)(u))}catch(c){if(c.code==="ERR_FS_FILE_TOO_LARGE"){let n=(void 0)(u),h=[];for await(let f of n)h.push(f);return new Uint8Array(Buffer.concat(h))}throw c}else{let c=await fetch(u);if(!c.ok)throw new Error(`failed to load external data file: ${u}`);let n=c.headers.get("Content-Length"),h=n?parseInt(n,10):0;if(h<1073741824)return new Uint8Array(await c.arrayBuffer());{if(!c.body)throw new Error(`failed to load external data file: ${u}, no response body.`);let f=c.body.getReader(),w;try{w=new ArrayBuffer(h)}catch(o){if(o instanceof RangeError){let T=Math.ceil(h/65536);w=new WebAssembly.Memory({initial:T,maximum:T}).buffer}else throw o}let g=0;for(;;){let{done:o,value:T}=await f.read();if(o)break;let P=T.byteLength;new Uint8Array(w,g,P).set(T),g+=P}return new Uint8Array(w,0,h)}}else return u instanceof Blob?new Uint8Array(await u.arrayBuffer()):u instanceof Uint8Array?u:new Uint8Array(u)};var dn=(u,c)=>{K()._OrtInit(u,c)!==0&&q("Can\'t initialize onnxruntime.")},Pr=async u=>{dn(u.wasm.numThreads,Cr(u.logLevel))},Ir=async(u,c)=>{},Ye=new Map,pn=u=>{let c=K(),n=c.stackSave();try{let h=c.stackAlloc(8);return c._OrtGetInputOutputCount(u,h,h+4)!==0&&q("Can\'t get session input/output count."),[c.HEAP32[h/4],c.HEAP32[h/4+1]]}finally{c.stackRestore(n)}},It=u=>{let c=K(),n=c._malloc(u.byteLength);if(n===0)throw new Error(`Can\'t create a session. failed to allocate a buffer of size ${u.byteLength}.`);return c.HEAPU8.set(u,n),[n,u.byteLength]},Ur=async(u,c)=>{let n,h,f=K();Array.isArray(u)?[n,h]=u:u.buffer===f.HEAPU8.buffer?[n,h]=[u.byteOffset,u.byteLength]:[n,h]=It(u);let w=0,g=0,o=0,T=[],P=[],I=[];try{if([g,T]=Tr(c),c?.externalData&&f.mountExternalData){let W=[];for(let z of c.externalData){let ae=typeof z=="string"?z:z.path;W.push(xr(typeof z=="string"?z:z.data).then(E=>{f.mountExternalData(ae,E)}))}await Promise.all(W)}w=await f._OrtCreateSession(n,h,g),w===0&&q("Can\'t create a session.");let[R,D]=pn(w),ee=!!c?.enableGraphCapture,U=[],L=[],v=[];for(let W=0;Wf._OrtFree(D)),I.forEach(D=>f._OrtFree(D)),o!==0&&f._OrtReleaseBinding(o),w!==0&&f._OrtReleaseSession(w),R}finally{f._free(n),g!==0&&f._OrtReleaseSessionOptions(g),T.forEach(R=>f._free(R)),f.unmountExternalData?.()}},Lr=u=>{let c=K(),n=Ye.get(u);if(!n)throw new Error(`cannot release session. invalid session id: ${u}`);let[h,f,w,g,o]=n;g&&(o&&c._OrtClearBoundOutputs(g.handle),c._OrtReleaseBinding(g.handle)),c.jsepOnReleaseSession?.(u),f.forEach(T=>c._OrtFree(T)),w.forEach(T=>c._OrtFree(T)),c._OrtReleaseSession(h),Ye.delete(u)},Fr=(u,c,n,h,f,w=!1)=>{if(!u){c.push(0);return}let g=K(),o=u[0],T=u[1],P=u[3],I,R;if(o==="string"&&P==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");if(w&&P!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${f} when enableGraphCapture is true.`);if(P==="gpu-buffer"){let U=u[2].gpuBuffer,L=Pt(Ft(o));R=T.reduce((k,W)=>k*W,1)*L;let v=g.jsepRegisterBuffer;if(!v)throw new Error(\'Tensor location "gpu-buffer" is not supported without using WebGPU.\');I=v(h,f,U,R)}else{let U=u[2];if(Array.isArray(U)){R=4*U.length,I=g._malloc(R),n.push(I);let L=I/4;for(let v=0;vg.HEAP32[U++]=v);let L=g._OrtCreateTensor(Ft(o),I,R,ee,T.length,Dr(P));L===0&&q(`Can\'t create tensor for input/output. session=${h}, index=${f}.`),c.push(L)}finally{g.stackRestore(D)}},Br=async(u,c,n,h,f,w)=>{let g=K(),o=Ye.get(u);if(!o)throw new Error(`cannot run inference. invalid session id: ${u}`);let T=o[0],P=o[1],I=o[2],R=o[3],D=o[4],ee=o[5],U=c.length,L=h.length,v=0,k=[],W=[],z=[],ae=[],E=g.stackSave(),ve=g.stackAlloc(U*4),Oe=g.stackAlloc(U*4),ce=g.stackAlloc(L*4),M=g.stackAlloc(L*4);try{[v,k]=Sr(w);for(let x=0;xte*j,1);J=Ar(Se);let Re=R?.outputPreferredLocations[h[x]];if(J==="string"){if(Re==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");let te=[],j=fe/4;for(let he=0;he0){let te=g.jsepGetBuffer;if(!te)throw new Error(\'preferredLocation "gpu-buffer" is not supported without using WebGPU.\');let j=te(fe),he=Pt(Se);if(he===void 0||!Rr(J))throw new Error(`Unsupported data type: ${J}`);Ee=!0,A.push([J,ge,{gpuBuffer:j,download:g.jsepCreateDownloader(j,Te*he,J),dispose:()=>{g._OrtReleaseTensor(de)}},"gpu-buffer"])}else{let te=Mr(J),j=new te(Te);new Uint8Array(j.buffer,j.byteOffset,j.byteLength).set(g.HEAPU8.subarray(fe,fe+j.byteLength)),A.push([J,ge,j,"cpu"])}}finally{g.stackRestore(ue),J==="string"&&fe&&g._free(fe),Ee||g._OrtReleaseTensor(de)}}return R&&!D&&(g._OrtClearBoundOutputs(R.handle),Ye.set(u,[T,P,I,R,D,!1])),A}finally{g.stackRestore(E),W.forEach(N=>g._OrtReleaseTensor(N)),z.forEach(N=>g._OrtReleaseTensor(N)),ae.forEach(N=>g._free(N)),v!==0&&g._OrtReleaseRunOptions(v),k.forEach(N=>g._free(N))}},kr=u=>{let c=K(),n=Ye.get(u);if(!n)throw new Error("invalid session id");let h=n[0],f=c._OrtEndProfiling(h);f===0&&q("Can\'t get an profile file name."),c._OrtFree(f)},Wr=u=>{let c=[];for(let n of u){let h=n[2];!Array.isArray(h)&&"buffer"in h&&c.push(h.buffer)}return c};self.onmessage=u=>{let{type:c,in:n}=u.data;try{switch(c){case"init-wasm":Er(n.wasm).then(()=>{Pr(n).then(()=>{postMessage({type:c})},h=>{postMessage({type:c,err:h})})},h=>{postMessage({type:c,err:h})});break;case"init-ep":{let{epName:h,env:f}=n;Ir(f,h).then(()=>{postMessage({type:c})},w=>{postMessage({type:c,err:w})});break}case"copy-from":{let{buffer:h}=n,f=It(h);postMessage({type:c,out:f});break}case"create":{let{model:h,options:f}=n;Ur(h,f).then(w=>{postMessage({type:c,out:w})},w=>{postMessage({type:c,err:w})});break}case"release":Lr(n),postMessage({type:c});break;case"run":{let{sessionId:h,inputIndices:f,inputs:w,outputIndices:g,options:o}=n;Br(h,f,w,g,new Array(g.length).fill(null),o).then(T=>{T.some(P=>P[3]!=="cpu")?postMessage({type:c,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:c,out:T},Wr([...w,...T]))},T=>{postMessage({type:c,err:T})});break}case"end-profiling":kr(n),postMessage({type:c});break;default:}}catch(h){postMessage({type:c,err:h})}};})();\n'});var Ze,Re,Ut,rr,nr,Ur,Fr,dt,pt,bo,tr,ga,ya,wa,ba,Oa,va,_a,Br=W(()=>{"use strict";Je();er();Qe();Ze=()=>!!V.wasm.proxy&&typeof document<"u",Ut=!1,rr=!1,nr=!1,Fr=new Map,dt=(n,r)=>{let e=Fr.get(n);e?e.push(r):Fr.set(n,[r])},pt=()=>{if(Ut||!rr||nr||!Re)throw new Error("worker not ready")},bo=n=>{switch(n.data.type){case"init-wasm":Ut=!1,n.data.err?(nr=!0,Ur[1](n.data.err)):(rr=!0,Ur[0]());break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=Fr.get(n.data.type);n.data.err?r.shift()[1](n.data.err):r.shift()[0](n.data.out);break}default:}},tr=typeof document<"u"?document?.currentScript?.src:void 0,ga=async()=>{if(!rr){if(Ut)throw new Error("multiple calls to 'initWasm()' detected.");if(nr)throw new Error("previous call to 'initWasm()' failed.");if(Ut=!0,Ze())return V.wasm.wasmPaths===void 0&&tr&&tr.indexOf("blob:")!==0&&(V.wasm.wasmPaths=tr.substr(0,+tr.lastIndexOf("/")+1)),new Promise((n,r)=>{Re?.terminate();let e=URL.createObjectURL(new Blob([ha()],{type:"text/javascript"}));Re=new Worker(e,{name:"ort-wasm-proxy-worker"}),Re.onerror=a=>r(a),Re.onmessage=bo,URL.revokeObjectURL(e),Ur=[n,r];let u={type:"init-wasm",in:V};Re.postMessage(u)});try{await ia(V.wasm),await ua(V),rr=!0}catch(n){throw nr=!0,n}finally{Ut=!1}}},ya=async n=>{if(Ze())return pt(),new Promise((r,e)=>{dt("init-ep",[r,e]);let u={type:"init-ep",in:{epName:n,env:V}};Re.postMessage(u)});await fa(V,n)},wa=async n=>Ze()?(pt(),new Promise((r,e)=>{dt("copy-from",[r,e]);let u={type:"copy-from",in:{buffer:n}};Re.postMessage(u,[n.buffer])})):Dt(n),ba=async(n,r)=>{if(Ze()){if(r?.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return pt(),new Promise((e,u)=>{dt("create",[e,u]);let a={type:"create",in:{model:n,options:{...r}}},c=[];n instanceof Uint8Array&&c.push(n.buffer),Re.postMessage(a,c)})}else return la(n,r)},Oa=async n=>{if(Ze())return pt(),new Promise((r,e)=>{dt("release",[r,e]);let u={type:"release",in:n};Re.postMessage(u)});ca(n)},va=async(n,r,e,u,a,c)=>{if(Ze()){if(e.some(f=>f[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(a.some(f=>f))throw new Error("pre-allocated output tensor is not supported for proxy.");return pt(),new Promise((f,o)=>{dt("run",[f,o]);let m=e,h={type:"run",in:{sessionId:n,inputIndices:r,inputs:m,outputIndices:u,options:c}};Re.postMessage(h,ma(m))})}else return da(n,r,e,u,a,c)},_a=async n=>{if(Ze())return pt(),new Promise((r,e)=>{dt("end-profiling",[r,e]);let u={type:"end-profiling",in:n};Re.postMessage(u)});pa(n)}});var Ke,or,ar,kr=W(()=>{"use strict";Je();Br();Zt();Dr();Ke=(n,r)=>{switch(n.location){case"cpu":return[n.type,n.dims,n.data,"cpu"];case"gpu-buffer":return[n.type,n.dims,{gpuBuffer:n.gpuBuffer},"gpu-buffer"];default:throw new Error(`invalid data location: ${n.location} for ${r()}`)}},or=n=>{switch(n[3]){case"cpu":return new le(n[0],n[2],n[1]);case"gpu-buffer":{let r=n[0];if(!Qt(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:e,download:u,dispose:a}=n[2];return le.fromGpuBuffer(e,{dataType:r,dims:n[1],download:u,dispose:a})}default:throw new Error(`invalid data location: ${n[3]}`)}},ar=class{async fetchModelAndCopyToWasmMemory(r){return wa(await It(r))}async loadModel(r,e){qe();let u;typeof r=="string"?typeof process<"u"&&process.versions&&process.versions.node?u=await It(r):u=await this.fetchModelAndCopyToWasmMemory(r):u=r,[this.sessionId,this.inputNames,this.outputNames]=await ba(u,e),Xe()}async dispose(){return Oa(this.sessionId)}async run(r,e,u){qe();let a=[],c=[];Object.entries(r).forEach(w=>{let M=w[0],C=w[1],S=this.inputNames.indexOf(M);if(S===-1)throw new Error(`invalid input '${M}'`);a.push(C),c.push(S)});let f=[],o=[];Object.entries(e).forEach(w=>{let M=w[0],C=w[1],S=this.outputNames.indexOf(M);if(S===-1)throw new Error(`invalid output '${M}'`);f.push(C),o.push(S)});let m=a.map((w,M)=>Ke(w,()=>`input "${this.inputNames[c[M]]}"`)),h=f.map((w,M)=>w?Ke(w,()=>`output "${this.outputNames[o[M]]}"`):null),g=await va(this.sessionId,c,m,o,h,u),b={};for(let w=0;w{"use strict";Je();Br();kr();Oo=()=>{if((typeof V.wasm.initTimeout!="number"||V.wasm.initTimeout<0)&&(V.wasm.initTimeout=0),typeof V.wasm.simd!="boolean"&&(V.wasm.simd=!0),typeof V.wasm.proxy!="boolean"&&(V.wasm.proxy=!1),typeof V.wasm.trace!="boolean"&&(V.wasm.trace=!1),typeof V.wasm.numThreads!="number"||!Number.isInteger(V.wasm.numThreads)||V.wasm.numThreads<=0){(typeof self<"u"&&!self.crossOriginIsolated||typeof process<"u"&&process.versions&&process.versions.node)&&(V.wasm.numThreads=1);let n=typeof navigator>"u"?(void 0)().length:navigator.hardwareConcurrency;V.wasm.numThreads=Math.min(4,Math.ceil((n||1)/2))}},ir=class{async init(r){Oo(),await ga(),await ya(r)}async createInferenceSessionHandler(r,e){let u=new ar;return await u.loadModel(r,e),Promise.resolve(u)}}});var Ce,be,Sa,vo,Ea,Lr,Aa,sr,Ma,Ra,Ca,Pa,xa,Nr,Ia,Da,Ua,Fa=W(()=>{"use strict";Pr();xr();Zt();er();Qe();Ct();Ce="Built without training API's enabled. Use the onnxruntime-web/training import for training functionality, and make sure that all the correct artifacts are built & moved to the correct folder if using a custom build. Check https://onnxruntime.ai/docs/build/web.html for more information.",be=(n,r,e=!0)=>{e&&n!==0?q(r):!e&&n===0&&q(r)},Sa=n=>{let r=G(),[e,u]=n,a=0;try{if(r._OrtTrainingLoadCheckpoint)a=r._OrtTrainingLoadCheckpoint(e,u);else throw new Error(Ce);return be(a,"Error occurred when trying to create a CheckpointState",!1),a}catch(c){throw r._OrtTrainingReleaseCheckpoint&&a!==0&&r._OrtTrainingReleaseCheckpoint(a),c}finally{r._OrtFree(n[0])}},vo=(n,r)=>{let e=G(),u=e.stackSave();try{let a=e.stackAlloc(8);if(e._OrtTrainingGetModelInputOutputCount){let c=e._OrtTrainingGetModelInputOutputCount(n,a,a+4,r);return be(c,"Can't get session input/output count."),[e.HEAP32[a/4],e.HEAP32[a/4+1]]}else throw new Error(Ce)}finally{e.stackRestore(u)}},Ea=(n,r,e,u)=>{let a=[],c=G();for(let f=0;f{let e=[],u=[],[a,c]=vo(n,r);return e=Ea(n,a,!0,r),u=Ea(n,c,!1,r),[e,u]},Aa=(n,r,e,u,a)=>{let c=G(),f=0,o=0,m=[];try{if([o,m]=Xt(a),c._OrtTrainingCreateSession)f=c._OrtTrainingCreateSession(o,n,r[0],r[1],e[0],e[1],u[0],u[1]);else throw new Error(Ce);return be(f,"Error occurred when trying to create a TrainingSession",!1),f}catch(h){throw c._OrtTrainingReleaseSession&&f!==0&&c._OrtTrainingReleaseSession(f),h}finally{c._free(r[0]),c._free(e[0]),c._free(u[0]),o!==0&&c._OrtReleaseSessionOptions(o),m.forEach(h=>c._free(h))}},sr=(n,r,e,u,a,c)=>{let f=r.length;for(let g=0;g{let a=G(),c=[];for(let f=0;fk*z,1);if(g=Jt(C),g==="string"){let k=[],z=b/4;for(let P=0;P{let r=G();if(r._OrtTrainingLazyResetGrad){let e=r._OrtTrainingLazyResetGrad(n);be(e,"Can't call lazyResetGrad.")}else throw new Error(Ce)},Ca=async(n,r,e,u,a,c)=>{let f=G(),o=r.length,m=u.length,h=0,g=[],b=[],w=[],M=[],C=f.stackSave();try{[h,g]=ft(c);let S=sr(n,r,e,b,M,0),E=sr(n,u,a,w,M,o);if(f._OrtTrainingRunTrainStep){let F=f._OrtTrainingRunTrainStep(n,S,o,E,m,h);be(F,"failed to call OrtTrainingRunTrainStep in the WebAssembly layer")}else throw new Error(Ce);return Ma(E,m,w,a)}finally{f.stackRestore(C),b.forEach(S=>f._OrtReleaseTensor(S)),w.forEach(S=>f._OrtReleaseTensor(S)),M.forEach(S=>f._free(S)),h!==0&&f._OrtReleaseRunOptions(h),g.forEach(S=>f._free(S))}},Pa=async(n,r)=>{let e=G(),u=0,a=[];try{if([u,a]=ft(r),e._OrtTrainingOptimizerStep){let c=e._OrtTrainingOptimizerStep(n,u);be(c,"Failed to call OrtTrainingOptimizerStep in the WebAssembly layer")}else throw new Error(Ce)}finally{u!==0&&e._OrtReleaseRunOptions(u),a.forEach(c=>e._free(c))}},xa=async(n,r,e,u,a,c)=>{let f=G(),o=r.length,m=u.length,h=0,g=[],b=[],w=[],M=[],C=f.stackSave();try{[h,g]=ft(c);let S=sr(n,r,e,b,M,0),E=sr(n,u,a,w,M,o);if(f._OrtTrainingEvalStep){let F=f._OrtTrainingEvalStep(n,S,o,E,m,h);be(F,"failed to call OrtTrainingEvalStep in the WebAssembly layer")}else throw new Error(Ce);return Ma(E,m,w,a)}finally{f.stackRestore(C),b.forEach(S=>f._OrtReleaseTensor(S)),w.forEach(S=>f._OrtReleaseTensor(S)),M.forEach(S=>f._free(S)),h!==0&&f._OrtReleaseRunOptions(h),g.forEach(S=>f._free(S))}},Nr=(n,r)=>{let e=G(),u=e.stackSave();try{let a=e.stackAlloc(4);if(e._OrtTrainingGetParametersSize){let c=e._OrtTrainingGetParametersSize(n,a,r);return be(c,"Can't get parameters size"),e.HEAP32[a/4]}else throw new Error(Ce)}finally{e.stackRestore(u)}},Ia=async(n,r)=>{let e=G(),u=e.stackSave(),a="float32",c="cpu",f=Nr(n,r),o=0,m=4*f,h=e._malloc(m),g=[f],b=e.stackAlloc(4),w=b/4;e.HEAP32[w]=f;try{if(o=e._OrtCreateTensor(lt(a),h,m,b,g.length,xt(c)),be(o,`Can't create tensor for getContiguousParameters. session=${n}.`,!1),e._OrtTrainingCopyParametersToBuffer){let E=e._OrtTrainingCopyParametersToBuffer(n,o,f,r);be(E,"Can't get contiguous parameters.")}else throw new Error(Ce);let M=Pt(a),C=new M(f),S=[];if(new Uint8Array(C.buffer,C.byteOffset,C.byteLength).set(e.HEAPU8.subarray(h,h+m)),S.push([a,g,C,c]),S.length!==1)throw new Error(`something unexpected happened in the getContiguousParameters function. Expected output length of + one, got ${S.length}`);return S[0]}finally{o!==0&&e._OrtReleaseTensor(o),e._free(h),e._free(b),e.stackRestore(u)}},Da=async(n,r,e)=>{let u=G(),a=u.stackSave(),c="float32",f="cpu",o=r.length,m=o/4,h=u._malloc(o);u.HEAPU8.set(r,h);let g=u.stackAlloc(4);u.HEAP32[g/4]=m;let b=1,w=0;try{if(w=u._OrtCreateTensor(lt(c),h,o,g,b,xt(f)),be(w,`Can't create tensor for input/output. session=${n}`,!1),u._OrtTrainingCopyParametersFromBuffer){let M=u._OrtTrainingCopyParametersFromBuffer(n,w,m,e);be(M,"Can't copy buffer to parameters.")}else throw new Error(Ce)}finally{w!==0&&u._OrtReleaseTensor(w),u.stackRestore(a),u._free(h),u._free(g)}},Ua=(n,r)=>{let e=G();e._OrtTrainingReleaseSession&&e._OrtTrainingReleaseSession(r),e._OrtTrainingReleaseCheckpoint&&e._OrtTrainingReleaseCheckpoint(n)}});var ur,Ba=W(()=>{"use strict";kr();er();Fa();ur=class{constructor(){this.evalInputNames=[];this.evalOutputNames=[]}async uriOrBufferToHeap(r){let e;if(typeof r=="string"){let a=await(await fetch(r)).arrayBuffer();e=new Uint8Array(a)}else e=r;return Dt(e)}async createTrainingSession(r,e,u,a,c){let f=await this.uriOrBufferToHeap(r),o=await this.uriOrBufferToHeap(e),m=[0,0],h=[0,0];u!==""&&(m=await this.uriOrBufferToHeap(u)),a!==""&&(h=await this.uriOrBufferToHeap(a)),this.checkpointId=Sa(f),this.sessionId=Aa(this.checkpointId,o,m,h,c),[this.inputNames,this.outputNames]=Lr(this.sessionId,!1),u!==""&&([this.evalInputNames,this.evalOutputNames]=Lr(this.sessionId,!0))}convertMapIntoValuesArrayAndIndicesArray(r,e,u){let a=[],c=[];Object.entries(r).forEach(o=>{let m=o[0],h=o[1],g=e.indexOf(m);if(g===-1)throw new Error(`invalid input '${m}`);a.push(h),c.push(g)});let f=a.map(u);return[a,c,f]}convertTensorMetadataToReturnType(r,e,u){let a={};for(let c=0;cKe(g,()=>`input "${this.inputNames[a[b]]}"`)),[f,o,m]=this.convertMapIntoValuesArrayAndIndicesArray(e,this.outputNames,(g,b)=>g?Ke(g,()=>`output "${this.outputNames[o[b]]}"`):null),h=await Ca(this.sessionId,a,c,o,m,u);return this.convertTensorMetadataToReturnType(h,f,o)}async runOptimizerStep(r){await Pa(this.sessionId,r)}async runEvalStep(r,e,u){let[,a,c]=this.convertMapIntoValuesArrayAndIndicesArray(r,this.evalInputNames,(g,b)=>Ke(g,()=>`input "${this.evalInputNames[a[b]]}"`)),[f,o,m]=this.convertMapIntoValuesArrayAndIndicesArray(e,this.evalOutputNames,(g,b)=>g?Ke(g,()=>`output "${this.evalOutputNames[o[b]]}"`):null),h=await xa(this.sessionId,a,c,o,m,u);return this.convertTensorMetadataToReturnType(h,f,o)}async getParametersSize(r){return Nr(this.sessionId,r)}async loadParametersBuffer(r,e){await Da(this.sessionId,r,e)}async getContiguousParameters(r){let e=await Ia(this.sessionId,r);return or(e)}async dispose(){return Ua(this.checkpointId,this.sessionId)}}});var ka={};St(ka,{wasmBackend:()=>_o});var Hr,_o,La=W(()=>{"use strict";Ta();Ba();Hr=class extends ir{async createTrainingSessionHandler(r,e,u,a,c){let f=new ur;return await f.createTrainingSession(r,e,u,a,c),Promise.resolve(f)}},_o=new Hr});Je();Je();Je();var $n="1.18.0";var bs=vr;{let n=(La(),ut(ka)).wasmBackend;At("cpu",n,10),At("wasm",n,10)}Object.defineProperty(V.versions,"web",{value:$n,enumerable:!0});export{Za as InferenceSession,Fn as TRACE,qe as TRACE_FUNC_BEGIN,Xe as TRACE_FUNC_END,le as Tensor,eo as TrainingSession,bs as default,V as env,At as registerBackend}; +//# sourceMappingURL=ort.training.wasm.min.js.map