UNPKG

dicomweb-proxy

Version:

A proxy to translate between dicomweb and dimse

2 lines 141 kB
/*! For license information please see ort.wasm.min.js.LICENSE.txt */ "use strict";var ort=(()=>{var e,t,r,n,a,o,i,s,u,l,f,c,d,p,h,g,m,y,w,b,v,O,_,E,A,T,M,S,R,C,P,U=Object.defineProperty,D=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,F=Object.prototype.hasOwnProperty,I=(e,t)=>()=>(e&&(t=e(e=0)),t),k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),B=(e,t)=>{for(var r in t)U(e,r,{get:t[r],enumerable:!0})},N=e=>((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of x(t))!F.call(e,a)&&a!==r&&U(e,a,{get:()=>t[a],enumerable:!(n=D(t,a))||n.enumerable});return e})(U({},"__esModule",{value:!0}),e),L=I((()=>{e=new Map,t=[],r=(r,n,a)=>{if(!n||"function"!=typeof n.init||"function"!=typeof n.createInferenceSessionHandler)throw new TypeError("not a valid backend");{let o=e.get(r);if(void 0===o)e.set(r,{backend:n,priority:a});else{if(o.priority>a)return;if(o.priority===a&&o.backend!==n)throw new Error(`cannot register backend "${r}" using priority ${a}`)}if(a>=0){let n=t.indexOf(r);-1!==n&&t.splice(n,1);for(let n=0;n<t.length;n++)if(e.get(t[n]).priority<=a)return void t.splice(n,0,r);t.push(r)}}},n=async r=>{let n=0===r.length?t:r,a=[];for(let t of n){let r=e.get(t);if(r){if(r.initialized)return r.backend;if(r.aborted)continue;let e=!!r.initPromise;try{return e||(r.initPromise=r.backend.init(t)),await r.initPromise,r.initialized=!0,r.backend}catch(n){e||a.push({name:t,err:n}),r.aborted=!0}finally{delete r.initPromise}}}throw new Error(`no available backend found. ERR: ${a.map((e=>`[${e.name}] ${e.err}`)).join(", ")}`)}})),H=I((()=>{L()})),$=I((()=>{a="1.17.1"})),W=I((()=>{$(),o="warning",i={wasm:{},webgl:{},webgpu:{},versions:{common:a},set logLevel(e){if(void 0!==e){if("string"!=typeof e||-1===["verbose","info","warning","error","fatal"].indexOf(e))throw new Error(`Unsupported logging level: ${e}`);o=e}},get logLevel(){return o}},Object.defineProperty(i,"logLevel",{enumerable:!0})})),j=I((()=>{W(),s=i})),Y=I((()=>{u=(e,t)=>{let r=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);r.width=e.dims[3],r.height=e.dims[2];let n=r.getContext("2d");if(null!=n){let a,o;void 0!==t?.tensorLayout&&"NHWC"===t.tensorLayout?(a=e.dims[2],o=e.dims[3]):(a=e.dims[3],o=e.dims[2]);let i,s,u=void 0!==t?.format?t.format:"RGB",l=t?.norm;void 0===l||void 0===l.mean?i=[255,255,255,255]:"number"==typeof l.mean?i=[l.mean,l.mean,l.mean,l.mean]:(i=[l.mean[0],l.mean[1],l.mean[2],0],void 0!==l.mean[3]&&(i[3]=l.mean[3])),void 0===l||void 0===l.bias?s=[0,0,0,0]:"number"==typeof l.bias?s=[l.bias,l.bias,l.bias,l.bias]:(s=[l.bias[0],l.bias[1],l.bias[2],0],void 0!==l.bias[3]&&(s[3]=l.bias[3]));let f=o*a,c=0,d=f,p=2*f,h=-1;"RGBA"===u?(c=0,d=f,p=2*f,h=3*f):"RGB"===u?(c=0,d=f,p=2*f):"RBG"===u&&(c=0,p=f,d=2*f);for(let t=0;t<o;t++)for(let r=0;r<a;r++){let a=(e.data[c++]-s[0])*i[0],o=(e.data[d++]-s[1])*i[1],u=(e.data[p++]-s[2])*i[2],l=-1===h?255:(e.data[h++]-s[3])*i[3];n.fillStyle="rgba("+a+","+o+","+u+","+l+")",n.fillRect(r,t,1,1)}if("toDataURL"in r)return r.toDataURL();throw new Error("toDataURL is not supported")}throw new Error("Can not access image data")},l=(e,t)=>{let r,n=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d");if(null==n)throw new Error("Can not access image data");{let a,o,i;void 0!==t?.tensorLayout&&"NHWC"===t.tensorLayout?(a=e.dims[2],o=e.dims[1],i=e.dims[3]):(a=e.dims[3],o=e.dims[2],i=e.dims[1]);let s,u,l=void 0!==t&&void 0!==t.format?t.format:"RGB",f=t?.norm;void 0===f||void 0===f.mean?s=[255,255,255,255]:"number"==typeof f.mean?s=[f.mean,f.mean,f.mean,f.mean]:(s=[f.mean[0],f.mean[1],f.mean[2],255],void 0!==f.mean[3]&&(s[3]=f.mean[3])),void 0===f||void 0===f.bias?u=[0,0,0,0]:"number"==typeof f.bias?u=[f.bias,f.bias,f.bias,f.bias]:(u=[f.bias[0],f.bias[1],f.bias[2],0],void 0!==f.bias[3]&&(u[3]=f.bias[3]));let c=o*a;if(void 0!==t&&(void 0!==t.format&&4===i&&"RGBA"!==t.format||3===i&&"RGB"!==t.format&&"BGR"!==t.format))throw new Error("Tensor format doesn't match input tensor dims");let d=4,p=0,h=1,g=2,m=3,y=0,w=c,b=2*c,v=-1;"RGBA"===l?(y=0,w=c,b=2*c,v=3*c):"RGB"===l?(y=0,w=c,b=2*c):"RBG"===l&&(y=0,b=c,w=2*c),r=n.createImageData(a,o);for(let t=0;t<o*a;p+=d,h+=d,g+=d,m+=d,t++)r.data[p]=(e.data[y++]-u[0])*s[0],r.data[h]=(e.data[w++]-u[1])*s[1],r.data[g]=(e.data[b++]-u[2])*s[2],r.data[m]=-1===v?255:(e.data[v++]-u[3])*s[3]}return r}})),G=I((()=>{q(),f=(e,t)=>{if(void 0===e)throw new Error("Image buffer must be defined");if(void 0===t.height||void 0===t.width)throw new Error("Image height and width must be defined");if("NHWC"===t.tensorLayout)throw new Error("NHWC Tensor layout is not supported yet");let r,n,{height:a,width:o}=t,i=t.norm??{mean:255,bias:0};r="number"==typeof i.mean?[i.mean,i.mean,i.mean,i.mean]:[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],n="number"==typeof i.bias?[i.bias,i.bias,i.bias,i.bias]:[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];let s=void 0!==t.format?t.format:"RGBA",u=void 0!==t.tensorFormat&&void 0!==t.tensorFormat?t.tensorFormat:"RGB",l=a*o,f="RGBA"===u?new Float32Array(4*l):new Float32Array(3*l),c=4,d=0,p=1,h=2,g=3,m=0,y=l,w=2*l,b=-1;"RGB"===s&&(c=3,d=0,p=1,h=2,g=-1),"RGBA"===u?b=3*l:"RBG"===u?(m=0,w=l,y=2*l):"BGR"===u&&(w=0,y=l,m=2*l);for(let t=0;t<l;t++,d+=c,h+=c,p+=c,g+=c)f[m++]=(e[d]+n[0])/r[0],f[y++]=(e[p]+n[1])/r[1],f[w++]=(e[h]+n[2])/r[2],-1!==b&&-1!==g&&(f[b++]=(e[g]+n[3])/r[3]);return new O("float32",f,"RGBA"===u?[1,4,a,o]:[1,3,a,o])},c=async(e,t)=>{let r,n=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,a=typeof ImageData<"u"&&e instanceof ImageData,o=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,i="string"==typeof e,s=t??{},u=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},l=e=>e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas?e.getContext("2d"):null;if(n){let n=u();n.width=e.width,n.height=e.height;let a=l(n);if(null==a)throw new Error("Can not access image data");{let n=e.height,o=e.width;if(void 0!==t&&void 0!==t.resizedHeight&&void 0!==t.resizedWidth&&(n=t.resizedHeight,o=t.resizedWidth),void 0!==t){if(s=t,void 0!==t.tensorFormat)throw new Error("Image input config format must be RGBA for HTMLImageElement");s.tensorFormat="RGBA",s.height=n,s.width=o}else s.tensorFormat="RGBA",s.height=n,s.width=o;a.drawImage(e,0,0),r=a.getImageData(0,0,o,n).data}}else{if(!a){if(o){if(void 0===t)throw new Error("Please provide image config with format for Imagebitmap");let n=u();n.width=e.width,n.height=e.height;let a=l(n);if(null!=a){let t=e.height,n=e.width;return a.drawImage(e,0,0,n,t),r=a.getImageData(0,0,n,t).data,s.height=t,s.width=n,f(r,s)}throw new Error("Can not access image data")}if(i)return new Promise(((t,r)=>{let n=u(),a=l(n);if(!e||!a)return r();let o=new Image;o.crossOrigin="Anonymous",o.src=e,o.onload=()=>{n.width=o.width,n.height=o.height,a.drawImage(o,0,0,n.width,n.height);let e=a.getImageData(0,0,n.width,n.height);s.height=n.height,s.width=n.width,t(f(e.data,s))}}));throw new Error("Input data provided is not supported - aborted tensor creation")}{let n,a;if(void 0!==t&&void 0!==t.resizedWidth&&void 0!==t.resizedHeight?(n=t.resizedHeight,a=t.resizedWidth):(n=e.height,a=e.width),void 0!==t&&(s=t),s.format="RGBA",s.height=n,s.width=a,void 0!==t){let t=u();t.width=a,t.height=n;let o=l(t);if(null==o)throw new Error("Can not access image data");o.putImageData(e,0,0),r=o.getImageData(0,0,a,n).data}else r=e.data}}if(void 0!==r)return f(r,s);throw new Error("Input data provided is not supported - aborted tensor creation")},d=(e,t)=>{let{width:r,height:n,download:a,dispose:o}=t;return new O({location:"texture",type:"float32",texture:e,dims:[1,n,r,4],download:a,dispose:o})},p=(e,t)=>{let{dataType:r,dims:n,download:a,dispose:o}=t;return new O({location:"gpu-buffer",type:r??"float32",gpuBuffer:e,dims:n,download:a,dispose:o})},h=(e,t,r)=>new O({location:"cpu-pinned",type:e,data:t,dims:r??[t.length]})})),z=I((()=>{g=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["float16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),m=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),y=!1,w=()=>{if(!y){y=!0;let e=typeof BigInt64Array<"u"&&"function"==typeof BigInt64Array.from,t=typeof BigUint64Array<"u"&&"function"==typeof BigUint64Array.from;e&&(g.set("int64",BigInt64Array),m.set(BigInt64Array,"int64")),t&&(g.set("uint64",BigUint64Array),m.set(BigUint64Array,"uint64"))}}})),V=I((()=>{q(),b=e=>{let t=1;for(let r=0;r<e.length;r++){let n=e[r];if("number"!=typeof n||!Number.isSafeInteger(n))throw new TypeError(`dims[${r}] must be an integer, got: ${n}`);if(n<0)throw new RangeError(`dims[${r}] must be a non-negative integer, got: ${n}`);t*=n}return t},v=(e,t)=>{switch(e.location){case"cpu":return new O(e.type,e.data,t);case"cpu-pinned":return new O({location:"cpu-pinned",data:e.data,type:e.type,dims:t});case"texture":return new O({location:"texture",texture:e.texture,type:e.type,dims:t});case"gpu-buffer":return new O({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:t});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}}})),q=I((()=>{Y(),G(),z(),V(),O=class{constructor(e,t,r){let n,a;if(w(),"object"==typeof e&&"location"in e)switch(this.dataLocation=e.location,n=e.type,a=e.dims,e.location){case"cpu-pinned":{let t=g.get(n);if(!t)throw new TypeError(`unsupported type "${n}" to create tensor from pinned buffer`);if(!(e.data instanceof t))throw new TypeError(`buffer should be of type ${t.name}`);this.cpuData=e.data;break}case"texture":if("float32"!==n)throw new TypeError(`unsupported type "${n}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break;case"gpu-buffer":if("float32"!==n&&"float16"!==n&&"int32"!==n&&"int64"!==n&&"uint32"!==n&&"bool"!==n)throw new TypeError(`unsupported type "${n}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break;default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let o,i;if("string"==typeof e)if(n=e,i=r,"string"===e){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");o=t}else{let r=g.get(e);if(void 0===r)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t)){if("float16"===e)throw new TypeError("Creating a float16 tensor from number array is not supported. Please use Uint16Array as data.");o="uint64"===e||"int64"===e?r.from(t,BigInt):r.from(t)}else{if(!(t instanceof r))throw new TypeError(`A ${n} tensor's data must be type of ${r}`);o=t}}else if(i=t,Array.isArray(e)){if(0===e.length)throw new TypeError("Tensor type cannot be inferred from an empty array.");let t=typeof e[0];if("string"===t)n="string",o=e;else{if("boolean"!==t)throw new TypeError(`Invalid element type of data array: ${t}.`);n="bool",o=Uint8Array.from(e)}}else{let t=m.get(e.constructor);if(void 0===t)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);n=t,o=e}if(void 0===i)i=[o.length];else if(!Array.isArray(i))throw new TypeError("A tensor's dims must be a number array");a=i,this.cpuData=o,this.dataLocation="cpu"}let o=b(a);if(this.cpuData&&o!==this.cpuData.length)throw new Error(`Tensor's size(${o}) does not match data length(${this.cpuData.length}).`);this.type=n,this.dims=a,this.size=o}static async fromImage(e,t){return c(e,t)}static fromTexture(e,t){return d(e,t)}static fromGpuBuffer(e,t){return p(e,t)}static fromPinnedBuffer(e,t,r){return h(e,t,r)}toDataURL(e){return u(this,e)}toImageData(e){return l(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}async getData(e){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 t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,e&&this.disposer&&(this.disposer(),this.disposer=void 0),t}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("none"===this.dataLocation)throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return v(this,e)}}})),J=I((()=>{q(),_=O})),X=I((()=>{W(),E=(e,t)=>{i.wasm.trace&&console.timeStamp(`${e}::ORT::${t}`)},A=(e,t)=>{let r=(new Error).stack?.split(/\r\n|\r|\n/g)||[],n=!1;for(let a=0;a<r.length;a++){if(n&&!r[a].includes("TRACE_FUNC")){let n=`FUNC_${e}::${r[a].trim().split(" ")[1]}`;return t&&(n+=`::${t}`),void E("CPU",n)}r[a].includes("TRACE_FUNC")&&(n=!0)}},T=e=>{i.wasm.trace&&A("BEGIN",e)},M=e=>{i.wasm.trace&&A("END",e)}})),Q=I((()=>{L(),J(),X(),S=class e{constructor(e){this.handler=e}async run(e,t,r){T();let n={},a={};if("object"!=typeof e||null===e||e instanceof _||Array.isArray(e))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let o=!0;if("object"==typeof t){if(null===t)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof _)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(0===t.length)throw new TypeError("'fetches' cannot be an empty array.");o=!1;for(let e of t){if("string"!=typeof e)throw new TypeError("'fetches' must be a string array or an object.");if(-1===this.outputNames.indexOf(e))throw new RangeError(`'fetches' contains invalid output name: ${e}.`);n[e]=null}if("object"==typeof r&&null!==r)a=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else{let e=!1,i=Object.getOwnPropertyNames(t);for(let r of this.outputNames)if(-1!==i.indexOf(r)){let a=t[r];(null===a||a instanceof _)&&(e=!0,o=!1,n[r]=a)}if(e){if("object"==typeof r&&null!==r)a=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else a=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let t of this.inputNames)if(typeof e[t]>"u")throw new Error(`input '${t}' is missing in 'feeds'.`);if(o)for(let e of this.outputNames)n[e]=null;let i=await this.handler.run(e,n,a),s={};for(let e in i)if(Object.hasOwnProperty.call(i,e)){let t=i[e];s[e]=t instanceof _?t:new _(t.type,t.data,t.dims)}return M(),s}async release(){return this.handler.dispose()}static async create(t,r,a,o){T();let i,s={};if("string"==typeof t){if(i=t,"object"==typeof r&&null!==r)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else if(t instanceof Uint8Array){if(i=t,"object"==typeof r&&null!==r)s=r;else if(typeof r<"u")throw new TypeError("'options' must be an object.")}else{if(!(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer))throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");{let e=t,n=0,u=t.byteLength;if("object"==typeof r&&null!==r)s=r;else if("number"==typeof r){if(n=r,!Number.isSafeInteger(n))throw new RangeError("'byteOffset' must be an integer.");if(n<0||n>=e.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(u=t.byteLength-n,"number"==typeof a){if(u=a,!Number.isSafeInteger(u))throw new RangeError("'byteLength' must be an integer.");if(u<=0||n+u>e.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${e.byteLength-n}].`);if("object"==typeof o&&null!==o)s=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof a<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof r<"u")throw new TypeError("'options' must be an object.");i=new Uint8Array(e,n,u)}}let u=(s.executionProviders||[]).map((e=>"string"==typeof e?e:e.name)),l=await(await n(u)).createInferenceSessionHandler(i,s);return M(),new e(l)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}})),Z=I((()=>{Q(),R=S})),K=I((()=>{})),ee=I((()=>{L(),J(),C=class e{constructor(e,t,r){this.handler=e,this.hasOptimizerModel=t,this.hasEvalModel=r}get trainingInputNames(){return this.handler.inputNames}get trainingOutputNames(){return this.handler.outputNames}get evalInputNames(){if(this.hasEvalModel)return this.handler.evalInputNames;throw new Error("This training session has no evalModel loaded.")}get evalOutputNames(){if(this.hasEvalModel)return this.handler.evalOutputNames;throw new Error("This training session has no evalModel loaded.")}static async create(t,r){let a=t.evalModel||"",o=t.optimizerModel||"",i=r||{},s=(i.executionProviders||[]).map((e=>"string"==typeof e?e:e.name)),u=await n(s);if(u.createTrainingSessionHandler){let r=await u.createTrainingSessionHandler(t.checkpointState,t.trainModel,a,o,i);return new e(r,!!t.optimizerModel,!!t.evalModel)}throw new Error("Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.")}typeNarrowingForRunStep(e,t,r,n,a){let o={},i={};if("object"!=typeof r||null===r||r instanceof _||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let s=!0;if("object"==typeof n){if(null===n)throw new TypeError("Unexpected argument[1]: cannot be null.");if(n instanceof _)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(n)){if(0===n.length)throw new TypeError("'fetches' cannot be an empty array.");s=!1;for(let e of n){if("string"!=typeof e)throw new TypeError("'fetches' must be a string array or an object.");if(-1===t.indexOf(e))throw new RangeError(`'fetches' contains invalid output name: ${e}.`);o[e]=null}if("object"==typeof a&&null!==a)i=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else{let e=!1,r=Object.getOwnPropertyNames(n);for(let a of t)if(-1!==r.indexOf(a)){let t=n[a];(null===t||t instanceof _)&&(e=!0,s=!1,o[a]=t)}if(e){if("object"==typeof a&&null!==a)i=a;else if(typeof a<"u")throw new TypeError("'options' must be an object.")}else i=n}}else if(typeof n<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let t of e)if(typeof r[t]>"u")throw new Error(`input '${t}' is missing in 'feeds'.`);if(s)for(let e of t)o[e]=null;return[o,i]}convertHandlerReturnTypeToMapOfTensors(e){let t={};for(let r in e)if(Object.hasOwnProperty.call(e,r)){let n=e[r];t[r]=n instanceof _?n:new _(n.type,n.data,n.dims)}return t}async lazyResetGrad(){await this.handler.lazyResetGrad()}async runTrainStep(e,t,r){let[n,a]=this.typeNarrowingForRunStep(this.trainingInputNames,this.trainingOutputNames,e,t,r),o=await this.handler.runTrainStep(e,n,a);return this.convertHandlerReturnTypeToMapOfTensors(o)}async runOptimizerStep(e){if(!this.hasOptimizerModel)throw new Error("This TrainingSession has no OptimizerModel loaded.");await this.handler.runOptimizerStep(e||{})}async runEvalStep(e,t,r){if(this.hasEvalModel){let[n,a]=this.typeNarrowingForRunStep(this.evalInputNames,this.evalOutputNames,e,t,r),o=await this.handler.runEvalStep(e,n,a);return this.convertHandlerReturnTypeToMapOfTensors(o)}throw new Error("This TrainingSession has no EvalModel loaded.")}async getParametersSize(e=!0){return this.handler.getParametersSize(e)}async loadParametersBuffer(e,t=!0){let r=await this.getParametersSize(t);if(e.length!==4*r)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(e,t)}async getContiguousParameters(e=!0){return this.handler.getContiguousParameters(e)}async release(){return this.handler.dispose()}}})),te=I((()=>{ee(),P=C})),re={};B(re,{InferenceSession:()=>R,TRACE:()=>E,TRACE_FUNC_BEGIN:()=>T,TRACE_FUNC_END:()=>M,Tensor:()=>_,TrainingSession:()=>P,env:()=>s,registerBackend:()=>r});var ne=I((()=>{H(),j(),Z(),J(),X(),K(),te()})),ae={};B(ae,{createReadStream:()=>se,readFile:()=>oe,readFileSync:()=>ie});var oe,ie,se,ue=I((()=>{oe=void 0,ie=void 0,se=void 0})),le={};B(le,{join:()=>fe});var fe,ce=I((()=>{fe=void 0})),de=k(((e,t)=>{var r,n=(r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(r=r||__filename),function(e={}){var t,n,a=e;a.ready=new Promise(((e,r)=>{t=e,n=r}));var o,i,s,u=Object.assign({},a),l="./this.program",f="object"==typeof window,c="function"==typeof importScripts,d="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,p="";if(d){var h=(ue(),N(ae)),g=(ce(),N(le));p=c?g.dirname(p)+"/":__dirname+"/",o=(e,t)=>(e=I(e)?new URL(e):g.normalize(e),h.readFileSync(e,t?void 0:"utf8")),s=e=>((e=o(e,!0)).buffer||(e=new Uint8Array(e)),e),i=(e,t,r,n=!0)=>{e=I(e)?new URL(e):g.normalize(e),h.readFile(e,n?void 0:"utf8",((e,a)=>{e?r(e):t(n?a.buffer:a)}))},!a.thisProgram&&1<process.argv.length&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),a.inspect=()=>"[Emscripten Module object]"}else(f||c)&&(c?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),r&&(p=r),p=0!==p.indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},c&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var m=console.log.bind(console),y=console.error.bind(console);Object.assign(a,u),u=null,"object"!=typeof WebAssembly&&D("no native wasm support detected");var w,b,v,O,_,E,A=!1;function T(){var e=w.buffer;a.HEAP8=b=new Int8Array(e),a.HEAP16=new Int16Array(e),a.HEAPU8=v=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAP32=O=new Int32Array(e),a.HEAPU32=_=new Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=E=new Float64Array(e)}var M=[],S=[],R=[],C=0,P=null,U=null;function D(e){throw y(e="Aborted("+e+")"),A=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),n(e),e}var x,F=e=>e.startsWith("data:application/octet-stream;base64,"),I=e=>e.startsWith("file://");if(!F(x="ort-wasm.wasm")){var k=x;x=a.locateFile?a.locateFile(k,p):p+k}function B(e){if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function L(e,t,r){return function(e){if(f||c){if("function"==typeof fetch&&!I(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>B(e)));if(i)return new Promise(((t,r)=>{i(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>B(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),D(e)}))}var H,$={919888:(e,t,r,n)=>{if(typeof a>"u"||!a.za)return 1;if((e=z(e>>>0)).startsWith("./")&&(e=e.substring(2)),!(e=a.za.get(e)))return 2;if((t>>>=0)+(r>>>=0)>e.byteLength)return 3;try{return v.set(e.subarray(t,t+r),n>>>0>>>0),0}catch{return 4}}};function W(e){this.xa=e-24,this.Ha=function(e){_[this.xa+4>>>2>>>0]=e},this.Ga=function(e){_[this.xa+8>>>2>>>0]=e},this.Aa=function(e,t){this.Fa(),this.Ha(e),this.Ga(t)},this.Fa=function(){_[this.xa+16>>>2>>>0]=0}}var j,Y=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,G=(e,t,r)=>{var n=(t>>>=0)+r;for(r=t;e[r]&&!(r>=n);)++r;if(16<r-t&&e.buffer&&Y)return Y.decode(e.subarray(t,r));for(n="";t<r;){var a=e[t++];if(128&a){var o=63&e[t++];if(192==(224&a))n+=String.fromCharCode((31&a)<<6|o);else{var i=63&e[t++];65536>(a=224==(240&a)?(15&a)<<12|o<<6|i:(7&a)<<18|o<<12|i<<6|63&e[t++])?n+=String.fromCharCode(a):(a-=65536,n+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else n+=String.fromCharCode(a)}return n},z=(e,t)=>(e>>>=0)?G(v,e,t):"",V=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);127>=n?t++:2047>=n?t+=2:55296<=n&&57343>=n?(t+=4,++r):t+=3}return t},q=(e,t,r,n)=>{if(!(0<n))return 0;var a=r>>>=0;n=r+n-1;for(var o=0;o<e.length;++o){var i=e.charCodeAt(o);if(55296<=i&&57343>=i&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++o)),127>=i){if(r>=n)break;t[r++>>>0]=i}else{if(2047>=i){if(r+1>=n)break;t[r++>>>0]=192|i>>6}else{if(65535>=i){if(r+2>=n)break;t[r++>>>0]=224|i>>12}else{if(r+3>=n)break;t[r++>>>0]=240|i>>18,t[r++>>>0]=128|i>>12&63}t[r++>>>0]=128|i>>6&63}t[r++>>>0]=128|63&i}}return t[r>>>0]=0,r-a},J=e=>e%4==0&&(e%100!=0||e%400==0),X=[0,31,60,91,121,152,182,213,244,274,305,335],Q=[0,31,59,90,120,151,181,212,243,273,304,334],Z=e=>{var t=V(e)+1,r=pe(t);return r&&q(e,v,r,t),r},K=[],ee={},te=()=>{if(!j){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:l||"./this.program"};for(e in ee)void 0===ee[e]?delete t[e]:t[e]=ee[e];var r=[];for(e in t)r.push(`${e}=${t[e]}`);j=r}return j},re=[null,[],[]],ne=[31,29,31,30,31,30,31,31,30,31,30,31],oe=[31,28,31,30,31,30,31,31,30,31,30,31];function ie(e,t,r,n){function a(e,t,r){for(e="number"==typeof e?e.toString():e||"";e.length<t;)e=r[0]+e;return e}function o(e,t){return a(e,t,"0")}function i(e,t){function r(e){return 0>e?-1:0<e?1:0}var n;return 0===(n=r(e.getFullYear()-t.getFullYear()))&&0===(n=r(e.getMonth()-t.getMonth()))&&(n=r(e.getDate()-t.getDate())),n}function s(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function u(e){var t=e.ta;for(e=new Date(new Date(e.ua+1900,0,1).getTime());0<t;){var r=e.getMonth(),n=(J(e.getFullYear())?ne:oe)[r];if(!(t>n-e.getDate())){e.setDate(e.getDate()+t);break}t-=n-e.getDate()+1,e.setDate(1),11>r?e.setMonth(r+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return r=new Date(e.getFullYear()+1,0,4),t=s(new Date(e.getFullYear(),0,4)),r=s(r),0>=i(t,e)?0>=i(r,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}e>>>=0,t>>>=0,r>>>=0;var l=_[40+(n>>>=0)>>>2>>>0];for(var f in n={Da:O[n>>>2>>>0],Ca:O[n+4>>>2>>>0],va:O[n+8>>>2>>>0],ya:O[n+12>>>2>>>0],wa:O[n+16>>>2>>>0],ua:O[n+20>>>2>>>0],oa:O[n+24>>>2>>>0],ta:O[n+28>>>2>>>0],Ia:O[n+32>>>2>>>0],Ba:O[n+36>>>2>>>0],Ea:l?z(l):""},r=z(r),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(f,"g"),l[f]);var c="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(f in l={"%a":e=>c[e.oa].substring(0,3),"%A":e=>c[e.oa],"%b":e=>d[e.wa].substring(0,3),"%B":e=>d[e.wa],"%C":e=>o((e.ua+1900)/100|0,2),"%d":e=>o(e.ya,2),"%e":e=>a(e.ya,2," "),"%g":e=>u(e).toString().substring(2),"%G":e=>u(e),"%H":e=>o(e.va,2),"%I":e=>(0==(e=e.va)?e=12:12<e&&(e-=12),o(e,2)),"%j":e=>{for(var t=0,r=0;r<=e.wa-1;t+=(J(e.ua+1900)?ne:oe)[r++]);return o(e.ya+t,3)},"%m":e=>o(e.wa+1,2),"%M":e=>o(e.Ca,2),"%n":()=>"\n","%p":e=>0<=e.va&&12>e.va?"AM":"PM","%S":e=>o(e.Da,2),"%t":()=>"\t","%u":e=>e.oa||7,"%U":e=>o(Math.floor((e.ta+7-e.oa)/7),2),"%V":e=>{var t=Math.floor((e.ta+7-(e.oa+6)%7)/7);if(2>=(e.oa+371-e.ta-2)%7&&t++,t)53==t&&(4==(r=(e.oa+371-e.ta)%7)||3==r&&J(e.ua)||(t=1));else{t=52;var r=(e.oa+7-e.ta-1)%7;(4==r||5==r&&J(e.ua%400-1))&&t++}return o(t,2)},"%w":e=>e.oa,"%W":e=>o(Math.floor((e.ta+7-(e.oa+6)%7)/7),2),"%y":e=>(e.ua+1900).toString().substring(2),"%Y":e=>e.ua+1900,"%z":e=>(0<=(e=e.Ba)?"+":"-")+("0000"+((e=Math.abs(e)/60)/60*100+e%60)).slice(-4),"%Z":e=>e.Ea,"%%":()=>"%"},r=r.replace(/%%/g,"\0\0"),l)r.includes(f)&&(r=r.replace(new RegExp(f,"g"),l[f](n)));return f=function(e){var t=Array(V(e)+1);return q(e,t,0,t.length),t}(r=r.replace(/\0\0/g,"%")),f.length>t?0:(b.set(f,e>>>0),f.length-1)}var se={a:function(e,t,r){throw new W(e>>>=0).Aa(t>>>0,r>>>0),e},e:function(){return 0},H:function(){},x:function(){},z:function(){},J:function(){return 0},F:function(){},A:function(){},E:function(){},g:function(){},y:function(){},v:function(){},G:function(){},w:function(){},k:()=>1,n:function(e,t,r){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,r>>>=0,e=new Date(1e3*e),O[r>>>2>>>0]=e.getUTCSeconds(),O[r+4>>>2>>>0]=e.getUTCMinutes(),O[r+8>>>2>>>0]=e.getUTCHours(),O[r+12>>>2>>>0]=e.getUTCDate(),O[r+16>>>2>>>0]=e.getUTCMonth(),O[r+20>>>2>>>0]=e.getUTCFullYear()-1900,O[r+24>>>2>>>0]=e.getUTCDay(),O[r+28>>>2>>>0]=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},o:function(e,t,r){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,r>>>=0,e=new Date(1e3*e),O[r>>>2>>>0]=e.getSeconds(),O[r+4>>>2>>>0]=e.getMinutes(),O[r+8>>>2>>>0]=e.getHours(),O[r+12>>>2>>>0]=e.getDate(),O[r+16>>>2>>>0]=e.getMonth(),O[r+20>>>2>>>0]=e.getFullYear()-1900,O[r+24>>>2>>>0]=e.getDay(),O[r+28>>>2>>>0]=(J(e.getFullYear())?X:Q)[e.getMonth()]+e.getDate()-1|0,O[r+36>>>2>>>0]=-60*e.getTimezoneOffset(),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var n=new Date(e.getFullYear(),0,1).getTimezoneOffset();O[r+32>>>2>>>0]=0|(t!=n&&e.getTimezoneOffset()==Math.min(n,t))},p:function(e){e>>>=0;var t=new Date(O[e+20>>>2>>>0]+1900,O[e+16>>>2>>>0],O[e+12>>>2>>>0],O[e+8>>>2>>>0],O[e+4>>>2>>>0],O[e>>>2>>>0],0),r=O[e+32>>>2>>>0],n=t.getTimezoneOffset(),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),o=new Date(t.getFullYear(),0,1).getTimezoneOffset(),i=Math.min(o,a);return 0>r?O[e+32>>>2>>>0]=+(a!=o&&i==n):0<r!=(i==n)&&(a=Math.max(o,a),t.setTime(t.getTime()+6e4*((0<r?i:a)-n))),O[e+24>>>2>>>0]=t.getDay(),O[e+28>>>2>>>0]=(J(t.getFullYear())?X:Q)[t.getMonth()]+t.getDate()-1|0,O[e>>>2>>>0]=t.getSeconds(),O[e+4>>>2>>>0]=t.getMinutes(),O[e+8>>>2>>>0]=t.getHours(),O[e+12>>>2>>>0]=t.getDate(),O[e+16>>>2>>>0]=t.getMonth(),O[e+20>>>2>>>0]=t.getYear(),e=t.getTime(),isNaN(e)?(O[de()>>>2>>>0]=61,e=-1):e/=1e3,ge((H=e,1<=+Math.abs(H)?0<H?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)),e>>>0},l:function(){return-52},m:function(){},t:function(e,t,r){function n(e){return(e=e.toTimeString().match(/\(([A-Za-z ]+)\)$/))?e[1]:"GMT"}r>>>=0;var a=(new Date).getFullYear(),o=new Date(a,0,1),i=new Date(a,6,1);a=o.getTimezoneOffset();var s=i.getTimezoneOffset();_[e>>>0>>>2>>>0]=60*Math.max(a,s),O[t>>>0>>>2>>>0]=+(a!=s),e=n(o),t=n(i),e=Z(e),t=Z(t),s<a?(_[r>>>2>>>0]=e,_[r+4>>>2>>>0]=t):(_[r>>>2>>>0]=t,_[r+4>>>2>>>0]=e)},d:()=>{D("")},B:function(e,t,r){e>>>=0,t>>>=0,r>>>=0,K.length=0;for(var n;n=v[t++>>>0];){var a=105!=n;r+=(a&=112!=n)&&r%8?4:0,K.push(112==n?_[r>>>2>>>0]:105==n?O[r>>>2>>>0]:E[r>>>3>>>0]),r+=a?8:4}return $[e].apply(null,K)},h:()=>Date.now(),u:function(){return 4294901760},b:()=>performance.now(),I:function(e,t,r){return t>>>=0,v.copyWithin(e>>>0>>>0,t>>>0,t+(r>>>0)>>>0)},s:function(e){e>>>=0;var t=v.length;if(4294901760<e)return!1;for(var r=1;4>=r;r*=2){var n=t*(1+.2/r);n=Math.min(n,e+100663296);var a=Math;n=Math.max(e,n);e:{a=(a.min.call(a,4294901760,n+(65536-n%65536)%65536)-w.buffer.byteLength+65535)/65536;try{w.grow(a),T();var o=1;break e}catch{}o=void 0}if(o)return!0}return!1},C:function(e,t){e>>>=0,t>>>=0;var r=0;return te().forEach(((n,a)=>{var o=t+r;for(a=_[e+4*a>>>2>>>0]=o,o=0;o<n.length;++o)b[a++>>>0>>>0]=n.charCodeAt(o);b[a>>>0>>>0]=0,r+=n.length+1})),0},D:function(e,t){e>>>=0,t>>>=0;var r=te();_[e>>>2>>>0]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),_[t>>>2>>>0]=n,0},f:()=>52,j:function(){return 52},q:function(){return 70},i:function(e,t,r,n){t>>>=0,r>>>=0,n>>>=0;for(var a=0,o=0;o<r;o++){var i=_[t>>>2>>>0],s=_[t+4>>>2>>>0];t+=8;for(var u=0;u<s;u++){var l=v[i+u>>>0],f=re[e];0===l||10===l?((1===e?m:y)(G(f,0)),f.length=0):f.push(l)}a+=s}return _[n>>>2>>>0]=a,0},r:ie,c:function(e,t,r,n){return ie(e>>>0,t>>>0,r>>>0,n>>>0)}},fe=function(){function e(e){return fe=e.exports,fe=function(){var e=fe;e=Object.assign({},e);var t=e=>()=>e()>>>0,r=e=>t=>e(t)>>>0;return e.la=t(e.la),e.ma=r(e.ma),e.qa=t(e.qa),e.sa=r(e.sa),e}(),w=fe.K,T(),S.unshift(fe.L),0==--C&&(null!==P&&(clearInterval(P),P=null),U&&(e=U,U=null,e())),fe}var t={a:se};if(C++,a.instantiateWasm)try{return a.instantiateWasm(t,e)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),n(e)}return function(e,t){var r=x;return"function"!=typeof WebAssembly.instantiateStreaming||F(r)||I(r)||d||"function"!=typeof fetch?L(r,e,t):fetch(r,{credentials:"same-origin"}).then((n=>WebAssembly.instantiateStreaming(n,e).then(t,(function(n){return y(`wasm streaming compile failed: ${n}`),y("falling back to ArrayBuffer instantiation"),L(r,e,t)}))))}(t,(function(t){e(t.instance)})).catch(n),{}}();a._OrtInit=(e,t)=>(a._OrtInit=fe.M)(e,t),a._OrtGetLastError=(e,t)=>(a._OrtGetLastError=fe.N)(e,t),a._OrtCreateSessionOptions=(e,t,r,n,o,i,s,u,l,f)=>(a._OrtCreateSessionOptions=fe.O)(e,t,r,n,o,i,s,u,l,f),a._OrtAppendExecutionProvider=(e,t)=>(a._OrtAppendExecutionProvider=fe.P)(e,t),a._OrtAddFreeDimensionOverride=(e,t,r)=>(a._OrtAddFreeDimensionOverride=fe.Q)(e,t,r),a._OrtAddSessionConfigEntry=(e,t,r)=>(a._OrtAddSessionConfigEntry=fe.R)(e,t,r),a._OrtReleaseSessionOptions=e=>(a._OrtReleaseSessionOptions=fe.S)(e),a._OrtCreateSession=(e,t,r)=>(a._OrtCreateSession=fe.T)(e,t,r),a._OrtReleaseSession=e=>(a._OrtReleaseSession=fe.U)(e),a._OrtGetInputOutputCount=(e,t,r)=>(a._OrtGetInputOutputCount=fe.V)(e,t,r),a._OrtGetInputName=(e,t)=>(a._OrtGetInputName=fe.W)(e,t),a._OrtGetOutputName=(e,t)=>(a._OrtGetOutputName=fe.X)(e,t),a._OrtFree=e=>(a._OrtFree=fe.Y)(e),a._OrtCreateTensor=(e,t,r,n,o,i)=>(a._OrtCreateTensor=fe.Z)(e,t,r,n,o,i),a._OrtGetTensorData=(e,t,r,n,o)=>(a._OrtGetTensorData=fe._)(e,t,r,n,o),a._OrtReleaseTensor=e=>(a._OrtReleaseTensor=fe.$)(e),a._OrtCreateRunOptions=(e,t,r,n)=>(a._OrtCreateRunOptions=fe.aa)(e,t,r,n),a._OrtAddRunConfigEntry=(e,t,r)=>(a._OrtAddRunConfigEntry=fe.ba)(e,t,r),a._OrtReleaseRunOptions=e=>(a._OrtReleaseRunOptions=fe.ca)(e),a._OrtCreateBinding=e=>(a._OrtCreateBinding=fe.da)(e),a._OrtBindInput=(e,t,r)=>(a._OrtBindInput=fe.ea)(e,t,r),a._OrtBindOutput=(e,t,r,n)=>(a._OrtBindOutput=fe.fa)(e,t,r,n),a._OrtClearBoundOutputs=e=>(a._OrtClearBoundOutputs=fe.ga)(e),a._OrtReleaseBinding=e=>(a._OrtReleaseBinding=fe.ha)(e),a._OrtRunWithBinding=(e,t,r,n,o)=>(a._OrtRunWithBinding=fe.ia)(e,t,r,n,o),a._OrtRun=(e,t,r,n,o,i,s,u)=>(a._OrtRun=fe.ja)(e,t,r,n,o,i,s,u),a._OrtEndProfiling=e=>(a._OrtEndProfiling=fe.ka)(e);var de=()=>(de=fe.la)(),pe=a._malloc=e=>(pe=a._malloc=fe.ma)(e);a._free=e=>(a._free=fe.na)(e);var he,ge=e=>(ge=fe.pa)(e),me=()=>(me=fe.qa)(),ye=e=>(ye=fe.ra)(e),we=e=>(we=fe.sa)(e);function be(){if(!(0<C)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;){var e=a.preRun.shift();M.unshift(e)}for(;0<M.length;)M.shift()(a);if(!(0<C||he||(he=!0,a.calledRun=!0,A))){for(;0<S.length;)S.shift()(a);for(t(a);0<R.length;)R.shift()(a)}}}return a.stackAlloc=we,a.stackSave=me,a.stackRestore=ye,a.UTF8ToString=z,a.stringToUTF8=(e,t,r)=>q(e,v,t,r),a.lengthBytesUTF8=V,U=function e(){he||be(),he||(U=e)},be(),e.ready});"object"==typeof e&&"object"==typeof t?t.exports=n:"function"==typeof define&&define.amd&&define([],(()=>n))})),pe=k((()=>{})),he=k((()=>{})),ge={};B(ge,{cpus:()=>me});var me,ye,we,be,ve,Oe,_e,Ee,Ae,Te,Me,Se,Re,Ce,Pe,Ue,De,xe,Fe,Ie,ke,Be,Ne,Le,He,$e,We,je,Ye,Ge,ze,Ve,qe,Je,Xe,Qe,Ze,Ke,et,tt,rt,nt,at,ot,it,st,ut,lt,ft,ct,dt,pt,ht,gt,mt,yt,wt,bt,vt,Ot,_t,Et,At,Tt,Mt=I((()=>{me=void 0})),St=k(((e,t)=>{var r,n=(r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(r=r||__filename),function(e={}){function t(){return R.buffer!=U.buffer&&B(),U}function n(){return R.buffer!=U.buffer&&B(),D}function a(){return R.buffer!=U.buffer&&B(),x}function o(){return R.buffer!=U.buffer&&B(),F}function i(){return R.buffer!=U.buffer&&B(),I}var s,u,l=e;l.ready=new Promise(((e,t)=>{s=e,u=t}));var f,c,d,p=Object.assign({},l),h="./this.program",g=(e,t)=>{throw t},m="object"==typeof window,y="function"==typeof importScripts,w="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,b=l.ENVIRONMENT_IS_PTHREAD||!1,v="";function O(e){return l.locateFile?l.locateFile(e,v):v+e}if(w){var _=(ue(),N(ae)),E=(ce(),N(le));let e;v=y?E.dirname(v)+"/":__dirname+"/",f=(e,t)=>(e=X(e)?new URL(e):E.normalize(e),_.readFileSync(e,t?void 0:"utf8")),d=e=>((e=f(e,!0)).buffer||(e=new Uint8Array(e)),e),c=(e,t,r,n=!0)=>{e=X(e)?new URL(e):E.normalize(e),_.readFile(e,n?void 0:"utf8",((e,a)=>{e?r(e):t(n?a.buffer:a)}))},!l.thisProgram&&1<process.argv.length&&(h=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),g=(e,t)=>{throw process.exitCode=e,t},l.inspect=()=>"[Emscripten Module object]";try{e=pe()}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=e.Worker}else(m||y)&&(y?v=self.location.href:typeof document<"u"&&document.currentScript&&(v=document.currentScript.src),typeof r<"u"&&r&&(v=r),v=0!==v.indexOf("blob:")?v.substr(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1):"",w||(f=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},y&&(d=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),c=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)}));w&&typeof performance>"u"&&(global.performance=he().performance);var A=console.log.bind(console),T=console.error.bind(console);w&&(A=(...e)=>_.writeSync(1,e.join(" ")+"\n"),T=(...e)=>_.writeSync(2,e.join(" ")+"\n"));var M=A,S=T;Object.assign(l,p),p=null,"object"!=typeof WebAssembly&&V("no native wasm support detected");var R,C,P,U,D,x,F,I,k=!1;function B(){var e=R.buffer;l.HEAP8=U=new Int8Array(e),l.HEAP16=new Int16Array(e),l.HEAPU8=D=new Uint8Array(e),l.HEAPU16=new Uint16Array(e),l.HEAP32=x=new Int32Array(e),l.HEAPU32=F=new Uint32Array(e),l.HEAPF32=new Float32Array(e),l.HEAPF64=I=new Float64Array(e)}var L=16777216;if(b)R=l.wasmMemory;else if(l.wasmMemory)R=l.wasmMemory;else if(!((R=new WebAssembly.Memory({initial:L/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw S("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"),w&&S("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");B(),L=R.buffer.byteLength;var H=[],$=[],W=[],j=0,Y=null,G=null;function z(){if(0==--j&&(null!==Y&&(clearInterval(Y),Y=null),G)){var e=G;G=null,e()}}function V(e){throw S(e="Aborted("+e+")"),k=!0,P=1,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),u(e),e}var q,J=e=>e.startsWith("data:application/octet-stream;base64,"),X=e=>e.startsWith("file://");function Q(e){if(d)return d(e);throw"both async and sync fetching of the wasm failed"}function Z(e,t,r){return function(e){if(m||y){if("function"==typeof fetch&&!X(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(c)return new Promise(((t,r)=>{c(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{S(`failed to asynchronously prepare wasm: ${e}`),V(e)}))}J(q="ort-wasm-threaded.wasm")||(q=O(q));var K,ee={921276:(e,t,r,a)=>{if(typeof l>"u"||!l.cb)return 1;if((e=fe(e>>>0)).startsWith("./")&&(e=e.substring(2)),!(e=l.cb.get(e)))return 2;if(a>>>=0,(t>>>=0)+(r>>>=0)>e.byteLength)return 3;try{return n().set(e.subarray(t,t+r),a>>>0),0}catch{return 4}}};function te(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var re=e=>{e.terminate(),e.onmessage=()=>{}},ne=e=>{0==Oe.Pa.length&&(ve(),Oe.Ya(Oe.Pa[0]));var t=Oe.Pa.pop();if(!t)return 6;Oe.Qa.push(t),Oe.Ma[e.Oa]=t,t.Oa=e.Oa;var r={cmd:"run",start_routine:e.kb,arg:e.hb,pthread_ptr:e.Oa};return w&&t.unref(),t.postMessage(r,e.qb),0},oe=0,ie=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,se=(e,t,r)=>{var n=(t>>>=0)+r;for(r=t;e[r]&&!(r>=n);)++r;if(16<r-t&&e.buffer&&ie)return ie.decode(e.buffer instanceof SharedArrayBuffer?e.slice(t,r):e.subarray(t,r));for(n="";t<r;){var a=e[t++];if(128&a){var o=63&e[t++];if(192==(224&a))n+=String.fromCharCode((31&a)<<6|o);else{var i=63&e[t++];65536>(a=224==(240&a)?(15&a)<<12|o<<6|i:(7&a)<<18|o<<12|i<<6|63&e[t++])?n+=String.fromCharCode(a):(a-=65536,n+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else n+=String.fromCharCode(a)}return n},fe=(e,t)=>(e>>>=0)?se(n(),e,t):"",de=e=>{var t=Ct();return e=e(),Pt(t),e};function me(e,t){var r=arguments.length-2,n=arguments;return de((()=>{for(var a=Ut(8*r),o=a>>>3,s=0;s<r;s++){var u=n[2+s];i()[o+s>>>0]=u}return _t(e,r,a,t)}))}function ye(e){if(b)return me(0,1,e);P=e,0<oe||(Oe.lb(),l.onExit?.(e),k=!0),g(e,new te(e))}var we=e=>{if(P=e,b)throw Ee(e),"unwind";ye(e)};function be(){for(var e=l.numThreads;e--;)ve();H.unshift((()=>{j++,function(e){b?e():Promise.all(Oe.Pa.map(Oe.Ya)).then(e)}((()=>z()))}))}function ve(){var e=O("ort-wasm-threaded.worker.js");e=new Worker(e),Oe.Pa.push(e)}var Oe={Pa:[],Qa:[],bb:[],Ma:{},Wa(){b?(Oe.receiveObjectTransfer=Oe.jb,Oe.threadInitTLS=Oe.ab,Oe.setExitStatus=Oe.$a):be()},$a:e=>P=e,tb:["$terminateWorker"],lb:()=>{for(var e of Oe.Qa)re(e);for(e of Oe.Pa)re(e);Oe.Pa=[],Oe.Qa=[],Oe.Ma=[]},Za:e=>{var t=e.Oa;delete Oe.Ma[t],Oe.Pa.push(e),Oe.Qa.splice(Oe.Qa.indexOf(e),1),e.Oa=0,Et(t)},jb(){},ab(){Oe.bb.forEach((e=>e()))},Ya:e=>new Promise((t=>{e.onmessage=r=>{var n=(r=r.data).cmd;if(r.targetThread&&r.targetThread!=wt()){var a=Oe.Ma[r.targetThread];a?a.postMessage(r,r.transferList):S(`Internal error! Worker sent a message "${n}" to target pthread ${r.targetThread}, but that thread no longer exists!`)}else"checkMailbox"===n?ze():"spawnThread"===n?ne(r):"cleanupThread"===n?Oe.Za(Oe.Ma[r.thread]):"killThread"===n?(r=r.thread,n=Oe.Ma[r],delete Oe.Ma[r],re(n),Et(r),Oe.Qa.splice(Oe.Qa.indexOf(n),1),n.Oa=0):"cancelThread"===n?Oe.Ma[r.thread].postMessage({cmd:"cancel"}):"loaded"===n?(e.loaded=!0,w&&!e.Oa&&e.unref(),t(e)):"alert"===n?alert(`Thread ${r.threadId}: ${r.text}`):"setimmediate"===r.target?e.postMessage(r):"callHandler"===n?l[r.handler](...r.args):n&&S(`worker sent an unknown command ${n}`)},e.onerror=e=>{throw S(`worker sent an error! ${e.filename}:${e.lineno}: ${e.message}`),e},w&&(e.on("message",(t=>e.onmessage({data:t}))),e.on("error",(t=>e.onerror(t))));var n,a=[];for(n of["onExit"])l.hasOwnProperty(n)&&a.push(n);e.postMessage({cmd:"load",handlers:a,urlOrBlob:l.mainScriptUrlOrBlob||r,wasmMemory:R,wasmModule:C})}))};l.PThread=Oe;var _e=e=>{for(;0<e.length;)e.shift()(l)};function Ee(e){if(b)return me(1,0,e);we(e)}l.establishStackSpace=()=>{var e=wt(),t=o()[e+52>>>2>>>0];e=o()[e+56>>>2>>>0],Rt(t,t-e),Pt(t)};var Ae,Te=[];function Me(e){this.Va=e-24,this.gb=function(e){o()[this.Va+4>>>2>>>0]=e},this.fb=function(e){o()[this.Va+8>>>2>>>0]=e},this.Wa=function(e,t){this.eb(),this.gb(e),this.fb(t)},this.eb=function(){o()[this.Va+16>>>2>>>0]=0}}function Se(e,t,r,n){return b?me(2,1,e,t,r,n):Re(e,t,r,n)}function Re(e,t,r,n){if(e>>>=0,t>>>=0,r>>>=0,n>>>=0,typeof SharedArrayBuffer>"u")return S("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return b&&0===a.length?Se(e,t,r,n):(e={kb:r,Oa:e,hb:n,qb:a},b?(e.sb="spawnThread",postMessage(e,a),0):ne(e))}function Ce(e,t,r){return b?me(3,1,e,t,r):0}function Pe(e,t){if(b)return me(4,1,e,t)}l.invokeEntryPoint=(e,t)=>{var r=Te[e];r||(e>=Te.length&&(Te.length=e+1),Te[e]=r=Ae.get(e)),e=r(t),0<oe?Oe.$a(e):At(e)};var Ue=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);127>=n?t++:2047>=n?t+=2:55296<=n&&57343>=n?(t+=4,++r):t+=3}return t},De=(e,t,r,n)=>{if(!(0<n))return 0;var a=r>>>=0;n=r+n-1;for(var o=0;o<e.length;++o){var i=e.charCodeAt(o);if(55296<=i&&57343>=i&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++o)),127>=i){if(r>=n)break;t[r++>>>0]=i}else{if(2047>=i){if(r+1>=n)break;t[r++>>>0]=192|i>>6}else{if(65535>=i){if(r+2>=n)break;t[r++>>>0]=224|i>>12}else{if(r+3>=n)break;t[r++>>>0]=240|i>>18,t[r++>>>0]=128|i>>12&63}t[r++>>>0]=128|i>>6&63}t[r++>>>0]=128|63&i}}return t[r>>>0]=0,r-a},xe=(e,t,r)=>De(e,n(),t,r);function Fe(e,t){if(b)return me(5,1,e,t)}function Ie(e,t,r){if(b)return me(6,1,e,t,r)}function ke(e,t,r){return b?me(7,1,e,t,r):0}function Be(e,t){if(b)return me(8,1,e,t)}function Ne(e,t,r){if(b)return me(9,1,e,t,r)}function Le(e,t,r,n){if(b)return me(10,1,e,t,r,n)}function He(e,t,r,n){if(b)return me(11,1,e,t,r,n)}function $e(e,t,r,n){if(b)return me(12,1,e,t,r,n)}function We(e){if(b)return me(13,1,e)}function je(e,t){if(b)return me(14,1,e,t)}function Ye(e,t,r){if(b)return me(15,1,e,t,r)}function Ge(e){e>>>=0,"function"==typeof Atomics.rb&&(Atomics.rb(a(),e>>>2,e).value.then(ze),e+=128,Atomics.store(a(),e>>>2,1))}l.__emscripten_thread_mailbox_await=Ge;var ze=()=>{var e=wt();if(e&&(Ge(e),e=Tt,!k))try{if(e(),!(0<oe))try{b?At(P):we(P)}catch(e){e instanceof te||"unwind"==e||g(1,e)}}catch(e){e instanceof te||"unwind"==e||g(1,e)}};l.checkMailbox=ze;var Ve=[],qe=e=>e%4==0&&(e%100!=0||e%400==0),Je=[0,31,60,91,121,152,182,213,244,274,305,335],Xe=[0,31,59,90,120,151,181,212,243,273,304,334];function Qe(e,t,r,n,a,o,i,s){return b?me(16,1,e,t,r,n,a,o,i,s):-52}function Ze(e,t,r,n,a,o,i){if(b)return me(17,1,e,t,r,n,a,o,i)}var Ke,et=e=>{var t=Ue(e)+1,r=bt(t);return r&&xe(e,r,t),r},tt=[],rt={},nt=()=>{if(!Ke){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:h||"./this.program"};for(e in rt)void 0===rt[e]?delete t[e]:t[e]=rt[e];var r=[];for(e in t)r.push(`${e}=${t[e]}`);Ke=r}return Ke};function at(e,r){if(b)return me(18,1,e,r);e>>>=0,r>>>=0;var n=0;return nt().forEach(((a,i)=>{var s=r+n;for(i=o()[e+4*i>>>2>>>0]=s,s=0;s<a.length;++s)t()[i++>>>0>>>0]=a.charCodeAt(s);t()[i>>>0>>>0]=0,n+=a.length+1})),0}function ot(e,t){if(b)return me(19,1,e,t);e>>>=0,t>>>=0;var r=nt();o()[e>>>2>>>0]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),o()[t>>>2>>>0]=n,0}function it(e){return b?me(20,1,e):52}function st(e,t,r,n){return b?me(21,1,e,t,r,n):52}function ut(e,t,r,n,a){return b?me(22,1,e,t,r,n,a):70}var lt=[null,[],[]];function ft(e,t,r,a){if(b)return me(23,1,e,t,r,a);t>>>=0,r>>>=0,a>>>=0;for(var i=0,s=0;s<r;s++){var u=o()[t>>>2>>>0],l=o()[t+4>>>2>>>0];t+=8;for(var f=0;f<l;f++){var c=n()[u+f>>>0],d=lt[e];0===c||10===c?((1===e?M:S)(se(d,0)),d.length=0):d.push(c)}i+=l}return o()[a>>>2>>>0]=i,0}var ct=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function pt(e,r,n,i){function s(e,t,r){for(e="number"==typeof e?e.toString():e||"";e.length<t;)e=r[0]+e;return e}function u(e,t){return s(e,t,"0")}function l(e,t){function r(e){return 0>e?-1:0<e?1:0}var n;return 0===(n=r(e.getFullYear()-t.getFullYear()))&&0===(n=r(e.getMonth()-t.getMonth()))&&(n=r(e.getDate()-t.getDate())),n}function f(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function c(e){var t=e.Ra;for(e=new Date(new Date(e.Sa+1900,0,1).getTime());0<t;){var r=e.getMonth(),n=(qe(e.getFullYear())?ct:dt)[r];if(!(t>n-e.getDate())){e.setDate(e.getDate()+t);break}t-=n-e.getDate()+1,e.setDate(1),11>r?e.setMonth(r+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return r=new Date(e.getFullYear()+1,0,4),t=f(new Date(e.getFullYear(),0,4)),r=f(r),0>=l(t,e)?0>=l(r,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}e>>>=0,r>>>=0,n>>>=0,i>>>=0;var d=o()[i+40>>>2>>>0];for(var p in i={ob:a()[i>>>2>>>0],nb:a()[i+4>>>2>>>0],Ta:a()[i+8>>>2>>>0],Xa:a()[i+12>>>2>>>0],Ua:a()[i+16>>>2>