diff --git a/modules/embeddings.js b/modules/embeddings.js
new file mode 100644
index 0000000000000000000000000000000000000000..956e6679ffc3b04bdbcbe81ac12737a91d3cacf7
--- /dev/null
+++ b/modules/embeddings.js
@@ -0,0 +1,33 @@
+import { convertToFloat32 } from './faqData.js';
+
+
+/** import embeddings from JSON files in file system */
+async function loadJsonData(filePath) {
+  try {
+    const response = await fetch(filePath);
+    if (!response.ok) return null;
+    const jsonData = JSON.parse(await response.text());
+    return convertToFloat32(jsonData);
+  } catch (err) {
+    return null;
+  }
+}
+
+/** check if embeddings are presenet in local storage. If not, try getting them from JSON file */
+export async function loadEmbedding(key, filePath) {
+  const retrievedEmb = JSON.parse(localStorage.getItem(key));
+  if (retrievedEmb && Object.keys(retrievedEmb).length > 0) {
+    return convertToFloat32(retrievedEmb);
+  } else {
+    return await loadJsonData(filePath) || {};
+  }
+}
+
+/** get rid of old embeddings */
+export function removeOutdatedEntries(stack, validKeys) {
+  Object.keys(stack).forEach(key => {
+    if (!validKeys.has(key)) {
+      delete stack[key];
+    }
+  });
+}
diff --git a/modules/faqData.js b/modules/faqData.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b1df7693427a82fb62cd5ee29ce0e5d19fd229d
--- /dev/null
+++ b/modules/faqData.js
@@ -0,0 +1,49 @@
+import { tokenizeText } from './semanticSearch.js';
+
+
+/** import the questions, answers and panel Ids from HHU FAQ site */
+/** panel Ids needed for locating and highlighting chat response */
+export async function extractFAQfromHTML(url) {
+  
+  const response = await fetch(url);
+  const htmlText = await response.text();
+  const parser = new DOMParser();
+  const doc = parser.parseFromString(htmlText, "text/html");
+
+  const result = [];
+  const akkordeonGroup = doc.querySelectorAll('.panel-group');
+
+  akkordeonGroup.forEach(group => {
+    const akkordeonId = group.id;
+    const panels = group.querySelectorAll('.panel');
+    panels.forEach(panel => {
+      const questionButton = panel.querySelector('button');
+      const panelBody = panel.querySelector('.panel-body');
+      if (questionButton && panelBody) {
+        const buttonId = questionButton.id;
+        /** extracting the relevant parts */
+        const questionText = questionButton.querySelector('.text-box')?.textContent.trim();
+        const answerText = panelBody.querySelector('.ce-bodytext')?.textContent.trim() || "";
+
+        result.push({
+          akkordeonId,
+          buttonId,
+          question: questionText,
+          answer: answerText,
+          qPlusA: questionText + " " + answerText,
+          tokens: tokenizeText(answerText)
+        });
+      }
+    });
+  });
+  return result;
+}
+
+/** conversion is needed for storage of embeddings */
+export function convertToFloat32(inputEmbeddings) {
+  const convertedEmbeddings = {};
+  for (const [key, value] of Object.entries(inputEmbeddings)) {
+    convertedEmbeddings[key] = new Float32Array(Object.values(value));
+  }
+  return convertedEmbeddings;
+}
\ No newline at end of file
diff --git a/modules/feedback.js b/modules/feedback.js
new file mode 100644
index 0000000000000000000000000000000000000000..9ec47b47fa039820e8d96cbb4ccbc06709fbb114
--- /dev/null
+++ b/modules/feedback.js
@@ -0,0 +1,42 @@
+
+
+
+/** open mail client of user with prewritten message and stats */
+export function submitFeedback(query, bestToken, feedback) {
+
+  /** temporary mail adress, adjust if needed */
+  const feedbackAdress = 'huepfen-richtlinie.7r@icloud.com';
+  const timestamp = new Date().toISOString();
+  let subject = '';
+  let message = '';
+
+
+  
+  if (feedback === 'up') {
+    subject = 'Positive Feedback: FAQ Search Feature';
+    message = `Hello,
+    \nI used your FAQ search feature and was pleased with the result. Details below:
+    \nQuery: ${query}\nBest Token: ${bestToken}\nFeedback: ${feedback}\nTimestamp: ${timestamp}
+    \nI also have some additional suggestions: 
+    \nKeep it up!
+    \nBest regards`;
+
+  } else if (feedback === 'down') {
+    subject = 'Negative Feedback: FAQ Search Feature';
+    message = `Hello,
+    \nI tried used FAQ search feature, and unfortunately, I was not satisfied with this result. Detail below:
+    \nQuery: ${query}\nBest Token: ${bestToken}\nFeedback: ${feedback}\nTimestamp: ${timestamp}
+    \nI also have some additional suggestions: 
+    \nI hope this feedback lets you improve the experience.
+    \nBest regards`;
+  }
+
+  
+  const newSubject = encodeURIComponent(subject);
+  const body = encodeURIComponent(message);
+  const mailtoLink = `mailto:${feedbackAdress}?subject=${newSubject}&body=${body}`;
+
+  window.location.href = mailtoLink;
+}
+
+
diff --git a/modules/highlightText.js b/modules/highlightText.js
new file mode 100644
index 0000000000000000000000000000000000000000..2aa941ba0ffcb67ce92e379bcb24faa77df2a941
--- /dev/null
+++ b/modules/highlightText.js
@@ -0,0 +1,20 @@
+
+
+/** URL highlights stay in DOM until refresh of page; not ideal */
+/** might leave it out */
+export function highlightText(textToHighlight) {
+  const text = encodeURIComponent(textToHighlight);
+  
+  let windows = window;
+  while (windows !== windows.parent) {
+    windows = windows.parent;
+  }
+  
+  const currentUrl = windows.location.origin + windows.location.pathname + windows.location.search;
+  const newUrl = currentUrl + '#:~:text=' + text;
+  windows.location.href = newUrl;
+}
+
+
+
+
diff --git a/modules/semanticSearch.js b/modules/semanticSearch.js
new file mode 100644
index 0000000000000000000000000000000000000000..5d1fd4309708e49bb91f5f0dc93b92be6cff5702
--- /dev/null
+++ b/modules/semanticSearch.js
@@ -0,0 +1,180 @@
+import { pipeline, env } from './transformers.js';
+
+
+/** set transformers.js variables so that nothing is loaded externally */
+env.allowRemoteModels = false; 
+env.useBrowserCache = true;
+env.localModelPath = './models/';
+env.backends.onnx.wasm.wasmPaths = './wasm/'
+
+
+
+
+let embedder;
+let embeddingCache = {};
+let tokenEmbeddingCache = {};
+let queryEmbeddingCache = {};
+
+
+/** getting extraction model ready */
+export async function initializeModel() {
+
+  embedder = await pipeline(
+        'feature-extraction', 
+        'Xenova/all-MiniLM-L6-v2'
+  );
+
+}
+
+/** cosine similarity works out of the box */
+/** https://www.restack.io/p/similarity-search-answer-javascript-cosine-similarity-cat-ai */
+export function cosineSimilarity(vectorA, vectorB) {
+
+  const dotProduct = vectorA.reduce((sum, value, index) => sum + value * vectorB[index], 0);
+  const magnitudeA = Math.sqrt(vectorA.reduce((sum, value) => sum + value * value, 0));
+  const magnitudeB = Math.sqrt(vectorB.reduce((sum, value) => sum + value * value, 0));
+  return dotProduct / (magnitudeA * magnitudeB);
+
+}
+
+
+
+/** various function to calculate the right embeddings */
+/** -------------------------------------------------- */
+function roundEmbedding(embedding) {
+  return embedding.data.map(v => Number(v.toFixed(3)));
+}
+
+export async function getAndRoundEmbedding(text) {
+
+  const embedding = await embedder(text, { 
+                        pooling: 'mean', 
+                        normalize: true 
+                    });
+
+  return roundEmbedding(embedding);
+}
+
+export async function computeEmbedding(text) {
+  return getCachedEmbedding(text, embeddingCache);
+}
+
+export async function computeTokenEmbedding(text) {
+  return getCachedEmbedding(text, tokenEmbeddingCache);
+}
+
+export async function computeQueryEmbedding(text) {
+  return getCachedEmbedding(text, queryEmbeddingCache);
+}
+
+export async function calcFAQEmbeddings(textData, type) {
+  return Promise.all(textData.map(item => computeEmbedding(item[type])));
+}
+
+export async function getEmbedding(text) {
+
+  const result = await embedder(text, { 
+                    pooling: 'mean',
+                    normalize: true 
+                  });
+
+  return result.data;
+}
+/** -------------------------------------------------- */
+
+/** checking if embedding already exists, if not calulate it */
+export async function getCachedEmbedding(text, cache) {
+
+  if (cache[text]) {
+    return cache[text];
+  }
+
+  const emb = await getAndRoundEmbedding(text);
+  cache[text] = emb;
+
+  return emb;
+}
+
+export function getEmbeddingCache() {
+  return embeddingCache;
+}
+
+export function getTokenEmbeddingCache() {
+  return tokenEmbeddingCache;
+}
+
+
+export function setCaches(newEmbeddingCache, newTokenEmbeddingCache) {
+
+  embeddingCache = newEmbeddingCache;
+  tokenEmbeddingCache = newTokenEmbeddingCache;
+
+}
+
+
+/** turn a given text snippet in to tokens */
+/** this could still be optimized with more elaborate regular expessions; good for now */
+export function tokenizeText(text) {
+
+  const tokens = [];
+  const sentences = text.split(/(?<=[.!?])\s+/).filter(s => s.length > 0);
+  let buffer = "";
+  for (let i = 0; i < sentences.length; i++) {
+    buffer = buffer ? buffer + " " + sentences[i] : sentences[i];
+    if (buffer.length >= 10 || i === sentences.length - 1) {
+      tokens.push(buffer);
+      buffer = "";
+    }
+  }
+  return tokens;
+}
+
+/** getting token embeddings ready for later use in realtime search */
+export async function precalcTokenEmbeddings(textData) {
+
+  const allTokens = textData.flatMap(item => tokenizeText(item.answer));
+  const uniqueTokens = Array.from(new Set(allTokens));
+  await Promise.all(uniqueTokens.map(token => computeTokenEmbedding(token)));
+
+}
+
+
+/** give each FAQ entry a score on how similiar it is to the given query */
+/** return only the three most similiar */
+export async function semanticSearch(query, textData, faqEmbeddings, topK = 3) {
+  
+  const queryEmbedding = await computeQueryEmbedding(query);
+
+  return faqEmbeddings
+    .map((emb, index) => ({
+      question: textData[index].question,
+      answer: textData[index].answer,
+      buttonId: textData[index].buttonId,
+      akkordeonId: textData[index].akkordeonId,
+      qPlusA: textData[index].qPlusA,
+      token: textData[index].token,
+      score: cosineSimilarity(queryEmbedding, emb),
+    }))
+    .sort((a, b) => b.score - a.score)
+    .slice(0, topK);
+}
+
+
+export async function findBestToken(query, text) {
+  
+  const tokens = tokenizeText(text);
+  const queryEmbedding = await computeQueryEmbedding(query);
+  let bestToken = null;
+  let bestScore = -Infinity;
+
+  for (const token of tokens) {
+    const tokenEmb = await computeTokenEmbedding(token);
+    const score = cosineSimilarity(queryEmbedding, tokenEmb);
+    if (score > bestScore) {
+      bestScore = score;
+      bestToken = token;
+    }
+  }
+  return { bestToken };
+}
+
diff --git a/modules/transformers.js b/modules/transformers.js
new file mode 100644
index 0000000000000000000000000000000000000000..951a408172022874204cf0bfad0ab1bf9d7f8725
--- /dev/null
+++ b/modules/transformers.js
@@ -0,0 +1,107 @@
+var __webpack_modules__={"./node_modules/onnxruntime-common/dist/lib/backend-impl.js":
+/*!******************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/backend-impl.js ***!
+  \******************************************************************/(e,t,n)=>{n.r(t),n.d(t,{registerBackend:()=>i,resolveBackend:()=>s});const r={},o=[],i=(e,t,n)=>{if(!t||"function"!=typeof t.init||"function"!=typeof t.createSessionHandler)throw new TypeError("not a valid backend");{const i=r[e];if(void 0===i)r[e]={backend:t,priority:n};else{if(i.priority>n)return;if(i.priority===n&&i.backend!==t)throw new Error(`cannot register backend "${e}" using priority ${n}`)}if(n>=0){const t=o.indexOf(e);-1!==t&&o.splice(t,1);for(let t=0;t<o.length;t++)if(r[o[t]].priority<=n)return void o.splice(t,0,e);o.push(e)}}},s=async e=>{const t=0===e.length?o:e,n=[];for(const e of t){const t=r[e];if(t){if(t.initialized)return t.backend;if(t.aborted)continue;const r=!!t.initPromise;try{return r||(t.initPromise=t.backend.init()),await t.initPromise,t.initialized=!0,t.backend}catch(o){r||n.push({name:e,err:o}),t.aborted=!0}finally{delete t.initPromise}}}throw new Error(`no available backend found. ERR: ${n.map((e=>`[${e.name}] ${e.err}`)).join(", ")}`)}},"./node_modules/onnxruntime-common/dist/lib/backend.js":
+/*!*************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/backend.js ***!
+  \*************************************************************/(e,t,n)=>{n.r(t),n.d(t,{registerBackend:()=>r.registerBackend});var r=n(/*! ./backend-impl */"./node_modules/onnxruntime-common/dist/lib/backend-impl.js")},"./node_modules/onnxruntime-common/dist/lib/env-impl.js":
+/*!**************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/env-impl.js ***!
+  \**************************************************************/(e,t,n)=>{n.r(t),n.d(t,{EnvImpl:()=>r});class r{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}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}`);this.logLevelInternal=e}}get logLevel(){return this.logLevelInternal}}},"./node_modules/onnxruntime-common/dist/lib/env.js":
+/*!*********************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/env.js ***!
+  \*********************************************************/(e,t,n)=>{n.r(t),n.d(t,{env:()=>r});const r=new(n(/*! ./env-impl */"./node_modules/onnxruntime-common/dist/lib/env-impl.js").EnvImpl)},"./node_modules/onnxruntime-common/dist/lib/index.js":
+/*!***********************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/index.js ***!
+  \***********************************************************/(e,t,n)=>{n.r(t),n.d(t,{InferenceSession:()=>i.InferenceSession,Tensor:()=>s.Tensor,env:()=>o.env,registerBackend:()=>r.registerBackend});var r=n(/*! ./backend */"./node_modules/onnxruntime-common/dist/lib/backend.js"),o=n(/*! ./env */"./node_modules/onnxruntime-common/dist/lib/env.js"),i=n(/*! ./inference-session */"./node_modules/onnxruntime-common/dist/lib/inference-session.js"),s=n(/*! ./tensor */"./node_modules/onnxruntime-common/dist/lib/tensor.js");n(/*! ./onnx-value */"./node_modules/onnxruntime-common/dist/lib/onnx-value.js")},"./node_modules/onnxruntime-common/dist/lib/inference-session-impl.js":
+/*!****************************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/inference-session-impl.js ***!
+  \****************************************************************************/(e,t,n)=>{n.r(t),n.d(t,{InferenceSession:()=>i});var r=n(/*! ./backend-impl */"./node_modules/onnxruntime-common/dist/lib/backend-impl.js"),o=n(/*! ./tensor */"./node_modules/onnxruntime-common/dist/lib/tensor.js");class i{constructor(e){this.handler=e}async run(e,t,n){const r={};let i={};if("object"!=typeof e||null===e||e instanceof o.Tensor||Array.isArray(e))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 t){if(null===t)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof o.Tensor)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.");s=!1;for(const 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}.`);r[e]=null}if("object"==typeof n&&null!==n)i=n;else if(void 0!==n)throw new TypeError("'options' must be an object.")}else{let e=!1;const a=Object.getOwnPropertyNames(t);for(const n of this.outputNames)if(-1!==a.indexOf(n)){const i=t[n];(null===i||i instanceof o.Tensor)&&(e=!0,s=!1,r[n]=i)}if(e){if("object"==typeof n&&null!==n)i=n;else if(void 0!==n)throw new TypeError("'options' must be an object.")}else i=t}}else if(void 0!==t)throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(const t of this.inputNames)if(void 0===e[t])throw new Error(`input '${t}' is missing in 'feeds'.`);if(s)for(const e of this.outputNames)r[e]=null;const a=await this.handler.run(e,r,i),l={};for(const e in a)Object.hasOwnProperty.call(a,e)&&(l[e]=new o.Tensor(a[e].type,a[e].data,a[e].dims));return l}static async create(e,t,n,o){let s,a={};if("string"==typeof e){if(s=e,"object"==typeof t&&null!==t)a=t;else if(void 0!==t)throw new TypeError("'options' must be an object.")}else if(e instanceof Uint8Array){if(s=e,"object"==typeof t&&null!==t)a=t;else if(void 0!==t)throw new TypeError("'options' must be an object.")}else{if(!(e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer))throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");{const r=e;let i=0,l=e.byteLength;if("object"==typeof t&&null!==t)a=t;else if("number"==typeof t){if(i=t,!Number.isSafeInteger(i))throw new RangeError("'byteOffset' must be an integer.");if(i<0||i>=r.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${r.byteLength}).`);if(l=e.byteLength-i,"number"==typeof n){if(l=n,!Number.isSafeInteger(l))throw new RangeError("'byteLength' must be an integer.");if(l<=0||i+l>r.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${r.byteLength-i}].`);if("object"==typeof o&&null!==o)a=o;else if(void 0!==o)throw new TypeError("'options' must be an object.")}else if(void 0!==n)throw new TypeError("'byteLength' must be a number.")}else if(void 0!==t)throw new TypeError("'options' must be an object.");s=new Uint8Array(r,i,l)}}const l=(a.executionProviders||[]).map((e=>"string"==typeof e?e:e.name)),c=await(0,r.resolveBackend)(l),u=await c.createSessionHandler(s,a);return new i(u)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}},"./node_modules/onnxruntime-common/dist/lib/inference-session.js":
+/*!***********************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/inference-session.js ***!
+  \***********************************************************************/(e,t,n)=>{n.r(t),n.d(t,{InferenceSession:()=>r});const r=n(/*! ./inference-session-impl */"./node_modules/onnxruntime-common/dist/lib/inference-session-impl.js").InferenceSession},"./node_modules/onnxruntime-common/dist/lib/onnx-value.js":
+/*!****************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/onnx-value.js ***!
+  \****************************************************************/(e,t,n)=>{n.r(t)},"./node_modules/onnxruntime-common/dist/lib/tensor-impl.js":
+/*!*****************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/tensor-impl.js ***!
+  \*****************************************************************/(e,t,n)=>{n.r(t),n.d(t,{Tensor:()=>a});const r="undefined"!=typeof BigInt64Array&&"function"==typeof BigInt64Array.from,o="undefined"!=typeof BigUint64Array&&"function"==typeof BigUint64Array.from,i=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),s=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);r&&(i.set("int64",BigInt64Array),s.set(BigInt64Array,"int64")),o&&(i.set("uint64",BigUint64Array),s.set(BigUint64Array,"uint64"));class a{constructor(e,t,n){let r,o,a;if("string"==typeof e)if(r=e,a=n,"string"===e){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");o=t}else{const n=i.get(e);if(void 0===n)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t))o=n.from(t);else{if(!(t instanceof n))throw new TypeError(`A ${r} tensor's data must be type of ${n}`);o=t}}else if(a=t,Array.isArray(e)){if(0===e.length)throw new TypeError("Tensor type cannot be inferred from an empty array.");const t=typeof e[0];if("string"===t)r="string",o=e;else{if("boolean"!==t)throw new TypeError(`Invalid element type of data array: ${t}.`);r="bool",o=Uint8Array.from(e)}}else{const t=s.get(e.constructor);if(void 0===t)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);r=t,o=e}if(void 0===a)a=[o.length];else if(!Array.isArray(a))throw new TypeError("A tensor's dims must be a number array");const l=(e=>{let t=1;for(let n=0;n<e.length;n++){const r=e[n];if("number"!=typeof r||!Number.isSafeInteger(r))throw new TypeError(`dims[${n}] must be an integer, got: ${r}`);if(r<0)throw new RangeError(`dims[${n}] must be a non-negative integer, got: ${r}`);t*=r}return t})(a);if(l!==o.length)throw new Error(`Tensor's size(${l}) does not match data length(${o.length}).`);this.dims=a,this.type=r,this.data=o,this.size=l}static bufferToTensor(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");const{height:n,width:r}=t,o=t.norm;let i,s;i=void 0===o||void 0===o.mean?255:o.mean,s=void 0===o||void 0===o.bias?0:o.bias;const l=void 0!==t.bitmapFormat?t.bitmapFormat:"RGBA",c=void 0!==t.tensorFormat&&void 0!==t.tensorFormat?t.tensorFormat:"RGB",u=n*r,p="RGBA"===c?new Float32Array(4*u):new Float32Array(3*u);let d=4,_=0,h=1,f=2,m=3,g=0,b=u,w=2*u,x=-1;"RGB"===l&&(d=3,_=0,h=1,f=2,m=-1),"RGBA"===c?x=3*u:"RBG"===c?(g=0,w=u,b=2*u):"BGR"===c&&(w=0,b=u,g=2*u);for(let t=0;t<u;t++,_+=d,f+=d,h+=d,m+=d)p[g++]=(e[_]+s)/i,p[b++]=(e[h]+s)/i,p[w++]=(e[f]+s)/i,-1!==x&&-1!==m&&(p[x++]=(e[m]+s)/i);return new a("float32",p,"RGBA"===c?[1,4,n,r]:[1,3,n,r])}static async fromImage(e,t){const n="undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement,r="undefined"!=typeof ImageData&&e instanceof ImageData,o="undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap,i="undefined"!=typeof String&&(e instanceof String||"string"==typeof e);let s,l={};if(n){const n=document.createElement("canvas"),r=n.getContext("2d");if(null==r)throw new Error("Can not access image data");{let o=e.naturalHeight,i=e.naturalWidth;if(void 0!==t&&void 0!==t.resizedHeight&&void 0!==t.resizedWidth&&(o=t.resizedHeight,i=t.resizedWidth),void 0!==t){if(l=t,void 0!==t.tensorFormat)throw new Error("Image input config format must be RGBA for HTMLImageElement");if(l.tensorFormat="RGBA",void 0!==t.height&&t.height!==o)throw new Error("Image input config height doesn't match HTMLImageElement height");if(l.height=o,void 0!==t.width&&t.width!==i)throw new Error("Image input config width doesn't match HTMLImageElement width");l.width=i}else l.tensorFormat="RGBA",l.height=o,l.width=i;n.width=i,n.height=o,r.drawImage(e,0,0,i,o),s=r.getImageData(0,0,i,o).data}}else{if(!r){if(o){if(void 0===t)throw new Error("Please provide image config with format for Imagebitmap");if(void 0!==t.bitmapFormat)throw new Error("Image input config format must be defined for ImageBitmap");const n=document.createElement("canvas").getContext("2d");if(null!=n){const r=e.height,o=e.width;if(n.drawImage(e,0,0,o,r),s=n.getImageData(0,0,o,r).data,void 0!==t){if(void 0!==t.height&&t.height!==r)throw new Error("Image input config height doesn't match ImageBitmap height");if(l.height=r,void 0!==t.width&&t.width!==o)throw new Error("Image input config width doesn't match ImageBitmap width");l.width=o}else l.height=r,l.width=o;return a.bufferToTensor(s,l)}throw new Error("Can not access image data")}if(i)return new Promise(((n,r)=>{const o=document.createElement("canvas"),i=o.getContext("2d");if(!e||!i)return r();const s=new Image;s.crossOrigin="Anonymous",s.src=e,s.onload=()=>{o.width=s.width,o.height=s.height,i.drawImage(s,0,0,o.width,o.height);const e=i.getImageData(0,0,o.width,o.height);if(void 0!==t){if(void 0!==t.height&&t.height!==o.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(l.height=o.height,void 0!==t.width&&t.width!==o.width)throw new Error("Image input config width doesn't match ImageBitmap width");l.width=o.width}else l.height=o.height,l.width=o.width;n(a.bufferToTensor(e.data,l))}}));throw new Error("Input data provided is not supported - aborted tensor creation")}{const n="RGBA";let r,o;if(void 0!==t&&void 0!==t.resizedWidth&&void 0!==t.resizedHeight?(r=t.resizedHeight,o=t.resizedWidth):(r=e.height,o=e.width),void 0!==t){if(l=t,void 0!==t.bitmapFormat&&t.bitmapFormat!==n)throw new Error("Image input config format must be RGBA for ImageData");l.bitmapFormat="RGBA"}else l.bitmapFormat="RGBA";if(l.height=r,l.width=o,void 0!==t){const t=document.createElement("canvas");t.width=o,t.height=r;const n=t.getContext("2d");if(null==n)throw new Error("Can not access image data");n.putImageData(e,0,0),s=n.getImageData(0,0,o,r).data}else s=e.data}}if(void 0!==s)return a.bufferToTensor(s,l);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(e){var t,n;const r=document.createElement("canvas").getContext("2d");let o;if(null==r)throw new Error("Can not access image data");{const i=this.dims[3],s=this.dims[2],a=this.dims[1],l=void 0!==e&&void 0!==e.format?e.format:"RGB",c=void 0!==e&&void 0!==(null===(t=e.norm)||void 0===t?void 0:t.mean)?e.norm.mean:255,u=void 0!==e&&void 0!==(null===(n=e.norm)||void 0===n?void 0:n.bias)?e.norm.bias:0,p=s*i;if(void 0!==e){if(void 0!==e.height&&e.height!==s)throw new Error("Image output config height doesn't match tensor height");if(void 0!==e.width&&e.width!==i)throw new Error("Image output config width doesn't match tensor width");if(void 0!==e.format&&4===a&&"RGBA"!==e.format||3===a&&"RGB"!==e.format&&"BGR"!==e.format)throw new Error("Tensor format doesn't match input tensor dims")}const d=4;let _=0,h=1,f=2,m=3,g=0,b=p,w=2*p,x=-1;"RGBA"===l?(g=0,b=p,w=2*p,x=3*p):"RGB"===l?(g=0,b=p,w=2*p):"RBG"===l&&(g=0,w=p,b=2*p),o=r.createImageData(i,s);for(let e=0;e<s*i;_+=d,h+=d,f+=d,m+=d,e++)o.data[_]=(this.data[g++]-u)*c,o.data[h]=(this.data[b++]-u)*c,o.data[f]=(this.data[w++]-u)*c,o.data[m]=-1===x?255:(this.data[x++]-u)*c}return o}reshape(e){return new a(this.type,this.data,e)}}},"./node_modules/onnxruntime-common/dist/lib/tensor.js":
+/*!************************************************************!*\
+  !*** ./node_modules/onnxruntime-common/dist/lib/tensor.js ***!
+  \************************************************************/(e,t,n)=>{n.r(t),n.d(t,{Tensor:()=>r});const r=n(/*! ./tensor-impl */"./node_modules/onnxruntime-common/dist/lib/tensor-impl.js").Tensor},"./node_modules/onnxruntime-web/dist/ort-web.min.js":
+/*!**********************************************************!*\
+  !*** ./node_modules/onnxruntime-web/dist/ort-web.min.js ***!
+  \**********************************************************/(module,__unused_webpack_exports,__webpack_require__)=>{var e;self,e=__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(e,t,n)=>{var r,o=(r=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){function t(){return O.buffer!=D&&W(O.buffer),L}function o(){return O.buffer!=D&&W(O.buffer),N}function i(){return O.buffer!=D&&W(O.buffer),$}function s(){return O.buffer!=D&&W(O.buffer),B}function a(){return O.buffer!=D&&W(O.buffer),z}var l,c,u;e=e||{},l||(l=void 0!==e?e:{}),l.ready=new Promise((function(e,t){c=e,u=t}));var p,d,_,h,f,m,g=Object.assign({},l),b="./this.program",w=(e,t)=>{throw t},x="object"==typeof window,y="function"==typeof importScripts,T="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,v=l.ENVIRONMENT_IS_PTHREAD||!1,k="";function M(e){return l.locateFile?l.locateFile(e,k):k+e}if(T){let t;k=y?n(908).dirname(k)+"/":"//",m=()=>{f||(h=n(1384),f=n(908))},p=function(e,t){return m(),e=f.normalize(e),h.readFileSync(e,t?void 0:"utf8")},_=e=>((e=p(e,!0)).buffer||(e=new Uint8Array(e)),e),d=(e,t,n)=>{m(),e=f.normalize(e),h.readFile(e,(function(e,r){e?n(e):t(r.buffer)}))},1<process.argv.length&&(b=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof ce))throw e})),process.on("unhandledRejection",(function(e){throw e})),w=(e,t)=>{if(J())throw process.exitCode=e,t;t instanceof ce||C("exiting due to exception: "+t),process.exit(e)},l.inspect=function(){return"[Emscripten Module object]"};try{t=n(9925)}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}n.g.Worker=t.Worker}else(x||y)&&(y?k=self.location.href:"undefined"!=typeof document&&document.currentScript&&(k=document.currentScript.src),r&&(k=r),k=0!==k.indexOf("blob:")?k.substr(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1):"",T||(p=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},y&&(_=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),d=(e,t,n)=>{var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)}));T&&"undefined"==typeof performance&&(n.g.performance=n(6953).performance);var S=console.log.bind(console),P=console.warn.bind(console);T&&(m(),S=e=>h.writeSync(1,e+"\n"),P=e=>h.writeSync(2,e+"\n"));var A,F=l.print||S,C=l.printErr||P;Object.assign(l,g),g=null,l.thisProgram&&(b=l.thisProgram),l.quit&&(w=l.quit),l.wasmBinary&&(A=l.wasmBinary);var E=l.noExitRuntime||!1;"object"!=typeof WebAssembly&&ie("no native wasm support detected");var O,I,D,L,N,$,B,z,R=!1,j="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function V(e,t,n){var r=(t>>>=0)+n;for(n=t;e[n]&&!(n>=r);)++n;if(16<n-t&&e.buffer&&j)return j.decode(e.buffer instanceof SharedArrayBuffer?e.slice(t,n):e.subarray(t,n));for(r="";t<n;){var o=e[t++];if(128&o){var i=63&e[t++];if(192==(224&o))r+=String.fromCharCode((31&o)<<6|i);else{var s=63&e[t++];65536>(o=224==(240&o)?(15&o)<<12|i<<6|s:(7&o)<<18|i<<12|s<<6|63&e[t++])?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode(55296|o>>10,56320|1023&o))}}else r+=String.fromCharCode(o)}return r}function U(e,t){return(e>>>=0)?V(o(),e,t):""}function G(e,t,n,r){if(!(0<r))return 0;var o=n>>>=0;r=n+r-1;for(var i=0;i<e.length;++i){var s=e.charCodeAt(i);if(55296<=s&&57343>=s&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),127>=s){if(n>=r)break;t[n++>>>0]=s}else{if(2047>=s){if(n+1>=r)break;t[n++>>>0]=192|s>>6}else{if(65535>=s){if(n+2>=r)break;t[n++>>>0]=224|s>>12}else{if(n+3>=r)break;t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63}t[n++>>>0]=128|s>>6&63}t[n++>>>0]=128|63&s}}return t[n>>>0]=0,n-o}function q(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);127>=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t}function W(e){D=e,l.HEAP8=L=new Int8Array(e),l.HEAP16=new Int16Array(e),l.HEAP32=$=new Int32Array(e),l.HEAPU8=N=new Uint8Array(e),l.HEAPU16=new Uint16Array(e),l.HEAPU32=B=new Uint32Array(e),l.HEAPF32=new Float32Array(e),l.HEAPF64=z=new Float64Array(e)}v&&(D=l.buffer);var H=l.INITIAL_MEMORY||16777216;if(v)O=l.wasmMemory,D=l.buffer;else if(l.wasmMemory)O=l.wasmMemory;else if(!((O=new WebAssembly.Memory({initial:H/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw C("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"),T&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");O&&(D=O.buffer),H=D.byteLength,W(D);var X,Q=[],Y=[],K=[],Z=[];function J(){return E||!1}function ee(){var e=l.preRun.shift();Q.unshift(e)}var te,ne=0,re=null,oe=null;function ie(e){throw v?postMessage({cmd:"onAbort",arg:e}):l.onAbort&&l.onAbort(e),C(e="Aborted("+e+")"),R=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),u(e),e}function se(){return te.startsWith("data:application/octet-stream;base64,")}function ae(){var e=te;try{if(e==te&&A)return new Uint8Array(A);if(_)return _(e);throw"both async and sync fetching of the wasm failed"}catch(e){ie(e)}}te="ort-wasm-threaded.wasm",se()||(te=M(te));var le={};function ce(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function ue(e){(e=he.Vb[e])||ie(),he.mc(e)}function pe(e){var t=he.Cc();if(!t)return 6;he.ac.push(t),he.Vb[e.Ub]=t,t.Ub=e.Ub;var n={cmd:"run",start_routine:e.Ic,arg:e.zc,pthread_ptr:e.Ub};return t.$b=()=>{n.time=performance.now(),t.postMessage(n,e.Nc)},t.loaded&&(t.$b(),delete t.$b),0}function de(e){if(v)return He(1,1,e);J()||(he.oc(),l.onExit&&l.onExit(e),R=!0),w(e,new ce(e))}function _e(e,t){if(!t&&v)throw me(e),"unwind";J()||v||(gt(),fe(K),mt(0),rt[1].length&&ot(1,10),rt[2].length&&ot(2,10),he.oc()),de(e)}var he={Yb:[],ac:[],qc:[],Vb:{},fc:function(){v&&he.Ec()},Pc:function(){},Ec:function(){he.receiveObjectTransfer=he.Gc,he.threadInitTLS=he.pc,he.setExitStatus=he.nc,E=!1},nc:function(){},oc:function(){for(var e of Object.values(he.Vb))he.mc(e);for(e of he.Yb)e.terminate();he.Yb=[]},mc:function(e){var t=e.Ub;delete he.Vb[t],he.Yb.push(e),he.ac.splice(he.ac.indexOf(e),1),e.Ub=0,Tt(t)},Gc:function(){},pc:function(){he.qc.forEach((e=>e()))},Fc:function(e,t){e.onmessage=n=>{var r=(n=n.data).cmd;if(e.Ub&&(he.Bc=e.Ub),n.targetThread&&n.targetThread!=_t()){var o=he.Vb[n.Qc];o?o.postMessage(n,n.transferList):C('Internal error! Worker sent a message "'+r+'" to target pthread '+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?je(n.queue):"spawnThread"===r?pe(n):"cleanupThread"===r?ue(n.thread):"killThread"===r?(n=n.thread,r=he.Vb[n],delete he.Vb[n],r.terminate(),Tt(n),he.ac.splice(he.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?he.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(e.loaded=!0,t&&t(e),e.$b&&(e.$b(),delete e.$b)):"print"===r?F("Thread "+n.threadId+": "+n.text):"printErr"===r?C("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?e.postMessage(n):"onAbort"===r?l.onAbort&&l.onAbort(n.arg):r&&C("worker sent an unknown command "+r);he.Bc=void 0},e.onerror=e=>{throw C("worker sent an error! "+e.filename+":"+e.lineno+": "+e.message),e},T&&(e.on("message",(function(t){e.onmessage({data:t})})),e.on("error",(function(t){e.onerror(t)})),e.on("detachedExit",(function(){}))),e.postMessage({cmd:"load",urlOrBlob:l.mainScriptUrlOrBlob||r,wasmMemory:O,wasmModule:I})},yc:function(){var e=M("ort-wasm-threaded.worker.js");he.Yb.push(new Worker(e))},Cc:function(){return 0==he.Yb.length&&(he.yc(),he.Fc(he.Yb[0])),he.Yb.pop()}};function fe(e){for(;0<e.length;)e.shift()(l)}function me(e){if(v)return He(2,0,e);try{_e(e)}catch(e){e instanceof ce||"unwind"==e||w(1,e)}}l.PThread=he,l.establishStackSpace=function(){var e=_t(),t=i()[e+44>>2>>>0];e=i()[e+48>>2>>>0],Mt(t,t-e),Pt(t)};var ge=[];function be(e){var t=ge[e];return t||(e>=ge.length&&(ge.length=e+1),ge[e]=t=X.get(e)),t}l.invokeEntryPoint=function(e,t){e=be(e)(t),J()?he.nc(e):vt(e)};var we,xe,ye=[],Te=0,ve=0;function ke(e){this.Zb=e,this.Sb=e-24,this.xc=function(e){s()[this.Sb+4>>2>>>0]=e},this.bc=function(){return s()[this.Sb+4>>2>>>0]},this.wc=function(e){s()[this.Sb+8>>2>>>0]=e},this.Dc=function(){return s()[this.Sb+8>>2>>>0]},this.rc=function(){i()[this.Sb>>2>>>0]=0},this.hc=function(e){e=e?1:0,t()[this.Sb+12>>0>>>0]=e},this.uc=function(){return 0!=t()[this.Sb+12>>0>>>0]},this.ic=function(e){e=e?1:0,t()[this.Sb+13>>0>>>0]=e},this.kc=function(){return 0!=t()[this.Sb+13>>0>>>0]},this.fc=function(e,t){this.cc(0),this.xc(e),this.wc(t),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(i(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(i(),this.Sb>>2,1)},this.cc=function(e){s()[this.Sb+16>>2>>>0]=e},this.tc=function(){return s()[this.Sb+16>>2>>>0]},this.vc=function(){if(Ct(this.bc()))return s()[this.Zb>>2>>>0];var e=this.tc();return 0!==e?e:this.Zb}}function Me(e){return ft(new ke(e).Sb)}function Se(e,t,n,r){return v?He(3,1,e,t,n,r):Pe(e,t,n,r)}function Pe(e,t,n,r){if("undefined"==typeof SharedArrayBuffer)return C("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var o=[];return v&&0===o.length?Se(e,t,n,r):(e={Ic:n,Ub:e,zc:r,Nc:o},v?(e.Oc="spawnThread",postMessage(e,o),0):pe(e))}function Ae(e,t,n){return v?He(4,1,e,t,n):0}function Fe(e,t){if(v)return He(5,1,e,t)}function Ce(e,t){if(v)return He(6,1,e,t)}function Ee(e,t,n){if(v)return He(7,1,e,t,n)}function Oe(e,t,n){return v?He(8,1,e,t,n):0}function Ie(e,t){if(v)return He(9,1,e,t)}function De(e,t,n){if(v)return He(10,1,e,t,n)}function Le(e,t,n,r){if(v)return He(11,1,e,t,n,r)}function Ne(e,t,n,r){if(v)return He(12,1,e,t,n,r)}function $e(e,t,n,r){if(v)return He(13,1,e,t,n,r)}function Be(e){if(v)return He(14,1,e)}function ze(e,t){if(v)return He(15,1,e,t)}function Re(e,t,n){if(v)return He(16,1,e,t,n)}function je(e){Atomics.store(i(),e>>2,1),_t()&&yt(e),Atomics.compareExchange(i(),e>>2,1,0)}function Ve(e){return s()[e>>>2]+4294967296*i()[e+4>>>2]}function Ue(e,t,n,r,o,i){return v?He(17,1,e,t,n,r,o,i):-52}function Ge(e,t,n,r,o,i){if(v)return He(18,1,e,t,n,r,o,i)}function qe(e){var n=q(e)+1,r=ht(n);return r&&G(e,t(),r,n),r}function We(e,t,n){function r(e){return(e=e.toTimeString().match(/\(([A-Za-z ]+)\)$/))?e[1]:"GMT"}if(v)return He(19,1,e,t,n);var o=(new Date).getFullYear(),a=new Date(o,0,1),l=new Date(o,6,1);o=a.getTimezoneOffset();var c=l.getTimezoneOffset(),u=Math.max(o,c);i()[e>>2>>>0]=60*u,i()[t>>2>>>0]=Number(o!=c),e=r(a),t=r(l),e=qe(e),t=qe(t),c<o?(s()[n>>2>>>0]=e,s()[n+4>>2>>>0]=t):(s()[n>>2>>>0]=t,s()[n+4>>2>>>0]=e)}function He(e,t){var n=arguments.length-2,r=arguments;return function(e){var t=St();return e=e(),Pt(t),e}((()=>{for(var o=At(8*n),i=o>>3,s=0;s<n;s++){var l=r[2+s];a()[i+s>>>0]=l}return xt(e,n,o,t)}))}l.executeNotifiedProxyingQueue=je,xe=T?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:v?()=>performance.now()-l.__performance_now_clock_drift:()=>performance.now();var Xe,Qe=[],Ye={};function Ke(){if(!Xe){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",_:b||"./this.program"};for(e in Ye)void 0===Ye[e]?delete t[e]:t[e]=Ye[e];var n=[];for(e in t)n.push(e+"="+t[e]);Xe=n}return Xe}function Ze(e,n){if(v)return He(20,1,e,n);var r=0;return Ke().forEach((function(o,i){var a=n+r;for(i=s()[e+4*i>>2>>>0]=a,a=0;a<o.length;++a)t()[i++>>0>>>0]=o.charCodeAt(a);t()[i>>0>>>0]=0,r+=o.length+1})),0}function Je(e,t){if(v)return He(21,1,e,t);var n=Ke();s()[e>>2>>>0]=n.length;var r=0;return n.forEach((function(e){r+=e.length+1})),s()[t>>2>>>0]=r,0}function et(e){return v?He(22,1,e):52}function tt(e,t,n,r){return v?He(23,1,e,t,n,r):52}function nt(e,t,n,r,o){return v?He(24,1,e,t,n,r,o):70}var rt=[null,[],[]];function ot(e,t){var n=rt[e];0===t||10===t?((1===e?F:C)(V(n,0)),n.length=0):n.push(t)}function it(e,t,n,r){if(v)return He(25,1,e,t,n,r);for(var i=0,a=0;a<n;a++){var l=s()[t>>2>>>0],c=s()[t+4>>2>>>0];t+=8;for(var u=0;u<c;u++)ot(e,o()[l+u>>>0]);i+=c}return s()[r>>2>>>0]=i,0}var st=0;function at(e){return 0==e%4&&(0!=e%100||0==e%400)}var lt=[31,29,31,30,31,30,31,31,30,31,30,31],ct=[31,28,31,30,31,30,31,31,30,31,30,31];function ut(e,n,r,o){function s(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.length<t;)e=n[0]+e;return e}function a(e,t){return s(e,t,"0")}function l(e,t){function n(e){return 0>e?-1:0<e?1:0}var r;return 0===(r=n(e.getFullYear()-t.getFullYear()))&&0===(r=n(e.getMonth()-t.getMonth()))&&(r=n(e.getDate()-t.getDate())),r}function c(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.Wb;for(e=new Date(new Date(e.Xb+1900,0,1).getTime());0<t;){var n=e.getMonth(),r=(at(e.getFullYear())?lt:ct)[n];if(!(t>r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),11>n?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return n=new Date(e.getFullYear()+1,0,4),t=c(new Date(e.getFullYear(),0,4)),n=c(n),0>=l(t,e)?0>=l(n,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var p=i()[o+40>>2>>>0];for(var d in o={Lc:i()[o>>2>>>0],Kc:i()[o+4>>2>>>0],dc:i()[o+8>>2>>>0],jc:i()[o+12>>2>>>0],ec:i()[o+16>>2>>>0],Xb:i()[o+20>>2>>>0],Tb:i()[o+24>>2>>>0],Wb:i()[o+28>>2>>>0],Rc:i()[o+32>>2>>>0],Jc:i()[o+36>>2>>>0],Mc:p?U(p):""},r=U(r),p={"%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(d,"g"),p[d]);var _="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),h="January February March April May June July August September October November December".split(" ");for(d in p={"%a":function(e){return _[e.Tb].substring(0,3)},"%A":function(e){return _[e.Tb]},"%b":function(e){return h[e.ec].substring(0,3)},"%B":function(e){return h[e.ec]},"%C":function(e){return a((e.Xb+1900)/100|0,2)},"%d":function(e){return a(e.jc,2)},"%e":function(e){return s(e.jc,2," ")},"%g":function(e){return u(e).toString().substring(2)},"%G":function(e){return u(e)},"%H":function(e){return a(e.dc,2)},"%I":function(e){return 0==(e=e.dc)?e=12:12<e&&(e-=12),a(e,2)},"%j":function(e){for(var t=0,n=0;n<=e.ec-1;t+=(at(e.Xb+1900)?lt:ct)[n++]);return a(e.jc+t,3)},"%m":function(e){return a(e.ec+1,2)},"%M":function(e){return a(e.Kc,2)},"%n":function(){return"\n"},"%p":function(e){return 0<=e.dc&&12>e.dc?"AM":"PM"},"%S":function(e){return a(e.Lc,2)},"%t":function(){return"\t"},"%u":function(e){return e.Tb||7},"%U":function(e){return a(Math.floor((e.Wb+7-e.Tb)/7),2)},"%V":function(e){var t=Math.floor((e.Wb+7-(e.Tb+6)%7)/7);if(2>=(e.Tb+371-e.Wb-2)%7&&t++,t)53==t&&(4==(n=(e.Tb+371-e.Wb)%7)||3==n&&at(e.Xb)||(t=1));else{t=52;var n=(e.Tb+7-e.Wb-1)%7;(4==n||5==n&&at(e.Xb%400-1))&&t++}return a(t,2)},"%w":function(e){return e.Tb},"%W":function(e){return a(Math.floor((e.Wb+7-(e.Tb+6)%7)/7),2)},"%y":function(e){return(e.Xb+1900).toString().substring(2)},"%Y":function(e){return e.Xb+1900},"%z":function(e){var t=0<=(e=e.Jc);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\0\0"),p)r.includes(d)&&(r=r.replace(new RegExp(d,"g"),p[d](o)));return d=function(e){var t=Array(q(e)+1);return G(e,t,0,t.length),t}(r=r.replace(/\0\0/g,"%")),d.length>n?0:(function(e,n){t().set(e,n>>>0)}(d,e),d.length-1)}he.fc();var pt=[null,de,me,Se,Ae,Fe,Ce,Ee,Oe,Ie,De,Le,Ne,$e,Be,ze,Re,Ue,Ge,We,Ze,Je,et,tt,nt,it],dt={b:function(e){return ht(e+24)+24},n:function(e){return(e=new ke(e)).uc()||(e.hc(!0),Te--),e.ic(!1),ye.push(e),e.sc(),e.vc()},ma:function(e){throw C("Unexpected exception thrown, this is not properly supported - aborting"),R=!0,e},x:function(){kt(0);var e=ye.pop();if(e.Hc()&&!e.kc()){var t=e.Dc();t&&be(t)(e.Zb),Me(e.Zb)}ve=0},e:function(){var e=ve;if(!e)return st=0;var t=new ke(e);t.cc(e);var n=t.bc();if(!n)return st=0,e;for(var r=Array.prototype.slice.call(arguments),o=0;o<r.length;o++){var i=r[o];if(0===i||i===n)break;if(Ft(i,n,t.Sb+16))return st=i,e}return st=n,e},l:function(){var e=ve;if(!e)return st=0;var t=new ke(e);t.cc(e);var n=t.bc();if(!n)return st=0,e;for(var r=Array.prototype.slice.call(arguments),o=0;o<r.length;o++){var i=r[o];if(0===i||i===n)break;if(Ft(i,n,t.Sb+16))return st=i,e}return st=n,e},h:function(){var e=ve;if(!e)return st=0;var t=new ke(e);t.cc(e);var n=t.bc();if(!n)return st=0,e;for(var r=Array.prototype.slice.call(arguments),o=0;o<r.length;o++){var i=r[o];if(0===i||i===n)break;if(Ft(i,n,t.Sb+16))return st=i,e}return st=n,e},t:Me,M:function(){var e=ye.pop();e||ie("no exception to throw");var t=e.Zb;throw e.kc()||(ye.push(e),e.ic(!0),e.hc(!1),Te++),ve=t,t},c:function(e,t,n){throw new ke(e).fc(t,n),ve=e,Te++,e},pa:function(){return Te},Fa:function(e){bt(e,!y,1,!x),he.pc()},T:function(e){v?postMessage({cmd:"cleanupThread",thread:e}):ue(e)},xa:Pe,j:function(e){throw ve||(ve=e),e},H:Ae,Ma:Fe,ua:Ce,wa:Ee,oa:Oe,Ka:Ie,Ca:De,Ja:Le,V:Ne,va:$e,sa:Be,La:ze,ta:Re,Ta:function(){},X:function(){ie("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ua:function(){ie("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},W:function(){return Date.now()},ya:function(){return 2097152},Oa:function(){return!0},za:function(e,t,n,r){if(e==t)setTimeout((()=>je(r)));else if(v)postMessage({targetThread:e,cmd:"processProxyingQueue",queue:r});else{if(!(e=he.Vb[e]))return;e.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(e,t){e=new Date(1e3*Ve(e)),i()[t>>2>>>0]=e.getUTCSeconds(),i()[t+4>>2>>>0]=e.getUTCMinutes(),i()[t+8>>2>>>0]=e.getUTCHours(),i()[t+12>>2>>>0]=e.getUTCDate(),i()[t+16>>2>>>0]=e.getUTCMonth(),i()[t+20>>2>>>0]=e.getUTCFullYear()-1900,i()[t+24>>2>>>0]=e.getUTCDay(),e=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,i()[t+28>>2>>>0]=e},Qa:function(e,t){e=new Date(1e3*Ve(e)),i()[t>>2>>>0]=e.getSeconds(),i()[t+4>>2>>>0]=e.getMinutes(),i()[t+8>>2>>>0]=e.getHours(),i()[t+12>>2>>>0]=e.getDate(),i()[t+16>>2>>>0]=e.getMonth(),i()[t+20>>2>>>0]=e.getFullYear()-1900,i()[t+24>>2>>>0]=e.getDay();var n=new Date(e.getFullYear(),0,1),r=(e.getTime()-n.getTime())/864e5|0;i()[t+28>>2>>>0]=r,i()[t+36>>2>>>0]=-60*e.getTimezoneOffset(),r=new Date(e.getFullYear(),6,1).getTimezoneOffset(),e=0|(r!=(n=n.getTimezoneOffset())&&e.getTimezoneOffset()==Math.min(n,r)),i()[t+32>>2>>>0]=e},Ra:function(e){var t=new Date(i()[e+20>>2>>>0]+1900,i()[e+16>>2>>>0],i()[e+12>>2>>>0],i()[e+8>>2>>>0],i()[e+4>>2>>>0],i()[e>>2>>>0],0),n=i()[e+32>>2>>>0],r=t.getTimezoneOffset(),o=new Date(t.getFullYear(),0,1),s=new Date(t.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),l=Math.min(a,s);return 0>n?i()[e+32>>2>>>0]=Number(s!=a&&l==r):0<n!=(l==r)&&(s=Math.max(a,s),t.setTime(t.getTime()+6e4*((0<n?l:s)-r))),i()[e+24>>2>>>0]=t.getDay(),n=(t.getTime()-o.getTime())/864e5|0,i()[e+28>>2>>>0]=n,i()[e>>2>>>0]=t.getSeconds(),i()[e+4>>2>>>0]=t.getMinutes(),i()[e+8>>2>>>0]=t.getHours(),i()[e+12>>2>>>0]=t.getDate(),i()[e+16>>2>>>0]=t.getMonth(),t.getTime()/1e3|0},Aa:Ue,Ba:Ge,Sa:function e(t,n,r){e.Ac||(e.Ac=!0,We(t,n,r))},y:function(){ie("")},U:function(){if(!T&&!y){var e="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";we||(we={}),we[e]||(we[e]=1,T&&(e="warning: "+e),C(e))}},ra:function(){return 4294901760},B:xe,Ia:function(e,t,n){o().copyWithin(e>>>0,t>>>0,t+n>>>0)},F:function(){return T?n(3993).cpus().length:navigator.hardwareConcurrency},Da:function(e,t,n){Qe.length=t,n>>=3;for(var r=0;r<t;r++)Qe[r]=a()[n+r>>>0];return(0>e?le[-e-1]:pt[e]).apply(null,Qe)},qa:function(e){var t=o().length;if((e>>>=0)<=t||4294901760<e)return!1;for(var n=1;4>=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296);var i=Math;r=Math.max(e,r),i=i.min.call(i,4294901760,r+(65536-r%65536)%65536);e:{try{O.grow(i-D.byteLength+65535>>>16),W(O.buffer);var s=1;break e}catch(e){}s=void 0}if(s)return!0}return!1},Na:function(){throw"unwind"},Ga:Ze,Ha:Je,J:_e,I:et,S:tt,ga:nt,R:it,d:function(){return st},na:function e(r,o){e.lc||(e.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return()=>(crypto.getRandomValues(e),e[0])}if(T)try{var t=n(Object(function(){var e=new Error("Cannot find module 'crypto'");throw e.code="MODULE_NOT_FOUND",e}()));return()=>t.randomBytes(1)[0]}catch(e){}return()=>ie("randomDevice")}());for(var i=0;i<o;i++)t()[r+i>>0>>>0]=e.lc();return 0},ia:function(e,t,n){var r=St();try{return be(e)(t,n)}catch(e){if(Pt(r),e!==e+0)throw e;kt(1,0)}},ja:function(e,t,n){var r=St();try{return be(e)(t,n)}catch(e){if(Pt(r),e!==e+0)throw e;kt(1,0)}},K:function(e){var t=St();try{return be(e)()}catch(e){if(Pt(t),e!==e+0)throw e;kt(1,0)}},f:function(e,t){var n=St();try{return be(e)(t)}catch(e){if(Pt(n),e!==e+0)throw e;kt(1,0)}},P:function(e,t,n){var r=St();try{return be(e)(t,n)}catch(e){if(Pt(r),e!==e+0)throw e;kt(1,0)}},Q:function(e,t,n){var r=St();try{return be(e)(t,n)}catch(e){if(Pt(r),e!==e+0)throw e;kt(1,0)}},k:function(e,t,n){var r=St();try{return be(e)(t,n)}catch(e){if(Pt(r),e!==e+0)throw e;kt(1,0)}},p:function(e,t,n,r){var o=St();try{return be(e)(t,n,r)}catch(e){if(Pt(o),e!==e+0)throw e;kt(1,0)}},q:function(e,t,n,r,o){var i=St();try{return be(e)(t,n,r,o)}catch(e){if(Pt(i),e!==e+0)throw e;kt(1,0)}},N:function(e,t,n,r,o,i){var s=St();try{return be(e)(t,n,r,o,i)}catch(e){if(Pt(s),e!==e+0)throw e;kt(1,0)}},s:function(e,t,n,r,o,i){var s=St();try{return be(e)(t,n,r,o,i)}catch(e){if(Pt(s),e!==e+0)throw e;kt(1,0)}},w:function(e,t,n,r,o,i,s){var a=St();try{return be(e)(t,n,r,o,i,s)}catch(e){if(Pt(a),e!==e+0)throw e;kt(1,0)}},L:function(e,t,n,r,o,i,s,a){var l=St();try{return be(e)(t,n,r,o,i,s,a)}catch(e){if(Pt(l),e!==e+0)throw e;kt(1,0)}},E:function(e,t,n,r,o,i,s,a,l,c,u,p){var d=St();try{return be(e)(t,n,r,o,i,s,a,l,c,u,p)}catch(e){if(Pt(d),e!==e+0)throw e;kt(1,0)}},aa:function(e,t,n,r,o,i,s,a){var l=St();try{return zt(e,t,n,r,o,i,s,a)}catch(e){if(Pt(l),e!==e+0)throw e;kt(1,0)}},_:function(e,t,n,r,o,i,s){var a=St();try{return Ot(e,t,n,r,o,i,s)}catch(e){if(Pt(a),e!==e+0)throw e;kt(1,0)}},Z:function(e,t,n,r,o){var i=St();try{return Rt(e,t,n,r,o)}catch(e){if(Pt(i),e!==e+0)throw e;kt(1,0)}},ca:function(e,t,n,r){var o=St();try{return $t(e,t,n,r)}catch(e){if(Pt(o),e!==e+0)throw e;kt(1,0)}},$:function(e){var t=St();try{return Et(e)}catch(e){if(Pt(t),e!==e+0)throw e;kt(1,0)}},ba:function(e,t){var n=St();try{return Bt(e,t)}catch(e){if(Pt(n),e!==e+0)throw e;kt(1,0)}},Y:function(e,t,n){var r=St();try{return It(e,t,n)}catch(e){if(Pt(r),e!==e+0)throw e;kt(1,0)}},g:function(e){var t=St();try{be(e)()}catch(e){if(Pt(t),e!==e+0)throw e;kt(1,0)}},r:function(e,t){var n=St();try{be(e)(t)}catch(e){if(Pt(n),e!==e+0)throw e;kt(1,0)}},i:function(e,t,n){var r=St();try{be(e)(t,n)}catch(e){if(Pt(r),e!==e+0)throw e;kt(1,0)}},ha:function(e,t,n,r){var o=St();try{be(e)(t,n,r)}catch(e){if(Pt(o),e!==e+0)throw e;kt(1,0)}},m:function(e,t,n,r){var o=St();try{be(e)(t,n,r)}catch(e){if(Pt(o),e!==e+0)throw e;kt(1,0)}},v:function(e,t,n,r,o){var i=St();try{be(e)(t,n,r,o)}catch(e){if(Pt(i),e!==e+0)throw e;kt(1,0)}},u:function(e,t,n,r,o,i){var s=St();try{be(e)(t,n,r,o,i)}catch(e){if(Pt(s),e!==e+0)throw e;kt(1,0)}},O:function(e,t,n,r,o,i,s){var a=St();try{be(e)(t,n,r,o,i,s)}catch(e){if(Pt(a),e!==e+0)throw e;kt(1,0)}},A:function(e,t,n,r,o,i,s,a){var l=St();try{be(e)(t,n,r,o,i,s,a)}catch(e){if(Pt(l),e!==e+0)throw e;kt(1,0)}},ka:function(e,t,n,r,o,i,s,a,l){var c=St();try{be(e)(t,n,r,o,i,s,a,l)}catch(e){if(Pt(c),e!==e+0)throw e;kt(1,0)}},C:function(e,t,n,r,o,i,s,a,l,c,u){var p=St();try{be(e)(t,n,r,o,i,s,a,l,c,u)}catch(e){if(Pt(p),e!==e+0)throw e;kt(1,0)}},D:function(e,t,n,r,o,i,s,a,l,c,u,p,d,_,h,f){var m=St();try{be(e)(t,n,r,o,i,s,a,l,c,u,p,d,_,h,f)}catch(e){if(Pt(m),e!==e+0)throw e;kt(1,0)}},fa:function(e,t,n,r,o,i,s,a){var l=St();try{Dt(e,t,n,r,o,i,s,a)}catch(e){if(Pt(l),e!==e+0)throw e;kt(1,0)}},da:function(e,t,n,r,o,i,s,a,l,c,u,p){var d=St();try{Nt(e,t,n,r,o,i,s,a,l,c,u,p)}catch(e){if(Pt(d),e!==e+0)throw e;kt(1,0)}},ea:function(e,t,n,r,o,i){var s=St();try{Lt(e,t,n,r,o,i)}catch(e){if(Pt(s),e!==e+0)throw e;kt(1,0)}},o:function(e){return e},a:O||l.wasmMemory,G:function(e){st=e},la:ut,z:function(e,t,n,r){return ut(e,t,n,r)}};!function(){function e(e,t){l.asm=e.exports,he.qc.push(l.asm.sb),X=l.asm.ub,Y.unshift(l.asm.Va),I=t,v||(ne--,l.monitorRunDependencies&&l.monitorRunDependencies(ne),0==ne&&(null!==re&&(clearInterval(re),re=null),oe&&(e=oe,oe=null,e())))}function t(t){e(t.instance,t.module)}function n(e){return function(){if(!A&&(x||y)){if("function"==typeof fetch&&!te.startsWith("file://"))return fetch(te,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+te+"'";return e.arrayBuffer()})).catch((function(){return ae()}));if(d)return new Promise((function(e,t){d(te,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return ae()}))}().then((function(e){return WebAssembly.instantiate(e,r)})).then((function(e){return e})).then(e,(function(e){C("failed to asynchronously prepare wasm: "+e),ie(e)}))}var r={a:dt};if(v||(ne++,l.monitorRunDependencies&&l.monitorRunDependencies(ne)),l.instantiateWasm)try{return l.instantiateWasm(r,e)}catch(e){return C("Module.instantiateWasm callback failed with error: "+e),!1}(A||"function"!=typeof WebAssembly.instantiateStreaming||se()||te.startsWith("file://")||T||"function"!=typeof fetch?n(t):fetch(te,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,r).then(t,(function(e){return C("wasm streaming compile failed: "+e),C("falling back to ArrayBuffer instantiation"),n(t)}))}))).catch(u)}(),l.___wasm_call_ctors=function(){return(l.___wasm_call_ctors=l.asm.Va).apply(null,arguments)},l._OrtInit=function(){return(l._OrtInit=l.asm.Wa).apply(null,arguments)},l._OrtCreateSessionOptions=function(){return(l._OrtCreateSessionOptions=l.asm.Xa).apply(null,arguments)},l._OrtAppendExecutionProvider=function(){return(l._OrtAppendExecutionProvider=l.asm.Ya).apply(null,arguments)},l._OrtAddSessionConfigEntry=function(){return(l._OrtAddSessionConfigEntry=l.asm.Za).apply(null,arguments)},l._OrtReleaseSessionOptions=function(){return(l._OrtReleaseSessionOptions=l.asm._a).apply(null,arguments)},l._OrtCreateSession=function(){return(l._OrtCreateSession=l.asm.$a).apply(null,arguments)},l._OrtReleaseSession=function(){return(l._OrtReleaseSession=l.asm.ab).apply(null,arguments)},l._OrtGetInputCount=function(){return(l._OrtGetInputCount=l.asm.bb).apply(null,arguments)},l._OrtGetOutputCount=function(){return(l._OrtGetOutputCount=l.asm.cb).apply(null,arguments)},l._OrtGetInputName=function(){return(l._OrtGetInputName=l.asm.db).apply(null,arguments)},l._OrtGetOutputName=function(){return(l._OrtGetOutputName=l.asm.eb).apply(null,arguments)},l._OrtFree=function(){return(l._OrtFree=l.asm.fb).apply(null,arguments)},l._OrtCreateTensor=function(){return(l._OrtCreateTensor=l.asm.gb).apply(null,arguments)},l._OrtGetTensorData=function(){return(l._OrtGetTensorData=l.asm.hb).apply(null,arguments)},l._OrtReleaseTensor=function(){return(l._OrtReleaseTensor=l.asm.ib).apply(null,arguments)},l._OrtCreateRunOptions=function(){return(l._OrtCreateRunOptions=l.asm.jb).apply(null,arguments)},l._OrtAddRunConfigEntry=function(){return(l._OrtAddRunConfigEntry=l.asm.kb).apply(null,arguments)},l._OrtReleaseRunOptions=function(){return(l._OrtReleaseRunOptions=l.asm.lb).apply(null,arguments)},l._OrtRun=function(){return(l._OrtRun=l.asm.mb).apply(null,arguments)},l._OrtEndProfiling=function(){return(l._OrtEndProfiling=l.asm.nb).apply(null,arguments)};var _t=l._pthread_self=function(){return(_t=l._pthread_self=l.asm.ob).apply(null,arguments)},ht=l._malloc=function(){return(ht=l._malloc=l.asm.pb).apply(null,arguments)},ft=l._free=function(){return(ft=l._free=l.asm.qb).apply(null,arguments)},mt=l._fflush=function(){return(mt=l._fflush=l.asm.rb).apply(null,arguments)};l.__emscripten_tls_init=function(){return(l.__emscripten_tls_init=l.asm.sb).apply(null,arguments)};var gt=l.___funcs_on_exit=function(){return(gt=l.___funcs_on_exit=l.asm.tb).apply(null,arguments)},bt=l.__emscripten_thread_init=function(){return(bt=l.__emscripten_thread_init=l.asm.vb).apply(null,arguments)};l.__emscripten_thread_crashed=function(){return(l.__emscripten_thread_crashed=l.asm.wb).apply(null,arguments)};var wt,xt=l._emscripten_run_in_main_runtime_thread_js=function(){return(xt=l._emscripten_run_in_main_runtime_thread_js=l.asm.xb).apply(null,arguments)},yt=l.__emscripten_proxy_execute_task_queue=function(){return(yt=l.__emscripten_proxy_execute_task_queue=l.asm.yb).apply(null,arguments)},Tt=l.__emscripten_thread_free_data=function(){return(Tt=l.__emscripten_thread_free_data=l.asm.zb).apply(null,arguments)},vt=l.__emscripten_thread_exit=function(){return(vt=l.__emscripten_thread_exit=l.asm.Ab).apply(null,arguments)},kt=l._setThrew=function(){return(kt=l._setThrew=l.asm.Bb).apply(null,arguments)},Mt=l._emscripten_stack_set_limits=function(){return(Mt=l._emscripten_stack_set_limits=l.asm.Cb).apply(null,arguments)},St=l.stackSave=function(){return(St=l.stackSave=l.asm.Db).apply(null,arguments)},Pt=l.stackRestore=function(){return(Pt=l.stackRestore=l.asm.Eb).apply(null,arguments)},At=l.stackAlloc=function(){return(At=l.stackAlloc=l.asm.Fb).apply(null,arguments)},Ft=l.___cxa_can_catch=function(){return(Ft=l.___cxa_can_catch=l.asm.Gb).apply(null,arguments)},Ct=l.___cxa_is_pointer_type=function(){return(Ct=l.___cxa_is_pointer_type=l.asm.Hb).apply(null,arguments)},Et=l.dynCall_j=function(){return(Et=l.dynCall_j=l.asm.Ib).apply(null,arguments)},Ot=l.dynCall_iiiiij=function(){return(Ot=l.dynCall_iiiiij=l.asm.Jb).apply(null,arguments)},It=l.dynCall_jii=function(){return(It=l.dynCall_jii=l.asm.Kb).apply(null,arguments)},Dt=l.dynCall_viiiiij=function(){return(Dt=l.dynCall_viiiiij=l.asm.Lb).apply(null,arguments)},Lt=l.dynCall_vjji=function(){return(Lt=l.dynCall_vjji=l.asm.Mb).apply(null,arguments)},Nt=l.dynCall_viiijjjii=function(){return(Nt=l.dynCall_viiijjjii=l.asm.Nb).apply(null,arguments)},$t=l.dynCall_iij=function(){return($t=l.dynCall_iij=l.asm.Ob).apply(null,arguments)},Bt=l.dynCall_ji=function(){return(Bt=l.dynCall_ji=l.asm.Pb).apply(null,arguments)},zt=l.dynCall_iiiiiij=function(){return(zt=l.dynCall_iiiiiij=l.asm.Qb).apply(null,arguments)},Rt=l.dynCall_iiij=function(){return(Rt=l.dynCall_iiij=l.asm.Rb).apply(null,arguments)};function jt(){function e(){if(!wt&&(wt=!0,l.calledRun=!0,!R)&&(v||fe(Y),c(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),!v)){if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;){var e=l.postRun.shift();Z.unshift(e)}fe(Z)}}if(!(0<ne))if(v)c(l),v||fe(Y),postMessage({cmd:"loaded"});else{if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)ee();fe(Q),0<ne||(l.setStatus?(l.setStatus("Running..."),setTimeout((function(){setTimeout((function(){l.setStatus("")}),1),e()}),1)):e())}}if(l.UTF8ToString=U,l.stringToUTF8=function(e,t,n){return G(e,o(),t,n)},l.lengthBytesUTF8=q,l.keepRuntimeAlive=J,l.wasmMemory=O,l.stackSave=St,l.stackRestore=Pt,l.stackAlloc=At,l.ExitStatus=ce,l.PThread=he,oe=function e(){wt||jt(),wt||(oe=e)},l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.pop()();return jt(),e.ready});e.exports=o},932:(e,t,n)=>{var r,o=(r=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){var t,o,i;e=e||{},t||(t=void 0!==e?e:{}),t.ready=new Promise((function(e,t){o=e,i=t}));var s,a,l,c,u,p,d=Object.assign({},t),_="./this.program",h=(e,t)=>{throw t},f="object"==typeof window,m="function"==typeof importScripts,g="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,b="";g?(b=m?n(908).dirname(b)+"/":"//",p=()=>{u||(c=n(1384),u=n(908))},s=function(e,t){return p(),e=u.normalize(e),c.readFileSync(e,t?void 0:"utf8")},l=e=>((e=s(e,!0)).buffer||(e=new Uint8Array(e)),e),a=(e,t,n)=>{p(),e=u.normalize(e),c.readFile(e,(function(e,r){e?n(e):t(r.buffer)}))},1<process.argv.length&&(_=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof K))throw e})),process.on("unhandledRejection",(function(e){throw e})),h=(e,t)=>{if(T||0<j)throw process.exitCode=e,t;t instanceof K||y("exiting due to exception: "+t),process.exit(e)},t.inspect=function(){return"[Emscripten Module object]"}):(f||m)&&(m?b=self.location.href:"undefined"!=typeof document&&document.currentScript&&(b=document.currentScript.src),r&&(b=r),b=0!==b.indexOf("blob:")?b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},m&&(l=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,n)=>{var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)});var w,x=t.print||console.log.bind(console),y=t.printErr||console.warn.bind(console);Object.assign(t,d),d=null,t.thisProgram&&(_=t.thisProgram),t.quit&&(h=t.quit),t.wasmBinary&&(w=t.wasmBinary);var T=t.noExitRuntime||!1;"object"!=typeof WebAssembly&&H("no native wasm support detected");var v,k,M,S,P,A,F=!1,C="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function E(e,t,n){var r=(t>>>=0)+n;for(n=t;e[n]&&!(n>=r);)++n;if(16<n-t&&e.buffer&&C)return C.decode(e.subarray(t,n));for(r="";t<n;){var o=e[t++];if(128&o){var i=63&e[t++];if(192==(224&o))r+=String.fromCharCode((31&o)<<6|i);else{var s=63&e[t++];65536>(o=224==(240&o)?(15&o)<<12|i<<6|s:(7&o)<<18|i<<12|s<<6|63&e[t++])?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode(55296|o>>10,56320|1023&o))}}else r+=String.fromCharCode(o)}return r}function O(e,t){return(e>>>=0)?E(S,e,t):""}function I(e,t,n,r){if(!(0<r))return 0;var o=n>>>=0;r=n+r-1;for(var i=0;i<e.length;++i){var s=e.charCodeAt(i);if(55296<=s&&57343>=s&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),127>=s){if(n>=r)break;t[n++>>>0]=s}else{if(2047>=s){if(n+1>=r)break;t[n++>>>0]=192|s>>6}else{if(65535>=s){if(n+2>=r)break;t[n++>>>0]=224|s>>12}else{if(n+3>=r)break;t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63}t[n++>>>0]=128|s>>6&63}t[n++>>>0]=128|63&s}}return t[n>>>0]=0,n-o}function D(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);127>=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t}function L(){var e=v.buffer;k=e,t.HEAP8=M=new Int8Array(e),t.HEAP16=new Int16Array(e),t.HEAP32=P=new Int32Array(e),t.HEAPU8=S=new Uint8Array(e),t.HEAPU16=new Uint16Array(e),t.HEAPU32=A=new Uint32Array(e),t.HEAPF32=new Float32Array(e),t.HEAPF64=new Float64Array(e)}var N,$=[],B=[],z=[],R=[],j=0;function V(){var e=t.preRun.shift();$.unshift(e)}var U,G=0,q=null,W=null;function H(e){throw t.onAbort&&t.onAbort(e),y(e="Aborted("+e+")"),F=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),i(e),e}function X(){return U.startsWith("data:application/octet-stream;base64,")}if(U="ort-wasm.wasm",!X()){var Q=U;U=t.locateFile?t.locateFile(Q,b):b+Q}function Y(){var e=U;try{if(e==U&&w)return new Uint8Array(w);if(l)return l(e);throw"both async and sync fetching of the wasm failed"}catch(e){H(e)}}function K(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Z(e){for(;0<e.length;)e.shift()(t)}var J=[],ee=0,te=0;function ne(e){this.Db=e,this.zb=e-24,this.Ub=function(e){A[this.zb+4>>2>>>0]=e},this.Eb=function(){return A[this.zb+4>>2>>>0]},this.Sb=function(e){A[this.zb+8>>2>>>0]=e},this.Wb=function(){return A[this.zb+8>>2>>>0]},this.Tb=function(){P[this.zb>>2>>>0]=0},this.Ib=function(e){M[this.zb+12>>0>>>0]=e?1:0},this.Pb=function(){return 0!=M[this.zb+12>>0>>>0]},this.Jb=function(e){M[this.zb+13>>0>>>0]=e?1:0},this.Lb=function(){return 0!=M[this.zb+13>>0>>>0]},this.Rb=function(e,t){this.Fb(0),this.Ub(e),this.Sb(t),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){P[this.zb>>2>>>0]+=1},this.Xb=function(){var e=P[this.zb>>2>>>0];return P[this.zb>>2>>>0]=e-1,1===e},this.Fb=function(e){A[this.zb+16>>2>>>0]=e},this.Ob=function(){return A[this.zb+16>>2>>>0]},this.Qb=function(){if(Ae(this.Eb()))return A[this.Db>>2>>>0];var e=this.Ob();return 0!==e?e:this.Db}}function re(e){return xe(new ne(e).zb)}var oe=[];function ie(e){var t=oe[e];return t||(e>=oe.length&&(oe.length=e+1),oe[e]=t=N.get(e)),t}function se(e){var t=D(e)+1,n=we(t);return n&&I(e,M,n,t),n}var ae={};function le(){if(!ce){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",_:_||"./this.program"};for(e in ae)void 0===ae[e]?delete t[e]:t[e]=ae[e];var n=[];for(e in t)n.push(e+"="+t[e]);ce=n}return ce}var ce,ue=[null,[],[]];function pe(e,t){var n=ue[e];0===t||10===t?((1===e?x:y)(E(n,0)),n.length=0):n.push(t)}var de=0;function _e(e){return 0==e%4&&(0!=e%100||0==e%400)}var he=[31,29,31,30,31,30,31,31,30,31,30,31],fe=[31,28,31,30,31,30,31,31,30,31,30,31];function me(e,t,n,r){function o(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.length<t;)e=n[0]+e;return e}function i(e,t){return o(e,t,"0")}function s(e,t){function n(e){return 0>e?-1:0<e?1:0}var r;return 0===(r=n(e.getFullYear()-t.getFullYear()))&&0===(r=n(e.getMonth()-t.getMonth()))&&(r=n(e.getDate()-t.getDate())),r}function a(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 l(e){var t=e.Bb;for(e=new Date(new Date(e.Cb+1900,0,1).getTime());0<t;){var n=e.getMonth(),r=(_e(e.getFullYear())?he:fe)[n];if(!(t>r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),11>n?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return n=new Date(e.getFullYear()+1,0,4),t=a(new Date(e.getFullYear(),0,4)),n=a(n),0>=s(t,e)?0>=s(n,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var c=P[r+40>>2>>>0];for(var u in r={$b:P[r>>2>>>0],Zb:P[r+4>>2>>>0],Gb:P[r+8>>2>>>0],Kb:P[r+12>>2>>>0],Hb:P[r+16>>2>>>0],Cb:P[r+20>>2>>>0],Ab:P[r+24>>2>>>0],Bb:P[r+28>>2>>>0],bc:P[r+32>>2>>>0],Yb:P[r+36>>2>>>0],ac:c?O(c):""},n=O(n),c={"%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"})n=n.replace(new RegExp(u,"g"),c[u]);var p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(u in c={"%a":function(e){return p[e.Ab].substring(0,3)},"%A":function(e){return p[e.Ab]},"%b":function(e){return d[e.Hb].substring(0,3)},"%B":function(e){return d[e.Hb]},"%C":function(e){return i((e.Cb+1900)/100|0,2)},"%d":function(e){return i(e.Kb,2)},"%e":function(e){return o(e.Kb,2," ")},"%g":function(e){return l(e).toString().substring(2)},"%G":function(e){return l(e)},"%H":function(e){return i(e.Gb,2)},"%I":function(e){return 0==(e=e.Gb)?e=12:12<e&&(e-=12),i(e,2)},"%j":function(e){for(var t=0,n=0;n<=e.Hb-1;t+=(_e(e.Cb+1900)?he:fe)[n++]);return i(e.Kb+t,3)},"%m":function(e){return i(e.Hb+1,2)},"%M":function(e){return i(e.Zb,2)},"%n":function(){return"\n"},"%p":function(e){return 0<=e.Gb&&12>e.Gb?"AM":"PM"},"%S":function(e){return i(e.$b,2)},"%t":function(){return"\t"},"%u":function(e){return e.Ab||7},"%U":function(e){return i(Math.floor((e.Bb+7-e.Ab)/7),2)},"%V":function(e){var t=Math.floor((e.Bb+7-(e.Ab+6)%7)/7);if(2>=(e.Ab+371-e.Bb-2)%7&&t++,t)53==t&&(4==(n=(e.Ab+371-e.Bb)%7)||3==n&&_e(e.Cb)||(t=1));else{t=52;var n=(e.Ab+7-e.Bb-1)%7;(4==n||5==n&&_e(e.Cb%400-1))&&t++}return i(t,2)},"%w":function(e){return e.Ab},"%W":function(e){return i(Math.floor((e.Bb+7-(e.Ab+6)%7)/7),2)},"%y":function(e){return(e.Cb+1900).toString().substring(2)},"%Y":function(e){return e.Cb+1900},"%z":function(e){var t=0<=(e=e.Yb);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),c)n.includes(u)&&(n=n.replace(new RegExp(u,"g"),c[u](r)));return u=function(e){var t=Array(D(e)+1);return I(e,t,0,t.length),t}(n=n.replace(/\0\0/g,"%")),u.length>t?0:(M.set(u,e>>>0),u.length-1)}var ge={a:function(e){return we(e+24)+24},m:function(e){return(e=new ne(e)).Pb()||(e.Ib(!0),ee--),e.Jb(!1),J.push(e),e.Nb(),e.Qb()},ia:function(e){throw y("Unexpected exception thrown, this is not properly supported - aborting"),F=!0,e},w:function(){ve(0);var e=J.pop();if(e.Xb()&&!e.Lb()){var t=e.Wb();t&&ie(t)(e.Db),re(e.Db)}te=0},d:function(){var e=te;if(!e)return de=0;var t=new ne(e);t.Fb(e);var n=t.Eb();if(!n)return de=0,e;for(var r=Array.prototype.slice.call(arguments),o=0;o<r.length;o++){var i=r[o];if(0===i||i===n)break;if(Pe(i,n,t.zb+16))return de=i,e}return de=n,e},k:function(){var e=te;if(!e)return de=0;var t=new ne(e);t.Fb(e);var n=t.Eb();if(!n)return de=0,e;for(var r=Array.prototype.slice.call(arguments),o=0;o<r.length;o++){var i=r[o];if(0===i||i===n)break;if(Pe(i,n,t.zb+16))return de=i,e}return de=n,e},g:function(){var e=te;if(!e)return de=0;var t=new ne(e);t.Fb(e);var n=t.Eb();if(!n)return de=0,e;for(var r=Array.prototype.slice.call(arguments),o=0;o<r.length;o++){var i=r[o];if(0===i||i===n)break;if(Pe(i,n,t.zb+16))return de=i,e}return de=n,e},s:re,L:function(){var e=J.pop();e||H("no exception to throw");var t=e.Db;throw e.Lb()||(J.push(e),e.Jb(!0),e.Ib(!1),ee++),te=t,t},b:function(e,t,n){throw new ne(e).Rb(t,n),te=e,ee++,e},la:function(){return ee},i:function(e){throw te||(te=e),e},H:function(){return 0},Ba:function(){},pa:function(){},ra:function(){},ka:function(){return 0},za:function(){},ua:function(){},ya:function(){},R:function(){},qa:function(){},na:function(){},Aa:function(){},oa:function(){},Ha:function(){},Ja:function(){H("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){H("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},S:function(){return Date.now()},Ca:function(){return!0},Da:function(e,t){e=new Date(1e3*(A[e>>>2]+4294967296*P[e+4>>>2])),P[t>>2>>>0]=e.getUTCSeconds(),P[t+4>>2>>>0]=e.getUTCMinutes(),P[t+8>>2>>>0]=e.getUTCHours(),P[t+12>>2>>>0]=e.getUTCDate(),P[t+16>>2>>>0]=e.getUTCMonth(),P[t+20>>2>>>0]=e.getUTCFullYear()-1900,P[t+24>>2>>>0]=e.getUTCDay(),P[t+28>>2>>>0]=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(e,t){e=new Date(1e3*(A[e>>>2]+4294967296*P[e+4>>>2])),P[t>>2>>>0]=e.getSeconds(),P[t+4>>2>>>0]=e.getMinutes(),P[t+8>>2>>>0]=e.getHours(),P[t+12>>2>>>0]=e.getDate(),P[t+16>>2>>>0]=e.getMonth(),P[t+20>>2>>>0]=e.getFullYear()-1900,P[t+24>>2>>>0]=e.getDay();var n=new Date(e.getFullYear(),0,1);P[t+28>>2>>>0]=(e.getTime()-n.getTime())/864e5|0,P[t+36>>2>>>0]=-60*e.getTimezoneOffset();var r=new Date(e.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),P[t+32>>2>>>0]=0|(r!=n&&e.getTimezoneOffset()==Math.min(n,r))},Fa:function(e){var t=new Date(P[e+20>>2>>>0]+1900,P[e+16>>2>>>0],P[e+12>>2>>>0],P[e+8>>2>>>0],P[e+4>>2>>>0],P[e>>2>>>0],0),n=P[e+32>>2>>>0],r=t.getTimezoneOffset(),o=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),a=Math.min(s,i);return 0>n?P[e+32>>2>>>0]=Number(i!=s&&a==r):0<n!=(a==r)&&(i=Math.max(s,i),t.setTime(t.getTime()+6e4*((0<n?a:i)-r))),P[e+24>>2>>>0]=t.getDay(),P[e+28>>2>>>0]=(t.getTime()-o.getTime())/864e5|0,P[e>>2>>>0]=t.getSeconds(),P[e+4>>2>>>0]=t.getMinutes(),P[e+8>>2>>>0]=t.getHours(),P[e+12>>2>>>0]=t.getDate(),P[e+16>>2>>>0]=t.getMonth(),t.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function e(t,n,r){e.Vb||(e.Vb=!0,function(e,t,n){function r(e){return(e=e.toTimeString().match(/\(([A-Za-z ]+)\)$/))?e[1]:"GMT"}var o=(new Date).getFullYear(),i=new Date(o,0,1),s=new Date(o,6,1);o=i.getTimezoneOffset();var a=s.getTimezoneOffset();P[e>>2>>>0]=60*Math.max(o,a),P[t>>2>>>0]=Number(o!=a),e=r(i),t=r(s),e=se(e),t=se(t),a<o?(A[n>>2>>>0]=e,A[n+4>>2>>>0]=t):(A[n>>2>>>0]=t,A[n+4>>2>>>0]=e)}(t,n,r))},B:function(){H("")},ma:function(){return 4294901760},I:g?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:()=>performance.now(),xa:function(e,t,n){S.copyWithin(e>>>0,t>>>0,t+n>>>0)},G:function(e){var t=S.length;if(4294901760<(e>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296);var o=Math;r=Math.max(e,r),o=o.min.call(o,4294901760,r+(65536-r%65536)%65536);e:{try{v.grow(o-k.byteLength+65535>>>16),L();var i=1;break e}catch(e){}i=void 0}if(i)return!0}return!1},va:function(e,t){var n=0;return le().forEach((function(r,o){var i=t+n;for(o=A[e+4*o>>2>>>0]=i,i=0;i<r.length;++i)M[o++>>0>>>0]=r.charCodeAt(i);M[o>>0>>>0]=0,n+=r.length+1})),0},wa:function(e,t){var n=le();A[e>>2>>>0]=n.length;var r=0;return n.forEach((function(e){r+=e.length+1})),A[t>>2>>>0]=r,0},ba:function(e){T||0<j||(Te(),Z(z),ye(0),ue[1].length&&pe(1,10),ue[2].length&&pe(2,10)),T||0<j||(t.onExit&&t.onExit(e),F=!0),h(e,new K(e))},E:function(){return 52},Q:function(){return 52},ca:function(){return 70},P:function(e,t,n,r){for(var o=0,i=0;i<n;i++){var s=A[t>>2>>>0],a=A[t+4>>2>>>0];t+=8;for(var l=0;l<a;l++)pe(e,S[s+l>>>0]);o+=a}return A[r>>2>>>0]=o,0},c:function(){return de},ja:function e(t,r){e.Mb||(e.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return()=>(crypto.getRandomValues(e),e[0])}if(g)try{var t=n(Object(function(){var e=new Error("Cannot find module 'crypto'");throw e.code="MODULE_NOT_FOUND",e}()));return()=>t.randomBytes(1)[0]}catch(e){}return()=>H("randomDevice")}());for(var o=0;o<r;o++)M[t+o>>0>>>0]=e.Mb();return 0},ea:function(e,t,n){var r=ke();try{return ie(e)(t,n)}catch(e){if(Me(r),e!==e+0)throw e;ve(1,0)}},fa:function(e,t,n){var r=ke();try{return ie(e)(t,n)}catch(e){if(Me(r),e!==e+0)throw e;ve(1,0)}},J:function(e){var t=ke();try{return ie(e)()}catch(e){if(Me(t),e!==e+0)throw e;ve(1,0)}},e:function(e,t){var n=ke();try{return ie(e)(t)}catch(e){if(Me(n),e!==e+0)throw e;ve(1,0)}},N:function(e,t,n){var r=ke();try{return ie(e)(t,n)}catch(e){if(Me(r),e!==e+0)throw e;ve(1,0)}},O:function(e,t,n){var r=ke();try{return ie(e)(t,n)}catch(e){if(Me(r),e!==e+0)throw e;ve(1,0)}},j:function(e,t,n){var r=ke();try{return ie(e)(t,n)}catch(e){if(Me(r),e!==e+0)throw e;ve(1,0)}},o:function(e,t,n,r){var o=ke();try{return ie(e)(t,n,r)}catch(e){if(Me(o),e!==e+0)throw e;ve(1,0)}},p:function(e,t,n,r,o){var i=ke();try{return ie(e)(t,n,r,o)}catch(e){if(Me(i),e!==e+0)throw e;ve(1,0)}},M:function(e,t,n,r,o,i){var s=ke();try{return ie(e)(t,n,r,o,i)}catch(e){if(Me(s),e!==e+0)throw e;ve(1,0)}},r:function(e,t,n,r,o,i){var s=ke();try{return ie(e)(t,n,r,o,i)}catch(e){if(Me(s),e!==e+0)throw e;ve(1,0)}},v:function(e,t,n,r,o,i,s){var a=ke();try{return ie(e)(t,n,r,o,i,s)}catch(e){if(Me(a),e!==e+0)throw e;ve(1,0)}},K:function(e,t,n,r,o,i,s,a){var l=ke();try{return ie(e)(t,n,r,o,i,s,a)}catch(e){if(Me(l),e!==e+0)throw e;ve(1,0)}},D:function(e,t,n,r,o,i,s,a,l,c,u,p){var d=ke();try{return ie(e)(t,n,r,o,i,s,a,l,c,u,p)}catch(e){if(Me(d),e!==e+0)throw e;ve(1,0)}},X:function(e,t,n,r,o,i,s,a){var l=ke();try{return $e(e,t,n,r,o,i,s,a)}catch(e){if(Me(l),e!==e+0)throw e;ve(1,0)}},V:function(e,t,n,r,o,i,s){var a=ke();try{return Ce(e,t,n,r,o,i,s)}catch(e){if(Me(a),e!==e+0)throw e;ve(1,0)}},U:function(e,t,n,r,o){var i=ke();try{return Be(e,t,n,r,o)}catch(e){if(Me(i),e!==e+0)throw e;ve(1,0)}},Z:function(e,t,n,r){var o=ke();try{return Le(e,t,n,r)}catch(e){if(Me(o),e!==e+0)throw e;ve(1,0)}},W:function(e){var t=ke();try{return Fe(e)}catch(e){if(Me(t),e!==e+0)throw e;ve(1,0)}},Y:function(e,t){var n=ke();try{return Ne(e,t)}catch(e){if(Me(n),e!==e+0)throw e;ve(1,0)}},T:function(e,t,n){var r=ke();try{return Ee(e,t,n)}catch(e){if(Me(r),e!==e+0)throw e;ve(1,0)}},f:function(e){var t=ke();try{ie(e)()}catch(e){if(Me(t),e!==e+0)throw e;ve(1,0)}},q:function(e,t){var n=ke();try{ie(e)(t)}catch(e){if(Me(n),e!==e+0)throw e;ve(1,0)}},h:function(e,t,n){var r=ke();try{ie(e)(t,n)}catch(e){if(Me(r),e!==e+0)throw e;ve(1,0)}},da:function(e,t,n,r){var o=ke();try{ie(e)(t,n,r)}catch(e){if(Me(o),e!==e+0)throw e;ve(1,0)}},l:function(e,t,n,r){var o=ke();try{ie(e)(t,n,r)}catch(e){if(Me(o),e!==e+0)throw e;ve(1,0)}},t:function(e,t,n,r,o){var i=ke();try{ie(e)(t,n,r,o)}catch(e){if(Me(i),e!==e+0)throw e;ve(1,0)}},u:function(e,t,n,r,o,i){var s=ke();try{ie(e)(t,n,r,o,i)}catch(e){if(Me(s),e!==e+0)throw e;ve(1,0)}},x:function(e,t,n,r,o,i,s){var a=ke();try{ie(e)(t,n,r,o,i,s)}catch(e){if(Me(a),e!==e+0)throw e;ve(1,0)}},z:function(e,t,n,r,o,i,s,a){var l=ke();try{ie(e)(t,n,r,o,i,s,a)}catch(e){if(Me(l),e!==e+0)throw e;ve(1,0)}},ga:function(e,t,n,r,o,i,s,a,l){var c=ke();try{ie(e)(t,n,r,o,i,s,a,l)}catch(e){if(Me(c),e!==e+0)throw e;ve(1,0)}},A:function(e,t,n,r,o,i,s,a,l,c,u){var p=ke();try{ie(e)(t,n,r,o,i,s,a,l,c,u)}catch(e){if(Me(p),e!==e+0)throw e;ve(1,0)}},C:function(e,t,n,r,o,i,s,a,l,c,u,p,d,_,h,f){var m=ke();try{ie(e)(t,n,r,o,i,s,a,l,c,u,p,d,_,h,f)}catch(e){if(Me(m),e!==e+0)throw e;ve(1,0)}},aa:function(e,t,n,r,o,i,s,a){var l=ke();try{Oe(e,t,n,r,o,i,s,a)}catch(e){if(Me(l),e!==e+0)throw e;ve(1,0)}},_:function(e,t,n,r,o,i,s,a,l,c,u,p){var d=ke();try{De(e,t,n,r,o,i,s,a,l,c,u,p)}catch(e){if(Me(d),e!==e+0)throw e;ve(1,0)}},$:function(e,t,n,r,o,i){var s=ke();try{Ie(e,t,n,r,o,i)}catch(e){if(Me(s),e!==e+0)throw e;ve(1,0)}},n:function(e){return e},F:function(e){de=e},ha:me,y:function(e,t,n,r){return me(e,t,n,r)}};!function(){function e(e){t.asm=e.exports,v=t.asm.Ka,L(),N=t.asm.ib,B.unshift(t.asm.La),G--,t.monitorRunDependencies&&t.monitorRunDependencies(G),0==G&&(null!==q&&(clearInterval(q),q=null),W&&(e=W,W=null,e()))}function n(t){e(t.instance)}function r(e){return function(){if(!w&&(f||m)){if("function"==typeof fetch&&!U.startsWith("file://"))return fetch(U,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+U+"'";return e.arrayBuffer()})).catch((function(){return Y()}));if(a)return new Promise((function(e,t){a(U,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return Y()}))}().then((function(e){return WebAssembly.instantiate(e,o)})).then((function(e){return e})).then(e,(function(e){y("failed to asynchronously prepare wasm: "+e),H(e)}))}var o={a:ge};if(G++,t.monitorRunDependencies&&t.monitorRunDependencies(G),t.instantiateWasm)try{return t.instantiateWasm(o,e)}catch(e){return y("Module.instantiateWasm callback failed with error: "+e),!1}(w||"function"!=typeof WebAssembly.instantiateStreaming||X()||U.startsWith("file://")||g||"function"!=typeof fetch?r(n):fetch(U,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,o).then(n,(function(e){return y("wasm streaming compile failed: "+e),y("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(i)}(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.La).apply(null,arguments)},t._OrtInit=function(){return(t._OrtInit=t.asm.Ma).apply(null,arguments)},t._OrtCreateSessionOptions=function(){return(t._OrtCreateSessionOptions=t.asm.Na).apply(null,arguments)},t._OrtAppendExecutionProvider=function(){return(t._OrtAppendExecutionProvider=t.asm.Oa).apply(null,arguments)},t._OrtAddSessionConfigEntry=function(){return(t._OrtAddSessionConfigEntry=t.asm.Pa).apply(null,arguments)},t._OrtReleaseSessionOptions=function(){return(t._OrtReleaseSessionOptions=t.asm.Qa).apply(null,arguments)},t._OrtCreateSession=function(){return(t._OrtCreateSession=t.asm.Ra).apply(null,arguments)},t._OrtReleaseSession=function(){return(t._OrtReleaseSession=t.asm.Sa).apply(null,arguments)},t._OrtGetInputCount=function(){return(t._OrtGetInputCount=t.asm.Ta).apply(null,arguments)},t._OrtGetOutputCount=function(){return(t._OrtGetOutputCount=t.asm.Ua).apply(null,arguments)},t._OrtGetInputName=function(){return(t._OrtGetInputName=t.asm.Va).apply(null,arguments)},t._OrtGetOutputName=function(){return(t._OrtGetOutputName=t.asm.Wa).apply(null,arguments)},t._OrtFree=function(){return(t._OrtFree=t.asm.Xa).apply(null,arguments)},t._OrtCreateTensor=function(){return(t._OrtCreateTensor=t.asm.Ya).apply(null,arguments)},t._OrtGetTensorData=function(){return(t._OrtGetTensorData=t.asm.Za).apply(null,arguments)},t._OrtReleaseTensor=function(){return(t._OrtReleaseTensor=t.asm._a).apply(null,arguments)},t._OrtCreateRunOptions=function(){return(t._OrtCreateRunOptions=t.asm.$a).apply(null,arguments)},t._OrtAddRunConfigEntry=function(){return(t._OrtAddRunConfigEntry=t.asm.ab).apply(null,arguments)},t._OrtReleaseRunOptions=function(){return(t._OrtReleaseRunOptions=t.asm.bb).apply(null,arguments)},t._OrtRun=function(){return(t._OrtRun=t.asm.cb).apply(null,arguments)},t._OrtEndProfiling=function(){return(t._OrtEndProfiling=t.asm.db).apply(null,arguments)};var be,we=t._malloc=function(){return(we=t._malloc=t.asm.eb).apply(null,arguments)},xe=t._free=function(){return(xe=t._free=t.asm.fb).apply(null,arguments)},ye=t._fflush=function(){return(ye=t._fflush=t.asm.gb).apply(null,arguments)},Te=t.___funcs_on_exit=function(){return(Te=t.___funcs_on_exit=t.asm.hb).apply(null,arguments)},ve=t._setThrew=function(){return(ve=t._setThrew=t.asm.jb).apply(null,arguments)},ke=t.stackSave=function(){return(ke=t.stackSave=t.asm.kb).apply(null,arguments)},Me=t.stackRestore=function(){return(Me=t.stackRestore=t.asm.lb).apply(null,arguments)},Se=t.stackAlloc=function(){return(Se=t.stackAlloc=t.asm.mb).apply(null,arguments)},Pe=t.___cxa_can_catch=function(){return(Pe=t.___cxa_can_catch=t.asm.nb).apply(null,arguments)},Ae=t.___cxa_is_pointer_type=function(){return(Ae=t.___cxa_is_pointer_type=t.asm.ob).apply(null,arguments)},Fe=t.dynCall_j=function(){return(Fe=t.dynCall_j=t.asm.pb).apply(null,arguments)},Ce=t.dynCall_iiiiij=function(){return(Ce=t.dynCall_iiiiij=t.asm.qb).apply(null,arguments)},Ee=t.dynCall_jii=function(){return(Ee=t.dynCall_jii=t.asm.rb).apply(null,arguments)},Oe=t.dynCall_viiiiij=function(){return(Oe=t.dynCall_viiiiij=t.asm.sb).apply(null,arguments)},Ie=t.dynCall_vjji=function(){return(Ie=t.dynCall_vjji=t.asm.tb).apply(null,arguments)},De=t.dynCall_viiijjjii=function(){return(De=t.dynCall_viiijjjii=t.asm.ub).apply(null,arguments)},Le=t.dynCall_iij=function(){return(Le=t.dynCall_iij=t.asm.vb).apply(null,arguments)},Ne=t.dynCall_ji=function(){return(Ne=t.dynCall_ji=t.asm.wb).apply(null,arguments)},$e=t.dynCall_iiiiiij=function(){return($e=t.dynCall_iiiiiij=t.asm.xb).apply(null,arguments)},Be=t.dynCall_iiij=function(){return(Be=t.dynCall_iiij=t.asm.yb).apply(null,arguments)};function ze(){function e(){if(!be&&(be=!0,t.calledRun=!0,!F)){if(Z(B),o(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e=t.postRun.shift();R.unshift(e)}Z(R)}}if(!(0<G)){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)V();Z($),0<G||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),e()}),1)):e())}}if(t.UTF8ToString=O,t.stringToUTF8=function(e,t,n){return I(e,S,t,n)},t.lengthBytesUTF8=D,t.stackSave=ke,t.stackRestore=Me,t.stackAlloc=Se,W=function e(){be||ze(),be||(W=e)},t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);0<t.preInit.length;)t.preInit.pop()();return ze(),e.ready});e.exports=o},4537:e=>{e.exports=function(e,t){for(var n=new Array(arguments.length-1),r=0,o=2,i=!0;o<arguments.length;)n[r++]=arguments[o++];return new Promise((function(o,s){n[r]=function(e){if(i)if(i=!1,e)s(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];o.apply(null,t)}};try{e.apply(t||null,n)}catch(e){i&&(i=!1,s(e))}}))}},7419:(e,t)=>{var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),o=new Array(123),i=0;i<64;)o[r[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;n.encode=function(e,t,n){for(var o,i=null,s=[],a=0,l=0;t<n;){var c=e[t++];switch(l){case 0:s[a++]=r[c>>2],o=(3&c)<<4,l=1;break;case 1:s[a++]=r[o|c>>4],o=(15&c)<<2,l=2;break;case 2:s[a++]=r[o|c>>6],s[a++]=r[63&c],l=0}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return l&&(s[a++]=r[o],s[a++]=61,1===l&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";n.decode=function(e,t,n){for(var r,i=n,a=0,l=0;l<e.length;){var c=e.charCodeAt(l++);if(61===c&&a>1)break;if(void 0===(c=o[c]))throw Error(s);switch(a){case 0:r=c,a=1;break;case 1:t[n++]=r<<2|(48&c)>>4,r=c,a=2;break;case 2:t[n++]=(15&r)<<4|(60&c)>>2,r=c,a=3;break;case 3:t[n++]=(3&r)<<6|c,a=0}}if(1===a)throw Error(s);return n-i},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},9211:e=>{function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},945:e=>{function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function o(e,r,o){t[0]=e,r[o]=n[0],r[o+1]=n[1],r[o+2]=n[2],r[o+3]=n[3]}function i(e,r,o){t[0]=e,r[o]=n[3],r[o+1]=n[2],r[o+2]=n[1],r[o+3]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function a(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?o:i,e.writeFloatBE=r?i:o,e.readFloatLE=r?s:a,e.readFloatBE=r?a:s}():function(){function t(e,t,n,r){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,n,r)}}function s(e,t,n){var r=e(t,n),o=2*(r>>31)+1,i=r>>>23&255,s=8388607&r;return 255===i?s?NaN:o*(1/0):0===i?1401298464324817e-60*o*s:o*Math.pow(2,i-150)*(s+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,r),e.readFloatLE=s.bind(null,o),e.readFloatBE=s.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function o(e,r,o){t[0]=e,r[o]=n[0],r[o+1]=n[1],r[o+2]=n[2],r[o+3]=n[3],r[o+4]=n[4],r[o+5]=n[5],r[o+6]=n[6],r[o+7]=n[7]}function i(e,r,o){t[0]=e,r[o]=n[7],r[o+1]=n[6],r[o+2]=n[5],r[o+3]=n[4],r[o+4]=n[3],r[o+5]=n[2],r[o+6]=n[1],r[o+7]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?o:i,e.writeDoubleBE=r?i:o,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,n,r,o,i){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,o,i+t),e(1/r>0?0:2147483648,o,i+n);else if(isNaN(r))e(0,o,i+t),e(2146959360,o,i+n);else if(r>17976931348623157e292)e(0,o,i+t),e((s<<31|2146435072)>>>0,o,i+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,o,i+t),e((s<<31|a/4294967296)>>>0,o,i+n);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=r*Math.pow(2,-l))>>>0,o,i+t),e((s<<31|l+1023<<20|1048576*a&1048575)>>>0,o,i+n)}}}function s(e,t,n,r,o){var i=e(r,o+t),s=e(r,o+n),a=2*(s>>31)+1,l=s>>>20&2047,c=4294967296*(1048575&s)+i;return 2047===l?c?NaN:a*(1/0):0===l?5e-324*a*c:a*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=s.bind(null,o,0,4),e.readDoubleBE=s.bind(null,i,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function r(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},6662:e=>{e.exports=function(e,t,n){var r=n||8192,o=r>>>1,i=null,s=r;return function(n){if(n<1||n>o)return e(n);s+n>r&&(i=e(r),s=0);var a=t.call(i,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},4997:(e,t)=>{var n=t;n.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},n.read=function(e,t,n){if(n-t<1)return"";for(var r,o=null,i=[],s=0;t<n;)(r=e[t++])<128?i[s++]=r:r>191&&r<224?i[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(r>>10),i[s++]=56320+(1023&r)):i[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},n.write=function(e,t,n){for(var r,o,i=n,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(o=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&o),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-i}},3442:(e,t)=>{t.__esModule=!0;var n=function(){function e(t){if(!t)throw new TypeError("Invalid argument; `value` has no value.");this.value=e.EMPTY,t&&e.isGuid(t)&&(this.value=t)}return e.isGuid=function(t){var n=t.toString();return t&&(t instanceof e||e.validator.test(n))},e.create=function(){return new e([e.gen(2),e.gen(1),e.gen(1),e.gen(1),e.gen(3)].join("-"))},e.createEmpty=function(){return new e("emptyguid")},e.parse=function(t){return new e(t)},e.raw=function(){return[e.gen(2),e.gen(1),e.gen(1),e.gen(1),e.gen(3)].join("-")},e.gen=function(e){for(var t="",n=0;n<e;n++)t+=(65536*(1+Math.random())|0).toString(16).substring(1);return t},e.prototype.equals=function(t){return e.isGuid(t)&&this.value===t.toString()},e.prototype.isEmpty=function(){return this.value===e.EMPTY},e.prototype.toString=function(){return this.value},e.prototype.toJSON=function(){return{value:this.value}},e.validator=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i"),e.EMPTY="00000000-0000-0000-0000-000000000000",e}();t.Guid=n},3720:e=>{e.exports=n;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function r(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var o={},i={};function s(e,t){var n,r,s;return t?(s=0<=(e>>>=0)&&e<256)&&(r=i[e])?r:(n=l(e,(0|e)<0?-1:0,!0),s&&(i[e]=n),n):(s=-128<=(e|=0)&&e<128)&&(r=o[e])?r:(n=l(e,e<0?-1:0,!1),s&&(o[e]=n),n)}function a(e,t){if(isNaN(e))return t?g:m;if(t){if(e<0)return g;if(e>=_)return T}else{if(e<=-h)return v;if(e+1>=h)return y}return e<0?a(-e,t).neg():l(e%d|0,e/d|0,t)}function l(e,t,r){return new n(e,t,r)}n.fromInt=s,n.fromNumber=a,n.fromBits=l;var c=Math.pow;function u(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return u(e.substring(1),t,n).neg();for(var o=a(c(n,8)),i=m,s=0;s<e.length;s+=8){var l=Math.min(8,e.length-s),p=parseInt(e.substring(s,s+l),n);if(l<8){var d=a(c(n,l));i=i.mul(d).add(a(p))}else i=(i=i.mul(o)).add(a(p))}return i.unsigned=t,i}function p(e,t){return"number"==typeof e?a(e,t):"string"==typeof e?u(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=u,n.fromValue=p;var d=4294967296,_=d*d,h=_/2,f=s(1<<24),m=s(0);n.ZERO=m;var g=s(0,!0);n.UZERO=g;var b=s(1);n.ONE=b;var w=s(1,!0);n.UONE=w;var x=s(-1);n.NEG_ONE=x;var y=l(-1,2147483647,!1);n.MAX_VALUE=y;var T=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=T;var v=l(0,-2147483648,!1);n.MIN_VALUE=v;var k=n.prototype;k.toInt=function(){return this.unsigned?this.low>>>0:this.low},k.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},k.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(v)){var t=a(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=a(c(e,6),this.unsigned),i=this,s="";;){var l=i.div(o),u=(i.sub(l.mul(o)).toInt()>>>0).toString(e);if((i=l).isZero())return u+s;for(;u.length<6;)u="0"+u;s=""+u+s}},k.getHighBits=function(){return this.high},k.getHighBitsUnsigned=function(){return this.high>>>0},k.getLowBits=function(){return this.low},k.getLowBitsUnsigned=function(){return this.low>>>0},k.getNumBitsAbs=function(){if(this.isNegative())return this.eq(v)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},k.isZero=function(){return 0===this.high&&0===this.low},k.eqz=k.isZero,k.isNegative=function(){return!this.unsigned&&this.high<0},k.isPositive=function(){return this.unsigned||this.high>=0},k.isOdd=function(){return 1==(1&this.low)},k.isEven=function(){return 0==(1&this.low)},k.equals=function(e){return r(e)||(e=p(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},k.eq=k.equals,k.notEquals=function(e){return!this.eq(e)},k.neq=k.notEquals,k.ne=k.notEquals,k.lessThan=function(e){return this.comp(e)<0},k.lt=k.lessThan,k.lessThanOrEqual=function(e){return this.comp(e)<=0},k.lte=k.lessThanOrEqual,k.le=k.lessThanOrEqual,k.greaterThan=function(e){return this.comp(e)>0},k.gt=k.greaterThan,k.greaterThanOrEqual=function(e){return this.comp(e)>=0},k.gte=k.greaterThanOrEqual,k.ge=k.greaterThanOrEqual,k.compare=function(e){if(r(e)||(e=p(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},k.comp=k.compare,k.negate=function(){return!this.unsigned&&this.eq(v)?v:this.not().add(b)},k.neg=k.negate,k.add=function(e){r(e)||(e=p(e));var t=this.high>>>16,n=65535&this.high,o=this.low>>>16,i=65535&this.low,s=e.high>>>16,a=65535&e.high,c=e.low>>>16,u=0,d=0,_=0,h=0;return _+=(h+=i+(65535&e.low))>>>16,d+=(_+=o+c)>>>16,u+=(d+=n+a)>>>16,u+=t+s,l((_&=65535)<<16|(h&=65535),(u&=65535)<<16|(d&=65535),this.unsigned)},k.subtract=function(e){return r(e)||(e=p(e)),this.add(e.neg())},k.sub=k.subtract,k.multiply=function(e){if(this.isZero())return m;if(r(e)||(e=p(e)),t)return l(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(v))return e.isOdd()?v:m;if(e.eq(v))return this.isOdd()?v:m;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(f)&&e.lt(f))return a(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,o=65535&this.high,i=this.low>>>16,s=65535&this.low,c=e.high>>>16,u=65535&e.high,d=e.low>>>16,_=65535&e.low,h=0,g=0,b=0,w=0;return b+=(w+=s*_)>>>16,g+=(b+=i*_)>>>16,b&=65535,g+=(b+=s*d)>>>16,h+=(g+=o*_)>>>16,g&=65535,h+=(g+=i*d)>>>16,g&=65535,h+=(g+=s*u)>>>16,h+=n*_+o*d+i*u+s*c,l((b&=65535)<<16|(w&=65535),(h&=65535)<<16|(g&=65535),this.unsigned)},k.mul=k.multiply,k.divide=function(e){if(r(e)||(e=p(e)),e.isZero())throw Error("division by zero");var n,o,i;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?g:m;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return w;i=g}else{if(this.eq(v))return e.eq(b)||e.eq(x)?v:e.eq(v)?b:(n=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?b:x:(o=this.sub(e.mul(n)),i=n.add(o.div(e)));if(e.eq(v))return this.unsigned?g:m;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=m}for(o=this;o.gte(e);){n=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),u=s<=48?1:c(2,s-48),d=a(n),_=d.mul(e);_.isNegative()||_.gt(o);)_=(d=a(n-=u,this.unsigned)).mul(e);d.isZero()&&(d=b),i=i.add(d),o=o.sub(_)}return i},k.div=k.divide,k.modulo=function(e){return r(e)||(e=p(e)),t?l((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},k.mod=k.modulo,k.rem=k.modulo,k.not=function(){return l(~this.low,~this.high,this.unsigned)},k.and=function(e){return r(e)||(e=p(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},k.or=function(e){return r(e)||(e=p(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},k.xor=function(e){return r(e)||(e=p(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},k.shiftLeft=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},k.shl=k.shiftLeft,k.shiftRight=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},k.shr=k.shiftRight,k.shiftRightUnsigned=function(e){if(r(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?l(this.low>>>e|t<<32-e,t>>>e,this.unsigned):l(32===e?t:t>>>e-32,0,this.unsigned)},k.shru=k.shiftRightUnsigned,k.shr_u=k.shiftRightUnsigned,k.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},k.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},k.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},k.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},k.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},1446:(e,t,n)=>{var r,o,i,s=n(2100),a=s.Reader,l=s.Writer,c=s.util,u=s.roots.default||(s.roots.default={});u.onnx=((i={}).Version=(r={},(o=Object.create(r))[r[0]="_START_VERSION"]=0,o[r[1]="IR_VERSION_2017_10_10"]=1,o[r[2]="IR_VERSION_2017_10_30"]=2,o[r[3]="IR_VERSION_2017_11_3"]=3,o[r[4]="IR_VERSION_2019_1_22"]=4,o[r[5]="IR_VERSION"]=5,o),i.AttributeProto=function(){function e(e){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.refAttrName="",e.prototype.docString="",e.prototype.type=0,e.prototype.f=0,e.prototype.i=c.Long?c.Long.fromBits(0,0,!1):0,e.prototype.s=c.newBuffer([]),e.prototype.t=null,e.prototype.g=null,e.prototype.floats=c.emptyArray,e.prototype.ints=c.emptyArray,e.prototype.strings=c.emptyArray,e.prototype.tensors=c.emptyArray,e.prototype.graphs=c.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.name&&e.hasOwnProperty("name")&&t.uint32(10).string(e.name),null!=e.f&&e.hasOwnProperty("f")&&t.uint32(21).float(e.f),null!=e.i&&e.hasOwnProperty("i")&&t.uint32(24).int64(e.i),null!=e.s&&e.hasOwnProperty("s")&&t.uint32(34).bytes(e.s),null!=e.t&&e.hasOwnProperty("t")&&u.onnx.TensorProto.encode(e.t,t.uint32(42).fork()).ldelim(),null!=e.g&&e.hasOwnProperty("g")&&u.onnx.GraphProto.encode(e.g,t.uint32(50).fork()).ldelim(),null!=e.floats&&e.floats.length){t.uint32(58).fork();for(var n=0;n<e.floats.length;++n)t.float(e.floats[n]);t.ldelim()}if(null!=e.ints&&e.ints.length){for(t.uint32(66).fork(),n=0;n<e.ints.length;++n)t.int64(e.ints[n]);t.ldelim()}if(null!=e.strings&&e.strings.length)for(n=0;n<e.strings.length;++n)t.uint32(74).bytes(e.strings[n]);if(null!=e.tensors&&e.tensors.length)for(n=0;n<e.tensors.length;++n)u.onnx.TensorProto.encode(e.tensors[n],t.uint32(82).fork()).ldelim();if(null!=e.graphs&&e.graphs.length)for(n=0;n<e.graphs.length;++n)u.onnx.GraphProto.encode(e.graphs[n],t.uint32(90).fork()).ldelim();return null!=e.docString&&e.hasOwnProperty("docString")&&t.uint32(106).string(e.docString),null!=e.type&&e.hasOwnProperty("type")&&t.uint32(160).int32(e.type),null!=e.refAttrName&&e.hasOwnProperty("refAttrName")&&t.uint32(170).string(e.refAttrName),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.AttributeProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.name=e.string();break;case 21:r.refAttrName=e.string();break;case 13:r.docString=e.string();break;case 20:r.type=e.int32();break;case 2:r.f=e.float();break;case 3:r.i=e.int64();break;case 4:r.s=e.bytes();break;case 5:r.t=u.onnx.TensorProto.decode(e,e.uint32());break;case 6:r.g=u.onnx.GraphProto.decode(e,e.uint32());break;case 7:if(r.floats&&r.floats.length||(r.floats=[]),2==(7&o))for(var i=e.uint32()+e.pos;e.pos<i;)r.floats.push(e.float());else r.floats.push(e.float());break;case 8:if(r.ints&&r.ints.length||(r.ints=[]),2==(7&o))for(i=e.uint32()+e.pos;e.pos<i;)r.ints.push(e.int64());else r.ints.push(e.int64());break;case 9:r.strings&&r.strings.length||(r.strings=[]),r.strings.push(e.bytes());break;case 10:r.tensors&&r.tensors.length||(r.tensors=[]),r.tensors.push(u.onnx.TensorProto.decode(e,e.uint32()));break;case 11:r.graphs&&r.graphs.length||(r.graphs=[]),r.graphs.push(u.onnx.GraphProto.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name))return"name: string expected";if(null!=e.refAttrName&&e.hasOwnProperty("refAttrName")&&!c.isString(e.refAttrName))return"refAttrName: string expected";if(null!=e.docString&&e.hasOwnProperty("docString")&&!c.isString(e.docString))return"docString: string expected";if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:}if(null!=e.f&&e.hasOwnProperty("f")&&"number"!=typeof e.f)return"f: number expected";if(null!=e.i&&e.hasOwnProperty("i")&&!(c.isInteger(e.i)||e.i&&c.isInteger(e.i.low)&&c.isInteger(e.i.high)))return"i: integer|Long expected";if(null!=e.s&&e.hasOwnProperty("s")&&!(e.s&&"number"==typeof e.s.length||c.isString(e.s)))return"s: buffer expected";if(null!=e.t&&e.hasOwnProperty("t")&&(n=u.onnx.TensorProto.verify(e.t)))return"t."+n;if(null!=e.g&&e.hasOwnProperty("g")&&(n=u.onnx.GraphProto.verify(e.g)))return"g."+n;if(null!=e.floats&&e.hasOwnProperty("floats")){if(!Array.isArray(e.floats))return"floats: array expected";for(var t=0;t<e.floats.length;++t)if("number"!=typeof e.floats[t])return"floats: number[] expected"}if(null!=e.ints&&e.hasOwnProperty("ints")){if(!Array.isArray(e.ints))return"ints: array expected";for(t=0;t<e.ints.length;++t)if(!(c.isInteger(e.ints[t])||e.ints[t]&&c.isInteger(e.ints[t].low)&&c.isInteger(e.ints[t].high)))return"ints: integer|Long[] expected"}if(null!=e.strings&&e.hasOwnProperty("strings")){if(!Array.isArray(e.strings))return"strings: array expected";for(t=0;t<e.strings.length;++t)if(!(e.strings[t]&&"number"==typeof e.strings[t].length||c.isString(e.strings[t])))return"strings: buffer[] expected"}if(null!=e.tensors&&e.hasOwnProperty("tensors")){if(!Array.isArray(e.tensors))return"tensors: array expected";for(t=0;t<e.tensors.length;++t)if(n=u.onnx.TensorProto.verify(e.tensors[t]))return"tensors."+n}if(null!=e.graphs&&e.hasOwnProperty("graphs")){if(!Array.isArray(e.graphs))return"graphs: array expected";for(t=0;t<e.graphs.length;++t){var n;if(n=u.onnx.GraphProto.verify(e.graphs[t]))return"graphs."+n}}return null},e.fromObject=function(e){if(e instanceof u.onnx.AttributeProto)return e;var t=new u.onnx.AttributeProto;switch(null!=e.name&&(t.name=String(e.name)),null!=e.refAttrName&&(t.refAttrName=String(e.refAttrName)),null!=e.docString&&(t.docString=String(e.docString)),e.type){case"UNDEFINED":case 0:t.type=0;break;case"FLOAT":case 1:t.type=1;break;case"INT":case 2:t.type=2;break;case"STRING":case 3:t.type=3;break;case"TENSOR":case 4:t.type=4;break;case"GRAPH":case 5:t.type=5;break;case"FLOATS":case 6:t.type=6;break;case"INTS":case 7:t.type=7;break;case"STRINGS":case 8:t.type=8;break;case"TENSORS":case 9:t.type=9;break;case"GRAPHS":case 10:t.type=10}if(null!=e.f&&(t.f=Number(e.f)),null!=e.i&&(c.Long?(t.i=c.Long.fromValue(e.i)).unsigned=!1:"string"==typeof e.i?t.i=parseInt(e.i,10):"number"==typeof e.i?t.i=e.i:"object"==typeof e.i&&(t.i=new c.LongBits(e.i.low>>>0,e.i.high>>>0).toNumber())),null!=e.s&&("string"==typeof e.s?c.base64.decode(e.s,t.s=c.newBuffer(c.base64.length(e.s)),0):e.s.length&&(t.s=e.s)),null!=e.t){if("object"!=typeof e.t)throw TypeError(".onnx.AttributeProto.t: object expected");t.t=u.onnx.TensorProto.fromObject(e.t)}if(null!=e.g){if("object"!=typeof e.g)throw TypeError(".onnx.AttributeProto.g: object expected");t.g=u.onnx.GraphProto.fromObject(e.g)}if(e.floats){if(!Array.isArray(e.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");t.floats=[];for(var n=0;n<e.floats.length;++n)t.floats[n]=Number(e.floats[n])}if(e.ints){if(!Array.isArray(e.ints))throw TypeError(".onnx.AttributeProto.ints: array expected");for(t.ints=[],n=0;n<e.ints.length;++n)c.Long?(t.ints[n]=c.Long.fromValue(e.ints[n])).unsigned=!1:"string"==typeof e.ints[n]?t.ints[n]=parseInt(e.ints[n],10):"number"==typeof e.ints[n]?t.ints[n]=e.ints[n]:"object"==typeof e.ints[n]&&(t.ints[n]=new c.LongBits(e.ints[n].low>>>0,e.ints[n].high>>>0).toNumber())}if(e.strings){if(!Array.isArray(e.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(t.strings=[],n=0;n<e.strings.length;++n)"string"==typeof e.strings[n]?c.base64.decode(e.strings[n],t.strings[n]=c.newBuffer(c.base64.length(e.strings[n])),0):e.strings[n].length&&(t.strings[n]=e.strings[n])}if(e.tensors){if(!Array.isArray(e.tensors))throw TypeError(".onnx.AttributeProto.tensors: array expected");for(t.tensors=[],n=0;n<e.tensors.length;++n){if("object"!=typeof e.tensors[n])throw TypeError(".onnx.AttributeProto.tensors: object expected");t.tensors[n]=u.onnx.TensorProto.fromObject(e.tensors[n])}}if(e.graphs){if(!Array.isArray(e.graphs))throw TypeError(".onnx.AttributeProto.graphs: array expected");for(t.graphs=[],n=0;n<e.graphs.length;++n){if("object"!=typeof e.graphs[n])throw TypeError(".onnx.AttributeProto.graphs: object expected");t.graphs[n]=u.onnx.GraphProto.fromObject(e.graphs[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.floats=[],n.ints=[],n.strings=[],n.tensors=[],n.graphs=[]),t.defaults){if(n.name="",n.f=0,c.Long){var r=new c.Long(0,0,!1);n.i=t.longs===String?r.toString():t.longs===Number?r.toNumber():r}else n.i=t.longs===String?"0":0;t.bytes===String?n.s="":(n.s=[],t.bytes!==Array&&(n.s=c.newBuffer(n.s))),n.t=null,n.g=null,n.docString="",n.type=t.enums===String?"UNDEFINED":0,n.refAttrName=""}if(null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.f&&e.hasOwnProperty("f")&&(n.f=t.json&&!isFinite(e.f)?String(e.f):e.f),null!=e.i&&e.hasOwnProperty("i")&&("number"==typeof e.i?n.i=t.longs===String?String(e.i):e.i:n.i=t.longs===String?c.Long.prototype.toString.call(e.i):t.longs===Number?new c.LongBits(e.i.low>>>0,e.i.high>>>0).toNumber():e.i),null!=e.s&&e.hasOwnProperty("s")&&(n.s=t.bytes===String?c.base64.encode(e.s,0,e.s.length):t.bytes===Array?Array.prototype.slice.call(e.s):e.s),null!=e.t&&e.hasOwnProperty("t")&&(n.t=u.onnx.TensorProto.toObject(e.t,t)),null!=e.g&&e.hasOwnProperty("g")&&(n.g=u.onnx.GraphProto.toObject(e.g,t)),e.floats&&e.floats.length){n.floats=[];for(var o=0;o<e.floats.length;++o)n.floats[o]=t.json&&!isFinite(e.floats[o])?String(e.floats[o]):e.floats[o]}if(e.ints&&e.ints.length)for(n.ints=[],o=0;o<e.ints.length;++o)"number"==typeof e.ints[o]?n.ints[o]=t.longs===String?String(e.ints[o]):e.ints[o]:n.ints[o]=t.longs===String?c.Long.prototype.toString.call(e.ints[o]):t.longs===Number?new c.LongBits(e.ints[o].low>>>0,e.ints[o].high>>>0).toNumber():e.ints[o];if(e.strings&&e.strings.length)for(n.strings=[],o=0;o<e.strings.length;++o)n.strings[o]=t.bytes===String?c.base64.encode(e.strings[o],0,e.strings[o].length):t.bytes===Array?Array.prototype.slice.call(e.strings[o]):e.strings[o];if(e.tensors&&e.tensors.length)for(n.tensors=[],o=0;o<e.tensors.length;++o)n.tensors[o]=u.onnx.TensorProto.toObject(e.tensors[o],t);if(e.graphs&&e.graphs.length)for(n.graphs=[],o=0;o<e.graphs.length;++o)n.graphs[o]=u.onnx.GraphProto.toObject(e.graphs[o],t);return null!=e.docString&&e.hasOwnProperty("docString")&&(n.docString=e.docString),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?u.onnx.AttributeProto.AttributeType[e.type]:e.type),null!=e.refAttrName&&e.hasOwnProperty("refAttrName")&&(n.refAttrName=e.refAttrName),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e.AttributeType=function(){var e={},t=Object.create(e);return t[e[0]="UNDEFINED"]=0,t[e[1]="FLOAT"]=1,t[e[2]="INT"]=2,t[e[3]="STRING"]=3,t[e[4]="TENSOR"]=4,t[e[5]="GRAPH"]=5,t[e[6]="FLOATS"]=6,t[e[7]="INTS"]=7,t[e[8]="STRINGS"]=8,t[e[9]="TENSORS"]=9,t[e[10]="GRAPHS"]=10,t}(),e}(),i.ValueInfoProto=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.type=null,e.prototype.docString="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.name&&e.hasOwnProperty("name")&&t.uint32(10).string(e.name),null!=e.type&&e.hasOwnProperty("type")&&u.onnx.TypeProto.encode(e.type,t.uint32(18).fork()).ldelim(),null!=e.docString&&e.hasOwnProperty("docString")&&t.uint32(26).string(e.docString),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.ValueInfoProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.name=e.string();break;case 2:r.type=u.onnx.TypeProto.decode(e,e.uint32());break;case 3:r.docString=e.string();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name))return"name: string expected";if(null!=e.type&&e.hasOwnProperty("type")){var t=u.onnx.TypeProto.verify(e.type);if(t)return"type."+t}return null!=e.docString&&e.hasOwnProperty("docString")&&!c.isString(e.docString)?"docString: string expected":null},e.fromObject=function(e){if(e instanceof u.onnx.ValueInfoProto)return e;var t=new u.onnx.ValueInfoProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.type){if("object"!=typeof e.type)throw TypeError(".onnx.ValueInfoProto.type: object expected");t.type=u.onnx.TypeProto.fromObject(e.type)}return null!=e.docString&&(t.docString=String(e.docString)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.name="",n.type=null,n.docString=""),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.type&&e.hasOwnProperty("type")&&(n.type=u.onnx.TypeProto.toObject(e.type,t)),null!=e.docString&&e.hasOwnProperty("docString")&&(n.docString=e.docString),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),i.NodeProto=function(){function e(e){if(this.input=[],this.output=[],this.attribute=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.input=c.emptyArray,e.prototype.output=c.emptyArray,e.prototype.name="",e.prototype.opType="",e.prototype.domain="",e.prototype.attribute=c.emptyArray,e.prototype.docString="",e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.input&&e.input.length)for(var n=0;n<e.input.length;++n)t.uint32(10).string(e.input[n]);if(null!=e.output&&e.output.length)for(n=0;n<e.output.length;++n)t.uint32(18).string(e.output[n]);if(null!=e.name&&e.hasOwnProperty("name")&&t.uint32(26).string(e.name),null!=e.opType&&e.hasOwnProperty("opType")&&t.uint32(34).string(e.opType),null!=e.attribute&&e.attribute.length)for(n=0;n<e.attribute.length;++n)u.onnx.AttributeProto.encode(e.attribute[n],t.uint32(42).fork()).ldelim();return null!=e.docString&&e.hasOwnProperty("docString")&&t.uint32(50).string(e.docString),null!=e.domain&&e.hasOwnProperty("domain")&&t.uint32(58).string(e.domain),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.NodeProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.input&&r.input.length||(r.input=[]),r.input.push(e.string());break;case 2:r.output&&r.output.length||(r.output=[]),r.output.push(e.string());break;case 3:r.name=e.string();break;case 4:r.opType=e.string();break;case 7:r.domain=e.string();break;case 5:r.attribute&&r.attribute.length||(r.attribute=[]),r.attribute.push(u.onnx.AttributeProto.decode(e,e.uint32()));break;case 6:r.docString=e.string();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.input&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(var t=0;t<e.input.length;++t)if(!c.isString(e.input[t]))return"input: string[] expected"}if(null!=e.output&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(t=0;t<e.output.length;++t)if(!c.isString(e.output[t]))return"output: string[] expected"}if(null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name))return"name: string expected";if(null!=e.opType&&e.hasOwnProperty("opType")&&!c.isString(e.opType))return"opType: string expected";if(null!=e.domain&&e.hasOwnProperty("domain")&&!c.isString(e.domain))return"domain: string expected";if(null!=e.attribute&&e.hasOwnProperty("attribute")){if(!Array.isArray(e.attribute))return"attribute: array expected";for(t=0;t<e.attribute.length;++t){var n=u.onnx.AttributeProto.verify(e.attribute[t]);if(n)return"attribute."+n}}return null!=e.docString&&e.hasOwnProperty("docString")&&!c.isString(e.docString)?"docString: string expected":null},e.fromObject=function(e){if(e instanceof u.onnx.NodeProto)return e;var t=new u.onnx.NodeProto;if(e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.NodeProto.input: array expected");t.input=[];for(var n=0;n<e.input.length;++n)t.input[n]=String(e.input[n])}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.NodeProto.output: array expected");for(t.output=[],n=0;n<e.output.length;++n)t.output[n]=String(e.output[n])}if(null!=e.name&&(t.name=String(e.name)),null!=e.opType&&(t.opType=String(e.opType)),null!=e.domain&&(t.domain=String(e.domain)),e.attribute){if(!Array.isArray(e.attribute))throw TypeError(".onnx.NodeProto.attribute: array expected");for(t.attribute=[],n=0;n<e.attribute.length;++n){if("object"!=typeof e.attribute[n])throw TypeError(".onnx.NodeProto.attribute: object expected");t.attribute[n]=u.onnx.AttributeProto.fromObject(e.attribute[n])}}return null!=e.docString&&(t.docString=String(e.docString)),t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.input=[],n.output=[],n.attribute=[]),t.defaults&&(n.name="",n.opType="",n.docString="",n.domain=""),e.input&&e.input.length){n.input=[];for(var r=0;r<e.input.length;++r)n.input[r]=e.input[r]}if(e.output&&e.output.length)for(n.output=[],r=0;r<e.output.length;++r)n.output[r]=e.output[r];if(null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.opType&&e.hasOwnProperty("opType")&&(n.opType=e.opType),e.attribute&&e.attribute.length)for(n.attribute=[],r=0;r<e.attribute.length;++r)n.attribute[r]=u.onnx.AttributeProto.toObject(e.attribute[r],t);return null!=e.docString&&e.hasOwnProperty("docString")&&(n.docString=e.docString),null!=e.domain&&e.hasOwnProperty("domain")&&(n.domain=e.domain),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),i.ModelProto=function(){function e(e){if(this.opsetImport=[],this.metadataProps=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.irVersion=c.Long?c.Long.fromBits(0,0,!1):0,e.prototype.opsetImport=c.emptyArray,e.prototype.producerName="",e.prototype.producerVersion="",e.prototype.domain="",e.prototype.modelVersion=c.Long?c.Long.fromBits(0,0,!1):0,e.prototype.docString="",e.prototype.graph=null,e.prototype.metadataProps=c.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.irVersion&&e.hasOwnProperty("irVersion")&&t.uint32(8).int64(e.irVersion),null!=e.producerName&&e.hasOwnProperty("producerName")&&t.uint32(18).string(e.producerName),null!=e.producerVersion&&e.hasOwnProperty("producerVersion")&&t.uint32(26).string(e.producerVersion),null!=e.domain&&e.hasOwnProperty("domain")&&t.uint32(34).string(e.domain),null!=e.modelVersion&&e.hasOwnProperty("modelVersion")&&t.uint32(40).int64(e.modelVersion),null!=e.docString&&e.hasOwnProperty("docString")&&t.uint32(50).string(e.docString),null!=e.graph&&e.hasOwnProperty("graph")&&u.onnx.GraphProto.encode(e.graph,t.uint32(58).fork()).ldelim(),null!=e.opsetImport&&e.opsetImport.length)for(var n=0;n<e.opsetImport.length;++n)u.onnx.OperatorSetIdProto.encode(e.opsetImport[n],t.uint32(66).fork()).ldelim();if(null!=e.metadataProps&&e.metadataProps.length)for(n=0;n<e.metadataProps.length;++n)u.onnx.StringStringEntryProto.encode(e.metadataProps[n],t.uint32(114).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.ModelProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.irVersion=e.int64();break;case 8:r.opsetImport&&r.opsetImport.length||(r.opsetImport=[]),r.opsetImport.push(u.onnx.OperatorSetIdProto.decode(e,e.uint32()));break;case 2:r.producerName=e.string();break;case 3:r.producerVersion=e.string();break;case 4:r.domain=e.string();break;case 5:r.modelVersion=e.int64();break;case 6:r.docString=e.string();break;case 7:r.graph=u.onnx.GraphProto.decode(e,e.uint32());break;case 14:r.metadataProps&&r.metadataProps.length||(r.metadataProps=[]),r.metadataProps.push(u.onnx.StringStringEntryProto.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.irVersion&&e.hasOwnProperty("irVersion")&&!(c.isInteger(e.irVersion)||e.irVersion&&c.isInteger(e.irVersion.low)&&c.isInteger(e.irVersion.high)))return"irVersion: integer|Long expected";if(null!=e.opsetImport&&e.hasOwnProperty("opsetImport")){if(!Array.isArray(e.opsetImport))return"opsetImport: array expected";for(var t=0;t<e.opsetImport.length;++t)if(n=u.onnx.OperatorSetIdProto.verify(e.opsetImport[t]))return"opsetImport."+n}if(null!=e.producerName&&e.hasOwnProperty("producerName")&&!c.isString(e.producerName))return"producerName: string expected";if(null!=e.producerVersion&&e.hasOwnProperty("producerVersion")&&!c.isString(e.producerVersion))return"producerVersion: string expected";if(null!=e.domain&&e.hasOwnProperty("domain")&&!c.isString(e.domain))return"domain: string expected";if(null!=e.modelVersion&&e.hasOwnProperty("modelVersion")&&!(c.isInteger(e.modelVersion)||e.modelVersion&&c.isInteger(e.modelVersion.low)&&c.isInteger(e.modelVersion.high)))return"modelVersion: integer|Long expected";if(null!=e.docString&&e.hasOwnProperty("docString")&&!c.isString(e.docString))return"docString: string expected";if(null!=e.graph&&e.hasOwnProperty("graph")&&(n=u.onnx.GraphProto.verify(e.graph)))return"graph."+n;if(null!=e.metadataProps&&e.hasOwnProperty("metadataProps")){if(!Array.isArray(e.metadataProps))return"metadataProps: array expected";for(t=0;t<e.metadataProps.length;++t){var n;if(n=u.onnx.StringStringEntryProto.verify(e.metadataProps[t]))return"metadataProps."+n}}return null},e.fromObject=function(e){if(e instanceof u.onnx.ModelProto)return e;var t=new u.onnx.ModelProto;if(null!=e.irVersion&&(c.Long?(t.irVersion=c.Long.fromValue(e.irVersion)).unsigned=!1:"string"==typeof e.irVersion?t.irVersion=parseInt(e.irVersion,10):"number"==typeof e.irVersion?t.irVersion=e.irVersion:"object"==typeof e.irVersion&&(t.irVersion=new c.LongBits(e.irVersion.low>>>0,e.irVersion.high>>>0).toNumber())),e.opsetImport){if(!Array.isArray(e.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");t.opsetImport=[];for(var n=0;n<e.opsetImport.length;++n){if("object"!=typeof e.opsetImport[n])throw TypeError(".onnx.ModelProto.opsetImport: object expected");t.opsetImport[n]=u.onnx.OperatorSetIdProto.fromObject(e.opsetImport[n])}}if(null!=e.producerName&&(t.producerName=String(e.producerName)),null!=e.producerVersion&&(t.producerVersion=String(e.producerVersion)),null!=e.domain&&(t.domain=String(e.domain)),null!=e.modelVersion&&(c.Long?(t.modelVersion=c.Long.fromValue(e.modelVersion)).unsigned=!1:"string"==typeof e.modelVersion?t.modelVersion=parseInt(e.modelVersion,10):"number"==typeof e.modelVersion?t.modelVersion=e.modelVersion:"object"==typeof e.modelVersion&&(t.modelVersion=new c.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber())),null!=e.docString&&(t.docString=String(e.docString)),null!=e.graph){if("object"!=typeof e.graph)throw TypeError(".onnx.ModelProto.graph: object expected");t.graph=u.onnx.GraphProto.fromObject(e.graph)}if(e.metadataProps){if(!Array.isArray(e.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(t.metadataProps=[],n=0;n<e.metadataProps.length;++n){if("object"!=typeof e.metadataProps[n])throw TypeError(".onnx.ModelProto.metadataProps: object expected");t.metadataProps[n]=u.onnx.StringStringEntryProto.fromObject(e.metadataProps[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.opsetImport=[],n.metadataProps=[]),t.defaults){if(c.Long){var r=new c.Long(0,0,!1);n.irVersion=t.longs===String?r.toString():t.longs===Number?r.toNumber():r}else n.irVersion=t.longs===String?"0":0;n.producerName="",n.producerVersion="",n.domain="",c.Long?(r=new c.Long(0,0,!1),n.modelVersion=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.modelVersion=t.longs===String?"0":0,n.docString="",n.graph=null}if(null!=e.irVersion&&e.hasOwnProperty("irVersion")&&("number"==typeof e.irVersion?n.irVersion=t.longs===String?String(e.irVersion):e.irVersion:n.irVersion=t.longs===String?c.Long.prototype.toString.call(e.irVersion):t.longs===Number?new c.LongBits(e.irVersion.low>>>0,e.irVersion.high>>>0).toNumber():e.irVersion),null!=e.producerName&&e.hasOwnProperty("producerName")&&(n.producerName=e.producerName),null!=e.producerVersion&&e.hasOwnProperty("producerVersion")&&(n.producerVersion=e.producerVersion),null!=e.domain&&e.hasOwnProperty("domain")&&(n.domain=e.domain),null!=e.modelVersion&&e.hasOwnProperty("modelVersion")&&("number"==typeof e.modelVersion?n.modelVersion=t.longs===String?String(e.modelVersion):e.modelVersion:n.modelVersion=t.longs===String?c.Long.prototype.toString.call(e.modelVersion):t.longs===Number?new c.LongBits(e.modelVersion.low>>>0,e.modelVersion.high>>>0).toNumber():e.modelVersion),null!=e.docString&&e.hasOwnProperty("docString")&&(n.docString=e.docString),null!=e.graph&&e.hasOwnProperty("graph")&&(n.graph=u.onnx.GraphProto.toObject(e.graph,t)),e.opsetImport&&e.opsetImport.length){n.opsetImport=[];for(var o=0;o<e.opsetImport.length;++o)n.opsetImport[o]=u.onnx.OperatorSetIdProto.toObject(e.opsetImport[o],t)}if(e.metadataProps&&e.metadataProps.length)for(n.metadataProps=[],o=0;o<e.metadataProps.length;++o)n.metadataProps[o]=u.onnx.StringStringEntryProto.toObject(e.metadataProps[o],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),i.StringStringEntryProto=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.key="",e.prototype.value="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.key&&e.hasOwnProperty("key")&&t.uint32(10).string(e.key),null!=e.value&&e.hasOwnProperty("value")&&t.uint32(18).string(e.value),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.StringStringEntryProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.key=e.string();break;case 2:r.value=e.string();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.key&&e.hasOwnProperty("key")&&!c.isString(e.key)?"key: string expected":null!=e.value&&e.hasOwnProperty("value")&&!c.isString(e.value)?"value: string expected":null},e.fromObject=function(e){if(e instanceof u.onnx.StringStringEntryProto)return e;var t=new u.onnx.StringStringEntryProto;return null!=e.key&&(t.key=String(e.key)),null!=e.value&&(t.value=String(e.value)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.key="",n.value=""),null!=e.key&&e.hasOwnProperty("key")&&(n.key=e.key),null!=e.value&&e.hasOwnProperty("value")&&(n.value=e.value),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),i.TensorAnnotation=function(){function e(e){if(this.quantParameterTensorNames=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.tensorName="",e.prototype.quantParameterTensorNames=c.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.tensorName&&e.hasOwnProperty("tensorName")&&t.uint32(10).string(e.tensorName),null!=e.quantParameterTensorNames&&e.quantParameterTensorNames.length)for(var n=0;n<e.quantParameterTensorNames.length;++n)u.onnx.StringStringEntryProto.encode(e.quantParameterTensorNames[n],t.uint32(18).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.TensorAnnotation;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.tensorName=e.string();break;case 2:r.quantParameterTensorNames&&r.quantParameterTensorNames.length||(r.quantParameterTensorNames=[]),r.quantParameterTensorNames.push(u.onnx.StringStringEntryProto.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.tensorName&&e.hasOwnProperty("tensorName")&&!c.isString(e.tensorName))return"tensorName: string expected";if(null!=e.quantParameterTensorNames&&e.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(e.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var t=0;t<e.quantParameterTensorNames.length;++t){var n=u.onnx.StringStringEntryProto.verify(e.quantParameterTensorNames[t]);if(n)return"quantParameterTensorNames."+n}}return null},e.fromObject=function(e){if(e instanceof u.onnx.TensorAnnotation)return e;var t=new u.onnx.TensorAnnotation;if(null!=e.tensorName&&(t.tensorName=String(e.tensorName)),e.quantParameterTensorNames){if(!Array.isArray(e.quantParameterTensorNames))throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: array expected");t.quantParameterTensorNames=[];for(var n=0;n<e.quantParameterTensorNames.length;++n){if("object"!=typeof e.quantParameterTensorNames[n])throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: object expected");t.quantParameterTensorNames[n]=u.onnx.StringStringEntryProto.fromObject(e.quantParameterTensorNames[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.quantParameterTensorNames=[]),t.defaults&&(n.tensorName=""),null!=e.tensorName&&e.hasOwnProperty("tensorName")&&(n.tensorName=e.tensorName),e.quantParameterTensorNames&&e.quantParameterTensorNames.length){n.quantParameterTensorNames=[];for(var r=0;r<e.quantParameterTensorNames.length;++r)n.quantParameterTensorNames[r]=u.onnx.StringStringEntryProto.toObject(e.quantParameterTensorNames[r],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),i.GraphProto=function(){function e(e){if(this.node=[],this.initializer=[],this.input=[],this.output=[],this.valueInfo=[],this.quantizationAnnotation=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.node=c.emptyArray,e.prototype.name="",e.prototype.initializer=c.emptyArray,e.prototype.docString="",e.prototype.input=c.emptyArray,e.prototype.output=c.emptyArray,e.prototype.valueInfo=c.emptyArray,e.prototype.quantizationAnnotation=c.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.node&&e.node.length)for(var n=0;n<e.node.length;++n)u.onnx.NodeProto.encode(e.node[n],t.uint32(10).fork()).ldelim();if(null!=e.name&&e.hasOwnProperty("name")&&t.uint32(18).string(e.name),null!=e.initializer&&e.initializer.length)for(n=0;n<e.initializer.length;++n)u.onnx.TensorProto.encode(e.initializer[n],t.uint32(42).fork()).ldelim();if(null!=e.docString&&e.hasOwnProperty("docString")&&t.uint32(82).string(e.docString),null!=e.input&&e.input.length)for(n=0;n<e.input.length;++n)u.onnx.ValueInfoProto.encode(e.input[n],t.uint32(90).fork()).ldelim();if(null!=e.output&&e.output.length)for(n=0;n<e.output.length;++n)u.onnx.ValueInfoProto.encode(e.output[n],t.uint32(98).fork()).ldelim();if(null!=e.valueInfo&&e.valueInfo.length)for(n=0;n<e.valueInfo.length;++n)u.onnx.ValueInfoProto.encode(e.valueInfo[n],t.uint32(106).fork()).ldelim();if(null!=e.quantizationAnnotation&&e.quantizationAnnotation.length)for(n=0;n<e.quantizationAnnotation.length;++n)u.onnx.TensorAnnotation.encode(e.quantizationAnnotation[n],t.uint32(114).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.GraphProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.node&&r.node.length||(r.node=[]),r.node.push(u.onnx.NodeProto.decode(e,e.uint32()));break;case 2:r.name=e.string();break;case 5:r.initializer&&r.initializer.length||(r.initializer=[]),r.initializer.push(u.onnx.TensorProto.decode(e,e.uint32()));break;case 10:r.docString=e.string();break;case 11:r.input&&r.input.length||(r.input=[]),r.input.push(u.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 12:r.output&&r.output.length||(r.output=[]),r.output.push(u.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 13:r.valueInfo&&r.valueInfo.length||(r.valueInfo=[]),r.valueInfo.push(u.onnx.ValueInfoProto.decode(e,e.uint32()));break;case 14:r.quantizationAnnotation&&r.quantizationAnnotation.length||(r.quantizationAnnotation=[]),r.quantizationAnnotation.push(u.onnx.TensorAnnotation.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.node&&e.hasOwnProperty("node")){if(!Array.isArray(e.node))return"node: array expected";for(var t=0;t<e.node.length;++t)if(n=u.onnx.NodeProto.verify(e.node[t]))return"node."+n}if(null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name))return"name: string expected";if(null!=e.initializer&&e.hasOwnProperty("initializer")){if(!Array.isArray(e.initializer))return"initializer: array expected";for(t=0;t<e.initializer.length;++t)if(n=u.onnx.TensorProto.verify(e.initializer[t]))return"initializer."+n}if(null!=e.docString&&e.hasOwnProperty("docString")&&!c.isString(e.docString))return"docString: string expected";if(null!=e.input&&e.hasOwnProperty("input")){if(!Array.isArray(e.input))return"input: array expected";for(t=0;t<e.input.length;++t)if(n=u.onnx.ValueInfoProto.verify(e.input[t]))return"input."+n}if(null!=e.output&&e.hasOwnProperty("output")){if(!Array.isArray(e.output))return"output: array expected";for(t=0;t<e.output.length;++t)if(n=u.onnx.ValueInfoProto.verify(e.output[t]))return"output."+n}if(null!=e.valueInfo&&e.hasOwnProperty("valueInfo")){if(!Array.isArray(e.valueInfo))return"valueInfo: array expected";for(t=0;t<e.valueInfo.length;++t)if(n=u.onnx.ValueInfoProto.verify(e.valueInfo[t]))return"valueInfo."+n}if(null!=e.quantizationAnnotation&&e.hasOwnProperty("quantizationAnnotation")){if(!Array.isArray(e.quantizationAnnotation))return"quantizationAnnotation: array expected";for(t=0;t<e.quantizationAnnotation.length;++t){var n;if(n=u.onnx.TensorAnnotation.verify(e.quantizationAnnotation[t]))return"quantizationAnnotation."+n}}return null},e.fromObject=function(e){if(e instanceof u.onnx.GraphProto)return e;var t=new u.onnx.GraphProto;if(e.node){if(!Array.isArray(e.node))throw TypeError(".onnx.GraphProto.node: array expected");t.node=[];for(var n=0;n<e.node.length;++n){if("object"!=typeof e.node[n])throw TypeError(".onnx.GraphProto.node: object expected");t.node[n]=u.onnx.NodeProto.fromObject(e.node[n])}}if(null!=e.name&&(t.name=String(e.name)),e.initializer){if(!Array.isArray(e.initializer))throw TypeError(".onnx.GraphProto.initializer: array expected");for(t.initializer=[],n=0;n<e.initializer.length;++n){if("object"!=typeof e.initializer[n])throw TypeError(".onnx.GraphProto.initializer: object expected");t.initializer[n]=u.onnx.TensorProto.fromObject(e.initializer[n])}}if(null!=e.docString&&(t.docString=String(e.docString)),e.input){if(!Array.isArray(e.input))throw TypeError(".onnx.GraphProto.input: array expected");for(t.input=[],n=0;n<e.input.length;++n){if("object"!=typeof e.input[n])throw TypeError(".onnx.GraphProto.input: object expected");t.input[n]=u.onnx.ValueInfoProto.fromObject(e.input[n])}}if(e.output){if(!Array.isArray(e.output))throw TypeError(".onnx.GraphProto.output: array expected");for(t.output=[],n=0;n<e.output.length;++n){if("object"!=typeof e.output[n])throw TypeError(".onnx.GraphProto.output: object expected");t.output[n]=u.onnx.ValueInfoProto.fromObject(e.output[n])}}if(e.valueInfo){if(!Array.isArray(e.valueInfo))throw TypeError(".onnx.GraphProto.valueInfo: array expected");for(t.valueInfo=[],n=0;n<e.valueInfo.length;++n){if("object"!=typeof e.valueInfo[n])throw TypeError(".onnx.GraphProto.valueInfo: object expected");t.valueInfo[n]=u.onnx.ValueInfoProto.fromObject(e.valueInfo[n])}}if(e.quantizationAnnotation){if(!Array.isArray(e.quantizationAnnotation))throw TypeError(".onnx.GraphProto.quantizationAnnotation: array expected");for(t.quantizationAnnotation=[],n=0;n<e.quantizationAnnotation.length;++n){if("object"!=typeof e.quantizationAnnotation[n])throw TypeError(".onnx.GraphProto.quantizationAnnotation: object expected");t.quantizationAnnotation[n]=u.onnx.TensorAnnotation.fromObject(e.quantizationAnnotation[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.node=[],n.initializer=[],n.input=[],n.output=[],n.valueInfo=[],n.quantizationAnnotation=[]),t.defaults&&(n.name="",n.docString=""),e.node&&e.node.length){n.node=[];for(var r=0;r<e.node.length;++r)n.node[r]=u.onnx.NodeProto.toObject(e.node[r],t)}if(null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),e.initializer&&e.initializer.length)for(n.initializer=[],r=0;r<e.initializer.length;++r)n.initializer[r]=u.onnx.TensorProto.toObject(e.initializer[r],t);if(null!=e.docString&&e.hasOwnProperty("docString")&&(n.docString=e.docString),e.input&&e.input.length)for(n.input=[],r=0;r<e.input.length;++r)n.input[r]=u.onnx.ValueInfoProto.toObject(e.input[r],t);if(e.output&&e.output.length)for(n.output=[],r=0;r<e.output.length;++r)n.output[r]=u.onnx.ValueInfoProto.toObject(e.output[r],t);if(e.valueInfo&&e.valueInfo.length)for(n.valueInfo=[],r=0;r<e.valueInfo.length;++r)n.valueInfo[r]=u.onnx.ValueInfoProto.toObject(e.valueInfo[r],t);if(e.quantizationAnnotation&&e.quantizationAnnotation.length)for(n.quantizationAnnotation=[],r=0;r<e.quantizationAnnotation.length;++r)n.quantizationAnnotation[r]=u.onnx.TensorAnnotation.toObject(e.quantizationAnnotation[r],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),i.TensorProto=function(){function e(e){if(this.dims=[],this.floatData=[],this.int32Data=[],this.stringData=[],this.int64Data=[],this.externalData=[],this.doubleData=[],this.uint64Data=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.dims=c.emptyArray,e.prototype.dataType=0,e.prototype.segment=null,e.prototype.floatData=c.emptyArray,e.prototype.int32Data=c.emptyArray,e.prototype.stringData=c.emptyArray,e.prototype.int64Data=c.emptyArray,e.prototype.name="",e.prototype.docString="",e.prototype.rawData=c.newBuffer([]),e.prototype.externalData=c.emptyArray,e.prototype.dataLocation=0,e.prototype.doubleData=c.emptyArray,e.prototype.uint64Data=c.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.dims&&e.dims.length){t.uint32(10).fork();for(var n=0;n<e.dims.length;++n)t.int64(e.dims[n]);t.ldelim()}if(null!=e.dataType&&e.hasOwnProperty("dataType")&&t.uint32(16).int32(e.dataType),null!=e.segment&&e.hasOwnProperty("segment")&&u.onnx.TensorProto.Segment.encode(e.segment,t.uint32(26).fork()).ldelim(),null!=e.floatData&&e.floatData.length){for(t.uint32(34).fork(),n=0;n<e.floatData.length;++n)t.float(e.floatData[n]);t.ldelim()}if(null!=e.int32Data&&e.int32Data.length){for(t.uint32(42).fork(),n=0;n<e.int32Data.length;++n)t.int32(e.int32Data[n]);t.ldelim()}if(null!=e.stringData&&e.stringData.length)for(n=0;n<e.stringData.length;++n)t.uint32(50).bytes(e.stringData[n]);if(null!=e.int64Data&&e.int64Data.length){for(t.uint32(58).fork(),n=0;n<e.int64Data.length;++n)t.int64(e.int64Data[n]);t.ldelim()}if(null!=e.name&&e.hasOwnProperty("name")&&t.uint32(66).string(e.name),null!=e.rawData&&e.hasOwnProperty("rawData")&&t.uint32(74).bytes(e.rawData),null!=e.doubleData&&e.doubleData.length){for(t.uint32(82).fork(),n=0;n<e.doubleData.length;++n)t.double(e.doubleData[n]);t.ldelim()}if(null!=e.uint64Data&&e.uint64Data.length){for(t.uint32(90).fork(),n=0;n<e.uint64Data.length;++n)t.uint64(e.uint64Data[n]);t.ldelim()}if(null!=e.docString&&e.hasOwnProperty("docString")&&t.uint32(98).string(e.docString),null!=e.externalData&&e.externalData.length)for(n=0;n<e.externalData.length;++n)u.onnx.StringStringEntryProto.encode(e.externalData[n],t.uint32(106).fork()).ldelim();return null!=e.dataLocation&&e.hasOwnProperty("dataLocation")&&t.uint32(112).int32(e.dataLocation),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.TensorProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:if(r.dims&&r.dims.length||(r.dims=[]),2==(7&o))for(var i=e.uint32()+e.pos;e.pos<i;)r.dims.push(e.int64());else r.dims.push(e.int64());break;case 2:r.dataType=e.int32();break;case 3:r.segment=u.onnx.TensorProto.Segment.decode(e,e.uint32());break;case 4:if(r.floatData&&r.floatData.length||(r.floatData=[]),2==(7&o))for(i=e.uint32()+e.pos;e.pos<i;)r.floatData.push(e.float());else r.floatData.push(e.float());break;case 5:if(r.int32Data&&r.int32Data.length||(r.int32Data=[]),2==(7&o))for(i=e.uint32()+e.pos;e.pos<i;)r.int32Data.push(e.int32());else r.int32Data.push(e.int32());break;case 6:r.stringData&&r.stringData.length||(r.stringData=[]),r.stringData.push(e.bytes());break;case 7:if(r.int64Data&&r.int64Data.length||(r.int64Data=[]),2==(7&o))for(i=e.uint32()+e.pos;e.pos<i;)r.int64Data.push(e.int64());else r.int64Data.push(e.int64());break;case 8:r.name=e.string();break;case 12:r.docString=e.string();break;case 9:r.rawData=e.bytes();break;case 13:r.externalData&&r.externalData.length||(r.externalData=[]),r.externalData.push(u.onnx.StringStringEntryProto.decode(e,e.uint32()));break;case 14:r.dataLocation=e.int32();break;case 10:if(r.doubleData&&r.doubleData.length||(r.doubleData=[]),2==(7&o))for(i=e.uint32()+e.pos;e.pos<i;)r.doubleData.push(e.double());else r.doubleData.push(e.double());break;case 11:if(r.uint64Data&&r.uint64Data.length||(r.uint64Data=[]),2==(7&o))for(i=e.uint32()+e.pos;e.pos<i;)r.uint64Data.push(e.uint64());else r.uint64Data.push(e.uint64());break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dims&&e.hasOwnProperty("dims")){if(!Array.isArray(e.dims))return"dims: array expected";for(var t=0;t<e.dims.length;++t)if(!(c.isInteger(e.dims[t])||e.dims[t]&&c.isInteger(e.dims[t].low)&&c.isInteger(e.dims[t].high)))return"dims: integer|Long[] expected"}if(null!=e.dataType&&e.hasOwnProperty("dataType")&&!c.isInteger(e.dataType))return"dataType: integer expected";if(null!=e.segment&&e.hasOwnProperty("segment")&&(n=u.onnx.TensorProto.Segment.verify(e.segment)))return"segment."+n;if(null!=e.floatData&&e.hasOwnProperty("floatData")){if(!Array.isArray(e.floatData))return"floatData: array expected";for(t=0;t<e.floatData.length;++t)if("number"!=typeof e.floatData[t])return"floatData: number[] expected"}if(null!=e.int32Data&&e.hasOwnProperty("int32Data")){if(!Array.isArray(e.int32Data))return"int32Data: array expected";for(t=0;t<e.int32Data.length;++t)if(!c.isInteger(e.int32Data[t]))return"int32Data: integer[] expected"}if(null!=e.stringData&&e.hasOwnProperty("stringData")){if(!Array.isArray(e.stringData))return"stringData: array expected";for(t=0;t<e.stringData.length;++t)if(!(e.stringData[t]&&"number"==typeof e.stringData[t].length||c.isString(e.stringData[t])))return"stringData: buffer[] expected"}if(null!=e.int64Data&&e.hasOwnProperty("int64Data")){if(!Array.isArray(e.int64Data))return"int64Data: array expected";for(t=0;t<e.int64Data.length;++t)if(!(c.isInteger(e.int64Data[t])||e.int64Data[t]&&c.isInteger(e.int64Data[t].low)&&c.isInteger(e.int64Data[t].high)))return"int64Data: integer|Long[] expected"}if(null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name))return"name: string expected";if(null!=e.docString&&e.hasOwnProperty("docString")&&!c.isString(e.docString))return"docString: string expected";if(null!=e.rawData&&e.hasOwnProperty("rawData")&&!(e.rawData&&"number"==typeof e.rawData.length||c.isString(e.rawData)))return"rawData: buffer expected";if(null!=e.externalData&&e.hasOwnProperty("externalData")){if(!Array.isArray(e.externalData))return"externalData: array expected";for(t=0;t<e.externalData.length;++t){var n;if(n=u.onnx.StringStringEntryProto.verify(e.externalData[t]))return"externalData."+n}}if(null!=e.dataLocation&&e.hasOwnProperty("dataLocation"))switch(e.dataLocation){default:return"dataLocation: enum value expected";case 0:case 1:}if(null!=e.doubleData&&e.hasOwnProperty("doubleData")){if(!Array.isArray(e.doubleData))return"doubleData: array expected";for(t=0;t<e.doubleData.length;++t)if("number"!=typeof e.doubleData[t])return"doubleData: number[] expected"}if(null!=e.uint64Data&&e.hasOwnProperty("uint64Data")){if(!Array.isArray(e.uint64Data))return"uint64Data: array expected";for(t=0;t<e.uint64Data.length;++t)if(!(c.isInteger(e.uint64Data[t])||e.uint64Data[t]&&c.isInteger(e.uint64Data[t].low)&&c.isInteger(e.uint64Data[t].high)))return"uint64Data: integer|Long[] expected"}return null},e.fromObject=function(e){if(e instanceof u.onnx.TensorProto)return e;var t=new u.onnx.TensorProto;if(e.dims){if(!Array.isArray(e.dims))throw TypeError(".onnx.TensorProto.dims: array expected");t.dims=[];for(var n=0;n<e.dims.length;++n)c.Long?(t.dims[n]=c.Long.fromValue(e.dims[n])).unsigned=!1:"string"==typeof e.dims[n]?t.dims[n]=parseInt(e.dims[n],10):"number"==typeof e.dims[n]?t.dims[n]=e.dims[n]:"object"==typeof e.dims[n]&&(t.dims[n]=new c.LongBits(e.dims[n].low>>>0,e.dims[n].high>>>0).toNumber())}if(null!=e.dataType&&(t.dataType=0|e.dataType),null!=e.segment){if("object"!=typeof e.segment)throw TypeError(".onnx.TensorProto.segment: object expected");t.segment=u.onnx.TensorProto.Segment.fromObject(e.segment)}if(e.floatData){if(!Array.isArray(e.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(t.floatData=[],n=0;n<e.floatData.length;++n)t.floatData[n]=Number(e.floatData[n])}if(e.int32Data){if(!Array.isArray(e.int32Data))throw TypeError(".onnx.TensorProto.int32Data: array expected");for(t.int32Data=[],n=0;n<e.int32Data.length;++n)t.int32Data[n]=0|e.int32Data[n]}if(e.stringData){if(!Array.isArray(e.stringData))throw TypeError(".onnx.TensorProto.stringData: array expected");for(t.stringData=[],n=0;n<e.stringData.length;++n)"string"==typeof e.stringData[n]?c.base64.decode(e.stringData[n],t.stringData[n]=c.newBuffer(c.base64.length(e.stringData[n])),0):e.stringData[n].length&&(t.stringData[n]=e.stringData[n])}if(e.int64Data){if(!Array.isArray(e.int64Data))throw TypeError(".onnx.TensorProto.int64Data: array expected");for(t.int64Data=[],n=0;n<e.int64Data.length;++n)c.Long?(t.int64Data[n]=c.Long.fromValue(e.int64Data[n])).unsigned=!1:"string"==typeof e.int64Data[n]?t.int64Data[n]=parseInt(e.int64Data[n],10):"number"==typeof e.int64Data[n]?t.int64Data[n]=e.int64Data[n]:"object"==typeof e.int64Data[n]&&(t.int64Data[n]=new c.LongBits(e.int64Data[n].low>>>0,e.int64Data[n].high>>>0).toNumber())}if(null!=e.name&&(t.name=String(e.name)),null!=e.docString&&(t.docString=String(e.docString)),null!=e.rawData&&("string"==typeof e.rawData?c.base64.decode(e.rawData,t.rawData=c.newBuffer(c.base64.length(e.rawData)),0):e.rawData.length&&(t.rawData=e.rawData)),e.externalData){if(!Array.isArray(e.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(t.externalData=[],n=0;n<e.externalData.length;++n){if("object"!=typeof e.externalData[n])throw TypeError(".onnx.TensorProto.externalData: object expected");t.externalData[n]=u.onnx.StringStringEntryProto.fromObject(e.externalData[n])}}switch(e.dataLocation){case"DEFAULT":case 0:t.dataLocation=0;break;case"EXTERNAL":case 1:t.dataLocation=1}if(e.doubleData){if(!Array.isArray(e.doubleData))throw TypeError(".onnx.TensorProto.doubleData: array expected");for(t.doubleData=[],n=0;n<e.doubleData.length;++n)t.doubleData[n]=Number(e.doubleData[n])}if(e.uint64Data){if(!Array.isArray(e.uint64Data))throw TypeError(".onnx.TensorProto.uint64Data: array expected");for(t.uint64Data=[],n=0;n<e.uint64Data.length;++n)c.Long?(t.uint64Data[n]=c.Long.fromValue(e.uint64Data[n])).unsigned=!0:"string"==typeof e.uint64Data[n]?t.uint64Data[n]=parseInt(e.uint64Data[n],10):"number"==typeof e.uint64Data[n]?t.uint64Data[n]=e.uint64Data[n]:"object"==typeof e.uint64Data[n]&&(t.uint64Data[n]=new c.LongBits(e.uint64Data[n].low>>>0,e.uint64Data[n].high>>>0).toNumber(!0))}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.dims=[],n.floatData=[],n.int32Data=[],n.stringData=[],n.int64Data=[],n.doubleData=[],n.uint64Data=[],n.externalData=[]),t.defaults&&(n.dataType=0,n.segment=null,n.name="",t.bytes===String?n.rawData="":(n.rawData=[],t.bytes!==Array&&(n.rawData=c.newBuffer(n.rawData))),n.docString="",n.dataLocation=t.enums===String?"DEFAULT":0),e.dims&&e.dims.length){n.dims=[];for(var r=0;r<e.dims.length;++r)"number"==typeof e.dims[r]?n.dims[r]=t.longs===String?String(e.dims[r]):e.dims[r]:n.dims[r]=t.longs===String?c.Long.prototype.toString.call(e.dims[r]):t.longs===Number?new c.LongBits(e.dims[r].low>>>0,e.dims[r].high>>>0).toNumber():e.dims[r]}if(null!=e.dataType&&e.hasOwnProperty("dataType")&&(n.dataType=e.dataType),null!=e.segment&&e.hasOwnProperty("segment")&&(n.segment=u.onnx.TensorProto.Segment.toObject(e.segment,t)),e.floatData&&e.floatData.length)for(n.floatData=[],r=0;r<e.floatData.length;++r)n.floatData[r]=t.json&&!isFinite(e.floatData[r])?String(e.floatData[r]):e.floatData[r];if(e.int32Data&&e.int32Data.length)for(n.int32Data=[],r=0;r<e.int32Data.length;++r)n.int32Data[r]=e.int32Data[r];if(e.stringData&&e.stringData.length)for(n.stringData=[],r=0;r<e.stringData.length;++r)n.stringData[r]=t.bytes===String?c.base64.encode(e.stringData[r],0,e.stringData[r].length):t.bytes===Array?Array.prototype.slice.call(e.stringData[r]):e.stringData[r];if(e.int64Data&&e.int64Data.length)for(n.int64Data=[],r=0;r<e.int64Data.length;++r)"number"==typeof e.int64Data[r]?n.int64Data[r]=t.longs===String?String(e.int64Data[r]):e.int64Data[r]:n.int64Data[r]=t.longs===String?c.Long.prototype.toString.call(e.int64Data[r]):t.longs===Number?new c.LongBits(e.int64Data[r].low>>>0,e.int64Data[r].high>>>0).toNumber():e.int64Data[r];if(null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.rawData&&e.hasOwnProperty("rawData")&&(n.rawData=t.bytes===String?c.base64.encode(e.rawData,0,e.rawData.length):t.bytes===Array?Array.prototype.slice.call(e.rawData):e.rawData),e.doubleData&&e.doubleData.length)for(n.doubleData=[],r=0;r<e.doubleData.length;++r)n.doubleData[r]=t.json&&!isFinite(e.doubleData[r])?String(e.doubleData[r]):e.doubleData[r];if(e.uint64Data&&e.uint64Data.length)for(n.uint64Data=[],r=0;r<e.uint64Data.length;++r)"number"==typeof e.uint64Data[r]?n.uint64Data[r]=t.longs===String?String(e.uint64Data[r]):e.uint64Data[r]:n.uint64Data[r]=t.longs===String?c.Long.prototype.toString.call(e.uint64Data[r]):t.longs===Number?new c.LongBits(e.uint64Data[r].low>>>0,e.uint64Data[r].high>>>0).toNumber(!0):e.uint64Data[r];if(null!=e.docString&&e.hasOwnProperty("docString")&&(n.docString=e.docString),e.externalData&&e.externalData.length)for(n.externalData=[],r=0;r<e.externalData.length;++r)n.externalData[r]=u.onnx.StringStringEntryProto.toObject(e.externalData[r],t);return null!=e.dataLocation&&e.hasOwnProperty("dataLocation")&&(n.dataLocation=t.enums===String?u.onnx.TensorProto.DataLocation[e.dataLocation]:e.dataLocation),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e.DataType=function(){var e={},t=Object.create(e);return t[e[0]="UNDEFINED"]=0,t[e[1]="FLOAT"]=1,t[e[2]="UINT8"]=2,t[e[3]="INT8"]=3,t[e[4]="UINT16"]=4,t[e[5]="INT16"]=5,t[e[6]="INT32"]=6,t[e[7]="INT64"]=7,t[e[8]="STRING"]=8,t[e[9]="BOOL"]=9,t[e[10]="FLOAT16"]=10,t[e[11]="DOUBLE"]=11,t[e[12]="UINT32"]=12,t[e[13]="UINT64"]=13,t[e[14]="COMPLEX64"]=14,t[e[15]="COMPLEX128"]=15,t[e[16]="BFLOAT16"]=16,t}(),e.Segment=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.begin=c.Long?c.Long.fromBits(0,0,!1):0,e.prototype.end=c.Long?c.Long.fromBits(0,0,!1):0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.begin&&e.hasOwnProperty("begin")&&t.uint32(8).int64(e.begin),null!=e.end&&e.hasOwnProperty("end")&&t.uint32(16).int64(e.end),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.TensorProto.Segment;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.begin=e.int64();break;case 2:r.end=e.int64();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.begin&&e.hasOwnProperty("begin")&&!(c.isInteger(e.begin)||e.begin&&c.isInteger(e.begin.low)&&c.isInteger(e.begin.high))?"begin: integer|Long expected":null!=e.end&&e.hasOwnProperty("end")&&!(c.isInteger(e.end)||e.end&&c.isInteger(e.end.low)&&c.isInteger(e.end.high))?"end: integer|Long expected":null},e.fromObject=function(e){if(e instanceof u.onnx.TensorProto.Segment)return e;var t=new u.onnx.TensorProto.Segment;return null!=e.begin&&(c.Long?(t.begin=c.Long.fromValue(e.begin)).unsigned=!1:"string"==typeof e.begin?t.begin=parseInt(e.begin,10):"number"==typeof e.begin?t.begin=e.begin:"object"==typeof e.begin&&(t.begin=new c.LongBits(e.begin.low>>>0,e.begin.high>>>0).toNumber())),null!=e.end&&(c.Long?(t.end=c.Long.fromValue(e.end)).unsigned=!1:"string"==typeof e.end?t.end=parseInt(e.end,10):"number"==typeof e.end?t.end=e.end:"object"==typeof e.end&&(t.end=new c.LongBits(e.end.low>>>0,e.end.high>>>0).toNumber())),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(c.Long){var r=new c.Long(0,0,!1);n.begin=t.longs===String?r.toString():t.longs===Number?r.toNumber():r}else n.begin=t.longs===String?"0":0;c.Long?(r=new c.Long(0,0,!1),n.end=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.end=t.longs===String?"0":0}return null!=e.begin&&e.hasOwnProperty("begin")&&("number"==typeof e.begin?n.begin=t.longs===String?String(e.begin):e.begin:n.begin=t.longs===String?c.Long.prototype.toString.call(e.begin):t.longs===Number?new c.LongBits(e.begin.low>>>0,e.begin.high>>>0).toNumber():e.begin),null!=e.end&&e.hasOwnProperty("end")&&("number"==typeof e.end?n.end=t.longs===String?String(e.end):e.end:n.end=t.longs===String?c.Long.prototype.toString.call(e.end):t.longs===Number?new c.LongBits(e.end.low>>>0,e.end.high>>>0).toNumber():e.end),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),e.DataLocation=function(){var e={},t=Object.create(e);return t[e[0]="DEFAULT"]=0,t[e[1]="EXTERNAL"]=1,t}(),e}(),i.TensorShapeProto=function(){function e(e){if(this.dim=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.dim=c.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.dim&&e.dim.length)for(var n=0;n<e.dim.length;++n)u.onnx.TensorShapeProto.Dimension.encode(e.dim[n],t.uint32(10).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.TensorShapeProto;e.pos<n;){var o=e.uint32();o>>>3==1?(r.dim&&r.dim.length||(r.dim=[]),r.dim.push(u.onnx.TensorShapeProto.Dimension.decode(e,e.uint32()))):e.skipType(7&o)}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dim&&e.hasOwnProperty("dim")){if(!Array.isArray(e.dim))return"dim: array expected";for(var t=0;t<e.dim.length;++t){var n=u.onnx.TensorShapeProto.Dimension.verify(e.dim[t]);if(n)return"dim."+n}}return null},e.fromObject=function(e){if(e instanceof u.onnx.TensorShapeProto)return e;var t=new u.onnx.TensorShapeProto;if(e.dim){if(!Array.isArray(e.dim))throw TypeError(".onnx.TensorShapeProto.dim: array expected");t.dim=[];for(var n=0;n<e.dim.length;++n){if("object"!=typeof e.dim[n])throw TypeError(".onnx.TensorShapeProto.dim: object expected");t.dim[n]=u.onnx.TensorShapeProto.Dimension.fromObject(e.dim[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.dim=[]),e.dim&&e.dim.length){n.dim=[];for(var r=0;r<e.dim.length;++r)n.dim[r]=u.onnx.TensorShapeProto.Dimension.toObject(e.dim[r],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e.Dimension=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t;return e.prototype.dimValue=c.Long?c.Long.fromBits(0,0,!1):0,e.prototype.dimParam="",e.prototype.denotation="",Object.defineProperty(e.prototype,"value",{get:c.oneOfGetter(t=["dimValue","dimParam"]),set:c.oneOfSetter(t)}),e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.dimValue&&e.hasOwnProperty("dimValue")&&t.uint32(8).int64(e.dimValue),null!=e.dimParam&&e.hasOwnProperty("dimParam")&&t.uint32(18).string(e.dimParam),null!=e.denotation&&e.hasOwnProperty("denotation")&&t.uint32(26).string(e.denotation),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.TensorShapeProto.Dimension;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.dimValue=e.int64();break;case 2:r.dimParam=e.string();break;case 3:r.denotation=e.string();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.dimValue&&e.hasOwnProperty("dimValue")&&(t.value=1,!(c.isInteger(e.dimValue)||e.dimValue&&c.isInteger(e.dimValue.low)&&c.isInteger(e.dimValue.high))))return"dimValue: integer|Long expected";if(null!=e.dimParam&&e.hasOwnProperty("dimParam")){if(1===t.value)return"value: multiple values";if(t.value=1,!c.isString(e.dimParam))return"dimParam: string expected"}return null!=e.denotation&&e.hasOwnProperty("denotation")&&!c.isString(e.denotation)?"denotation: string expected":null},e.fromObject=function(e){if(e instanceof u.onnx.TensorShapeProto.Dimension)return e;var t=new u.onnx.TensorShapeProto.Dimension;return null!=e.dimValue&&(c.Long?(t.dimValue=c.Long.fromValue(e.dimValue)).unsigned=!1:"string"==typeof e.dimValue?t.dimValue=parseInt(e.dimValue,10):"number"==typeof e.dimValue?t.dimValue=e.dimValue:"object"==typeof e.dimValue&&(t.dimValue=new c.LongBits(e.dimValue.low>>>0,e.dimValue.high>>>0).toNumber())),null!=e.dimParam&&(t.dimParam=String(e.dimParam)),null!=e.denotation&&(t.denotation=String(e.denotation)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.denotation=""),null!=e.dimValue&&e.hasOwnProperty("dimValue")&&("number"==typeof e.dimValue?n.dimValue=t.longs===String?String(e.dimValue):e.dimValue:n.dimValue=t.longs===String?c.Long.prototype.toString.call(e.dimValue):t.longs===Number?new c.LongBits(e.dimValue.low>>>0,e.dimValue.high>>>0).toNumber():e.dimValue,t.oneofs&&(n.value="dimValue")),null!=e.dimParam&&e.hasOwnProperty("dimParam")&&(n.dimParam=e.dimParam,t.oneofs&&(n.value="dimParam")),null!=e.denotation&&e.hasOwnProperty("denotation")&&(n.denotation=e.denotation),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),e}(),i.TypeProto=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t;return e.prototype.tensorType=null,e.prototype.denotation="",Object.defineProperty(e.prototype,"value",{get:c.oneOfGetter(t=["tensorType"]),set:c.oneOfSetter(t)}),e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.tensorType&&e.hasOwnProperty("tensorType")&&u.onnx.TypeProto.Tensor.encode(e.tensorType,t.uint32(10).fork()).ldelim(),null!=e.denotation&&e.hasOwnProperty("denotation")&&t.uint32(50).string(e.denotation),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.TypeProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.tensorType=u.onnx.TypeProto.Tensor.decode(e,e.uint32());break;case 6:r.denotation=e.string();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.tensorType&&e.hasOwnProperty("tensorType")){var t=u.onnx.TypeProto.Tensor.verify(e.tensorType);if(t)return"tensorType."+t}return null!=e.denotation&&e.hasOwnProperty("denotation")&&!c.isString(e.denotation)?"denotation: string expected":null},e.fromObject=function(e){if(e instanceof u.onnx.TypeProto)return e;var t=new u.onnx.TypeProto;if(null!=e.tensorType){if("object"!=typeof e.tensorType)throw TypeError(".onnx.TypeProto.tensorType: object expected");t.tensorType=u.onnx.TypeProto.Tensor.fromObject(e.tensorType)}return null!=e.denotation&&(t.denotation=String(e.denotation)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.denotation=""),null!=e.tensorType&&e.hasOwnProperty("tensorType")&&(n.tensorType=u.onnx.TypeProto.Tensor.toObject(e.tensorType,t),t.oneofs&&(n.value="tensorType")),null!=e.denotation&&e.hasOwnProperty("denotation")&&(n.denotation=e.denotation),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e.Tensor=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.elemType=0,e.prototype.shape=null,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.elemType&&e.hasOwnProperty("elemType")&&t.uint32(8).int32(e.elemType),null!=e.shape&&e.hasOwnProperty("shape")&&u.onnx.TensorShapeProto.encode(e.shape,t.uint32(18).fork()).ldelim(),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.TypeProto.Tensor;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.elemType=e.int32();break;case 2:r.shape=u.onnx.TensorShapeProto.decode(e,e.uint32());break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.elemType&&e.hasOwnProperty("elemType")&&!c.isInteger(e.elemType))return"elemType: integer expected";if(null!=e.shape&&e.hasOwnProperty("shape")){var t=u.onnx.TensorShapeProto.verify(e.shape);if(t)return"shape."+t}return null},e.fromObject=function(e){if(e instanceof u.onnx.TypeProto.Tensor)return e;var t=new u.onnx.TypeProto.Tensor;if(null!=e.elemType&&(t.elemType=0|e.elemType),null!=e.shape){if("object"!=typeof e.shape)throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");t.shape=u.onnx.TensorShapeProto.fromObject(e.shape)}return t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.elemType=0,n.shape=null),null!=e.elemType&&e.hasOwnProperty("elemType")&&(n.elemType=e.elemType),null!=e.shape&&e.hasOwnProperty("shape")&&(n.shape=u.onnx.TensorShapeProto.toObject(e.shape,t)),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),e}(),i.OperatorSetIdProto=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.domain="",e.prototype.version=c.Long?c.Long.fromBits(0,0,!1):0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.domain&&e.hasOwnProperty("domain")&&t.uint32(10).string(e.domain),null!=e.version&&e.hasOwnProperty("version")&&t.uint32(16).int64(e.version),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new u.onnx.OperatorSetIdProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:r.domain=e.string();break;case 2:r.version=e.int64();break;default:e.skipType(7&o)}}return r},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.domain&&e.hasOwnProperty("domain")&&!c.isString(e.domain)?"domain: string expected":null!=e.version&&e.hasOwnProperty("version")&&!(c.isInteger(e.version)||e.version&&c.isInteger(e.version.low)&&c.isInteger(e.version.high))?"version: integer|Long expected":null},e.fromObject=function(e){if(e instanceof u.onnx.OperatorSetIdProto)return e;var t=new u.onnx.OperatorSetIdProto;return null!=e.domain&&(t.domain=String(e.domain)),null!=e.version&&(c.Long?(t.version=c.Long.fromValue(e.version)).unsigned=!1:"string"==typeof e.version?t.version=parseInt(e.version,10):"number"==typeof e.version?t.version=e.version:"object"==typeof e.version&&(t.version=new c.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber())),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults)if(n.domain="",c.Long){var r=new c.Long(0,0,!1);n.version=t.longs===String?r.toString():t.longs===Number?r.toNumber():r}else n.version=t.longs===String?"0":0;return null!=e.domain&&e.hasOwnProperty("domain")&&(n.domain=e.domain),null!=e.version&&e.hasOwnProperty("version")&&("number"==typeof e.version?n.version=t.longs===String?String(e.version):e.version:n.version=t.longs===String?c.Long.prototype.toString.call(e.version):t.longs===Number?new c.LongBits(e.version.low>>>0,e.version.high>>>0).toNumber():e.version),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),i),e.exports=u},2100:(e,t,n)=>{e.exports=n(9482)},9482:(e,t,n)=>{var r=t;function o(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(1173),r.BufferWriter=n(3155),r.Reader=n(1408),r.BufferReader=n(593),r.util=n(9693),r.rpc=n(5994),r.roots=n(5054),r.configure=o,o()},1408:(e,t,n)=>{e.exports=l;var r,o=n(9693),i=o.LongBits,s=o.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},p=function(){return o.Buffer?function(e){return(l.create=function(e){return o.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u};function d(){var e=new i(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function _(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new i(_(this.buf,this.pos+=4),_(this.buf,this.pos+=4))}l.create=p(),l.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return _(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|_(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},l.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){r=e,l.create=p(),r._configure();var t=o.Long?"toLong":"toNumber";o.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},593:(e,t,n)=>{e.exports=i;var r=n(1408);(i.prototype=Object.create(r.prototype)).constructor=i;var o=n(9693);function i(e){r.call(this,e)}i._configure=function(){o.Buffer&&(i.prototype._slice=o.Buffer.prototype.slice)},i.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},i._configure()},5054:e=>{e.exports={}},5994:(e,t,n)=>{t.Service=n(7948)},7948:(e,t,n)=>{e.exports=o;var r=n(9693);function o(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(o.prototype=Object.create(r.EventEmitter.prototype)).constructor=o,o.prototype.rpcCall=function e(t,n,o,i,s){if(!i)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,o,i);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null!==n){if(!(n instanceof o))try{n=o[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},o.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(e,t,n)=>{e.exports=o;var r=n(9693);function o(e,t){this.lo=e>>>0,this.hi=t>>>0}var i=o.zero=new o(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var s=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(e){if(0===e)return i;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new o(n,r)},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(r.isString(e)){if(!r.Long)return o.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):i},o.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;o.fromHash=function(e){return e===s?i:new o((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},9693:function(e,t,n){var r=t;function o(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;++o)void 0!==e[r[o]]&&n||(e[r[o]]=t[r[o]]);return e}function i(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&o(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=n(4537),r.base64=n(7419),r.EventEmitter=n(9211),r.float=n(945),r.inquire=n(7199),r.utf8=n(4997),r.pool=n(6662),r.LongBits=n(1945),r.isNode=Boolean(void 0!==n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=o,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=i,r.ProtocolError=i("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},1173:(e,t,n)=>{e.exports=p;var r,o=n(9693),i=o.LongBits,s=o.base64,a=o.utf8;function l(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function p(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}var d=function(){return o.Buffer?function(){return(p.create=function(){return new r})()}:function(){return new p}};function _(e,t,n){t[n]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function f(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function m(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}p.create=d(),p.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(p.alloc=o.pool(p.alloc,o.Array.prototype.subarray)),p.prototype._push=function(e,t,n){return this.tail=this.tail.next=new l(e,t,n),this.len+=t,this},h.prototype=Object.create(l.prototype),h.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},p.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},p.prototype.int32=function(e){return e<0?this._push(f,10,i.fromNumber(e)):this.uint32(e)},p.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},p.prototype.uint64=function(e){var t=i.from(e);return this._push(f,t.length(),t)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(e){var t=i.from(e).zzEncode();return this._push(f,t.length(),t)},p.prototype.bool=function(e){return this._push(_,1,e?1:0)},p.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(e){var t=i.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},p.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var g=o.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};p.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(_,1,0);if(o.isString(e)){var n=p.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(g,t,e)},p.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(_,1,0)},p.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},p.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},p.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},p._configure=function(e){r=e,p.create=d(),r._configure()}},3155:(e,t,n)=>{e.exports=i;var r=n(1173);(i.prototype=Object.create(r.prototype)).constructor=i;var o=n(9693);function i(){r.call(this)}function s(e,t,n){e.length<40?o.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}i._configure=function(){i.alloc=o._Buffer_allocUnsafe,i.writeBytesBuffer=o.Buffer&&o.Buffer.prototype instanceof Uint8Array&&"set"===o.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},i.prototype.bytes=function(e){o.isString(e)&&(e=o._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(i.writeBytesBuffer,t,e),this},i.prototype.string=function(e){var t=o.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},i._configure()},7714:(e,t,n)=>{t.R=void 0;const r=n(6919),o=n(7448);t.R=new class{async init(){}async createSessionHandler(e,t){const n=new r.Session(t);return await n.loadModel(e),new o.OnnxjsSessionHandler(n)}}},4200:(e,t,n)=>{t.c8=t.rX=void 0;const r=n(1670),o=n(5381),i=n(2157),s=n(2306);t.rX=()=>{if(("number"!=typeof r.env.wasm.initTimeout||r.env.wasm.initTimeout<0)&&(r.env.wasm.initTimeout=0),"boolean"!=typeof r.env.wasm.simd&&(r.env.wasm.simd=!0),"boolean"!=typeof r.env.wasm.proxy&&(r.env.wasm.proxy=!1),"number"!=typeof r.env.wasm.numThreads||!Number.isInteger(r.env.wasm.numThreads)||r.env.wasm.numThreads<=0){const e="undefined"==typeof navigator?(0,o.cpus)().length:navigator.hardwareConcurrency;r.env.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}},t.c8=new class{async init(){(0,t.rX)(),await(0,i.initWasm)()}async createSessionHandler(e,t){const n=new s.OnnxruntimeWebAssemblySessionHandler;return await n.loadModel(e,t),Promise.resolve(n)}}},6018:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(1670),t);const i=n(1670);{const e=n(7714).R;(0,i.registerBackend)("webgl",e,-10)}{const e=n(4200).c8;(0,i.registerBackend)("cpu",e,10),(0,i.registerBackend)("wasm",e,10),(0,i.registerBackend)("xnnpack",e,9)}},246:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createAttributeWithCacheKey=void 0;class n{constructor(e){Object.assign(this,e)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map((e=>`${this[e]}`)).join(";")),this._cacheKey}}t.createAttributeWithCacheKey=e=>new n(e)},7778:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Attribute=void 0;const r=n(1446),o=n(9395),i=n(9162),s=n(2517);var a=o.onnxruntime.experimental.fbs;class l{constructor(e){if(this._attributes=new Map,null!=e){for(const t of e)t instanceof r.onnx.AttributeProto?this._attributes.set(t.name,[l.getValue(t),l.getType(t)]):t instanceof a.Attribute&&this._attributes.set(t.name(),[l.getValue(t),l.getType(t)]);if(this._attributes.size<e.length)throw new Error("duplicated attribute names")}}set(e,t,n){this._attributes.set(e,[n,t])}delete(e){this._attributes.delete(e)}getFloat(e,t){return this.get(e,"float",t)}getInt(e,t){return this.get(e,"int",t)}getString(e,t){return this.get(e,"string",t)}getTensor(e,t){return this.get(e,"tensor",t)}getFloats(e,t){return this.get(e,"floats",t)}getInts(e,t){return this.get(e,"ints",t)}getStrings(e,t){return this.get(e,"strings",t)}getTensors(e,t){return this.get(e,"tensors",t)}get(e,t,n){const r=this._attributes.get(e);if(void 0===r){if(void 0!==n)return n;throw new Error(`required attribute not found: ${e}`)}if(r[1]!==t)throw new Error(`type mismatch: expected ${t} but got ${r[1]}`);return r[0]}static getType(e){const t=e instanceof r.onnx.AttributeProto?e.type:e.type();switch(t){case r.onnx.AttributeProto.AttributeType.FLOAT:return"float";case r.onnx.AttributeProto.AttributeType.INT:return"int";case r.onnx.AttributeProto.AttributeType.STRING:return"string";case r.onnx.AttributeProto.AttributeType.TENSOR:return"tensor";case r.onnx.AttributeProto.AttributeType.FLOATS:return"floats";case r.onnx.AttributeProto.AttributeType.INTS:return"ints";case r.onnx.AttributeProto.AttributeType.STRINGS:return"strings";case r.onnx.AttributeProto.AttributeType.TENSORS:return"tensors";default:throw new Error(`attribute type is not supported yet: ${r.onnx.AttributeProto.AttributeType[t]}`)}}static getValue(e){const t=e instanceof r.onnx.AttributeProto?e.type:e.type();if(t===r.onnx.AttributeProto.AttributeType.GRAPH||t===r.onnx.AttributeProto.AttributeType.GRAPHS)throw new Error("graph attribute is not supported yet");const n=this.getValueNoCheck(e);if(t===r.onnx.AttributeProto.AttributeType.INT&&s.LongUtil.isLong(n))return s.LongUtil.longToNumber(n);if(t===r.onnx.AttributeProto.AttributeType.INTS){const e=n,t=new Array(e.length);for(let n=0;n<e.length;n++){const r=e[n];t[n]=s.LongUtil.longToNumber(r)}return t}if(t===r.onnx.AttributeProto.AttributeType.TENSOR)return e instanceof r.onnx.AttributeProto?i.Tensor.fromProto(n):i.Tensor.fromOrtTensor(n);if(t===r.onnx.AttributeProto.AttributeType.TENSORS){if(e instanceof r.onnx.AttributeProto)return n.map((e=>i.Tensor.fromProto(e)));if(e instanceof a.Attribute)return n.map((e=>i.Tensor.fromOrtTensor(e)))}if(t===r.onnx.AttributeProto.AttributeType.STRING&&e instanceof r.onnx.AttributeProto){const e=n;return(0,s.decodeUtf8String)(e)}return t===r.onnx.AttributeProto.AttributeType.STRINGS&&e instanceof r.onnx.AttributeProto?n.map(s.decodeUtf8String):n}static getValueNoCheck(e){return e instanceof r.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(e):this.getValueNoCheckFromOrtFormat(e)}static getValueNoCheckFromOnnxFormat(e){switch(e.type){case r.onnx.AttributeProto.AttributeType.FLOAT:return e.f;case r.onnx.AttributeProto.AttributeType.INT:return e.i;case r.onnx.AttributeProto.AttributeType.STRING:return e.s;case r.onnx.AttributeProto.AttributeType.TENSOR:return e.t;case r.onnx.AttributeProto.AttributeType.GRAPH:return e.g;case r.onnx.AttributeProto.AttributeType.FLOATS:return e.floats;case r.onnx.AttributeProto.AttributeType.INTS:return e.ints;case r.onnx.AttributeProto.AttributeType.STRINGS:return e.strings;case r.onnx.AttributeProto.AttributeType.TENSORS:return e.tensors;case r.onnx.AttributeProto.AttributeType.GRAPHS:return e.graphs;default:throw new Error(`unsupported attribute type: ${r.onnx.AttributeProto.AttributeType[e.type]}`)}}static getValueNoCheckFromOrtFormat(e){switch(e.type()){case a.AttributeType.FLOAT:return e.f();case a.AttributeType.INT:return e.i();case a.AttributeType.STRING:return e.s();case a.AttributeType.TENSOR:return e.t();case a.AttributeType.GRAPH:return e.g();case a.AttributeType.FLOATS:return e.floatsArray();case a.AttributeType.INTS:{const t=[];for(let n=0;n<e.intsLength();n++)t.push(e.ints(n));return t}case a.AttributeType.STRINGS:{const t=[];for(let n=0;n<e.stringsLength();n++)t.push(e.strings(n));return t}case a.AttributeType.TENSORS:{const t=[];for(let n=0;n<e.tensorsLength();n++)t.push(e.tensors(n));return t}default:throw new Error(`unsupported attribute type: ${a.AttributeType[e.type()]}`)}}}t.Attribute=l},7091:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveBackend=t.backend=void 0;const r=n(5038),o=new Map;async function i(e){const n=t.backend;if(void 0!==n[e]&&function(e){const t=e;return"initialize"in t&&"function"==typeof t.initialize&&"createSessionHandler"in t&&"function"==typeof t.createSessionHandler&&"dispose"in t&&"function"==typeof t.dispose}(n[e])){const t=n[e];let r=t.initialize();if("object"==typeof r&&"then"in r&&(r=await r),r)return o.set(e,t),t}}t.backend={webgl:new r.WebGLBackend},t.resolveBackend=async function e(t){if(!t)return e(["webgl"]);{const e="string"==typeof t?[t]:t;for(const t of e){const e=o.get(t);if(e)return e;const n=await i(t);if(n)return n}}throw new Error("no available backend to use")}},5038:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLBackend=void 0;const r=n(1670),o=n(6231),i=n(6416),s=n(7305);t.WebGLBackend=class{get contextId(){return r.env.webgl.contextId}set contextId(e){r.env.webgl.contextId=e}get matmulMaxBatchSize(){return r.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(e){r.env.webgl.matmulMaxBatchSize=e}get textureCacheMode(){return r.env.webgl.textureCacheMode}set textureCacheMode(e){r.env.webgl.textureCacheMode=e}get pack(){return r.env.webgl.pack}set pack(e){r.env.webgl.pack=e}get async(){return r.env.webgl.async}set async(e){r.env.webgl.async=e}initialize(){try{return this.glContext=(0,s.createWebGLContext)(this.contextId),"number"!=typeof this.matmulMaxBatchSize&&(this.matmulMaxBatchSize=16),"string"!=typeof this.textureCacheMode&&(this.textureCacheMode="full"),"boolean"!=typeof this.pack&&(this.pack=!1),"boolean"!=typeof this.async&&(this.async=!1),o.Logger.setWithEnv(r.env),o.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(e){return o.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${e}`),!1}}createSessionHandler(e){return new i.WebGLSessionHandler(this,e)}dispose(){this.glContext.dispose()}}},5107:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoordsGlslLib=void 0;const r=n(2517),o=n(8520),i=n(5060),s=n(7859),a=n(9390);class l extends o.GlslLib{constructor(e){super(e)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new o.GlslLibRoutine("\n      vec2 offsetToCoords(int offset, int width, int height) {\n        int t = offset / width;\n        int s = offset - t*width;\n        vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height);\n        return coords;\n      }\n      ")}}coordsToOffset(){return{coordsToOffset:new o.GlslLibRoutine("\n      int coordsToOffset(vec2 coords, int width, int height) {\n        float s = coords.s * float(width);\n        float t = coords.t * float(height);\n        int offset = int(t) * width + int(s);\n        return offset;\n      }\n      ")}}getOutputSamplingSnippet(){const e=this.context.outputTextureLayout;return e.isPacked?this.getPackedOutputSamplingSnippet(e):this.getUnpackedOutputSamplingSnippet(e)}getPackedOutputSamplingSnippet(e){const t=e.unpackedShape,n=[e.width,e.height],r={},s="getOutputCoords";switch(t.length){case 0:r[s]=this.getOutputScalarCoords();break;case 1:r[s]=this.getOutputPacked1DCoords(t,n);break;case 2:r[s]=this.getOutputPacked2DCoords(t,n);break;case 3:r[s]=this.getOutputPacked3DCoords(t,n);break;default:r[s]=this.getOutputPackedNDCoords(t,n)}const a=`\n      void setOutput(vec4 val) {\n        ${(0,i.getGlsl)(this.context.glContext.version).output} = val;\n      }\n    `;return r.floatTextureSetRGBA=new o.GlslLibRoutine(a),r}getUnpackedOutputSamplingSnippet(e){const t=e.unpackedShape,n=[e.width,e.height],r={},s="getOutputCoords";switch(t.length){case 0:r[s]=this.getOutputScalarCoords();break;case 1:r[s]=this.getOutputUnpacked1DCoords(t,n);break;case 2:r[s]=this.getOutputUnpacked2DCoords(t,n);break;case 3:r[s]=this.getOutputUnpacked3DCoords(t,n);break;case 4:r[s]=this.getOutputUnpacked4DCoords(t,n);break;case 5:r[s]=this.getOutputUnpacked5DCoords(t,n);break;case 6:r[s]=this.getOutputUnpacked6DCoords(t,n);break;default:throw new Error(`Unsupported output dimensionality: ${t.length}`)}const a=`\n        void setOutput(float val) {\n          ${(0,i.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0);\n        }\n    `;return r.floatTextureSetR=new o.GlslLibRoutine(a),r}getOutputScalarCoords(){return new o.GlslLibRoutine("\n      int getOutputCoords() {\n        return 0;\n      }\n    ")}getOutputPacked1DCoords(e,t){const n=t;let r="";return 1===n[0]?(r=`\n          int getOutputCoords() {\n            return 2 * int(TexCoords.y * ${n[1]}.0);\n          }\n        `,new o.GlslLibRoutine(r)):1===n[1]?(r=`\n          int getOutputCoords() {\n            return 2 * int(TexCoords.x * ${n[0]}.0);\n          }\n        `,new o.GlslLibRoutine(r)):(r=`\n        int getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                 vec2(${n[0]}, ${n[1]}));\n          return 2 * (resTexRC.y * ${n[0]} + resTexRC.x);\n        }\n      `,new o.GlslLibRoutine(r))}getOutputPacked2DCoords(e,t){let n="";if(r.ArrayUtil.arraysEqual(e,t))return n=`\n        ivec2 getOutputCoords() {\n          return 2 * ivec2(TexCoords.xy * vec2(${t[0]}, ${t[1]}));\n        }\n      `,new o.GlslLibRoutine(n);const i=t,s=Math.ceil(e[1]/2);return n=`\n        ivec2 getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                vec2(${i[0]}, ${i[1]}));\n\n          int index = resTexRC.y * ${i[0]} + resTexRC.x;\n\n          // reverse r and c order for packed texture\n          int r = imod(index, ${s}) * 2;\n          int c = 2 * (index / ${s});\n\n          return ivec2(r, c);\n        }\n      `,new o.GlslLibRoutine(n)}getOutputPacked3DCoords(e,t){const n=[t[0],t[1]],r=Math.ceil(e[2]/2),i=r*Math.ceil(e[1]/2),s=`\n        ivec3 getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                vec2(${n[0]}, ${n[1]}));\n          int index = resTexRC.y * ${n[0]} + resTexRC.x;\n\n          int b = index / ${i};\n          index -= b * ${i};\n\n          // reverse r and c order for packed texture\n          int r = imod(index, ${r}) * 2;\n          int c = 2 * (index / ${r});\n\n          return ivec3(b, r, c);\n        }\n      `;return new o.GlslLibRoutine(s)}getOutputPackedNDCoords(e,t){const n=[t[0],t[1]],r=Math.ceil(e[e.length-1]/2),i=r*Math.ceil(e[e.length-2]/2);let s=i,a="",l="b, r, c";for(let t=2;t<e.length-1;t++)s*=e[e.length-t-1],a=`\n      int b${t} = index / ${s};\n      index -= b${t} * ${s};\n    `+a,l=`b${t}, `+l;const c=`\n      ivec${e.length} getOutputCoords() {\n        ivec2 resTexRC = ivec2(TexCoords.xy *\n                              vec2(${n[0]}, ${n[1]}));\n        int index = resTexRC.y * ${n[0]} + resTexRC.x;\n\n        ${a}\n\n        int b = index / ${i};\n        index -= b * ${i};\n\n        // reverse r and c order for packed texture\n        int r = imod(index, ${r}) * 2;\n        int c = 2 * (index / ${r});\n\n        return ivec${e.length}(${l});\n      }\n    `;return new o.GlslLibRoutine(c)}getOutputUnpacked1DCoords(e,t){const n=`\n        int getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                vec2(${t[0]}, ${t[1]}));\n          return resTexRC.y * ${t[0]} + resTexRC.x;\n        }\n      `;return new o.GlslLibRoutine(n)}getOutputUnpacked2DCoords(e,t){const n=`\n        ivec2 getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                vec2(${t[0]}, ${t[1]}));\n          int index = resTexRC.y * ${t[0]} + resTexRC.x;\n          int r = index / ${e[1]};\n          int c = index - r * ${e[1]};\n          return ivec2(r, c);\n        }\n      `;return new o.GlslLibRoutine(n)}getOutputUnpacked3DCoords(e,t){let n="";const r=e.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=e[r-1];for(let t=r-3;t>=0;--t)i[t]=i[t+1]*e[t+1];const s=["r","c","d"],a=i.map(((e,t)=>`int ${s[t]} = index / ${e}; ${t===i.length-1?`int ${s[t+1]} = index - ${s[t]} * ${e}`:`index -= ${s[t]} * ${e}`};`)).join("");return n=`\n        ivec3 getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                vec2(${t[0]}, ${t[1]}));\n          int index = resTexRC.y * ${t[0]} + resTexRC.x;\n          ${a}\n          return ivec3(r, c, d);\n        }\n      `,new o.GlslLibRoutine(n)}getOutputUnpacked4DCoords(e,t){let n="";const r=e.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=e[r-1];for(let t=r-3;t>=0;--t)i[t]=i[t+1]*e[t+1];const s=["r","c","d","d2"],a=i.map(((e,t)=>`int ${s[t]} = index / ${e}; ${t===i.length-1?`int ${s[t+1]} = index - ${s[t]} * ${e}`:`index -= ${s[t]} * ${e}`};`)).join("");return n=`\n      ivec4 getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                vec2(${t[0]}, ${t[1]}));\n          int index = resTexRC.y * ${t[0]} + resTexRC.x;\n          ${a}\n          return ivec4(r, c, d, d2);\n        }\n      `,new o.GlslLibRoutine(n)}getOutputUnpacked5DCoords(e,t){let n="";const r=e.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=e[r-1];for(let t=r-3;t>=0;--t)i[t]=i[t+1]*e[t+1];const s=["r","c","d","d2","d3"],a=i.map(((e,t)=>`int ${s[t]} = index / ${e}; ${t===i.length-1?`int ${s[t+1]} = index - ${s[t]} * ${e}`:`index -= ${s[t]} * ${e}`};`)).join("");return n=`\n      ivec5 getOutputCoords() {\n          ivec2 resTexRC = ivec2(TexCoords.xy *\n                                vec2(${t[0]}, ${t[1]}));\n          int index = resTexRC.y * ${t[0]} + resTexRC.x;\n          ${a}\n          return ivec5(r, c, d, d2, d3);\n        }\n      `,new o.GlslLibRoutine(n)}getOutputUnpacked6DCoords(e,t){let n="";const r=e.length;let i=null;r<2&&(i=[]),i=new Array(r-1),i[r-2]=e[r-1];for(let t=r-3;t>=0;--t)i[t]=i[t+1]*e[t+1];const s=["r","c","d","d2","d3","d4"],a=i.map(((e,t)=>`int ${s[t]} = index / ${e}; ${t===i.length-1?`int ${s[t+1]} = index - ${s[t]} * ${e}`:`index -= ${s[t]} * ${e}`};`)).join("");return n=`\n     ivec6 getOutputCoords() {\n         ivec2 resTexRC = ivec2(TexCoords.xy *\n                               vec2(${t[0]}, ${t[1]}));\n         int index = resTexRC.y * ${t[0]} + resTexRC.x;\n         ${a}\n         return ivec6(r, c, d, d2, d3, d4);\n       }\n     `,new o.GlslLibRoutine(n)}getCommonUtilFuncs(){const e={};let t="uvFromFlat";e[t]=new o.GlslLibRoutine("\n    vec2 uvFromFlat(int texNumR, int texNumC, int index) {\n      int texC = index / texNumR;\n      int texR = index - texC * texNumR;\n      // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to\n      //       v.\n      return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC);\n    }\n    "),t="packedUVfrom1D",e[t]=new o.GlslLibRoutine("\n      vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n        int texelIndex = index / 2;\n        int texR = texelIndex / texNumC;\n        int texC = texelIndex - texR * texNumC;\n        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n      }\n      "),t="packedUVfrom2D",e[t]=new o.GlslLibRoutine("\n      vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) {\n        int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n        int texR = texelIndex / texNumC;\n        int texC = texelIndex - texR * texNumC;\n        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n      }\n      "),t="packedUVfrom3D",e[t]=new o.GlslLibRoutine("\n      vec2 packedUVfrom3D(int texNumR, int texNumC,\n          int texelsInBatch, int texelsInLogicalRow, int b,\n          int row, int col) {\n        int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n        int texR = index / texNumC;\n        int texC = index - texR * texNumC;\n        return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n      }\n      "),t="sampleTexture";const n=(0,i.getGlsl)(this.context.glContext.version);return e[t]=new o.GlslLibRoutine(`\n        float sampleTexture(sampler2D textureSampler, vec2 uv) {\n            return ${n.texture2D}(textureSampler, uv).r;\n        }`),e}getInputsSamplingSnippets(){const e={},t=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach(((n,r)=>{const o=this.context.inputTextureLayouts[r],i=(0,a.generateShaderFuncNameFromInputSamplerName)(n);o.isPacked?e[i]=this.getPackedSamplerFromInput(i,n,o):e[i]=this.getUnpackedSamplerFromInput(i,n,o);const s=(0,a.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(n);o.unpackedShape.length<=t.unpackedShape.length&&(o.isPacked?e[s]=this.getPackedSamplerAtOutputCoords(s,o,t,n):e[s]=this.getUnpackedSamplerAtOutputCoords(s,o,t,n))})),e}getPackedSamplerAtOutputCoords(e,t,n,i){const s=t.unpackedShape,l=n.unpackedShape,c=i,u=(0,a.generateShaderFuncNameFromInputSamplerName)(c),p=s.length,d=l.length,_=r.BroadcastUtil.getBroadcastDims(s,l),h=(0,a.getCoordsDataType)(d),f=d-p;let m;const g=(0,a.getGlChannels)();m=0===p?"":d<2&&_.length>=1?"coords = 0;":_.map((e=>`coords.${g[e+f]} = 0;`)).join("\n");let b="";b=d<2&&p>0?"coords":s.map(((e,t)=>`coords.${g[t+f]}`)).join(", ");let w="return outputValue;";const x=1===r.ShapeUtil.size(s),y=1===r.ShapeUtil.size(l);if(1!==p||x||y){if(x&&!y)w=1===d?"\n          return vec4(outputValue.x, outputValue.x, 0., 0.);\n        ":"\n          return vec4(outputValue.x);\n        ";else if(_.length){const e=p-2,t=p-1;_.indexOf(e)>-1&&_.indexOf(t)>-1?w="return vec4(outputValue.x);":_.indexOf(e)>-1?w="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":_.indexOf(t)>-1&&(w="return vec4(outputValue.xx, outputValue.zz);")}}else w="\n        return vec4(outputValue.xy, outputValue.xy);\n      ";const T=`\n      vec4 ${e}() {\n        ${h} coords = getOutputCoords();\n        \n        int lastDim = coords.${g[d-1]};\n        coords.${g[d-1]} = coords.${g[d-2]};\n        coords.${g[d-2]} = lastDim;\n      \n        ${m}\n        vec4 outputValue = ${u}(${b});\n        ${w}\n      }\n    `;return new o.GlslLibRoutine(T,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(e,t,n,i){const s=[n.width,n.height],l=[t.width,t.height],c=t.unpackedShape.length,u=n.unpackedShape.length,p=t.unpackedShape,d=n.unpackedShape,_=(0,a.generateShaderFuncNameFromInputSamplerName)(i);if(c===u&&r.ArrayUtil.arraysEqual(l,s)){const t=`\n          float ${e}() {\n            return sampleTexture(${i}, TexCoords);\n          }\n        `;return new o.GlslLibRoutine(t,["coordinates.sampleTexture"])}const h=(0,a.getCoordsDataType)(u),f=r.BroadcastUtil.getBroadcastDims(p,d),m=u-c;let g;const b=(0,a.getGlChannels)();g=0===c?"":u<2&&f.length>=1?"coords = 0;":f.map((e=>`coords.${b[e+m]} = 0;`)).join("\n");let w="";w=u<2&&c>0?"coords":t.unpackedShape.map(((e,t)=>`coords.${b[t+m]}`)).join(", ");const x=`\n        float ${e}() {\n          ${h} coords = getOutputCoords();\n          ${g}\n          return ${_}(${w});\n        }\n      `;return new o.GlslLibRoutine(x,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(e,t,n){switch(n.unpackedShape.length){case 0:return this.getPackedSamplerScalar(e,t);case 1:return this.getPackedSampler1D(e,t,n);case 2:return this.getPackedSampler2D(e,t,n);case 3:return this.getPackedSampler3D(e,t,n);default:return this.getPackedSamplerND(e,t,n)}}getUnpackedSamplerFromInput(e,t,n){const r=n.unpackedShape;switch(r.length){case 0:return this.getUnpackedSamplerScalar(e,t,n);case 1:return this.getUnpackedSampler1D(e,t,n);case 2:return this.getUnpackedSampler2D(e,t,n);case 3:return this.getUnpackedSampler3D(e,t,n);case 4:return this.getUnpackedSampler4D(e,t,n);case 5:return this.getUnpackedSampler5D(e,t,n);case 6:return this.getUnpackedSampler6D(e,t,n);default:throw new Error(`Unsupported dimension ${r.length}-D`)}}getPackedSamplerScalar(e,t){const n=`\n          vec4 ${e}() {\n            return ${(0,i.getGlsl)(this.context.glContext.version).texture2D}(${t}, halfCR);\n          }\n        `;return new o.GlslLibRoutine(n)}getPackedSampler1D(e,t,n){const r=[n.width,n.height],s=[r[1],r[0]],a=(0,i.getGlsl)(this.context.glContext.version),l=`vec4 ${e}(int index) {\n      vec2 uv = packedUVfrom1D(\n      ${s[0]}, ${s[1]}, index);\n      return ${a.texture2D}(${t}, uv);\n    }`;return new o.GlslLibRoutine(l,["coordinates.packedUVfrom1D"])}getPackedSampler2D(e,t,n){const s=n.unpackedShape,a=[n.width,n.height],l=(0,i.getGlsl)(this.context.glContext.version),c=a[0],u=a[1];if(null!=a&&r.ArrayUtil.arraysEqual(s,a)){const n=`vec4 ${e}(int row, int col) {\n        vec2 uv = (vec2(col, row) + halfCR) / vec2(${u}.0, ${c}.0);\n        return ${l.texture2D}(${t}, uv);\n      }`;return new o.GlslLibRoutine(n)}const p=a,d=Math.ceil(s[1]/2),_=`vec4 ${e}(int row, int col) {\n      vec2 uv = packedUVfrom2D(${p[1]}, ${p[0]}, ${d}, row, col);\n      return ${l.texture2D}(${t}, uv);\n    }`;return new o.GlslLibRoutine(_,["coordinates.packedUVfrom2D"])}getPackedSampler3D(e,t,n){const r=n.unpackedShape,s=[n.width,n.height],l=[s[0],s[1]],c=(0,i.getGlsl)(this.context.glContext.version);if(1===r[0]){const i=r.slice(1),s=[1,2],l=(0,a.squeezeInputShape)(r,i),c=["b","row","col"],u=JSON.parse(JSON.stringify(n));u.unpackedShape=l;const p=this.getPackedSamplerFromInput(e,t,u),d=`${p.routineBody}\n      vec4 ${e}(int b, int row, int col) {\n        return ${e}(${(0,a.getSqueezedParams)(c,s)});\n      } `;return new o.GlslLibRoutine(d,p.dependencies)}const u=l[0],p=l[1],d=Math.ceil(r[2]/2),_=`vec4 ${e}(int b, int row, int col) {\n      vec2 uv = packedUVfrom3D(\n        ${p}, ${u}, ${d*Math.ceil(r[1]/2)}, ${d}, b, row, col);\n      return ${c.texture2D}(${t}, uv);}`;return new o.GlslLibRoutine(_,["coordinates.packedUVfrom3D"])}getPackedSamplerND(e,t,n){const r=n.unpackedShape,s=r.length,a=[n.width,n.height],l=(0,i.getGlsl)(this.context.glContext.version),c=[a[0],a[1]],u=c[1],p=c[0],d=Math.ceil(r[s-1]/2);let _=d*Math.ceil(r[s-2]/2),h="int b, int row, int col",f=`b * ${_} + (row / 2) * ${d} + (col / 2)`;for(let e=2;e<s-1;e++)h=`int b${e}, `+h,_*=r[s-e-1],f=`b${e} * ${_} + `+f;const m=`vec4 ${e}(${h}) {\n      int index = ${f};\n      int texR = index / ${p};\n      int texC = index - texR * ${p};\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${p}, ${u});\n      return ${l.texture2D}(${t}, uv);\n    }`;return new o.GlslLibRoutine(m)}getUnpackedSamplerScalar(e,t,n){const[r,i]=[n.width,n.height];if(1===r&&1===i){const n=`\n          float ${e}() {\n            return sampleTexture(${t}, halfCR);\n          }\n        `;return new o.GlslLibRoutine(n,["coordinates.sampleTexture"])}const s=`\n        float ${e}() {\n          int offset_${t} = coordsToOffset(TexCoords, ${r}, ${i});\n          vec2 uv = uvFromFlat(${r}, ${i}, offset_${t});\n          return sampleTexture(${t}, uv);\n        }\n      `;return new o.GlslLibRoutine(s,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler1D(e,t,n){const r=n.width,i=n.height;if(1===i&&1===r){const n=`\n        float ${e}(int index) {\n          return sampleTexture(${t}, halfCR);\n        }\n      `;return new o.GlslLibRoutine(n,["coordinates.sampleTexture"])}if(1===i){const n=`\n          float ${e}(int index) {\n            vec2 uv = vec2((float(index) + 0.5) / ${r}.0, 0.5);\n            return sampleTexture(${t}, uv);\n          }\n        `;return new o.GlslLibRoutine(n,["coordinates.sampleTexture"])}if(1===r){const n=`\n          float ${e}(int index) {\n            vec2 uv = vec2(0.5, (float(index) + 0.5) / ${i}.0);\n            return sampleTexture(${t}, uv);\n          }\n        `;return new o.GlslLibRoutine(n,["coordinates.sampleTexture"])}const s=`\n        float ${e}(int index) {\n          vec2 uv = uvFromFlat(${r}, ${i}, index);\n          return sampleTexture(${t}, uv);\n        }\n      `;return new o.GlslLibRoutine(s,["coordinates.uvFromFlat","coordinates.sampleTexture"])}getUnpackedSampler2D(e,t,n){const i=n.unpackedShape,l=[n.height,n.width];if(null!=l&&r.ArrayUtil.arraysEqual(i,l)){const n=`\n          float ${e}(int row, int col) {\n            vec2 uv = (vec2(row, col) + halfCR) / vec2(${l[1]}.0, ${l[0]}.0);\n            return sampleTexture(${t}, uv);\n          }\n        `;return new o.GlslLibRoutine(n,["coordinates.sampleTexture"])}const{newShape:c,keptDims:u}=(0,s.squeezeShape)(i),p=c;if(p.length<i.length){const r=(0,a.squeezeInputShape)(i,p),s=JSON.parse(JSON.stringify(n));s.unpackedShape=r;const l=["col","row"],c=`\n          ${this.getUnpackedSamplerFromInput(e,t,s).routineBody}\n          float ${e}(int row, int col) {\n            return ${e}(${(0,a.getSqueezedParams)(l,u)});\n          }\n        `;return new o.GlslLibRoutine(c,["coordinates.sampleTexture"])}const d=l[1],_=l[0];if(1===_){const n=`\n          float ${e}(int row, int col) {\n            int offset_${t} = coordsToOffset(TexCoords, ${d}, ${_});\n            float index = dot(vec3(row, col, offset_${t}), vec3(${i[1]}, 1, 1));\n            vec2 uv = vec2(0.5, (index + 0.5) / ${d}.0);\n            return sampleTexture(${t}, uv);\n          }\n        `;return new o.GlslLibRoutine(n,["coordinates.sampleTexture","coordinates.coordsToOffset"])}if(1===d){const n=`\n          float ${e}(int row, int col) {\n            int offset_${t} = coordsToOffset(TexCoords, ${d}, ${_});\n            float index = dot(vec3(row, col, offset_${t}), vec3(${i[1]}, 1, 1));\n            vec2 uv = vec2((index + 0.5) / ${_}.0, 0.5);\n            return sampleTexture(${t}, uv);\n          }\n        `;return new o.GlslLibRoutine(n,["coordinates.sampleTexture","coordinates.coordsToOffset"])}const h=`\n        float ${e}(int row, int col) {\n          int index = col * ${i[1]} + row;\n          vec2 uv = uvFromFlat(${d}, ${_}, index);\n          return sampleTexture(${t}, uv);\n        }\n      `;return new o.GlslLibRoutine(h,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler3D(e,t,n){const r=n.unpackedShape,i=r[1]*r[2],l=r[2],{newShape:c,keptDims:u}=(0,s.squeezeShape)(r),p=c;if(p.length<r.length){const i=(0,a.squeezeInputShape)(r,p),s=["batch","col","row"],l=JSON.parse(JSON.stringify(n));l.unpackedShape=i;const c=this.getUnpackedSamplerFromInput(e,t,l),d=u.reverse(),_=`\n          ${c.routineBody}\n          float ${e}(int batch, int row, int col) {\n            return ${e}(${(0,a.getSqueezedParams)(s,d)});\n          }\n        `;return new o.GlslLibRoutine(_,c.dependencies)}const d=`\n          float ${e}(int depth, int row, int col) {\n            // Explicitly use integer operations as dot() only works on floats.\n            int index = depth * ${i} + col * ${l} + row;\n            vec2 uv = uvFromFlat(${n.width}, ${n.height}, index);\n            return sampleTexture(${t}, uv);\n          }\n      `;return new o.GlslLibRoutine(d,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}getUnpackedSampler4D(e,t,n){const r=n.unpackedShape,i=r[3],s=r[2]*i,a=`\n        float ${e}(int row, int col, int depth, int depth2) {\n          int index = row * ${r[1]*s} + col * ${s} +\n              depth2 * ${i} + depth;\n          vec2 uv = uvFromFlat(${n.width}, ${n.height}, index);\n          return sampleTexture(${t}, uv);\n        }\n      `;return new o.GlslLibRoutine(a,["coordinates.uvFromFlat","coordinates.sampleTexture"])}getUnpackedSampler5D(e,t,n){const r=n.unpackedShape,i=r[4],l=r[3]*i,c=r[2]*l,u=r[1]*c,{newShape:p,keptDims:d}=(0,s.squeezeShape)(r);if(p.length<r.length){const i=(0,a.squeezeInputShape)(r,p),s=["row","col","depth","depth2","depth3"],l=JSON.parse(JSON.stringify(n));l.unpackedShape=i;const c=`\n          ${this.getUnpackedSamplerFromInput(e,t,l).routineBody}\n          float ${e}(int row, int col, int depth, int depth2, int depth3) {\n            return ${e}(${(0,a.getSqueezedParams)(s,d)});\n          }\n        `;return new o.GlslLibRoutine(c,["coordinates.sampleTexture","coordinates.uvFromFlat"])}const _=`\n        float ${e}(int row, int col, int depth, int depth2, int depth3) {\n          int index = row * ${u} + col * ${c} + depth * ${l} +\n          depth3 * ${i} + depth2;\n          vec2 uv = uvFromFlat(${n.width}, ${n.height}, index);\n          return sampleTexture(${t}, uv);\n        }\n      `;return new o.GlslLibRoutine(_,["coordinates.sampleTexture","coordinates.uvFromFlat"])}getUnpackedSampler6D(e,t,n){const r=n.unpackedShape,i=r[5],l=r[4]*i,c=r[3]*l,u=r[2]*c,p=r[1]*u,{newShape:d,keptDims:_}=(0,s.squeezeShape)(r);if(d.length<r.length){const i=(0,a.squeezeInputShape)(r,d),s=["row","col","depth","depth2","depth3","depth4"],l=JSON.parse(JSON.stringify(n));l.unpackedShape=i;const c=`\n            ${this.getUnpackedSamplerFromInput(e,t,l).routineBody}\n            float ${e}(int row, int col, int depth,\n              int depth2, int depth3, int depth4) {\n              return ${e}(${(0,a.getSqueezedParams)(s,_)});\n            }\n          `;return new o.GlslLibRoutine(c,["coordinates.sampleTexture","coordinates.uvFromFlat"])}const h=`\n          float ${e}(int row, int col, int depth,\n            int depth2, int depth3, int depth4) {\n            int index = row * ${p} + col * ${u} + depth * ${c} +\n            depth2 * ${l} + depth3 * ${i} + depth4;\n            vec2 uv = uvFromFlat(${n.width}, ${n.height}, index);\n            return sampleTexture(${t}, uv);\n          }\n        `;return new o.GlslLibRoutine(h,["coordinates.uvFromFlat","coordinates.sampleTexture","coordinates.coordsToOffset"])}toVec(){const e=this.context.outputTextureLayout,t=e.shape.length,n=e.strides,r=e.width,i=e.height,s=[];for(let e=0;e<t-1;++e)s.push(`\n        c[${e}] = offset / ${n[e]};`),s.push(`\n        offset -= c[${e}] * ${n[e]};`);s.push(`\n        c[${t-1}] = offset;`);const a=`\n      void toVec(vec2 texCoords, out int c[${t}]) {\n        int offset = coordsToOffset(texCoords, ${r}, ${i});\n        ${s.join("")}\n      }\n      void toVec(int offset, out int c[${t}]) {\n        ${s.join("")}\n      }\n    `;return{toVec:new o.GlslLibRoutine(a,["coordinates.coordsToOffset"])}}valueFrom(){const e={};return this.context.programInfo.inputNames.forEach(((t,n)=>{const r=this.context.inputTextureLayouts[n],i=(r.unpackedShape.length>0?r.unpackedShape:r.shape).length;let s=`_${t}`;e[s]=new o.GlslLibRoutine(this.getValueFromSingle(t,i,r.width,r.height,!1),[`shapeUtils.indicesToOffset${s}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),s+="_T",e[s]=new o.GlslLibRoutine(this.getValueFromSingle(t,i,r.width,r.height,!0),[`shapeUtils.indicesToOffset${s}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])})),e}getValueFromSingle(e,t,n,r,o){let s=`_${e}`;return o&&(s+="_T"),`\n        float ${s}(int m[${t}]) {\n          int offset = indicesToOffset${s}(m);\n          vec2 coords = offsetToCoords(offset, ${n}, ${r});\n          float value = getColorAsFloat(${(0,i.getGlsl)(this.context.glContext.version).texture2D}(${e}, coords));\n          return value;\n        }\n        `}getPackedValueFrom(e,t,n,r,o){let s=`_${e}_Pack`;return o&&(s+="_T"),`\n        vec4 ${s}(int m[${t}]) {\n          int offset = indicesToOffset_${e}(m);\n          vec2 coords = offsetToCoords(offset, ${n}, ${r});\n          return ${(0,i.getGlsl)(this.context.glContext.version).texture2D}(${e}, coords);\n        }\n        `}}t.CoordsGlslLib=l},8520:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TopologicalSortGlslRoutines=t.GlslLibRoutineNode=t.GlslLibRoutine=t.GlslLib=t.GlslContext=t.FunctionType=void 0,(n=t.FunctionType||(t.FunctionType={}))[n.ValueBased=0]="ValueBased",n[n.Positional=1]="Positional",t.GlslContext=class{constructor(e,t,n,r){this.glContext=e,this.programInfo=t,this.inputTextureLayouts=n,this.outputTextureLayout=r}},t.GlslLib=class{constructor(e){this.context=e}},t.GlslLibRoutine=class{constructor(e,t){this.routineBody=e,this.dependencies=t}},t.GlslLibRoutineNode=class{constructor(e,t,n){this.name=e,this.dependencies=n||[],t&&(this.routineBody=t)}addDependency(e){e&&this.dependencies.push(e)}},t.TopologicalSortGlslRoutines=class{static returnOrderedNodes(e){if(!e||0===e.length)return[];if(1===e.length)return e;const t=new Set,n=new Set,r=new Array;return this.createOrderedNodes(e,t,n,r),r}static createOrderedNodes(e,t,n,r){for(let o=0;o<e.length;++o)this.dfsTraverse(e[o],t,n,r)}static dfsTraverse(e,t,n,r){if(!e||n.has(e.name))return;if(t.has(e.name))throw new Error("Cyclic dependency detected. Can't topologically sort routines needed for shader.");t.add(e.name);const o=e.dependencies;if(o&&o.length>0)for(let e=0;e<o.length;++e)this.dfsTraverse(o[e],t,n,r);r.push(e),n.add(e.name),t.delete(e.name)}}},7341:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EncodingGlslLib=void 0;const r=n(8520);class o extends r.GlslLib{constructor(e){super(e)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new r.GlslLibRoutine("highp vec4 encode(highp float f) {\n        return vec4(f, 0.0, 0.0, 0.0);\n      }\n        ")}}decodeFloat32(){return{decode:new r.GlslLibRoutine("highp float decode(highp vec4 rgba) {\n        return rgba.r;\n      }\n        ")}}encodeUint8(){const e=o.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new r.GlslLibRoutine(`\n      highp vec4 encode(highp float f) {\n        highp float F = abs(f);\n        highp float Sign = step(0.0,-f);\n        highp float Exponent = floor(log2(F));\n        highp float Mantissa = (exp2(- Exponent) * F);\n        Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa));\n        highp vec4 rgba;\n        rgba[0] = 128.0 * Sign  + floor(Exponent*exp2(-1.0));\n        rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0);\n        rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0)));\n        rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0)));\n        ${e}\n        rgba = rgba / 255.0; // values need to be normalized to [0,1]\n        return rgba;\n    }\n        `)}}decodeUint8(){const e=o.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new r.GlslLibRoutine(`\n        highp float decode(highp vec4 rgba) {\n          rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255]\n          ${e}\n          highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;\n          highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0;\n          highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);\n          highp float Result =  Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));\n          return Result;\n      }\n        `)}}static isLittleEndian(){const e=new ArrayBuffer(4),t=new Uint32Array(e),n=new Uint8Array(e);if(t[0]=3735928559,239===n[0])return!0;if(222===n[0])return!1;throw new Error("unknown endianness")}}t.EncodingGlslLib=o},9894:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FragColorGlslLib=void 0;const r=n(8520),o=n(5060);class i extends r.GlslLib{constructor(e){super(e)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const e=(0,o.getGlsl)(this.context.glContext.version);return{setFragColor:new r.GlslLibRoutine(`\n        void setFragColor(float value) {\n            ${e.output} = encode(value);\n        }\n        `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new r.GlslLibRoutine("\n        float getColorAsFloat(vec4 color) {\n            return decode(color);\n        }\n        ",["encoding.decode"])}}}t.FragColorGlslLib=i},2848:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.replaceInlines=void 0;const n=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;t.replaceInlines=function(e){const t={};let r;for(;null!==(r=n.exec(e));){const e=r[3].split(",").map((e=>{const t=e.trim().split(" ");return t&&2===t.length?{type:t[0],name:t[1]}:null})).filter((e=>null!==e));t[r[2]]={params:e,body:r[4]}}for(const n in t){const o="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",n),i=new RegExp(o,"gm");for(;null!==(r=i.exec(e));){const o=r[1],i=r[2],s=r[3].split(","),a=o?`${o} ${i};`:"";let l=t[n].body,c="";t[n].params.forEach(((e,t)=>{e&&(c+=`${e.type} ${e.name} = ${s[t]};\n`)})),l=`${c}\n ${l}`,l=l.replace("return",`${i} = `);const u=`\n      ${a}\n      {\n        ${l}\n      }\n      `;e=e.replace(r[0],u)}}return e.replace(n,"")}},8879:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlslPreprocessor=void 0;const r=n(8520),o=n(2848),i=n(5483),s=n(5060);t.GlslPreprocessor=class{constructor(e,t,n,o){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new r.GlslContext(e,t,n,o),Object.keys(i.glslRegistry).forEach((e=>{const t=new i.glslRegistry[e](this.context);this.libs[e]=t}));const s=this.glslLibRoutineDependencyGraph;for(const e in this.libs){const t=this.libs[e].getFunctions();for(const n in t){const o=e+"."+n;let i;s[o]?(i=s[o],i.routineBody=t[n].routineBody):(i=new r.GlslLibRoutineNode(o,t[n].routineBody),s[o]=i);const a=t[n].dependencies;if(a)for(let e=0;e<a.length;++e)if(s[a[e]])i.addDependency(s[a[e]]);else{const t=new r.GlslLibRoutineNode(a[e]);s[a[e]]=t,i.addDependency(t)}}}}preprocess(){const e=this.context.programInfo;let t=e.shaderSource;return this.context.programInfo.hasMain||(t=`${t}\n      ${(0,s.getDefaultFragShaderMain)(this.context.glContext.version,this.context.outputTextureLayout.shape.length)}`),t=(0,o.replaceInlines)(t),`${(0,s.getFragShaderPreamble)(this.context.glContext.version)}\n    ${this.getUniforms(e.inputNames,e.variables)}\n    ${this.getImports(t)}\n    ${t}`}getImports(e){const t=this.selectGlslLibRoutinesToBeIncluded(e);if(0===t.length)return"";let n="";for(let e=0;e<t.length;++e){if(!t[e].routineBody)throw new Error(`Missing body for the Glsl Library routine: ${t[e].name}`);n+=t[e].routineBody+"\n"}return n}selectGlslLibRoutinesToBeIncluded(e){const t=[];return Object.keys(this.glslLibRoutineDependencyGraph).forEach((n=>{const r=n.split(".")[1];-1!==e.indexOf(r)&&t.push(this.glslLibRoutineDependencyGraph[n])})),r.TopologicalSortGlslRoutines.returnOrderedNodes(t)}getUniforms(e,t){const n=[];if(e)for(const t of e)n.push(`uniform sampler2D ${t};`);if(t)for(const e of t)n.push(`uniform ${e.type} ${e.name}${e.arrayLength?`[${e.arrayLength}]`:""};`);return n.join("\n")}}},5483:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.glslRegistry=void 0;const r=n(5107),o=n(7341),i=n(9894),s=n(2655),a=n(3891);t.glslRegistry={encoding:o.EncodingGlslLib,fragcolor:i.FragColorGlslLib,vec:a.VecGlslLib,shapeUtils:s.ShapeUtilsGlslLib,coordinates:r.CoordsGlslLib}},2655:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ShapeUtilsGlslLib=void 0;const r=n(8520);class o extends r.GlslLib{constructor(e){super(e)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const e=this.context.outputTextureLayout.shape.length,t={};return this.context.programInfo.inputNames.forEach(((n,o)=>{const i=this.context.inputTextureLayouts[o].unpackedShape;if(i.length<=e){const o=i.length,s=e-o,a=`bcastIndices_${n}`;let l="";for(let e=0;e<o;++e)l+=`\n          realIndices[${e}] = int( mod(float(bcastedIndices[${s+e}]), ${i[e]}.0) );\n          `;const c=`\n        void ${a} (int bcastedIndices[${e}], out int realIndices[${o}]) {\n          ${l}\n        }\n        `;t[a]=new r.GlslLibRoutine(c)}})),t}bcastMatmulIndex(){const e=this.context.outputTextureLayout.shape.length,t={};return this.context.programInfo.inputNames.forEach(((n,o)=>{const i=this.context.inputTextureLayouts[o].shape;if(!(i.length<2||i.length>e)){const o=i.length,s=e-o,a=`bcastMatmulIndices_${n}`;let l="";for(let e=0;e<o-2;++e)l+=`\n          realIndices[${e}] = int( mod(float(bcastedIndices[${s+e}]), ${i[e]}.0) );\n          `;const c=`\n        void ${a}(int bcastedIndices[${e}], out int realIndices[${o}]) {\n          ${l}\n          realIndices[${o-1}] = bcastedIndices[${e-1}];\n          realIndices[${o-2}] = bcastedIndices[${e-2}];\n        }\n        `;t[a]=new r.GlslLibRoutine(c)}})),t}indicesToOffset(){const e={};return this.context.programInfo.inputNames.forEach(((t,n)=>{const i=this.context.inputTextureLayouts[n].shape,s=this.context.inputTextureLayouts[n].strides,a=i.length;let l=`indicesToOffset_${t}`;e[l]=new r.GlslLibRoutine(o.indexToOffsetSingle(l,a,s)),l=`indicesToOffset_${t}_T`,e[l]=new r.GlslLibRoutine(o.indexToOffsetSingle(l,a,s.slice().reverse()))})),e}static indexToOffsetSingle(e,t,n){let r="";for(let e=t-1;e>=0;--e)r+=`\n        offset += indices[${e}] * ${n[e]};\n        `;return`\n      int ${e}(int indices[${t}]) {\n        int offset = 0;\n        ${r}\n        return offset;\n      }\n      `}offsetToIndices(){const e={};return this.context.programInfo.inputNames.forEach(((t,n)=>{const i=this.context.inputTextureLayouts[n].shape,s=this.context.inputTextureLayouts[n].strides,a=i.length;let l=`offsetToIndices_${t}`;e[l]=new r.GlslLibRoutine(o.offsetToIndicesSingle(l,a,s)),l=`offsetToIndices_${t}_T`,e[l]=new r.GlslLibRoutine(o.offsetToIndicesSingle(l,a,s.slice().reverse()))})),e}static offsetToIndicesSingle(e,t,n){const r=[];for(let e=0;e<t-1;++e)r.push(`\n      indices[${e}] = offset / ${n[e]};`),r.push(`\n        offset -= indices[${e}] * ${n[e]};`);return r.push(`\n      indices[${t-1}] = offset;`),`\n      void ${e}(int offset, out int indices[${t}]) {\n        ${r.join("")}\n      }\n      `}incrementIndices(){const e={};return this.context.programInfo.inputNames.forEach(((t,n)=>{const o=this.context.inputTextureLayouts[n].shape,i=o.length,s=`incrementIndices_${t}`;let a="";for(let e=0;e<i;++e)a+=`\n        shape[${e}] = ${o[e]};`;const l=`\n        void ${s}(int axis, out int indices[${i}]) {\n          int shape[${i}];\n          ${a};\n          for(int i = ${i} -1 ; i >= 0; --i) {\n            if(i > axis) continue;\n            indices[i] += 1;\n            if(indices[i] < shape[i]) {\n              break;\n            }\n            indices[i] = 0;\n          }\n        }\n        `;e[s]=new r.GlslLibRoutine(l)})),e}}t.ShapeUtilsGlslLib=o},5060:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultFragShaderMain=t.getFragShaderPreamble=t.getVertexShaderSource=t.getGlsl=void 0;const n={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},r={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function o(e){return 1===e?n:r}t.getGlsl=o,t.getVertexShaderSource=function(e){const t=o(e);return`${t.version}\n      precision highp float;\n      ${t.attribute} vec3 position;\n      ${t.attribute} vec2 textureCoord;\n\n      ${t.varyingVertex} vec2 TexCoords;\n\n      void main()\n      {\n          gl_Position = vec4(position, 1.0);\n          TexCoords = textureCoord;\n      }`},t.getFragShaderPreamble=function(e){const t=o(e);return`${t.version}\n    precision highp float;\n    precision highp int;\n    precision highp sampler2D;\n    ${t.varyingFrag} vec2 TexCoords;\n    ${t.outputDeclaration}\n    const vec2 halfCR = vec2(0.5, 0.5);\n\n    // Custom vector types to handle higher dimenalities.\n    struct ivec5\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n    };\n\n    struct ivec6\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n      int v;\n    };\n\n    int imod(int x, int y) {\n      return x - y * (x / y);\n    }\n\n    `},t.getDefaultFragShaderMain=function(e,t){return`\n  void main() {\n    int indices[${t}];\n    toVec(TexCoords, indices);\n    vec4 result = vec4(process(indices));\n    ${o(e).output} = result;\n  }\n  `}},3891:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VecGlslLib=void 0;const r=n(8520);class o extends r.GlslLib{constructor(e){super(e)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const e=this.context.outputTextureLayout.shape.length,t={add:"+=",sub:"-=",mul:"*=",div:"/="},n={};for(const o in t){const i=`${o}Vec`;let s="";for(let n=0;n<e;++n)s+=`\n          dest[${n}] ${t[o]} src[${n}];\n          `;const a=`\n        void ${i}(int src[${e}], out int dest[${e}]) {\n          ${s}\n        }\n        `;n[i]=new r.GlslLibRoutine(a)}return n}copyVec(){const e=this.context.outputTextureLayout.shape.length;let t="";for(let n=0;n<e;++n)t+=`\n        dest[${n}] = src[${n}];\n        `;const n=`\n      void copyVec(int src[${e}], out int dest[${e}]) {\n        ${t}\n      }\n      `;return{copyVec:new r.GlslLibRoutine(n)}}setVecItem(){const e=this.context.outputTextureLayout.shape.length;let t=`\n        if(index < 0)\n            index =${e} + index;\n        if (index == 0)\n            m[0] = value;\n        `;for(let n=1;n<e-1;++n)t+=`\n        else if (index == ${n})\n            m[${n}] = value;\n            `;t+=`\n        else\n            m[${e-1}] = value;\n        `;const n=`\n      void setVecItem(out int m[${e}], int index, int value) {\n        ${t}\n      }\n        `;return{setVecItem:new r.GlslLibRoutine(n)}}getVecItem(){const e=this.context.outputTextureLayout.shape.length;let t=`\n        if(index < 0)\n            index = ${e} + index;\n        if (index == 0)\n            return m[0];\n      `;for(let n=1;n<e-1;++n)t+=`\n        else if (index == ${n})\n            return m[${n}];\n      `;t+=`\n        else\n            return m[${e-1}];\n        `;const n=`\n      int getVecItem(int m[${e}], int index) {\n        ${t}\n      }\n    `;return{getVecItem:new r.GlslLibRoutine(n)}}}t.VecGlslLib=o},8316:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLInferenceHandler=void 0;const r=n(6231),o=n(9162),i=n(2517),s=n(2403),a=n(7019),l=n(8710),c=n(5611),u=n(4057),p=n(2039);t.WebGLInferenceHandler=class{constructor(e){this.session=e,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(e,t){return(0,u.calculateTextureWidthAndHeight)(this.session.layoutStrategy,e,t)}executeProgram(e,t){if(t.length<e.inputNames.length)throw new Error(`Input size mustn't be less than ${e.inputNames.length}.`);if(e.inputNames.length!==e.inputTypes.length)throw new Error("input names size does not match input types");const n=[];for(let r=0;r<e.inputNames.length;++r)n[r]=this.getOrCreateTextureData(t[r],e.inputTypes[r]);const r=((e,t)=>{const n=t.map((e=>`${e.unpackedShape.join(",")};${e.width}x${e.height}`)).join("_");let r=e.name;return e.cacheHint&&(r+="["+e.cacheHint+"]"),r+=":"+n,r})(e,n);let o=this.session.programManager.getArtifact(r);const i=o?o.programInfo:"function"==typeof e.get?e.get():e,s=(0,u.createTextureLayoutFromTextureType)(this.session.layoutStrategy,i.output.dims,i.output.textureType),a=this.createTextureData(s,i.output.type);return o||(o=this.session.programManager.build(i,n,a),this.session.programManager.setArtifact(r,o)),this.runProgram(o,n,a),a}run(e,t){return this.executeProgram(e,t).tensor}runProgram(e,t,n){for(let n=0;n<t.length;++n)if(!!t[n].isPacked!=(e.programInfo.inputTypes[n]===p.TextureType.packed))throw new Error(`input[${n}] property packed inconsistent`);if(!!n.isPacked!=(e.programInfo.output.textureType===p.TextureType.packed))throw new Error("output property packed inconsistent");this.session.programManager.run(e,t,n)}getOrCreateTextureData(e,t){let n=this.getTextureData(e.dataId,t===p.TextureType.packed);if(!n&&(n=this.getTextureData(e.dataId,t!==p.TextureType.packed),n))return t===p.TextureType.packed?this.pack(n):this.unpack(n);if(!n){const r=(0,u.createTextureLayoutFromTextureType)(this.session.layoutStrategy,e.dims,t);if(t===p.TextureType.packedLastDimension){const n=1,r=4,o=e.dims;if(4===o.length){const i=[o[0],Math.ceil(o[1]*o[2]*o[3]/r)],s=(0,u.createTextureLayoutFromTextureType)(this.session.layoutStrategy,i,t);let a=e.numberData;if(o[1]*o[2]*o[3]%r!=0){const t=o[0],i=o[1]*o[2]*o[3],s=Math.ceil(i*n/r)*r;a=new Float32Array(t*s);for(let r=0;r<t;++r){const t=r*i,o=r*s+r%n*i;a.set(e.numberData.subarray(t,t+i),o)}}return this.createTextureData(s,e.type,a,e,1)}}if(t===p.TextureType.packed){const t=(0,u.createTextureLayoutFromShape)(this.session.layoutStrategy,e.dims,1,[],{reverseWH:!0}),r=this.createTextureData(t,e.type,e.numberData,e,1);n=this.pack(r)}else n=this.createTextureData(r,e.type,e.numberData,e,1)}return n}createTextureDataFromLayoutBindTensor(e,t,n,r){return this.createTextureData(e,t,n,r,1)}createTextureData(e,t,n,o,i){r.Logger.verbose("InferenceHandler",`Creating TextureData: layout:[${JSON.stringify(e)}]`);const s=this.session.textureManager.createTextureFromLayout(t,e,n,i);return this.createTextureDataFromTexture(e,t,s,o)}reshapeUnpacked(e,t){const n=this.getOrCreateTextureData(e,p.TextureType.unpacked),r={channels:n.channels,height:n.height,width:n.width,shape:0!==t.length?t:[1],strides:i.ShapeUtil.computeStrides(t),unpackedShape:t};return this.createTextureDataFromTexture(r,e.type,n.texture).tensor}reshapePacked(e,t){const n=this.getOrCreateTextureData(e,p.TextureType.packed);if((0,a.isReshapeCheap)(e.dims,t)){const r={channels:n.channels,height:n.height,width:n.width,shape:0!==t.length?t:[1],strides:i.ShapeUtil.computeStrides(t),unpackedShape:t,isPacked:!0};return this.createTextureDataFromTexture(r,e.type,n.texture).tensor}const r=(0,a.processDims3D)(e.dims),o=(0,a.processDims3D)(t),s=this.reshapePacked(e,r),l=this.run((0,a.createPackedReshape3DProgramInfoLoader)(this,s,o),[s]);return this.reshapePacked(l,t)}cast(e,t){const n=this.getOrCreateTextureData(e,p.TextureType.unpacked);return this.createTextureDataFromTexture(n,t,n.texture).tensor}createTextureDataFromTexture(e,t,n,r,i){const s=Object.assign(Object.assign({},e),{tensor:r||new o.Tensor(e.unpackedShape,t,(e=>this.readTexture(s)),(async e=>this.readTextureAsync(s)),void 0,i),texture:n});return this.setTextureData(s.tensor.dataId,s,e.isPacked),s}getTextureData(e,t=!1){return this.session.isInitializer(e)?this.session.getTextureData(e,t):t?this.packedTextureDataCache.get(e):this.unpackedTextureDataCache.get(e)}setTextureData(e,t,n=!1){this.session.isInitializer(e)?this.session.setTextureData(e,t,n):(n?this.packedTextureDataCache:this.unpackedTextureDataCache).set(e,t)}isTextureLayoutCached(e,t=!1){return!!this.getTextureData(e.dataId,t)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach((e=>this.session.textureManager.releaseTexture(e))),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach((e=>this.session.textureManager.releaseTexture(e))),this.unpackedTextureDataCache=new Map}readTexture(e){return e.isPacked?this.readTexture(this.unpack(e)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(e,e.tensor.type,e.channels):this.session.textureManager.readUint8TextureAsFloat((0,l.encodeAsUint8)(this,e))}async readTextureAsync(e){return e.isPacked?this.readTextureAsync(this.unpack(e)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(e,e.tensor.type,e.channels):this.session.textureManager.readUint8TextureAsFloat((0,l.encodeAsUint8)(this,e))}pack(e){return this.executeProgram((0,s.createPackProgramInfoLoader)(this,e.tensor),[e.tensor])}unpack(e){return this.executeProgram((0,c.createUnpackProgramInfoLoader)(this,e.tensor),[e.tensor])}}},1640:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.WEBGL_OP_RESOLVE_RULES=void 0;const s=n(2898),a=i(n(7839)),l=n(4196),c=n(2069),u=n(8138),p=n(9663),d=n(5193),_=n(7992),h=n(1253),f=n(4776),m=n(6572),g=n(3346),b=n(5623),w=n(2870),x=n(2143),y=n(4939),T=n(718),v=n(2268),k=n(8117),M=n(2278),S=n(5524),P=n(5975),A=n(3933),F=n(6558),C=n(5723),E=n(3738),O=i(n(4909)),I=n(8428),D=n(9793);t.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",O.abs],["Acos","","7+",O.acos],["Add","","7+",a.add],["And","","7+",a.and],["Asin","","7+",O.asin],["Atan","","7+",O.atan],["AveragePool","","7+",x.averagePool,x.parseAveragePoolAttributes],["BatchNormalization","","7+",s.batchNormalization,s.parseBatchNormalizationAttributes],["Cast","","6+",l.cast,l.parseCastAttributes],["Ceil","","6+",O.ceil],["Clip","","6-10",O.clip,O.parseClipAttributes],["Clip","","11+",O.clipV11],["Concat","","4+",c.concat,c.parseConcatAttributes],["Conv","","1+",u.conv,u.parseConvAttributes],["ConvTranspose","","1+",p.convTranspose,p.parseConvTransposeAttributes],["Cos","","7+",O.cos],["Div","","7+",a.div],["Dropout","","7+",O.identity],["DepthToSpace","","1+",d.depthToSpace,d.parseDepthToSpaceAttributes],["Equal","","7+",a.equal],["Elu","","6+",O.elu,O.parseEluAttributes],["Exp","","6+",O.exp],["Flatten","","1+",_.flatten,_.parseFlattenAttributes],["Floor","","6+",O.floor],["FusedConv","com.microsoft","1+",u.conv,u.parseConvAttributes],["Gather","","1+",h.gather,h.parseGatherAttributes],["Gemm","","7-10",f.gemm,f.parseGemmAttributesV7],["Gemm","","11+",f.gemm,f.parseGemmAttributesV11],["GlobalAveragePool","","1+",x.globalAveragePool,x.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",x.globalMaxPool],["Greater","","7+",a.greater],["Identity","","1+",O.identity],["ImageScaler","","1+",m.imageScaler,m.parseImageScalerAttributes],["InstanceNormalization","","6+",g.instanceNormalization,g.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",O.leakyRelu,O.parseLeakyReluAttributes],["Less","","7+",a.less],["Log","","6+",O.log],["MatMul","","1+",b.matMul,b.parseMatMulAttributes],["MaxPool","","1+",x.maxPool,x.parseMaxPoolAttributes],["Mul","","7+",a.mul],["Neg","","6+",O.neg],["Not","","1+",O.not],["Or","","7+",a.or],["Pad","","2-10",w.padV2,w.parsePadAttributesV2],["Pad","","11+",w.padV11,w.parsePadAttributesV11],["Pow","","7+",a.pow],["PRelu","","7+",a.pRelu],["ReduceLogSum","","1+",y.reduceLogSum,y.parseReduceAttributes],["ReduceMax","","1+",y.reduceMax,y.parseReduceAttributes],["ReduceMean","","1+",y.reduceMean,y.parseReduceAttributes],["ReduceMin","","1+",y.reduceMin,y.parseReduceAttributes],["ReduceProd","","1+",y.reduceProd,y.parseReduceAttributes],["ReduceSum","","1-12",y.reduceSum,y.parseReduceAttributes],["ReduceSumSquare","","1+",y.reduceLogSumSquare,y.parseReduceAttributes],["Relu","","6+",O.relu],["Reshape","","5+",T.reshape],["Resize","","10",v.resize,v.parseResizeAttributesV10],["Resize","","11+",v.resize,v.parseResizeAttributesV11],["Shape","","1+",k.shape],["Sigmoid","","6+",O.sigmoid],["Sin","","7+",O.sin],["Slice","","10+",M.sliceV10],["Slice","","1-9",M.slice,M.parseSliceAttributes],["Softmax","","1-12",S.softmax,S.parseSoftmaxAttributes],["Softmax","","13+",S.softmaxV13,S.parseSoftmaxAttributesV13],["Split","","2-12",P.split,P.parseSplitAttributes],["Sqrt","","6+",O.sqrt],["Squeeze","","1-12",A.squeeze,A.parseSqueezeAttributes],["Squeeze","","13+",A.squeezeV13],["Sub","","7+",a.sub],["Sum","","6+",F.sum],["Tan","","7+",O.tan],["Tanh","","6+",O.tanh],["Tile","","6+",C.tile],["Transpose","","1+",E.transpose,E.parseTransposeAttributes],["Upsample","","7-8",D.upsample,D.parseUpsampleAttributesV7],["Upsample","","9",D.upsample,D.parseUpsampleAttributesV9],["Unsqueeze","","1-12",I.unsqueeze,I.parseUnsqueezeAttributes],["Unsqueeze","","13+",I.unsqueezeV13],["Xor","","7+",a.xor]]},2898:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseBatchNormalizationAttributes=t.batchNormalization=void 0;const r=n(246),o=n(5060),i=n(2039),s={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]};t.batchNormalization=(e,t,n)=>(l(t),[e.run(Object.assign(Object.assign({},s),{cacheHint:n.cacheKey,get:()=>a(e,t,n)}),t)]),t.parseBatchNormalizationAttributes=e=>{const t=e.attributes.getFloat("epsilon",1e-5),n=e.attributes.getFloat("momentum",.9),o=e.attributes.getInt("spatial",1);return(0,r.createAttributeWithCacheKey)({epsilon:t,momentum:n,spatial:o})};const a=(e,t,n)=>{const r=(0,o.getGlsl)(e.session.backend.glContext.version),a=t[0].dims.length,[l,c]=e.calculateTextureWidthAndHeight(t[1].dims,i.TextureType.unpacked),u=`\n  float process(int[${a}] indices) {\n    vec2 position = offsetToCoords(indices[1], ${l}, ${c});\n    float scale = getColorAsFloat(${r.texture2D}(Scale, position));\n    float mean = getColorAsFloat(${r.texture2D}(Mean, position));\n    float variance = getColorAsFloat(${r.texture2D}(Variance, position));\n    float b = getColorAsFloat(${r.texture2D}(B, position));\n\n    return scale * ( (_A(indices) - mean) / sqrt(variance + float(${n.epsilon})) ) + b;\n  }`;return Object.assign(Object.assign({},s),{output:{dims:t[0].dims,type:t[0].type,textureType:i.TextureType.unpacked},shaderSource:u})},l=e=>{if(!e||5!==e.length)throw new Error("BatchNormalization requires 5 inputs.");const t=e[0],n=e[1],r=e[2],o=e[3],i=e[4];if(t.dims.length<3||1!==n.dims.length||1!==r.dims.length||1!==o.dims.length||1!==i.dims.length)throw new Error("invalid input shape.");if(n.dims[0]!==t.dims[1]||r.dims[0]!==t.dims[1]||o.dims[0]!==t.dims[1]||i.dims[0]!==t.dims[1])throw new Error("invalid input shape.");if("float32"!==t.type&&"float64"!==t.type||"float32"!==n.type&&"float64"!==n.type||"float32"!==r.type&&"float64"!==r.type||"float32"!==o.type&&"float64"!==o.type||"float32"!==i.type&&"float64"!==i.type)throw new Error("invalid input tensor types.")}},7839:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.xor=t.sub=t.pRelu=t.pow=t.or=t.mul=t.less=t.greater=t.equal=t.div=t.and=t.add=t.glslPRelu=t.glslPow=t.glslXor=t.glslOr=t.glslAnd=t.glslLess=t.glslGreater=t.glslEqual=t.glslSub=t.glslMul=t.glslDiv=t.glslAdd=void 0;const r=n(2517),o=n(8520),i=n(5060),s=n(2039);function a(){const e="add_";return{body:`\n  float ${e}(float a, float b) {\n    return a + b;\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return v1 + v2;\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function l(){const e="div_";return{body:`\n  float ${e}(float a, float b) {\n    return a / b;\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return v1 / v2;\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function c(){const e="mul_";return{body:`\n  float ${e}(float a, float b) {\n    return a * b;\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return v1 * v2;\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function u(){const e="sub_";return{body:`\n  float ${e}(float a, float b) {\n    return a - b;\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return v1 - v2;\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function p(){const e="equal_";return{body:`\n  float ${e}(float a, float b) {\n    return float(a == b);\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return vec4(equal(v1, v2));\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function d(){const e="greater_";return{body:`\n  float ${e}(float a, float b) {\n    return float(a > b);\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return vec4( v1.r > v2.r ,\n      v1.g > v2.g,\n      v1.b > v2.b,\n      v1.a > v2.a );\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function _(){const e="less_";return{body:`\n  float ${e}(float a, float b) {\n    return float(a < b);\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return vec4( v1.r < v2.r ,\n                v1.g < v2.g,\n                v1.b < v2.b,\n                v1.a < v2.a );\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function h(){const e="and_";return{body:`\n  float ${e}(float a, float b) {\n    return float( bool(a) && bool(b) );\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    bvec4 b1 = bvec4(v1);\n    bvec4 b2 = bvec4(v2);\n    return vec4( b1.r && b2.r ,\n                b1.g && b2.g,\n                b1.b && b2.b,\n                b1.a && b2.a );\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function f(){const e="or_";return{body:`\n  float ${e}(float a, float b) {\n    return float( bool(a) || bool(b) );\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    bvec4 b1 = bvec4(v1);\n    bvec4 b2 = bvec4(v2);\n    return vec4( b1.r || b2.r ,\n                b1.g || b2.g,\n                b1.b || b2.b,\n                b1.a || b2.a );\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function m(){const e="xor_";return{body:`\n  float ${e}(float a, float b) {\n    return float( bool(a) ^^ bool(b) );\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    bvec4 b1 = bvec4(v1);\n    bvec4 b2 = bvec4(v2);\n    return vec4( b1.r ^^ b2.r ,\n                b1.g ^^ b2.g,\n                b1.b ^^ b2.b,\n                b1.a ^^ b2.a );\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}function g(){return function(e){const t=`${e}_`;return{body:`\n  float ${t}(float a, float b) {\n    return ${e}(a, b);\n  }\n  vec4 ${t}(vec4 v1, vec4 v2) {\n    return ${e}(v1, v2);\n  }\n  `,name:t,type:o.FunctionType.ValueBased}}("pow")}function b(){const e="prelu_";return{body:`\n  float ${e}(float a, float b) {\n    return a < 0.0 ? a * b: a;\n  }\n  vec4 ${e}(vec4 v1, vec4 v2) {\n    return vec4(\n      v1.r < 0.0 ? v1.r * v2.r: v1.r,\n      v1.g < 0.0 ? v1.g * v2.g: v1.g,\n      v1.b < 0.0 ? v1.b * v2.b: v1.b,\n      v1.a < 0.0 ? v1.a * v2.a: v1.a\n      );\n  }\n  `,name:e,type:o.FunctionType.ValueBased}}t.glslAdd=a,t.glslDiv=l,t.glslMul=c,t.glslSub=u,t.glslEqual=p,t.glslGreater=d,t.glslLess=_,t.glslAnd=h,t.glslOr=f,t.glslXor=m,t.glslPow=g,t.glslPRelu=b;const w=(e,t,n,r=t[0].type,o)=>{const i=e.session.pack?s.TextureType.packed:s.TextureType.unpacked;return{name:n.name,inputNames:["A","B"],inputTypes:[i,i],cacheHint:o,get:()=>x(e,t,n,r)}},x=(e,t,n,o=t[0].type)=>{const a=e.session.pack?s.TextureType.packed:s.TextureType.unpacked,l=!r.ShapeUtil.areEqual(t[0].dims,t[1].dims);let c=t[0].dims;const u=e.session.pack;if(l){const s=r.BroadcastUtil.calcShape(t[0].dims,t[1].dims,!1);if(!s)throw new Error("Can't perform binary op on the given tensors");c=s;const l=c.length,p=0!==t[0].dims.length?t[0].dims.length:1,d=0!==t[1].dims.length?t[1].dims.length:1,_=0!==t[0].dims.length?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",h=0!==t[1].dims.length?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",f=(0,i.getGlsl)(e.session.backend.glContext.version),m=u?`\n      ${n.body}\n      void main() {\n        vec4 a = getAAtOutCoords();\n        vec4 b = getBAtOutCoords();\n        vec4 result = ${n.name}(a, b);\n        ${f.output} = result;\n      }`:`\n      ${n.body}\n      float process(int indices[${l}]) {\n        int aindices[${p}];\n        int bindices[${d}];\n        ${_}\n        ${h}\n        return ${n.name}(_A(aindices), _B(bindices));\n      }`;return{name:n.name,inputNames:["A","B"],inputTypes:[a,a],output:{dims:c,type:o,textureType:a},shaderSource:m,hasMain:u}}const p=(0,i.getGlsl)(e.session.backend.glContext.version),d=`\n    ${n.body}\n    void main() {\n      vec4 v1 = ${p.texture2D}(A, TexCoords);\n      vec4 v2 = ${p.texture2D}(B, TexCoords);\n      vec4 result = ${n.name}(v1, v2);\n      ${p.output} = result;\n    }\n    `;return{name:n.name,inputNames:["A","B"],inputTypes:[a,a],output:{dims:t[0].dims,type:o,textureType:a},shaderSource:d,hasMain:!0}};t.add=(e,t)=>[e.run(w(e,t,a()),t)],t.and=(e,t)=>[e.run(w(e,t,h(),"bool"),t)],t.div=(e,t)=>[e.run(w(e,t,l()),t)],t.equal=(e,t)=>[e.run(w(e,t,p(),"bool"),t)],t.greater=(e,t)=>[e.run(w(e,t,d(),"bool"),t)],t.less=(e,t)=>[e.run(w(e,t,_(),"bool"),t)],t.mul=(e,t)=>[e.run(w(e,t,c()),t)],t.or=(e,t)=>[e.run(w(e,t,f(),"bool"),t)],t.pow=(e,t)=>[e.run(w(e,t,g()),t)],t.pRelu=(e,t)=>[e.run(w(e,t,b()),t)],t.sub=(e,t)=>[e.run(w(e,t,u()),t)],t.xor=(e,t)=>[e.run(w(e,t,m(),"bool"),t)]},4196:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseCastAttributes=t.cast=void 0;const r=n(2517);t.cast=(e,t,n)=>(o(t),[e.cast(t[0],n)]),t.parseCastAttributes=e=>r.ProtoUtil.tensorDataTypeFromProto(e.attributes.getInt("to"));const o=e=>{if(!e||1!==e.length)throw new Error("Cast requires 1 input.");if("string"===e[0].type)throw new Error("Invalid input type.")}},1163:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createPackedConcatProgramInfoLoader=void 0;const r=n(5060),o=n(2039),i=n(9390),s=n(2827);t.createPackedConcatProgramInfoLoader=(e,t,n)=>{const l=(c=t.length,u=n.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:c},((e,t)=>`X${t}`)),inputTypes:Array(c).fill(o.TextureType.packed),cacheHint:u});var c,u;return Object.assign(Object.assign({},l),{get:()=>((e,t,n,l)=>{const c=n[0].dims.slice();if(l>=c.length||l<-1*c.length)throw new Error("axis specified for concat doesn't match input dimensionality");l<0&&(l=c.length+l);const u=c.slice(0);for(let e=1;e<n.length;e++){const t=n[e].dims.slice();for(let e=0;e<c.length;e++)if(e===l)u[l]+=t[e];else if(c[e]!==t[e])throw new Error("non concat dimensions must match")}const p=u.length,d=(0,s.getChannels)("coords",p),_=(0,i.getCoordsDataType)(p),h=(0,s.unpackFromChannel)(),f=n.map((e=>e.dims)),m=(0,i.getGlChannels)(p),g=new Array(f.length-1);g[0]=f[0][l];for(let e=1;e<g.length;e++)g[e]=g[e-1]+f[e][l];const b=m[l],w=m.slice(-2),x=m.join();let y=`if (${b} < ${g[0]}) {\n        return getChannel(\n            getX0(${x}), vec2(${w.join()}));\n        }`;for(let e=1;e<g.length;e++){const t=g[e-1];y+=`\n            if (${b} < ${g[e]}  && ${b} >= ${g[e-1]}) {\n              return getChannel(\n                getX${e}(${a(m,b,t)}),\n                vec2(${a(w,b,t)}));\n            }`}const T=g.length,v=g[g.length-1];y+=`\n            return getChannel(\n              getX${T}(${a(m,b,v)}),\n              vec2(${a(w,b,v)}));`;const k=(0,r.getGlsl)(e.session.backend.glContext.version),M=`\n          ${h}\n          float getValue(${m.map((e=>"int "+e))}) {\n            ${y}\n          }\n\n          void main() {\n            ${_} coords = getOutputCoords();\n            int lastDim = coords.${m[p-1]};\n            coords.${m[p-1]} = coords.${m[p-2]};\n            coords.${m[p-2]} = lastDim;\n\n            vec4 result = vec4(getValue(${d}), 0., 0., 0.);\n\n            ${d[p-1]} = ${d[p-1]} + 1;\n            if (${d[p-1]} < ${u[p-1]}) {\n              result.g = getValue(${d});\n            }\n\n            ${d[p-2]} = ${d[p-2]} + 1;\n            if (${d[p-2]} < ${u[p-2]}) {\n              result.a = getValue(${d});\n            }\n\n            ${d[p-1]} = ${d[p-1]} - 1;\n            if (${d[p-2]} < ${u[p-2]} &&\n                ${d[p-1]} < ${u[p-1]}) {\n              result.b = getValue(${d});\n            }\n            ${k.output} = result;\n          }\n        `;return Object.assign(Object.assign({},t),{output:{dims:u,type:n[0].type,textureType:o.TextureType.packed},shaderSource:M,hasMain:!0})})(e,l,t,n.axis)})};const a=(e,t,n)=>{const r=e.indexOf(t);return e.map(((e,t)=>t===r?`${e} - ${n}`:e)).join()}},2069:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseConcatAttributes=t.concat=void 0;const r=n(246),o=n(2039),i=n(1163);t.concat=(e,t,n)=>(p(t),e.session.pack&&t[0].dims.length>1?[e.run((0,i.createPackedConcatProgramInfoLoader)(e,t,n),t)]:[e.run(s(e,t,n),t)]);const s=(e,t,n)=>{const r=(i=t.length,s=n.cacheKey,{name:"Concat",inputNames:Array.from({length:i},((e,t)=>`X${t}`)),inputTypes:Array(i).fill(o.TextureType.unpacked),cacheHint:s});var i,s;return Object.assign(Object.assign({},r),{get:()=>((e,t,n,r)=>{const i=n[0].dims.slice();if(r>=i.length||r<-1*i.length)throw new Error("axis specified for concat doesn't match input dimensionality");r<0&&(r=i.length+r);const s=i.slice(0);for(let e=1;e<n.length;e++){const t=n[e].dims.slice();for(let e=0;e<i.length;e++)if(e===r)s[r]+=t[e];else if(i[e]!==t[e])throw new Error("non concat dimensions must match")}const p=s.length,d=new Array(n.length);let _=0;for(let e=0;e<d.length;++e)_+=n[e].dims[r],d[e]=_;let h="";h=n.length<5?a(d):l(d);const f=`\n        ${c(n.length,p)}\n        ${u(d)}\n        ${h}\n        float process(int indices[${p}]) {\n          int textureIndex = getTextureWhereDataResides (indices[${r}]);\n\n          if(textureIndex != 0) {\n            indices[${r}] = indices[${r}] - int(getSizeInConcatAxisValueFromIndex(textureIndex-int(1)));\n          }\n\n          return fetchDataFromCorrectTexture(textureIndex, indices);\n        }`;return Object.assign(Object.assign({},t),{output:{dims:s,type:n[0].type,textureType:o.TextureType.unpacked},shaderSource:f})})(0,r,t,n.axis)})},a=e=>`int getTextureWhereDataResides(int index) {\n      ${e.map(((e,t)=>`if(index<${e}) {return ${t};}\n`)).join("")}\n    }`,l=e=>a(e),c=(e,t)=>{const n=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${t}]) {`];for(let t=0;t<e;++t)0===t?n.push(`\tif (textureIndex == ${t}) { return _X${t}(indices); }`):t===e-1?n.push(`\telse { return _X${t}(indices); }`):n.push(`\telse if (textureIndex == ${t}) { return _X${t}(indices); }`);return n.push("\t}"),n.join("\n")},u=e=>{const t=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let n=0;n<e.length;++n)0===n?t.push(`\tif (index == ${n}) { return ${e[n]}; }`):n===e.length-1?t.push(`\telse { return ${e[n]}; }`):t.push(`\telse if (index == ${n}) { return ${e[n]}; }`);return t.push("\t}"),t.join("\n")};t.parseConcatAttributes=e=>(0,r.createAttributeWithCacheKey)({axis:e.attributes.getInt("axis")});const p=e=>{if(!e||e.length<1)throw new Error("too few inputs");const t=e[0].type,n=e[0].dims.length;if("string"===t)throw new Error("string tensor is not supported yet");for(const r of e){if(r.type!==t)throw new Error("input tensors should be one type");if(r.dims.length!==n)throw new Error("input tensors should have the same shape")}}},4770:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createUnpackedGroupedConvProgramInfoLoader=void 0;const r=n(6231),o=n(5060),i=n(2039),s=n(8138),a=n(2823);t.createUnpackedGroupedConvProgramInfoLoader=(e,t,n)=>{const l=(c=t.length>2,u=n.cacheKey,{name:"GroupedConv",inputNames:c?["X","W","Bias"]:["X","W"],inputTypes:c?[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.unpacked],cacheHint:u});var c,u;return Object.assign(Object.assign({},l),{get:()=>((e,t,n,l)=>{const c=t.length>2?"value += getBias(output_channel);":"",u=t[0].dims.slice(),p=t[1].dims.slice(),d=p[0]/l.group;r.Logger.verbose("GroupedConv",`autpPad:${l.autoPad}, dilations:${l.dilations}, group:${l.group}, kernelShape:${l.kernelShape}, pads:${l.pads}, strides:${l.strides}`);const _=(0,s.calculateOutputShape)(u,p,l.dilations,l.pads,l.strides),h=(0,o.getGlsl)(e.session.backend.glContext.version),{activationFunction:f,applyActivation:m}=(0,a.getActivationSnippet)(l),g=`\n  const ivec2 strides = ivec2(${l.strides[0]}, ${l.strides[1]});\n  const ivec2 pads = ivec2(${l.pads[0]}, ${l.pads[1]});\n  ${f}\n  void main() {\n    ivec4 coords = getOutputCoords();\n    int batch = coords.x;\n    int output_channel = coords.y;\n    ivec2 xRCCorner = coords.zw * strides - pads;\n    int group_id = output_channel / ${d};\n\n    float value = 0.0;\n    for (int wInChannel = 0; wInChannel < ${p[1]}; wInChannel++) {\n      int input_channel = group_id * ${p[1]} + wInChannel;\n      for (int wHeight = 0; wHeight < ${p[2]}; wHeight++) {\n        int xHeight = xRCCorner.x + wHeight * ${l.dilations[0]};\n\n        if (xHeight < 0 || xHeight >= ${u[2]}) {\n          continue;\n        }\n\n        for (int wWidth = 0; wWidth < ${p[3]}; wWidth++) {\n          int xWidth = xRCCorner.y + wWidth * ${l.dilations[1]};\n          if (xWidth < 0 || xWidth >= ${u[3]}) {\n            continue;\n          }\n\n          float xVal = getX(batch, input_channel, xWidth, xHeight);\n          float wVal = getW(output_channel, wInChannel, wWidth, wHeight);\n          value += xVal*wVal;\n        }\n      }\n    }\n    ${c}\n    ${m}\n    ${h.output} = vec4(value, .0, .0, .0);\n  }\n`;return Object.assign(Object.assign({},n),{output:{dims:_,type:t[0].type,textureType:i.TextureType.unpacked},shaderSource:g,hasMain:!0})})(e,t,l,n)})}},1386:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.conv2DPacked=t.conv2DPackedPointwise=void 0;const r=n(8138),o=n(8555),i=n(708);t.conv2DPackedPointwise=(e,t,n)=>{const o=t[0].dims,s=t[1].dims,a=(0,r.calculateOutputShape)(o,s,n.dilations,n.pads,n.strides),l=e.reshapePacked(t[0],[o[1],o[2]*o[3]]),c=e.reshapePacked(t[1],[s[0],s[1]]),u=t.length>2?[c,l,t[2]]:[c,l],p=e.run((0,i.createPackedMatmulProgramInfoLoader)(e,u,n),u);return e.reshapePacked(p,a)},t.conv2DPacked=(e,t,n)=>{const s=t[0].dims,a=t[1].dims,l=(0,r.calculateOutputShape)(s,a,n.dilations,n.pads,n.strides),c=e.run((0,o.createPackedIm2ColProgramInfoLoader)(e,t[0],t[1],l,n),[t[0]]),u=e.reshapePacked(t[1],[a[0],a[1]*a[2]*a[3]]),p=3===t.length?[u,c,t[2]]:[u,c],d=e.run((0,i.createPackedMatmulProgramInfoLoader)(e,p,n),p);return e.reshapePacked(d,l)}},9663:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseConvTransposeAttributes=t.convTranspose=void 0;const r=n(246),o=n(5060),i=n(2039),s=n(2823),a=(e,t,n,r,o,i)=>(e-1)*t+n+(r-1)*o+1-i,l=(e,t,n,r,o)=>{const i=Math.floor(e/2);"SAME_UPPER"===t?(n[r]=i,n[o]=e-i):"SAME_LOWER"===t&&(n[r]=e-i,n[o]=i)};t.convTranspose=(e,t,n)=>(d(t,n),c(e,t,n));const c=(e,t,n)=>{const r=p(n,t);return[u(e,t,r)]},u=(e,t,n)=>e.run(((e,t,n)=>{const r=(a=t.length>2,l=n.cacheKey,{name:"ConvTranspose",inputNames:a?["X","W","B"]:["X","W"],inputTypes:a?[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.unpacked],cacheHint:l});var a,l;return Object.assign(Object.assign({},r),{get:()=>((e,t,n,r)=>{const a=t.length>2?"getB(output_channel)":"0.0",l=t[0].dims,c=t[1].dims,u=c[1],p=c[0]/r.group,d=[t[0].dims[0],t[1].dims[1]*r.group,...r.outputShape],_=(0,o.getGlsl)(e.session.backend.glContext.version),{activationFunction:h,applyActivation:f}=(0,s.getActivationSnippet)(r),m=`\n  const ivec2 strides = ivec2(${r.strides[0]}, ${r.strides[1]});\n  const ivec2 pads = ivec2(${r.pads[0]}, ${r.pads[1]});\n  ${h}\n  void main() {\n    ivec4 coords = getOutputCoords();\n    int batch = coords.x;\n    int output_channel = coords.y;\n\n    ivec2 loc = coords.zw + pads;\n\n    int group_id = output_channel / ${u};\n    int wOutChannel = output_channel - group_id * ${u};\n\n    float value = ${a};\n    for (int inChannelOffset = 0; inChannelOffset < ${p}; inChannelOffset++) {\n      int input_channel = group_id * ${p} + inChannelOffset;\n      for (int wWOff = 0; wWOff < ${c[2]}; wWOff++) {\n        for (int wHOff = 0; wHOff < ${c[3]}; wHOff++) {\n          ivec2 wOff = ivec2(wWOff * ${r.dilations[0]}, wHOff * ${r.dilations[1]});\n          ivec2 wLoc = loc - wOff;\n          ivec2 wLocIn = wLoc / strides;\n          if (\n            wLocIn * strides == wLoc &&\n            wLocIn.x >= 0 && wLocIn.x < ${l[2]} &&\n            wLocIn.y >= 0 && wLocIn.y < ${l[3]}\n          ) {\n            float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x);\n            float wVal = getW(input_channel, wOutChannel, wHOff, wWOff);\n            value += xVal * wVal;\n          }\n        }\n      }\n    }\n    ${f}\n    ${_.output} = vec4(value, .0, .0, .0);\n  }\n`;return Object.assign(Object.assign({},n),{output:{dims:d,type:t[0].type,textureType:i.TextureType.unpacked},shaderSource:m,hasMain:!0})})(e,t,r,n)})})(e,t,n),t),p=(e,t)=>{const n=e.kernelShape.slice();if(0===e.kernelShape.length)for(let e=2;e<t[1].dims.length;++e)n.push(t[1].dims[e]);const r=e.pads.slice(),o=e.outputShape.slice();((e,t,n,r,o,i,s,c)=>{const u=e.length-2,p=0===c.length;for(let d=0;d<u;++d){const _=p?e[d+2]*i[d]:c[d],h=a(e[d+2],i[d],o[d],t[d],n[d],_);l(h,r,o,d,d+u),p&&c.push(i[d]*(e[d+2]-1)+s[d]+(t[d]-1)*n[d]+1-o[d]-o[d+u])}})(t[0].dims,n,e.dilations,e.autoPad,r,e.strides,e.outputPadding,o);const i=Object.assign({},e);return Object.assign(i,{kernelShape:n,pads:r,outputShape:o,cacheKey:e.cacheKey}),i};t.parseConvTransposeAttributes=e=>{const t=e.attributes,n=(0,s.parseInternalActivationAttributes)(t),o=t.getString("auto_pad","NOTSET"),i=t.getInts("dilations",[1,1]),a=t.getInt("group",1),l=t.getInts("kernel_shape",[]),c=t.getInts("output_padding",[0,0]),u=t.getInts("output_shape",[]),p=t.getInts("pads",[0,0,0,0]),d=t.getInts("strides",[1,1]);return(0,r.createAttributeWithCacheKey)(Object.assign({autoPad:o,dilations:i,group:a,kernelShape:l,outputPadding:c,outputShape:u,pads:p,strides:d},n))};const d=(e,t)=>{if(!e||2!==e.length&&3!==e.length)throw new Error("Conv requires 2 or 3 inputs");if(4!==e[0].dims.length||4!==e[1].dims.length)throw new Error("currently only support 2-dimensional conv");if(e[0].dims[1]!==e[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const n=e[1].dims[1]*t.group;if(3===e.length&&(1!==e[2].dims.length||e[2].dims[0]!==n))throw new Error("invalid bias");const r=e[0].dims.length-2;if(t.dilations.length!==r)throw new Error(`dilations should be ${r}D`);if(t.strides.length!==r)throw new Error(`strides should be ${r}D`);if(t.pads.length!==2*r)throw new Error(`pads should be ${2*r}D`);if(t.outputPadding.length!==r)throw new Error(`output_padding should be ${r}D`);if(0!==t.kernelShape.length&&t.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape");if(0!==t.outputShape.length&&t.outputShape.length!==e[0].dims.length-2)throw new Error("invalid output shape");if("float32"!==e[0].type||"float32"!==e[1].type)throw new Error("ConvTranspose input(X,W) should be float tensor");if(3===e.length&&"float32"!==e[2].type)throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseConvAttributes=t.conv=t.calculateOutputShape=void 0;const r=n(246),o=n(2517),i=n(4770),s=n(1386),a=n(9828),l=n(2823),c=n(3248),u=n(5623);t.calculateOutputShape=(e,t,n,r,o)=>{const i=e[0],s=e.slice(2),a=s.length,l=t[0],c=t.slice(2).map(((e,t)=>e+(e-1)*(n[t]-1))),u=s.map(((e,t)=>e+r[t]+r[t+a])).map(((e,t)=>Math.floor((e-c[t]+o[t])/o[t])));return[i,l].concat(...u)},t.conv=(e,t,n)=>(f(t,n),p(e,t,n));const p=(e,t,n)=>{const r=h(n,t),o=e.session.pack,a=1===r.kernelShape[0]&&1===r.kernelShape[1];return r.group>1?[e.run((0,i.createUnpackedGroupedConvProgramInfoLoader)(e,t,r),t)]:a&&o?[d(e,t,r)]:o&&4===t[0].dims.length&&1===t[0].dims[0]&&!a?[(0,s.conv2DPacked)(e,t,r)]:[_(e,t,r)]},d=(e,n,r)=>{const o=n[0].dims,i=n[1].dims,s=(0,t.calculateOutputShape)(o,i,r.dilations,r.pads,r.strides),a=e.reshapeUnpacked(n[0],[o[1],o[2]*o[3]]),l=e.reshapeUnpacked(n[1],[i[0],i[1]]),c=n.length>2?[l,a,n[2]]:[l,a],p=e.run((0,u.createMatmulProgramInfoLoader)(c,r),c);return e.reshapeUnpacked(p,s)},_=(e,n,r)=>{const o=n[0].dims,i=n[1].dims,s=(0,t.calculateOutputShape)(o,i,r.dilations,r.pads,r.strides),l=e.run((0,c.createIm2ColProgramInfoLoader)(e,n[0],n[1],s,r),[n[0]]),u=3===n.length?[l,n[1],n[2]]:[l,n[1]];return e.run((0,a.createDotProductProgramInfoLoader)(e,n,s,r),u)},h=(e,t)=>{const n=e.kernelShape.slice();if(0===e.kernelShape.length)for(let e=2;e<t[1].dims.length;++e)n.push(t[1].dims[e]);const r=e.pads.slice();o.PoolConvUtil.adjustPadsBasedOnAutoPad(t[0].dims,e.strides,e.dilations,n,r,e.autoPad);const i=Object.assign({},e);return Object.assign(i,{kernelShape:n,pads:r,cacheKey:e.cacheKey}),i};t.parseConvAttributes=e=>{const t=e.attributes,n=(0,l.parseInternalActivationAttributes)(t),o=t.getString("auto_pad","NOTSET"),i=t.getInts("dilations",[1,1]),s=t.getInt("group",1),a=t.getInts("kernel_shape",[]),c=t.getInts("pads",[0,0,0,0]),u=t.getInts("strides",[1,1]);return(0,r.createAttributeWithCacheKey)(Object.assign({autoPad:o,dilations:i,group:s,kernelShape:a,pads:c,strides:u},n))};const f=(e,t)=>{if(!e||2!==e.length&&3!==e.length)throw new Error("Conv requires 2 or 3 inputs");if(4!==e[0].dims.length||4!==e[1].dims.length)throw new Error("currently only support 2-dimensional conv");if(e[0].dims[1]!==e[1].dims[1]*t.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(3===e.length&&(1!==e[2].dims.length||e[1].dims[0]!==e[2].dims[0]))throw new Error("invalid bias");const n=e[0].dims.length-2;if(t.dilations.length!==n)throw new Error(`dilations should be ${n}D`);if(t.strides.length!==n)throw new Error(`strides should be ${n}D`);if(t.pads.length!==2*n)throw new Error(`pads should be ${2*n}D`);if(0!==t.kernelShape.length&&t.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape");if("float32"!==e[0].type||"float32"!==e[1].type)throw new Error("Conv input(X,W) should be float tensor");if(3===e.length&&"float32"!==e[2].type)throw new Error("Conv input(bias) should be float tensor")}},5193:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseDepthToSpaceAttributes=t.depthToSpace=void 0;const r=n(3738);t.depthToSpace=(e,t,n)=>{o(t);const i=n.blocksize,s=i*i,a="DCR"===n.mode?[0,3,4,1,5,2]:[0,1,4,2,5,3],l="DCR"===n.mode?[t[0].dims[0],i,i,t[0].dims[1]/s,t[0].dims[2],t[0].dims[3]]:[t[0].dims[0],t[0].dims[1]/s,i,i,t[0].dims[2],t[0].dims[3]],c=e.reshapeUnpacked(t[0],l),u={perm:a,cacheKey:`${a}`},[p]=(0,r.transpose)(e,[c],u),d=[t[0].dims[0],t[0].dims[1]/s,t[0].dims[2]*i,t[0].dims[3]*i];return[e.reshapeUnpacked(p,d)]},t.parseDepthToSpaceAttributes=e=>{const t=e.attributes.getInt("blocksize");if(t<1)throw new Error(`blocksize must be >= 1, but got : ${t} for DepthToSpace`);const n=e.attributes.getString("mode","DCR");if("DCR"!==n&&"CRD"!==n)throw new Error(`unrecognized mode: ${n} for DepthToSpace`);return{mode:n,blocksize:t}};const o=e=>{if(1!==e.length)throw new Error(`DepthToSpace expect 1 inputs, but got ${e.length}`);if("string"===e[0].type||4!==e[0].dims.length)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDotProductProgramInfoLoader=void 0;const r=n(2517),o=n(5060),i=n(2039),s=n(2823),a=n(3248);t.createDotProductProgramInfoLoader=(e,t,n,l)=>{const c=((e,t)=>({name:"ConvDotProduct",inputNames:e?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:e?[i.TextureType.unpacked,i.TextureType.packedLastDimension,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.packedLastDimension],cacheKey:t.activationCacheKey}))(t.length>2,l);return Object.assign(Object.assign({},c),{get:()=>((e,t,n,l,c)=>{const u=n[0].dims,p=n[1].dims,d=[p[0],Math.ceil(u[1]*p[2]*p[3]/4)],_=(0,a.calculateIm2ColDims)(u,p,l),[h,f]=e.calculateTextureWidthAndHeight(d,i.TextureType.packedLastDimension),m=r.ShapeUtil.computeStrides(_),[g,b]=e.calculateTextureWidthAndHeight(_,i.TextureType.packedLastDimension),w=l.length,x=n.length<3?"0.0":"_B(b)",y=Math.ceil(u[1]*p[2]*p[3]/4),{activationFunction:T,applyActivation:v}=(0,s.getActivationSnippet)(c),k=(0,o.getGlsl)(e.session.backend.glContext.version),M=`\n${T}\nfloat process(int indices[${w}]) {\n  int b[1];\n  b[0] = indices[1];\n  int im2col[4];\n  im2col[0] = indices[0];\n  im2col[1] = indices[2];\n  im2col[2] = indices[3];\n  int im2colOffset = im2col[0] * ${m[0]} + im2col[1] * ${m[1]} + im2col[2] * ${m[2]};\n  int kernelOffset = indices[1] * ${d[1]};\n  float value = ${x};\n  for (int i = 0; i < ${y}; ++i) {\n    vec2 im2colCoords = offsetToCoords(im2colOffset, ${g}, ${b});\n    vec2 kernelCoords = offsetToCoords(kernelOffset, ${h}, ${f});\n    value += dot(${k.texture2D}(Im2Col, im2colCoords), ${k.texture2D}(K, kernelCoords));\n    ++im2colOffset;\n    ++kernelOffset;\n  }\n  ${v}\n  return value;\n}`;return Object.assign(Object.assign({},t),{output:{dims:l,type:n[0].type,textureType:i.TextureType.unpacked},shaderSource:M})})(e,c,t,n,l)})}},7992:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseFlattenAttributes=t.flatten=void 0;const r=n(2517);t.flatten=(e,t,n)=>{o(t,n);const i=r.ShapeUtil.flattenShape(t[0].dims,n);return[e.reshapeUnpacked(t[0],i)]},t.parseFlattenAttributes=e=>e.attributes.getInt("axis",1);const o=(e,t)=>{if(!e||1!==e.length)throw new Error("Flatten requires 1 input.");const n=e[0].dims.length;if(0===n)throw new Error("scalar tensor is not supported.");if(t<-n||t>n)throw new Error("Invalid axis");if("string"===e[0].type)throw new Error("string tensor is not supported.")}},2823:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseInternalActivationAttributes=t.getActivationSnippet=void 0;const r=n(2517),o=n(4909);t.getActivationSnippet=function(e){let t;switch(e.activation){case"Relu":t=(0,o.glslRelu)();break;case"Sigmoid":t=(0,o.glslSigmoid)();break;case"Clip":t=(0,o.glslClip)(e.clipMin,e.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const n=t.name;return{activationFunction:t.body,applyActivation:`value = ${n}_(value);`}},t.parseInternalActivationAttributes=e=>{const t=e.getString("activation","");if("Clip"===t){const[n,o]=e.getFloats("activation_params",[r.MIN_CLIP,r.MAX_CLIP]);return{activation:t,clipMax:o,clipMin:n,activationCacheKey:`${t}:${n},${o}`}}return{activation:t,activationCacheKey:t}}},1253:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseGatherAttributes=t.gather=void 0;const r=n(246),o=n(782),i=n(2517),s=n(2039);t.gather=(e,t,n)=>(c(t,n.axis),[e.run(l(e,t,n),t)]),t.parseGatherAttributes=e=>(0,r.createAttributeWithCacheKey)({axis:e.attributes.getInt("axis",0)});const a={name:"Gather",inputNames:["A","B"],inputTypes:[s.TextureType.unpacked,s.TextureType.unpacked]},l=(e,t,n)=>{const r=Object.assign(Object.assign({},a),{cacheHint:n.cacheKey});return Object.assign(Object.assign({},r),{get:()=>((e,t,n,r)=>{const o=n[0].dims.slice(),a=n[1].dims.slice(),l=new Array(o.length+a.length-1);r=i.ShapeUtil.normalizeAxis(r,o.length);const c=[];for(let e=0;e<l.length;e++)e<r?(l[e]=o[e],c.push(`inputIdx[${e}] = outputIdx[${e}];`)):e<r+a.length?(l[e]=a[e-r],c.push(`indexDataIdx[${e-r}] = outputIdx[${e}];`)):(l[e]=o[e-a.length+1],c.push(`inputIdx[${e-a.length+1}] = outputIdx[${e}];`));const u=`\n      float process(int outputIdx[${l.length||1}]) {\n        int inputIdx[${o.length}];\n        int indexDataIdx[${a.length||1}];\n        indexDataIdx[0] = 0;\n        ${c.join("\n        ")}\n        int idx = int(_B(indexDataIdx));\n        inputIdx[${r}] = idx < 0 ? idx + ${o[r]} : idx;\n        return _A(inputIdx);\n      }`;return Object.assign(Object.assign({},t),{output:{dims:l,type:n[0].type,textureType:s.TextureType.unpacked},shaderSource:u})})(0,r,t,n.axis)})},c=(e,t)=>{if(!e||2!==e.length)throw new Error("Gather requires 2 inputs.");const n=e[0].dims.length;if(n<1)throw new Error("Invalid input shape.");if(t<-n||t>n-1)throw new Error("Invalid axis.");if(-1===o.NUMBER_TYPES.indexOf(e[0].type))throw new Error("Invaid input type.");if("int32"!==e[1].type&&"int16"!==e[1].type)throw new Error("Invaid input type.")}},4776:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseGemmAttributesV11=t.parseGemmAttributesV7=t.gemm=void 0;const r=n(246),o=n(2517),i=n(2039);t.gemm=(e,t,n)=>(c(t,n),[e.run(a(t,n),t)]);const s=(e,t)=>{const n=0!==e.attributes.getInt("transA",0),o=0!==e.attributes.getInt("transB",0),i=e.attributes.getFloat("alpha",1),s=e.attributes.getFloat("beta",1);return(0,r.createAttributeWithCacheKey)({transA:n,transB:o,alpha:i,beta:s,isOptionalC:t})};t.parseGemmAttributesV7=e=>s(e,!1),t.parseGemmAttributesV11=e=>s(e,!0);const a=(e,t)=>{const n={name:"Gemm",inputNames:3===e.length?["A","B","C"]:["A","B"],inputTypes:3===e.length?[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.unpacked],key:t.cacheKey};return Object.assign(Object.assign({},n),{get:()=>l(n,e,t)})},l=(e,t,n)=>{const r=t[0].dims.slice(),s=t[1].dims.slice(),[a,l]=o.GemmUtil.getShapeOfGemmResult(r,n.transA,s,n.transB,3===t.length?t[2].dims:void 0),c=[a,l];if(!c)throw new Error("Can't use gemm on the given tensors");let u=r[r.length-1],p="";n.transA&&(u=r[0]),n.transA&&n.transB?p="value += _A_T(a) * _B_T(b);":n.transA&&!n.transB?p="value += _A_T(a) * _B(b);":!n.transA&&n.transB?p="value += _A(a) * _B_T(b);":n.transA||n.transB||(p="value += _A(a) * _B(b);");const d=c.length,_=`\n      float process(int indices[${d}]) {\n          int a[${d}];\n          int b[${d}];\n          ${3===t.length?`int c[${t[2].dims.length}];`:""}\n\n          copyVec(indices, a);\n          copyVec(indices, b);\n          ${3===t.length?"bcastIndices_C(indices, c);":""}\n\n          float value = 0.0;\n          for (int k=0; k<${u}; ++k) {\n              a[${d-1}] = k;\n              b[${d-2}] = k;\n              ${p}\n          }\n\n          value = value * alpha;\n          ${3===t.length?"value += beta * _C(c);":""}\n          return value;\n      }`;return Object.assign(Object.assign({},e),{output:{dims:c,type:t[0].type,textureType:i.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:n.alpha},{name:"beta",type:"float",data:n.beta}],shaderSource:_})},c=(e,t)=>{if(!e)throw new Error("Input is missing");if(t.isOptionalC&&(e.length<2||e.length>3))throw new Error("Invaid input shape.");if(!t.isOptionalC&&3!==e.length)throw new Error("Gemm requires 3 inputs");if(3===e.length&&1!==e[2].dims.length&&2!==e[2].dims.length)throw new Error("Invalid input shape of C");if("float32"!==e[0].type&&"float64"!==e[0].type||"float32"!==e[1].type&&"float64"!==e[1].type||3===e.length&&"float32"!==e[2].type&&"float64"!==e[2].type)throw new Error("Invalid input type.");if(e[0].type!==e[1].type||3===e.length&&e[0].type!==e[2].type)throw new Error("Input types are mismatched")}},8555:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createPackedIm2ColProgramInfoLoader=void 0;const r=n(5060),o=n(2039),i=n(2827);t.createPackedIm2ColProgramInfoLoader=(e,t,n,s,a)=>{const l=(c=a.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[o.TextureType.packed],cacheHint:c});var c;return Object.assign(Object.assign({},l),{get:()=>((e,t,n,s,a,l)=>{const c=n.dims,u=s.dims,p=a.length,d=[u[1]*u[2]*u[3],a[2]*a[3]],_=u[2]*u[3],h=(0,i.unpackFromChannel)(),f=(0,r.getGlsl)(e.session.backend.glContext.version);let m="";for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)m+=`\n            blockIndex = rc.x + ${t};\n            pos = rc.y + ${e};\n\n            if(blockIndex < ${d[1]} && pos < ${d[0]}) {\n              offsetY = int(blockIndex / (${a[p-1]})) * ${l.strides[0]} -\n                ${l.pads[0]};\n              d0 = offsetY + ${l.dilations[0]} * (imod(pos, ${_}) / ${u[2]});\n\n              if(d0 < ${c[2]} && d0 >= 0) {\n                offsetX = imod(blockIndex, ${a[p-1]}) * ${l.strides[1]} -\n                  ${l.pads[1]};\n                d1 = offsetX + ${l.dilations[1]} * imod(imod(pos, ${_}), ${u[2]});\n\n                if(d1 < ${c[3]} && d1 >= 0) {\n\n                  ch = int(float(pos)/ ${_}.);\n                    innerDims = vec2(d0, d1);\n                    result[${2*e+t}] = getChannel(\n                      getA(0, ch, int(innerDims.x),\n                      int(innerDims.y)), innerDims);\n                }\n              }\n            }\n\n          `;const g=`\n      ${h}\n\n      void main() {\n        ivec2 rc = getOutputCoords();\n          vec4 result = vec4(0.0);\n          int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n          vec2 innerDims;\n          ${m}\n          ${f.output} = result;\n      }\n            `;return Object.assign(Object.assign({},t),{output:{dims:d,type:n.type,textureType:o.TextureType.packed},shaderSource:g,hasMain:!0})})(e,l,t,n,s,a)})}},3248:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculateIm2ColDims=t.createIm2ColProgramInfoLoader=void 0;const r=n(2039);t.createIm2ColProgramInfoLoader=(e,n,o,i,s)=>{const a=(l=s.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[r.TextureType.unpacked],cacheHint:l});var l;return Object.assign(Object.assign({},a),{get:()=>((e,n,o,i,s,a)=>{const l=o.dims,c=i.dims,u=s.length,p=(0,t.calculateIm2ColDims)(l,c,s,4),d=`\n        const int XC = ${l[1]};\n        const int XH = ${l[2]};\n        const int XW = ${l[3]};\n        const int KH = ${a.kernelShape[0]};\n        const int KW = ${a.kernelShape[1]};\n        const int dilationH = ${a.dilations[0]};\n        const int dilationW = ${a.dilations[1]};\n        const int strideH = ${a.strides[0]};\n        const int strideW = ${a.strides[1]};\n        const int padH = ${a.pads[0]};\n        const int padW = ${a.pads[1]};\n        const int KHKW = KH*KW;\n        const int XCKHKW = XC * KHKW;\n        const int outputChannels = 4;\n        vec4 process(int indices[${u}]) {\n          int b  = indices[0]; // batch size\n          int oh = indices[1] * strideH - padH; //output height\n          int ow = indices[2] * strideW - padW; //output width\n          int p = indices[3] * outputChannels; //patch\n          vec4 value = vec4(0.0);\n          for(int i=0; i < outputChannels; ++i) {\n            if(p < XCKHKW) {\n              int patchC = p / KHKW;\n              int patchH = (p - patchC*KHKW) / KW;\n              int patchW = (p - patchC*KHKW) - patchH * KW;\n              int xh2 = oh + patchH * dilationH;\n              int xw2 = ow + patchW * dilationW;\n              int x[${l.length}];\n              x[0] = b;\n              x[1] = patchC;\n              x[2] = xh2;\n              x[3] = xw2;\n              if(xh2 >= 0 &&\n                  xh2 < XH &&\n                  xw2 >= 0 &&\n                  xw2 < XW) {\n                value[i] = _X(x);\n              }\n            }\n            ++p;\n          }\n          return value;\n        }\n        `;return Object.assign(Object.assign({},n),{output:{dims:p,type:o.type,textureType:r.TextureType.packedLastDimension},shaderSource:d})})(0,a,n,o,i,s)})},t.calculateIm2ColDims=(e,t,n,r=4)=>[n[0],n[2],n[3],Math.ceil(e[1]*t[2]*t[3]/r)]},6572:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseImageScalerAttributes=t.imageScaler=void 0;const r=n(246),o=n(2039);t.imageScaler=(e,t,n)=>(l(t),[e.run(s(e,t,n),t)]),t.parseImageScalerAttributes=e=>{const t=e.attributes.getFloat("scale"),n=e.attributes.getFloats("bias");return(0,r.createAttributeWithCacheKey)({scale:t,bias:n})};const i={name:"ImageScaler",inputNames:["X"],inputTypes:[o.TextureType.unpacked]},s=(e,t,n)=>{const r=Object.assign(Object.assign({},i),{cacheHint:n.cacheKey});return Object.assign(Object.assign({},r),{get:()=>((e,t,n,r)=>{const i=n[0].dims.slice(),s=i.length,l=`\n      ${a(r.bias.length)}\n      float process(int indices[${s}]) {\n        return _X(indices) * scale + getBias(bias, indices[1]);\n      }`;return Object.assign(Object.assign({},t),{output:{dims:i,type:n[0].type,textureType:o.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:r.bias.length,data:r.bias},{name:"scale",type:"float",data:r.scale}],shaderSource:l})})(0,r,t,n)})},a=e=>{const t=[`float getBias(float bias[${e}], int channel) {`];for(let n=0;n<e;++n)0===n?t.push(`\tif (channel == ${n}) { return bias[${n}]; }`):n===e-1?t.push(`\telse { return bias[${n}]; }`):t.push(`\telse if (channel == ${n}) { return bias[${n}]; }`);return t.push("\t}"),t.join("\n")},l=e=>{if(!e||1!==e.length)throw new Error("ImageScaler requires 1 input.");if(4!==e[0].dims.length)throw new Error("Invalid input shape.");if("float32"!==e[0].type&&"float64"!==e[0].type)throw new Error("Invalid input type.")}},3346:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseInstanceNormalizationAttributes=t.instanceNormalization=void 0;const r=n(5060),o=n(2039);t.instanceNormalization=(e,t,n)=>{c(t);const r=e.run(s(t[0]),t);return[e.run(l(e,t[0],n,r.dims),[t[0],r,t[1],t[2]])]},t.parseInstanceNormalizationAttributes=e=>e.attributes.getFloat("epsilon",1e-5);const i={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[o.TextureType.unpacked]},s=e=>Object.assign(Object.assign({},i),{get:()=>((e,t)=>{const n=t.dims.slice(),r=n[1],i=n[2]*n[3],s=[n[0],r],a=`\n      vec4 process(int[2] indices) {\n        vec4 v = vec4(0.0);\n        int a[4];\n        a[0] = indices[0];\n        a[1] = indices[1];\n        float temp = 0.0;\n        for(int a2=0; a2<${n[2]}; a2++) {\n          a[2] = a2;\n          for(int a3=0; a3<${n[3]}; a3++) {\n            a[3] = a3;\n            float x = _X(a);\n            temp += x;\n          }\n        }\n        float mean = temp / float(${i});\n        temp = 0.0;\n        for(int a2=0; a2<${n[2]}; a2++) {\n          a[2] = a2;\n          for(int a3=0; a3<${n[3]}; a3++) {\n            a[3] = a3;\n            float x = _X(a);\n            temp += (x - mean) * (x - mean);\n          }\n        }\n        v.r = mean;\n        v.g = temp / float(${i});\n\n        return v;\n      }`;return Object.assign(Object.assign({},e),{output:{dims:s,type:t.type,textureType:o.TextureType.packedLastDimension},shaderSource:a})})(i,e)}),a={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[o.TextureType.unpacked,o.TextureType.packedLastDimension,o.TextureType.unpacked,o.TextureType.unpacked]},l=(e,t,n,i)=>{const s=Object.assign(Object.assign({},a),{cacheHint:`${n}`});return Object.assign(Object.assign({},s),{get:()=>((e,t,n,i,s)=>{const a=(0,r.getGlsl)(e.session.backend.glContext.version),[l,c]=e.calculateTextureWidthAndHeight(s,o.TextureType.packedLastDimension),[u,p]=[l/4,c],d=`\n      vec4 get_MeanAndVariance(int[2] mv) {\n        int offset = indicesToOffset_MeanAndVariance(mv);\n        vec2 coords = offsetToCoords(offset, ${u}, ${p});\n        return ${a.texture2D}(MeanAndVariance, coords);\n      }\n\n      float process(int[4] indices) {\n        int mv[2];\n        mv[0] = indices[0];\n        mv[1] = indices[1];\n        vec4 mean_and_variance = get_MeanAndVariance(mv);\n        float mean = mean_and_variance.r;\n        float variance = mean_and_variance.g;\n\n        int sb[1];\n        sb[0] = indices[1];\n        float scale = _Scale(sb);\n        float b = _B(sb);\n\n        return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b;\n      }`;return Object.assign(Object.assign({},t),{output:{dims:n.dims,type:n.type,textureType:o.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:i}],shaderSource:d})})(e,s,t,n,i)})},c=e=>{if(!e||3!==e.length)throw new Error("InstanceNormalization requires 3 inputs.");const t=e[0],n=e[1],r=e[2];if(t.dims.length<3||1!==n.dims.length||1!==r.dims.length)throw new Error("Invalid input shape.");if(n.dims[0]!==t.dims[1]||r.dims[0]!==t.dims[1])throw new Error("Input shapes are mismatched.");if("float32"!==t.type&&"float64"!==t.type||"float32"!==n.type&&"float64"!==n.type||"float32"!==r.type&&"float64"!==r.type)throw new Error("Invalid input type.");if(4!==e[0].dims.length)throw new Error("Only support 4-D input shape.")}},708:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createPackedMatmulProgramInfoLoader=void 0;const r=n(2517),o=n(5060),i=n(2039),s=n(9390),a=n(2823),l=n(5623);t.createPackedMatmulProgramInfoLoader=(e,t,n)=>{const c=(u=t.length>2,p=n.activationCacheKey,{name:"MatMul (packed)",inputNames:u?["A","B","Bias"]:["A","B"],inputTypes:u?[i.TextureType.packed,i.TextureType.packed,i.TextureType.packed]:[i.TextureType.packed,i.TextureType.packed],cacheHint:p});var u,p;return Object.assign(Object.assign({},c),{get:()=>((e,t,n,c)=>{const u=n.length>2,p=u?"value += getBiasForMatmul();":"",d=n[0].dims,_=n[1].dims,h=r.BroadcastUtil.calcShape(d,_,!0),f=!r.ShapeUtil.areEqual(n[0].dims,n[1].dims);if(!h)throw new Error("Can't use matmul on the given tensors");const m=d[d.length-1],g=Math.ceil(m/2),b=d.length,w=_.length,x=(0,o.getGlsl)(e.session.backend.glContext.version),y=(0,s.getCoordsDataType)(h.length),T=h.length,v=(0,s.getGlChannels)(),{activationFunction:k,applyActivation:M}=(0,a.getActivationSnippet)(c),S=u?`${(0,l.getBiasForMatmul)(y,v,n[2].dims,h,!0)}`:"",P=f?`${function(e,t,n,o){let i=[],s=[];const a=n[0].dims,l=n[1].dims,c=a.length,u=l.length,p=o.length,d=p-c,_=p-u;i=a.map(((e,n)=>`coords.${t[n+d]}`)),i[c-1]="i*2",i.join(", "),s=l.map(((e,n)=>`coords.${t[n+_]}`)),s[u-2]="i*2",s.join(", ");const h=r.BroadcastUtil.getBroadcastDims(a,o),f=r.BroadcastUtil.getBroadcastDims(l,o),m=h.map((e=>`coords.${t[e+d]} = 0;`)).join("\n"),g=f.map((e=>`coords.${t[e+_]} = 0;`)).join("\n"),b=`int lastDim = coords.${t[p-1]};\n  coords.${t[p-1]} = coords.${t[p-2]};\n  coords.${t[p-2]} = lastDim;`;return`\nvec4 getAAtOutCoordsMatmul(int i) {\n  ${e} coords = getOutputCoords();\n  ${b}\n  ${m}\n  vec4 outputValue = getA(${i});\n  return outputValue;\n}\n\nvec4 getBAtOutCoordsMatmul(int i) {\n  ${e} coords = getOutputCoords();\n  ${b}\n  ${g}\n  vec4 outputValue = getB(${s});\n  return outputValue;\n}`}(y,v,n,h)}`:"",A=f?"getAAtOutCoordsMatmul(i)":`getA(${function(e,t){let n="";for(let r=0;r<t-2;r++)n+=`rc.${e[r]}, `;return n+=`rc.${e[t-2]}, i*2`,n}(v,b)})`,F=f?"getBAtOutCoordsMatmul(i)":`getB(${function(e,t){let n="";for(let r=0;r<t-2;r++)n+=`rc.${e[r]}, `;return n+=`i*2, rc.${e[t-1]}`,n}(v,w)})`,C=`\n            ${P}\n            ${S}\n            ${k}\n            void main() {\n              ${f?"":`${y} rc =\n          getOutputCoords(); int lastDim = rc.${v[T-1]}; rc.${v[T-1]} =\n          rc.${v[T-2]}; rc.${v[T-2]} = lastDim;\n      `}\n\n              vec4 value = vec4(0);\n              for (int i = 0; i < ${g}; i++) {\n                vec4 a = ${A};\n                vec4 b = ${F};\n\n                value += (a.rrbb * b.rgrg);\n                value += (a.ggaa * b.baba);\n              }\n              ${p}\n              ${M}\n              ${x.output} = value;\n            }`;return Object.assign(Object.assign({},t),{output:{dims:h,type:n[0].type,textureType:i.TextureType.packed},shaderSource:C,hasMain:!0})})(e,c,t,n)})}},5623:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getBiasForMatmul=t.createMatmulProgramInfoLoader=t.parseMatMulAttributes=t.matMul=void 0;const r=n(2517),o=n(2039),i=n(9390),s=n(2823),a=n(708);function l(e,t){const n=(a=e.length>2,l=t.activationCacheKey,{name:"MatMul",inputNames:a?["A","B","Bias"]:["A","B"],inputTypes:a?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],cacheHint:l});var a,l;return Object.assign(Object.assign({},n),{get:()=>function(e,t,n){const a=t[0].dims,l=t[1].dims,c=r.BroadcastUtil.calcShape(a,l,!0);if(!c)throw new Error("Can't use matmul on the given tensors");const p=(0,i.getCoordsDataType)(c.length),d=(0,i.getGlChannels)(),{activationFunction:_,applyActivation:h}=(0,s.getActivationSnippet)(n),f=t.length>2,m=f?"value += getBiasForMatmul();":"",g=f?`${u(p,d,t[2].dims,c,!1)}`:"",b=c.length,w=a.length,x=l.length,y=`\n    ${_}\n    ${g}\n    float process(int indices[${b}]) {\n        int a[${w}];\n        int b[${x}];\n        bcastMatmulIndices_A(indices, a);\n        bcastMatmulIndices_B(indices, b);\n\n        float value;\n        for (int k=0; k<${a[a.length-1]}; ++k) {\n            a[${w-1}] = k;\n            b[${x-2}] = k;\n            value += _A(a) * _B(b);\n        }\n        ${m}\n        ${h}\n        return value;\n    }`;return Object.assign(Object.assign({},e),{output:{dims:c,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:y})}(n,e,t)})}t.matMul=(e,t,n)=>(c(t),e.session.pack?[e.run((0,a.createPackedMatmulProgramInfoLoader)(e,t,n),t)]:[e.run(l(t,n),t)]),t.parseMatMulAttributes=e=>(0,s.parseInternalActivationAttributes)(e.attributes),t.createMatmulProgramInfoLoader=l;const c=e=>{if(!e||2!==e.length)throw new Error("MatMul requires 2 inputs.");if(e[0].dims[e[0].dims.length-1]!==e[1].dims[e[1].dims.length-2])throw new Error("shared dimension does not match.");if("float32"!==e[0].type&&"float64"!==e[0].type||"float32"!==e[1].type&&"float64"!==e[1].type)throw new Error("inputs should be float type");if(e[0].type!==e[1].type)throw new Error("inputs types should match")};function u(e,t,n,o,i){let s="";const a=n.length,l=o.length,c=l-a;s=l<2&&a>0?"coords":n.map(((e,n)=>`coords.${t[n+c]}`)).join(", ");const u=r.BroadcastUtil.getBroadcastDims(n,o).map((e=>`coords.${t[e+c]} = 0;`)).join("\n");let p="vec4(outputValue.xx, outputValue.yy)";return 1===r.ShapeUtil.size(n)&&(p="vec4(outputValue.x)"),i?`\nvec4 getBiasForMatmul() {\n  ${e} coords = getOutputCoords();\n  ${u}\n  vec4 outputValue = getBias(${s});\n  return ${p};\n}`:`\nfloat getBiasForMatmul() {\n  ${e} coords = getOutputCoords();\n  ${u}\n  return getBias(coords.x);\n}`}t.getBiasForMatmul=u},2403:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createPackProgramInfoLoader=void 0;const r=n(5060),o=n(2039),i=n(9390),s=n(2827),a={name:"pack",inputNames:["A"],inputTypes:[o.TextureType.unpackedReversed]};t.createPackProgramInfoLoader=(e,t)=>Object.assign(Object.assign({},a),{get:()=>((e,t)=>{const n=(0,r.getGlsl)(e.session.backend.glContext.version),l=t.dims,c=l.length,u=t.dims.length,p=(0,i.getCoordsDataType)(u),d=(0,s.getChannels)("rc",u),_=(h=u,f=d,m=l[l.length-2],g=l[l.length-1],0===h||1===h?"":`\n    int r = ${f[h-2]};\n    int c = ${f[h-1]};\n    int rp1 = ${f[h-2]} + 1;\n    int cp1 = ${f[h-1]} + 1;\n    bool rEdge = rp1 >= ${g};\n    bool cEdge = cp1 >= ${m};\n    `);var h,f,m,g;let b;b=0===c?[1,1]:1===c?[l[0],1]:[l[u-1],l[u-2]];const w=function(e,t,n){if(0===e)return"false";if(1===e)return`rc > ${t[0]}`;let r="";for(let o=e-2;o<e;o++)r+=`${n[o]} >= ${t[o-e+2]}`,o<e-1&&(r+="||");return r}(u,b,d),x=function(e,t){const n=e.length;if(0===n)return"getA(), 0, 0, 0";if(1===n)return`getA(rc),\n            rc + 1 >= ${e[0]} ? 0. : getA(rc + 1),\n            0, 0`;let r="";if(n>2)for(let e=0;e<n-2;++e)r+=`${t[e]},`;return`getA(${r}r, c),\n          rEdge ? 0. : getA(${r}rp1, c),\n          cEdge ? 0. : getA(${r}r, cp1),\n          rEdge || cEdge ? 0. : getA(${r}rp1, cp1)`}(l,d),y=`\n        void main() {\n          ${p} rc = getOutputCoords();\n\n          if(${w}) {\n            ${n.output} = vec4(0);\n          } else {\n            ${_}\n\n            ${n.output} = vec4(${x});\n          }\n        }\n      `;return Object.assign(Object.assign({},a),{hasMain:!0,output:{dims:t.dims,type:t.type,textureType:o.TextureType.packed},shaderSource:y})})(e,t)})},2827:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unpackFromChannel=t.getChannels=t.getVecChannels=void 0;const r=n(9390);function o(e,t){return(0,r.getGlChannels)(t).map((t=>`${e}.${t}`))}t.getVecChannels=o,t.getChannels=function(e,t){return 1===t?[e]:o(e,t)},t.unpackFromChannel=function(){return"\n    float getChannel(vec4 frag, int dim) {\n      int modCoord = imod(dim, 2);\n      return modCoord == 0 ? frag.r : frag.g;\n    }\n\n    float getChannel(vec4 frag, vec2 innerDims) {\n      vec2 modCoord = mod(innerDims, 2.);\n      return modCoord.x == 0. ?\n        (modCoord.y == 0. ? frag.r : frag.g) :\n        (modCoord.y == 0. ? frag.b : frag.a);\n    }\n  "}},2870:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parsePadAttributesV11=t.padV11=t.parsePadAttributesV2=t.padV2=void 0;const r=n(246),o=n(2517),i=n(5060),s=n(2039),a={name:"Pad",inputNames:["A"],inputTypes:[s.TextureType.unpacked]};t.padV2=(e,t,n)=>(u(t),[e.run(Object.assign(Object.assign({},a),{cacheHint:n.cacheKey,get:()=>c(e,t[0],n)}),t)]),t.parsePadAttributesV2=e=>{const t=e.attributes.getString("mode","constant"),n=e.attributes.getFloat("value",0),o=e.attributes.getInts("pads");return(0,r.createAttributeWithCacheKey)({mode:t,value:n,pads:o})},t.padV11=(e,n,r)=>{p(n);const o=l(e,n,r);return(0,t.padV2)(e,[n[0]],o)},t.parsePadAttributesV11=e=>e.attributes.getString("mode","constant");const l=(e,t,n)=>{if(!e.session.isInitializer(t[1].dataId)||t.length>=3&&!e.session.isInitializer(t[2].dataId))throw new Error("dynamic pad attributes are not allowed");const o=Array.from(t[1].integerData),i=t.length>=3?t[2].floatData[0]:0;return(0,r.createAttributeWithCacheKey)({mode:n,pads:o,value:i})},c=(e,t,n)=>{const r=o.ShapeUtil.padShape(t.dims.slice(),n.pads),i=r.length,a=`\n      ${d(e,t,n)}\n      float process(int[${i}] indices) {\n          return padA(indices);\n      }`;return{name:"Pad",inputNames:["A"],inputTypes:[s.TextureType.unpacked],output:{dims:r,type:t.type,textureType:s.TextureType.unpacked},shaderSource:a}},u=e=>{if(!e||1!==e.length)throw new Error("Pad requires 1 input");if("float32"!==e[0].type&&"float64"!==e[0].type)throw new Error("Invalid input type.")},p=e=>{if(!e||2!==e.length&&3!==e.length)throw new Error("Pad requires 2 or 3 inputs");if("int32"!==e[1].type)throw new Error("Invalid input type.");if(e.length>=3&&"string"===e[2].type)throw new Error("Invalid input type.")},d=(e,t,n)=>{const r=(0,i.getGlsl)(e.session.backend.glContext.version),[a,l]=e.calculateTextureWidthAndHeight(t.dims,s.TextureType.unpacked),c=o.ShapeUtil.computeStrides(t.dims);switch(n.mode){case"constant":return _(r,t.dims,c,a,l,n.pads,n.value);case"reflect":return h(r,t.dims,c,a,l,n.pads);case"edge":return f(r,t.dims,c,a,l,n.pads);default:throw new Error("Invalid mode")}},_=(e,t,n,r,o,i,s)=>{const a=t.length;let l="";for(let e=a-1;e>=0;--e)l+=`\n        k = m[${e}] - ${i[e]};\n        if (k < 0)  return constant;\n        if (k >= ${t[e]}) return constant;\n        offset += k * ${n[e]};\n        `;return`\n      float padA(int m[${a}]) {\n        const float constant = float(${s});\n        int offset = 0;\n        int k = 0;\n        ${l}\n        vec2 coords = offsetToCoords(offset, ${r}, ${o});\n        float value = getColorAsFloat(${e.texture2D}(A, coords));\n        return value;\n      }\n      `},h=(e,t,n,r,o,i)=>{const s=t.length;let a="";for(let e=s-1;e>=0;--e)a+=`\n        k = m[${e}] - ${i[e]};\n        if (k < 0) { k = -k; }\n        {\n          const int _2n_1 = ${2*(t[e]-1)};\n          k = int( mod( float(k), float(_2n_1) ) ) ;\n          if(k >= ${t[e]}) { k = _2n_1 - k; }\n        }\n        offset += k * ${n[e]};\n        `;return`\n      float padA(int m[${s}]) {\n        int offset = 0;\n        int k = 0;\n        ${a}\n        vec2 coords = offsetToCoords(offset, ${r}, ${o});\n        float value = getColorAsFloat(${e.texture2D}(A, coords));\n        return value;\n      }\n      `},f=(e,t,n,r,o,i)=>{const s=t.length;let a="";for(let e=s-1;e>=0;--e)a+=`\n        k = m[${e}] - ${i[e]};\n        if (k < 0)  k = 0;\n        if (k >= ${t[e]}) k = ${t[e]-1};\n        offset += k * ${n[e]};\n      `;return`\n      float padA(int m[${s}]) {\n        int offset = 0;\n        int k = 0;\n        ${a}\n        vec2 coords = offsetToCoords(offset, ${r}, ${o});\n        float value = getColorAsFloat(${e.texture2D}(A, coords));\n        return value;\n      }\n      `}},2143:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.globalMaxPool=t.parseMaxPoolAttributes=t.maxPool=t.parseGlobalAveragePoolAttributes=t.globalAveragePool=t.parseAveragePoolAttributes=t.averagePool=void 0;const r=n(246),o=n(2517),i=n(2039);t.averagePool=(e,t,n)=>{p(t);const r={name:"AveragePool",inputNames:["X"],inputTypes:[i.TextureType.unpacked],cacheHint:n.cacheKey};return[e.run(Object.assign(Object.assign({},r),{get:()=>s(t,r,!1,n)}),t)]},t.parseAveragePoolAttributes=e=>{const t=e.attributes.getString("auto_pad","NOTSET"),n=e.attributes.getInt("ceil_mode",0),o=0!==e.attributes.getInt("count_include_pad",0),i=e.attributes.getInts("kernel_shape"),s=e.attributes.getInts("strides",[]),a=e.attributes.getInts("pads",[]);if(0!==n)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,r.createAttributeWithCacheKey)({autoPad:t,ceilMode:n,countIncludePad:o,kernelShape:i,strides:s,pads:a})};const s=(e,t,n,r)=>{const[s,a]=l(e,r,n),c=o.ShapeUtil.size(s.kernelShape);let u="";s.countIncludePad?u+=`value /= float(${c});`:u+=`value /= float(${c} - pad);`;const p=`\n        ${d(e[0].dims,s,"value += _X(x);",u,"0.0")}\n      `;return Object.assign(Object.assign({},t),{output:{dims:a,type:e[0].type,textureType:i.TextureType.unpacked},shaderSource:p})};t.globalAveragePool=(e,t,n)=>{p(t);const r={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[i.TextureType.unpacked],cacheHint:`${n.countIncludePad}`};return[e.run(Object.assign(Object.assign({},r),{get:()=>s(t,r,!0,n)}),t)]},t.parseGlobalAveragePoolAttributes=e=>{const t=0!==e.attributes.getInt("count_include_pad",0);return(0,r.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:t,kernelShape:[],strides:[],pads:[]})},t.maxPool=(e,t,n)=>{p(t);const r={name:"MaxPool",inputNames:["X"],inputTypes:[i.TextureType.unpacked],cacheHint:n.cacheKey};return[e.run(Object.assign(Object.assign({},r),{get:()=>a(t,r,!1,n)}),t)]},t.parseMaxPoolAttributes=e=>{const t=e.attributes.getString("auto_pad","NOTSET"),n=e.attributes.getInt("ceil_mode",0),o=e.attributes.getInts("kernel_shape"),i=e.attributes.getInts("strides",[]),s=e.attributes.getInts("pads",[]),a=e.attributes.getInt("storage_order",0),l=e.attributes.getInts("dilations",[]);if(0!==a)throw new Error("column major storage order is not yet supported for MaxPool");if(0!==n)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,r.createAttributeWithCacheKey)({autoPad:t,ceilMode:n,countIncludePad:!1,kernelShape:o,strides:i,pads:s,storageOrder:a,dilations:l})};const a=(e,t,n,r)=>{const[o,s]=l(e,r,n),a=`\n      ${d(e[0].dims,o,"\n      value = max(_X(x), value);\n    ","","-1e5")}\n    `;return Object.assign(Object.assign({},t),{output:{dims:s,type:e[0].type,textureType:i.TextureType.unpacked},shaderSource:a})},l=(e,t,n)=>{const r=e[0].dims.slice(),i=Object.hasOwnProperty.call(t,"dilations"),s=t.kernelShape.slice(),a=t.strides.slice(),l=i?t.dilations.slice():[],c=t.pads.slice();o.PoolConvUtil.adjustPoolAttributes(n,r,s,a,l,c);const u=o.PoolConvUtil.computePoolOutputShape(n,r,a,l,s,c,t.autoPad),p=Object.assign({},t);return i?Object.assign(p,{kernelShape:s,strides:a,pads:c,dilations:l,cacheKey:t.cacheKey}):Object.assign(p,{kernelShape:s,strides:a,pads:c,cacheKey:t.cacheKey}),[p,u]},c={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},u={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[i.TextureType.unpacked]};t.globalMaxPool=(e,t)=>(p(t),[e.run(Object.assign(Object.assign({},u),{get:()=>a(t,u,!0,c)}),t)]);const p=e=>{if(!e||1!==e.length)throw new Error("Pool ops requires 1 input.");if("float32"!==e[0].type&&"float64"!==e[0].type)throw new Error("Invalid input type.")},d=(e,t,n,r,i)=>{const s=e.length;if(t.kernelShape.length<=2){const o=t.kernelShape[t.kernelShape.length-1],a=t.strides[t.strides.length-1],l=t.pads[t.pads.length/2-1],c=t.pads[t.pads.length-1],u=e[s-1];let p="",d="",_="";if(p=l+c!==0?`\n          for (int i = 0; i < ${o}; i++) {\n            x[${s} - 1] = indices[${s} - 1] * ${a} - ${l} + i;\n            if (x[${s} - 1] < 0 || x[${s} - 1] >= ${u}) {\n              pad++;\n              continue;\n            }\n            ${n}\n          }`:`\n          for (int i = 0; i < ${o}; i++) {\n            x[${s} - 1] = indices[${s} - 1] * ${a} - ${l} + i;\n            ${n}\n          }`,2===t.kernelShape.length){const n=t.kernelShape[t.kernelShape.length-2],r=t.strides[t.strides.length-2],i=t.pads[t.pads.length/2-2],a=t.pads[t.pads.length-2],l=e[s-2];d=i+a!==0?`\n            for (int j = 0; j < ${n}; j++) {\n              x[${s} - 2] = indices[${s} - 2] * ${r} - ${i} + j;\n              if (x[${s} - 2] < 0 || x[${s} - 2] >= ${l}) {\n                pad+= ${o};\n                continue;\n              }\n          `:`\n            for (int j = 0; j < ${n}; j++) {\n              x[${s} - 2] = indices[${s} - 2] * ${r} - ${i} + j;\n            `,_="\n          }\n        "}return`\n        float process(int indices[${s}]) {\n          int x[${s}];\n          copyVec(indices, x);\n\n          float value = ${i};\n          int pad = 0;\n          ${d}\n          ${p}\n          ${_}\n          ${r}\n          return value;\n        }\n      `}{const a=o.ShapeUtil.size(t.kernelShape),l=o.ShapeUtil.computeStrides(t.kernelShape),c=l.length,u=t.pads.length,p=h(c),d=_(e,"inputDims"),f=_(t.pads,"pads"),m=_(l,"kernelStrides"),g=_(t.strides,"strides");let b="";return b=t.pads.reduce(((e,t)=>e+t))?`\n            if (x[j] >= inputDims[j] || x[j] < 0) {\n              pad++;\n              isPad = true;\n              break;\n            }\n          }\n          if (!isPad) {\n            ${n}\n          }`:`\n          }\n          ${n}\n        `,`\n        ${p}\n        float process(int indices[${s}]) {\n          int x[${s}];\n          copyVec(indices, x);\n          int offset[${c}];\n          int pads[${u}];\n          int inputDims[${s}];\n          int kernelStrides[${c}];\n          int strides[${c}];\n          ${f}\n          ${d}\n          ${g}\n          ${m}\n\n          float value = ${i};\n          int pad = 0;\n          bool isPad = false;\n          for (int i = 0; i < ${a}; i++) {\n            offsetToIndices(i, kernelStrides, offset);\n            isPad = false;\n            for (int j = ${s} - ${c}; j < ${s}; j++) {\n              x[j] = indices[j] * strides[j - ${s} + ${c}]\n                + offset[j - ${s} + ${c}] - pads[j - 2];\n              ${b}\n          }\n          ${r}\n\n          return value;\n        }\n      `}},_=(e,t)=>{let n="";for(let r=0;r<e.length;r++)n+=`\n      ${t}[${r}] = ${e[r]};\n    `;return n},h=e=>`\n  void offsetToIndices(int offset, int[${e}] strides, out int[${e}] indices) {\n    if (${e} == 0) {\n      return;\n    }\n    for (int i = 0; i < ${e} - 1; ++i) {\n      indices[i] = offset / strides[i];\n      offset -= indices[i] * strides[i];\n    }\n    indices[${e} - 1] = offset;\n  }`},4939:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduceLogSumSquare=t.reduceLogSum=t.reduceProd=t.reduceMin=t.reduceMax=t.reduceMean=t.reduceSum=t.parseReduceAttributes=void 0;const r=n(246),o=n(782),i=n(2517),s=n(2039),a=(e,t,n,r,o)=>{c(t);const i={name:r,inputNames:["A"],inputTypes:[s.TextureType.unpacked]};return[e.run(Object.assign(Object.assign({},i),{cacheHint:n.cacheKey,get:()=>l(e,t,n,r,o,i)}),t)]};t.parseReduceAttributes=e=>{const t=e.attributes.getInts("axes",[]),n=1===e.attributes.getInt("keepdims",1);return(0,r.createAttributeWithCacheKey)({axes:t,keepDims:n})};const l=(e,t,n,r,o,a)=>{const l=[],c=t[0].dims.length||1,u=[],p=i.ShapeUtil.normalizeAxes(n.axes,t[0].dims.length),d=o(t,p);let _=d[1];for(let e=0;e<t[0].dims.length;e++)p.indexOf(e)>=0||0===p.length?(n.keepDims&&l.push(1),_=`\n          for(int j${e} = 0; j${e} < ${t[0].dims[e]}; j${e}++) {\n            inputIdx[${e}] = j${e};\n            ${_}\n          }`):(u.push(`inputIdx[${e}] = outputIdx[${l.length}];`),l.push(t[0].dims[e]));const h=`\n      float process(int outputIdx[${l.length||1}]) {\n        float value;                 // final result\n        int inputIdx[${c}];      // addressing input data\n        ${u.join("\n")}\n        ${d[0]}       // init ops for reduce max/min\n        ${_}\n        ${d[2]}       // final computation for reduce mean\n        return value;\n      }`;return Object.assign(Object.assign({},a),{output:{dims:l,type:t[0].type,textureType:s.TextureType.unpacked},shaderSource:h})},c=e=>{if(!e||1!==e.length)throw new Error("Reduce op requires 1 input.");if(-1===o.NUMBER_TYPES.indexOf(e[0].type))throw new Error("Invalid input type.")};t.reduceSum=(e,t,n)=>a(e,t,n,"ReduceSum",(()=>["value = 0.0;","value += _A(inputIdx);",""])),t.reduceMean=(e,t,n)=>a(e,t,n,"ReduceMean",((e,t)=>{let n=1;for(let r=0;r<e[0].dims.length;r++)(t.indexOf(r)>=0||0===t.length)&&(n*=e[0].dims[r]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${n}.;`]})),t.reduceMax=(e,t,n)=>a(e,t,n,"ReduceMax",((e,t)=>{const n=[];for(let r=0;r<e[0].dims.length;r++)(t.indexOf(r)>=0||0===t.length)&&n.push(`inputIdx[${r}] = 0;`);return[`${n.join("\n")}\nvalue = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]})),t.reduceMin=(e,t,n)=>a(e,t,n,"ReduceMin",((e,t)=>{const n=[];for(let r=0;r<e[0].dims.length;r++)(t.indexOf(r)>=0||0===t.length)&&n.push(`inputIdx[${r}] = 0;`);return[`${n.join("\n")}\nvalue = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]})),t.reduceProd=(e,t,n)=>a(e,t,n,"ReduceProd",(()=>["value = 1.0;","value *= _A(inputIdx);",""])),t.reduceLogSum=(e,t,n)=>a(e,t,n,"ReduceLogSum",(()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"])),t.reduceLogSumSquare=(e,t,n)=>a(e,t,n,"ReduceLogSumSquare",(()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""]))},7019:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isReshapeCheap=t.processDims3D=t.createPackedReshape3DProgramInfoLoader=void 0;const r=n(2517),o=n(5060),i=n(2039),s=n(2827);t.createPackedReshape3DProgramInfoLoader=(e,t,n)=>{const a=(e=>({name:"Reshape (packed)",inputTypes:[i.TextureType.packed],inputNames:["A"],cacheHint:`${e}`}))(n);return Object.assign(Object.assign({},a),{get:()=>((e,t,n,a)=>{const l=t.dims,c=a;let u="";for(let e=0;e<4;e++){let t="";switch(e){case 0:t="outputCoords = rc;";break;case 1:t="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:t="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:t="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}u+=`\n        ${t}\n        ${e>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""}\n          int flattenedIndex = getFlattenedIndex(outputCoords);\n\n          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex);\n          vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n          result[${e}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims);\n\n        ${e>0?"}":""}\n      `}const p=(0,o.getGlsl)(e.session.backend.glContext.version),d=`\n      ${function(e){const t=r.ShapeUtil.computeStrides(e),n=["b","r","c"],o="index";return`\n    ivec3 inputCoordsFromReshapedOutCoords(int index) {\n      ${t.map(((e,r)=>`int ${n[r]} = ${o} / ${e}; ${r===t.length-1?`int ${n[r+1]} = ${o} - ${n[r]} * ${e}`:`index -= ${n[r]} * ${e}`};`)).join("")}\n      return ivec3(b, r, c);\n    }\n  `}(l)}\n      ${function(e){const t=r.ShapeUtil.computeStrides(e);return`\n  int getFlattenedIndex(ivec3 coords) {\n    // reverse y, z order\n    return coords.x * ${t[0]} + coords.z * ${t[1]} + coords.y;\n  }\n`}(c)}\n      ${(0,s.unpackFromChannel)()}\n\n      void main() {\n        ivec3 rc = getOutputCoords();\n\n        vec4 result = vec4(0.0);\n\n        ivec3 outputCoords;\n        int rows = ${c[2]};\n        int cols = ${c[1]};\n\n        ${u}\n        ${p.output} = result;\n      }\n    `;return Object.assign(Object.assign({},n),{output:{dims:c,type:t.type,textureType:i.TextureType.packed},shaderSource:d,hasMain:!0})})(e,t,a,n)})},t.processDims3D=function(e){if(0===e.length)return[1,1,1];let t=1;for(let n=0;n<e.length-2;++n)t*=e[n];return[t,e.length>1?e[e.length-2]:1,e[e.length-1]]},t.isReshapeCheap=function(e,t){let n=!1;return n=0===e.length||0===t.length||(e.length<2||t.length<2?e[e.length-1]===t[t.length-1]:e[e.length-1]===t[t.length-1]&&e[e.length-2]===t[t.length-2]),n}},718:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=void 0;const r=n(2517);t.reshape=(e,t)=>{const n=r.ShapeUtil.calculateReshapedDims(t[0].dims,t[1].integerData);return e.session.pack?[e.reshapePacked(t[0],n)]:[e.reshapeUnpacked(t[0],n)]}},2268:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseResizeAttributesV11=t.parseResizeAttributesV10=t.resize=void 0;const r=n(5060),o=n(2039),i=n(9390),s=n(2827),a=n(9793),l={name:"Resize",inputNames:["A"],inputTypes:[o.TextureType.packed]};t.resize=(e,t,n)=>((0,a.validateInputs)(t,n),[e.run(Object.assign(Object.assign({},l),{cacheHint:n.cacheKey,get:()=>c(e,t,n)}),t)]),t.parseResizeAttributesV10=e=>(0,a.parseUpsampleAttributes)(e,10),t.parseResizeAttributesV11=e=>(0,a.parseUpsampleAttributes)(e,11);const c=(e,t,n)=>{const a=(0,r.getGlsl)(e.session.backend.glContext.version),[c,p]=u(t,n);if(c.every((e=>1===e))&&"tf_crop_and_resize"!==n.coordinateTransformMode)return Object.assign(Object.assign({},l),{output:{dims:p,type:t[0].type,textureType:o.TextureType.packed},hasMain:!0,shaderSource:`void main() {\n                    vec4 v = ${a.texture2D}(X, TexCoords);\n                    ${a.output} = v;\n                }`});const d=p.length;if(d<2)throw new Error(`output dimension should be at least 2, but got ${d}`);const _=p[d-2],h=p[d-1],f=t[0].dims;if(d!==f.length)throw new Error(`output dimension should match input ${f.length}, but got ${d}`);const m=f[d-2],g=f[d-1],b=c[d-2],w=c[d-1];let x="";if("linear"!==n.mode)throw new Error(`resize (packed) does not support mode: '${n.mode}'`);switch(n.coordinateTransformMode){case"asymmetric":x="\n                    vec4 getSourceFracIndex(ivec4 coords) {\n                        return vec4(coords) / scaleWHWH;\n                    }\n                ";break;case"half_pixel":x="\n                    vec4 getSourceFracIndex(ivec4 coords) {\n                        return (vec4(coords) + 0.5) / scaleWHWH - 0.5;\n                    }\n                ";break;case"pytorch_half_pixel":x=`\n                    vec4 getSourceFracIndex(ivec4 coords) {\n                        vec4 fcoords = vec4(coords);\n                        return vec4(\n                            ${h}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0,\n                            ${_}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0,\n                            ${h}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0,\n                            ${_}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0\n                          );\n                    }\n                `;break;case"align_corners":x=`\n                    vec4 getSourceFracIndex(ivec4 coords) {\n                        vec4 resized = vec4(${h}.0 - 1.0, ${_}.0 - 1.0, ${h}.0 - 1.0,\n                            ${_}.0 - 1.0);\n                        vec4 original = vec4(${g}.0 - 1.0, ${m}.0 - 1.0, ${g}.0 - 1.0,\n                            ${m}.0 - 1.0);\n                        vec4 new_scale = original / resized;\n                        return vec4(coords) * new_scale;\n                    }\n                `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode:                                 '${n.coordinateTransformMode}'`)}const y=(0,i.getCoordsDataType)(d),T=`\n            const vec2 inputWH = vec2(${m}.0, ${g}.0);\n            const vec4 scaleWHWH = vec4(float(${b}), float(${w}), float(${b}), float(${w}));\n            ${(0,s.unpackFromChannel)()}\n            ${x}\n            float getAValue(int x10, int r, int c, int d) {\n                return getChannel(getA(x10, r, c, d), vec2(c, d));\n            }\n            void main() {\n                ${y} rc = getOutputCoords();\n\n                int batch = rc[0];\n                int depth = rc[1];\n\n                // retrieve the 4 coordinates that is used in the 4 packed output values.\n                ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1);\n\n                // calculate the source index in fraction\n                vec4 sourceFrac = getSourceFracIndex(coords);\n\n                // get the lower and upper bound of the 4 values that will be packed into one texel.\n                ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy)));\n                ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw)));\n                ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy)));\n                ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw)));\n\n                bool hasNextRow = rc.w < ${_-1};\n                bool hasNextCol = rc.z < ${h-1};\n\n                // pack x00, x01, x10, x11's top-left corner into one vec4 structure\n                vec4 topLeft = vec4(\n                    getAValue(batch, depth, x00.x, x00.y),\n                    hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0,\n                    hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0,\n                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0);\n\n                // pack x00, x01, x10, x11's top-right corner into one vec4 structure\n                vec4 topRight = vec4(\n                    getAValue(batch, depth, x00.x, x00.w),\n                    hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0,\n                    hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0,\n                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0);\n\n                // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure\n                vec4 bottomLeft = vec4(\n                    getAValue(batch, depth, x00.z, x00.y),\n                    hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0,\n                    hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0,\n                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0);\n\n                // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure\n                vec4 bottomRight = vec4(\n                    getAValue(batch, depth, x00.z, x00.w),\n                    hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0,\n                    hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0,\n                    (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0);\n\n                // calculate the interpolation fraction on u and v direction\n                vec4 frac = vec4(sourceFrac) - floor(sourceFrac);\n                vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0));\n\n                vec4 top = mix(topLeft, topRight, clampFrac.ywyw);\n                vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw);\n                vec4 newValue = mix(top, bottom, clampFrac.xxzz);\n\n                ${a.output} = vec4(newValue);\n            }\n        `;return Object.assign(Object.assign({},l),{output:{dims:p,type:t[0].type,textureType:o.TextureType.packed},hasMain:!0,shaderSource:T})},u=(e,t)=>{const n=e[0].dims;let r,o=t.scales;if(0===o.length){const i=e[t.scalesInputIdx];if(i&&0!==i.size){if(e[t.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");o=p(i,t.mode,t.isResize)}else{const i=e[t.sizesInputIdx];if(!i||0===i.size)throw new Error("Either scales or sizes MUST be provided as input.");r=Array.from(i.integerData),o=d(r,n,t.mode,t.isResize)}}else if(e[t.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const i=r||n.map(((e,t)=>Math.floor(e*o[t])));return[o,i]},p=(e,t,n)=>{const r=Array.from(e.floatData);return(0,a.scalesValidation)(r,t,n),r},d=(e,t,n,r)=>{const o=t.length,i=new Array(o);for(let n=0,r=o;n<r;n++)if(0===t[n]){if(0!==e[n])throw new Error("Input dim is zero but required output dim is non-zero.");i[n]=1}else i[n]=e[n]/t[n];return(0,a.scalesValidation)(i,n,r),i}},8117:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shape=void 0;const r=n(9162);t.shape=(e,t)=>(o(t),[new r.Tensor([t[0].dims.length],"int32",void 0,void 0,new Int32Array(t[0].dims))]);const o=e=>{if(!e||1!==e.length)throw new Error("Shape requires 1 input.")}},2278:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sliceV10=t.parseSliceAttributes=t.slice=void 0;const r=n(246),o=n(782),i=n(2517),s=n(2039),a={name:"Slice",inputNames:["A"],inputTypes:[s.TextureType.unpacked]};t.slice=(e,t,n)=>(c(t),[e.run(Object.assign(Object.assign({},a),{cacheHint:n.cacheKey,get:()=>l(e,t[0],n)}),t)]),t.parseSliceAttributes=e=>{const t=e.attributes.getInts("starts"),n=e.attributes.getInts("ends"),o=e.attributes.getInts("axes",[]);return(0,r.createAttributeWithCacheKey)({starts:t,ends:n,axes:o})};const l=(e,t,n)=>{const r=0===n.axes.length?t.dims.slice(0).map(((e,t)=>t)):n.axes,o=i.ShapeUtil.normalizeAxes(r,t.dims.length),l=n.starts.map(((e,n)=>e>t.dims[o[n]]-1?t.dims[o[n]]:i.ShapeUtil.normalizeAxis(e,t.dims[o[n]]))),c=n.ends.map(((e,n)=>e>t.dims[o[n]]-1?t.dims[o[n]]:i.ShapeUtil.normalizeAxis(e,t.dims[o[n]]))),u=t.dims.slice(),p=[];for(let e=0;e<o.length;e++)u[o[e]]=c[e]-l[e],l[e]>0&&p.push(`outputIdx[${o[e]}] += ${l[e]};`);const d=`\n      float process(int outputIdx[${u.length}]) {\n        ${p.join("\n      ")}\n        return _A(outputIdx);\n      }`;return Object.assign(Object.assign({},a),{output:{dims:u,type:t.type,textureType:s.TextureType.unpacked},shaderSource:d})},c=e=>{if(!e||1!==e.length)throw new Error("Slice requires 1 input.");if(-1===o.NUMBER_TYPES.indexOf(e[0].type))throw new Error("Invalid input type.")};t.sliceV10=(e,t)=>{p(t);const n=u(e,t);return[e.run(Object.assign(Object.assign({},a),{cacheHint:n.cacheKey,get:()=>l(e,t[0],n)}),[t[0]])]};const u=(e,t)=>{if(!e.session.isInitializer(t[1].dataId)||!e.session.isInitializer(t[2].dataId)||t.length>=4&&!e.session.isInitializer(t[3].dataId)||t.length>=5&&!e.session.isInitializer(t[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(t.length>=5&&t[4].integerData.some((e=>1!==e)))throw new Error("currently non-1 steps is not supported for Slice");const n=Array.from(t[1].integerData),r=Array.from(t[2].integerData),o=t.length>=4?Array.from(t[3].integerData):[];return{starts:n,ends:r,axes:o,cacheKey:`${o};${n};${r}`}},p=e=>{if(!e||e.length<3||e.length>5)throw new Error("Invalid input number.");if("int32"!==e[1].type||1!==e[1].dims.length)throw new Error("Invalid input type.");if("int32"!==e[2].type||1!==e[2].dims.length)throw new Error("Invalid input type.");if(e.length>=4&&("int32"!==e[3].type||1!==e[3].dims.length))throw new Error("Invalid input type.");if(e.length>=5&&("int32"!==e[4].type||1!==e[4].dims.length))throw new Error("Invalid input type.")}},5524:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.softmaxV13=t.parseSoftmaxAttributesV13=t.parseSoftmaxAttributes=t.softmax=void 0;const r=n(246),o=n(2517),i=n(5060),s=n(2039),a=n(3738),l={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[s.TextureType.unpacked]},c={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[s.TextureType.unpacked,s.TextureType.unpacked]},u={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[s.TextureType.unpacked,s.TextureType.unpacked,s.TextureType.unpacked]};t.softmax=(e,t,n)=>{f(t);const r=t[0].dims.slice(),i=o.ShapeUtil.normalizeAxis(n.axis,r.length),s=o.ShapeUtil.sizeToDimension(r,i),a=o.ShapeUtil.sizeFromDimension(r,i);return p(e,t,n,s,a)},t.parseSoftmaxAttributes=e=>(0,r.createAttributeWithCacheKey)({axis:e.attributes.getInt("axis",1)}),t.parseSoftmaxAttributesV13=e=>(0,r.createAttributeWithCacheKey)({axis:e.attributes.getInt("axis",-1)}),t.softmaxV13=(e,t,n)=>{f(t);const i=t[0].dims.slice(),s=o.ShapeUtil.normalizeAxis(n.axis,i.length),l=i.length,c=s!==l-1,u=[];let d,_=[],h=[];c&&(_=Array.from({length:l}).map(((e,t)=>t)),_[s]=l-1,_[l-1]=s,_.map((e=>u.push(i[e]))),d=(0,r.createAttributeWithCacheKey)({perm:_}),h=(0,a.transpose)(e,t,d));const m=c?o.ShapeUtil.sizeToDimension(u,l-1):o.ShapeUtil.sizeToDimension(i,l-1),g=c?o.ShapeUtil.sizeFromDimension(u,l-1):o.ShapeUtil.sizeFromDimension(i,l-1),b=p(e,c?h:t,n,m,g);return c?(0,a.transpose)(e,b,d):b};const p=(e,t,n,r,o)=>{const i=d(e,t[0],r,o,[r]),s=e.run(Object.assign(Object.assign({},l),{cacheHint:n.cacheKey,get:()=>i}),t),a=_(e,t[0],r,o,i.output.dims,[r]),p=e.run(Object.assign(Object.assign({},c),{cacheHint:n.cacheKey,get:()=>a}),[t[0],s]),f=h(e,t[0],r,o,i.output.dims,a.output.dims);return[e.run(Object.assign(Object.assign({},u),{cacheHint:n.cacheKey,get:()=>f}),[t[0],s,p])]},d=(e,t,n,r,o)=>{const[a,c]=e.calculateTextureWidthAndHeight(t.dims,s.TextureType.unpacked),u=o.length;if(n<1||r<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==o.length)throw new Error("Dimensionality of the output should be 1");if(o[0]!==n)throw new Error("Shape of the output should be equal to logical row count");const p=(0,i.getGlsl)(e.session.backend.glContext.version),d=`\n      float process(int[${u}] indices) {\n        int logical_row_start_offset = indices[0] * ${r};\n\n        float max = getColorAsFloat(${p.texture2D}(A, offsetToCoords(logical_row_start_offset, ${a},\n        ${c} )));\n        for(int i=1; i<${r}; ++i)\n        {\n          float current = getColorAsFloat(${p.texture2D}(A, offsetToCoords(logical_row_start_offset + i,\n            ${a}, ${c})));\n          if(current > max)\n          max = current;\n        }\n\n        return max;\n      }`;return Object.assign(Object.assign({},l),{output:{dims:o,type:t.type,textureType:s.TextureType.unpacked},shaderSource:d})},_=(e,t,n,r,o,a)=>{const[l,u]=e.calculateTextureWidthAndHeight(t.dims,s.TextureType.unpacked),p=a.length;if(n<1||r<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==a.length)throw new Error("Dimensionality of the output should be 1");if(a[0]!==n)throw new Error("Shape of the output should be equal to logical row count");if(1!==o.length)throw new Error("Dimensionality of the intermediate results should be 1");if(o[0]!==n)throw new Error("Shape of the intermediate results should be equal to logical row count");const d=`\n      float process(int[${p}] indices) {\n        int logical_row_start_offset = indices[0] * ${r};\n\n        float norm_factor = 0.0;\n        float max = _Max(indices);\n        for(int i=0; i<${r}; ++i)\n        {\n          norm_factor += exp(getColorAsFloat(${(0,i.getGlsl)(e.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i,\n            ${l}, ${u}))) - max);\n        }\n\n        return norm_factor;\n      }`;return Object.assign(Object.assign({},c),{output:{dims:a,type:t.type,textureType:s.TextureType.unpacked},shaderSource:d})},h=(e,t,n,r,o,i)=>{const[a,l]=e.calculateTextureWidthAndHeight(t.dims,s.TextureType.unpacked),c=t.dims.length;if(n<1||r<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==o.length||1!==i.length)throw new Error("Dimensionality of the intermediate results should be 1");if(o[0]!==n||i[0]!==n)throw new Error("Shape of the intermediate results should be equal to logical row count");const p=`\n      float process(int[${c}] indices) {\n\n      // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords)\n      int offset = coordsToOffset(TexCoords, ${a}, ${l});\n\n      //determine the logical row for this index\n      int logical_row_index[1];\n      logical_row_index[0] = offset / ${r};\n\n      float norm_factor = _Norm(logical_row_index);\n\n      // avoid possible division by 0\n      // if norm_facor is 0, all elements are zero\n      // if so, return 0\n      if(norm_factor == 0.0)\n        return 0.0;\n\n      return exp(_A(indices) - _Max(logical_row_index)) / norm_factor;\n    }`;return Object.assign(Object.assign({},u),{output:{dims:t.dims,type:t.type,textureType:s.TextureType.unpacked},shaderSource:p})},f=e=>{if(!e||1!==e.length)throw new Error("Softmax requires 1 input.");if("float32"!==e[0].type&&"float64"!==e[0].type)throw new Error("Invalid input type")}},5975:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseSplitAttributes=t.split=void 0;const r=n(246),o=n(2517),i=n(2039),s={name:"Split",inputNames:["A"],inputTypes:[i.TextureType.unpacked]};t.split=(e,t,n)=>{c(t);const r=o.ShapeUtil.normalizeAxis(n.axis,t[0].dims.length),i=a(e,t,r,n),u=[];for(let o=0;o<i;++o)u.push(e.run(Object.assign(Object.assign({},s),{cacheHint:`${n.cacheKey};${o}`,get:()=>l(e,t[0],n,r,o)}),t));return u},t.parseSplitAttributes=e=>{const t=e.attributes.getInt("axis",0),n=e.attributes.getInts("split",[]),o=e.outputs.length;return(0,r.createAttributeWithCacheKey)({axis:t,split:n,numOutputs:o})};const a=(e,t,n,r)=>{const[,i]=o.SplitUtil.splitShape(t[0].dims,n,r.split,r.numOutputs);return i.length},l=(e,t,n,r,a)=>{const[l,c]=o.SplitUtil.splitShape(t.dims,r,n.split,n.numOutputs),u=c[a],p=l[a],d=`\n      float process(int indices[${p.length}]) {\n        indices[${r}] += ${u};\n        return _A(indices);\n      }\n    `;return Object.assign(Object.assign({},s),{cacheHint:`${n.cacheKey}:${a}`,output:{dims:p,type:t.type,textureType:i.TextureType.unpacked},shaderSource:d})},c=e=>{if(!e||1!==e.length)throw new Error("Split requires one input.");if("int8"!==e[0].type&&"uint8"!==e[0].type&&"int16"!==e[0].type&&"uint16"!==e[0].type&&"int32"!==e[0].type&&"uint32"!==e[0].type&&"float32"!==e[0].type&&"float64"!==e[0].type&&"bool"!==e[0].type)throw new Error("Invalid input type.")}},3933:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseSqueezeAttributes=t.squeezeV13=t.squeeze=void 0;const r=n(2517);t.squeeze=(e,t,n)=>{o(t);const i=r.ShapeUtil.squeezeShape(t[0].dims,n);return[e.reshapeUnpacked(t[0],i)]},t.squeezeV13=(e,n)=>(i(n),(0,t.squeeze)(e,[n[0]],Array.from(n[1].integerData))),t.parseSqueezeAttributes=e=>e.attributes.getInts("axes");const o=e=>{if(!e||1!==e.length)throw new Error("Squeeze requires 1 input.");if("string"===e[0].type)throw new Error("invalid input tensor types.")},i=e=>{if(!e||2!==e.length)throw new Error("Squeeze requires 2 inputs.");if("int32"!==e[1].type)throw new Error("Invalid input type.")}},6558:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sum=void 0;const r=n(5060),o=n(2039);t.sum=(e,t)=>{s(t);const n={name:"Sum",inputNames:t.map(((e,t)=>`X${t}`)),inputTypes:new Array(t.length).fill(o.TextureType.unpacked)};return[e.run(Object.assign(Object.assign({},n),{get:()=>i(e,t,n)}),t)]};const i=(e,t,n)=>{const i=(0,r.getGlsl)(e.session.backend.glContext.version),s=t[0].dims.slice(),a=`\n      void main() {\n        vec4 result = ${t.map(((e,t)=>`${i.texture2D}(X${t},TexCoords)`)).join(" + ")};\n        ${i.output} = result;\n      }\n    `;return Object.assign(Object.assign({},n),{output:{dims:s,type:t[0].type,textureType:o.TextureType.unpacked},hasMain:!0,shaderSource:a})},s=e=>{if(!e||0===e.length)throw new Error("Sum requires inputs.");const t=e[0].dims.length;for(let n=1;n<e.length;n++){if(t!==e[n].dims.length)throw new Error("Input shapes are mismatched.");for(let r=0;r<t;r++)if(e[0].dims[r]!==e[n].dims[r])throw new Error("Input shapes are not matched.")}if("float32"!==e[0].type&&"float64"!==e[0].type)throw new Error("Invalid input type.");for(let t=1;t<e.length;t++)if(e[0].type!==e[t].type)throw new Error("Input types are not matched.")}},5723:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tile=void 0;const r=n(782),o=n(2039);t.tile=(e,t)=>{s(t);const n={name:"Tile",inputNames:["A"],inputTypes:[o.TextureType.unpacked]};return[e.run(Object.assign(Object.assign({},n),{get:()=>i(e,t,n)}),t)]};const i=(e,t,n)=>{const r=t[0].dims.slice(),i=new Array(r.length),s=[];for(let e=0;e<r.length;e++)i[e]=r[e]*t[1].numberData[e],s.push(`inputIdx[${e}] = int(mod(float(outputIdx[${e}]), ${r[e]}.));`);const a=i.length,l=`\n      float process(int outputIdx[${a}]) {\n        int inputIdx[${a}];\n        ${s.join("\n")}\n        return _A(inputIdx);\n      }\n    `;return Object.assign(Object.assign({},n),{output:{dims:i,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:l})},s=e=>{if(!e||2!==e.length)throw new Error("Tile requires 2 input.");if(1!==e[1].dims.length)throw new Error("The second input shape must 1 dimension.");if(e[1].dims[0]!==e[0].dims.length)throw new Error("Invalid input shape.");if(-1===r.NUMBER_TYPES.indexOf(e[0].type))throw new Error("Invalid input type.");if("int32"!==e[1].type&&"int16"!==e[1].type)throw new Error("Invalid repeat type.")}},3738:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseTransposeAttributes=t.transpose=void 0;const r=n(246),o=n(2517),i=n(2039),s={name:"Transpose",inputNames:["A"],inputTypes:[i.TextureType.unpacked]};t.transpose=(e,t,n)=>(p(t),[e.run(Object.assign(Object.assign({},s),{cacheHint:n.cacheKey,get:()=>a(e,t[0],n.perm)}),t)]),t.parseTransposeAttributes=e=>(0,r.createAttributeWithCacheKey)({perm:e.attributes.getInts("perm",[])});const a=(e,t,n)=>{const r=t.dims;n=l(r,n);const o=c(r,n),a=r.length,p=`\n      ${u("perm",n,a)}\n      float process(int indices[${a}]) {\n        int a[${a}];\n        perm(a, indices);\n        return _A(a);\n      }`;return Object.assign(Object.assign({},s),{output:{dims:o,type:t.type,textureType:i.TextureType.unpacked},shaderSource:p})},l=(e,t)=>(t&&t.length!==e.length&&(t=[...e.keys()].reverse()),t),c=(e,t)=>(t=l(e,t),o.ShapeUtil.sortBasedOnPerm(e,t)),u=(e,t,n)=>{const r=[];r.push(`void ${e}(out int a[${n}], int src[${n}]) {`);for(let e=0;e<n;++e)r.push(`\ta[${t[e]}]=src[${e}];`);return r.push("\t}"),r.join("\n")},p=e=>{if(!e||1!==e.length)throw new Error("Transpose requires 1 input.");if("float32"!==e[0].type&&"float64"!==e[0].type)throw new Error("input should be float tensor")}},8710:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.encodeAsUint8=void 0;const r=n(5060),o=n(2039);t.encodeAsUint8=(e,t)=>{const n=t.shape,i=(0,r.getGlsl)(e.session.backend.glContext.version),s=`\n    const float FLOAT_MAX = 1.70141184e38;\n    const float FLOAT_MIN = 1.17549435e-38;\n\n    bool isNaN(float val) {\n      return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true;\n    }\n\n    highp vec4 encodeAsUint8(highp float v) {\n      if (isNaN(v)) {\n        return vec4(255, 255, 255, 255);\n      }\n\n      highp float av = abs(v);\n\n      if(av < FLOAT_MIN) {\n        return vec4(0.0, 0.0, 0.0, 0.0);\n      } else if(v > FLOAT_MAX) {\n        return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n      } else if(v < -FLOAT_MAX) {\n        return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;\n      }\n\n      highp vec4 c = vec4(0,0,0,0);\n\n      highp float e = floor(log2(av));\n      highp float m = exp2(fract(log2(av))) - 1.0;\n\n      c[2] = floor(128.0 * m);\n      m -= c[2] / 128.0;\n      c[1] = floor(32768.0 * m);\n      m -= c[1] / 32768.0;\n      c[0] = floor(8388608.0 * m);\n\n      highp float ebias = e + 127.0;\n      c[3] = floor(ebias / 2.0);\n      ebias -= c[3] * 2.0;\n      c[2] += floor(ebias) * 128.0;\n\n      c[3] += 128.0 * step(0.0, -v);\n\n      return c / 255.0;\n    }\n\n    void main() {\n      float value = ${i.texture2D}(X,TexCoords).r;\n      ${i.output} = encodeAsUint8(value);\n    }`,a={name:"Uint8Encode",inputTypes:[o.TextureType.unpacked],inputNames:["X"],output:{dims:n,type:t.tensor.type,textureType:o.TextureType.downloadUint8AsFloat},shaderSource:s,hasMain:!0};return e.executeProgram(a,[t.tensor])}},4909:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tanh=t.tan=t.sqrt=t.sin=t.sigmoid=t.relu=t.not=t.neg=t.log=t.parseLeakyReluAttributes=t.leakyRelu=t.identity=t.floor=t.exp=t.parseEluAttributes=t.elu=t.cos=t.ceil=t.clipV11=t.parseClipAttributes=t.clip=t.atan=t.asin=t.acos=t.abs=t.glslTanh=t.glslTan=t.glslSqrt=t.glslSigmoid=t.glslRelu=t.glslSin=t.glslNot=t.glslNeg=t.glslLog=t.glslLeakyRelu=t.glslIdentity=t.glslClip=t.glslFloor=t.glslExp=t.glslElu=t.glslCos=t.glslCeil=t.glslAtan=t.glslAsin=t.glslAcos=t.glslAbs=void 0;const r=n(246),o=n(2517),i=n(8520),s=n(5060),a=n(2039);function l(){return F("abs")}function c(){return F("acos")}function u(){return F("asin")}function p(){return F("atan")}function d(){return F("ceil")}function _(){return F("cos")}function h(e){const t="elu";return{body:`\n  const float alpha = float(${e});\n\n  float ${t}_(float a) {\n    return a >= 0.0 ? a: (exp(a) - 1.0) * alpha;\n  }\n  vec4 ${t}_(vec4 v) {\n    return vec4(${t}_(v.x), ${t}_(v.y), ${t}_(v.z), ${t}_(v.w));\n  }\n  `,name:t,type:i.FunctionType.ValueBased}}function f(){return F("exp")}function m(){return F("floor")}function g(e,t){const n="clip";return{body:`\n  const float min = float(${e});\n  const float max = float(${t});\n\n  float ${n}_(float a) {\n    return clamp(a, min, max);\n  }\n  vec4 ${n}_(vec4 v) {\n    return clamp(v, min, max);\n  }\n  `,name:n,type:i.FunctionType.ValueBased}}function b(){const e="indentity";return{body:`\n  float ${e}_(float a) {\n    return a;\n  }\n  vec4 ${e}_(vec4 v) {\n    return v;\n  }\n  `,name:e,type:i.FunctionType.ValueBased}}function w(e){const t="leakyRelu";return{body:`\n  const float alpha = float(${e});\n\n  float ${t}_(float a) {\n    return a < 0.0 ? a * alpha : a;\n  }\n  vec4 ${t}_(vec4 v) {\n    return vec4(${t}_(v.x), ${t}_(v.y), ${t}_(v.z), ${t}_(v.w));\n  }\n  `,name:t,type:i.FunctionType.ValueBased}}function x(){return F("log")}function y(){const e="neg";return{body:`\n  float ${e}_(float a) {\n    return -a;\n  }\n  vec4 ${e}_(vec4 v) {\n    return -v;\n  }\n  `,name:e,type:i.FunctionType.ValueBased}}function T(){const e="not";return{body:`\n  float ${e}_(float a) {\n    return float( ! bool(a) );\n  }\n  bool ${e}_(bool a) {\n    return !a;\n  }\n  vec4 ${e}_(vec4 v) {\n    return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w));\n  }\n  bvec4 ${e}_(bvec4 v) {\n    return bvec4(!v.x, !v.y, !v.z, !v.w);\n  }\n  `,name:e,type:i.FunctionType.ValueBased}}function v(){return F("sin")}function k(){const e="relu";return{body:`\n  float ${e}_(float a) {\n    return max( a, 0.0 );\n  }\n  vec4 ${e}_(vec4 v) {\n    return max( v, 0.0 );\n  }\n  `,name:e,type:i.FunctionType.ValueBased}}function M(){const e="sigmoid";return{body:`\n  float ${e}_(float a) {\n    return 1.0 / (1.0 + exp(-a));\n  }\n  vec4 ${e}_(vec4 v) {\n    return 1.0 / (1.0 + exp(-v));\n  }\n  `,name:e,type:i.FunctionType.ValueBased}}function S(){return F("sqrt")}function P(){return F("tan")}function A(){const e="tanh";return{body:`\n  float ${e}_(float a) {\n    a = clamp(a, -10., 10.);\n    a = exp(2.*a);\n    return (a - 1.) / (a + 1.);\n  }\n  vec4 ${e}_(vec4 v) {\n    v = clamp(v, -10., 10.);\n    v = exp(2.*v);\n    return (v - 1.) / (v + 1.);\n  }\n  `,name:e,type:i.FunctionType.ValueBased}}function F(e){return{body:`\n  float ${e}_(float a) {\n    return ${e}(a);\n  }\n  vec4 ${e}_(vec4 v) {\n    return ${e}(v);\n  }\n  `,name:e,type:i.FunctionType.ValueBased}}t.glslAbs=l,t.glslAcos=c,t.glslAsin=u,t.glslAtan=p,t.glslCeil=d,t.glslCos=_,t.glslElu=h,t.glslExp=f,t.glslFloor=m,t.glslClip=g,t.glslIdentity=b,t.glslLeakyRelu=w,t.glslLog=x,t.glslNeg=y,t.glslNot=T,t.glslSin=v,t.glslRelu=k,t.glslSigmoid=M,t.glslSqrt=S,t.glslTan=P,t.glslTanh=A;const C=(e,t,n,r)=>{const o=e.session.pack?a.TextureType.packed:a.TextureType.unpacked,i={name:n.name,inputTypes:[o],inputNames:["A"],cacheHint:r};return Object.assign(Object.assign({},i),{get:()=>((e,t,n,r)=>{const o=e.session.pack?a.TextureType.packed:a.TextureType.unpacked,i=(0,s.getGlsl)(e.session.backend.glContext.version);return Object.assign(Object.assign({},t),{output:{dims:n.dims,type:n.type,textureType:o},shaderSource:`\n     ${r.body}\n     void main() {\n       vec4 v = ${i.texture2D}(A, TexCoords);\n       v = ${r.name}_(v);\n       ${i.output} = v;\n     }\n     `,hasMain:!0})})(e,i,t,n)})};t.abs=(e,t)=>[e.run(C(e,t[0],l()),t)],t.acos=(e,t)=>[e.run(C(e,t[0],c()),t)],t.asin=(e,t)=>[e.run(C(e,t[0],u()),t)],t.atan=(e,t)=>[e.run(C(e,t[0],p()),t)],t.clip=(e,t,n)=>[e.run(C(e,t[0],g(n.min,n.max),n.cacheKey),t)],t.parseClipAttributes=e=>(0,r.createAttributeWithCacheKey)({min:e.attributes.getFloat("min",o.MIN_CLIP),max:e.attributes.getFloat("max",o.MAX_CLIP)}),t.clipV11=(e,n)=>{const r=E(e,n);return(0,t.clip)(e,[n[0]],r)};const E=(e,t)=>{if(t.length>=3&&(!e.session.isInitializer(t[1].dataId)||!e.session.isInitializer(t[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const n=t.length>=3?t[1].numberData[0]:o.MIN_CLIP,i=t.length>=3?t[2].numberData[0]:o.MAX_CLIP;return(0,r.createAttributeWithCacheKey)({min:n,max:i})};t.ceil=(e,t)=>[e.run(C(e,t[0],d()),t)],t.cos=(e,t)=>[e.run(C(e,t[0],_()),t)],t.elu=(e,t,n)=>[e.run(C(e,t[0],h(n.alpha),n.cacheKey),t)],t.parseEluAttributes=e=>(0,r.createAttributeWithCacheKey)({alpha:e.attributes.getFloat("alpha",1)}),t.exp=(e,t)=>[e.run(C(e,t[0],f()),t)],t.floor=(e,t)=>[e.run(C(e,t[0],m()),t)],t.identity=(e,t)=>[e.run(C(e,t[0],b()),t)],t.leakyRelu=(e,t,n)=>[e.run(C(e,t[0],w(n.alpha),n.cacheKey),t)],t.parseLeakyReluAttributes=e=>(0,r.createAttributeWithCacheKey)({alpha:e.attributes.getFloat("alpha",.01)}),t.log=(e,t)=>[e.run(C(e,t[0],x()),t)],t.neg=(e,t)=>[e.run(C(e,t[0],y()),t)],t.not=(e,t)=>[e.run(C(e,t[0],T()),t)],t.relu=(e,t)=>[e.run(C(e,t[0],k()),t)],t.sigmoid=(e,t)=>[e.run(C(e,t[0],M()),t)],t.sin=(e,t)=>[e.run(C(e,t[0],v()),t)],t.sqrt=(e,t)=>[e.run(C(e,t[0],S()),t)],t.tan=(e,t)=>[e.run(C(e,t[0],P()),t)],t.tanh=(e,t)=>[e.run(C(e,t[0],A()),t)]},5611:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createUnpackProgramInfoLoader=t.createUnpackProgramInfo=void 0;const r=n(5060),o=n(2039),i=n(9390),s=n(2827),a={name:"unpack",inputNames:["A"],inputTypes:[o.TextureType.packed]};t.createUnpackProgramInfo=(e,t)=>{const n=t.dims.length,l=(0,s.getChannels)("rc",n),c=l.slice(-2),u=(0,i.getCoordsDataType)(n),p=(0,s.unpackFromChannel)(),d=0===t.dims.length?"":function(e,t){if(1===e)return"rc";let n="";for(let r=0;r<e;r++)n+=t[r],r<e-1&&(n+=",");return n}(n,l),_=n<=1?"rc":`vec2(${c.join(",")})`,h=`\n    ${p}\n    void main() {\n      ${u} rc = getOutputCoords();\n\n       // Sample the texture with the coords to get the rgba channel value.\n       vec4 packedInput = getA(${d});\n\n       ${(0,r.getGlsl)(e.session.backend.glContext.version).output} = vec4(getChannel(packedInput, ${_}), 0, 0, 0);\n     }\n   `;return Object.assign(Object.assign({},a),{hasMain:!0,output:{dims:t.dims,type:t.type,textureType:o.TextureType.unpacked},shaderSource:h})},t.createUnpackProgramInfoLoader=(e,n)=>Object.assign(Object.assign({},a),{get:()=>(0,t.createUnpackProgramInfo)(e,n)})},8428:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseUnsqueezeAttributes=t.unsqueezeV13=t.unsqueeze=void 0;const r=n(2517);t.unsqueeze=(e,t,n)=>{o(t);const i=r.ShapeUtil.unsqueezeShape(t[0].dims,n);return[e.reshapeUnpacked(t[0],i)]},t.unsqueezeV13=(e,n)=>(i(n),(0,t.unsqueeze)(e,[n[0]],Array.from(n[1].integerData))),t.parseUnsqueezeAttributes=e=>e.attributes.getInts("axes");const o=e=>{if(!e||1!==e.length)throw new Error("Unsqueeze requires 1 input.");if("string"===e[0].type)throw new Error("invalid input tensor types.")},i=e=>{if(!e||2!==e.length)throw new Error("Unsqueeze requires 2 inputs.");if("int32"!==e[1].type)throw new Error("Invalid input type.")}},9793:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scalesValidation=t.validateInputs=t.parseUpsampleAttributes=t.parseUpsampleAttributesV9=t.parseUpsampleAttributesV7=t.upsample=void 0;const r=n(246),o=n(5060),i=n(2039),s={name:"Upsample",inputNames:["X"],inputTypes:[i.TextureType.unpacked]};t.upsample=(e,n,r)=>((0,t.validateInputs)(n,r),[e.run(Object.assign(Object.assign({},s),{cacheHint:r.cacheKey,get:()=>a(e,n,r)}),n)]),t.parseUpsampleAttributesV7=e=>(0,t.parseUpsampleAttributes)(e,7),t.parseUpsampleAttributesV9=e=>(0,t.parseUpsampleAttributes)(e,9),t.parseUpsampleAttributes=(e,n)=>{const o=n>=10,i=e.attributes.getString("mode","nearest");if("nearest"!==i&&"linear"!==i&&(n<11||"cubic"!==i))throw new Error(`unrecognized mode: ${i}`);let s=[];n<9&&(s=e.attributes.getFloats("scales"),(0,t.scalesValidation)(s,i,o));const a=e.attributes.getFloat("extrapolation_value",0),l=n>10?e.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(-1===["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(l))throw new Error(`coordinate_transform_mode '${l}' is not supported`);const c="tf_crop_and_resize"===l,u=c,p="nearest"===i&&n>=11?e.attributes.getString("nearest_mode","round_prefer_floor"):"";if(-1===["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(p))throw new Error(`nearest_mode '${p}' is not supported`);const d=e.attributes.getFloat("cubic_coeff_a",-.75),_=0!==e.attributes.getInt("exclude_outside",0);if(_&&"cubic"!==i)throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const h=n<11||"nearest"===i&&"asymmetric"===l&&"floor"===p;let f=0,m=0,g=0;return n>10?e.inputs.length>2?(f=1,m=2,g=3):(m=1,g=2):9===n&&(m=1),(0,r.createAttributeWithCacheKey)({opset:n,isResize:o,mode:i,scales:s,extrapolationValue:a,coordinateTransformMode:l,useExtrapolation:u,needRoiInput:c,nearestMode:p,cubicCoefficientA:d,excludeOutside:_,useNearest2xOptimization:h,roiInputIdx:f,scalesInputIdx:m,sizesInputIdx:g})};const a=(e,t,n)=>{const r=(0,o.getGlsl)(e.session.backend.glContext.version),[a,l]=e.calculateTextureWidthAndHeight(t[0].dims,i.TextureType.unpacked),c=t[0].dims.map(((e,t)=>Math.floor(e*n.scales[t]))),[u,p]=e.calculateTextureWidthAndHeight(c,i.TextureType.unpacked),d=c.length,_=new Array(d),h=new Array(d);let f=`\n      int output_pitches[${d}];\n      int input_pitches[${d}];\n      `;for(let e=d-1;e>=0;e--)_[e]=e===d-1?1:_[e+1]*c[e+1],h[e]=e===d-1?1:h[e+1]*t[0].dims[e+1],f+=`\n        output_pitches[${e}] = ${_[e]};\n        input_pitches[${e}] = ${h[e]};\n        `;const m=`\n      float getInputFloat(int index) {\n        vec2 coords = offsetToCoords(index, ${a}, ${l});\n        float value = getColorAsFloat(${r.texture2D}(X, coords));\n        return value;\n      }\n      `,g="nearest"===n.mode?`\n    ${m}\n    float process(int indices[${d}]) {\n      int input_index = 0;\n      int output_index = coordsToOffset(TexCoords, ${u}, ${p});\n\n      ${f}\n\n      int d, m;\n      for (int dim = 0; dim < ${d}; ++dim) {\n        d = output_index / output_pitches[dim];\n        m = output_index - d * output_pitches[dim];\n        output_index = m;\n\n        if (scales[dim] != 1 && d > 0) {\n          int d2 = d / scales[dim];\n          m = d - d2 * scales[dim];\n          d = d2;\n        }\n        input_index += input_pitches[dim] * d;\n      }\n\n      return getInputFloat(input_index);\n    }`:4===d?`\n    ${m}\n    float process(int indices[4]) {\n      int input_index = 0;\n      int output_index = coordsToOffset(TexCoords, ${u}, ${p});\n\n      ${f}\n\n      int m;\n      int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3;\n      index_of_dim0 = output_index / output_pitches[0];\n      m = output_index - index_of_dim0 * output_pitches[0];\n      index_of_dim1 = m / output_pitches[1];\n      m = m - index_of_dim1 * output_pitches[1];\n      index_of_dim2 = m / output_pitches[2];\n      m = m - index_of_dim2 * output_pitches[2];\n      index_of_dim3 = m;\n\n      int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset;\n      index_of_input_dim2 = index_of_dim2 / scales[2];\n      y_offset = index_of_dim2 - index_of_input_dim2 * scales[2];\n      index_of_input_dim3 = index_of_dim3 / scales[3];\n      x_offset = index_of_dim3 - index_of_input_dim3 * scales[3];\n\n      input_index = index_of_dim0 * input_pitches[0] +\n            index_of_dim1 * input_pitches[1] +\n            index_of_input_dim2 * input_pitches[2] +\n            index_of_input_dim3;\n\n      float x00 = getInputFloat(input_index);\n      float x10, x01, x11;\n\n      bool end_of_dim2 = false;\n      if (index_of_input_dim2 == (${t[0].dims[2]} - 1)) {\n        // It's the end in dimension 2\n        x01 = x00;\n        end_of_dim2 = true;\n      } else {\n        x01 = getInputFloat(input_index + input_pitches[2]);\n      }\n\n      if (index_of_input_dim3 == (input_pitches[2] - 1)) {\n        // It's the end in dimension 3\n        x10 = x00;\n        x11 = x01;\n      }\n      else {\n        x10 = getInputFloat(input_index + 1);\n        x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1);\n      }\n\n      float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]);\n      float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]);\n      return y0 + float(x_offset) * (y1 - y0) / float(scales[3]);\n    }`:`\n    ${m}\n    float process(int indices[2]) {\n      int input_index = 0;\n      int output_index = coordsToOffset(TexCoords, ${u}, ${p});\n\n      ${f}\n\n      int m;\n      int index_of_dim0, index_of_dim1;\n      index_of_dim0 = output_index / output_pitches[0];\n      m = output_index - index_of_dim0 * output_pitches[0];\n      index_of_dim1 = m;\n\n      int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset;\n      index_of_input_dim0 = index_of_dim0 / scales[0];\n      y_offset = index_of_dim0 - index_of_input_dim0 * scales[0];\n      index_of_input_dim1 = index_of_dim1 / scales[1];\n      x_offset = index_of_dim1 - index_of_input_dim1 * scales[1];\n\n      input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1;\n\n      float x00 = getInputFloat(input_index);\n      float x10, x01, x11;\n\n      bool end_of_dim0 = false;\n      if (index_of_input_dim0 == (${t[0].dims[0]} - 1)) {\n        // It's the end in dimension 0\n        x01 = x00;\n        end_of_dim0 = true;\n      } else {\n        x01 = getInputFloat(input_index + input_pitches[0]);\n      }\n\n      if (index_of_input_dim1 == (input_pitches[0] - 1)) {\n        // It's the end in dimension 1\n        x10 = x00;\n        x11 = x01;\n      }\n      else {\n        x10 = getInputFloat(input_index + 1);\n        x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1);\n      }\n\n      float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]);\n      float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]);\n      return y0 + float(x_offset) * (y1 - y0) / float(scales[1]);\n    }`;return Object.assign(Object.assign({},s),{output:{dims:c,type:t[0].type,textureType:i.TextureType.unpacked},shaderSource:g,variables:[{name:"scales",type:"int",arrayLength:n.scales.length,data:n.scales.map((e=>Math.ceil(e)))}]})};t.validateInputs=(e,t)=>{if(!e||t.opset<9&&1!==e.length||t.opset>=9&&t.opset<11&&2!==e.length||t.opset>=11&&e.length<2)throw new Error("invalid inputs.");if(t.scales.length>0&&e[0].dims.length!==t.scales.length)throw new Error("Invalid input shape.");if("string"===e[0].type)throw new Error("Invalid input tensor types.")},t.scalesValidation=(e,t,n)=>{if(n){for(const t of e)if(t<=0)throw new Error("Scale value should be greater than 0.")}else for(const t of e)if(t<1)throw new Error("Scale value should be greater than or equal to 1.");if(!("linear"!==t&&"cubic"!==t||2===e.length||4===e.length&&1===e[0]&&1===e[1]))throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic')         or 4-D inputs with the corresponding outermost 2 scale values being 1         in the ${n?"Resize":"Upsample"} opeartor.`)}},1958:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProgramManager=void 0;const r=n(1670),o=n(6231),i=n(8879),s=n(5060);t.ProgramManager=class{constructor(e,t,n){this.profiler=e,this.glContext=t,this.textureLayoutStrategy=n,this.repo=new Map,this.attributesBound=!1}getArtifact(e){return this.repo.get(e)}setArtifact(e,t){this.repo.set(e,t)}run(e,t,n){var r;this.profiler.event("op",`ProgramManager.run ${null!==(r=e.programInfo.name)&&void 0!==r?r:"unknown kernel"}`,(()=>{var r;const i=this.glContext.gl,s=e.program;i.useProgram(s);try{this.bindOutput(n),this.attributesBound||this.bindAttributes(e.attribLocations),this.bindUniforms(e.uniformLocations,null!==(r=e.programInfo.variables)&&void 0!==r?r:[],t)}catch(t){throw o.Logger.error("ProgramManager",e.programInfo.shaderSource),t}this.profiler.event("backend","GlContext.draw()",(()=>{this.glContext.draw()}))}),this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach((e=>this.glContext.deleteProgram(e.program)))}build(e,t,n){return this.profiler.event("backend","ProgramManager.build",(()=>{const r=new i.GlslPreprocessor(this.glContext,e,t,n),o=r.preprocess(),s=this.compile(o);return{programInfo:e,program:s,uniformLocations:this.getUniformLocations(s,r.context.programInfo.inputNames,r.context.programInfo.variables),attribLocations:this.getAttribLocations(s)}}))}compile(e){if(!this.vertexShader){o.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const e=(0,s.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(e,this.glContext.gl.VERTEX_SHADER)}r.env.debug&&o.Logger.verbose("ProrgramManager",`FragShader:\n${e}\n`);const t=this.glContext.compileShader(e,this.glContext.gl.FRAGMENT_SHADER),n=this.glContext.createProgram(this.vertexShader,t);return this.glContext.deleteShader(t),n}bindOutput(e){const t=e.width,n=e.height;o.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${t}/${n}, shape=${e.shape}, type=${e.tensor.type}`),this.glContext.attachFramebuffer(e.texture,t,n)}bindAttributes(e){const t=e.position,n=e.textureCoord;this.glContext.setVertexAttributes(t,n),this.attributesBound=!0}bindUniforms(e,t,n){var r;const o=this.glContext.gl;let i=0;for(const{name:s,type:a,location:l,arrayLength:c}of e){const e=null===(r=t.find((e=>e.name===s)))||void 0===r?void 0:r.data;if("sampler2D"!==a&&!e)throw new Error(`variable '${s}' does not have data defined in program info`);switch(a){case"sampler2D":this.bindTexture(n[i],l,i),i++;break;case"float":c?o.uniform1fv(l,e):o.uniform1f(l,e);break;case"int":c?o.uniform1iv(l,e):o.uniform1i(l,e);break;default:throw new Error(`Uniform not implemented: ${a}`)}}}bindTexture(e,t,n){this.glContext.bindTextureToUniform(e.texture,n,t)}getAttribLocations(e){return{position:this.getAttribLocation(e,"position"),textureCoord:this.getAttribLocation(e,"textureCoord")}}getUniformLocations(e,t,n){const r=[];if(t)for(const n of t)r.push({name:n,type:"sampler2D",location:this.getUniformLocation(e,n)});if(n)for(const t of n)r.push(Object.assign(Object.assign({},t),{location:this.getUniformLocation(e,t.name)}));return r}getUniformLocation(e,t){const n=this.glContext.gl.getUniformLocation(e,t);if(null===n)throw new Error(`Uniform ${t} not found.`);return n}getAttribLocation(e,t){return this.glContext.gl.getAttribLocation(e,t)}}},6416:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLSessionHandler=void 0;const r=n(6231),o=n(1047),i=n(8316),s=n(1640),a=n(1958),l=n(7859),c=n(5702);t.WebGLSessionHandler=class{constructor(e,t){this.backend=e,this.context=t,this.layoutStrategy=new l.PreferLogicalStrategy(e.glContext.maxTextureSize),this.programManager=new a.ProgramManager(this.context.profiler,e.glContext,this.layoutStrategy),this.textureManager=new c.TextureManager(e.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:"full"===e.textureCacheMode}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=e.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new i.WebGLInferenceHandler(this)}onGraphInitialized(e){const t=e.getValues().filter((e=>-1===e.from&&e.tensor)).map((e=>e.tensor.dataId));this.initializers=new Set(t)}isInitializer(e){return!!this.initializers&&this.initializers.has(e)}addInitializer(e){this.initializers.add(e)}getTextureData(e,t){return t?this.packedTextureDataCache.get(e):this.unpackedTextureDataCache.get(e)}setTextureData(e,t,n=!1){r.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),n?this.packedTextureDataCache.set(e,t):this.unpackedTextureDataCache.set(e,t)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach((e=>this.textureManager.releaseTexture(e,!0))),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach((e=>this.textureManager.releaseTexture(e,!0))),this.unpackedTextureDataCache=new Map}resolve(e,t,n){const r=(0,o.resolveOperator)(e,t,s.WEBGL_OP_RESOLVE_RULES);return{impl:r.opImpl,context:r.opInit?r.opInit(e,n):e}}}},7769:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Uint8DataEncoder=t.RGBAFloatDataEncoder=t.RedFloat32DataEncoder=void 0;const r=n(6231);t.RedFloat32DataEncoder=class{constructor(e,t=1){if(1===t)this.internalFormat=e.R32F,this.format=e.RED,this.textureType=e.FLOAT,this.channelSize=t;else{if(4!==t)throw new Error(`Invalid number of channels: ${t}`);this.internalFormat=e.RGBA32F,this.format=e.RGBA,this.textureType=e.FLOAT,this.channelSize=t}}encode(e,t){let n,o;return e.constructor!==Float32Array&&(r.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),o=new Float32Array(e)),t*this.channelSize>e.length?(r.Logger.warning("Encoder","Source data too small. Allocating larger array"),o=e,n=this.allocate(t*this.channelSize),o.forEach(((e,t)=>n[t]=e))):(o=e,n=o),n}allocate(e){return new Float32Array(4*e)}decode(e,t){return 1===this.channelSize?e.filter(((e,t)=>t%4==0)).subarray(0,t):e.subarray(0,t)}},t.RGBAFloatDataEncoder=class{constructor(e,t=1,n){if(1!==t&&4!==t)throw new Error(`Invalid number of channels: ${t}`);this.internalFormat=e.RGBA,this.format=e.RGBA,this.channelSize=t,this.textureType=n||e.FLOAT}encode(e,t){let n=e;return 1===this.channelSize&&(r.Logger.verbose("Encoder","Exploding into a larger array"),n=this.allocate(t),e.forEach(((e,t)=>n[4*t]=e))),n}allocate(e){return new Float32Array(4*e)}decode(e,t){return 1===this.channelSize?e.filter(((e,t)=>t%4==0)).subarray(0,t):e.subarray(0,t)}},t.Uint8DataEncoder=class{constructor(e,t=1){if(this.channelSize=4,1===t)this.internalFormat=e.ALPHA,this.format=e.ALPHA,this.textureType=e.UNSIGNED_BYTE,this.channelSize=t;else{if(4!==t)throw new Error(`Invalid number of channels: ${t}`);this.internalFormat=e.RGBA,this.format=e.RGBA,this.textureType=e.UNSIGNED_BYTE,this.channelSize=t}}encode(e,t){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}allocate(e){return new Uint8Array(e*this.channelSize)}decode(e,t){if(e instanceof Uint8Array)return e.subarray(0,t);throw new Error(`Invalid array type: ${e.constructor}`)}}},7859:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getBatchDim=t.sizeToSquarishShape=t.getRowsCols=t.sizeFromShape=t.isInt=t.parseAxisParam=t.squeezeShape=t.PreferLogicalStrategy=t.AlwaysKeepOriginalSizeStrategy=void 0;const r=n(6231),o=n(2517);function i(e,t){const n=[],r=[],o=null!=t&&Array.isArray(t)&&0===t.length,i=null==t||o?null:s(t,e).sort();let a=0;for(let t=0;t<e.length;++t){if(null!=i){if(i[a]===t&&1!==e[t])throw new Error(`Can't squeeze axis ${t} since its dim '${e[t]}' is not 1`);(null==i[a]||i[a]>t)&&1===e[t]&&(n.push(e[t]),r.push(t)),i[a]<=t&&a++}1!==e[t]&&(n.push(e[t]),r.push(t))}return{newShape:n,keptDims:r}}function s(e,t){const n=t.length;return e=null==e?t.map(((e,t)=>t)):[].concat(e),(0,o.assert)(e.every((e=>e>=-n&&e<n)),(()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`)),(0,o.assert)(e.every(a),(()=>`All values in axis param must be integers but got axis ${e}`)),e.map((e=>e<0?n+e:e))}function a(e){return e%1==0}function l(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function c(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}t.AlwaysKeepOriginalSizeStrategy=class{constructor(e){this.maxTextureSize=e}computeTextureWH(e,t){if(0===e.length)return[1,1];const n=this.maxTextureSize;if(t&&void 0!==t.breakAxis){const o=t.breakAxis>=e.length?1:e.slice(t.breakAxis).reduce(((e,t)=>e*t)),i=t.breakAxis<=0?1:e.slice(0,t.breakAxis).reduce(((e,t)=>e*t));if(!(o>n||i>n))return[o,i];r.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${e}, breakAxis:${t.breakAxis}`)}const o=e.reduce(((e,t)=>e*t));let i=Math.floor(Math.sqrt(o));for(;i<n&&i<o&&o%i!=0;i++);if(i>=n||o%i!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${e}`);return[i,o/i]}},t.PreferLogicalStrategy=class{constructor(e){this.maxTextureSize=e}computeTextureWH(e,t){const n=this.computeTexture(e,t);return t&&t.isPacked&&(n[0]/=2,n[1]/=2),t&&t.reverseWH?[n[1],n[0]]:n}computeTexture(e,t){const n=t&&t.isPacked;if(0===e.length)return n?[2,2]:[1,1];let o=this.maxTextureSize;if(t&&void 0!==t.breakAxis){const n=t.breakAxis>=e.length?1:e.slice(t.breakAxis).reduce(((e,t)=>e*t)),i=t.breakAxis<=0?1:e.slice(0,t.breakAxis).reduce(((e,t)=>e*t));if(!(n>o||i>o))return[n,i];r.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${e}, breakAxis:${t.breakAxis}`)}let s=e.slice(0);if(n&&(o*=2,s=s.map(((e,t)=>t>=s.length-2?s[t]%2==0?s[t]:s[t]+1:s[t])),1===s.length&&(s=[2,s[0]])),2!==s.length){const e=i(s);s=e.newShape}const a=l(s);return s.length<=1&&a<=o?[1,a]:2===s.length&&s[0]<=o&&s[1]<=o?s:3===s.length&&s[0]*s[1]<=o&&s[2]<=o?[s[0]*s[1],s[2]]:3===s.length&&s[0]<=o&&s[1]*s[2]<=o?[s[0],s[1]*s[2]]:4===s.length&&s[0]*s[1]*s[2]<=o&&s[3]<=o?[s[0]*s[1]*s[2],s[3]]:4===s.length&&s[0]<=o&&s[1]*s[2]*s[3]<=o?[s[0],s[1]*s[2]*s[3]]:n?c(a/4).map((e=>2*e)):c(a)}},t.squeezeShape=i,t.parseAxisParam=s,t.isInt=a,t.sizeFromShape=l,t.getRowsCols=function(e){if(0===e.length)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]},t.sizeToSquarishShape=c,t.getBatchDim=function(e,t=2){return l(e.slice(0,e.length-t))}},4057:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTextureLayoutFromShape=t.calculateTextureWidthAndHeight=t.createTextureLayoutFromTextureType=void 0;const r=n(2517),o=n(2039);t.createTextureLayoutFromTextureType=(e,n,r)=>{const i=r===o.TextureType.unpacked||r===o.TextureType.unpackedReversed?1:4,s=r===o.TextureType.packed,a=r===o.TextureType.unpackedReversed||r===o.TextureType.packed,l=r===o.TextureType.packedLastDimension?n.length-1:void 0,c=r===o.TextureType.packedLastDimension?n.map(((e,t)=>t===n.length-1?4*e:e)):void 0;return(0,t.createTextureLayoutFromShape)(e,n,i,c,{isPacked:s,reverseWH:a,breakAxis:l})},t.calculateTextureWidthAndHeight=(e,n,r)=>{const o=(0,t.createTextureLayoutFromTextureType)(e,n,r);return[o.width,o.height]},t.createTextureLayoutFromShape=(e,t,n=1,o,i)=>{const s=!(!i||!i.isPacked),[a,l]=e.computeTextureWH(s&&o||t,i),c=t.length;let u=t.slice(0);if(0===c&&(u=[1]),1===n)o=t;else if(s){if(4!==n)throw new Error("a packed texture must be 4-channel");o=t,c>0&&(u[c-1]=Math.ceil(u[c-1]/2)),c>1&&(u[c-2]=Math.ceil(u[c-2]/2))}else if(!o)throw new Error("Unpacked shape is needed when using channels > 1");return{width:a,height:l,channels:n,isPacked:s,shape:u,strides:r.ShapeUtil.computeStrides(u),unpackedShape:o,reversedWH:i&&i.reverseWH}}},5702:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureManager=void 0;const r=n(6231);t.TextureManager=class{constructor(e,t,n,r){this.glContext=e,this.layoutStrategy=t,this.profiler=n,this.config=r,this.pendingRead=new Map,r.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(e,t,n,o){const i=this.toEncoderType(e),s=this.glContext.getEncoder(i,t.channels||1,o);if(t.isPacked&&1===o)throw new Error("not implemented");const a=t.width,l=t.height;let c,u;if(this.config.reuseTextures){c=`${a}x${l}_${s.format}_${s.internalFormat}_${s.textureType}`,u=this.inUseTextures.get(c),u||(u=[],this.inUseTextures.set(c,u));const t=this.idleTextures.get(c);if(t&&t.length>0){const r=t.pop();return u.push(r),1===o&&this.glContext.updateTexture(r,a,l,s,this.toTextureData(e,n)),r}}r.Logger.verbose("TextureManager",`Creating new texture of size ${t.width}x${t.height}`);const p=this.glContext.allocateTexture(a,l,s,this.toTextureData(e,n));return this.config.reuseTextures&&(u.push(p),this.textureLookup.set(p,c)),p}readTexture(e,t,n){return n||(n=1),this.profiler.event("backend","TextureManager.readTexture",(()=>{const r=e.shape.reduce(((e,t)=>e*t))*n,o=this.glContext.readTexture(e.texture,e.width,e.height,r,this.toEncoderType(t),n);return this.toTensorData(t,o)}))}async readTextureAsync(e,t,n){const r=e.tensor.dataId;if(n||(n=1),this.pendingRead.has(r)){const e=this.pendingRead.get(r);return new Promise((t=>null==e?void 0:e.push(t)))}return this.profiler.event("backend","TextureManager.readTextureAsync",(async()=>{this.pendingRead.set(r,[]);const o=e.shape.reduce(((e,t)=>e*t))*n;await this.glContext.createAndWaitForFence();const i=this.glContext.readTexture(e.texture,e.width,e.height,o,this.toEncoderType(t),n),s=this.toTensorData(t,i),a=this.pendingRead.get(r);return this.pendingRead.delete(r),null==a||a.forEach((e=>e(s))),s}))}readUint8TextureAsFloat(e){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",(()=>{const t=e.shape.reduce(((e,t)=>e*t)),n=this.glContext.readTexture(e.texture,e.width,e.height,4*t,"byte",4);return new Float32Array(n.buffer,n.byteOffset,t)}))}releaseTexture(e,t){let n;if(this.config.reuseTextures&&(n=this.textureLookup.get(e.texture),n)){t&&this.textureLookup.delete(n);const r=this.inUseTextures.get(n);if(r){const t=r.indexOf(e.texture);if(-1!==t){r.splice(t,1);let o=this.idleTextures.get(n);o||(o=[],this.idleTextures.set(n,o)),o.push(e.texture)}}}n&&!t||(r.Logger.verbose("TextureManager",`Deleting texture of size ${e.width}x${e.height}`),this.glContext.deleteTexture(e.texture))}toTensorData(e,t){switch(e){case"int16":return t instanceof Int16Array?t:Int16Array.from(t);case"int32":return t instanceof Int32Array?t:Int32Array.from(t);case"int8":return t instanceof Int8Array?t:Int8Array.from(t);case"uint16":return t instanceof Uint16Array?t:Uint16Array.from(t);case"uint32":return t instanceof Uint32Array?t:Uint32Array.from(t);case"uint8":case"bool":return t instanceof Uint8Array?t:Uint8Array.from(t);case"float32":return t instanceof Float32Array?t:Float32Array.from(t);case"float64":return t instanceof Float64Array?t:Float64Array.from(t);default:throw new Error(`TensorData type ${e} is not supported`)}}toTextureData(e,t){if(t)return t instanceof Float32Array?t:new Float32Array(t)}toEncoderType(e){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TextureType=void 0,(n=t.TextureType||(t.TextureType={}))[n.unpacked=0]="unpacked",n[n.unpackedReversed=1]="unpackedReversed",n[n.packed=2]="packed",n[n.downloadUint8AsFloat=3]="downloadUint8AsFloat",n[n.packedLastDimension=4]="packedLastDimension"},9390:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getGlChannels=t.getCoordsDataType=t.getSqueezedParams=t.squeezeInputShape=t.generateShaderFuncNameFromInputSamplerNameAtOutCoords=t.generateShaderFuncNameFromInputSamplerName=t.repeatedTry=t.getPackedShape=void 0;const r=n(2517);t.getPackedShape=function(e){const t=e.length;return e.slice(0,t-1).concat(e[t-1]/4)},t.repeatedTry=async function(e,t=(e=>0),n){return new Promise(((r,o)=>{let i=0;const s=()=>{if(e())return void r();i++;const a=t(i);null!=n&&i>=n?o():setTimeout(s,a)};s()}))},t.generateShaderFuncNameFromInputSamplerName=function(e){return(0,r.assert)(void 0!==e&&0!==e.length,(()=>"empty string found for sampler name")),"get"+e.charAt(0).toUpperCase()+e.slice(1)},t.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(e){return(0,r.assert)(void 0!==e&&0!==e.length,(()=>"empty string found for sampler name")),"get"+e.charAt(0).toUpperCase()+e.slice(1)+"AtOutCoords"},t.squeezeInputShape=function(e,t){let n=JSON.parse(JSON.stringify(e));return n=t,n},t.getSqueezedParams=function(e,t){return t.map((t=>e[t])).join(", ")},t.getCoordsDataType=function(e){if(e<=1)return"int";if(2===e)return"ivec2";if(3===e)return"ivec3";if(4===e)return"ivec4";if(5===e)return"ivec5";if(6===e)return"ivec6";throw Error(`GPU for rank ${e} is not yet supported`)},t.getGlChannels=function(e=6){return["x","y","z","w","u","v"].slice(0,e)}},7305:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createNewWebGLContext=t.createWebGLContext=void 0;const r=n(6231),o=n(1713),i={};function s(e){const t=function(){if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas)throw new TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}const e=document.createElement("canvas");return e.width=1,e.height=1,e}();let n;const i={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!e||"webgl2"===e)&&(n=t.getContext("webgl2",i),n))try{return new o.WebGLContext(n,2)}catch(e){r.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${e}`)}if((!e||"webgl"===e)&&(n=t.getContext("webgl",i)||t.getContext("experimental-webgl",i),n))try{return new o.WebGLContext(n,1)}catch(e){r.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${e}`)}throw new Error("WebGL is not supported")}t.createWebGLContext=function e(t){let n;t&&"webgl2"!==t||!("webgl2"in i)?t&&"webgl"!==t||!("webgl"in i)||(n=i.webgl):n=i.webgl2,n=n||s(t),t=t||1===n.version?"webgl":"webgl2";const r=n.gl;return i[t]=n,r.isContextLost()?(delete i[t],e(t)):(r.disable(r.DEPTH_TEST),r.disable(r.STENCIL_TEST),r.disable(r.BLEND),r.disable(r.DITHER),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SAMPLE_COVERAGE),r.enable(r.SCISSOR_TEST),r.enable(r.CULL_FACE),r.cullFace(r.BACK),n)},t.createNewWebGLContext=s},1713:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.WebGLContext=t.linearSearchLastTrue=void 0;const s=n(1670),a=i(n(7769)),l=n(9390);function c(e){let t=0;for(;t<e.length&&e[t]();++t);return t-1}t.linearSearchLastTrue=c,t.WebGLContext=class{constructor(e,t){this.frameBufferBound=!1,this.itemsToPoll=[],this.gl=e,this.version=t,this.getExtensions(),this.vertexbuffer=this.createVertexbuffer(),this.framebuffer=this.createFramebuffer(),this.queryVitalParameters()}allocateTexture(e,t,n,r){const o=this.gl,i=o.createTexture();o.bindTexture(o.TEXTURE_2D,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE);const s=r?n.encode(r,e*t):null;return o.texImage2D(o.TEXTURE_2D,0,n.internalFormat,e,t,0,n.format,n.textureType,s),this.checkError(),i}updateTexture(e,t,n,r,o){const i=this.gl;i.bindTexture(i.TEXTURE_2D,e);const s=r.encode(o,t*n);i.texSubImage2D(i.TEXTURE_2D,0,0,0,t,n,r.format,r.textureType,s),this.checkError()}attachFramebuffer(e,t,n){const r=this.gl;r.bindTexture(r.TEXTURE_2D,e),r.bindFramebuffer(r.FRAMEBUFFER,this.framebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),this.checkError(),r.viewport(0,0,t,n),r.scissor(0,0,t,n)}readTexture(e,t,n,r,o,i){const s=this.gl;i||(i=1),this.frameBufferBound||this.attachFramebuffer(e,t,n);const a=this.getEncoder(o,i),l=a.allocate(t*n);return s.bindTexture(s.TEXTURE_2D,e),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),s.readPixels(0,0,t,n,s.RGBA,a.textureType,l),this.checkError(),a.decode(l,r)}isFramebufferReady(){return!0}getActiveTexture(){const e=this.gl;return"TEXTURE"+(e.getParameter(this.gl.ACTIVE_TEXTURE)-e.TEXTURE0)}getTextureBinding(){return this.gl.getParameter(this.gl.TEXTURE_BINDING_2D)}getFramebufferBinding(){return this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING)}setVertexAttributes(e,t){const n=this.gl;n.vertexAttribPointer(e,3,n.FLOAT,!1,20,0),n.enableVertexAttribArray(e),-1!==t&&(n.vertexAttribPointer(t,2,n.FLOAT,!1,20,12),n.enableVertexAttribArray(t)),this.checkError()}createProgram(e,t){const n=this.gl,r=n.createProgram();return n.attachShader(r,e),n.attachShader(r,t),n.linkProgram(r),r}compileShader(e,t){const n=this.gl,r=n.createShader(t);if(!r)throw new Error(`createShader() returned null with type ${t}`);if(n.shaderSource(r,e),n.compileShader(r),!1===n.getShaderParameter(r,n.COMPILE_STATUS))throw new Error(`Failed to compile shader: ${n.getShaderInfoLog(r)}\nShader source:\n${e}`);return r}deleteShader(e){this.gl.deleteShader(e)}bindTextureToUniform(e,t,n){const r=this.gl;r.activeTexture(r.TEXTURE0+t),this.checkError(),r.bindTexture(r.TEXTURE_2D,e),this.checkError(),r.uniform1i(n,t),this.checkError()}draw(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.checkError()}checkError(){if(s.env.debug){const e=this.gl,t=e.getError();let n="";switch(t){case e.NO_ERROR:return;case e.INVALID_ENUM:n="INVALID_ENUM";break;case e.INVALID_VALUE:n="INVALID_VALUE";break;case e.INVALID_OPERATION:n="INVALID_OPERATION";break;case e.INVALID_FRAMEBUFFER_OPERATION:n="INVALID_FRAMEBUFFER_OPERATION";break;case e.OUT_OF_MEMORY:n="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:n="CONTEXT_LOST_WEBGL";break;default:n=`Unknown WebGL Error: ${t.toString(16)}`}throw new Error(n)}}deleteTexture(e){this.gl.deleteTexture(e)}deleteProgram(e){this.gl.deleteProgram(e)}getEncoder(e,t,n=0){if(2===this.version)return new a.RedFloat32DataEncoder(this.gl,t);switch(e){case"float":return 1===n||this.isRenderFloat32Supported?new a.RGBAFloatDataEncoder(this.gl,t):new a.RGBAFloatDataEncoder(this.gl,t,this.textureHalfFloatExtension.HALF_FLOAT_OES);case"int":throw new Error("not implemented");case"byte":return new a.Uint8DataEncoder(this.gl,t);default:throw new Error(`Invalid dataType: ${e}`)}}clearActiveTextures(){const e=this.gl;for(let t=0;t<this.maxTextureImageUnits;++t)e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,null)}dispose(){if(this.disposed)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteFramebuffer(this.framebuffer),e.bindBuffer(e.ARRAY_BUFFER,null),e.deleteBuffer(this.vertexbuffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.finish(),this.disposed=!0}createDefaultGeometry(){return new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0])}createVertexbuffer(){const e=this.gl,t=e.createBuffer();if(!t)throw new Error("createBuffer() returned null");const n=this.createDefaultGeometry();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW),this.checkError(),t}createFramebuffer(){const e=this.gl.createFramebuffer();if(!e)throw new Error("createFramebuffer returned null");return e}queryVitalParameters(){const e=this.gl;if(this.isFloatTextureAttachableToFrameBuffer=this.checkFloatTextureAttachableToFrameBuffer(),this.isRenderFloat32Supported=this.checkRenderFloat32(),this.isFloat32DownloadSupported=this.checkFloat32Download(),1===this.version&&!this.textureHalfFloatExtension&&!this.isRenderFloat32Supported)throw new Error("both float32 and float16 TextureType are not supported");this.isBlendSupported=!this.isRenderFloat32Supported||this.checkFloat32Blend(),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxTextureImageUnits=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.version}getExtensions(){2===this.version?(this.colorBufferFloatExtension=this.gl.getExtension("EXT_color_buffer_float"),this.disjointTimerQueryWebgl2Extension=this.gl.getExtension("EXT_disjoint_timer_query_webgl2")):(this.textureFloatExtension=this.gl.getExtension("OES_texture_float"),this.textureHalfFloatExtension=this.gl.getExtension("OES_texture_half_float"))}checkFloatTextureAttachableToFrameBuffer(){const e=this.gl,t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);const n=2===this.version?e.RGBA32F:e.RGBA;e.texImage2D(e.TEXTURE_2D,0,n,1,1,0,e.RGBA,e.FLOAT,null);const r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0);const o=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(t),e.deleteFramebuffer(r),o}checkRenderFloat32(){if(2===this.version){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension)return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Download(){if(2===this.version){if(!this.colorBufferFloatExtension)return!1}else{if(!this.textureFloatExtension)return!1;if(!this.gl.getExtension("WEBGL_color_buffer_float"))return!1}return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Blend(){const e=this.gl;let t,n,r,o,i;try{t=e.createTexture(),n=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,t);const s=2===this.version?e.RGBA32F:e.RGBA;return e.texImage2D(e.TEXTURE_2D,0,s,1,1,0,e.RGBA,e.FLOAT,null),e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.enable(e.BLEND),r=e.createShader(e.VERTEX_SHADER),!!r&&(e.shaderSource(r,"void main(){}"),e.compileShader(r),o=e.createShader(e.FRAGMENT_SHADER),!!o&&(e.shaderSource(o,"precision highp float;void main(){gl_FragColor=vec4(0.5);}"),e.compileShader(o),i=e.createProgram(),!!i&&(e.attachShader(i,r),e.attachShader(i,o),e.linkProgram(i),e.useProgram(i),e.drawArrays(e.POINTS,0,1),e.getError()===e.NO_ERROR)))}finally{e.disable(e.BLEND),i&&e.deleteProgram(i),r&&e.deleteShader(r),o&&e.deleteShader(o),n&&(e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteFramebuffer(n)),t&&(e.bindTexture(e.TEXTURE_2D,null),e.deleteTexture(t))}}beginTimer(){if(2===this.version&&this.disjointTimerQueryWebgl2Extension){const e=this.gl,t=this.disjointTimerQueryWebgl2Extension,n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}throw new Error("WebGL1 profiling currently not supported.")}endTimer(){if(2!==this.version||!this.disjointTimerQueryWebgl2Extension)throw new Error("WebGL1 profiling currently not supported");{const e=this.gl,t=this.disjointTimerQueryWebgl2Extension;e.endQuery(t.TIME_ELAPSED_EXT)}}isTimerResultAvailable(e){let t=!1,n=!1;if(2!==this.version||!this.disjointTimerQueryWebgl2Extension)throw new Error("WebGL1 profiling currently not supported");{const r=this.gl,o=this.disjointTimerQueryWebgl2Extension;t=r.getQueryParameter(e,r.QUERY_RESULT_AVAILABLE),n=r.getParameter(o.GPU_DISJOINT_EXT)}return t&&!n}getTimerResult(e){let t=0;if(2!==this.version)throw new Error("WebGL1 profiling currently not supported");{const n=this.gl;t=n.getQueryParameter(e,n.QUERY_RESULT),n.deleteQuery(e)}return t/1e6}async waitForQueryAndGetTime(e){return await(0,l.repeatedTry)((()=>this.isTimerResultAvailable(e))),this.getTimerResult(e)}async createAndWaitForFence(){const e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t;const n=e,r=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),t=null===r?()=>!0:()=>{const e=n.clientWaitSync(r,0,0);return e===n.ALREADY_SIGNALED||e===n.CONDITION_SATISFIED},{query:r,isFencePassed:t}}async pollFence(e){return new Promise((t=>{this.addItemToPoll((()=>e.isFencePassed()),(()=>t()))}))}pollItems(){const e=c(this.itemsToPoll.map((e=>e.isDoneFn)));for(let t=0;t<=e;++t){const{resolveFn:e}=this.itemsToPoll[t];e()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}async addItemToPoll(e,t){this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1||await(0,l.repeatedTry)((()=>(this.pollItems(),0===this.itemsToPoll.length)))}}},1036:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExecutionPlan=void 0;const r=n(6231);class o{constructor(e,t){this.op=e,this.node=t}}t.ExecutionPlan=class{constructor(e,t,n){this.graph=e,this.profiler=n,this.initialize(t)}initialize(e){this.profiler.event("session","ExecutionPlan.initialize",(()=>{const t=this.graph.getNodes();if(t.length!==e.length)throw new Error("The size of nodes and OPs do not match.");this._ops=e.map(((e,n)=>new o(e,t[n]))),this.reset(),this._starter=[],this._ops.forEach(((e,t)=>{let n=!0;for(const t of e.node.inputs)if(!this._values[t]&&-1===this.graph.getInputIndices().indexOf(t)){n=!1;break}n&&this._starter.push(t)}))}))}reset(){this._values=this.graph.getValues().map((e=>e.tensor))}async execute(e,t){return this.profiler.event("session","ExecutionPlan.execute",(async()=>{this.reset();const n=e.createInferenceHandler(),o=this.graph.getInputIndices();if(t.length!==o.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${t.length} expected: ${o.length}`);t.forEach(((e,t)=>{const n=o[t];this._values[n]=e}));const i=this._starter.slice(0),s=this.graph.getValues(),a=this.graph.getNodes();let l=0;for(;l<i.length;){const e=i[l++],t=this._ops[e],o=t.node.inputs.map((e=>this._values[e]));if(-1!==o.indexOf(void 0))throw new Error(`unresolved input detected: op: ${t.node}`);const c=o;r.Logger.verbose("ExecPlan",`Runing op:${t.node.name} (${c.map(((e,n)=>`'${t.node.inputs[n]}': ${e.type}[${e.dims.join(",")}]`)).join(", ")})`);const u=await this.profiler.event("node",t.node.name,(async()=>t.op.impl(n,c,t.op.context)));if(u.length!==t.node.outputs.length)throw new Error("the size of output does not match model definition.");u.forEach(((e,n)=>{const r=t.node.outputs[n];if(this._values[r])throw new Error(`output [${r}] already has value: op:${t.node.name}`);this._values[r]=e}));const p=new Set;u.forEach(((e,n)=>{const r=t.node.outputs[n];for(const e of s[r].to){const t=a[e];let n=!0;for(const e of t.inputs)if(!this._values[e]){n=!1;break}n&&p.add(e)}})),i.push(...p)}const c=[];for(let e=0;e<this.graph.getOutputIndices().length;e++){const t=this.graph.getOutputIndices()[e],n=this._values[t];if(void 0===n)throw new Error(`required output [${t}] does not have value`);0===t?await n.getData():n.data,c.push(n)}return r.Logger.verbose("ExecPlan","disposing of inferenceHandler"),n.dispose(),c}))}}},7070:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Graph=void 0;const r=n(1446),o=n(7778),i=n(9395),s=n(9162),a=n(2517);var l=i.onnxruntime.experimental.fbs;t.Graph={from:(e,t)=>new p(e,t)};class c{constructor(e){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,e&&(this.type=a.ProtoUtil.tensorValueTypeFromProto(e.type.tensorType))}get from(){return this._from}get to(){return this._to}}class u{constructor(e,t){e instanceof r.onnx.NodeProto?(this.name=e.name,this.opType=e.opType,this.attributes=new o.Attribute(e.attribute)):e instanceof l.Node&&(this.name=null!=t?t:e.name(),this.opType=e.opType(),this.attributes=new o.Attribute(a.ProtoUtil.tensorAttributesFromORTFormat(e))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class p{constructor(e,t){if(!e)throw new TypeError("graph is empty");this.buildGraph(e),this.transformGraph(t),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(e){if(e instanceof r.onnx.GraphProto)this.buildGraphFromOnnxFormat(e);else{if(!(e instanceof l.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(e)}}buildGraphFromOnnxFormat(e){const t=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const n=new Map;if(!e.input)throw new Error("missing information in graph: input");const r=[];for(const n of e.input){if(t.has(n.name))throw new Error(`duplicated input name: ${n.name}`);const e=this._allData.push(new c(n))-1;t.set(n.name,e),r.push(n.name)}if(!e.initializer)throw new Error("missing information in graph: initializer");for(const n of e.initializer){let e=t.get(n.name);if(void 0===e){const r=new c;r.type={shape:{dims:a.ProtoUtil.tensorDimsFromProto(n.dims)},tensorType:a.ProtoUtil.tensorDataTypeFromProto(n.dataType)},e=this._allData.push(r)-1,t.set(n.name,e)}this._allData[e]._from=-1,this._allData[e].tensor=s.Tensor.fromProto(n)}for(let e=0;e<this._allData.length;e++)this._allData[e].tensor||(this._allInputIndices.push(e),this._allInputNames.push(r[e]));if(!e.output)throw new Error("missing information in graph: output");for(const n of e.output){if(t.has(n.name))throw new Error(`duplicated output name: ${n.name}`);const e=this._allData.push(new c(n))-1;t.set(n.name,e),this._allOutputIndices.push(e),this._allOutputNames.push(n.name)}if(!e.node)throw new Error("missing information in graph: node");for(const t of e.node){if(!t.name)for(let e=0;;e++){const r=`unnamed_${t.opType}_${e}`;if(!n.has(r)){t.name=r;break}}if(n.has(t.name))throw new Error(`duplicated node name: ${t.name}`);const e=this._nodes.push(new u(t))-1;n.set(t.name,e)}for(let n=0;n<this._nodes.length;n++){const r=this._nodes[n],o=e.node[n];if(!o.output)throw new Error(`missing output for node: ${o.name}`);for(const e of o.output){let i=t.get(e);if(void 0===i&&(i=this._allData.push(new c)-1,t.set(e,i)),r.outputs.push(i),void 0!==this._allData[i]._from)throw new Error(`multiple nodes output to one data value: ${i}`);if(this._allData[i]._from=n,"Constant"===o.opType){if(!o.attribute||1!==o.attribute.length||!o.attribute[0].t)throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(!o.output||1!==o.output.length)throw new Error("missing output or incorrect number of outputs for this Constant operator");r.outputs.pop(),r.executeNode=!1,this._allData[i]._from=-1,this._allData[i].tensor=s.Tensor.fromProto(o.attribute[0].t)}}}for(let n=0;n<this._nodes.length;n++){const r=this._nodes[n],o=e.node[n];if(!o.input)throw new Error(`missing input for node: ${o.name}`);for(const e of o.input){const i=t.get(e);if(void 0===i){if(""===e&&3===o.input.length&&"Resize"===o.opType)continue;throw new Error(`unrecognized input '${e}' for node: ${o.name}`)}r.inputs.push(i),this._allData[i]._to.push(n)}}return!0}buildGraphFromOrtFormat(e){var t,n,r;const o=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const i=new Map,p=[];for(let i=0;i<e.inputsLength();i++){const s=e.inputs(i);if(o.has(s))throw new Error(`duplicated input name: ${s}`);for(let i=0;i<e.nodeArgsLength();i++)if((null===(t=e.nodeArgs(i))||void 0===t?void 0:t.name())===s){const t=new c;if((null===(r=null===(n=e.nodeArgs(i))||void 0===n?void 0:n.type())||void 0===r?void 0:r.valueType())!==l.TypeInfoValue.tensor_type)throw new Error("Unexpected value type for the nodeArg.");const u=e.nodeArgs(i).type().value(new l.TensorTypeAndShape),d=a.ProtoUtil.tensorDataTypeFromProto(u.elemType()),_=u.shape(),h=[];for(let e=0;e<_.dimLength();e++)h.push(a.LongUtil.longToNumber(_.dim(e).value().dimValue()));t.type={shape:{dims:h},tensorType:d};const f=this._allData.push(t)-1;o.set(s,f),p.push(s)}}for(let t=0;t<e.initializersLength();t++){const n=e.initializers(t);let r=o.get(n.name());if(void 0===r){const e=new c,t=a.ProtoUtil.tensorDimsFromORTFormat(n),i=a.ProtoUtil.tensorDataTypeFromProto(n.dataType());e.type={shape:{dims:t},tensorType:i},r=this._allData.push(e)-1,o.set(n.name(),r)}this._allData[r]._from=-1,this._allData[r].tensor=s.Tensor.fromOrtTensor(n)}for(let e=0;e<this._allData.length;e++)this._allData[e].tensor||(this._allInputIndices.push(e),this._allInputNames.push(p[e]));for(let t=0;t<e.outputsLength();t++){const n=e.outputs(t);if(o.has(n))throw new Error(`duplicated output name: ${n}`);const r=this._allData.push(new c)-1;o.set(n,r),this._allOutputIndices.push(r),this._allOutputNames.push(n)}if(!e.nodes)throw new Error("missing information in graph: node");for(let t=0;t<e.nodesLength();t++){const n=e.nodes(t);let r=n.name();if(!r)for(let e=0;r=`unnamed_${n.opType()}_${e}`,i.has(r);e++);if(i.has(r))throw new Error(`duplicated node name: ${r}`);const o=this._nodes.push(new u(n,r))-1;i.set(r,o)}for(let t=0;t<this._nodes.length;t++){const n=this._nodes[t],r=e.nodes(t);if(null==r)throw new Error(`No node exists at index ${t}`);if(0===(null==r?void 0:r.outputsLength()))throw new Error(`missing output for node: ${r.name}`);for(let e=0;e<(null==r?void 0:r.outputsLength());e++){const i=null==r?void 0:r.outputs(e);let a=o.get(i);if(void 0===a&&(a=this._allData.push(new c)-1,o.set(i,a)),n.outputs.push(a),void 0!==this._allData[a]._from)throw new Error(`multiple nodes output to one data value: ${a}`);if(this._allData[a]._from=t,"Constant"===r.opType()){if(1!==r.attributesLength()||!r.attributes(0).t())throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(1!==r.outputsLength())throw new Error("missing output or incorrect number of outputs for this Constant operator");n.outputs.pop(),n.executeNode=!1,this._allData[a]._from=-1,this._allData[a].tensor=s.Tensor.fromOrtTensor(r.attributes(0).t())}}}for(let t=0;t<this._nodes.length;t++){const n=this._nodes[t],r=e.nodes(t);if(0===r.inputsLength())throw new Error(`missing input for node: ${r.name}`);for(let e=0;e<r.inputsLength();e++){const i=r.inputs(e),s=o.get(i);if(void 0===s)throw new Error(`unrecognized input '${i}' for node: ${r.name()}`);n.inputs.push(s),this._allData[s]._to.push(t)}}}checkIsAcyclic(){const e=new Set;this._allInputIndices.forEach((t=>{this._allData[t]._to.forEach((t=>{e.add(t)}))}));const t=Array.from(e),n=new Array(this._nodes.length).fill("white");for(;t.length>0;){const e=t.pop();"gray"===n[e]?n[e]="black":(t.push(e),n[e]="gray",this._nodes[e].outputs.forEach((r=>{const o=this._allData[r];if(void 0!==o.tensor)throw new Error("node outputs should not be initialized");if(o._from!==e)throw new Error("from property of the Value object doesn't match index of Node being processed");o._to.forEach((e=>{if("gray"===n[e])throw new Error("model graph is cyclic");"white"===n[e]&&t.push(e)}))})))}}transformGraph(e){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),e&&e.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let e=0;for(let t=0;t<this._nodes.length;t++)this._nodes[t].executeNode?e>0&&(this._nodes[t].inputs.forEach((n=>{const r=this._allData[n]._to.indexOf(t+e);-1!==r&&(this._allData[n]._to[r]=t)})),this._nodes[t].outputs.forEach((n=>{this._allData[n]._from&&this._allData[n]._from===t+e&&(this._allData[n]._from=t)}))):(e++,this._nodes[t].outputs.forEach((e=>{this._allData[e]._from=-2})),this._nodes.splice(t,1),t--);e=0;for(let t=0;t<this._allData.length;t++)if(-2!==this._allData[t].from||-1!==this._allOutputIndices.indexOf(t+e)){if(e>0){let n=-1;void 0!==this._allData[t].from&&-1!==this._allData[t].from?(n=this._nodes[this._allData[t].from].outputs.indexOf(t+e),-1!==n&&(this._nodes[this._allData[t].from].outputs[n]=t)):(n=this._allInputIndices.indexOf(t+e),-1!==n&&(this._allInputIndices[n]=t)),this._allData[t].to.forEach((r=>{n=this._nodes[r].inputs.indexOf(t+e),-1!==n&&(this._nodes[r].inputs[n]=t)})),0===this._allData[t].to.length&&(n=this._allOutputIndices.indexOf(t+e),-1!==n&&(this._allOutputIndices[n]=t))}}else e++,this._allData.splice(t,1),t--}deleteNode(e){const t=this._nodes[e];if(t.outputs.length>1)for(let e=1;e<t.outputs.length;e++)if(this._allData[t.outputs[e]].to.length>0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ");t.executeNode=!1;const n=t.inputs[0],r=t.outputs[0],o=this._allData[r].to,i=this._allData[n].to.indexOf(e);if(-1===i)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[n].to.splice(i,1),this._allData[r]._to=[];const s=this._allOutputIndices.indexOf(r);if(-1!==s&&(this._allOutputIndices[s]=n),o&&o.length>0)for(const e of o){const t=this._nodes[e].inputs.indexOf(r);if(-1===t)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[e].inputs[t]=n,this._allData[n].to.push(e)}}removeAllDropoutNodes(){let e=0;for(const t of this._nodes){if("Dropout"===t.opType){if(1!==t.inputs.length)throw new Error("Dropout nodes should only contain one input. ");if(1!==t.outputs.length&&2!==t.outputs.length)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(2===t.outputs.length&&0!==this._allData[t.outputs[1]]._to.length)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(e)}e++}}removeAllIdentityNodes(){let e=0;for(const t of this._nodes)"Identity"===t.opType&&this.deleteNode(e),e++}isActivation(e){switch(e.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const e of this._nodes)if("Conv"===e.opType){const t=this._allData[e.outputs[0]]._to;if(1===t.length&&this.isActivation(this._nodes[t[0]])){const n=this._nodes[t[0]];if("Clip"===n.opType)if(1===n.inputs.length)try{e.attributes.set("activation_params","floats",[n.attributes.getFloat("min"),n.attributes.getFloat("max")])}catch(t){e.attributes.set("activation_params","floats",[a.MIN_CLIP,a.MAX_CLIP])}else{if(!(n.inputs.length>=3&&void 0!==this._allData[n.inputs[1]].tensor&&void 0!==this._allData[n.inputs[2]].tensor))continue;e.attributes.set("activation_params","floats",[this._allData[n.inputs[1]].tensor.floatData[0],this._allData[n.inputs[2]].tensor.floatData[0]])}e.attributes.set("activation","string",n.opType),this.deleteNode(t[0])}}}}},6231:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.now=t.Profiler=t.Logger=void 0;const n={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},r={none:new class{log(e,t,n){}},console:new class{log(e,t,n){console.log(`${this.color(e)} ${n?""+n+" ":""}${t}`)}color(e){switch(e){case"verbose":return"v";case"info":return"i";case"warning":return"w";case"error":return"e";case"fatal":return"f";default:throw new Error(`unsupported severity: ${e}`)}}}},o={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let i={"":o};function s(e,t,n,r){if(void 0===t)return o=e,{verbose:s.verbose.bind(null,o),info:s.info.bind(null,o),warning:s.warning.bind(null,o),error:s.error.bind(null,o),fatal:s.fatal.bind(null,o)};if(void 0===n)a(e,t);else if("number"==typeof n&&void 0===r)a(e,t);else if("string"==typeof n&&void 0===r)a(e,n,0,t);else{if("string"!=typeof n||"number"!=typeof r)throw new TypeError("input is valid");a(e,n,0,t)}var o}function a(e,t,o,s){const a=i[s||""]||i[""];n[e]<n[a.minimalSeverity]||(a.logDateTime&&(t=`${(new Date).toISOString()}|${t}`),a.logSourceLocation,r[a.provider].log(e,t,s))}!function(e){function t(e){i={},n("",e||{})}function n(e,n){if("*"===e)t(n);else{const t=i[e]||o;i[e]={provider:n.provider||t.provider,minimalSeverity:n.minimalSeverity||t.minimalSeverity,logDateTime:void 0===n.logDateTime?t.logDateTime:n.logDateTime,logSourceLocation:void 0===n.logSourceLocation?t.logSourceLocation:n.logSourceLocation}}}e.verbose=function(t,n){e("verbose",t,n)},e.info=function(t,n){e("info",t,n)},e.warning=function(t,n){e("warning",t,n)},e.error=function(t,n){e("error",t,n)},e.fatal=function(t,n){e("fatal",t,n)},e.reset=t,e.set=n,e.setWithEnv=function(e){const t={};e.logLevel&&(t.minimalSeverity=e.logLevel),n("",t)}}(s||(s={})),t.Logger=s;class l{constructor(e,t,n,r,o,i){this.category=e,this.name=t,this.startTime=n,this.endCallback=r,this.timer=o,this.ctx=i}end(){return this.endCallback(this)}async checkTimer(){if(void 0===this.ctx||void 0===this.timer)throw new Error("No webgl timer found");return this.ctx.endTimer(),this.ctx.waitForQueryAndGetTime(this.timer)}}class c{constructor(e,t,n,r){this.category=e,this.name=t,this.startTime=n,this.endTime=r}}t.Profiler=class{static create(e){return void 0===e?new this:new this(e.maxNumberEvents,e.flushBatchSize,e.flushIntervalInMilliseconds)}constructor(e,t,n){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=void 0===e?1e4:e,this._flushBatchSize=void 0===t?10:t,this._flushIntervalInMilliseconds=void 0===n?5e3:n}start(){this._started=!0,this._timingEvents=[],this._flushTime=(0,t.now)(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer])}event(e,t,n,r){const o=this._started?this.begin(e,t,r):void 0;let i=!1;const s=n();if(s&&"function"==typeof s.then)return i=!0,new Promise(((e,t)=>{s.then((async t=>{o&&await o.end(),e(t)}),(async e=>{o&&await o.end(),t(e)}))}));if(!i&&o){const e=o.end();if(e&&"function"==typeof e.then)return new Promise(((t,n)=>{e.then((()=>{t(s)}),(e=>{n(e)}))}))}return s}begin(e,n,r){if(!this._started)throw new Error("profiler is not started yet");if(void 0===r){const r=(0,t.now)();return this.flush(r),new l(e,n,r,(e=>this.endSync(e)))}{const t=r.beginTimer();return new l(e,n,0,(async e=>this.end(e)),t,r)}}async end(e){const t=await e.checkTimer();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new c(e.category,e.name,e.startTime,t)),this.flush(t))}endSync(e){const n=(0,t.now)();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new c(e.category,e.name,e.startTime,n)),this.flush(n))}logOneEvent(e){t.Logger.verbose(`Profiler.${e.category}`,`${(e.endTime-e.startTime).toFixed(2)}ms on event '${e.name}' at ${e.endTime.toFixed(2)}`)}flush(e){if(this._timingEvents.length-this._flushPointer>=this._flushBatchSize||e-this._flushTime>=this._flushIntervalInMilliseconds){for(const e=this._flushPointer;this._flushPointer<e+this._flushBatchSize&&this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer]);this._flushTime=(0,t.now)()}}get started(){return this._started}},t.now="undefined"!=typeof performance&&performance.now?()=>performance.now():Date.now},2644:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Model=void 0;const r=n(5686),o=n(1446),i=n(7070),s=n(9395),a=n(2517);var l=s.onnxruntime.experimental.fbs;t.Model=class{constructor(){}load(e,t,n){if(!n)try{return void this.loadFromOnnxFormat(e,t)}catch(e){if(void 0!==n)throw e}this.loadFromOrtFormat(e,t)}loadFromOnnxFormat(e,t){const n=o.onnx.ModelProto.decode(e);if(a.LongUtil.longToNumber(n.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=n.opsetImport.map((e=>({domain:e.domain,version:a.LongUtil.longToNumber(e.version)}))),this._graph=i.Graph.from(n.graph,t)}loadFromOrtFormat(e,t){const n=new r.flatbuffers.ByteBuffer(e),o=l.InferenceSession.getRootAsInferenceSession(n).model();if(a.LongUtil.longToNumber(o.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let e=0;e<o.opsetImportLength();e++){const t=o.opsetImport(e);this._opsets.push({domain:null==t?void 0:t.domain(),version:a.LongUtil.longToNumber(t.version())})}this._graph=i.Graph.from(o.graph(),t)}get graph(){return this._graph}get opsets(){return this._opsets}}},782:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FLOAT_TYPES=t.INT_TYPES=t.NUMBER_TYPES=void 0,t.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],t.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],t.FLOAT_TYPES=["float32","float64"]},1047:(e,t)=>{function n(e,t){if(t.endsWith("+")){const n=Number.parseInt(t.substring(0,t.length-1),10);return!isNaN(n)&&n<=e}if(2===t.split("-").length){const n=t.split("-"),r=Number.parseInt(n[0],10),o=Number.parseInt(n[1],10);return!isNaN(r)&&!isNaN(o)&&r<=e&&e<=o}return Number.parseInt(t,10)===e}Object.defineProperty(t,"__esModule",{value:!0}),t.resolveOperator=void 0,t.resolveOperator=function(e,t,r){for(const o of r){const r=o[0],i=o[1],s=o[2],a=o[3],l=o[4];if(e.opType===r)for(const e of t)if((e.domain===i||"ai.onnx"===e.domain&&""===i)&&n(e.version,s))return{opImpl:a,opInit:l}}throw new TypeError(`cannot resolve operator '${e.opType}' with opsets: ${t.map((e=>`${e.domain||"ai.onnx"} v${e.version}`)).join(", ")}`)}},9395:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.onnxruntime=void 0;const r=n(5686);var o,i;(function(e){let t;!function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.FLOAT=1]="FLOAT",e[e.INT=2]="INT",e[e.STRING=3]="STRING",e[e.TENSOR=4]="TENSOR",e[e.GRAPH=5]="GRAPH",e[e.FLOATS=6]="FLOATS",e[e.INTS=7]="INTS",e[e.STRINGS=8]="STRINGS",e[e.TENSORS=9]="TENSORS",e[e.GRAPHS=10]="GRAPHS",e[e.SPARSE_TENSOR=11]="SPARSE_TENSOR",e[e.SPARSE_TENSORS=12]="SPARSE_TENSORS"}(t=e.AttributeType||(e.AttributeType={}))})((i=(o=t.onnxruntime||(t.onnxruntime={})).experimental||(o.experimental={})).fbs||(i.fbs={})),function(e){!function(e){!function(e){let t;!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.VALUE=1]="VALUE",e[e.PARAM=2]="PARAM"}(t=e.DimensionValueType||(e.DimensionValueType={}))}(e.fbs||(e.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(e){!function(e){let t;!function(e){e[e.UNDEFINED=0]="UNDEFINED",e[e.FLOAT=1]="FLOAT",e[e.UINT8=2]="UINT8",e[e.INT8=3]="INT8",e[e.UINT16=4]="UINT16",e[e.INT16=5]="INT16",e[e.INT32=6]="INT32",e[e.INT64=7]="INT64",e[e.STRING=8]="STRING",e[e.BOOL=9]="BOOL",e[e.FLOAT16=10]="FLOAT16",e[e.DOUBLE=11]="DOUBLE",e[e.UINT32=12]="UINT32",e[e.UINT64=13]="UINT64",e[e.COMPLEX64=14]="COMPLEX64",e[e.COMPLEX128=15]="COMPLEX128",e[e.BFLOAT16=16]="BFLOAT16"}(t=e.TensorDataType||(e.TensorDataType={}))}(e.fbs||(e.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(e){!function(e){let t;!function(e){e[e.Primitive=0]="Primitive",e[e.Fused=1]="Fused"}(t=e.NodeType||(e.NodeType={}))}(e.fbs||(e.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(e){!function(e){let t;!function(e){e[e.NONE=0]="NONE",e[e.tensor_type=1]="tensor_type",e[e.sequence_type=2]="sequence_type",e[e.map_type=3]="map_type"}(t=e.TypeInfoValue||(e.TypeInfoValue={}))}(e.fbs||(e.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsShape(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsShape(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}dim(t,n){let r=this.bb.__offset(this.bb_pos,4);return r?(n||new e.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}dimLength(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__vector_len(this.bb_pos+e):0}static startShape(e){e.startObject(1)}static addDim(e,t){e.addFieldOffset(0,t,0)}static createDimVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startDimVector(e,t){e.startVector(4,t,4)}static endShape(e){return e.endObject()}static createShape(e,t){return n.startShape(e),n.addDim(e,t),n.endShape(e)}}t.Shape=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDimension(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDimension(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}value(t){let n=this.bb.__offset(this.bb_pos,4);return n?(t||new e.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}denotation(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startDimension(e){e.startObject(2)}static addValue(e,t){e.addFieldOffset(0,t,0)}static addDenotation(e,t){e.addFieldOffset(1,t,0)}static endDimension(e){return e.endObject()}static createDimension(e,t,r){return n.startDimension(e),n.addValue(e,t),n.addDenotation(e,r),n.endDimension(e)}}t.Dimension=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDimensionValue(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDimensionValue(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}dimType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):e.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}dimParam(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__string(this.bb_pos+t,e):null}static startDimensionValue(e){e.startObject(3)}static addDimType(t,n){t.addFieldInt8(0,n,e.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(e,t){e.addFieldInt64(1,t,e.createLong(0,0))}static addDimParam(e,t){e.addFieldOffset(2,t,0)}static endDimensionValue(e){return e.endObject()}static createDimensionValue(e,t,r,o){return n.startDimensionValue(e),n.addDimType(e,t),n.addDimValue(e,r),n.addDimParam(e,o),n.endDimensionValue(e)}}t.DimensionValue=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTensorTypeAndShape(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTensorTypeAndShape(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}elemType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):e.experimental.fbs.TensorDataType.UNDEFINED}shape(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new e.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startTensorTypeAndShape(e){e.startObject(2)}static addElemType(t,n){t.addFieldInt32(0,n,e.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(e,t){e.addFieldOffset(1,t,0)}static endTensorTypeAndShape(e){return e.endObject()}static createTensorTypeAndShape(e,t,r){return n.startTensorTypeAndShape(e),n.addElemType(e,t),n.addShape(e,r),n.endTensorTypeAndShape(e)}}t.TensorTypeAndShape=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMapType(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMapType(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}keyType(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):e.experimental.fbs.TensorDataType.UNDEFINED}valueType(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new e.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startMapType(e){e.startObject(2)}static addKeyType(t,n){t.addFieldInt32(0,n,e.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(e,t){e.addFieldOffset(1,t,0)}static endMapType(e){return e.endObject()}static createMapType(e,t,r){return n.startMapType(e),n.addKeyType(e,t),n.addValueType(e,r),n.endMapType(e)}}t.MapType=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSequenceType(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSequenceType(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}elemType(t){let n=this.bb.__offset(this.bb_pos,4);return n?(t||new e.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startSequenceType(e){e.startObject(1)}static addElemType(e,t){e.addFieldOffset(0,t,0)}static endSequenceType(e){return e.endObject()}static createSequenceType(e,t){return n.startSequenceType(e),n.addElemType(e,t),n.endSequenceType(e)}}t.SequenceType=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(e){(e.fbs||(e.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(e,t,n,r){return e.prep(4,12),e.writeInt32(r),e.writeInt32(n),e.writeInt32(t),e.offset()}}}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNodeEdge(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNodeEdge(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}nodeIndex(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb_pos+e):0}inputEdges(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new e.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*t,this.bb):null}inputEdgesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}outputEdges(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new e.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*t,this.bb):null}outputEdgesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}static startNodeEdge(e){e.startObject(3)}static addNodeIndex(e,t){e.addFieldInt32(0,t,0)}static addInputEdges(e,t){e.addFieldOffset(1,t,0)}static startInputEdgesVector(e,t){e.startVector(12,t,4)}static addOutputEdges(e,t){e.addFieldOffset(2,t,0)}static startOutputEdgesVector(e,t){e.startVector(12,t,4)}static endNodeEdge(e){return e.endObject()}static createNodeEdge(e,t,r,o){return n.startNodeEdge(e),n.addNodeIndex(e,t),n.addInputEdges(e,r),n.addOutputEdges(e,o),n.endNodeEdge(e)}}t.NodeEdge=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNode(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNode(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}docString(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}domain(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__string(this.bb_pos+t,e):null}sinceVersion(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt32(this.bb_pos+e):0}index(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readUint32(this.bb_pos+e):0}opType(e){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__string(this.bb_pos+t,e):null}type(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):e.experimental.fbs.NodeType.Primitive}executionProviderType(e){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__string(this.bb_pos+t,e):null}inputs(e,t){let n=this.bb.__offset(this.bb_pos,20);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*e,t):null}inputsLength(){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__vector_len(this.bb_pos+e):0}outputs(e,t){let n=this.bb.__offset(this.bb_pos,22);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*e,t):null}outputsLength(){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.__vector_len(this.bb_pos+e):0}attributes(t,n){let r=this.bb.__offset(this.bb_pos,24);return r?(n||new e.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}attributesLength(){let e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__vector_len(this.bb_pos+e):0}inputArgCounts(e){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+4*e):0}inputArgCountsLength(){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__vector_len(this.bb_pos+e):0}inputArgCountsArray(){let e=this.bb.__offset(this.bb_pos,26);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}implicitInputs(e,t){let n=this.bb.__offset(this.bb_pos,28);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*e,t):null}implicitInputsLength(){let e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__vector_len(this.bb_pos+e):0}static startNode(e){e.startObject(13)}static addName(e,t){e.addFieldOffset(0,t,0)}static addDocString(e,t){e.addFieldOffset(1,t,0)}static addDomain(e,t){e.addFieldOffset(2,t,0)}static addSinceVersion(e,t){e.addFieldInt32(3,t,0)}static addIndex(e,t){e.addFieldInt32(4,t,0)}static addOpType(e,t){e.addFieldOffset(5,t,0)}static addType(t,n){t.addFieldInt32(6,n,e.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(e,t){e.addFieldOffset(7,t,0)}static addInputs(e,t){e.addFieldOffset(8,t,0)}static createInputsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startInputsVector(e,t){e.startVector(4,t,4)}static addOutputs(e,t){e.addFieldOffset(9,t,0)}static createOutputsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startOutputsVector(e,t){e.startVector(4,t,4)}static addAttributes(e,t){e.addFieldOffset(10,t,0)}static createAttributesVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startAttributesVector(e,t){e.startVector(4,t,4)}static addInputArgCounts(e,t){e.addFieldOffset(11,t,0)}static createInputArgCountsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startInputArgCountsVector(e,t){e.startVector(4,t,4)}static addImplicitInputs(e,t){e.addFieldOffset(12,t,0)}static createImplicitInputsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startImplicitInputsVector(e,t){e.startVector(4,t,4)}static endNode(e){return e.endObject()}static createNode(e,t,r,o,i,s,a,l,c,u,p,d,_,h){return n.startNode(e),n.addName(e,t),n.addDocString(e,r),n.addDomain(e,o),n.addSinceVersion(e,i),n.addIndex(e,s),n.addOpType(e,a),n.addType(e,l),n.addExecutionProviderType(e,c),n.addInputs(e,u),n.addOutputs(e,p),n.addAttributes(e,d),n.addInputArgCounts(e,_),n.addImplicitInputs(e,h),n.endNode(e)}}t.Node=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsValueInfo(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsValueInfo(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}docString(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}type(t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new e.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startValueInfo(e){e.startObject(3)}static addName(e,t){e.addFieldOffset(0,t,0)}static addDocString(e,t){e.addFieldOffset(1,t,0)}static addType(e,t){e.addFieldOffset(2,t,0)}static endValueInfo(e){return e.endObject()}static createValueInfo(e,t,r,o){return n.startValueInfo(e),n.addName(e,t),n.addDocString(e,r),n.addType(e,o),n.endValueInfo(e)}}t.ValueInfo=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTypeInfo(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTypeInfo(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}denotation(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}valueType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):e.experimental.fbs.TypeInfoValue.NONE}value(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}static startTypeInfo(e){e.startObject(3)}static addDenotation(e,t){e.addFieldOffset(0,t,0)}static addValueType(t,n){t.addFieldInt8(1,n,e.experimental.fbs.TypeInfoValue.NONE)}static addValue(e,t){e.addFieldOffset(2,t,0)}static endTypeInfo(e){return e.endObject()}static createTypeInfo(e,t,r,o){return n.startTypeInfo(e),n.addDenotation(e,t),n.addValueType(e,r),n.addValue(e,o),n.endTypeInfo(e)}}t.TypeInfo=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(e){!function(e){class t{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsOperatorSetId(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsOperatorSetId(e,n){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(n||new t).__init(e.readInt32(e.position())+e.position(),e)}domain(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}version(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}static startOperatorSetId(e){e.startObject(2)}static addDomain(e,t){e.addFieldOffset(0,t,0)}static addVersion(e,t){e.addFieldInt64(1,t,e.createLong(0,0))}static endOperatorSetId(e){return e.endObject()}static createOperatorSetId(e,n,r){return t.startOperatorSetId(e),t.addDomain(e,n),t.addVersion(e,r),t.endOperatorSetId(e)}}e.OperatorSetId=t}(e.fbs||(e.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTensor(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTensor(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}docString(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}dims(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+8*e):this.bb.createLong(0,0)}dimsLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}dataType(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):e.experimental.fbs.TensorDataType.UNDEFINED}rawData(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint8(this.bb.__vector(this.bb_pos+t)+e):0}rawDataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}rawDataArray(){let e=this.bb.__offset(this.bb_pos,12);return e?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}stringData(e,t){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*e,t):null}stringDataLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}static startTensor(e){e.startObject(6)}static addName(e,t){e.addFieldOffset(0,t,0)}static addDocString(e,t){e.addFieldOffset(1,t,0)}static addDims(e,t){e.addFieldOffset(2,t,0)}static createDimsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startDimsVector(e,t){e.startVector(8,t,8)}static addDataType(t,n){t.addFieldInt32(3,n,e.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(e,t){e.addFieldOffset(4,t,0)}static createRawDataVector(e,t){e.startVector(1,t.length,1);for(let n=t.length-1;n>=0;n--)e.addInt8(t[n]);return e.endVector()}static startRawDataVector(e,t){e.startVector(1,t,1)}static addStringData(e,t){e.addFieldOffset(5,t,0)}static createStringDataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startStringDataVector(e,t){e.startVector(4,t,4)}static endTensor(e){return e.endObject()}static createTensor(e,t,r,o,i,s,a){return n.startTensor(e),n.addName(e,t),n.addDocString(e,r),n.addDims(e,o),n.addDataType(e,i),n.addRawData(e,s),n.addStringData(e,a),n.endTensor(e)}}t.Tensor=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSparseTensor(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSparseTensor(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}values(t){let n=this.bb.__offset(this.bb_pos,4);return n?(t||new e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}indices(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dims(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+8*e):this.bb.createLong(0,0)}dimsLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSparseTensor(e){e.startObject(3)}static addValues(e,t){e.addFieldOffset(0,t,0)}static addIndices(e,t){e.addFieldOffset(1,t,0)}static addDims(e,t){e.addFieldOffset(2,t,0)}static createDimsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startDimsVector(e,t){e.startVector(8,t,8)}static endSparseTensor(e){return e.endObject()}static createSparseTensor(e,t,r,o){return n.startSparseTensor(e),n.addValues(e,t),n.addIndices(e,r),n.addDims(e,o),n.endSparseTensor(e)}}t.SparseTensor=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsAttribute(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsAttribute(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}docString(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}type(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):e.experimental.fbs.AttributeType.UNDEFINED}f(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat32(this.bb_pos+e):0}i(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}s(e){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__string(this.bb_pos+t,e):null}t(t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}g(t){let n=this.bb.__offset(this.bb_pos,18);return n?(t||new e.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}floats(e){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readFloat32(this.bb.__vector(this.bb_pos+t)+4*e):0}floatsLength(){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__vector_len(this.bb_pos+e):0}floatsArray(){let e=this.bb.__offset(this.bb_pos,20);return e?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}ints(e){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+8*e):this.bb.createLong(0,0)}intsLength(){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.__vector_len(this.bb_pos+e):0}strings(e,t){let n=this.bb.__offset(this.bb_pos,24);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*e,t):null}stringsLength(){let e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__vector_len(this.bb_pos+e):0}tensors(t,n){let r=this.bb.__offset(this.bb_pos,26);return r?(n||new e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}tensorsLength(){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__vector_len(this.bb_pos+e):0}graphs(t,n){let r=this.bb.__offset(this.bb_pos,28);return r?(n||new e.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}graphsLength(){let e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__vector_len(this.bb_pos+e):0}static startAttribute(e){e.startObject(13)}static addName(e,t){e.addFieldOffset(0,t,0)}static addDocString(e,t){e.addFieldOffset(1,t,0)}static addType(t,n){t.addFieldInt32(2,n,e.experimental.fbs.AttributeType.UNDEFINED)}static addF(e,t){e.addFieldFloat32(3,t,0)}static addI(e,t){e.addFieldInt64(4,t,e.createLong(0,0))}static addS(e,t){e.addFieldOffset(5,t,0)}static addT(e,t){e.addFieldOffset(6,t,0)}static addG(e,t){e.addFieldOffset(7,t,0)}static addFloats(e,t){e.addFieldOffset(8,t,0)}static createFloatsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addFloat32(t[n]);return e.endVector()}static startFloatsVector(e,t){e.startVector(4,t,4)}static addInts(e,t){e.addFieldOffset(9,t,0)}static createIntsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startIntsVector(e,t){e.startVector(8,t,8)}static addStrings(e,t){e.addFieldOffset(10,t,0)}static createStringsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startStringsVector(e,t){e.startVector(4,t,4)}static addTensors(e,t){e.addFieldOffset(11,t,0)}static createTensorsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startTensorsVector(e,t){e.startVector(4,t,4)}static addGraphs(e,t){e.addFieldOffset(12,t,0)}static createGraphsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startGraphsVector(e,t){e.startVector(4,t,4)}static endAttribute(e){return e.endObject()}static createAttribute(e,t,r,o,i,s,a,l,c,u,p,d,_,h){return n.startAttribute(e),n.addName(e,t),n.addDocString(e,r),n.addType(e,o),n.addF(e,i),n.addI(e,s),n.addS(e,a),n.addT(e,l),n.addG(e,c),n.addFloats(e,u),n.addInts(e,p),n.addStrings(e,d),n.addTensors(e,_),n.addGraphs(e,h),n.endAttribute(e)}}t.Attribute=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsGraph(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsGraph(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}initializers(t,n){let r=this.bb.__offset(this.bb_pos,4);return r?(n||new e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}initializersLength(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__vector_len(this.bb_pos+e):0}nodeArgs(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new e.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodeArgsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}nodes(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new e.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}maxNodeIndex(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readUint32(this.bb_pos+e):0}nodeEdges(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new e.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}nodeEdgesLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}inputs(e,t){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*e,t):null}inputsLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}outputs(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*e,t):null}outputsLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}sparseInitializers(t,n){let r=this.bb.__offset(this.bb_pos,18);return r?(n||new e.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}sparseInitializersLength(){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__vector_len(this.bb_pos+e):0}static startGraph(e){e.startObject(8)}static addInitializers(e,t){e.addFieldOffset(0,t,0)}static createInitializersVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startInitializersVector(e,t){e.startVector(4,t,4)}static addNodeArgs(e,t){e.addFieldOffset(1,t,0)}static createNodeArgsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startNodeArgsVector(e,t){e.startVector(4,t,4)}static addNodes(e,t){e.addFieldOffset(2,t,0)}static createNodesVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startNodesVector(e,t){e.startVector(4,t,4)}static addMaxNodeIndex(e,t){e.addFieldInt32(3,t,0)}static addNodeEdges(e,t){e.addFieldOffset(4,t,0)}static createNodeEdgesVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startNodeEdgesVector(e,t){e.startVector(4,t,4)}static addInputs(e,t){e.addFieldOffset(5,t,0)}static createInputsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startInputsVector(e,t){e.startVector(4,t,4)}static addOutputs(e,t){e.addFieldOffset(6,t,0)}static createOutputsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startOutputsVector(e,t){e.startVector(4,t,4)}static addSparseInitializers(e,t){e.addFieldOffset(7,t,0)}static createSparseInitializersVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startSparseInitializersVector(e,t){e.startVector(4,t,4)}static endGraph(e){return e.endObject()}static createGraph(e,t,r,o,i,s,a,l,c){return n.startGraph(e),n.addInitializers(e,t),n.addNodeArgs(e,r),n.addNodes(e,o),n.addMaxNodeIndex(e,i),n.addNodeEdges(e,s),n.addInputs(e,a),n.addOutputs(e,l),n.addSparseInitializers(e,c),n.endGraph(e)}}t.Graph=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsModel(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsModel(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}irVersion(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}opsetImport(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new e.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}opsetImportLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}producerName(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__string(this.bb_pos+t,e):null}producerVersion(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__string(this.bb_pos+t,e):null}domain(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__string(this.bb_pos+t,e):null}modelVersion(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readInt64(this.bb_pos+e):this.bb.createLong(0,0)}docString(e){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__string(this.bb_pos+t,e):null}graph(t){let n=this.bb.__offset(this.bb_pos,18);return n?(t||new e.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}graphDocString(e){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__string(this.bb_pos+t,e):null}static startModel(e){e.startObject(9)}static addIrVersion(e,t){e.addFieldInt64(0,t,e.createLong(0,0))}static addOpsetImport(e,t){e.addFieldOffset(1,t,0)}static createOpsetImportVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startOpsetImportVector(e,t){e.startVector(4,t,4)}static addProducerName(e,t){e.addFieldOffset(2,t,0)}static addProducerVersion(e,t){e.addFieldOffset(3,t,0)}static addDomain(e,t){e.addFieldOffset(4,t,0)}static addModelVersion(e,t){e.addFieldInt64(5,t,e.createLong(0,0))}static addDocString(e,t){e.addFieldOffset(6,t,0)}static addGraph(e,t){e.addFieldOffset(7,t,0)}static addGraphDocString(e,t){e.addFieldOffset(8,t,0)}static endModel(e){return e.endObject()}static createModel(e,t,r,o,i,s,a,l,c,u){return n.startModel(e),n.addIrVersion(e,t),n.addOpsetImport(e,r),n.addProducerName(e,o),n.addProducerVersion(e,i),n.addDomain(e,s),n.addModelVersion(e,a),n.addDocString(e,l),n.addGraph(e,c),n.addGraphDocString(e,u),n.endModel(e)}}t.Model=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(e){!function(e){class t{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKernelCreateInfos(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKernelCreateInfos(e,n){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(n||new t).__init(e.readInt32(e.position())+e.position(),e)}nodeIndices(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb.__vector(this.bb_pos+t)+4*e):0}nodeIndicesLength(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__vector_len(this.bb_pos+e):0}nodeIndicesArray(){let e=this.bb.__offset(this.bb_pos,4);return e?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}kernelDefHashes(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint64(this.bb.__vector(this.bb_pos+t)+8*e):this.bb.createLong(0,0)}kernelDefHashesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}static startKernelCreateInfos(e){e.startObject(2)}static addNodeIndices(e,t){e.addFieldOffset(0,t,0)}static createNodeIndicesVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startNodeIndicesVector(e,t){e.startVector(4,t,4)}static addKernelDefHashes(e,t){e.addFieldOffset(1,t,0)}static createKernelDefHashesVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startKernelDefHashesVector(e,t){e.startVector(8,t,8)}static endKernelCreateInfos(e){return e.endObject()}static createKernelCreateInfos(e,n,r){return t.startKernelCreateInfos(e),t.addNodeIndices(e,n),t.addKernelDefHashes(e,r),t.endKernelCreateInfos(e)}}e.KernelCreateInfos=t}(e.fbs||(e.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSubGraphSessionState(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSubGraphSessionState(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}graphId(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}sessionState(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new e.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startSubGraphSessionState(e){e.startObject(2)}static addGraphId(e,t){e.addFieldOffset(0,t,0)}static addSessionState(e,t){e.addFieldOffset(1,t,0)}static endSubGraphSessionState(e){let t=e.endObject();return e.requiredField(t,4),t}static createSubGraphSessionState(e,t,r){return n.startSubGraphSessionState(e),n.addGraphId(e,t),n.addSessionState(e,r),n.endSubGraphSessionState(e)}}t.SubGraphSessionState=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSessionState(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSessionState(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}kernels(t){let n=this.bb.__offset(this.bb_pos,4);return n?(t||new e.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}subGraphSessionStates(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new e.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}subGraphSessionStatesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSessionState(e){e.startObject(2)}static addKernels(e,t){e.addFieldOffset(0,t,0)}static addSubGraphSessionStates(e,t){e.addFieldOffset(1,t,0)}static createSubGraphSessionStatesVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startSubGraphSessionStatesVector(e,t){e.startVector(4,t,4)}static endSessionState(e){return e.endObject()}static createSessionState(e,t,r){return n.startSessionState(e),n.addKernels(e,t),n.addSubGraphSessionStates(e,r),n.endSessionState(e)}}t.SessionState=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={})),function(e){!function(t){!function(t){class n{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInferenceSession(e,t){return(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInferenceSession(e,t){return e.setPosition(e.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(t||new n).__init(e.readInt32(e.position())+e.position(),e)}static bufferHasIdentifier(e){return e.__has_identifier("ORTM")}ortVersion(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}model(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new e.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}sessionState(t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new e.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startInferenceSession(e){e.startObject(3)}static addOrtVersion(e,t){e.addFieldOffset(0,t,0)}static addModel(e,t){e.addFieldOffset(1,t,0)}static addSessionState(e,t){e.addFieldOffset(2,t,0)}static endInferenceSession(e){return e.endObject()}static finishInferenceSessionBuffer(e,t){e.finish(t,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(e,t){e.finish(t,"ORTM",!0)}static createInferenceSession(e,t,r,o){return n.startInferenceSession(e),n.addOrtVersion(e,t),n.addModel(e,r),n.addSessionState(e,o),n.endInferenceSession(e)}}t.InferenceSession=n}(t.fbs||(t.fbs={}))}(e.experimental||(e.experimental={}))}(t.onnxruntime||(t.onnxruntime={}))},7448:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OnnxjsSessionHandler=void 0;const r=n(1670),o=n(9162);t.OnnxjsSessionHandler=class{constructor(e){this.session=e,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(e,t,n){const i=new Map;for(const t in e)if(Object.hasOwnProperty.call(e,t)){const n=e[t];i.set(t,new o.Tensor(n.dims,n.type,void 0,void 0,n.data))}const s=await this.session.run(i),a={};return s.forEach(((e,t)=>{a[t]=new r.Tensor(e.type,e.data,e.dims)})),a}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Session=void 0;const r=n(7067),o=n(1296),i=n(7091),s=n(1036),a=n(6231),l=n(2644);t.Session=class{constructor(e={}){this._initialized=!1,this.backendHint=e.backendHint,this.profiler=a.Profiler.create(e.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(e,t,n){await this.profiler.event("session","Session.loadModel",(async()=>{const s=await(0,i.resolveBackend)(this.backendHint);if(this.sessionHandler=s.createSessionHandler(this.context),this._model=new l.Model,"string"==typeof e){const t=e.endsWith(".ort");if("undefined"==typeof fetch){const n=await(0,o.promisify)(r.readFile)(e);this.initialize(n,t)}else{const n=await fetch(e),r=await n.arrayBuffer();this.initialize(new Uint8Array(r),t)}}else if(ArrayBuffer.isView(e))this.initialize(e);else{const r=new Uint8Array(e,t||0,n||e.byteLength);this.initialize(r)}}))}initialize(e,t){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",(()=>{const n=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(e,n,t),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new s.ExecutionPlan(this._model.graph,this._ops,this.profiler)})),this._initialized=!0}async run(e){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",(async()=>{const t=this.normalizeAndValidateInputs(e),n=await this._executionPlan.execute(this.sessionHandler,t);return this.createOutput(n)}))}normalizeAndValidateInputs(e){const t=this._model.graph.getInputNames();if(Array.isArray(e)){if(e.length!==t.length)throw new Error(`incorrect input array length: expected ${t.length} but got ${e.length}`)}else{if(e.size!==t.length)throw new Error(`incorrect input map size: expected ${t.length} but got ${e.size}`);const n=new Array(e.size);let r=0;for(let o=0;o<t.length;++o){const i=e.get(t[o]);if(!i)throw new Error(`missing input tensor for: '${name}'`);n[r++]=i}e=n}if(this.context.graphInputTypes&&0!==this.context.graphInputTypes.length&&this.context.graphInputDims&&0!==this.context.graphInputDims.length)this.validateInputTensorDims(this.context.graphInputDims,e,!1);else{const t=this._model.graph.getInputIndices(),n=this._model.graph.getValues(),r=new Array(t.length);for(let o=0;o<t.length;++o){const i=n[t[o]];r[o]=i.type.shape.dims,this.context.graphInputTypes.push(i.type.tensorType),this.context.graphInputDims.push(e[o].dims)}this.validateInputTensorDims(r,e,!0)}return this.validateInputTensorTypes(this.context.graphInputTypes,e),e}validateInputTensorTypes(e,t){for(let n=0;n<t.length;n++){const r=e[n],o=t[n].type;if(r!==o)throw new Error(`input tensor[${n}] check failed: expected type '${r}' but got ${o}`)}}validateInputTensorDims(e,t,n){for(let r=0;r<t.length;r++){const o=e[r],i=t[r].dims;if(!this.compareTensorDims(o,i,n))throw new Error(`input tensor[${r}] check failed: expected shape '[${o.join(",")}]' but got [${i.join(",")}]`)}}compareTensorDims(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r]&&(!n||0!==e[r]))return!1;return!0}createOutput(e){const t=this._model.graph.getOutputNames();if(e.length!==t.length)throw new Error("expected number of outputs do not match number of generated outputs");const n=new Map;for(let r=0;r<t.length;++r)n.set(t[r],e[r]);return n}initializeOps(e){const t=e.getNodes();this._ops=new Array(t.length);for(let n=0;n<t.length;n++)this._ops[n]=this.sessionHandler.resolve(t[n],this._model.opsets,e)}}},9162:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Tensor=void 0;const o=n(3442),i=r(n(3720)),s=n(1446),a=n(9395),l=n(2517);var c=a.onnxruntime.experimental.fbs;class u{get data(){if(void 0===this.cache){const e=this.dataProvider(this.dataId);if(e.length!==this.size)throw new Error("Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.");this.cache=e}return this.cache}get stringData(){if("string"!==this.type)throw new TypeError("data type is not string");return this.data}get integerData(){switch(this.type){case"uint8":case"int8":case"uint16":case"int16":case"int32":case"uint32":case"bool":return this.data;default:throw new TypeError("data type is not integer (uint8, int8, uint16, int16, int32, uint32, bool)")}}get floatData(){switch(this.type){case"float32":case"float64":return this.data;default:throw new TypeError("data type is not float (float32, float64)")}}get numberData(){if("string"!==this.type)return this.data;throw new TypeError("type cannot be non-number (string)")}get(e){return this.data[l.ShapeUtil.indicesToOffset(e,this.strides)]}set(e,t){this.data[l.ShapeUtil.indicesToOffset(e,this.strides)]=t}async getData(){return void 0===this.cache&&(this.cache=await this.asyncDataProvider(this.dataId)),this.cache}get strides(){return this._strides||(this._strides=l.ShapeUtil.computeStrides(this.dims)),this._strides}constructor(e,t,n,r,i,s=o.Guid.create()){this.dims=e,this.type=t,this.dataProvider=n,this.asyncDataProvider=r,this.cache=i,this.dataId=s,this.size=l.ShapeUtil.validateDimsAndCalcSize(e);const a=this.size,c=void 0===n&&void 0===r&&void 0===i;if(void 0!==i&&i.length!==a)throw new RangeError("Input dims doesn't match data length.");if("string"===t){if(!(void 0===i||Array.isArray(i)&&i.every((e=>"string"==typeof e))))throw new TypeError("cache should be a string array");c&&(this.cache=new Array(a))}else{if(void 0!==i){const e=d(t);if(!(i instanceof e))throw new TypeError(`cache should be type ${e.name}`)}if(c){const e=new ArrayBuffer(a*function(e){switch(e){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${e}`)}}(t));this.cache=function(e,t){return new(d(t))(e)}(e,t)}}}static fromProto(e){if(!e)throw new Error("cannot construct Value from an empty tensor");const t=l.ProtoUtil.tensorDataTypeFromProto(e.dataType),n=l.ProtoUtil.tensorDimsFromProto(e.dims),r=new u(n,t);if("string"===t)e.stringData.forEach(((e,t)=>{r.data[t]=(0,l.decodeUtf8String)(e)}));else if(e.rawData&&"number"==typeof e.rawData.byteLength&&e.rawData.byteLength>0){const t=r.data,n=new DataView(e.rawData.buffer,e.rawData.byteOffset,e.rawData.byteLength),o=p(e.dataType),i=e.rawData.byteLength/o;if(e.rawData.byteLength%o!=0)throw new Error("invalid buffer length");if(t.length!==i)throw new Error("buffer length mismatch");for(let r=0;r<i;r++){const i=h(n,e.dataType,r*o);t[r]=i}}else{let t;switch(e.dataType){case s.onnx.TensorProto.DataType.FLOAT:t=e.floatData;break;case s.onnx.TensorProto.DataType.INT32:case s.onnx.TensorProto.DataType.INT16:case s.onnx.TensorProto.DataType.UINT16:case s.onnx.TensorProto.DataType.INT8:case s.onnx.TensorProto.DataType.UINT8:case s.onnx.TensorProto.DataType.BOOL:t=e.int32Data;break;case s.onnx.TensorProto.DataType.INT64:t=e.int64Data;break;case s.onnx.TensorProto.DataType.DOUBLE:t=e.doubleData;break;case s.onnx.TensorProto.DataType.UINT32:case s.onnx.TensorProto.DataType.UINT64:t=e.uint64Data;break;default:throw new Error("unspecific error")}if(null==t)throw new Error("failed to populate data from a tensorproto value");const n=r.data;if(n.length!==t.length)throw new Error("array length mismatch");for(let r=0;r<t.length;r++){const o=t[r];i.default.isLong(o)?n[r]=_(o,e.dataType):n[r]=o}}return r}static fromData(e,t,n){return new u(t,n,void 0,void 0,e)}static fromOrtTensor(e){if(!e)throw new Error("cannot construct Value from an empty tensor");const t=l.ProtoUtil.tensorDimsFromORTFormat(e),n=l.ProtoUtil.tensorDataTypeFromProto(e.dataType()),r=new u(t,n);if("string"===n)for(let t=0;t<e.stringDataLength();t++)r.data[t]=e.stringData(t);else if(e.rawDataArray()&&"number"==typeof e.rawDataLength()&&e.rawDataLength()>0){const t=r.data,n=new DataView(e.rawDataArray().buffer,e.rawDataArray().byteOffset,e.rawDataLength()),o=p(e.dataType()),i=e.rawDataLength()/o;if(e.rawDataLength()%o!=0)throw new Error("invalid buffer length");if(t.length!==i)throw new Error("buffer length mismatch");for(let r=0;r<i;r++){const i=h(n,e.dataType(),r*o);t[r]=i}}return r}}function p(e){switch(e){case s.onnx.TensorProto.DataType.UINT8:case s.onnx.TensorProto.DataType.INT8:case s.onnx.TensorProto.DataType.BOOL:return 1;case s.onnx.TensorProto.DataType.UINT16:case s.onnx.TensorProto.DataType.INT16:return 2;case s.onnx.TensorProto.DataType.FLOAT:case s.onnx.TensorProto.DataType.INT32:case s.onnx.TensorProto.DataType.UINT32:return 4;case s.onnx.TensorProto.DataType.INT64:case s.onnx.TensorProto.DataType.DOUBLE:case s.onnx.TensorProto.DataType.UINT64:return 8;default:throw new Error(`cannot calculate sizeof() on type ${s.onnx.TensorProto.DataType[e]}`)}}function d(e){switch(e){case"bool":case"uint8":return Uint8Array;case"int8":return Int8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:throw new Error("unspecified error")}}function _(e,t){if(t===s.onnx.TensorProto.DataType.INT64||t===c.TensorDataType.INT64){if(e.greaterThanOrEqual(2147483648)||e.lessThan(-2147483648))throw new TypeError("int64 is not supported")}else{if(t!==s.onnx.TensorProto.DataType.UINT32&&t!==c.TensorDataType.UINT32&&t!==s.onnx.TensorProto.DataType.UINT64&&t!==c.TensorDataType.UINT64)throw new TypeError(`not a LONG type: ${s.onnx.TensorProto.DataType[t]}`);if(e.greaterThanOrEqual(4294967296)||e.lessThan(0))throw new TypeError("uint64 is not supported")}return e.toNumber()}function h(e,t,n){switch(t){case s.onnx.TensorProto.DataType.BOOL:case s.onnx.TensorProto.DataType.UINT8:return e.getUint8(n);case s.onnx.TensorProto.DataType.INT8:return e.getInt8(n);case s.onnx.TensorProto.DataType.UINT16:return e.getUint16(n,!0);case s.onnx.TensorProto.DataType.INT16:return e.getInt16(n,!0);case s.onnx.TensorProto.DataType.FLOAT:return e.getFloat32(n,!0);case s.onnx.TensorProto.DataType.INT32:return e.getInt32(n,!0);case s.onnx.TensorProto.DataType.UINT32:return e.getUint32(n,!0);case s.onnx.TensorProto.DataType.INT64:return _(i.default.fromBits(e.getUint32(n,!0),e.getUint32(n+4,!0),!1),t);case s.onnx.TensorProto.DataType.DOUBLE:return e.getFloat64(n,!0);case s.onnx.TensorProto.DataType.UINT64:return _(i.default.fromBits(e.getUint32(n,!0),e.getUint32(n+4,!0),!0),t);default:throw new Error(`cannot read from DataView for type ${s.onnx.TensorProto.DataType[t]}`)}}t.Tensor=u},2517:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeUtf8String=t.MAX_CLIP=t.MIN_CLIP=t.PoolConvUtil=t.ReduceUtil=t.SplitUtil=t.MathUtil=t.ShapeUtil=t.LongUtil=t.ProtoUtil=t.GemmUtil=t.arrayCopyHelper=t.BroadcastUtil=t.MatMulUtil=t.ArrayUtil=t.assert=t.checkInputsShape=void 0;const o=n(5686),i=r(n(3720)),s=n(1446),a=n(9162);t.checkInputsShape=function(e,...t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].dims||e[n].dims.length!==t[n])return!1;return!0},t.assert=function(e,t){if(!e)throw new Error("string"==typeof t?t:t())},t.ArrayUtil=class{static arraysEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}};class l{static preprocessInputShapes(e,t){return[1===e.length?[1,e[0]]:e,1===t.length?[t[0],1]:t]}static postprocessOutputShape(e,t,n){1===t&&e.splice(e.length-2,1),1===n&&e.pop()}static calcMatMulShape(e,t){return e[1]!==t[0]?void 0:[e[0],t[1]]}}t.MatMulUtil=l;class c{static calcShape(e,t,n=!1){const r=e.length,o=t.length;if(0===r)return t;if(0===o)return e;const i=Math.max(e.length,t.length),s=new Array(i);if(n){if(r<2||o<2)return;const n=l.calcMatMulShape([e[r-2],e[r-1]],[t[o-2],t[o-1]]);if(void 0===n)return;[s[i-2],s[i-1]]=n}for(let a=n?3:1;a<=i;a++){const n=r-a<0?1:e[r-a],l=o-a<0?1:t[o-a];if(n!==l&&n>1&&l>1)return;s[i-a]=Math.max(n,l)}return s}static index(e,t){const n=new Array(t.length);return c.fillIndex(e,t,n),n}static fillIndex(e,t,n){const r=e.length-t.length;for(let o=0;o<t.length;o++)n[o]=e[r+o]%t[o]}static calc(e,t,n,r,o){const i=c.calcShape(e.dims,t.dims);if(i){if(r&&!d.areEqual(i,e.dims))return;const s=d.size(i),l=r?e:new a.Tensor(i,o||e.type);if(0===i.length)l.set([],n(e.get([]),t.get([])));else{const r=new Array(i.length),o=new Array(e.dims.length),a=new Array(t.dims.length);let u,p=0,d=0,_=!1,h=!1;0===e.dims.length&&(p=e.get([]),_=!0),0===t.dims.length&&(d=t.get([]),h=!0);for(let f=0;f<s;f++){u=f;for(let e=i.length-1;e>=0;e--)r[e]=u%i[e],u=Math.floor(u/i[e]);_||(c.fillIndex(r,e.dims,o),p=e.get(o)),h||(c.fillIndex(r,t.dims,a),d=t.get(a)),l.set(r,n(p,d))}}return l}}static isValidBroadcast(e,t){const n=e.length,r=t.length;if(n>r)return!1;for(let o=1;o<=n;o++)if(1!==e[n-o]&&e[n-o]!==t[r-o])return!1;return!0}static getBroadcastDims(e,t){const n=e.length,r=[];for(let o=0;o<n;o++){const i=n-1-o,s=e[i]||1;(t[t.length-1-o]||1)>1&&1===s&&r.unshift(i)}return r}}t.BroadcastUtil=c,t.arrayCopyHelper=function(e,t,n,r,o){if(r<0||r>=t.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=e.length)throw new Error("targetIndex out of bounds");if(r+o>t.length)throw new Error("source indices to be copied are outside bounds");if(n+o>e.length)throw new Error("target array is too small to hold result");for(let i=0;i<o;i++)e[n+i]=t[r+i]},t.GemmUtil=class{static getShapeOfGemmResult(e,t,n,r,o){if(2!==e.length||2!==n.length)throw new Error("shape need to be of size 2");let i,s,a;t?(i=e[1],s=e[0]):(i=e[0],s=e[1]);let l=-1;if(r?(a=n[0],l=1):(a=n[1],l=0),n[l]!==s)throw new Error("dimension mismatch");if(i<=0||a<=0||s<=0)throw new Error("invalid shape specified");if(o&&!c.isValidBroadcast(o,[i,a]))throw new Error("gemm: invalid bias shape for broadcast");return[i,a,s]}};class u{static tensorDataTypeFromProto(e){switch(e){case s.onnx.TensorProto.DataType.INT8:return"int8";case s.onnx.TensorProto.DataType.UINT8:return"uint8";case s.onnx.TensorProto.DataType.BOOL:return"bool";case s.onnx.TensorProto.DataType.INT16:return"int16";case s.onnx.TensorProto.DataType.UINT16:return"uint16";case s.onnx.TensorProto.DataType.INT32:return"int32";case s.onnx.TensorProto.DataType.UINT32:return"uint32";case s.onnx.TensorProto.DataType.FLOAT:return"float32";case s.onnx.TensorProto.DataType.DOUBLE:return"float64";case s.onnx.TensorProto.DataType.STRING:return"string";case s.onnx.TensorProto.DataType.INT64:return"int32";case s.onnx.TensorProto.DataType.UINT64:return"uint32";default:throw new Error(`unsupported data type: ${s.onnx.TensorProto.DataType[e]}`)}}static tensorDataTypeStringToEnum(e){switch(e){case"int8":return s.onnx.TensorProto.DataType.INT8;case"uint8":return s.onnx.TensorProto.DataType.UINT8;case"bool":return s.onnx.TensorProto.DataType.BOOL;case"int16":return s.onnx.TensorProto.DataType.INT16;case"uint16":return s.onnx.TensorProto.DataType.UINT16;case"int32":return s.onnx.TensorProto.DataType.INT32;case"uint32":return s.onnx.TensorProto.DataType.UINT32;case"float32":return s.onnx.TensorProto.DataType.FLOAT;case"float64":return s.onnx.TensorProto.DataType.DOUBLE;case"string":return s.onnx.TensorProto.DataType.STRING;case"int64":return s.onnx.TensorProto.DataType.INT64;case"uint64":return s.onnx.TensorProto.DataType.UINT64;default:throw new Error(`unsupported data type: ${e}`)}}static tensorDimsFromProto(e){return e.map((e=>i.default.isLong(e)?e.toNumber():e))}static tensorValueTypeFromProto(e){return{tensorType:u.tensorDataTypeFromProto(e.elemType),shape:{dims:u.tensorDimsFromProto(e.shape.dim.map((e=>e.dimValue)))}}}static tensorDimsFromORTFormat(e){const t=[];for(let n=0;n<e.dimsLength();n++)t.push(p.longToNumber(e.dims(n)));return t}static tensorAttributesFromORTFormat(e){const t=[];for(let n=0;n<e.attributesLength();n++)t.push(e.attributes(n));return t}}t.ProtoUtil=u;class p{static longToNumber(e,t){return i.default.isLong(e)?e.toNumber():e instanceof o.flatbuffers.Long?i.default.fromValue({low:e.low,high:e.high,unsigned:null!=t&&t}).toNumber():e}static isLong(e){return i.default.isLong(e)||e instanceof o.flatbuffers.Long}}t.LongUtil=p;class d{static size(e){return d.getSizeFromDimensionRange(e,0,e.length)}static sizeFromDimension(e,t){if(t<0||t>e.length)throw new Error(`invalid dimension of ${t} for sizeFromDimension as Tensor has ${e.length} dimensions.`);return d.getSizeFromDimensionRange(e,t,e.length)}static sizeToDimension(e,t){if(t<0||t>e.length)throw new Error(`invalid dimension of ${t} for sizeToDimension as Tensor has ${e.length} dimensions.`);return d.getSizeFromDimensionRange(e,0,t)}static getSizeFromDimensionRange(e,t,n){let r=1;for(let o=t;o<n;o++){if(e[o]<=0)throw new Error("cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.");r*=e[o]}return r}static computeStrides(e){const t=e.length;if(0===t)return[];if(1===t)return[1];const n=new Array(t);n[t-1]=1,n[t-2]=e[t-1];for(let r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n}static transpose(e){return e.slice().reverse()}static indicesToOffset(e,t,n){void 0===n&&(n=e.length);let r=0;for(let o=0;o<n;++o)r+=t[o]*e[o];return r}static offsetToIndices(e,t){const n=t.length;if(0===n)return[];if(1===n)return[e*t[0]];const r=new Array(t.length);for(let n=0;n<r.length-1;++n)r[n]=Math.floor(e/t[n]),e-=r[n]*t[n];return r[r.length-1]=e,r}static normalizeAxis(e,t){if(e<-t&&e>=t)throw new Error("unsupported axis for this operation.");return e<0?e+t:e}static normalizeAxes(e,t){return e.map((e=>this.normalizeAxis(e,t)))}static incrementIndex(e,t,n){if(0===t.length||0===e.length)throw new Error("Index incrementing unsupported for scalar Tensor");if(void 0===n)n=t.length;else if(n<=0||n>t.length)throw new Error("Incorrect axis to increment on");for(let r=n-1;r>=0&&(e[r]++,!(e[r]<t[r]));--r)e[r]=0}static calculateReshapedDims(e,t){if(0===t.length){if(0===e.length||1===d.size(e))return[];throw new Error("cannot reshape to a scalar Tensor")}const n=t.length,r=new Array(n);let o=-1,i=1;for(let s=0;s<n;s++){if(t[s]<-1)throw new Error("a dimension in shape hints cannot be less than -1");if(-1===t[s]){if(-1!==o)throw new Error("at most one dimension in shape hints can be -1");o=s}else{if(0===t[s]){if(s>=e.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");r[s]=e[s]}else r[s]=t[s];i*=r[s]}}const s=d.size(e);if(-1!==o){if(s%i!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${e}] Output shape: [${t}]`);r[o]=s/i}else if(i!==s)throw new Error("reshapedDims and originalDims don't have matching sizes");return r}static sortBasedOnPerm(e,t){return t?t.map((t=>e[t])):e.slice().reverse()}static padShape(e,t){const n=e.length;return e.map(((e,r)=>e+t[r]+t[r+n]))}static areEqual(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))}static validateDimsAndCalcSize(e){if(e.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let t=1;for(const n of e){if(!Number.isInteger(n))throw new TypeError(`Invalid shape: ${n} is not an integer`);if(n<0||n>2147483647)throw new TypeError(`Invalid shape: length ${n} is not allowed`);t*=n}return t}static flattenShape(e,t){t<0&&(t+=e.length);const n=e.reduce(((e,t)=>e*t),1),r=e.slice(t).reduce(((e,t)=>e*t),1);return[n/r,r]}static squeezeShape(e,t){const n=new Array;t=d.normalizeAxes(t,e.length);for(let r=0;r<e.length;r++){const o=t.indexOf(r)>=0;if(o&&1!==e[r])throw new Error("squeeze an axis of size different than 1");(0===t.length&&e[r]>1||t.length>0&&!o)&&n.push(e[r])}return n}static unsqueezeShape(e,t){const n=new Array(e.length+t.length);n.fill(0);for(let e=0;e<t.length;e++){const r=d.normalizeAxis(t[e],n.length);if(r>=n.length)throw new Error("'axes' has an out of range axis");if(0!==n[r])throw new Error("'axes' has a duplicate axis");n[r]=1}let r=0;for(let t=0;t<n.length;t++)0===n[t]&&(n[t]=e[r++]);if(r!==e.length)throw new Error("the unsqueezed dimension could not be established");return n}}t.ShapeUtil=d,t.MathUtil=class{static sqr(e,t,n,r,o){if(r<0||r>=t.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=e.length)throw new Error("targetIndex out of bounds");if(r+o>t.length)throw new Error("source indices to be copied are outside bounds");if(n+o>e.length)throw new Error("target array is too small to hold result");for(let i=0;i<o;i++)e[n+i]+=Math.pow(t[r+i],2)}static axpy(e,t,n,r,o,i){if(r<0||r>=t.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=e.length)throw new Error("targetIndex out of bounds");if(r+o>t.length)throw new Error("source indices to be copied are outside bounds");if(n+o>e.length)throw new Error("target array is too small to hold result");for(let s=0;s<o;s++)e[n+s]+=i*t[r+s]}static powx(e,t,n,r,o,i){if(r<0||r>=t.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=e.length)throw new Error("targetIndex out of bounds");if(r+o>t.length)throw new Error("source indices to be copied are outside bounds");if(n+o>e.length)throw new Error("target array is too small to hold result");for(let s=0;s<o;s++)e[n+s]=Math.pow(t[r+s],i)}static mul(e,t,n,r,o){if(r<0||r>=t.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=e.length)throw new Error("targetIndex out of bounds");if(r+o>t.length)throw new Error("source indices to be copied are outside bounds");if(n+o>e.length)throw new Error("target array is too small to hold result");for(let i=0;i<o;i++)e[n+i]=t[r+i]*e[n+i]}};class _{static splitShape(e,t,n,r){if(0===n.length){if(!r)throw new Error("need to know number of outputs when the 'split' attribute is not specified");_.determineSplit(e[t],r,n)}const o=[],i=[0];for(let r=0;r<n.length;++r){0!==r&&i.push(i[r-1]+n[r-1]);const s=e.slice();s[t]=n[r],o.push(s)}return[o,i]}static determineSplit(e,t,n){if(e%t!=0)throw new Error("cannot split tensor to equal sized parts");for(let r=0;r<t;++r)n.push(e/t)}}t.SplitUtil=_;class h{static calcReduce(e,t,n,r,o){const i=e.dims.slice(0);0===t.length&&i.forEach(((e,n)=>t.push(n)));const s=h.calcReduceShape(i,t,!0),l=d.size(s),u=new a.Tensor(s,e.type),p=d.computeStrides(s),_=d.computeStrides(i),f=new Array(i.length);for(let n=0;n<l;n++){const s=d.offsetToIndices(n,p);c.fillIndex(s,i,f),u.set(s,h.calcReduceByAxis(e.numberData,t,i,0,d.indicesToOffset(f,_),r,o))}return n?u:new a.Tensor(h.calcReduceShape(i,t,n),u.type,void 0,void 0,u.data,u.dataId)}static calcReduceByAxis(e,t,n,r,o,i,s){let a=0;if(r>=t.length)return i(e[o]);const l=t[r],c=l>=n.length?1:d.size(n.slice(l+1));for(let u=0;u<n[l];u++)a=0===u?h.calcReduceByAxis(e,t,n,r+1,o,i,s):s(a,h.calcReduceByAxis(e,t,n,r+1,o,i,s)),o+=c;return a}static calcReduceShape(e,t,n){const r=e.slice();for(let e=0;e<t.length;e++)r[t[e]]=n?1:0;return r.filter((e=>0!==e))}}t.ReduceUtil=h;class f{static adjustPoolAttributes(e,t,n,r,o,i){if(!e&&n.length!==t.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(e)for(let e=0;e<t.length-2;e++)e>=n.length?n.push(t[e+2]):n[e]=t[e+2];for(let e=0;e<n.length;e++)if(e<r.length){if(r[e]<0)throw new Error("strides should be greater than or equal to 1")}else r.push(1);for(let e=0;e<n.length;e++)if(e<o.length){if(o[e]<0)throw new Error("dilations should be greater than or equal to 1")}else o.push(1);for(let e=0;e<2*n.length;e++)if(e<i.length){if(i[e]<0)throw new Error("pad should be greater than or equal to 1")}else i.push(0);for(let e=0;e<n.length;e++){if(n[e]<=0)throw new Error("kernel shapes need to be greater than 0");if(i[e]>=n[e]||i[e+n.length]>=n[e])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(e,t,n,r,o,i){if(i){if(o.length!==2*(e.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(t.length!==e.length-2)throw new Error("length of strides should be the length of data dimensions");if(r.length!==e.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let s=0;s<e.length-2;s++)f.adjustPadAndReturnShape(e[s+2],t[s],n[s],r[s],o,s,s+e.length-2,i)}}static computePoolOutputShape(e,t,n,r,o,i,s){if(t.length<=0)throw new Error("input shape must be of size greater than 0");const a=[t[0],t[1]];return f.computeShapeHelper(e,t,a,n,r,o,i,s),a}static computeConvOutputShape(e,t,n,r,o,i,s){if(e.length<=0||t.length<=0)throw new Error("invalid input tensor dims or invalid filter tensor dims");const a=[e[0],t[0]];return f.computeShapeHelper(!1,e,a,n,r,o,i,s),a}static computeShapeHelper(e,t,n,r,o,i,s,a){if(e)for(let e=0;e<t.length-2;e++)n.push(1);else for(let e=0;e<t.length-2;e++)n.push(f.adjustPadAndReturnShape(t[e+2],r[e],o[e],i[e],s,e,e+t.length-2,a))}static adjustPadAndReturnShape(e,t,n,r,o,i,s,a){const l=n*(r-1)+1;if(!a||"NOTSET"===a)return Math.floor((e+o[i]+o[s]-l)/t+1);switch(a){case"VALID":return o[i]=0,o[s]=0,Math.floor((e-l)/t+1);case"SAME_LOWER":case"SAME_UPPER":if(1!==n)throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{const n=((e+t-1)/t-1)*t+r-e;return o[i]="SAME_LOWER"===a?Math.floor((n+1)/2):Math.floor(n/2),o[s]=n-o[i],Math.floor((e+n-r)/t+1)}default:throw new Error("Unsupported AutoPad type")}}}t.PoolConvUtil=f,t.MIN_CLIP=-34028234663852886e22,t.MAX_CLIP=34028234663852886e22,t.decodeUtf8String=function(e){return(new TextDecoder).decode(e)}},7967:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.iterateExtraOptions=void 0,t.iterateExtraOptions=(e,n,r,o)=>{if("object"==typeof e&&null!==e){if(r.has(e))throw new Error("Circular reference in options");r.add(e)}Object.entries(e).forEach((([e,i])=>{const s=n?n+e:e;if("object"==typeof i)(0,t.iterateExtraOptions)(i,s+".",r,o);else if("string"==typeof i||"number"==typeof i)o(s,i.toString());else{if("boolean"!=typeof i)throw new Error("Can't handle extra config type: "+typeof i);o(s,i?"1":"0")}}))}},2157:function(e,t,n){var r,o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.endProfiling=t.run=t.releaseSession=t.createSession=t.createSessionFinalize=t.createSessionAllocate=t.initOrt=t.initWasm=void 0;const a=n(1670),l=s(n(349)),c=n(6361),u=()=>!!a.env.wasm.proxy&&"undefined"!=typeof document;let p,d,_,h=!1,f=!1,m=!1;const g=[],b=[],w=[],x=[],y=[],T=[],v=()=>{if(h||!f||m||!p)throw new Error("worker not ready")},k=e=>{switch(e.data.type){case"init-wasm":h=!1,e.data.err?(m=!0,d[1](e.data.err)):(f=!0,d[0]());break;case"init-ort":e.data.err?_[1](e.data.err):_[0]();break;case"create_allocate":e.data.err?g.shift()[1](e.data.err):g.shift()[0](e.data.out);break;case"create_finalize":e.data.err?b.shift()[1](e.data.err):b.shift()[0](e.data.out);break;case"create":e.data.err?w.shift()[1](e.data.err):w.shift()[0](e.data.out);break;case"release":e.data.err?x.shift()[1](e.data.err):x.shift()[0]();break;case"run":e.data.err?y.shift()[1](e.data.err):y.shift()[0](e.data.out);break;case"end-profiling":e.data.err?T.shift()[1](e.data.err):T.shift()[0]()}},M="undefined"!=typeof document?null===(r=null===document||void 0===document?void 0:document.currentScript)||void 0===r?void 0:r.src:void 0;t.initWasm=async()=>{if(u()){if(f)return;if(h)throw new Error("multiple calls to 'initWasm()' detected.");if(m)throw new Error("previous call to 'initWasm()' failed.");return h=!0,void 0===a.env.wasm.wasmPaths&&M&&0!==M.indexOf("blob:")&&(a.env.wasm.wasmPaths=M.substr(0,+M.lastIndexOf("/")+1)),new Promise(((e,t)=>{null==p||p.terminate(),p=n(9710).Z(),p.onmessage=k,d=[e,t];const r={type:"init-wasm",in:a.env.wasm};p.postMessage(r)}))}return(0,c.initializeWebAssembly)(a.env.wasm)},t.initOrt=async(e,t)=>{if(u())return v(),new Promise(((n,r)=>{_=[n,r];const o={type:"init-ort",in:{numThreads:e,loggingLevel:t}};p.postMessage(o)}));l.initOrt(e,t)},t.createSessionAllocate=async e=>u()?(v(),new Promise(((t,n)=>{g.push([t,n]);const r={type:"create_allocate",in:{model:e}};p.postMessage(r,[e.buffer])}))):l.createSessionAllocate(e),t.createSessionFinalize=async(e,t)=>u()?(v(),new Promise(((n,r)=>{b.push([n,r]);const o={type:"create_finalize",in:{modeldata:e,options:t}};p.postMessage(o)}))):l.createSessionFinalize(e,t),t.createSession=async(e,t)=>u()?(v(),new Promise(((n,r)=>{w.push([n,r]);const o={type:"create",in:{model:e,options:t}};p.postMessage(o,[e.buffer])}))):l.createSession(e,t),t.releaseSession=async e=>{if(u())return v(),new Promise(((t,n)=>{x.push([t,n]);const r={type:"release",in:e};p.postMessage(r)}));l.releaseSession(e)},t.run=async(e,t,n,r,o)=>u()?(v(),new Promise(((i,s)=>{y.push([i,s]);const a={type:"run",in:{sessionId:e,inputIndices:t,inputs:n,outputIndices:r,options:o}};p.postMessage(a,l.extractTransferableBuffers(n))}))):l.run(e,t,n,r,o),t.endProfiling=async e=>{if(u())return v(),new Promise(((t,n)=>{T.push([t,n]);const r={type:"end-profiling",in:e};p.postMessage(r)}));l.endProfiling(e)}},586:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setRunOptions=void 0;const r=n(7967),o=n(4983),i=n(6361);t.setRunOptions=e=>{const t=(0,i.getInstance)();let n=0;const s=[],a=e||{};try{if(void 0===(null==e?void 0:e.logSeverityLevel))a.logSeverityLevel=2;else if("number"!=typeof e.logSeverityLevel||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if(void 0===(null==e?void 0:e.logVerbosityLevel))a.logVerbosityLevel=0;else if("number"!=typeof e.logVerbosityLevel||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);void 0===(null==e?void 0:e.terminate)&&(a.terminate=!1);let i=0;if(void 0!==(null==e?void 0:e.tag)&&(i=(0,o.allocWasmString)(e.tag,s)),n=t._OrtCreateRunOptions(a.logSeverityLevel,a.logVerbosityLevel,!!a.terminate,i),0===n)throw new Error("Can't create run options");return void 0!==(null==e?void 0:e.extra)&&(0,r.iterateExtraOptions)(e.extra,"",new WeakSet,((e,r)=>{const i=(0,o.allocWasmString)(e,s),a=(0,o.allocWasmString)(r,s);if(0!==t._OrtAddRunConfigEntry(n,i,a))throw new Error(`Can't set a run config entry: ${e} - ${r}`)})),[n,s]}catch(e){throw 0!==n&&t._OrtReleaseRunOptions(n),s.forEach(t._free),e}}},2306:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OnnxruntimeWebAssemblySessionHandler=void 0;const r=n(2806),o=n(1670),i=n(2850),s=n(2157);let a;t.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(e){const t=await fetch(e),n=await t.arrayBuffer();return(0,s.createSessionAllocate)(new Uint8Array(n))}async loadModel(e,t){if(a||(await(0,s.initOrt)(o.env.wasm.numThreads,(e=>{switch(e){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: ${e}`)}})(o.env.logLevel)),a=!0),"string"==typeof e)if("undefined"==typeof fetch){const n=await(0,i.promisify)(r.readFile)(e);[this.sessionId,this.inputNames,this.outputNames]=await(0,s.createSession)(n,t)}else{const n=await this.createSessionAllocate(e);[this.sessionId,this.inputNames,this.outputNames]=await(0,s.createSessionFinalize)(n,t)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,s.createSession)(e,t)}async dispose(){return(0,s.releaseSession)(this.sessionId)}async run(e,t,n){const r=[],i=[];Object.entries(e).forEach((e=>{const t=e[0],n=e[1],o=this.inputNames.indexOf(t);if(-1===o)throw new Error(`invalid input '${t}'`);r.push(n),i.push(o)}));const a=[];Object.entries(t).forEach((e=>{const t=e[0],n=this.outputNames.indexOf(t);if(-1===n)throw new Error(`invalid output '${t}'`);a.push(n)}));const l=await(0,s.run)(this.sessionId,i,r.map((e=>[e.type,e.dims,e.data])),a,n),c={};for(let e=0;e<l.length;e++)c[this.outputNames[a[e]]]=new o.Tensor(l[e][0],l[e][2],l[e][1]);return c}startProfiling(){}endProfiling(){(0,s.endProfiling)(this.sessionId)}}},4919:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setSessionOptions=void 0;const r=n(7967),o=n(4983),i=n(6361);t.setSessionOptions=e=>{const t=(0,i.getInstance)();let n=0;const s=[],a=e||{};(e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});const t=e.extra.session;t.use_ort_model_bytes_directly||(t.use_ort_model_bytes_directly="1")})(a);try{void 0===(null==e?void 0:e.graphOptimizationLevel)&&(a.graphOptimizationLevel="all");const l=(e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}})(a.graphOptimizationLevel);void 0===(null==e?void 0:e.enableCpuMemArena)&&(a.enableCpuMemArena=!0),void 0===(null==e?void 0:e.enableMemPattern)&&(a.enableMemPattern=!0),void 0===(null==e?void 0:e.executionMode)&&(a.executionMode="sequential");const c=(e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}})(a.executionMode);let u=0;if(void 0!==(null==e?void 0:e.logId)&&(u=(0,o.allocWasmString)(e.logId,s)),void 0===(null==e?void 0:e.logSeverityLevel))a.logSeverityLevel=2;else if("number"!=typeof e.logSeverityLevel||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if(void 0===(null==e?void 0:e.logVerbosityLevel))a.logVerbosityLevel=0;else if("number"!=typeof e.logVerbosityLevel||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);if(void 0===(null==e?void 0:e.enableProfiling)&&(a.enableProfiling=!1),n=t._OrtCreateSessionOptions(l,!!a.enableCpuMemArena,!!a.enableMemPattern,c,!!a.enableProfiling,0,u,a.logSeverityLevel,a.logVerbosityLevel),0===n)throw new Error("Can't create session options");return(null==e?void 0:e.executionProviders)&&((e,t,n)=>{for(const r of t){let t="string"==typeof r?r:r.name;switch(t){case"xnnpack":t="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${t}`)}const s=(0,o.allocWasmString)(t,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(e,s))throw new Error(`Can't append execution provider: ${t}`)}})(n,e.executionProviders,s),void 0!==(null==e?void 0:e.extra)&&(0,r.iterateExtraOptions)(e.extra,"",new WeakSet,((e,r)=>{const i=(0,o.allocWasmString)(e,s),a=(0,o.allocWasmString)(r,s);if(0!==t._OrtAddSessionConfigEntry(n,i,a))throw new Error(`Can't set a session config entry: ${e} - ${r}`)})),[n,s]}catch(e){throw 0!==n&&t._OrtReleaseSessionOptions(n),s.forEach(t._free),e}}},4983:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.allocWasmString=void 0;const r=n(6361);t.allocWasmString=(e,t)=>{const n=(0,r.getInstance)(),o=n.lengthBytesUTF8(e)+1,i=n._malloc(o);return n.stringToUTF8(e,i,o),t.push(i),i}},349:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extractTransferableBuffers=t.endProfiling=t.run=t.releaseSession=t.createSession=t.createSessionFinalize=t.createSessionAllocate=t.initOrt=void 0;const r=n(586),o=n(4919),i=n(4983),s=n(6361);t.initOrt=(e,t)=>{const n=(0,s.getInstance)()._OrtInit(e,t);if(0!==n)throw new Error(`Can't initialize onnxruntime. error code = ${n}`)};const a=new Map;t.createSessionAllocate=e=>{const t=(0,s.getInstance)(),n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),[n,e.byteLength]},t.createSessionFinalize=(e,t)=>{const n=(0,s.getInstance)();let r=0,i=0,l=[];try{if([i,l]=(0,o.setSessionOptions)(t),r=n._OrtCreateSession(e[0],e[1],i),0===r)throw new Error("Can't create a session")}finally{n._free(e[0]),n._OrtReleaseSessionOptions(i),l.forEach(n._free)}const c=n._OrtGetInputCount(r),u=n._OrtGetOutputCount(r),p=[],d=[],_=[],h=[];for(let e=0;e<c;e++){const t=n._OrtGetInputName(r,e);if(0===t)throw new Error("Can't get an input name");d.push(t),p.push(n.UTF8ToString(t))}for(let e=0;e<u;e++){const t=n._OrtGetOutputName(r,e);if(0===t)throw new Error("Can't get an output name");h.push(t),_.push(n.UTF8ToString(t))}return a.set(r,[r,d,h]),[r,p,_]},t.createSession=(e,n)=>{const r=(0,t.createSessionAllocate)(e);return(0,t.createSessionFinalize)(r,n)},t.releaseSession=e=>{const t=(0,s.getInstance)(),n=a.get(e);if(!n)throw new Error("invalid session id");const r=n[0],o=n[1],i=n[2];o.forEach(t._OrtFree),i.forEach(t._OrtFree),t._OrtReleaseSession(r),a.delete(e)};const l=e=>{switch(e){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"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: ${e}`)}},c=e=>{switch(e){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 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: ${e}`)}},u=e=>{switch(e){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}};t.run=(e,t,n,o,p)=>{const d=(0,s.getInstance)(),_=a.get(e);if(!_)throw new Error("invalid session id");const h=_[0],f=_[1],m=_[2],g=t.length,b=o.length;let w=0,x=[];const y=[],T=[];try{[w,x]=(0,r.setRunOptions)(p);for(let e=0;e<g;e++){const t=n[e][0],r=n[e][1],o=n[e][2];let s,a;if(Array.isArray(o)){a=4*o.length,s=d._malloc(a),T.push(s);let e=s/4;for(let t=0;t<o.length;t++){if("string"!=typeof o[t])throw new TypeError(`tensor data at index ${t} is not a string`);d.HEAPU32[e++]=(0,i.allocWasmString)(o[t],T)}}else a=o.byteLength,s=d._malloc(a),T.push(s),d.HEAPU8.set(new Uint8Array(o.buffer,o.byteOffset,a),s);const c=d.stackSave(),u=d.stackAlloc(4*r.length);try{let e=u/4;r.forEach((t=>d.HEAP32[e++]=t));const n=d._OrtCreateTensor(l(t),s,a,u,r.length);if(0===n)throw new Error("Can't create a tensor");y.push(n)}finally{d.stackRestore(c)}}const e=d.stackSave(),s=d.stackAlloc(4*g),a=d.stackAlloc(4*g),_=d.stackAlloc(4*b),v=d.stackAlloc(4*b);try{let e=s/4,n=a/4,r=_/4,i=v/4;for(let r=0;r<g;r++)d.HEAPU32[e++]=y[r],d.HEAPU32[n++]=f[t[r]];for(let e=0;e<b;e++)d.HEAPU32[r++]=0,d.HEAPU32[i++]=m[o[e]];let l=d._OrtRun(h,a,s,g,v,b,_,w);const p=[];if(0===l)for(let e=0;e<b;e++){const t=d.HEAPU32[_/4+e],n=d.stackSave(),r=d.stackAlloc(16);let o,i=0;try{if(l=d._OrtGetTensorData(t,r,r+4,r+8,r+12),0!==l)throw new Error(`Can't access output tensor data. error code = ${l}`);let e=r/4;const n=d.HEAPU32[e++];i=d.HEAPU32[e++];const s=d.HEAPU32[e++],a=d.HEAPU32[e++],_=[];for(let e=0;e<a;e++)_.push(d.HEAPU32[s/4+e]);d._OrtFree(s);const h=0===_.length?1:_.reduce(((e,t)=>e*t));if(o=c(n),"string"===o){const e=[];let t=i/4;for(let n=0;n<h;n++){const r=d.HEAPU32[t++],o=n===h-1?void 0:d.HEAPU32[t]-r;e.push(d.UTF8ToString(r,o))}p.push([o,_,e])}else{const e=new(u(o))(h);new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(d.HEAPU8.subarray(i,i+e.byteLength)),p.push([o,_,e])}}finally{d.stackRestore(n),"string"===o&&i&&d._free(i),d._OrtReleaseTensor(t)}}if(0===l)return p;throw new Error(`failed to call OrtRun(). error code = ${l}.`)}finally{d.stackRestore(e)}}finally{y.forEach(d._OrtReleaseTensor),T.forEach(d._free),d._OrtReleaseRunOptions(w),x.forEach(d._free)}},t.endProfiling=e=>{const t=(0,s.getInstance)(),n=a.get(e);if(!n)throw new Error("invalid session id");const r=n[0],o=t._OrtEndProfiling(r);if(0===o)throw new Error("Can't get an profile file name");t._OrtFree(o)},t.extractTransferableBuffers=e=>{const t=[];for(const n of e){const e=n[2];!Array.isArray(e)&&e.buffer&&t.push(e.buffer)}return t}},6361:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.dispose=t.getInstance=t.initializeWebAssembly=void 0;const a=i(n(6449)),l=s(n(932)),c=n(3474);let u,p=!1,d=!1,_=!1;const h=(e,t)=>t?e?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":e?"ort-wasm-simd.wasm":"ort-wasm.wasm";t.initializeWebAssembly=async e=>{if(p)return Promise.resolve();if(d)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(_)throw new Error("previous call to 'initializeWebAssembly()' failed.");d=!0;const t=e.initTimeout,r=e.numThreads,o=e.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(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(e){return!1}})(),s=o&&(()=>{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(e){return!1}})(),f="string"==typeof e.wasmPaths?e.wasmPaths:void 0,m=h(!1,i),g=h(s,i),b="object"==typeof e.wasmPaths?e.wasmPaths[g]:void 0;let w=!1;const x=[];if(t>0&&x.push(new Promise((e=>{setTimeout((()=>{w=!0,e()}),t)}))),x.push(new Promise(((e,t)=>{const r=i?c:l.default,o={locateFile:(e,t)=>i&&e.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(4154)],{type:"text/javascript"})):e===m?null!=b?b:(null!=f?f:t)+g:t+e};if(i)if("undefined"==typeof Blob)o.mainScriptUrlOrBlob=a.join("/","ort-wasm-threaded.js");else{const e=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;o.mainScriptUrlOrBlob=new Blob([e],{type:"text/javascript"})}r(o).then((t=>{d=!1,p=!0,u=t,e()}),(e=>{d=!1,_=!0,t(e)}))}))),await Promise.race(x),w)throw new Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},t.getInstance=()=>{if(p&&u)return u;throw new Error("WebAssembly is not initialized yet.")},t.dispose=()=>{var e;!p||d||_||(d=!0,null===(e=u.PThread)||void 0===e||e.terminateAllThreads(),u=void 0,d=!1,p=!1,_=!0)}},9710:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(477),o=n.n(r);function i(){return o()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1<process.argv.length&&(m=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof ct))throw t})),process.on("unhandledRejection",(function(t){throw t})),g=(t,e)=>{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16<n-e&&t.buffer&&L)return L.decode(t.buffer instanceof SharedArrayBuffer?t.slice(e,n):t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n<t.length;++n){var r=t.charCodeAt(n);127>=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("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"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0<t.length;)t.shift()(u)}function yt(t){var e=Ee();return t=t(),Me(e),t}function bt(t){if(O)return $t(2,0,t);try{pt(t)}catch(t){t instanceof ct||"unwind"==t||g(1,t)}}u.PThread=ht,u.establishStackSpace=function(){var t=he(),e=a()[t+44>>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s<o?(i()[n>>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u<n;u++){var c=r[2+u];o()[i+u>>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={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",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u<a.length;++u)e()[o++>>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u<n;u++){var c=i()[e>>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l<s;l++)ae(t,r()[c+l>>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=n[0]+t;return t}function u(t,e){return o(t,e,"0")}function c(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function s(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function l(t){var e=t.Wb;for(t=new Date(new Date(t.Xb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(ue(t.getFullYear())?ce:se)[n];if(!(e>r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%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(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12<t&&(t-=12),u(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.ec-1;e+=(ue(t.Xb+1900)?ce:se)[n++]);return u(t.jc+e,3)},"%m":function(t){return u(t.ec+1,2)},"%M":function(t){return u(t.Kc,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.dc&&12>t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&&gt(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},l:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},h:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},t:Tt,M:function(){var t=_t.pop();t||at("no exception to throw");var e=t.Zb;throw t.kc()||(_t.push(t),t.ic(!0),t.hc(!1),Ot++),At=e,e},c:function(t,e,n){throw new St(t).fc(e,n),At=t,Ot++,t},pa:function(){return Ot},Fa:function(t){ge(t,!w,1,!v),ht.pc()},T:function(t){O?postMessage({cmd:"cleanupThread",thread:t}):st(t)},xa:Mt,j:function(t){throw At||(At=t),t},H:Ct,Ma:xt,ua:Rt,wa:jt,oa:kt,Ka:Dt,Ca:Pt,Ja:Ut,V:Ft,va:It,sa:Wt,La:Ht,ta:Lt,Ta:function(){},X:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ua:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},W:function(){return Date.now()},ya:function(){return 2097152},Oa:function(){return!0},za:function(t,e,n,r){if(t==e)setTimeout((()=>zt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=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),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0<n!=(c==r)&&(o=Math.max(u,o),e.setTime(e.getTime()+6e4*((0<n?c:o)-r))),a()[t+24>>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r<e;r++)Xt[r]=o()[n+r>>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760<t)return!1;for(var n=1;4>=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i<a;i++)e()[r+i>>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0<et))if(O)c(u),O||dt(X),postMessage({cmd:"loaded"});else{if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)K();dt(q),0<et||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),t()}),1)):t())}}if(u.UTF8ToString=Y,u.stringToUTF8=function(t,e,n){return B(t,r(),e,n)},u.lengthBytesUTF8=G,u.keepRuntimeAlive=Q,u.wasmMemory=j,u.stackSave=Ee,u.stackRestore=Me,u.stackAlloc=Ce,u.ExitStatus=ct,u.PThread=ht,rt=function t(){ve||ze(),ve||(rt=t)},u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);0<u.preInit.length;)u.preInit.pop()();return ze(),t.ready});t.exports=r},932:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1<process.argv.length&&(p=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof J))throw t})),process.on("unhandledRejection",(function(t){throw t})),h=(t,e)=>{if(_||0<L)throw process.exitCode=t,e;e instanceof J||w("exiting due to exception: "+e),process.exit(t)},e.inspect=function(){return"[Emscripten Module object]"}):(d||y)&&(y?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),_scriptDir&&(m=_scriptDir),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16<n-e&&t.buffer&&x)return x.decode(t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n<t.length;++n){var r=t.charCodeAt(n);127>=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0<t.length;)t.shift()(e)}var Q=[],K=0,tt=0;function et(t){this.Db=t,this.zb=t-24,this.Ub=function(t){M[this.zb+4>>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={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",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[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 yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=n[0]+t;return t}function i(t,e){return a(t,e,"0")}function o(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function u(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function c(t){var e=t.Bb;for(t=new Date(new Date(t.Cb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(pt(t.getFullYear())?ht:dt)[n];if(!(e>r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%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"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12<t&&(t-=12),i(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.Hb-1;e+=(pt(t.Cb+1900)?ht:dt)[n++]);return i(t.Kb+e,3)},"%m":function(t){return i(t.Hb+1,2)},"%M":function(t){return i(t.Zb,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.Gb&&12>t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},k:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},g:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},s:nt,L:function(){var t=Q.pop();t||V("no exception to throw");var e=t.Db;throw t.Lb()||(Q.push(t),t.Jb(!0),t.Ib(!1),K++),tt=e,e},b:function(t,e,n){throw new et(t).Rb(e,n),tt=t,K++,t},la:function(){return K},i:function(t){throw tt||(tt=t),t},H:function(){return 0},Ba:function(){},pa:function(){},ra:function(){},ka:function(){return 0},za:function(){},ua:function(){},ya:function(){},R:function(){},qa:function(){},na:function(){},Aa:function(){},oa:function(){},Ha:function(){},Ja:function(){V("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){V("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},S:function(){return Date.now()},Ca:function(){return!0},Da:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0<n!=(u==r)&&(i=Math.max(o,i),e.setTime(e.getTime()+6e4*((0<n?u:i)-r))),E[t+24>>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u<a?(M[n>>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i<r.length;++i)S[a++>>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0<L||(_t(),Z(W),wt(0),st[1].length&&lt(1,10),st[2].length&&lt(2,10)),_||0<L||(e.onExit&&e.onExit(t),C=!0),h(t,new J(t))},E:function(){return 52},Q:function(){return 52},ca:function(){return 70},P:function(t,e,n,r){for(var a=0,i=0;i<n;i++){var o=M[e>>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c<u;c++)lt(t,T[o+c>>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a<r;a++)S[e+a>>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0<B)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)z();Z(F),0<B||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),t()}),1)):t())}}if(e.UTF8ToString=j,e.stringToUTF8=function(t,e,n){return k(t,T,e,n)},e.lengthBytesUTF8=D,e.stackSave=At,e.stackRestore=St,e.stackAlloc=Tt,N=function t(){mt||Wt(),mt||(N=t)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return Wt(),t.ready});t.exports=r},967:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t<s;t++){const e=n._OrtGetInputName(r,t);if(0===e)throw new Error("Can\'t get an input name");p.push(e),f.push(n.UTF8ToString(e))}for(let t=0;t<l;t++){const e=n._OrtGetOutputName(r,t);if(0===e)throw new Error("Can\'t get an output name");d.push(e),h.push(n.UTF8ToString(e))}return u.set(r,[r,p,d]),[r,f,h]},e.createSession=(t,n)=>{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"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: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 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: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;t<m;t++){const e=n[t][0],r=n[t][1],a=n[t][2];let o,u;if(Array.isArray(a)){u=4*a.length,o=p._malloc(u),O.push(o);let t=o/4;for(let e=0;e<a.length;e++){if("string"!=typeof a[e])throw new TypeError(`tensor data at index ${e} is not a string`);p.HEAPU32[t++]=(0,i.allocWasmString)(a[e],O)}}else u=a.byteLength,o=p._malloc(u),O.push(o),p.HEAPU8.set(new Uint8Array(a.buffer,a.byteOffset,u),o);const s=p.stackSave(),l=p.stackAlloc(4*r.length);try{let t=l/4;r.forEach((e=>p.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;t<m;t++)p.HEAPU32[n++]=_[t],p.HEAPU32[r++]=y[e[t]];for(let t=0;t<g;t++)p.HEAPU32[i++]=0,p.HEAPU32[c++]=b[a[t]];let f=p._OrtRun(d,u,o,m,A,g,h,v);const w=[];if(0===f)for(let t=0;t<g;t++){const e=p.HEAPU32[h/4+t],n=p.stackSave(),r=p.stackAlloc(16);let a,i=0;try{if(f=p._OrtGetTensorData(e,r,r+4,r+8,r+12),0!==f)throw new Error(`Can\'t access output tensor data. error code = ${f}`);let t=r/4;const o=p.HEAPU32[t++];i=p.HEAPU32[t++];const u=p.HEAPU32[t++],c=p.HEAPU32[t++],h=[];for(let t=0;t<c;t++)h.push(p.HEAPU32[u/4+t]);p._OrtFree(u);const d=0===h.length?1:h.reduce(((t,e)=>t*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n<d;n++){const r=p.HEAPU32[e++],a=n===d-1?void 0:p.HEAPU32[e]-r;t.push(p.UTF8ToString(r,a))}w.push([a,h,t])}else{const t=new(l(a))(d);new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(p.HEAPU8.subarray(i,i+t.byteLength)),w.push([a,h,t])}}finally{p.stackRestore(n),"string"===a&&i&&p._free(i),p._OrtReleaseTensor(e)}}if(0===f)return w;throw new Error(`failed to call OrtRun(). error code = ${f}.`)}finally{p.stackRestore(t)}}finally{_.forEach(p._OrtReleaseTensor),O.forEach(p._free),p._OrtReleaseRunOptions(v),w.forEach(p._free)}},e.endProfiling=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(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(t){return!1}})(),o=a&&(()=>{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(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:e=>{e.exports=function(e,t,n,r){var o=self||window;try{try{var i;try{i=new o.Blob([e])}catch(t){(i=new(o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder)).append(e),i=i.getBlob()}var s=o.URL||o.webkitURL,a=s.createObjectURL(i),l=new o[t](a,n);return s.revokeObjectURL(a),l}catch(r){return new o[t]("data:application/javascript,".concat(encodeURIComponent(e)),n)}}catch(e){if(!r)throw Error("Inline worker is not supported");return new o[t](r,n)}}},4154:e=>{e.exports='"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\n'},1670:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(e,t,n)=>{n.r(t),n.d(t,{flatbuffers:()=>r});var r={};r.Offset,r.Table,r.SIZEOF_SHORT=2,r.SIZEOF_INT=4,r.FILE_IDENTIFIER_LENGTH=4,r.SIZE_PREFIX_LENGTH=4,r.Encoding={UTF8_BYTES:1,UTF16_STRING:2},r.int32=new Int32Array(2),r.float32=new Float32Array(r.int32.buffer),r.float64=new Float64Array(r.int32.buffer),r.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],r.Long=function(e,t){this.low=0|e,this.high=0|t},r.Long.create=function(e,t){return 0==e&&0==t?r.Long.ZERO:new r.Long(e,t)},r.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},r.Long.prototype.equals=function(e){return this.low==e.low&&this.high==e.high},r.Long.ZERO=new r.Long(0,0),r.Builder=function(e){if(e)t=e;else var t=1024;this.bb=r.ByteBuffer.allocate(t),this.space=t,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.forceDefaults=function(e){this.force_defaults=e},r.Builder.prototype.dataBuffer=function(){return this.bb},r.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},r.Builder.prototype.prep=function(e,t){e>this.minalign&&(this.minalign=e);for(var n=1+~(this.bb.capacity()-this.space+t)&e-1;this.space<n+e+t;){var o=this.bb.capacity();this.bb=r.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-o}this.pad(n)},r.Builder.prototype.pad=function(e){for(var t=0;t<e;t++)this.bb.writeInt8(--this.space,0)},r.Builder.prototype.writeInt8=function(e){this.bb.writeInt8(this.space-=1,e)},r.Builder.prototype.writeInt16=function(e){this.bb.writeInt16(this.space-=2,e)},r.Builder.prototype.writeInt32=function(e){this.bb.writeInt32(this.space-=4,e)},r.Builder.prototype.writeInt64=function(e){this.bb.writeInt64(this.space-=8,e)},r.Builder.prototype.writeFloat32=function(e){this.bb.writeFloat32(this.space-=4,e)},r.Builder.prototype.writeFloat64=function(e){this.bb.writeFloat64(this.space-=8,e)},r.Builder.prototype.addInt8=function(e){this.prep(1,0),this.writeInt8(e)},r.Builder.prototype.addInt16=function(e){this.prep(2,0),this.writeInt16(e)},r.Builder.prototype.addInt32=function(e){this.prep(4,0),this.writeInt32(e)},r.Builder.prototype.addInt64=function(e){this.prep(8,0),this.writeInt64(e)},r.Builder.prototype.addFloat32=function(e){this.prep(4,0),this.writeFloat32(e)},r.Builder.prototype.addFloat64=function(e){this.prep(8,0),this.writeFloat64(e)},r.Builder.prototype.addFieldInt8=function(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))},r.Builder.prototype.addFieldInt16=function(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))},r.Builder.prototype.addFieldInt32=function(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))},r.Builder.prototype.addFieldInt64=function(e,t,n){!this.force_defaults&&t.equals(n)||(this.addInt64(t),this.slot(e))},r.Builder.prototype.addFieldFloat32=function(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))},r.Builder.prototype.addFieldFloat64=function(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))},r.Builder.prototype.addFieldOffset=function(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))},r.Builder.prototype.addFieldStruct=function(e,t,n){t!=n&&(this.nested(t),this.slot(e))},r.Builder.prototype.nested=function(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},r.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},r.Builder.prototype.slot=function(e){this.vtable[e]=this.offset()},r.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},r.Builder.growByteBuffer=function(e){var t=e.capacity();if(3221225472&t)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var n=t<<1,o=r.ByteBuffer.allocate(n);return o.setPosition(n-t),o.bytes().set(e.bytes(),n-t),o},r.Builder.prototype.addOffset=function(e){this.prep(r.SIZEOF_INT,0),this.writeInt32(this.offset()-e+r.SIZEOF_INT)},r.Builder.prototype.startObject=function(e){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=e;for(var t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()},r.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var e=this.offset(),t=this.vtable_in_use-1;t>=0&&0==this.vtable[t];t--);for(var n=t+1;t>=0;t--)this.addInt16(0!=this.vtable[t]?e-this.vtable[t]:0);this.addInt16(e-this.object_start);var o=(n+2)*r.SIZEOF_SHORT;this.addInt16(o);var i=0,s=this.space;e:for(t=0;t<this.vtables.length;t++){var a=this.bb.capacity()-this.vtables[t];if(o==this.bb.readInt16(a)){for(var l=r.SIZEOF_SHORT;l<o;l+=r.SIZEOF_SHORT)if(this.bb.readInt16(s+l)!=this.bb.readInt16(a+l))continue e;i=this.vtables[t];break}}return i?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,i-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e},r.Builder.prototype.finish=function(e,t,n){var o=n?r.SIZE_PREFIX_LENGTH:0;if(t){var i=t;if(this.prep(this.minalign,r.SIZEOF_INT+r.FILE_IDENTIFIER_LENGTH+o),i.length!=r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+r.FILE_IDENTIFIER_LENGTH);for(var s=r.FILE_IDENTIFIER_LENGTH-1;s>=0;s--)this.writeInt8(i.charCodeAt(s))}this.prep(this.minalign,r.SIZEOF_INT+o),this.addOffset(e),o&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},r.Builder.prototype.finishSizePrefixed=function(e,t){this.finish(e,t,!0)},r.Builder.prototype.requiredField=function(e,t){var n=this.bb.capacity()-e,r=n-this.bb.readInt32(n);if(0==this.bb.readInt16(r+t))throw new Error("FlatBuffers: field "+t+" must be set")},r.Builder.prototype.startVector=function(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(r.SIZEOF_INT,e*t),this.prep(n,e*t)},r.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},r.Builder.prototype.createString=function(e){if(e instanceof Uint8Array)var t=e;else{t=[];for(var n=0;n<e.length;){var r,o=e.charCodeAt(n++);(r=o<55296||o>=56320?o:(o<<10)+e.charCodeAt(n++)+-56613888)<128?t.push(r):(r<2048?t.push(r>>6&31|192):(r<65536?t.push(r>>12&15|224):t.push(r>>18&7|240,r>>12&63|128),t.push(r>>6&63|128)),t.push(63&r|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),n=0;for(var i=this.space,s=this.bb.bytes();n<t.length;n++)s[i++]=t[n];return this.endVector()},r.Builder.prototype.createLong=function(e,t){return r.Long.create(e,t)},r.ByteBuffer=function(e){this.bytes_=e,this.position_=0},r.ByteBuffer.allocate=function(e){return new r.ByteBuffer(new Uint8Array(e))},r.ByteBuffer.prototype.clear=function(){this.position_=0},r.ByteBuffer.prototype.bytes=function(){return this.bytes_},r.ByteBuffer.prototype.position=function(){return this.position_},r.ByteBuffer.prototype.setPosition=function(e){this.position_=e},r.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},r.ByteBuffer.prototype.readInt8=function(e){return this.readUint8(e)<<24>>24},r.ByteBuffer.prototype.readUint8=function(e){return this.bytes_[e]},r.ByteBuffer.prototype.readInt16=function(e){return this.readUint16(e)<<16>>16},r.ByteBuffer.prototype.readUint16=function(e){return this.bytes_[e]|this.bytes_[e+1]<<8},r.ByteBuffer.prototype.readInt32=function(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24},r.ByteBuffer.prototype.readUint32=function(e){return this.readInt32(e)>>>0},r.ByteBuffer.prototype.readInt64=function(e){return new r.Long(this.readInt32(e),this.readInt32(e+4))},r.ByteBuffer.prototype.readUint64=function(e){return new r.Long(this.readUint32(e),this.readUint32(e+4))},r.ByteBuffer.prototype.readFloat32=function(e){return r.int32[0]=this.readInt32(e),r.float32[0]},r.ByteBuffer.prototype.readFloat64=function(e){return r.int32[r.isLittleEndian?0:1]=this.readInt32(e),r.int32[r.isLittleEndian?1:0]=this.readInt32(e+4),r.float64[0]},r.ByteBuffer.prototype.writeInt8=function(e,t){this.bytes_[e]=t},r.ByteBuffer.prototype.writeUint8=function(e,t){this.bytes_[e]=t},r.ByteBuffer.prototype.writeInt16=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8},r.ByteBuffer.prototype.writeUint16=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8},r.ByteBuffer.prototype.writeInt32=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24},r.ByteBuffer.prototype.writeUint32=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24},r.ByteBuffer.prototype.writeInt64=function(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)},r.ByteBuffer.prototype.writeUint64=function(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)},r.ByteBuffer.prototype.writeFloat32=function(e,t){r.float32[0]=t,this.writeInt32(e,r.int32[0])},r.ByteBuffer.prototype.writeFloat64=function(e,t){r.float64[0]=t,this.writeInt32(e,r.int32[r.isLittleEndian?0:1]),this.writeInt32(e+4,r.int32[r.isLittleEndian?1:0])},r.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+r.SIZEOF_INT+r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var e="",t=0;t<r.FILE_IDENTIFIER_LENGTH;t++)e+=String.fromCharCode(this.readInt8(this.position_+r.SIZEOF_INT+t));return e},r.ByteBuffer.prototype.__offset=function(e,t){var n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0},r.ByteBuffer.prototype.__union=function(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e},r.ByteBuffer.prototype.__string=function(e,t){e+=this.readInt32(e);var n=this.readInt32(e),o="",i=0;if(e+=r.SIZEOF_INT,t===r.Encoding.UTF8_BYTES)return this.bytes_.subarray(e,e+n);for(;i<n;){var s,a=this.readUint8(e+i++);if(a<192)s=a;else{var l=this.readUint8(e+i++);if(a<224)s=(31&a)<<6|63&l;else{var c=this.readUint8(e+i++);s=a<240?(15&a)<<12|(63&l)<<6|63&c:(7&a)<<18|(63&l)<<12|(63&c)<<6|63&this.readUint8(e+i++)}}s<65536?o+=String.fromCharCode(s):(s-=65536,o+=String.fromCharCode(55296+(s>>10),56320+(1023&s)))}return o},r.ByteBuffer.prototype.__indirect=function(e){return e+this.readInt32(e)},r.ByteBuffer.prototype.__vector=function(e){return e+this.readInt32(e)+r.SIZEOF_INT},r.ByteBuffer.prototype.__vector_len=function(e){return this.readInt32(e+this.readInt32(e))},r.ByteBuffer.prototype.__has_identifier=function(e){if(e.length!=r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+r.FILE_IDENTIFIER_LENGTH);for(var t=0;t<r.FILE_IDENTIFIER_LENGTH;t++)if(e.charCodeAt(t)!=this.readInt8(this.position_+r.SIZEOF_INT+t))return!1;return!0},r.ByteBuffer.prototype.createLong=function(e,t){return r.Long.create(e,t)}}},__webpack_module_cache__={};function __nested_webpack_require_546802__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__nested_webpack_require_546802__),n.exports}__nested_webpack_require_546802__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __nested_webpack_require_546802__.d(t,{a:t}),t},__nested_webpack_require_546802__.d=(e,t)=>{for(var n in t)__nested_webpack_require_546802__.o(t,n)&&!__nested_webpack_require_546802__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__nested_webpack_require_546802__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__nested_webpack_require_546802__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__nested_webpack_require_546802__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __nested_webpack_exports__=__nested_webpack_require_546802__(6018);return __nested_webpack_exports__})(),module.exports=e(__webpack_require__(/*! onnxruntime-common */"./node_modules/onnxruntime-common/dist/lib/index.js"))},"?2ce3":
+/*!**********************************!*\
+  !*** onnxruntime-node (ignored) ***!
+  \**********************************/()=>{},"?7a2c":
+/*!********************!*\
+  !*** fs (ignored) ***!
+  \********************/()=>{},"?a42a":
+/*!**********************!*\
+  !*** path (ignored) ***!
+  \**********************/()=>{},"?2b25":
+/*!***********************!*\
+  !*** sharp (ignored) ***!
+  \***********************/()=>{},"?569f":
+/*!********************!*\
+  !*** fs (ignored) ***!
+  \********************/()=>{},"?3f59":
+/*!**********************!*\
+  !*** path (ignored) ***!
+  \**********************/()=>{},"?154a":
+/*!*********************!*\
+  !*** url (ignored) ***!
+  \*********************/()=>{},"./node_modules/@huggingface/jinja/dist/index.js":
+/*!*******************************************************!*\
+  !*** ./node_modules/@huggingface/jinja/dist/index.js ***!
+  \*******************************************************/(e,t,n)=>{n.r(t),n.d(t,{Environment:()=>H,Interpreter:()=>X,Template:()=>Y,parse:()=>I,tokenize:()=>u});var r=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator"}),o=Object.freeze({set:r.Set,for:r.For,in:r.In,is:r.Is,if:r.If,else:r.Else,endif:r.EndIf,elif:r.ElseIf,endfor:r.EndFor,and:r.And,or:r.Or,not:r.Not,"not in":r.NotIn,true:r.BooleanLiteral,false:r.BooleanLiteral}),i=class{constructor(e,t){this.value=e,this.type=t}};function s(e){return/\w/.test(e)}function a(e){return/[0-9]/.test(e)}var l=[["{%",r.OpenStatement],["%}",r.CloseStatement],["{{",r.OpenExpression],["}}",r.CloseExpression],["(",r.OpenParen],[")",r.CloseParen],["{",r.OpenCurlyBracket],["}",r.CloseCurlyBracket],["[",r.OpenSquareBracket],["]",r.CloseSquareBracket],[",",r.Comma],[".",r.Dot],[":",r.Colon],["|",r.Pipe],["<=",r.ComparisonBinaryOperator],[">=",r.ComparisonBinaryOperator],["==",r.ComparisonBinaryOperator],["!=",r.ComparisonBinaryOperator],["<",r.ComparisonBinaryOperator],[">",r.ComparisonBinaryOperator],["+",r.AdditiveBinaryOperator],["-",r.AdditiveBinaryOperator],["*",r.MultiplicativeBinaryOperator],["/",r.MultiplicativeBinaryOperator],["%",r.MultiplicativeBinaryOperator],["=",r.Equals]],c=new Map([["n","\n"],["t","\t"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function u(e,t={}){const n=[],u=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),e=e.replace(/{#.*?#}/gs,"{##}"),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%]})\n/g,"$1")),e.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}(e,t);let p=0;const d=e=>{let t="";for(;e(u[p]);)if("\\"!==u[p]){if(t+=u[p++],p>=u.length)throw new SyntaxError("Unexpected end of input")}else{if(++p,p>=u.length)throw new SyntaxError("Unexpected end of input");const e=u[p++],n=c.get(e);if(void 0===n)throw new SyntaxError(`Unexpected escaped character: ${e}`);t+=n}return t};e:for(;p<u.length;){const e=n.at(-1)?.type;if(void 0===e||e===r.CloseStatement||e===r.CloseExpression){let e="";for(;p<u.length&&("{"!==u[p]||"%"!==u[p+1]&&"{"!==u[p+1]);)e+=u[p++];if(e.length>0){n.push(new i(e,r.Text));continue}}d((e=>/\s/.test(e)));const t=u[p];if("-"===t||"+"===t){const e=n.at(-1)?.type;if(e===r.Text||void 0===e)throw new SyntaxError(`Unexpected character: ${t}`);switch(e){case r.Identifier:case r.NumericLiteral:case r.BooleanLiteral:case r.StringLiteral:case r.CloseParen:case r.CloseSquareBracket:break;default:{++p;const e=d(a);n.push(new i(`${t}${e}`,e.length>0?r.NumericLiteral:r.UnaryOperator));continue}}}for(const[e,t]of l){if(u.slice(p,p+e.length)===e){n.push(new i(e,t)),p+=e.length;continue e}}if("'"!==t&&'"'!==t)if(a(t)){const e=d(a);n.push(new i(e,r.NumericLiteral))}else{if(!s(t))throw new SyntaxError(`Unexpected character: ${t}`);{const e=d(s),t=Object.hasOwn(o,e)?o[e]:r.Identifier;t===r.In&&n.at(-1)?.type===r.Not?(n.pop(),n.push(new i("not in",r.NotIn))):n.push(new i(e,t))}}else{++p;const e=d((e=>e!==t));n.push(new i(e,r.StringLiteral)),++p}}return n}var p=class{type="Statement"},d=class extends p{constructor(e){super(),this.body=e}type="Program"},_=class extends p{constructor(e,t,n){super(),this.test=e,this.body=t,this.alternate=n}type="If"},h=class extends p{constructor(e,t,n){super(),this.loopvar=e,this.iterable=t,this.body=n}type="For"},f=class extends p{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},m=class extends p{type="Expression"},g=class extends m{constructor(e,t,n){super(),this.object=e,this.property=t,this.computed=n}type="MemberExpression"},b=class extends m{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},w=class extends m{constructor(e){super(),this.value=e}type="Identifier"},x=class extends m{constructor(e){super(),this.value=e}type="Literal"},y=class extends x{type="NumericLiteral"},T=class extends x{type="StringLiteral"},v=class extends x{type="BooleanLiteral"},k=class extends x{type="ArrayLiteral"},M=class extends x{type="TupleLiteral"},S=class extends x{type="ObjectLiteral"},P=class extends m{constructor(e,t,n){super(),this.operator=e,this.left=t,this.right=n}type="BinaryExpression"},A=class extends m{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},F=class extends m{constructor(e,t,n){super(),this.operand=e,this.negate=t,this.test=n}type="TestExpression"},C=class extends m{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},E=class extends m{constructor(e=void 0,t=void 0,n=void 0){super(),this.start=e,this.stop=t,this.step=n}type="SliceExpression"},O=class extends m{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function I(e){const t=new d([]);let n=0;function o(t,r){const o=e[n++];if(!o||o.type!==t)throw new Error(`Parser Error: ${r}. ${o.type} !== ${t}.`);return o}function i(){switch(e[n].type){case r.Text:return new T(o(r.Text,"Expected text token").value);case r.OpenStatement:return function(){let t;switch(o(r.OpenStatement,"Expected opening statement token"),e[n].type){case r.Set:++n,t=l(),o(r.CloseStatement,"Expected closing statement token");break;case r.If:++n,t=c(),o(r.OpenStatement,"Expected {% token"),o(r.EndIf,"Expected endif token"),o(r.CloseStatement,"Expected %} token");break;case r.For:++n,t=function(){const e=u(!0);if(!(e instanceof w||e instanceof M))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);o(r.In,"Expected `in` keyword following loop variable");const t=p();o(r.CloseStatement,"Expected closing statement token");const n=[];for(;s(r.OpenStatement,r.EndFor);)n.push(i());return new h(e,t,n)}(),o(r.OpenStatement,"Expected {% token"),o(r.EndFor,"Expected endfor token"),o(r.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${e[n].type}`)}return t}();case r.OpenExpression:return function(){o(r.OpenExpression,"Expected opening expression token");const e=p();return o(r.CloseExpression,"Expected closing expression token"),e}();default:throw new SyntaxError(`Unexpected token type: ${e[n].type}`)}}function s(...t){return n+t.length<=e.length&&t.some(((t,r)=>t!==e[n+r].type))}function a(...t){return n+t.length<=e.length&&t.every(((t,r)=>t===e[n+r].type))}function l(){const e=p();if(a(r.Equals)){++n;const t=l();return new f(e,t)}return e}function c(){const t=p();o(r.CloseStatement,"Expected closing statement token");const s=[],l=[];for(;e[n]?.type!==r.OpenStatement||e[n+1]?.type!==r.ElseIf&&e[n+1]?.type!==r.Else&&e[n+1]?.type!==r.EndIf;)s.push(i());if(e[n]?.type===r.OpenStatement&&e[n+1]?.type!==r.EndIf)if(++n,a(r.ElseIf))o(r.ElseIf,"Expected elseif token"),l.push(c());else for(o(r.Else,"Expected else token"),o(r.CloseStatement,"Expected closing statement token");e[n]?.type!==r.OpenStatement||e[n+1]?.type!==r.EndIf;)l.push(i());return new _(t,s,l)}function u(e=!1){const t=e?R:p,o=[t()],i=a(r.Comma);for(;i&&(++n,o.push(t()),a(r.Comma)););return i?new M(o):o[0]}function p(){return function(){const e=m();if(a(r.If)){++n;const t=m();o(r.Else,"Expected else token");const i=m();return new _(t,[e],[i])}return e}()}function m(){let t=x();for(;a(r.Or);){const r=e[n];++n;const o=x();t=new P(r,t,o)}return t}function x(){let t=I();for(;a(r.And);){const r=e[n];++n;const o=I();t=new P(r,t,o)}return t}function I(){let t;for(;a(r.Not);){const r=e[n];++n;const o=I();t=new C(r,o)}return t??function(){let t=D();for(;a(r.ComparisonBinaryOperator)||a(r.In)||a(r.NotIn);){const r=e[n];++n;const o=D();t=new P(r,t,o)}return t}()}function D(){let t=B();for(;a(r.AdditiveBinaryOperator);){const r=e[n];++n;const o=B();t=new P(r,t,o)}return t}function L(){const t=function(){let t=R();for(;a(r.Dot)||a(r.OpenSquareBracket);){const i=e[n];let s;++n;const a=i.type!==r.Dot;if(a)s=$(),o(r.CloseSquareBracket,"Expected closing square bracket");else if(s=R(),"Identifier"!==s.type)throw new SyntaxError("Expected identifier following dot operator");t=new g(t,s,a)}return t}();return a(r.OpenParen)?N(t):t}function N(e){let t=new b(e,function(){o(r.OpenParen,"Expected opening parenthesis for arguments list");const e=function(){const e=[];for(;!a(r.CloseParen);){let t=p();if(a(r.Equals)){if(++n,!(t instanceof w))throw new SyntaxError("Expected identifier for keyword argument");const e=p();t=new O(t,e)}e.push(t),a(r.Comma)&&++n}return e}();return o(r.CloseParen,"Expected closing parenthesis for arguments list"),e}());return a(r.OpenParen)&&(t=N(t)),t}function $(){const e=[];let t=!1;for(;!a(r.CloseSquareBracket);)a(r.Colon)?(e.push(void 0),++n,t=!0):(e.push(p()),a(r.Colon)&&(++n,t=!0));if(0===e.length)throw new SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new E(...e)}return e[0]}function B(){let t=z();for(;a(r.MultiplicativeBinaryOperator);){const r=e[n];++n;const o=z();t=new P(r,t,o)}return t}function z(){let e=function(){let e=L();for(;a(r.Pipe);){++n;let t=R();if(!(t instanceof w))throw new SyntaxError("Expected identifier for the filter");a(r.OpenParen)&&(t=N(t)),e=new A(e,t)}return e}();for(;a(r.Is);){++n;const t=a(r.Not);t&&++n;let o=R();if(o instanceof v&&(o=new w(o.value.toString())),!(o instanceof w))throw new SyntaxError("Expected identifier for the test");e=new F(e,t,o)}return e}function R(){const t=e[n];switch(t.type){case r.NumericLiteral:return++n,new y(Number(t.value));case r.StringLiteral:return++n,new T(t.value);case r.BooleanLiteral:return++n,new v("true"===t.value);case r.Identifier:return++n,new w(t.value);case r.OpenParen:{++n;const t=u();if(e[n].type!==r.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${e[n].type} instead`);return++n,t}case r.OpenSquareBracket:{++n;const e=[];for(;!a(r.CloseSquareBracket);)e.push(p()),a(r.Comma)&&++n;return++n,new k(e)}case r.OpenCurlyBracket:{++n;const e=new Map;for(;!a(r.CloseCurlyBracket);){const t=p();o(r.Colon,"Expected colon between key and value in object literal");const i=p();e.set(t,i),a(r.Comma)&&++n}return++n,new S(e)}default:throw new SyntaxError(`Unexpected token: ${t.type}`)}}for(;n<e.length;)t.body.push(i());return t}function D(e,t,n=1){void 0===t&&(t=e,e=0);const r=[];for(let o=e;o<t;o+=n)r.push(o);return r}function L(e,t,n,r=1){const o=Math.sign(r);o>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),n=(n??=e.length)<0?Math.max(e.length+n,0):Math.min(n,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),n=(n??=-1)<-1?Math.max(e.length+n,-1):Math.min(n,e.length-1));const i=[];for(let s=t;o*s<o*n;s+=r)i.push(e[s]);return i}function N(e){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}var $=class{type="RuntimeValue";value;builtins=new Map;constructor(e=void 0){this.value=e}__bool__(){return new R(!!this.value)}},B=class extends ${type="NumericValue"},z=class extends ${type="StringValue";builtins=new Map([["upper",new G((()=>new z(this.value.toUpperCase())))],["lower",new G((()=>new z(this.value.toLowerCase())))],["strip",new G((()=>new z(this.value.trim())))],["title",new G((()=>new z(N(this.value))))],["length",new B(this.value.length)]])},R=class extends ${type="BooleanValue"},j=class extends ${type="ObjectValue";__bool__(){return new R(this.value.size>0)}builtins=new Map([["get",new G((([e,t])=>{if(!(e instanceof z))throw new Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new q}))],["items",new G((()=>new V(Array.from(this.value.entries()).map((([e,t])=>new V([new z(e),t]))))))]])},V=class extends ${type="ArrayValue";builtins=new Map([["length",new B(this.value.length)]]);__bool__(){return new R(this.value.length>0)}},U=class extends V{type="TupleValue"},G=class extends ${type="FunctionValue"},q=class extends ${type="NullValue"},W=class extends ${type="UndefinedValue"},H=class{constructor(e){this.parent=e}variables=new Map([["namespace",new G((e=>{if(0===e.length)return new j(new Map);if(1!==e.length||!(e[0]instanceof j))throw new Error("`namespace` expects either zero arguments or a single object argument");return e[0]}))]]);tests=new Map([["boolean",e=>"BooleanValue"===e.type],["callable",e=>e instanceof G],["odd",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "even" to type: ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>e instanceof V||e instanceof z],["lower",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toUpperCase()}],["none",e=>"NullValue"===e.type],["defined",e=>"UndefinedValue"!==e.type],["undefined",e=>"UndefinedValue"===e.type],["equalto",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,Q(t))}declareVariable(e,t){if(this.variables.has(e))throw new SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){return this.variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw new Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new W}catch{return new W}}},X=class{global;constructor(e){this.global=e??new H}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){const n=this.evaluate(e.left,t);switch(e.operator.value){case"and":return n.__bool__().value?this.evaluate(e.right,t):n;case"or":return n.__bool__().value?n:this.evaluate(e.right,t)}const r=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new R(n.value==r.value);case"!=":return new R(n.value!=r.value)}if(n instanceof W||r instanceof W)throw new Error("Cannot perform operation on undefined values");if(n instanceof q||r instanceof q)throw new Error("Cannot perform operation on null values");if(n instanceof B&&r instanceof B)switch(e.operator.value){case"+":return new B(n.value+r.value);case"-":return new B(n.value-r.value);case"*":return new B(n.value*r.value);case"/":return new B(n.value/r.value);case"%":return new B(n.value%r.value);case"<":return new R(n.value<r.value);case">":return new R(n.value>r.value);case">=":return new R(n.value>=r.value);case"<=":return new R(n.value<=r.value)}else if(n instanceof V&&r instanceof V){if("+"===e.operator.value)return new V(n.value.concat(r.value))}else if(r instanceof V){const t=void 0!==r.value.find((e=>e.value===n.value));switch(e.operator.value){case"in":return new R(t);case"not in":return new R(!t)}}if((n instanceof z||r instanceof z)&&"+"===e.operator.value)return new z(n.value.toString()+r.value.toString());if(n instanceof z&&r instanceof z)switch(e.operator.value){case"in":return new R(r.value.includes(n.value));case"not in":return new R(!r.value.includes(n.value))}if(n instanceof z&&r instanceof j)switch(e.operator.value){case"in":return new R(r.value.has(n.value));case"not in":return new R(!r.value.has(n.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${n.type} and ${r.type}`)}evaluateFilterExpression(e,t){const n=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){const t=e.filter;if(n instanceof V)switch(t.value){case"list":return n;case"first":return n.value[0];case"last":return n.value[n.value.length-1];case"length":return new B(n.value.length);case"reverse":return new V(n.value.reverse());case"sort":return new V(n.value.sort(((e,t)=>{if(e.type!==t.type)throw new Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw new Error(`Cannot compare type: ${e.type}`)}})));default:throw new Error(`Unknown ArrayValue filter: ${t.value}`)}else if(n instanceof z)switch(t.value){case"length":return new B(n.value.length);case"upper":return new z(n.value.toUpperCase());case"lower":return new z(n.value.toLowerCase());case"title":return new z(N(n.value));case"capitalize":return new z(n.value.charAt(0).toUpperCase()+n.value.slice(1));case"trim":return new z(n.value.trim());default:throw new Error(`Unknown StringValue filter: ${t.value}`)}else{if(n instanceof B){if("abs"===t.value)return new B(Math.abs(n.value));throw new Error(`Unknown NumericValue filter: ${t.value}`)}if(n instanceof j)switch(t.value){case"items":return new V(Array.from(n.value.entries()).map((([e,t])=>new V([new z(e),t]))));case"length":return new B(n.value.size);default:throw new Error(`Unknown ObjectValue filter: ${t.value}`)}}throw new Error(`Cannot apply filter "${t.value}" to type: ${n.type}`)}if("CallExpression"===e.filter.type){const r=e.filter;if("Identifier"!==r.callee.type)throw new Error(`Unknown filter: ${r.callee.type}`);const o=r.callee.value;if(n instanceof V){if("selectattr"===o){if(n.value.some((e=>!(e instanceof j))))throw new Error("`selectattr` can only be applied to array of objects");if(r.args.some((e=>"StringLiteral"!==e.type)))throw new Error("arguments of `selectattr` must be strings");const[e,o,i]=r.args.map((e=>this.evaluate(e,t)));let s;if(o){const e=t.tests.get(o.value);if(!e)throw new Error(`Unknown test: ${o.value}`);s=e}else s=(...e)=>e[0].__bool__().value;const a=n.value.filter((t=>{const n=t.value.get(e.value);return!!n&&s(n,i)}));return new V(a)}throw new Error(`Unknown ArrayValue filter: ${o}`)}throw new Error(`Cannot apply filter "${o}" to type: ${n.type}`)}throw new Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){const n=this.evaluate(e.operand,t),r=t.tests.get(e.test.value);if(!r)throw new Error(`Unknown test: ${e.test.value}`);const o=r(n);return new R(e.negate?!o:o)}evaluateUnaryExpression(e,t){const n=this.evaluate(e.argument,t);if("not"===e.operator.value)return new R(!n.value);throw new SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let n="";for(const r of e){const e=this.evaluate(r,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(n+=e.value)}return new z(n)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){const n=[],r=new Map;for(const o of e.args)if("KeywordArgumentExpression"===o.type){const e=o;r.set(e.key.value,this.evaluate(e.value,t))}else n.push(this.evaluate(o,t));r.size>0&&n.push(new j(r));const o=this.evaluate(e.callee,t);if("FunctionValue"!==o.type)throw new Error(`Cannot call something that is not a function: got ${o.type}`);return o.value(n,t)}evaluateSliceExpression(e,t,n){if(!(e instanceof V||e instanceof z))throw new Error("Slice object must be an array or string");const r=this.evaluate(t.start,n),o=this.evaluate(t.stop,n),i=this.evaluate(t.step,n);if(!(r instanceof B||r instanceof W))throw new Error("Slice start must be numeric or undefined");if(!(o instanceof B||o instanceof W))throw new Error("Slice stop must be numeric or undefined");if(!(i instanceof B||i instanceof W))throw new Error("Slice step must be numeric or undefined");return e instanceof V?new V(L(e.value,r.value,o.value,i.value)):new z(L(Array.from(e.value),r.value,o.value,i.value).join(""))}evaluateMemberExpression(e,t){const n=this.evaluate(e.object,t);let r,o;if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(n,e.property,t);r=this.evaluate(e.property,t)}else r=new z(e.property.value);if(n instanceof j){if(!(r instanceof z))throw new Error(`Cannot access property with non-string: got ${r.type}`);o=n.value.get(r.value)??n.builtins.get(r.value)}else if(n instanceof V||n instanceof z)if(r instanceof B)o=n.value.at(r.value),n instanceof z&&(o=new z(n.value.at(r.value)));else{if(!(r instanceof z))throw new Error(`Cannot access property with non-string/non-number: got ${r.type}`);o=n.builtins.get(r.value)}else{if(!(r instanceof z))throw new Error(`Cannot access property with non-string: got ${r.type}`);o=n.builtins.get(r.value)}return o instanceof $?o:new W}evaluateSet(e,t){const n=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){const r=e.assignee.value;t.setVariable(r,n)}else{if("MemberExpression"!==e.assignee.type)throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);{const r=e.assignee,o=this.evaluate(r.object,t);if(!(o instanceof j))throw new Error("Cannot assign to member of non-object");if("Identifier"!==r.property.type)throw new Error("Cannot assign to member with non-identifier property");o.value.set(r.property.value,n)}}return new q}evaluateIf(e,t){const n=this.evaluate(e.test,t);return this.evaluateBlock(n.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){const n=new H(t),r=this.evaluate(e.iterable,n);if(!(r instanceof V))throw new Error(`Expected iterable type in for loop: got ${r.type}`);let o="";for(let t=0;t<r.value.length;++t){const i=new Map([["index",new B(t+1)],["index0",new B(t)],["revindex",new B(r.value.length-t)],["revindex0",new B(r.value.length-t-1)],["first",new R(0===t)],["last",new R(t===r.value.length-1)],["length",new B(r.value.length)],["previtem",t>0?r.value[t-1]:new W],["nextitem",t<r.value.length-1?r.value[t+1]:new W]]);n.setVariable("loop",new j(i));const s=r.value[t];if("Identifier"===e.loopvar.type)n.setVariable(e.loopvar.value,s);else if("TupleLiteral"===e.loopvar.type){const t=e.loopvar;if("ArrayValue"!==s.type)throw new Error(`Cannot unpack non-iterable type: ${s.type}`);const r=s;if(t.value.length!==r.value.length)throw new Error(`Too ${t.value.length>r.value.length?"few":"many"} items to unpack`);for(let e=0;e<t.value.length;++e){if("Identifier"!==t.value[e].type)throw new Error(`Cannot unpack non-identifier type: ${t.value[e].type}`);n.setVariable(t.value[e].value,r.value[e])}}o+=this.evaluateBlock(e.body,n).value}return new z(o)}evaluate(e,t){if(void 0===e)return new W;switch(e.type){case"Program":return this.evalProgram(e,t);case"Set":return this.evaluateSet(e,t);case"If":return this.evaluateIf(e,t);case"For":return this.evaluateFor(e,t);case"NumericLiteral":return new B(Number(e.value));case"StringLiteral":return new z(e.value);case"BooleanLiteral":return new R(e.value);case"ArrayLiteral":return new V(e.value.map((e=>this.evaluate(e,t))));case"TupleLiteral":return new U(e.value.map((e=>this.evaluate(e,t))));case"ObjectLiteral":{const n=new Map;for(const[r,o]of e.value){const e=this.evaluate(r,t);if(!(e instanceof z))throw new Error(`Object keys must be strings: got ${e.type}`);n.set(e.value,this.evaluate(o,t))}return new j(n)}case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);default:throw new SyntaxError(`Unknown node type: ${e.type}`)}}};function Q(e){switch(typeof e){case"number":return new B(e);case"string":return new z(e);case"boolean":return new R(e);case"object":return null===e?new q:Array.isArray(e)?new V(e.map(Q)):new j(new Map(Object.entries(e).map((([e,t])=>[e,Q(t)]))));case"function":return new G(((t,n)=>Q(e(...t.map((e=>e.value)))??null)));default:throw new Error(`Cannot convert to runtime value: ${e}`)}}var Y=class{parsed;constructor(e){const t=u(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=I(t)}render(e){const t=new H;t.set("false",!1),t.set("true",!0),t.set("raise_exception",(e=>{throw new Error(e)})),t.set("range",D);for(const[n,r]of Object.entries(e))t.set(n,r);return new X(t).run(this.parsed).value}}},"./src/backends/onnx.js":
+/*!******************************!*\
+  !*** ./src/backends/onnx.js ***!
+  \******************************/(e,t,n)=>{var r,o;n.r(t),n.d(t,{ONNX:()=>a,executionProviders:()=>l});var i=n(/*! onnxruntime-node */"?2ce3"),s=n(/*! onnxruntime-web */"./node_modules/onnxruntime-web/dist/ort-web.min.js");let a;const l=["wasm"];if("undefined"!=typeof process&&"node"===process?.release?.name)a=i??(r||(r=n.t(i,2))),l.unshift("cpu");else{a=s??(o||(o=n.t(s,2)));"undefined"!=typeof navigator&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(a.env.wasm.simd=!1)}},"./src/configs.js":
+/*!************************!*\
+  !*** ./src/configs.js ***!
+  \************************/(e,t,n)=>{n.r(t),n.d(t,{AutoConfig:()=>i,PretrainedConfig:()=>o});var r=n(/*! ./utils/hub.js */"./src/utils/hub.js");class o{constructor(e){this.model_type=null,this.is_encoder_decoder=!1,Object.assign(this,e)}static async from_pretrained(e,{progress_callback:t=null,config:n=null,cache_dir:o=null,local_files_only:i=!1,revision:s="main"}={}){let a=n??await async function(e,t){return await(0,r.getModelJSON)(e,"config.json",!0,t)}(e,{progress_callback:t,config:n,cache_dir:o,local_files_only:i,revision:s});return new this(a)}}class i{static async from_pretrained(...e){return o.from_pretrained(...e)}}},"./src/env.js":
+/*!********************!*\
+  !*** ./src/env.js ***!
+  \********************/(e,t,n)=>{n.r(t),n.d(t,{env:()=>g});var r=n(/*! fs */"?569f"),o=n(/*! path */"?3f59"),i=n(/*! url */"?154a"),s=n(/*! ./backends/onnx.js */"./src/backends/onnx.js");const{env:a}=s.ONNX,l="2.17.2",c="undefined"!=typeof self&&"caches"in self,u=!b(r),p=!b(o),d=u&&p,_=d?o.dirname(o.dirname(i.fileURLToPath("file:///home/runner/work/transformers.js/transformers.js/src/env.js"))):"./",h=d?o.join(_,"/.cache/"):null,f="/models/",m=d?o.join(_,f):f;a?.wasm&&(a.wasm.wasmPaths=d?o.join(_,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${l}/dist/`);const g={backends:{onnx:a,tfjs:{}},__dirname:_,version:l,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath:m,useFS:u,useBrowserCache:c,useFSCache:u,cacheDir:h,useCustomCache:!1,customCache:null};function b(e){return 0===Object.keys(e).length}},"./src/models.js":
+/*!***********************!*\
+  !*** ./src/models.js ***!
+  \***********************/(e,t,n)=>{n.r(t),n.d(t,{ASTForAudioClassification:()=>Jt,ASTModel:()=>Zt,ASTPreTrainedModel:()=>Kt,AlbertForMaskedLM:()=>lt,AlbertForQuestionAnswering:()=>at,AlbertForSequenceClassification:()=>st,AlbertModel:()=>it,AlbertPreTrainedModel:()=>ot,AutoModel:()=>as,AutoModelForAudioClassification:()=>Ms,AutoModelForAudioFrameClassification:()=>Ps,AutoModelForCTC:()=>ks,AutoModelForCausalLM:()=>hs,AutoModelForDepthEstimation:()=>Es,AutoModelForDocumentQuestionAnswering:()=>As,AutoModelForImageClassification:()=>bs,AutoModelForImageFeatureExtraction:()=>Os,AutoModelForImageMatting:()=>Fs,AutoModelForImageSegmentation:()=>ws,AutoModelForImageToImage:()=>Cs,AutoModelForMaskGeneration:()=>vs,AutoModelForMaskedLM:()=>fs,AutoModelForObjectDetection:()=>ys,AutoModelForQuestionAnswering:()=>ms,AutoModelForSemanticSegmentation:()=>xs,AutoModelForSeq2SeqLM:()=>us,AutoModelForSequenceClassification:()=>ls,AutoModelForSpeechSeq2Seq:()=>ps,AutoModelForTextToSpectrogram:()=>ds,AutoModelForTextToWaveform:()=>_s,AutoModelForTokenClassification:()=>cs,AutoModelForVision2Seq:()=>gs,AutoModelForXVector:()=>Ss,AutoModelForZeroShotObjectDetection:()=>Ts,BartForConditionalGeneration:()=>xt,BartForSequenceClassification:()=>yt,BartModel:()=>wt,BartPretrainedModel:()=>bt,BaseModelOutput:()=>R,BeitForImageClassification:()=>Tr,BeitModel:()=>yr,BeitPreTrainedModel:()=>xr,BertForMaskedLM:()=>U,BertForQuestionAnswering:()=>W,BertForSequenceClassification:()=>G,BertForTokenClassification:()=>q,BertModel:()=>V,BertPreTrainedModel:()=>j,BlenderbotForConditionalGeneration:()=>Ft,BlenderbotModel:()=>At,BlenderbotPreTrainedModel:()=>Pt,BlenderbotSmallForConditionalGeneration:()=>Ot,BlenderbotSmallModel:()=>Et,BlenderbotSmallPreTrainedModel:()=>Ct,BloomForCausalLM:()=>Hn,BloomModel:()=>Wn,BloomPreTrainedModel:()=>qn,CLIPModel:()=>sn,CLIPPreTrainedModel:()=>on,CLIPSegForImageSegmentation:()=>gn,CLIPSegModel:()=>mn,CLIPSegPreTrainedModel:()=>fn,CLIPTextModelWithProjection:()=>an,CLIPVisionModelWithProjection:()=>ln,CamembertForMaskedLM:()=>fe,CamembertForQuestionAnswering:()=>be,CamembertForSequenceClassification:()=>me,CamembertForTokenClassification:()=>ge,CamembertModel:()=>he,CamembertPreTrainedModel:()=>_e,CausalLMOutput:()=>zs,CausalLMOutputWithPast:()=>Rs,ChineseCLIPModel:()=>hn,ChineseCLIPPreTrainedModel:()=>_n,ClapAudioModelWithProjection:()=>gi,ClapModel:()=>fi,ClapPreTrainedModel:()=>hi,ClapTextModelWithProjection:()=>mi,CodeGenForCausalLM:()=>Ln,CodeGenModel:()=>Dn,CodeGenPreTrainedModel:()=>In,ConvBertForMaskedLM:()=>re,ConvBertForQuestionAnswering:()=>se,ConvBertForSequenceClassification:()=>oe,ConvBertForTokenClassification:()=>ie,ConvBertModel:()=>ne,ConvBertPreTrainedModel:()=>te,ConvNextForImageClassification:()=>ro,ConvNextModel:()=>no,ConvNextPreTrainedModel:()=>to,ConvNextV2ForImageClassification:()=>so,ConvNextV2Model:()=>io,ConvNextV2PreTrainedModel:()=>oo,DPTForDepthEstimation:()=>Hr,DPTModel:()=>Wr,DPTPreTrainedModel:()=>qr,DebertaForMaskedLM:()=>ye,DebertaForQuestionAnswering:()=>ke,DebertaForSequenceClassification:()=>Te,DebertaForTokenClassification:()=>ve,DebertaModel:()=>xe,DebertaPreTrainedModel:()=>we,DebertaV2ForMaskedLM:()=>Pe,DebertaV2ForQuestionAnswering:()=>Ce,DebertaV2ForSequenceClassification:()=>Ae,DebertaV2ForTokenClassification:()=>Fe,DebertaV2Model:()=>Se,DebertaV2PreTrainedModel:()=>Me,DeiTForImageClassification:()=>Lr,DeiTModel:()=>Dr,DeiTPreTrainedModel:()=>Ir,DepthAnythingForDepthEstimation:()=>Qr,DepthAnythingPreTrainedModel:()=>Xr,DetrForObjectDetection:()=>Mr,DetrForSegmentation:()=>Sr,DetrModel:()=>kr,DetrObjectDetectionOutput:()=>Pr,DetrPreTrainedModel:()=>vr,DetrSegmentationOutput:()=>Ar,Dinov2ForImageClassification:()=>co,Dinov2Model:()=>lo,Dinov2PreTrainedModel:()=>ao,DistilBertForMaskedLM:()=>Ne,DistilBertForQuestionAnswering:()=>Le,DistilBertForSequenceClassification:()=>Ie,DistilBertForTokenClassification:()=>De,DistilBertModel:()=>Oe,DistilBertPreTrainedModel:()=>Ee,DonutSwinModel:()=>eo,DonutSwinPreTrainedModel:()=>Jr,EfficientNetForImageClassification:()=>Fi,EfficientNetModel:()=>Ai,EfficientNetPreTrainedModel:()=>Pi,ElectraForMaskedLM:()=>ce,ElectraForQuestionAnswering:()=>de,ElectraForSequenceClassification:()=>ue,ElectraForTokenClassification:()=>pe,ElectraModel:()=>le,ElectraPreTrainedModel:()=>ae,EsmForMaskedLM:()=>ze,EsmForSequenceClassification:()=>Re,EsmForTokenClassification:()=>je,EsmModel:()=>Be,EsmPreTrainedModel:()=>$e,FalconForCausalLM:()=>_i,FalconModel:()=>di,FalconPreTrainedModel:()=>pi,FastViTForImageClassification:()=>ir,FastViTModel:()=>or,FastViTPreTrainedModel:()=>rr,GLPNForDepthEstimation:()=>Zr,GLPNModel:()=>Kr,GLPNPreTrainedModel:()=>Yr,GPT2LMHeadModel:()=>xn,GPT2Model:()=>wn,GPT2PreTrainedModel:()=>bn,GPTBigCodeForCausalLM:()=>On,GPTBigCodeModel:()=>En,GPTBigCodePreTrainedModel:()=>Cn,GPTJForCausalLM:()=>Fn,GPTJModel:()=>An,GPTJPreTrainedModel:()=>Pn,GPTNeoForCausalLM:()=>vn,GPTNeoModel:()=>Tn,GPTNeoPreTrainedModel:()=>yn,GPTNeoXForCausalLM:()=>Sn,GPTNeoXModel:()=>Mn,GPTNeoXPreTrainedModel:()=>kn,HubertForCTC:()=>Go,HubertForSequenceClassification:()=>qo,HubertModel:()=>Uo,HubertPreTrainedModel:()=>Vo,ImageMattingOutput:()=>js,LlamaForCausalLM:()=>Bn,LlamaModel:()=>$n,LlamaPreTrainedModel:()=>Nn,LongT5ForConditionalGeneration:()=>ht,LongT5Model:()=>_t,LongT5PreTrainedModel:()=>dt,M2M100ForConditionalGeneration:()=>vo,M2M100Model:()=>To,M2M100PreTrainedModel:()=>yo,MBartForCausalLM:()=>St,MBartForConditionalGeneration:()=>kt,MBartForSequenceClassification:()=>Mt,MBartModel:()=>vt,MBartPreTrainedModel:()=>Tt,MPNetForMaskedLM:()=>Qe,MPNetForQuestionAnswering:()=>Ze,MPNetForSequenceClassification:()=>Ye,MPNetForTokenClassification:()=>Ke,MPNetModel:()=>Xe,MPNetPreTrainedModel:()=>He,MT5ForConditionalGeneration:()=>gt,MT5Model:()=>mt,MT5PreTrainedModel:()=>ft,MarianMTModel:()=>xo,MarianModel:()=>wo,MarianPreTrainedModel:()=>bo,MaskedLMOutput:()=>$s,MistralForCausalLM:()=>ai,MistralModel:()=>si,MistralPreTrainedModel:()=>ii,MobileBertForMaskedLM:()=>Ge,MobileBertForQuestionAnswering:()=>We,MobileBertForSequenceClassification:()=>qe,MobileBertModel:()=>Ue,MobileBertPreTrainedModel:()=>Ve,MobileViTForImageClassification:()=>ur,MobileViTModel:()=>cr,MobileViTPreTrainedModel:()=>lr,MobileViTV2ForImageClassification:()=>_r,MobileViTV2Model:()=>dr,MobileViTV2PreTrainedModel:()=>pr,ModelOutput:()=>z,MptForCausalLM:()=>Yn,MptModel:()=>Qn,MptPreTrainedModel:()=>Xn,NomicBertModel:()=>X,NomicBertPreTrainedModel:()=>H,OPTForCausalLM:()=>Jn,OPTModel:()=>Zn,OPTPreTrainedModel:()=>Kn,OwlViTForObjectDetection:()=>mr,OwlViTModel:()=>fr,OwlViTPreTrainedModel:()=>hr,Owlv2ForObjectDetection:()=>wr,Owlv2Model:()=>br,Owlv2PreTrainedModel:()=>gr,PhiForCausalLM:()=>Gn,PhiModel:()=>Un,PhiPreTrainedModel:()=>Vn,PreTrainedModel:()=>B,PretrainedMixin:()=>Ci,QuestionAnsweringModelOutput:()=>Bs,Qwen2ForCausalLM:()=>jn,Qwen2Model:()=>Rn,Qwen2PreTrainedModel:()=>zn,ResNetForImageClassification:()=>Br,ResNetModel:()=>$r,ResNetPreTrainedModel:()=>Nr,RoFormerForMaskedLM:()=>K,RoFormerForQuestionAnswering:()=>ee,RoFormerForSequenceClassification:()=>Z,RoFormerForTokenClassification:()=>J,RoFormerModel:()=>Y,RoFormerPreTrainedModel:()=>Q,RobertaForMaskedLM:()=>Lt,RobertaForQuestionAnswering:()=>Bt,RobertaForSequenceClassification:()=>Nt,RobertaForTokenClassification:()=>$t,RobertaModel:()=>Dt,RobertaPreTrainedModel:()=>It,SamImageSegmentationOutput:()=>go,SamModel:()=>mo,SamPreTrainedModel:()=>fo,SegformerForImageClassification:()=>Ti,SegformerForSemanticSegmentation:()=>vi,SegformerModel:()=>yi,SegformerPreTrainedModel:()=>xi,Seq2SeqLMOutput:()=>Is,SequenceClassifierOutput:()=>Ds,SiglipModel:()=>un,SiglipPreTrainedModel:()=>cn,SiglipTextModel:()=>pn,SiglipVisionModel:()=>dn,SpeechT5ForSpeechToText:()=>ei,SpeechT5ForTextToSpeech:()=>ti,SpeechT5HifiGan:()=>ni,SpeechT5Model:()=>Jo,SpeechT5PreTrainedModel:()=>Zo,SqueezeBertForMaskedLM:()=>tt,SqueezeBertForQuestionAnswering:()=>rt,SqueezeBertForSequenceClassification:()=>nt,SqueezeBertModel:()=>et,SqueezeBertPreTrainedModel:()=>Je,StableLmForCausalLM:()=>Si,StableLmModel:()=>Mi,StableLmPreTrainedModel:()=>ki,Starcoder2ForCausalLM:()=>ui,Starcoder2Model:()=>ci,Starcoder2PreTrainedModel:()=>li,Swin2SRForImageSuperResolution:()=>Gr,Swin2SRModel:()=>Ur,Swin2SRPreTrainedModel:()=>Vr,SwinForImageClassification:()=>jr,SwinModel:()=>Rr,SwinPreTrainedModel:()=>zr,T5ForConditionalGeneration:()=>pt,T5Model:()=>ut,T5PreTrainedModel:()=>ct,TableTransformerForObjectDetection:()=>Er,TableTransformerModel:()=>Cr,TableTransformerObjectDetectionOutput:()=>Or,TableTransformerPreTrainedModel:()=>Fr,TokenClassifierOutput:()=>Ns,TrOCRForCausalLM:()=>oi,TrOCRPreTrainedModel:()=>ri,UniSpeechForCTC:()=>Eo,UniSpeechForSequenceClassification:()=>Oo,UniSpeechModel:()=>Co,UniSpeechPreTrainedModel:()=>Fo,UniSpeechSatForAudioFrameClassification:()=>$o,UniSpeechSatForCTC:()=>Lo,UniSpeechSatForSequenceClassification:()=>No,UniSpeechSatModel:()=>Do,UniSpeechSatPreTrainedModel:()=>Io,ViTForImageClassification:()=>nr,ViTModel:()=>tr,ViTPreTrainedModel:()=>er,VisionEncoderDecoderModel:()=>rn,VitMatteForImageMatting:()=>ar,VitMattePreTrainedModel:()=>sr,VitsModel:()=>wi,VitsModelOutput:()=>Vs,VitsPreTrainedModel:()=>bi,Wav2Vec2BertForCTC:()=>Ro,Wav2Vec2BertForSequenceClassification:()=>jo,Wav2Vec2BertModel:()=>zo,Wav2Vec2BertPreTrainedModel:()=>Bo,Wav2Vec2ForAudioFrameClassification:()=>Ao,Wav2Vec2ForCTC:()=>So,Wav2Vec2ForSequenceClassification:()=>Po,Wav2Vec2Model:()=>Mo,Wav2Vec2PreTrainedModel:()=>ko,WavLMForAudioFrameClassification:()=>Ko,WavLMForCTC:()=>Xo,WavLMForSequenceClassification:()=>Qo,WavLMForXVector:()=>Yo,WavLMModel:()=>Ho,WavLMPreTrainedModel:()=>Wo,WhisperForConditionalGeneration:()=>nn,WhisperModel:()=>tn,WhisperPreTrainedModel:()=>en,XLMForQuestionAnswering:()=>Gt,XLMForSequenceClassification:()=>Vt,XLMForTokenClassification:()=>Ut,XLMModel:()=>Rt,XLMPreTrainedModel:()=>zt,XLMRobertaForMaskedLM:()=>Ht,XLMRobertaForQuestionAnswering:()=>Yt,XLMRobertaForSequenceClassification:()=>Xt,XLMRobertaForTokenClassification:()=>Qt,XLMRobertaModel:()=>Wt,XLMRobertaPreTrainedModel:()=>qt,XLMWithLMHeadModel:()=>jt,XVectorOutput:()=>Ls,YolosForObjectDetection:()=>_o,YolosModel:()=>po,YolosObjectDetectionOutput:()=>ho,YolosPreTrainedModel:()=>uo});var r=n(/*! ./configs.js */"./src/configs.js"),o=n(/*! ./utils/core.js */"./src/utils/core.js"),i=n(/*! ./utils/hub.js */"./src/utils/hub.js"),s=n(/*! ./utils/generation.js */"./src/utils/generation.js"),a=n(/*! ./utils/tensor.js */"./src/utils/tensor.js"),l=n(/*! ./backends/onnx.js */"./src/backends/onnx.js"),c=n(/*! ./transformers.js */"./src/transformers.js");const{InferenceSession:u,Tensor:p,env:d}=l.ONNX,_=0,h=1,f=2,m=3,g=4,b=5,w=new Map,x=new Map,y=new Map;async function T(e,t,n){let r=`onnx/${t}${n.quantized?"_quantized":""}.onnx`,o=await(0,i.getModelFile)(e,r,!0,n);try{return await u.create(o,{executionProviders:l.executionProviders})}catch(e){if(1===l.executionProviders.length&&"wasm"===l.executionProviders[0])throw e;return console.warn(e),console.warn("Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback. "),await u.create(o,{executionProviders:["wasm"]})}}async function v(e,t){const n=function(e,t){const n=Object.create(null),r=[];for(const o of e.inputNames){const e=t[o];e instanceof a.Tensor?n[o]=d.wasm.proxy?e.clone():e:r.push(o)}if(r.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${r.join(", ")}.`);const o=Object.keys(t).length,i=e.inputNames.length;if(o>i){let n=Object.keys(t).filter((t=>!e.inputNames.includes(t)));console.warn(`WARNING: Too many inputs were provided (${o} > ${i}). The following inputs will be ignored: "${n.join(", ")}".`)}return n}(e,t);try{let t=await e.run(n);return t=k(t),t}catch(e){throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",n),e}}function k(e){for(let t in e)e[t]instanceof p?e[t]=new a.Tensor(e[t]):"object"==typeof e[t]&&k(e[t]);return e}function M(e){if(e instanceof a.Tensor)return e;if(0===e.length)throw Error("items must be non-empty");if(Array.isArray(e[0])){if(e.some((t=>t.length!==e[0].length)))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new a.Tensor("int64",BigInt64Array.from(e.flat().map((e=>BigInt(e)))),[e.length,e[0].length])}return new a.Tensor("int64",BigInt64Array.from(e.map((e=>BigInt(e)))),[1,e.length])}function S(e,t){let n=e.config.pad_token_id??null,r=e.config.eos_token_id??null;(0,o.isIntegralNumber)(r)&&(r=[r]);let i=-1!==t.indexOf(n),s=null===r||!r.includes(n);if(i&&s){let e=BigInt64Array.from(t.data.map((e=>e!=n)));return new a.Tensor("int64",e,t.dims)}return(0,a.ones_like)(t)}function P(e,t,n){if(!e.inputNames.includes("position_ids"))return;const r=new BigInt64Array(t.attention_mask.data.length);for(let e=0;e<t.attention_mask.dims[0];++e){let n=e*t.attention_mask.dims[1],o=BigInt(0);for(let e=0;e<t.attention_mask.dims[1];++e){const i=n+e;0n===t.attention_mask.data[i]?r[i]=BigInt(1):(r[i]=o,o+=t.attention_mask.data[i])}}t.position_ids=new a.Tensor("int64",r,t.attention_mask.dims),n&&(t.position_ids=t.position_ids.slice(null,-1).unsqueeze_(-1))}function A(e){return new a.Tensor("bool",[e],[1])}async function F(e,t){let{encoder_outputs:n,past_key_values:r}=t;n||(n=(await I(e,t)).last_hidden_state);let o={input_ids:t.decoder_input_ids,encoder_hidden_states:n};const i=!!r;e.decoder_merged_session.inputNames.includes("use_cache_branch")&&(o.use_cache_branch=A(i)),e.decoder_merged_session.inputNames.includes("encoder_attention_mask")&&(o.encoder_attention_mask=t.attention_mask),P(e.decoder_merged_session,o,i),e.addPastKeyValues(o,r);const s=await v(e.decoder_merged_session,o);let a=s.logits;r=e.getPastKeyValues(s,r);const l=e.getAttentions(s);return new Is({logits:a,past_key_values:r,encoder_outputs:n,...l})}function C(e,t,n,r){let o=[],i=0;const s=e.requires_attention_mask??!0;let l=n.decoder_input_ids??n.decoder_start_token_id??n.bos_token_id??n.eos_token_id;l instanceof a.Tensor?l=l.tolist().flat():Array.isArray(l)||(l=[l]);for(let n of t){n.dims=[1,...n.dims];let t={inputs:n,encoder_outputs:null,prev_model_outputs:null,output_token_ids:l,done:!1,score:0,id:i++};s&&(t.attention_mask=S(e,n)),o.push(t)}return o}async function E(e,t){const n=e.main_input_name;let r=t.output_token_ids;t.prev_model_outputs&&(r=r.slice(-1));let o={[n]:t.inputs,decoder_input_ids:M(r),encoder_outputs:t.encoder_outputs,past_key_values:t.prev_model_outputs?.past_key_values};t.attention_mask&&(o.attention_mask=t.attention_mask);let i=await e.forward(o);return t.prev_model_outputs=i,t.encoder_outputs=i.encoder_outputs,i}function O(e,t){e.output_token_ids=[...e.output_token_ids,t]}async function I(e,t){const n=Object.create(null);for(const r of e.session.inputNames)n[r]=t[r];return e.session.inputNames.includes("token_type_ids")&&!n.token_type_ids&&(n.token_type_ids=new a.Tensor("int64",new BigInt64Array(n.input_ids.data.length),n.input_ids.dims)),await v(e.session,n)}async function D(e,t){let{input_ids:n,past_key_values:r,attention_mask:o}=t,i={input_ids:n,attention_mask:o??S(e,n)};const s=!!r;e.session.inputNames.includes("use_cache_branch")&&(i.use_cache_branch=A(s)),P(e.session,i,s),e.addPastKeyValues(i,r);let a=await v(e.session,i),l=a.logits;return r=e.getPastKeyValues(a,r),{logits:l,past_key_values:r}}function L(e,t,n,r,o){let i=[],s=0;for(let n of t){let t,a=n.tolist().map(Number);n.dims=[1,...n.dims],o?(t=o[s],t.dims=[1,...t.dims]):t=S(e,n);let l={input:n,model_input_ids:n,attention_mask:t,prev_model_outputs:null,output_token_ids:a,num_output_tokens:r,done:!1,score:0,id:s++};i.push(l)}return i}async function N(e,t){let n=new BigInt64Array(t.output_token_ids.length).fill(1n),r={input_ids:t.model_input_ids,attention_mask:new a.Tensor("int64",n,[1,n.length]),past_key_values:t.prev_model_outputs?.past_key_values},o=await e.forward(r);return t.prev_model_outputs=o,o}function $(e,t){e.output_token_ids=[...e.output_token_ids,t],e.model_input_ids=new a.Tensor("int64",[BigInt(t)],[1,1])}class B extends o.Callable{main_input_name="input_ids";constructor(e,t){super(),this.config=e,this.session=t;const n=y.get(this.constructor),r=w.get(n);this.can_generate=!1,this._runBeam=null,this._getStartBeams=null,this._updateBeam=null,this._forward=null,r===g?(this.can_generate=!0,this._runBeam=N,this._getStartBeams=L,this._updateBeam=$,this._forward=D):r===f||r===m?(this.can_generate=!0,this._runBeam=E,this._getStartBeams=C,this._updateBeam=O,this._forward=F):this._forward=I}async dispose(){const e=[];for(let t of Object.keys(this)){const n=this[t];n instanceof u&&e.push(n.handler.dispose())}return await Promise.all(e)}static async from_pretrained(e,{quantized:t=!0,progress_callback:n=null,config:o=null,cache_dir:s=null,local_files_only:a=!1,revision:l="main",model_file_name:c=null}={}){let u={quantized:t,progress_callback:n,config:o,cache_dir:s,local_files_only:a,revision:l,model_file_name:c};const p=y.get(this),d=w.get(p);let x;return d===g?x=await Promise.all([r.AutoConfig.from_pretrained(e,u),T(e,u.model_file_name??"decoder_model_merged",u),(0,i.getModelJSON)(e,"generation_config.json",!1,u)]):d===f||d===m?x=await Promise.all([r.AutoConfig.from_pretrained(e,u),T(e,"encoder_model",u),T(e,"decoder_model_merged",u),(0,i.getModelJSON)(e,"generation_config.json",!1,u)]):d===b?x=await Promise.all([r.AutoConfig.from_pretrained(e,u),T(e,"vision_encoder",u),T(e,"prompt_encoder_mask_decoder",u)]):d===h?x=await Promise.all([r.AutoConfig.from_pretrained(e,u),T(e,"encoder_model",u),T(e,"decoder_model_merged",u)]):(d!==_&&console.warn(`Model type for '${p??o?.model_type}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`),x=await Promise.all([r.AutoConfig.from_pretrained(e,u),T(e,u.model_file_name??"model",u)])),new this(...x)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}_get_logits_processor(e,t,n=null){const r=new s.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&r.push(new s.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&r.push(new s.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&r.push(new s.NoBadWordsLogitsProcessor(e.bad_words_ids,e.eos_token_id)),null!==e.min_length&&null!==e.eos_token_id&&e.min_length>0&&r.push(new s.MinLengthLogitsProcessor(e.min_length,e.eos_token_id)),null!==e.min_new_tokens&&null!==e.eos_token_id&&e.min_new_tokens>0&&r.push(new s.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&r.push(new s.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&r.push(new s.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){let n=t>1||null===e.forced_bos_token_id?t:t+1;null!==e.forced_decoder_ids&&(n+=e.forced_decoder_ids[e.forced_decoder_ids.length-1][0]),r.push(new s.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,n))}return null!==e.forced_decoder_ids&&r.push(new s.ForceTokensLogitsProcessor(e.forced_decoder_ids)),null!==n&&r.extend(n),r}_get_generation_config(e){let t=new s.GenerationConfig(this.config);return"generation_config"in this&&Object.assign(t,this.generation_config),null!==e&&Object.assign(t,e),t}async generate(e,t=null,n=null,{inputs_attention_mask:r=null}={}){if(!this.can_generate){let e=`The current model class (${y.get(this.constructor)}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;const t=this.config.model_type,n=Ri.get(t)??zi.get(t)??Di.get(t)??Ui.get(t);throw n&&(e+=` Please use the following class instead: '${n[0]}'`),Error(e)}if(!(e instanceof a.Tensor||(0,o.isTypedArray)(e)||Array.isArray(e)))throw Error(`\`inputs\` must be a Tensor, TypedArray, or Array, but is "${e.constructor.name}".`);let i;if(this.config.is_encoder_decoder)i=0;else if(i=e instanceof a.Tensor?e.dims.at(-1):e.length,0===i)throw Error("Must supply a non-empty array of input token ids.");t=this._get_generation_config(t),n=n??new s.LogitsProcessorList,n=this._get_logits_processor(t,i,n);let l=t.eos_token_id;null===l||Array.isArray(l)||(l=[l]);let c=1;const u=c+(t.max_new_tokens??1/0),p=Number.isInteger(t.max_length)&&null===(t.max_new_tokens??null);let d=s.Sampler.getSampler(t),_=this.getStartBeams(e,t,c,r);for(;_.some((e=>!e.done))&&c<u;){let e=[];for(let r of _){if(r.done){e.push(r);continue}if(p&&r.output_token_ids.length>=t.max_length){r.done=!0,e.push(r);continue}let o=await this.runBeam(r);t.output_attentions&&this.addAttentionsToBeam(r,o),t.output_scores;let i=o.logits.slice(null,-1,null);n(r.output_token_ids,i);let s=d(i);for(let[t,n]of s){let o={...r};this.updateBeam(o,t),o.score+=n,l&&l.includes(t)&&(o.done=!0),e.push(o)}}++c,e=this.groupBeams(e).map((e=>e.sort(((e,t)=>t.score-e.score)).slice(0,t.num_beams))),_=e.flat(),t.callback_function&&t.callback_function(_)}const h=this.groupBeams(_),f=e=>h.map((n=>t.num_return_sequences>1?n.slice(0,t.num_return_sequences).map((t=>t[e])):[n[0][e]])).flat(),m=f("output_token_ids");if(t.return_dict_in_generate){return{sequences:m,decoder_attentions:f("decoder_attentions"),cross_attentions:f("cross_attentions")}}return m}addAttentionsToBeam(e,t){if(this.config.is_encoder_decoder){if(!t.cross_attentions||0===t.cross_attentions.length)throw Error("`output_attentions` is true, but the model did not produce cross-attentions. This is most likely because the model was not exported with `output_attentions=True`.");e.cross_attentions||(e.cross_attentions=[]),e.cross_attentions.push(t.cross_attentions)}if(!t.decoder_attentions||0===t.decoder_attentions.length)throw Error("`output_attentions` is true, but the model did not produce decoder-attentions. This is most likely because the model was not exported with `output_attentions=True`.");e.decoder_attentions||(e.decoder_attentions=[]),e.decoder_attentions.push(t.decoder_attentions)}groupBeams(e){const t=Object.create(null);for(const n of e)void 0===t[n.id]?t[n.id]=[n]:t[n.id].push(n);return Object.values(t)}getPastKeyValues(e,t){const n=Object.create(null);for(const r in e)if(r.startsWith("present")){let o=r.replace("present","past_key_values");t&&r.includes("encoder")?n[o]=t[o]:n[o]=e[r]}return n}getAttentions(e){const t=Object.create(null);for(const n of["cross_attentions","decoder_attentions"]){const r=[];for(const t in e)if(t.startsWith(n)){r[t.split(".").pop()]=e[t]}t[n]=r}return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{const t=1;if(this.config.is_encoder_decoder&&(this.add_encoder_pkv??1)){let n=[t,this.num_encoder_heads,0,this.encoder_dim_kv],r=[t,this.num_decoder_heads,0,this.decoder_dim_kv];for(let t=0;t<this.num_decoder_layers;++t)e[`past_key_values.${t}.encoder.key`]=new a.Tensor("float32",[],n),e[`past_key_values.${t}.encoder.value`]=new a.Tensor("float32",[],n),e[`past_key_values.${t}.decoder.key`]=new a.Tensor("float32",[],r),e[`past_key_values.${t}.decoder.value`]=new a.Tensor("float32",[],r)}else if("falcon"===this.config.model_type){let n=[t*this.num_heads,0,this.dim_kv];for(let t=0;t<this.num_layers;++t)e[`past_key_values.${t}.key`]=new a.Tensor("float32",[],n),e[`past_key_values.${t}.value`]=new a.Tensor("float32",[],n)}else if(this.config.multi_query){let n=[t*this.num_heads,0,2*this.dim_kv];for(let t=0;t<this.num_layers;++t)e[`past_key_values.${t}.key_value`]=new a.Tensor("float32",[],n)}else if("bloom"===this.config.model_type){let n=[t*this.num_heads,this.dim_kv,0],r=[t*this.num_heads,0,this.dim_kv];for(let t=0;t<this.num_layers;++t)e[`past_key_values.${t}.key`]=new a.Tensor("float32",[],n),e[`past_key_values.${t}.value`]=new a.Tensor("float32",[],r)}else{let n=[t,this.num_heads,0,this.dim_kv];for(let t=0;t<this.num_layers;++t)e[`past_key_values.${t}.key`]=new a.Tensor("float32",[],n),e[`past_key_values.${t}.value`]=new a.Tensor("float32",[],n)}}}getStartBeams(e,t,n,r){return this._getStartBeams(this,e,t,n,r)}async runBeam(e){return await this._runBeam(this,e)}updateBeam(e,t){return this._updateBeam(e,t)}}class z{}class R extends z{constructor({last_hidden_state:e,hidden_states:t=null,attentions:n=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=n}}class j extends B{}class V extends j{}class U extends j{async _call(e){return new $s(await super._call(e))}}class G extends j{async _call(e){return new Ds(await super._call(e))}}class q extends j{async _call(e){return new Ns(await super._call(e))}}class W extends j{async _call(e){return new Bs(await super._call(e))}}class H extends B{}class X extends H{}class Q extends B{}class Y extends Q{}class K extends Q{async _call(e){return new $s(await super._call(e))}}class Z extends Q{async _call(e){return new Ds(await super._call(e))}}class J extends Q{async _call(e){return new Ns(await super._call(e))}}class ee extends Q{async _call(e){return new Bs(await super._call(e))}}class te extends B{}class ne extends te{}class re extends te{async _call(e){return new $s(await super._call(e))}}class oe extends te{async _call(e){return new Ds(await super._call(e))}}class ie extends te{async _call(e){return new Ns(await super._call(e))}}class se extends te{async _call(e){return new Bs(await super._call(e))}}class ae extends B{}class le extends ae{}class ce extends ae{async _call(e){return new $s(await super._call(e))}}class ue extends ae{async _call(e){return new Ds(await super._call(e))}}class pe extends ae{async _call(e){return new Ns(await super._call(e))}}class de extends ae{async _call(e){return new Bs(await super._call(e))}}class _e extends B{}class he extends _e{}class fe extends _e{async _call(e){return new $s(await super._call(e))}}class me extends _e{async _call(e){return new Ds(await super._call(e))}}class ge extends _e{async _call(e){return new Ns(await super._call(e))}}class be extends _e{async _call(e){return new Bs(await super._call(e))}}class we extends B{}class xe extends we{}class ye extends we{async _call(e){return new $s(await super._call(e))}}class Te extends we{async _call(e){return new Ds(await super._call(e))}}class ve extends we{async _call(e){return new Ns(await super._call(e))}}class ke extends we{async _call(e){return new Bs(await super._call(e))}}class Me extends B{}class Se extends Me{}class Pe extends Me{async _call(e){return new $s(await super._call(e))}}class Ae extends Me{async _call(e){return new Ds(await super._call(e))}}class Fe extends Me{async _call(e){return new Ns(await super._call(e))}}class Ce extends Me{async _call(e){return new Bs(await super._call(e))}}class Ee extends B{}class Oe extends Ee{}class Ie extends Ee{async _call(e){return new Ds(await super._call(e))}}class De extends Ee{async _call(e){return new Ns(await super._call(e))}}class Le extends Ee{async _call(e){return new Bs(await super._call(e))}}class Ne extends Ee{async _call(e){return new $s(await super._call(e))}}class $e extends B{}class Be extends $e{}class ze extends $e{async _call(e){return new $s(await super._call(e))}}class Re extends $e{async _call(e){return new Ds(await super._call(e))}}class je extends $e{async _call(e){return new Ns(await super._call(e))}}class Ve extends B{}class Ue extends Ve{}class Ge extends Ve{async _call(e){return new $s(await super._call(e))}}class qe extends Ve{async _call(e){return new Ds(await super._call(e))}}class We extends Ve{async _call(e){return new Bs(await super._call(e))}}class He extends B{}class Xe extends He{}class Qe extends He{async _call(e){return new $s(await super._call(e))}}class Ye extends He{async _call(e){return new Ds(await super._call(e))}}class Ke extends He{async _call(e){return new Ns(await super._call(e))}}class Ze extends He{async _call(e){return new Bs(await super._call(e))}}class Je extends B{}class et extends Je{}class tt extends Je{async _call(e){return new $s(await super._call(e))}}class nt extends Je{async _call(e){return new Ds(await super._call(e))}}class rt extends Je{async _call(e){return new Bs(await super._call(e))}}class ot extends B{}class it extends ot{}class st extends ot{async _call(e){return new Ds(await super._call(e))}}class at extends ot{async _call(e){return new Bs(await super._call(e))}}class lt extends ot{async _call(e){return new $s(await super._call(e))}}class ct extends B{}class ut extends ct{}class pt extends ct{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.num_decoder_layers,this.num_decoder_heads=this.config.num_heads,this.decoder_dim_kv=this.config.d_kv,this.num_encoder_layers=this.config.num_layers,this.num_encoder_heads=this.config.num_heads,this.encoder_dim_kv=this.config.d_kv}}class dt extends B{}class _t extends dt{}class ht extends dt{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.num_decoder_layers,this.num_decoder_heads=this.config.num_heads,this.decoder_dim_kv=this.config.d_kv,this.num_encoder_layers=this.config.num_layers,this.num_encoder_heads=this.config.num_heads,this.encoder_dim_kv=this.config.d_kv}}class ft extends B{}class mt extends ft{}class gt extends ft{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.num_decoder_layers,this.num_decoder_heads=this.config.num_heads,this.decoder_dim_kv=this.config.d_kv,this.num_encoder_layers=this.config.num_layers,this.num_encoder_heads=this.config.num_heads,this.encoder_dim_kv=this.config.d_kv}}class bt extends B{}class wt extends bt{}class xt extends bt{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class yt extends bt{async _call(e){return new Ds(await super._call(e))}}class Tt extends B{}class vt extends Tt{}class kt extends Tt{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class Mt extends Tt{async _call(e){return new Ds(await super._call(e))}}class St extends Tt{constructor(e,t,n){super(e,t),this.generation_config=n,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class Pt extends B{}class At extends Pt{}class Ft extends Pt{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class Ct extends B{}class Et extends Ct{}class Ot extends Ct{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class It extends B{}class Dt extends It{}class Lt extends It{async _call(e){return new $s(await super._call(e))}}class Nt extends It{async _call(e){return new Ds(await super._call(e))}}class $t extends It{async _call(e){return new Ns(await super._call(e))}}class Bt extends It{async _call(e){return new Bs(await super._call(e))}}class zt extends B{}class Rt extends zt{}class jt extends zt{async _call(e){return new $s(await super._call(e))}}class Vt extends zt{async _call(e){return new Ds(await super._call(e))}}class Ut extends zt{async _call(e){return new Ns(await super._call(e))}}class Gt extends zt{async _call(e){return new Bs(await super._call(e))}}class qt extends B{}class Wt extends qt{}class Ht extends qt{async _call(e){return new $s(await super._call(e))}}class Xt extends qt{async _call(e){return new Ds(await super._call(e))}}class Qt extends qt{async _call(e){return new Ns(await super._call(e))}}class Yt extends qt{async _call(e){return new Bs(await super._call(e))}}class Kt extends B{}class Zt extends Kt{}class Jt extends Kt{}class en extends B{}class tn extends en{}class nn extends en{requires_attention_mask=!1;main_input_name="input_features";constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}async generate(e,t=null,n=null){if(t=this._get_generation_config(t),t.return_timestamps??=!1,t.return_timestamps&&(n=[new s.WhisperTimeStampLogitsProcessor(t)]),t.return_token_timestamps&&(t.output_attentions=!0,t.return_dict_in_generate=!0,"translate"===t.task&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),!t.alignment_heads))throw new Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");const r=await super.generate(e,t,n);return t.return_token_timestamps&&t.alignment_heads&&(r.token_timestamps=this._extract_token_timestamps(r,t.alignment_heads,t.num_frames)),r}_extract_token_timestamps(e,t,n=null,r=.02){if(!e.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");let i=this.config.median_filter_width;void 0===i&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),i=7);const s=e.cross_attentions.map((e=>{let r=Array.from({length:this.config.decoder_layers},((t,n)=>(0,a.cat)(e.map((e=>e[n])),2))),o=(0,a.stack)(t.map((([e,t])=>n?r[e].slice(null,t,null,[0,n]):r[e].slice(null,t))));o=o.transpose(1,0,2,3);let[s,l]=(0,a.std_mean)(o,-2,0,!0),u=o.clone();for(let e=0;e<u.dims[0];++e){let t=u[e];for(let n=0;n<t.dims[0];++n){let r=t[n];const o=s[e][n][0],a=l[e][n][0];for(let e=0;e<r.dims[0];++e){let t=r[e];for(let e=0;e<t.data.length;++e)t.data[e]=(t.data[e]-a.data[e])/o.data[e];t.data.set((0,c.medianFilter)(t.data,i))}}}return(0,a.mean)(u,1)})),l=[e.sequences.length,e.sequences[0].length],u=new a.Tensor("float32",new Float32Array(l[0]*l[1]),l);for(let e=0;e<l[0];++e){const t=s[e].neg().squeeze_(0);let[n,i]=(0,a.dynamicTimeWarping)(t),l=Array.from({length:n.length-1},((e,t)=>n[t+1]-n[t])),c=(0,o.mergeArrays)([1],l).map((e=>!!e)),p=[];for(let e=0;e<c.length;++e)c[e]&&p.push(i[e]*r);u[e].data.set(p,1)}return u}}class rn extends B{main_input_name="pixel_values";constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r;const o=this.config.encoder,i=this.config.decoder,s=o.model_type;(Ei.get(s)??Oi.get(s))||console.warn(`Model type for encoder '${s}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`);const a=Ri.get(i.model_type);if(!a)throw new Error(`Unable to construct \`VisionEncoderDecoder\` due to unsupported decoder: "${this.config.decoder.model_type}"`);const l=new(0,a[1])(i,n,r);this.add_encoder_pkv="num_decoder_layers"in l,this.add_encoder_pkv?(this.num_decoder_layers=l.num_decoder_layers,this.num_decoder_heads=l.num_decoder_heads,this.decoder_dim_kv=l.decoder_dim_kv,this.num_encoder_layers=l.num_encoder_layers,this.num_encoder_heads=l.num_encoder_heads,this.encoder_dim_kv=l.encoder_dim_kv):(this.num_layers=l.num_layers,this.num_heads=l.num_heads,this.dim_kv=l.dim_kv)}}class on extends B{}class sn extends on{}class an extends on{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class ln extends on{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class cn extends B{}class un extends cn{}class pn extends cn{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class dn extends on{static async from_pretrained(e,t={}){return t.model_file_name??="vision_model",super.from_pretrained(e,t)}}class _n extends B{}class hn extends _n{}class fn extends B{}class mn extends fn{}class gn extends fn{}class bn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class wn extends bn{}class xn extends bn{}class yn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_heads,this.num_layers=this.config.num_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class Tn extends yn{}class vn extends yn{}class kn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class Mn extends kn{}class Sn extends kn{}class Pn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class An extends Pn{}class Fn extends Pn{}class Cn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class En extends Cn{}class On extends Cn{}class In extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.n_embd/this.num_heads}}class Dn extends In{}class Ln extends In{}class Nn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads??this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class $n extends Nn{}class Bn extends Nn{}class zn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads??this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class Rn extends zn{}class jn extends zn{}class Vn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class Un extends Vn{}class Gn extends Vn{}class qn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.n_head,this.num_layers=this.config.n_layer,this.dim_kv=this.config.hidden_size/this.num_heads}}class Wn extends qn{}class Hn extends qn{}class Xn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.n_heads,this.num_layers=this.config.n_layers,this.dim_kv=this.config.d_model/this.num_heads}}class Qn extends Xn{}class Yn extends Xn{}class Kn extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class Zn extends Kn{}class Jn extends Kn{}class er extends B{}class tr extends er{}class nr extends er{async _call(e){return new Ds(await super._call(e))}}class rr extends B{}class or extends rr{}class ir extends rr{async _call(e){return new Ds(await super._call(e))}}class sr extends B{}class ar extends sr{async _call(e){return new js(await super._call(e))}}class lr extends B{}class cr extends lr{}class ur extends lr{async _call(e){return new Ds(await super._call(e))}}class pr extends B{}class dr extends pr{}class _r extends pr{async _call(e){return new Ds(await super._call(e))}}class hr extends B{}class fr extends hr{}class mr extends hr{}class gr extends B{}class br extends gr{}class wr extends gr{}class xr extends B{}class yr extends xr{}class Tr extends xr{async _call(e){return new Ds(await super._call(e))}}class vr extends B{}class kr extends vr{}class Mr extends vr{async _call(e){return new Pr(await super._call(e))}}class Sr extends vr{async _call(e){return new Ar(await super._call(e))}}class Pr extends z{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Ar extends z{constructor({logits:e,pred_boxes:t,pred_masks:n}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=n}}class Fr extends B{}class Cr extends Fr{}class Er extends Fr{async _call(e){return new Or(await super._call(e))}}class Or extends Pr{}class Ir extends B{}class Dr extends Ir{}class Lr extends Ir{async _call(e){return new Ds(await super._call(e))}}class Nr extends B{}class $r extends Nr{}class Br extends Nr{async _call(e){return new Ds(await super._call(e))}}class zr extends B{}class Rr extends zr{}class jr extends zr{async _call(e){return new Ds(await super._call(e))}}class Vr extends B{}class Ur extends Vr{}class Gr extends Vr{}class qr extends B{}class Wr extends qr{}class Hr extends qr{}class Xr extends B{}class Qr extends Xr{}class Yr extends B{}class Kr extends Yr{}class Zr extends Yr{}class Jr extends B{}class eo extends Jr{}class to extends B{}class no extends to{}class ro extends to{async _call(e){return new Ds(await super._call(e))}}class oo extends B{}class io extends oo{}class so extends oo{async _call(e){return new Ds(await super._call(e))}}class ao extends B{}class lo extends ao{}class co extends ao{async _call(e){return new Ds(await super._call(e))}}class uo extends B{}class po extends uo{}class _o extends uo{async _call(e){return new ho(await super._call(e))}}class ho extends z{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class fo extends B{}class mo extends fo{constructor(e,t,n){super(e,t),this.prompt_encoder_mask_decoder=n}async get_image_embeddings({pixel_values:e}){return await I(this,{pixel_values:e})}async forward(e){if(e.image_embeddings&&e.image_positional_embeddings||(e={...e,...await this.get_image_embeddings(e)}),!e.input_labels){const t=e.input_points.dims.slice(0,-1),n=t.reduce(((e,t)=>e*t),1);e.input_labels=new a.Tensor("int64",new BigInt64Array(n).fill(1n),t)}return await v(this.prompt_encoder_mask_decoder,{input_points:e.input_points,input_labels:e.input_labels,image_embeddings:e.image_embeddings,image_positional_embeddings:e.image_positional_embeddings})}async _call(e){return new go(await super._call(e))}}class go extends z{constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class bo extends B{}class wo extends bo{}class xo extends bo{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class yo extends B{}class To extends yo{}class vo extends yo{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class ko extends B{}class Mo extends ko{}class So extends ko{async _call(e){return new zs(await super._call(e))}}class Po extends ko{async _call(e){return new Ds(await super._call(e))}}class Ao extends ko{async _call(e){return new Ns(await super._call(e))}}class Fo extends B{}class Co extends Fo{}class Eo extends Fo{async _call(e){return new zs(await super._call(e))}}class Oo extends Fo{async _call(e){return new Ds(await super._call(e))}}class Io extends B{}class Do extends Io{}class Lo extends Io{async _call(e){return new zs(await super._call(e))}}class No extends Io{async _call(e){return new Ds(await super._call(e))}}class $o extends Io{async _call(e){return new Ns(await super._call(e))}}class Bo extends B{}class zo extends Bo{}class Ro extends Bo{async _call(e){return new zs(await super._call(e))}}class jo extends Bo{async _call(e){return new Ds(await super._call(e))}}class Vo extends B{}class Uo extends ko{}class Go extends ko{async _call(e){return new zs(await super._call(e))}}class qo extends ko{async _call(e){return new Ds(await super._call(e))}}class Wo extends B{}class Ho extends Wo{}class Xo extends Wo{async _call(e){return new zs(await super._call(e))}}class Qo extends Wo{async _call(e){return new Ds(await super._call(e))}}class Yo extends Wo{async _call(e){return new Ls(await super._call(e))}}class Ko extends Wo{async _call(e){return new Ns(await super._call(e))}}class Zo extends B{}class Jo extends Zo{}class ei extends Zo{}class ti extends Zo{constructor(e,t,n,r){super(e,t),this.decoder_merged_session=n,this.generation_config=r,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.hidden_size/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.hidden_size/this.num_encoder_heads}async generate_speech(e,t,{threshold:n=.5,minlenratio:r=0,maxlenratio:o=20,vocoder:i=null}={}){const s={input_ids:e},{encoder_outputs:l,encoder_attention_mask:c}=await I(this,s),u=l.dims[1]/this.config.reduction_factor,p=Math.floor(u*o),d=Math.floor(u*r),_=this.config.num_mel_bins;let h=[],f=null,m=null,g=0;for(;;){++g;const e=A(!!m);let r;r=m?m.output_sequence_out:new a.Tensor("float32",new Float32Array(_),[1,1,_]);let o={use_cache_branch:e,output_sequence:r,encoder_attention_mask:c,speaker_embeddings:t,encoder_hidden_states:l};this.addPastKeyValues(o,f),m=await v(this.decoder_merged_session,o),f=this.getPastKeyValues(m,f);const{prob:i,spectrum:s}=m;if(h.push(s),g>=d&&(Array.from(i.data).filter((e=>e>=n)).length>0||g>=p))break}const b=(0,a.cat)(h),{waveform:w}=await v(i.session,{spectrogram:b});return{spectrogram:b,waveform:w}}}class ni extends B{main_input_name="spectrogram"}class ri extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_encoder_layers=this.num_decoder_layers=this.config.decoder_layers,this.num_encoder_heads=this.num_decoder_heads=this.config.decoder_attention_heads,this.encoder_dim_kv=this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads}}class oi extends ri{}class ii extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class si extends ii{}class ai extends ii{}class li extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class ci extends li{}class ui extends li{}class pi extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class di extends pi{}class _i extends pi{}class hi extends B{}class fi extends hi{}class mi extends hi{static async from_pretrained(e,t={}){return t.model_file_name??="text_model",super.from_pretrained(e,t)}}class gi extends hi{static async from_pretrained(e,t={}){return t.model_file_name??="audio_model",super.from_pretrained(e,t)}}class bi extends B{}class wi extends bi{async _call(e){return new Vs(await super._call(e))}}class xi extends B{}class yi extends xi{}class Ti extends xi{}class vi extends xi{}class ki extends B{constructor(e,t,n){super(e,t),this.generation_config=n,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class Mi extends ki{}class Si extends ki{}class Pi extends B{}class Ai extends Pi{}class Fi extends Pi{async _call(e){return new Ds(await super._call(e))}}class Ci{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{quantized:t=!0,progress_callback:n=null,config:o=null,cache_dir:i=null,local_files_only:s=!1,revision:a="main",model_file_name:l=null}={}){let c={quantized:t,progress_callback:n,config:o,cache_dir:i,local_files_only:s,revision:a,model_file_name:l};if(o=await r.AutoConfig.from_pretrained(e,c),c.config||(c.config=o),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);for(let t of this.MODEL_CLASS_MAPPINGS){const n=t.get(o.model_type);if(n)return await n[1].from_pretrained(e,c)}if(this.BASE_IF_FAIL)return console.warn(`Unknown model class "${o.model_type}", attempting to construct from base class.`),await B.from_pretrained(e,c);throw Error(`Unsupported model type: ${o.model_type}`)}}const Ei=new Map([["bert",["BertModel",V]],["nomic_bert",["NomicBertModel",X]],["roformer",["RoFormerModel",Y]],["electra",["ElectraModel",le]],["esm",["EsmModel",Be]],["convbert",["ConvBertModel",ne]],["camembert",["CamembertModel",he]],["deberta",["DebertaModel",xe]],["deberta-v2",["DebertaV2Model",Se]],["mpnet",["MPNetModel",Xe]],["albert",["AlbertModel",it]],["distilbert",["DistilBertModel",Oe]],["roberta",["RobertaModel",Dt]],["xlm",["XLMModel",Rt]],["xlm-roberta",["XLMRobertaModel",Wt]],["clap",["ClapModel",fi]],["clip",["CLIPModel",sn]],["clipseg",["CLIPSegModel",mn]],["chinese_clip",["ChineseCLIPModel",hn]],["siglip",["SiglipModel",un]],["mobilebert",["MobileBertModel",Ue]],["squeezebert",["SqueezeBertModel",et]],["wav2vec2",["Wav2Vec2Model",Mo]],["wav2vec2-bert",["Wav2Vec2BertModel",zo]],["unispeech",["UniSpeechModel",Co]],["unispeech-sat",["UniSpeechSatModel",Do]],["hubert",["HubertModel",Uo]],["wavlm",["WavLMModel",Ho]],["audio-spectrogram-transformer",["ASTModel",Zt]],["vits",["VitsModel",wi]],["detr",["DetrModel",kr]],["table-transformer",["TableTransformerModel",Cr]],["vit",["ViTModel",tr]],["fastvit",["FastViTModel",or]],["mobilevit",["MobileViTModel",cr]],["mobilevitv2",["MobileViTV2Model",dr]],["owlvit",["OwlViTModel",fr]],["owlv2",["Owlv2Model",br]],["beit",["BeitModel",yr]],["deit",["DeiTModel",Dr]],["convnext",["ConvNextModel",no]],["convnextv2",["ConvNextV2Model",io]],["dinov2",["Dinov2Model",lo]],["resnet",["ResNetModel",$r]],["swin",["SwinModel",Rr]],["swin2sr",["Swin2SRModel",Ur]],["donut-swin",["DonutSwinModel",eo]],["yolos",["YolosModel",po]],["dpt",["DPTModel",Wr]],["glpn",["GLPNModel",Kr]],["hifigan",["SpeechT5HifiGan",ni]],["efficientnet",["EfficientNetModel",Ai]]]),Oi=new Map([["t5",["T5Model",ut]],["longt5",["LongT5Model",_t]],["mt5",["MT5Model",mt]],["bart",["BartModel",wt]],["mbart",["MBartModel",vt]],["marian",["MarianModel",wo]],["whisper",["WhisperModel",tn]],["m2m_100",["M2M100Model",To]],["blenderbot",["BlenderbotModel",At]],["blenderbot-small",["BlenderbotSmallModel",Et]]]),Ii=new Map([["bloom",["BloomModel",Wn]],["gpt2",["GPT2Model",wn]],["gptj",["GPTJModel",An]],["gpt_bigcode",["GPTBigCodeModel",En]],["gpt_neo",["GPTNeoModel",Tn]],["gpt_neox",["GPTNeoXModel",Mn]],["codegen",["CodeGenModel",Dn]],["llama",["LlamaModel",$n]],["qwen2",["Qwen2Model",Rn]],["phi",["PhiModel",Un]],["mpt",["MptModel",Qn]],["opt",["OPTModel",Zn]],["mistral",["MistralModel",si]],["starcoder2",["Starcoder2Model",ci]],["falcon",["FalconModel",di]]]),Di=new Map([["speecht5",["SpeechT5ForSpeechToText",ei]],["whisper",["WhisperForConditionalGeneration",nn]]]),Li=new Map([["speecht5",["SpeechT5ForTextToSpeech",ti]]]),Ni=new Map([["vits",["VitsModel",wi]]]),$i=new Map([["bert",["BertForSequenceClassification",G]],["roformer",["RoFormerForSequenceClassification",Z]],["electra",["ElectraForSequenceClassification",ue]],["esm",["EsmForSequenceClassification",Re]],["convbert",["ConvBertForSequenceClassification",oe]],["camembert",["CamembertForSequenceClassification",me]],["deberta",["DebertaForSequenceClassification",Te]],["deberta-v2",["DebertaV2ForSequenceClassification",Ae]],["mpnet",["MPNetForSequenceClassification",Ye]],["albert",["AlbertForSequenceClassification",st]],["distilbert",["DistilBertForSequenceClassification",Ie]],["roberta",["RobertaForSequenceClassification",Nt]],["xlm",["XLMForSequenceClassification",Vt]],["xlm-roberta",["XLMRobertaForSequenceClassification",Xt]],["bart",["BartForSequenceClassification",yt]],["mbart",["MBartForSequenceClassification",Mt]],["mobilebert",["MobileBertForSequenceClassification",qe]],["squeezebert",["SqueezeBertForSequenceClassification",nt]]]),Bi=new Map([["bert",["BertForTokenClassification",q]],["roformer",["RoFormerForTokenClassification",J]],["electra",["ElectraForTokenClassification",pe]],["esm",["EsmForTokenClassification",je]],["convbert",["ConvBertForTokenClassification",ie]],["camembert",["CamembertForTokenClassification",ge]],["deberta",["DebertaForTokenClassification",ve]],["deberta-v2",["DebertaV2ForTokenClassification",Fe]],["mpnet",["MPNetForTokenClassification",Ke]],["distilbert",["DistilBertForTokenClassification",De]],["roberta",["RobertaForTokenClassification",$t]],["xlm",["XLMForTokenClassification",Ut]],["xlm-roberta",["XLMRobertaForTokenClassification",Qt]]]),zi=new Map([["t5",["T5ForConditionalGeneration",pt]],["longt5",["LongT5ForConditionalGeneration",ht]],["mt5",["MT5ForConditionalGeneration",gt]],["bart",["BartForConditionalGeneration",xt]],["mbart",["MBartForConditionalGeneration",kt]],["marian",["MarianMTModel",xo]],["m2m_100",["M2M100ForConditionalGeneration",vo]],["blenderbot",["BlenderbotForConditionalGeneration",Ft]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",Ot]]]),Ri=new Map([["bloom",["BloomForCausalLM",Hn]],["gpt2",["GPT2LMHeadModel",xn]],["gptj",["GPTJForCausalLM",Fn]],["gpt_bigcode",["GPTBigCodeForCausalLM",On]],["gpt_neo",["GPTNeoForCausalLM",vn]],["gpt_neox",["GPTNeoXForCausalLM",Sn]],["codegen",["CodeGenForCausalLM",Ln]],["llama",["LlamaForCausalLM",Bn]],["qwen2",["Qwen2ForCausalLM",jn]],["phi",["PhiForCausalLM",Gn]],["mpt",["MptForCausalLM",Yn]],["opt",["OPTForCausalLM",Jn]],["mbart",["MBartForCausalLM",St]],["mistral",["MistralForCausalLM",ai]],["starcoder2",["Starcoder2ForCausalLM",ui]],["falcon",["FalconForCausalLM",_i]],["trocr",["TrOCRForCausalLM",oi]],["stablelm",["StableLmForCausalLM",Si]]]),ji=new Map([["bert",["BertForMaskedLM",U]],["roformer",["RoFormerForMaskedLM",K]],["electra",["ElectraForMaskedLM",ce]],["esm",["EsmForMaskedLM",ze]],["convbert",["ConvBertForMaskedLM",re]],["camembert",["CamembertForMaskedLM",fe]],["deberta",["DebertaForMaskedLM",ye]],["deberta-v2",["DebertaV2ForMaskedLM",Pe]],["mpnet",["MPNetForMaskedLM",Qe]],["albert",["AlbertForMaskedLM",lt]],["distilbert",["DistilBertForMaskedLM",Ne]],["roberta",["RobertaForMaskedLM",Lt]],["xlm",["XLMWithLMHeadModel",jt]],["xlm-roberta",["XLMRobertaForMaskedLM",Ht]],["mobilebert",["MobileBertForMaskedLM",Ge]],["squeezebert",["SqueezeBertForMaskedLM",tt]]]),Vi=new Map([["bert",["BertForQuestionAnswering",W]],["roformer",["RoFormerForQuestionAnswering",ee]],["electra",["ElectraForQuestionAnswering",de]],["convbert",["ConvBertForQuestionAnswering",se]],["camembert",["CamembertForQuestionAnswering",be]],["deberta",["DebertaForQuestionAnswering",ke]],["deberta-v2",["DebertaV2ForQuestionAnswering",Ce]],["mpnet",["MPNetForQuestionAnswering",Ze]],["albert",["AlbertForQuestionAnswering",at]],["distilbert",["DistilBertForQuestionAnswering",Le]],["roberta",["RobertaForQuestionAnswering",Bt]],["xlm",["XLMForQuestionAnswering",Gt]],["xlm-roberta",["XLMRobertaForQuestionAnswering",Yt]],["mobilebert",["MobileBertForQuestionAnswering",We]],["squeezebert",["SqueezeBertForQuestionAnswering",rt]]]),Ui=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",rn]]]),Gi=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",rn]]]),qi=new Map([["vit",["ViTForImageClassification",nr]],["fastvit",["FastViTForImageClassification",ir]],["mobilevit",["MobileViTForImageClassification",ur]],["mobilevitv2",["MobileViTV2ForImageClassification",_r]],["beit",["BeitForImageClassification",Tr]],["deit",["DeiTForImageClassification",Lr]],["convnext",["ConvNextForImageClassification",ro]],["convnextv2",["ConvNextV2ForImageClassification",so]],["dinov2",["Dinov2ForImageClassification",co]],["resnet",["ResNetForImageClassification",Br]],["swin",["SwinForImageClassification",jr]],["segformer",["SegformerForImageClassification",Ti]],["efficientnet",["EfficientNetForImageClassification",Fi]]]),Wi=new Map([["detr",["DetrForObjectDetection",Mr]],["table-transformer",["TableTransformerForObjectDetection",Er]],["yolos",["YolosForObjectDetection",_o]]]),Hi=new Map([["owlvit",["OwlViTForObjectDetection",mr]],["owlv2",["Owlv2ForObjectDetection",wr]]]),Xi=new Map([["detr",["DetrForSegmentation",Sr]],["clipseg",["CLIPSegForImageSegmentation",gn]]]),Qi=new Map([["segformer",["SegformerForSemanticSegmentation",vi]]]),Yi=new Map([["sam",["SamModel",mo]]]),Ki=new Map([["wav2vec2",["Wav2Vec2ForCTC",So]],["wav2vec2-bert",["Wav2Vec2BertForCTC",Ro]],["unispeech",["UniSpeechForCTC",Eo]],["unispeech-sat",["UniSpeechSatForCTC",Lo]],["wavlm",["WavLMForCTC",Xo]],["hubert",["HubertForCTC",Go]]]),Zi=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Po]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",jo]],["unispeech",["UniSpeechForSequenceClassification",Oo]],["unispeech-sat",["UniSpeechSatForSequenceClassification",No]],["wavlm",["WavLMForSequenceClassification",Qo]],["hubert",["HubertForSequenceClassification",qo]],["audio-spectrogram-transformer",["ASTForAudioClassification",Jt]]]),Ji=new Map([["wavlm",["WavLMForXVector",Yo]]]),es=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",$o]],["wavlm",["WavLMForAudioFrameClassification",Ko]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",Ao]]]),ts=new Map([["vitmatte",["VitMatteForImageMatting",ar]]]),ns=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Gr]]]),rs=new Map([["dpt",["DPTForDepthEstimation",Hr]],["depth_anything",["DepthAnythingForDepthEstimation",Qr]],["glpn",["GLPNForDepthEstimation",Zr]]]),os=new Map([["clip",["CLIPVisionModelWithProjection",ln]],["siglip",["SiglipVisionModel",dn]]]),is=[[Ei,_],[Oi,h],[Ii,g],[$i,_],[Bi,_],[zi,f],[Di,f],[Ri,g],[ji,_],[Vi,_],[Ui,m],[qi,_],[Xi,_],[Qi,_],[ts,_],[ns,_],[rs,_],[Wi,_],[Hi,_],[Yi,b],[Ki,_],[Zi,_],[Li,f],[Ni,_],[Ji,_],[es,_],[os,_]];for(const[e,t]of is)for(const[n,r]of e.values())w.set(n,t),y.set(r,n),x.set(n,r);const ss=[["CLIPTextModelWithProjection",an,_],["SiglipTextModel",pn,_],["ClapTextModelWithProjection",mi,_],["ClapAudioModelWithProjection",gi,_]];for(const[e,t,n]of ss)w.set(e,n),y.set(t,e),x.set(e,t);class as extends Ci{static MODEL_CLASS_MAPPINGS=is.map((e=>e[0]));static BASE_IF_FAIL=!0}class ls extends Ci{static MODEL_CLASS_MAPPINGS=[$i]}class cs extends Ci{static MODEL_CLASS_MAPPINGS=[Bi]}class us extends Ci{static MODEL_CLASS_MAPPINGS=[zi]}class ps extends Ci{static MODEL_CLASS_MAPPINGS=[Di]}class ds extends Ci{static MODEL_CLASS_MAPPINGS=[Li]}class _s extends Ci{static MODEL_CLASS_MAPPINGS=[Ni]}class hs extends Ci{static MODEL_CLASS_MAPPINGS=[Ri]}class fs extends Ci{static MODEL_CLASS_MAPPINGS=[ji]}class ms extends Ci{static MODEL_CLASS_MAPPINGS=[Vi]}class gs extends Ci{static MODEL_CLASS_MAPPINGS=[Ui]}class bs extends Ci{static MODEL_CLASS_MAPPINGS=[qi]}class ws extends Ci{static MODEL_CLASS_MAPPINGS=[Xi]}class xs extends Ci{static MODEL_CLASS_MAPPINGS=[Qi]}class ys extends Ci{static MODEL_CLASS_MAPPINGS=[Wi]}class Ts extends Ci{static MODEL_CLASS_MAPPINGS=[Hi]}class vs extends Ci{static MODEL_CLASS_MAPPINGS=[Yi]}class ks extends Ci{static MODEL_CLASS_MAPPINGS=[Ki]}class Ms extends Ci{static MODEL_CLASS_MAPPINGS=[Zi]}class Ss extends Ci{static MODEL_CLASS_MAPPINGS=[Ji]}class Ps extends Ci{static MODEL_CLASS_MAPPINGS=[es]}class As extends Ci{static MODEL_CLASS_MAPPINGS=[Gi]}class Fs extends Ci{static MODEL_CLASS_MAPPINGS=[ts]}class Cs extends Ci{static MODEL_CLASS_MAPPINGS=[ns]}class Es extends Ci{static MODEL_CLASS_MAPPINGS=[rs]}class Os extends Ci{static MODEL_CLASS_MAPPINGS=[os]}class Is extends z{constructor({logits:e,past_key_values:t,encoder_outputs:n,decoder_attentions:r=null,cross_attentions:o=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=n,this.decoder_attentions=r,this.cross_attentions=o}}class Ds extends z{constructor({logits:e}){super(),this.logits=e}}class Ls extends z{constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class Ns extends z{constructor({logits:e}){super(),this.logits=e}}class $s extends z{constructor({logits:e}){super(),this.logits=e}}class Bs extends z{constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class zs extends z{constructor({logits:e}){super(),this.logits=e}}class Rs extends z{constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class js extends z{constructor({alphas:e}){super(),this.alphas=e}}class Vs extends z{constructor({waveform:e,spectrogram:t}){super(),this.waveform=e,this.spectrogram=t}}},"./src/pipelines.js":
+/*!**************************!*\
+  !*** ./src/pipelines.js ***!
+  \**************************/(e,t,n)=>{n.r(t),n.d(t,{AudioClassificationPipeline:()=>P,AutomaticSpeechRecognitionPipeline:()=>F,DepthEstimationPipeline:()=>z,DocumentQuestionAnsweringPipeline:()=>N,FeatureExtractionPipeline:()=>M,FillMaskPipeline:()=>b,ImageClassificationPipeline:()=>E,ImageFeatureExtractionPipeline:()=>S,ImageSegmentationPipeline:()=>O,ImageToImagePipeline:()=>B,ImageToTextPipeline:()=>C,ObjectDetectionPipeline:()=>D,Pipeline:()=>h,QuestionAnsweringPipeline:()=>g,SummarizationPipeline:()=>x,Text2TextGenerationPipeline:()=>w,TextClassificationPipeline:()=>f,TextGenerationPipeline:()=>v,TextToAudioPipeline:()=>$,TokenClassificationPipeline:()=>m,TranslationPipeline:()=>y,ZeroShotAudioClassificationPipeline:()=>A,ZeroShotClassificationPipeline:()=>k,ZeroShotImageClassificationPipeline:()=>I,ZeroShotObjectDetectionPipeline:()=>L,pipeline:()=>V});var r=n(/*! ./tokenizers.js */"./src/tokenizers.js"),o=n(/*! ./models.js */"./src/models.js"),i=n(/*! ./processors.js */"./src/processors.js"),s=n(/*! ./utils/core.js */"./src/utils/core.js"),a=n(/*! ./utils/maths.js */"./src/utils/maths.js"),l=n(/*! ./utils/audio.js */"./src/utils/audio.js"),c=n(/*! ./utils/tensor.js */"./src/utils/tensor.js"),u=n(/*! ./utils/image.js */"./src/utils/image.js");async function p(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>u.RawImage.read(e))))}async function d(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>"string"==typeof e||e instanceof URL?(0,l.read_audio)(e,t):e instanceof Float64Array?new Float32Array(e):e)))}function _(e,t){t&&(e=e.map((e=>0|e)));const[n,r,o,i]=e;return{xmin:n,ymin:r,xmax:o,ymax:i}}class h extends s.Callable{constructor({task:e,model:t,tokenizer:n=null,processor:r=null}){super(),this.task=e,this.model=t,this.tokenizer=n,this.processor=r}async dispose(){await this.model.dispose()}}class f extends h{constructor(e){super(e)}async _call(e,{topk:t=1}={}){const n=this.tokenizer(e,{padding:!0,truncation:!0}),r=await this.model(n),o="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid().data:e=>(0,a.softmax)(e.data),i=this.model.config.id2label,s=[];for(const e of r.logits){const n=o(e),r=(0,a.getTopItems)(n,t).map((e=>({label:i[e[0]],score:e[1]})));1===t?s.push(...r):s.push(r)}return Array.isArray(e)||1===t?s:s[0]}}class m extends h{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){const n=Array.isArray(e),r=this.tokenizer(n?e:[e],{padding:!0,truncation:!0}),o=(await this.model(r)).logits,i=this.model.config.id2label,s=[];for(let e=0;e<o.dims[0];++e){const n=r.input_ids[e],l=o[e],c=[];for(let e=0;e<l.dims[0];++e){const r=l[e],o=(0,a.max)(r.data)[1],s=i?i[o]:`LABEL_${o}`;if(t.includes(s))continue;const u=this.tokenizer.decode([n[e].item()],{skip_special_tokens:!0});if(""===u)continue;const p=(0,a.softmax)(r.data);c.push({entity:s,score:p[o],index:e,word:u,start:null,end:null})}s.push(c)}return n?s:s[0]}}class g extends h{constructor(e){super(e)}async _call(e,t,{topk:n=1}={}){const r=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),o=await this.model(r),i=[];for(let e=0;e<o.start_logits.dims[0];++e){const t=r.input_ids[e],l=t.indexOf(this.tokenizer.sep_token_id),c=Array.from((0,a.softmax)(o.start_logits[e].data)).map(((e,t)=>[e,t])).filter((e=>e[1]>l)),u=Array.from((0,a.softmax)(o.end_logits[e].data)).map(((e,t)=>[e,t])).filter((e=>e[1]>l)),p=(0,s.product)(c,u).filter((e=>e[0][1]<=e[1][1])).map((e=>[e[0][1],e[1][1],e[0][0]*e[1][0]])).sort(((e,t)=>t[2]-e[2]));for(let e=0;e<Math.min(p.length,n);++e){const[n,r,o]=p[e],s=[...t].slice(n,r+1),a=this.tokenizer.decode(s,{skip_special_tokens:!0});i.push({answer:a,score:o})}}return 1===n?i[0]:i}}class b extends h{constructor(e){super(e)}async _call(e,{topk:t=5}={}){const n=this.tokenizer(e,{padding:!0,truncation:!0}),r=await this.model(n),o=[];for(let e=0;e<n.input_ids.dims[0];++e){const i=n.input_ids[e],s=i.indexOf(this.tokenizer.mask_token_id);if(-1===s)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const l=r.logits[e][s],c=(0,a.getTopItems)((0,a.softmax)(l.data),t);o.push(c.map((e=>{const t=[...i];return t[s]=e[0],{score:e[1],token:e[0],token_str:this.tokenizer.model.vocab[e[0]],sequence:this.tokenizer.decode(t,{skip_special_tokens:!0})}})))}return Array.isArray(e)?o:o[0]}}class w extends h{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map((e=>this.model.config.prefix+e)));const n=this.model.config.task_specific_params;n&&n[this.task]&&n[this.task].prefix&&(e=e.map((e=>n[this.task].prefix+e)));const r=this.tokenizer,o={padding:!0,truncation:!0};let i;i=this instanceof y&&"_build_translation_inputs"in r?r._build_translation_inputs(e,o,t).input_ids:r(e,o).input_ids;const s=await this.model.generate(i,t);return r.batch_decode(s,{skip_special_tokens:!0}).map((e=>({[this._key]:e})))}}class x extends w{_key="summary_text";constructor(e){super(e)}}class y extends w{_key="translation_text";constructor(e){super(e)}}function T(e){return Array.isArray(e)&&e.every((e=>"role"in e&&"content"in e))}class v extends h{constructor(e){super(e)}async _call(e,t={}){let n,r=!1,o=!1;if("string"==typeof e)n=e=[e];else if(Array.isArray(e)&&e.every((e=>"string"==typeof e)))r=!0,n=e;else{if(T(e))e=[e];else{if(!Array.isArray(e)||!e.every(T))throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");r=!0}o=!0,n=e.map((e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0})))}const i=t.add_special_tokens??!1,s=!o&&(t.return_full_text??!0);this.tokenizer.padding_side="left";const{input_ids:a,attention_mask:l}=this.tokenizer(n,{add_special_tokens:i,padding:!0,truncation:!0}),c=await this.model.generate(a,t,null,{inputs_attention_mask:l});let u,p=this.tokenizer.batch_decode(c,{skip_special_tokens:!0});!s&&a.dims.at(-1)>0&&(u=this.tokenizer.batch_decode(a,{skip_special_tokens:!0}).map((e=>e.length)));const d=Array.from({length:e.length},(e=>[]));for(let t=0;t<p.length;++t){const n=Math.floor(t/c.length*e.length);u&&(p[t]=p[t].slice(u[n])),d[n].push({generated_text:o?[...e[n],{role:"assistant",content:p[t]}]:p[t]})}return r||1!==d.length?d:d[0]}}class k extends h{constructor(e){super(e),this.label2id=Object.fromEntries(Object.entries(this.model.config.label2id).map((([e,t])=>[e.toLowerCase(),t]))),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:n="This example is {}.",multi_label:r=!1}={}){const o=Array.isArray(e);o||(e=[e]),Array.isArray(t)||(t=[t]);const i=t.map((e=>n.replace("{}",e))),s=r||1===t.length,l=[];for(const n of e){const e=[];for(const t of i){const r=this.tokenizer(n,{text_pair:t,padding:!0,truncation:!0}),o=await this.model(r);s?e.push([o.logits.data[this.contradiction_id],o.logits.data[this.entailment_id]]):e.push(o.logits.data[this.entailment_id])}const r=(s?e.map((e=>(0,a.softmax)(e)[1])):(0,a.softmax)(e)).map(((e,t)=>[e,t])).sort(((e,t)=>t[0]-e[0]));l.push({sequence:n,labels:r.map((e=>t[e[1]])),scores:r.map((e=>e[0]))})}return o?l:l[0]}}class M extends h{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:n=!1,quantize:r=!1,precision:o="binary"}={}){const i=this.tokenizer(e,{padding:!0,truncation:!0}),s=await this.model(i);let a=s.last_hidden_state??s.logits??s.token_embeddings;if("none"===t);else if("mean"===t)a=(0,c.mean_pooling)(a,i.attention_mask);else{if("cls"!==t)throw Error(`Pooling method '${t}' not supported.`);a=a.slice(null,0)}return n&&(a=a.normalize(2,-1)),r&&(a=(0,c.quantize_embeddings)(a,o)),a}}class S extends h{constructor(e){super(e)}async _call(e,{pool:t=null}={}){const n=await p(e),{pixel_values:r}=await this.processor(n),o=await this.model({pixel_values:r});let i;if(t){if(!("pooler_output"in o))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");i=o.pooler_output}else i=o.last_hidden_state??o.logits??o.image_embeds;return i}}class P extends h{constructor(e){super(e)}async _call(e,{topk:t=null}={}){const n=!Array.isArray(e),r=this.processor.feature_extractor.config.sampling_rate,o=await d(e,r),i=this.model.config.id2label,s=[];for(const e of o){const n=await this.processor(e),r=(await this.model(n)).logits[0],o=(0,a.getTopItems)((0,a.softmax)(r.data),t).map((e=>({label:i[e[0]],score:e[1]})));1===t?s.push(...o):s.push(o)}return n&&1!==t?s[0]:s}}class A extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:n="This is a sound of {}."}={}){const r=!Array.isArray(e);r&&(e=[e]);const o=t.map((e=>n.replace("{}",e))),i=this.tokenizer(o,{padding:!0,truncation:!0}),s=this.processor.feature_extractor.config.sampling_rate,l=await d(e,s),c=[];for(const e of l){const n=await this.processor(e),r=await this.model({...i,...n}),o=(0,a.softmax)(r.logits_per_audio.data);c.push([...o].map(((e,n)=>({score:e,label:t[n]}))))}return r?c[0]:c}}class F extends h{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(e,t);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t={}){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const n=!Array.isArray(e);n&&(e=[e]);const r=this.processor.feature_extractor.config.sampling_rate,o=await d(e,r),i=[];for(const e of o){const t=await this.processor(e),n=(await this.model(t)).logits[0],r=[];for(const e of n)r.push((0,a.max)(e.data)[1]);const o=this.tokenizer.decode(r);i.push({text:o})}return n?i[0]:i}async _call_whisper(e,t={}){const n=t.return_timestamps??!1,r=t.chunk_length_s??0,o=t.chunk_callback??null,i=t.force_full_sequences??!1;let l=t.stride_length_s??null;"word"===n&&(t.return_token_timestamps=!0);const c=(0,s.pop)(t,"language",null),u=(0,s.pop)(t,"task",null);if(c||u||n){if(t.forced_decoder_ids)throw new Error("Cannot specify `language`/`task`/`return_timestamps` and `forced_decoder_ids` at the same time.");const e=this.tokenizer.get_decoder_prompt_ids({language:c,task:u,no_timestamps:!n});e.length>0&&(t.forced_decoder_ids=e)}const p=!Array.isArray(e);p&&(e=[e]);const _=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,h=this.processor.feature_extractor.config.hop_length,f=this.processor.feature_extractor.config.sampling_rate,m=await d(e,f),g=[];for(const e of m){let s=[];if(r>0){if(null===l)l=r/6;else if(r<=l)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const t=f*r,n=f*l,o=t-2*n;let i=0;for(;i<e.length;){const r=e.subarray(i,i+t),a=await this.processor(r),l=0===i,c=i+o>=e.length;s.push({stride:[r.length,l?0:n,c?0:n],input_features:a.input_features,is_last:c}),i+=o}}else s=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(const e of s){t.num_frames=Math.floor(e.stride[0]/h);const r=await this.model.generate(e.input_features,t);"word"===n?(e.tokens=r.sequences[0],e.token_timestamps=r.token_timestamps.tolist()[0].map((e=>(0,a.round)(e,2)))):e.tokens=r[0],e.stride=e.stride.map((e=>e/f)),null!==o&&o(e)}const[c,u]=this.tokenizer._decode_asr(s,{time_precision:_,return_timestamps:n,force_full_sequences:i});g.push({text:c,...u})}return p?g[0]:g}}class C extends h{constructor(e){super(e)}async _call(e,t={}){const n=Array.isArray(e),r=await p(e),{pixel_values:o}=await this.processor(r),i=[];for(const e of o){e.dims=[1,...e.dims];const n=await this.model.generate(e,t),r=this.tokenizer.batch_decode(n,{skip_special_tokens:!0}).map((e=>({generated_text:e.trim()})));i.push(r)}return n?i:i[0]}}class E extends h{constructor(e){super(e)}async _call(e,{topk:t=1}={}){const n=Array.isArray(e),r=await p(e),{pixel_values:o}=await this.processor(r),i=await this.model({pixel_values:o}),s=this.model.config.id2label,l=[];for(const e of i.logits){const n=(0,a.getTopItems)((0,a.softmax)(e.data),t).map((e=>({label:s[e[0]],score:e[1]})));1===t?l.push(...n):l.push(n)}return n||1===t?l:l[0]}}class O extends h{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:n=.5,overlap_mask_area_threshold:r=.8,label_ids_to_fuse:o=null,target_sizes:i=null,subtask:s=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const a=await p(e),l=a.map((e=>[e.height,e.width])),{pixel_values:c,pixel_mask:d}=await this.processor(a),_=await this.model({pixel_values:c,pixel_mask:d});let h=null;if(null!==s)h=this.subtasks_mapping[s];else for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.feature_extractor){h=this.processor.feature_extractor[t].bind(this.processor.feature_extractor),s=e;break}const f=this.model.config.id2label,m=[];if("panoptic"===s||"instance"===s){const e=h(_,t,n,r,o,i??l)[0],s=e.segmentation;for(const t of e.segments_info){const e=new Uint8ClampedArray(s.data.length);for(let n=0;n<s.data.length;++n)s.data[n]===t.id&&(e[n]=255);const n=new u.RawImage(e,s.dims[1],s.dims[0],1);m.push({score:t.score,label:f[t.label_id],mask:n})}}else{if("semantic"!==s)throw Error(`Subtask ${s} not supported.`);{const{segmentation:e,labels:t}=h(_,i??l)[0];for(const n of t){const t=new Uint8ClampedArray(e.data.length);for(let r=0;r<e.data.length;++r)e.data[r]===n&&(t[r]=255);const r=new u.RawImage(t,e.dims[1],e.dims[0],1);m.push({score:null,label:f[n],mask:r})}}}return m}}class I extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:n="This is a photo of {}"}={}){const r=Array.isArray(e),o=await p(e),i=t.map((e=>n.replace("{}",e))),s=this.tokenizer(i,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:l}=await this.processor(o),c=await this.model({...s,pixel_values:l}),u="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,a.softmax)(e.data),d=[];for(const e of c.logits_per_image){const n=[...u(e)].map(((e,n)=>({score:e,label:t[n]})));n.sort(((e,t)=>t.score-e.score)),d.push(n)}return r?d:d[0]}}class D extends h{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:n=!1}={}){const r=Array.isArray(e);if(r&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");const o=await p(e),i=n?null:o.map((e=>[e.height,e.width])),{pixel_values:s,pixel_mask:a}=await this.processor(o),l=await this.model({pixel_values:s,pixel_mask:a}),c=this.processor.feature_extractor.post_process_object_detection(l,t,i),u=this.model.config.id2label,d=c.map((e=>e.boxes.map(((t,r)=>({score:e.scores[r],label:u[e.classes[r]],box:_(t,!n)})))));return r?d:d[0]}}class L extends h{constructor(e){super(e)}async _call(e,t,{threshold:n=.1,topk:r=null,percentage:o=!1}={}){const i=Array.isArray(e),s=await p(e),a=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(s),c=[];for(let e=0;e<s.length;++e){const i=s[e],u=o?null:[[i.height,i.width]],p=l.pixel_values[e].unsqueeze_(0),d=await this.model({...a,pixel_values:p}),h=this.processor.feature_extractor.post_process_object_detection(d,n,u,!0)[0];let f=h.boxes.map(((e,n)=>({score:h.scores[n],label:t[h.classes[n]],box:_(e,!o)}))).sort(((e,t)=>t.score-e.score));null!==r&&(f=f.slice(0,r)),c.push(f)}return i?c:c[0]}}class N extends h{constructor(e){super(e)}async _call(e,t,n={}){const r=(await p(e))[0],{pixel_values:o}=await this.processor(r),i=`<s_docvqa><s_question>${t}</s_question><s_answer>`,s=this.tokenizer(i,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,a=await this.model.generate(o,{...n,decoder_input_ids:s,max_length:this.model.config.decoder.max_position_embeddings}),l=this.tokenizer.batch_decode(a)[0].match(/<s_answer>(.*?)<\/s_answer>/);let c=null;return l&&l.length>=2&&(c=l[1].trim()),[{answer:c}]}}class $ extends h{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){const t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:n}=await this.model(t),r=this.model.config.sampling_rate;return{audio:n.data,sampling_rate:r}}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{quantized:!1})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await(await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new c.Tensor("float32",t,[1,t.length]);else if(!(t instanceof c.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:n}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:r}=await this.model.generate_speech(n,t,{vocoder:this.vocoder}),i=this.processor.feature_extractor.config.sampling_rate;return{audio:r.data,sampling_rate:i}}}class B extends h{constructor(e){super(e)}async _call(e){const t=await p(e),n=await this.processor(t),r=await this.model(n),o=[];for(const e of r.reconstruction){const t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");o.push(u.RawImage.fromTensor(t))}return o.length>1?o:o[0]}}class z extends h{constructor(e){super(e)}async _call(e){const t=await p(e),n=await this.processor(t),{predicted_depth:r}=await this.model(n),o=[];for(let e=0;e<t.length;++e){const n=(0,c.interpolate)(r[e],t[e].size.reverse(),"bilinear",!1),i=n.mul_(255/(0,a.max)(n.data)[0]).to("uint8");o.push({predicted_depth:r[e],depth:u.RawImage.fromTensor(i)})}return o.length>1?o:o[0]}}const R=Object.freeze({"text-classification":{tokenizer:r.AutoTokenizer,pipeline:f,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:r.AutoTokenizer,pipeline:m,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:r.AutoTokenizer,pipeline:g,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:r.AutoTokenizer,pipeline:b,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:r.AutoTokenizer,pipeline:x,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:r.AutoTokenizer,pipeline:y,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:r.AutoTokenizer,pipeline:w,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:r.AutoTokenizer,pipeline:v,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:r.AutoTokenizer,pipeline:k,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:P,model:o.AutoModelForAudioClassification,processor:i.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:r.AutoTokenizer,pipeline:A,model:o.AutoModel,processor:i.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:r.AutoTokenizer,pipeline:F,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:i.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:r.AutoTokenizer,pipeline:$,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[i.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:r.AutoTokenizer,pipeline:C,model:o.AutoModelForVision2Seq,processor:i.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:E,model:o.AutoModelForImageClassification,processor:i.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:O,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation],processor:i.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:r.AutoTokenizer,pipeline:I,model:o.AutoModel,processor:i.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:D,model:o.AutoModelForObjectDetection,processor:i.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:r.AutoTokenizer,pipeline:L,model:o.AutoModelForZeroShotObjectDetection,processor:i.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:r.AutoTokenizer,pipeline:N,model:o.AutoModelForDocumentQuestionAnswering,processor:i.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:B,model:o.AutoModelForImageToImage,processor:i.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:z,model:o.AutoModelForDepthEstimation,processor:i.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:r.AutoTokenizer,pipeline:M,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:i.AutoProcessor,pipeline:S,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),j=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function V(e,t=null,{quantized:n=!0,progress_callback:r=null,config:o=null,cache_dir:i=null,local_files_only:a=!1,revision:l="main",model_file_name:c=null}={}){e=j[e]??e;const u=R[e.split("_",1)[0]];if(!u)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(R)}]`);t||(t=u.default.model,console.log(`No model specified. Using default model: "${t}".`));const p={quantized:n,progress_callback:r,config:o,cache_dir:i,local_files_only:a,revision:l,model_file_name:c},d=new Map([["tokenizer",u.tokenizer],["model",u.model],["processor",u.processor]]),_=await async function(e,t,n){const r=Object.create(null),o=[];for(let[i,s]of e.entries()){if(!s)continue;let e;e=Array.isArray(s)?new Promise((async(e,r)=>{let o;for(let r of s){if(null===r)return void e(null);try{return void e(await r.from_pretrained(t,n))}catch(e){o=e}}r(o)})):s.from_pretrained(t,n),r[i]=e,o.push(e)}await Promise.all(o);for(let[e,t]of Object.entries(r))r[e]=await t;return r}(d,t,p);_.task=e,(0,s.dispatchCallback)(r,{status:"ready",task:e,model:t});return new(0,u.pipeline)(_)}},"./src/processors.js":
+/*!***************************!*\
+  !*** ./src/processors.js ***!
+  \***************************/(e,t,n)=>{n.r(t),n.d(t,{ASTFeatureExtractor:()=>G,AutoProcessor:()=>J,BeitFeatureExtractor:()=>I,BitImageProcessor:()=>b,CLIPFeatureExtractor:()=>x,ChineseCLIPFeatureExtractor:()=>y,ClapFeatureExtractor:()=>q,ConvNextFeatureExtractor:()=>v,ConvNextImageProcessor:()=>k,DPTFeatureExtractor:()=>m,DPTImageProcessor:()=>g,DeiTFeatureExtractor:()=>O,DetrFeatureExtractor:()=>N,DonutFeatureExtractor:()=>D,EfficientNetImageProcessor:()=>P,FeatureExtractor:()=>_,GLPNFeatureExtractor:()=>w,ImageFeatureExtractor:()=>h,MobileViTFeatureExtractor:()=>A,MobileViTImageProcessor:()=>F,NougatImageProcessor:()=>L,OwlViTFeatureExtractor:()=>C,OwlViTProcessor:()=>Z,Owlv2ImageProcessor:()=>E,Processor:()=>H,SamImageProcessor:()=>B,SamProcessor:()=>X,SeamlessM4TFeatureExtractor:()=>U,SegformerFeatureExtractor:()=>f,SiglipImageProcessor:()=>T,SpeechT5FeatureExtractor:()=>W,SpeechT5Processor:()=>K,Swin2SRImageProcessor:()=>z,ViTFeatureExtractor:()=>M,ViTImageProcessor:()=>S,VitMatteImageProcessor:()=>R,Wav2Vec2FeatureExtractor:()=>V,Wav2Vec2ProcessorWithLM:()=>Y,WhisperFeatureExtractor:()=>j,WhisperProcessor:()=>Q,YolosFeatureExtractor:()=>$});var r=n(/*! ./utils/core.js */"./src/utils/core.js"),o=n(/*! ./utils/hub.js */"./src/utils/hub.js"),i=n(/*! ./utils/maths.js */"./src/utils/maths.js"),s=n(/*! ./utils/tensor.js */"./src/utils/tensor.js"),a=(n(/*! ./utils/image.js */"./src/utils/image.js"),n(/*! ./utils/audio.js */"./src/utils/audio.js"));function l([e,t,n,r]){return[e-n/2,t-r/2,e+n/2,t+r/2]}function c(e,t=.5,n=null,r=!1){const o=e.logits,s=e.pred_boxes,[a,c,u]=o.dims;if(null!==n&&n.length!==a)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let p=[];for(let e=0;e<a;++e){let a=null!==n?n[e]:null,d={boxes:[],classes:[],scores:[]},_=o[e],h=s[e];for(let e=0;e<c;++e){let n,o=_[e],s=[];if(r){n=o.sigmoid().data;for(let e=0;e<n.length;++e)n[e]>t&&s.push(e)}else{let e=(0,i.max)(o.data)[1];if(e===u-1)continue;s.push(e),n=(0,i.softmax)(o.data)}for(const t of s){let r=h[e].data;r=l(r),null!==a&&(r=r.map(((e,t)=>e*a[(t+1)%2]))),d.boxes.push(r),d.classes.push(t),d.scores.push(n[t])}}p.push(d)}return p}function u(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}function p(e,t,n=0,r=null){const o=e/t;let s=(0,i.bankers_round)(o)*t;return null!==r&&s>r&&(s=Math.floor(o)*t),s<n&&(s=Math.ceil(o)*t),s}function d([e,t],n){return[Math.max(Math.floor(e/n),1)*n,Math.max(Math.floor(t/n),1)*n]}class _ extends r.Callable{constructor(e){super(),this.config=e}}class h extends _{constructor(e){super(e),this.image_mean=this.config.image_mean??this.config.mean,this.image_std=this.config.image_std??this.config.std,this.resample=this.config.resample??2,this.do_rescale=this.config.do_rescale??!0,this.rescale_factor=this.config.rescale_factor??1/255,this.do_normalize=this.config.do_normalize,this.do_resize=this.config.do_resize,this.do_thumbnail=this.config.do_thumbnail,this.size=this.config.size,this.size_divisibility=this.config.size_divisibility??this.config.size_divisor,this.do_center_crop=this.config.do_center_crop,this.crop_size=this.config.crop_size,this.do_convert_rgb=this.config.do_convert_rgb??!0,this.do_crop_margin=this.config.do_crop_margin,this.pad_size=this.config.pad_size,this.do_pad=this.config.do_pad,this.do_pad&&!this.pad_size&&this.size&&void 0!==this.size.width&&void 0!==this.size.height&&(this.pad_size=this.size),this.do_flip_channel_order=this.config.do_flip_channel_order??!1}async thumbnail(e,t,n=2){const r=e.height,o=e.width,i=t.height,s=t.width;let a=Math.min(r,i),l=Math.min(o,s);return a===r&&l===o?e:(r>o?l=Math.floor(o*a/r):o>r&&(a=Math.floor(r*l/o)),await e.resize(l,a,{resample:n}))}async crop_margin(e,t=200){const n=e.clone().grayscale(),r=(0,i.min)(n.data)[0],o=(0,i.max)(n.data)[0]-r;if(0===o)return e;const s=t/255;let a=n.width,l=n.height,c=0,u=0;for(let e=0;e<n.height;++e){const t=e*n.width;for(let i=0;i<n.width;++i)(n.data[t+i]-r)/o<s&&(a=Math.min(a,i),l=Math.min(l,e),c=Math.max(c,i),u=Math.max(u,e))}return e=await e.crop([a,l,c,u])}pad_image(e,t,n,{mode:o="constant",center:i=!1,constant_values:s=0}={}){const[a,l,c]=t;let u,p;if("number"==typeof n?(u=n,p=n):(u=n.width,p=n.height),u!==l||p!==a){const n=new Float32Array(u*p*c);if(Array.isArray(s))for(let e=0;e<n.length;++e)n[e]=s[e%c];else 0!==s&&n.fill(s);const[d,_]=i?[Math.floor((u-l)/2),Math.floor((p-a)/2)]:[0,0];for(let t=0;t<a;++t){const r=(t+_)*u,o=t*l;for(let t=0;t<l;++t){const i=(r+t+d)*c,s=(o+t)*c;for(let t=0;t<c;++t)n[i+t]=e[s+t]}}if("symmetric"===o){if(i)throw new Error("`center` padding is not supported when `mode` is set to `symmetric`.");const t=a-1,o=l-1;for(let i=0;i<p;++i){const s=i*u,p=(0,r.calculateReflectOffset)(i,t)*l;for(let t=0;t<u;++t){if(i<a&&t<l)continue;const u=(s+t)*c,d=(p+(0,r.calculateReflectOffset)(t,o))*c;for(let t=0;t<c;++t)n[u+t]=e[d+t]}}}e=n,t=[p,u,c]}return[e,t]}rescale(e){for(let t=0;t<e.length;++t)e[t]=this.rescale_factor*e[t]}get_resize_output_image_size(e,t){const[n,r]=e.size;let o,i;if(this.do_thumbnail){const{height:e,width:n}=t;o=Math.min(e,n)}else Number.isInteger(t)?(o=t,i=this.config.max_size??o):void 0!==t&&(o=t.shortest_edge,i=t.longest_edge);if(void 0!==o||void 0!==i){const e=void 0===o?1:Math.max(o/n,o/r),t=n*e,s=r*e,a=void 0===i?1:Math.min(i/t,i/s);let l=Math.floor(Number((t*a).toFixed(2))),c=Math.floor(Number((s*a).toFixed(2)));return void 0!==this.size_divisibility&&([l,c]=d([l,c],this.size_divisibility)),[l,c]}if(void 0!==t&&void 0!==t.width&&void 0!==t.height){let e=t.width,o=t.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let t=o/r,i=e/n;Math.abs(1-i)<Math.abs(1-t)?t=i:i=t,o=p(t*r,this.config.ensure_multiple_of),e=p(i*n,this.config.ensure_multiple_of)}return[e,o]}if(void 0!==this.size_divisibility)return d([n,r],this.size_divisibility);throw new Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(t)}`)}async resize(e){const[t,n]=this.get_resize_output_image_size(e,this.size);return await e.resize(t,n,{resample:this.resample})}async preprocess(e,{do_normalize:t=null,do_pad:n=null,do_convert_rgb:r=null,do_convert_grayscale:o=null,do_flip_channel_order:i=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));const[a,l]=e.size;if(r??this.do_convert_rgb?e=e.rgb():o&&(e=e.grayscale()),this.do_resize&&(e=await this.resize(e)),this.do_thumbnail&&(e=await this.thumbnail(e,this.size,this.resample)),this.do_center_crop){let t,n;Number.isInteger(this.crop_size)?(t=this.crop_size,n=this.crop_size):(t=this.crop_size.width,n=this.crop_size.height),e=await e.center_crop(t,n)}const c=[e.height,e.width];let u=Float32Array.from(e.data),p=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(u),t??this.do_normalize){let t=this.image_mean;Array.isArray(this.image_mean)||(t=new Array(e.channels).fill(t));let n=this.image_std;if(Array.isArray(this.image_std)||(n=new Array(e.channels).fill(t)),t.length!==e.channels||n.length!==e.channels)throw new Error(`When set to arrays, the length of \`image_mean\` (${t.length}) and \`image_std\` (${n.length}) must match the number of channels in the image (${e.channels}).`);for(let r=0;r<u.length;r+=e.channels)for(let o=0;o<e.channels;++o)u[r+o]=(u[r+o]-t[o])/n[o]}if(n??this.do_pad)if(this.pad_size){const t=this.pad_image(u,[e.height,e.width,e.channels],this.pad_size);[u,p]=t}else if(this.size_divisibility){const[e,t]=d([p[1],p[0]],this.size_divisibility);[u,p]=this.pad_image(u,p,{width:e,height:t})}if(i??this.do_flip_channel_order){if(3!==p[2])throw new Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<u.length;e+=3){const t=u[e];u[e]=u[e+2],u[e+2]=t}}return{original_size:[l,a],reshaped_input_size:c,pixel_values:new s.Tensor("float32",u,p).permute(2,0,1)}}async _call(e,...t){Array.isArray(e)||(e=[e]);const n=await Promise.all(e.map((e=>this.preprocess(e))));return{pixel_values:(0,s.stack)(n.map((e=>e.pixel_values)),0),original_sizes:n.map((e=>e.original_size)),reshaped_input_sizes:n.map((e=>e.reshaped_input_size))}}}class f extends h{post_process_semantic_segmentation(e,t=null){const n=e.logits,r=n.dims[0];if(null!==t&&t.length!==r)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const o=[];for(let e=0;e<r;++e){const r=null!==t?t[e]:null;let i=n[e];null!==r&&(i=(0,s.interpolate)(i,r,"bilinear",!1));const[a,l]=r??i.dims.slice(-2),c=new s.Tensor("int32",new Int32Array(a*l),[a,l]),u=i[0].data;for(let e=1;e<i.dims[0];++e){const t=i[e].data;for(let n=0;n<t.length;++n)t[n]>u[n]&&(u[n]=t[n],c.data[n]=e)}const p=new Array(i.dims[0]),d=c.data;for(let e=0;e<d.length;++e){const t=d[e];p[t]=t}const _=p.filter((e=>void 0!==e));o.push({segmentation:c,labels:_})}return o}}class m extends h{}class g extends m{}class b extends h{}class w extends h{}class x extends h{}class y extends h{}class T extends h{}class v extends h{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){const t=this.size?.shortest_edge;if(void 0===t)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){const n=Math.floor(t/this.crop_pct),[r,o]=this.get_resize_output_image_size(e,{shortest_edge:n});e=await e.resize(r,o,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class k extends v{}class M extends h{}class S extends h{}class P extends h{constructor(e){super(e),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map((e=>e*e)))}}class A extends h{}class F extends A{}class C extends h{post_process_object_detection(...e){return c(...e)}}class E extends C{}class O extends h{}class I extends h{}class D extends h{pad_image(e,t,n,r={}){const[o,i,s]=t;let a=this.image_mean;Array.isArray(this.image_mean)||(a=new Array(s).fill(a));let l=this.image_std;Array.isArray(l)||(l=new Array(s).fill(a));const c=a.map(((e,t)=>-e/l[t]));return super.pad_image(e,t,n,{center:!0,constant_values:c,...r})}}class L extends D{}class N extends h{async _call(e){const t=await super._call(e),n=[t.pixel_values.dims[0],64,64],r=new s.Tensor("int64",new BigInt64Array(n.reduce(((e,t)=>e*t))).fill(1n),n);return{...t,pixel_mask:r}}post_process_object_detection(...e){return c(...e)}remove_low_and_no_objects(e,t,n,r){let o=[],s=[],a=[];for(let l=0;l<e.dims[0];++l){let c=e[l],u=t[l],p=(0,i.max)(c.data)[1];if(p===r)continue;let d=(0,i.softmax)(c.data)[p];d>n&&(o.push(u),s.push(d),a.push(p))}return[o,s,a]}check_segment_validity(e,t,n,r=.5,o=.8){let i=[],s=0,a=0;for(let o=0;o<e.length;++o)e[o]===n&&(i.push(o),++s),t[n].data[o]>=r&&++a;let l=s>0&&a>0;if(l){l=s/a>o}return[l,i]}compute_segments(e,t,n,r,o,i=null,a=null){let[l,c]=a??e[0].dims,u=new s.Tensor("int32",new Int32Array(l*c),[l,c]),p=[];if(null!==a)for(let t=0;t<e.length;++t)e[t]=(0,s.interpolate)(e[t],a,"bilinear",!1);let d=new Int32Array(e[0].data.length),_=new Float32Array(e[0].data.length);for(let n=0;n<e.length;++n){let r=t[n];for(let t=0;t<e[n].data.length;++t)e[n].data[t]*=r,e[n].data[t]>_[t]&&(d[t]=n,_[t]=e[n].data[t])}let h=0;for(let i=0;i<n.length;++i){let s=n[i],[a,l]=this.check_segment_validity(d,e,i,r,o);if(a){++h;for(let e of l)u.data[e]=h;p.push({id:h,label_id:s,score:t[i]})}}return[u,p]}post_process_panoptic_segmentation(e,t=.5,n=.5,r=.8,o=null,i=null){null===o&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),o=new Set);const a=e.logits,l=e.pred_masks.sigmoid();let[c,u,p]=a.dims;if(p-=1,null!==i&&i.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let d=[];for(let e=0;e<c;++e){let c=null!==i?i[e]:null,u=a[e],_=l[e],[h,f,m]=this.remove_low_and_no_objects(u,_,t,p);if(0===m.length){let[e,t]=c??_.dims.slice(-2),n=new s.Tensor("int32",new Int32Array(e*t).fill(-1),[e,t]);d.push({segmentation:n,segments_info:[]});continue}let[g,b]=this.compute_segments(h,f,m,n,r,o,c);d.push({segmentation:g,segments_info:b})}return d}post_process_instance_segmentation(){throw Error("Not implemented yet")}}class $ extends h{post_process_object_detection(...e){return c(...e)}}class B extends h{reshape_input_points(e,t,n){e=structuredClone(e);let o=(0,r.calculateDimensions)(e);if(3===o.length)o=[1,...o],e=[e];else if(4!==o.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let r=0;r<e.length;++r){let o=t[r],i=n[r],s=[i[0]/o[0],i[1]/o[1]];for(let t=0;t<e[r].length;++t)for(let n=0;n<e[r][t].length;++n)for(let o=0;o<e[r][t][n].length;++o)e[r][t][n][o]*=s[o]}return new s.Tensor("float32",Float32Array.from(e.flat(1/0)),o)}add_input_labels(e,t){let n=(0,r.calculateDimensions)(e);if(2===n.length)n=[1,...n],e=[e];else if(3!==n.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(n.some(((e,n)=>e!==t.dims[n])))throw Error(`The first ${n.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new s.Tensor("int64",e.flat(1/0).map(BigInt),n)}async _call(e,t=null,n=null){const r=await super._call(e);if(t&&(r.input_points=this.reshape_input_points(t,r.original_sizes,r.reshaped_input_sizes)),n){if(!r.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");r.input_labels=this.add_input_labels(n,r.input_points)}return r}post_process_masks(e,t,n,{mask_threshold:r=0,binarize:o=!0,pad_size:i=null}={}){const a=[],l=[(i=i??this.pad_size).height,i.width];for(let i=0;i<t.length;++i){const c=t[i],u=n[i],p=e[i],d=[];for(let e=0;e<p.dims[0];++e){const t=p[e];let n=(0,s.interpolate)(t,l,"bilinear",!1);if(n=n.slice(null,[0,u[0]],[0,u[1]]),n=(0,s.interpolate)(n,c,"bilinear",!1),o){const e=new Uint8Array(n.data.length);for(let t=0;t<n.data.length;++t)n.data[t]>r&&(e[t]=1);n=new s.Tensor("bool",e,n.dims)}d.push(n)}a.push((0,s.stack)(d))}return a}}class z extends h{pad_image(e,t,n,r={}){const[o,i,s]=t;return super.pad_image(e,t,{width:i+(n-i%n)%n,height:o+(n-o%n)%n},{mode:"symmetric",center:!1,constant_values:-1,...r})}}class R extends h{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const n=await Promise.all(e.map((e=>this.preprocess(e)))),r=await Promise.all(t.map((e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0}))));return{pixel_values:(0,s.stack)(n.map(((e,t)=>(0,s.cat)([e.pixel_values,r[t].pixel_values],0))),0),original_sizes:n.map((e=>e.original_size)),reshaped_input_sizes:n.map((e=>e.reshaped_input_size))}}}class j extends _{constructor(e){super(e),this.config.mel_filters??=(0,a.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=(0,a.window_function)(this.config.n_fft,"hann")}_extract_fbank_features(e){const{data:t,dims:n}=(0,a.spectrogram)(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:this.config.nb_max_frames}),r=(0,i.max)(t)[0];for(let e=0;e<t.length;++e)t[e]=(Math.max(t[e],r-8)+4)/4;return{data:t,dims:n}}async _call(e){let t;u(e,"WhisperFeatureExtractor"),e.length>this.config.n_samples?(console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),t=e.slice(0,this.config.n_samples)):(t=new Float32Array(this.config.n_samples),t.set(e));const{data:n,dims:r}=this._extract_fbank_features(t);return{input_features:new s.Tensor("float32",n,[1,...r])}}}class V extends _{_zero_mean_unit_var_norm(e){const t=e.reduce(((e,t)=>e+t),0)/e.length,n=e.reduce(((e,n)=>e+(n-t)**2),0)/e.length;return e.map((e=>(e-t)/Math.sqrt(n+1e-7)))}async _call(e){u(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));const n=[1,t.length];return{input_values:new s.Tensor("float32",t,n),attention_mask:new s.Tensor("int64",new BigInt64Array(t.length).fill(1n),n)}}}class U extends _{constructor(e){super(e);const t=this.config.sampling_rate,n=(0,a.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<n.length;++e)n[e].push(0);this.mel_filters=n,this.window=(0,a.window_function)(400,"povey",{periodic:!1})}_extract_fbank_features(e,t){return e=e.map((e=>32768*e)),(0,a.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:n=2,do_normalize_per_mel_bins:r=!0,return_attention_mask:o=!0}={}){u(e,"SeamlessM4TFeatureExtractor");let i,a=this._extract_fbank_features(e,this.config.max_length);if(r){const[e,t]=a.dims;for(let n=0;n<t;++n){let r=0;for(let o=0;o<e;++o)r+=a.data[o*t+n];const o=r/e;let i=0;for(let r=0;r<e;++r)i+=(a.data[r*t+n]-o)**2;i/=e-1;const s=Math.sqrt(i+1e-7);for(let r=0;r<e;++r){const e=r*t+n;a.data[e]=(a.data[e]-o)/s}}}if(t){const[e,t]=a.dims,r=e%n;if(r>0){const n=new Float32Array(t*(e+r));n.set(a.data),n.fill(this.config.padding_value,a.data.length);const l=e+r;a={data:n,dims:[l,t]},o&&(i=new s.Tensor("int64",new BigInt64Array(l),[1,l]),i.data.fill(1n,0,e))}}const[l,c]=a.dims,p=this.config.stride;if(0!==l%p)throw new Error(`The number of frames (${l}) must be a multiple of the stride (${p}).`);const d=new s.Tensor("float32",a.data,a.dims).view(1,Math.floor(l/p),c*p),_={input_features:d};if(o){const e=d.dims[1],t=new s.Tensor("int64",new BigInt64Array(e),[1,e]);if(i)for(let e=1,n=0;e<l;e+=p,++n)t.data[n]=i.data[e];else t.data.fill(1n);_.attention_mask=t}return _}}class G extends _{constructor(e){super(e);const t=this.config.sampling_rate,n=(0,a.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<n.length;++e)n[e].push(0);this.mel_filters=n,this.window=(0,a.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}_extract_fbank_features(e,t){return(0,a.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e){u(e,"ASTFeatureExtractor");const t=this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){const e=2*this.std;for(let n=0;n<t.data.length;++n)t.data[n]=(t.data[n]-this.mean)/e}return{input_values:new s.Tensor("float32",t.data,[1,...t.dims])}}}class q extends _{constructor(e){super(e),this.mel_filters=(0,a.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,a.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,a.window_function)(this.config.fft_window_size,"hann")}_get_input_mel(e,t,n,r){let o,i=!1;const s=e.length-t;if(s>0){if("rand_trunc"!==n)throw new Error(`Truncation strategy "${n}" not implemented`);{i=!0;const n=Math.floor(Math.random()*(s+1));e=e.subarray(n,n+t),o=this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples),o.dims=[1,...o.dims]}}else{if(s<0){let n=new Float64Array(t);if(n.set(e),"repeat"===r)for(let r=e.length;r<t;r+=e.length)n.set(e.subarray(0,Math.min(e.length,t-r)),r);else if("repeatpad"===r)for(let t=e.length;t<-s;t+=e.length)n.set(e,t);e=n}if("fusion"===n)throw new Error(`Truncation strategy "${n}" not implemented`);o=this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples),o.dims=[1,...o.dims]}return{...o,longer:i}}_extract_fbank_features(e,t,n=null){return(0,a.spectrogram)(e,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:t,log_mel:"dB",max_num_frames:n,do_pad:!1,transpose:!0})}async _call(e,{max_length:t=null}={}){u(e,"ClapFeatureExtractor");const n=this._get_input_mel(e,t??this.config.nb_max_samples,this.config.truncation,this.config.padding);return{input_features:new s.Tensor("float32",n.data,[1,...n.dims])}}}class W extends _{}class H extends r.Callable{constructor(e){super(),this.feature_extractor=e}async _call(e,...t){return await this.feature_extractor(e,...t)}}class X extends H{async _call(...e){return await this.feature_extractor(...e)}post_process_masks(...e){return this.feature_extractor.post_process_masks(...e)}reshape_input_points(...e){return this.feature_extractor.reshape_input_points(...e)}}class Q extends H{async _call(e){return await this.feature_extractor(e)}}class Y extends H{async _call(e){return await this.feature_extractor(e)}}class K extends H{async _call(e){return await this.feature_extractor(e)}}class Z extends H{}class J{static FEATURE_EXTRACTOR_CLASS_MAPPING={ImageFeatureExtractor:h,WhisperFeatureExtractor:j,ViTFeatureExtractor:M,MobileViTFeatureExtractor:A,MobileViTImageProcessor:F,OwlViTFeatureExtractor:C,Owlv2ImageProcessor:E,CLIPFeatureExtractor:x,ChineseCLIPFeatureExtractor:y,SiglipImageProcessor:T,ConvNextFeatureExtractor:v,ConvNextImageProcessor:k,SegformerFeatureExtractor:f,BitImageProcessor:b,DPTImageProcessor:g,DPTFeatureExtractor:m,GLPNFeatureExtractor:w,BeitFeatureExtractor:I,DeiTFeatureExtractor:O,DetrFeatureExtractor:N,YolosFeatureExtractor:$,DonutFeatureExtractor:D,NougatImageProcessor:L,EfficientNetImageProcessor:P,ViTImageProcessor:S,VitMatteImageProcessor:R,SamImageProcessor:B,Swin2SRImageProcessor:z,Wav2Vec2FeatureExtractor:V,SeamlessM4TFeatureExtractor:U,SpeechT5FeatureExtractor:W,ASTFeatureExtractor:G,ClapFeatureExtractor:q};static PROCESSOR_CLASS_MAPPING={WhisperProcessor:Q,Wav2Vec2ProcessorWithLM:Y,SamProcessor:X,SpeechT5Processor:K,OwlViTProcessor:Z};static async from_pretrained(e,{progress_callback:t=null,config:n=null,cache_dir:r=null,local_files_only:i=!1,revision:s="main"}={}){let a=n??await(0,o.getModelJSON)(e,"preprocessor_config.json",!0,{progress_callback:t,config:n,cache_dir:r,local_files_only:i,revision:s}),l=a.feature_extractor_type??a.image_processor_type,c=this.FEATURE_EXTRACTOR_CLASS_MAPPING[l];if(!c){if(void 0===a.size)throw new Error(`Unknown Feature Extractor type: ${l}`);console.warn(`Feature extractor type "${l}" not found, assuming ImageFeatureExtractor due to size parameter in config.`),c=h}return new(this.PROCESSOR_CLASS_MAPPING[a.processor_class]??H)(new c(a))}}},"./src/tokenizers.js":
+/*!***************************!*\
+  !*** ./src/tokenizers.js ***!
+  \***************************/(e,t,n)=>{n.r(t),n.d(t,{AlbertTokenizer:()=>ge,AutoTokenizer:()=>pt,BartTokenizer:()=>Ee,BertTokenizer:()=>me,BlenderbotSmallTokenizer:()=>st,BlenderbotTokenizer:()=>it,BloomTokenizer:()=>Le,CLIPTokenizer:()=>tt,CamembertTokenizer:()=>Se,CodeGenTokenizer:()=>et,CodeLlamaTokenizer:()=>Be,CohereTokenizer:()=>ut,ConvBertTokenizer:()=>ve,DebertaTokenizer:()=>xe,DebertaV2Tokenizer:()=>ye,DistilBertTokenizer:()=>Me,ElectraTokenizer:()=>Ae,EsmTokenizer:()=>Ue,FalconTokenizer:()=>je,GPT2Tokenizer:()=>Ce,GPTNeoXTokenizer:()=>Ve,GemmaTokenizer:()=>qe,Grok1Tokenizer:()=>We,HerbertTokenizer:()=>Te,LlamaTokenizer:()=>$e,M2M100Tokenizer:()=>Qe,MBart50Tokenizer:()=>Ie,MBartTokenizer:()=>Oe,MPNetTokenizer:()=>Re,MarianTokenizer:()=>rt,MobileBertTokenizer:()=>be,NllbTokenizer:()=>Xe,NougatTokenizer:()=>lt,PreTrainedTokenizer:()=>fe,Qwen2Tokenizer:()=>Ge,RoFormerTokenizer:()=>ke,RobertaTokenizer:()=>De,SiglipTokenizer:()=>nt,SpeechT5Tokenizer:()=>at,SqueezeBertTokenizer:()=>we,T5Tokenizer:()=>Fe,TokenizerModel:()=>b,VitsTokenizer:()=>ct,Wav2Vec2CTCTokenizer:()=>ot,WhisperTokenizer:()=>Je,XLMRobertaTokenizer:()=>ze,XLMTokenizer:()=>Pe});var r=n(/*! ./utils/core.js */"./src/utils/core.js"),o=n(/*! ./utils/hub.js */"./src/utils/hub.js"),i=n(/*! ./utils/maths.js */"./src/utils/maths.js"),s=n(/*! ./utils/tensor.js */"./src/utils/tensor.js"),a=n(/*! ./utils/data-structures.js */"./src/utils/data-structures.js"),l=n(/*! @huggingface/jinja */"./node_modules/@huggingface/jinja/dist/index.js");async function c(e,t){const n=await Promise.all([(0,o.getModelJSON)(e,"tokenizer.json",!0,t),(0,o.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(n[1].legacy=t.legacy),n}function u(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(const[e,n]of m)t=t.replaceAll(e,n);return new RegExp(t,"gu")}if(void 0!==e.String){const n=(0,r.escapeRegExp)(e.String);return new RegExp(t?n:`(${n})`,"gu")}return console.warn("Unknown pattern type:",e),null}function p(e){return new Map(Object.entries(e))}function d(e){const t=e.dims;switch(t.length){case 1:return e.tolist();case 2:if(1!==t[0])throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");return e.tolist()[0];default:throw new Error(`Expected tensor to have 1-2 dimensions, got ${t.length}.`)}}function _(e){return e.replace(/ \./g,".").replace(/ \?/g,"?").replace(/ \!/g,"!").replace(/ ,/g,",").replace(/ \' /g,"'").replace(/ n\'t/g,"n't").replace(/ \'m/g,"'m").replace(/ \'s/g,"'s").replace(/ \'ve/g,"'ve").replace(/ \'re/g,"'re")}function h(e){return e.replace(/[\u0300-\u036f]/g,"")}const f="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",m=new Map([["(?i:'s|'t|'re|'ve|'m|'ll|'d)","(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"]]);class g{constructor(e){this.content=e.content,this.id=e.id,this.single_word=e.single_word??!1,this.lstrip=e.lstrip??!1,this.rstrip=e.rstrip??!1,this.special=e.special??!1,this.normalized=e.normalized??null}}class b extends r.Callable{constructor(e){super(),this.config=e,this.vocab=[],this.tokens_to_ids=new Map,this.unk_token_id=void 0,this.unk_token=void 0,this.end_of_word_suffix=void 0,this.fuse_unk=this.config.fuse_unk??!1}static fromConfig(e,...t){switch(e.type){case"WordPiece":return new w(e);case"Unigram":return new x(e,...t);case"BPE":return new v(e);default:if(e.vocab)return new k(e,...t);throw new Error(`Unknown TokenizerModel type: ${e.type}`)}}_call(e){let t=this.encode(e);return this.fuse_unk&&(t=function(e,t,n){const r=[];let o=0;for(;o<e.length;)if(r.push(e[o]),(n.get(e[o])??t)===t)for(;o<e.length&&(n.get(e[o])??t)===t;)++o;else++o;return r}(t,this.unk_token_id,this.tokens_to_ids)),t}encode(e){throw Error("encode should be implemented in subclass.")}convert_tokens_to_ids(e){return e.map((e=>this.tokens_to_ids.get(e)??this.unk_token_id))}convert_ids_to_tokens(e){return e.map((e=>this.vocab[e]??this.unk_token))}}class w extends b{constructor(e){super(e),this.tokens_to_ids=p(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.max_input_chars_per_word=e.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){const t=[];for(const n of e){const e=[...n];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let r=!1,o=0;const i=[];for(;o<e.length;){let t=e.length,n=null;for(;o<t;){let r=e.slice(o,t).join("");if(o>0&&(r=this.config.continuing_subword_prefix+r),this.tokens_to_ids.has(r)){n=r;break}--t}if(null===n){r=!0;break}i.push(n),o=t}r?t.push(this.unk_token):t.push(...i)}return t}}class x extends b{constructor(e,t){super(e);const n=e.vocab.length;this.vocab=new Array(n),this.scores=new Array(n);for(let t=0;t<n;++t){const n=e.vocab[t];this.vocab[t]=n[0],this.scores[t]=n[1]}this.unk_token_id=e.unk_id,this.unk_token=this.vocab[e.unk_id],this.tokens_to_ids=new Map(this.vocab.map(((e,t)=>[e,t]))),this.bosToken=" ",this.bosTokenId=this.tokens_to_ids.get(this.bosToken),this.eosToken=t.eos_token,this.eosTokenId=this.tokens_to_ids.get(this.eosToken),this.unkToken=this.vocab[this.unk_token_id],this.minScore=(0,i.min)(this.scores)[0],this.unkScore=this.minScore-10,this.scores[this.unk_token_id]=this.unkScore,this.trie=new a.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(e){const t=e.sentence,n=t.length;let r=0;for(;r<n;){const n=1;let o=!1;const i=[];for(let s of this.trie.commonPrefixSearch(t.slice(r))){i.push(s);const t=this.tokens_to_ids.get(s),a=this.scores[t],l=s.length;e.insert(r,l,a,t),o||l!==n||(o=!0)}o||e.insert(r,n,this.unkScore,this.unk_token_id),r+=n}}tokenize(e){const t=new a.TokenLattice(e,this.bosTokenId,this.eosTokenId);return this.populateNodes(t),t.tokens()}encode(e){const t=[];for(const n of e){const e=this.tokenize(n);t.push(...e)}return t}}const y=(()=>{const e=[...Array.from({length:"~".charCodeAt(0)-"!".charCodeAt(0)+1},((e,t)=>t+"!".charCodeAt(0))),...Array.from({length:"¬".charCodeAt(0)-"¡".charCodeAt(0)+1},((e,t)=>t+"¡".charCodeAt(0))),...Array.from({length:"ÿ".charCodeAt(0)-"®".charCodeAt(0)+1},((e,t)=>t+"®".charCodeAt(0)))],t=e.slice();let n=0;for(let r=0;r<256;++r)e.includes(r)||(e.push(r),t.push(256+n),n+=1);const r=t.map((e=>String.fromCharCode(e)));return Object.fromEntries(e.map(((e,t)=>[e,r[t]])))})(),T=(0,r.reverseDictionary)(y);class v extends b{constructor(e){super(e),this.BPE_SPLIT_TOKEN=" ",this.tokens_to_ids=p(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e;this.bpe_ranks=new Map(e.merges.map(((e,t)=>[e,t]))),this.merges=e.merges.map((e=>e.split(this.BPE_SPLIT_TOKEN))),this.end_of_word_suffix=e.end_of_word_suffix,this.continuing_subword_suffix=e.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.cache=new Map}bpe(e){if(0===e.length)return[];const t=this.cache.get(e);if(void 0!==t)return t;const n=Array.from(e);this.end_of_word_suffix&&(n[n.length-1]+=this.end_of_word_suffix);let r=[];if(n.length>1){const e=new a.PriorityQueue(((e,t)=>e.score<t.score));let t={token:n[0],bias:0,prev:null,next:null},o=t;for(let t=1;t<n.length;++t){const r={bias:t/n.length,token:n[t],prev:o,next:null};o.next=r,this._add_node(e,o),o=r}for(;!e.isEmpty();){const n=e.pop();if(n.deleted||!n.next||n.next.deleted)continue;if(n.deleted=!0,n.next.deleted=!0,n.prev){const e={...n.prev};n.prev.deleted=!0,n.prev=e,e.prev?e.prev.next=e:t=e}const r={token:n.token+n.next.token,bias:n.bias,prev:n.prev,next:n.next.next};r.prev?(r.prev.next=r,this._add_node(e,r.prev)):t=r,r.next&&(r.next.prev=r,this._add_node(e,r))}for(let e=t;null!==e;e=e.next)r.push(e.token)}else r=n;if(this.continuing_subword_suffix)for(let e=0;e<r.length-1;++e)r[e]+=this.continuing_subword_suffix;return this.cache.set(e,r),r}_add_node(e,t){const n=this.bpe_ranks.get(t.token+this.BPE_SPLIT_TOKEN+t.next.token);void 0!==n&&(t.score=n+t.bias,e.push(t))}encode(e){const t=[];for(const n of e){if(this.ignore_merges&&this.tokens_to_ids.has(n)){t.push(n);continue}const e=this.bpe(n);for(const n of e)this.tokens_to_ids.has(n)?t.push(n):this.byte_fallback?t.push(...Array.from(this.text_encoder.encode(n)).map((e=>`<0x${e.toString(16).toUpperCase().padStart(2,"0")}>`))):t.push(this.unk_token)}return t}}class k extends b{constructor(e,t){super(e),this.tokens_to_ids=p(t.target_lang?e.vocab[t.target_lang]:e.vocab),this.bos_token=t.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=t.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=t.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){return e}}class M extends r.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new L(e);case"Precompiled":return new ae(e);case"Sequence":return new D(e);case"Replace":return new S(e);case"NFC":return new P(e);case"NFKC":return new A(e);case"NFKD":return new F(e);case"Strip":return new C(e);case"StripAccents":return new E(e);case"Lowercase":return new O(e);case"Prepend":return new I(e);default:throw new Error(`Unknown Normalizer type: ${e.type}`)}}normalize(e){throw Error("normalize should be implemented in subclass.")}_call(e){return this.normalize(e)}}class S extends M{normalize(e){const t=u(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class P extends M{normalize(e){return e=e.normalize("NFC")}}class A extends M{normalize(e){return e=e.normalize("NFKC")}}class F extends M{normalize(e){return e=e.normalize("NFKD")}}class C extends M{normalize(e){return this.config.strip_left&&this.config.strip_right?e=e.trim():(this.config.strip_left&&(e=e.trimStart()),this.config.strip_right&&(e=e.trimEnd())),e}}class E extends M{normalize(e){return e=h(e)}}class O extends M{normalize(e){return e=e.toLowerCase()}}class I extends M{normalize(e){return e=this.config.prepend+e}}class D extends M{constructor(e){super(e),this.normalizers=e.normalizers.map((e=>M.fromConfig(e)))}normalize(e){return this.normalizers.reduce(((e,t)=>t.normalize(e)),e)}}class L extends M{_tokenize_chinese_chars(e){const t=[];for(let n=0;n<e.length;++n){const r=e[n],o=r.charCodeAt(0);this._is_chinese_char(o)?(t.push(" "),t.push(r),t.push(" ")):t.push(r)}return t.join("")}_is_chinese_char(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=63744&&e<=64255||e>=194560&&e<=195103}stripAccents(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}_is_control(e){switch(e){case"\t":case"\n":case"\r":return!1;default:return/^\p{Cc}|\p{Cf}|\p{Co}|\p{Cs}$/u.test(e)}}_clean_text(e){const t=[];for(const n of e){const e=n.charCodeAt(0);0===e||65533===e||this._is_control(n)||(/^\s$/.test(n)?t.push(" "):t.push(n))}return t.join("")}normalize(e){return this.config.clean_text&&(e=this._clean_text(e)),this.config.handle_chinese_chars&&(e=this._tokenize_chinese_chars(e)),this.config.lowercase?(e=e.toLowerCase(),!1!==this.config.strip_accents&&(e=this.stripAccents(e))):this.config.strip_accents&&(e=this.stripAccents(e)),e}}class N extends r.Callable{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new $(e);case"Sequence":return new le(e);case"Whitespace":return new ce(e);case"WhitespaceSplit":return new ue(e);case"Metaspace":return new ie(e);case"ByteLevel":return new B(e);case"Split":return new z(e);case"Punctuation":return new R(e);case"Digits":return new j(e);case"Replace":return new pe(e);default:throw new Error(`Unknown PreTokenizer type: ${e.type}`)}}pre_tokenize_text(e,t){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(e,t){return(Array.isArray(e)?e.map((e=>this.pre_tokenize_text(e,t))):this.pre_tokenize_text(e,t)).flat()}_call(e,t){return this.pre_tokenize(e,t)}}class $ extends N{constructor(e){super(),this.pattern=new RegExp(`[^\\s${f}]+|[${f}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class B extends N{constructor(e){super(),this.config=e,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=y,this.text_encoder=new TextEncoder}pre_tokenize_text(e,t){this.add_prefix_space&&!e.startsWith(" ")&&(e=" "+e);return(this.use_regex?e.match(this.pattern)||[]:[e]).map((e=>Array.from(this.text_encoder.encode(e),(e=>this.byte_encoder[e])).join("")))}}class z extends N{constructor(e){super(),this.config=e,this.pattern=u(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:function(e,t){const n=[];let r=0;for(const o of e.matchAll(t)){const t=o[0];r<o.index&&n.push(e.slice(r,o.index)),t.length>0&&n.push(t),r=o.index+t.length}return r<e.length&&n.push(e.slice(r)),n}(e,this.pattern)}}class R extends N{constructor(e){super(),this.config=e,this.pattern=new RegExp(`[^${f}]+|[${f}]+`,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class j extends N{constructor(e){super(),this.config=e;const t="[^\\d]+|\\d"+(this.config.individual_digits?"":"+");this.pattern=new RegExp(t,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class V extends r.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"TemplateProcessing":return new q(e);case"ByteLevel":return new W(e);case"RobertaProcessing":return new G(e);case"BertProcessing":return new U(e);case"Sequence":return new H(e);default:throw new Error(`Unknown PostProcessor type: ${e.type}`)}}post_process(e,...t){throw Error("post_process should be implemented in subclass.")}_call(e,...t){return this.post_process(e,...t)}}class U extends V{constructor(e){super(e),this.cls=e.cls[0],this.sep=e.sep[0]}post_process(e,t=null,{add_special_tokens:n=!0}={}){n&&(e=(0,r.mergeArrays)([this.cls],e,[this.sep]));let o=new Array(e.length).fill(0);if(null!==t){const i=n&&this instanceof G?[this.sep]:[],s=n?[this.sep]:[];e=(0,r.mergeArrays)(e,i,t,s),o=(0,r.mergeArrays)(o,new Array(t.length+i.length+s.length).fill(1))}return{tokens:e,token_type_ids:o}}}class G extends U{}class q extends V{constructor(e){super(e),this.single=e.single,this.pair=e.pair}post_process(e,t=null,{add_special_tokens:n=!0}={}){const o=null===t?this.single:this.pair;let i=[],s=[];for(const a of o)"SpecialToken"in a?n&&(i.push(a.SpecialToken.id),s.push(a.SpecialToken.type_id)):"Sequence"in a&&("A"===a.Sequence.id?(i=(0,r.mergeArrays)(i,e),s=(0,r.mergeArrays)(s,new Array(e.length).fill(a.Sequence.type_id))):"B"===a.Sequence.id&&(i=(0,r.mergeArrays)(i,t),s=(0,r.mergeArrays)(s,new Array(t.length).fill(a.Sequence.type_id))));return{tokens:i,token_type_ids:s}}}class W extends V{post_process(e,t=null){return t&&(e=(0,r.mergeArrays)(e,t)),{tokens:e}}}class H extends V{constructor(e){super(e),this.processors=e.processors.map((e=>V.fromConfig(e)))}post_process(e,t=null,n={}){let r;for(const o of this.processors)if(o instanceof W){if(e=o.post_process(e).tokens,t){t=o.post_process(t).tokens}}else{const i=o.post_process(e,t,n);e=i.tokens,r=i.token_type_ids}return{tokens:e,token_type_ids:r}}}class X extends r.Callable{constructor(e){super(),this.config=e,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=e.trim_offsets}static fromConfig(e){if(null===e)return null;switch(e.type){case"WordPiece":return new J(e);case"Metaspace":return new se(e);case"ByteLevel":return new ee(e);case"Replace":return new Q(e);case"ByteFallback":return new Y(e);case"Fuse":return new K(e);case"Strip":return new Z(e);case"Sequence":return new ne(e);case"CTC":return new te(e);case"BPEDecoder":return new re(e);default:throw new Error(`Unknown Decoder type: ${e.type}`)}}_call(e){return this.decode(e)}decode(e){return this.decode_chain(e).join("")}decode_chain(e){throw Error("`decode_chain` should be implemented in subclass.")}}class Q extends X{decode_chain(e){const t=u(this.config.pattern);return null===t?e:e.map((e=>e.replaceAll(t,this.config.content)))}}class Y extends X{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){const t=[];let n=[];for(const r of e){let e=null;if(6===r.length&&r.startsWith("<0x")&&r.endsWith(">")){const t=parseInt(r.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)n.push(e);else{if(n.length>0){const e=this.text_decoder.decode(Uint8Array.from(n));t.push(e),n=[]}t.push(r)}}if(n.length>0){const e=this.text_decoder.decode(Uint8Array.from(n));t.push(e),n=[]}return t}}class K extends X{decode_chain(e){return[e.join("")]}}class Z extends X{constructor(e){super(e),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(e){return e.map((e=>{let t=0;for(let n=0;n<this.start&&e[n]===this.content;++n)t=n+1;let n=e.length;for(let t=0;t<this.stop;++t){const r=e.length-t-1;if(e[r]!==this.content)break;n=r}return e.slice(t,n)}))}}class J extends X{constructor(e){super(e),this.cleanup=e.cleanup}decode_chain(e){return e.map(((e,t)=>(0!==t&&(e=e.startsWith(this.config.prefix)?e.replace(this.config.prefix,""):" "+e),this.cleanup&&(e=_(e)),e)))}}class ee extends X{constructor(e){super(e),this.byte_decoder=T,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(e){const t=e.join(""),n=new Uint8Array([...t].map((e=>this.byte_decoder[e])));return this.text_decoder.decode(n)}decode_chain(e){const t=[];let n=[];for(const r of e)void 0!==this.added_tokens.find((e=>e.content===r))?(n.length>0&&(t.push(this.convert_tokens_to_string(n)),n=[]),t.push(r)):n.push(r);return n.length>0&&t.push(this.convert_tokens_to_string(n)),t}}class te extends X{constructor(e){super(e),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(e){if(0===e.length)return"";const t=[e[0]];for(let n=1;n<e.length;++n)e[n]!==t.at(-1)&&t.push(e[n]);let n=t.filter((e=>e!==this.pad_token)).join("");return this.cleanup&&(n=_(n).replaceAll(this.word_delimiter_token," ").trim()),n}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ne extends X{constructor(e){super(e),this.decoders=e.decoders.map((e=>X.fromConfig(e)))}decode_chain(e){return this.decoders.reduce(((e,t)=>t.decode_chain(e)),e)}}class re extends X{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map(((t,n)=>t.replaceAll(this.suffix,n===e.length-1?"":" ")))}}class oe extends X{decode_chain(e){let t="";for(let n=1;n<e.length;n+=2)t+=e[n];return[t]}}class ie extends N{constructor(e){super(),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement,this.strRep=e.str_rep||this.replacement,this.prepend_scheme=e.prepend_scheme??"always"}pre_tokenize_text(e,{section_index:t}={}){let n=e.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!n.startsWith(this.replacement)&&("always"===this.prepend_scheme||"first"===this.prepend_scheme&&0===t)&&(n=this.strRep+n),[n]}}class se extends X{constructor(e){super(e),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement}decode_chain(e){const t=[];for(let n=0;n<e.length;++n){let r=e[n].replaceAll(this.replacement," ");this.addPrefixSpace&&0==n&&r.startsWith(" ")&&(r=r.substring(1)),t.push(r)}return t}}class ae extends M{constructor(e){super(e),this.charsmap=e.precompiled_charsmap}normalize(e){if((e=(e=e.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm,"")).replace(/[\u0009\u000A\u000C\u000D\u1680\u200B\u200C\u200E\u200F\u2028\u2029\u2581\uFEFF\uFFFD]/gm," ")).includes("~")){const t=e.split("~");e=t.map((e=>e.normalize("NFKC"))).join("~")}else e=e.normalize("NFKC");return e}}class le extends N{constructor(e){super(),this.tokenizers=e.pretokenizers.map((e=>N.fromConfig(e)))}pre_tokenize_text(e,t){return this.tokenizers.reduce(((e,n)=>n.pre_tokenize(e,t)),[e])}}class ce extends N{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class ue extends N{constructor(e){super()}pre_tokenize_text(e,t){return function(e){return e.match(/\S+/g)||[]}(e)}}class pe extends N{constructor(e){super(),this.config=e,this.pattern=u(this.config.pattern),this.content=this.config.content}pre_tokenize_text(e,t){return null===this.pattern?[e]:[e.replaceAll(this.pattern,this.config.content)]}}const de=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function _e(e,t,n,o){for(const i of Object.keys(e)){const s=t-e[i].length,a=n(i),l=new Array(s).fill(a);e[i]="right"===o?(0,r.mergeArrays)(e[i],l):(0,r.mergeArrays)(l,e[i])}}function he(e,t){for(const n of Object.keys(e))e[n].length=t}class fe extends r.Callable{return_token_type_ids=!1;_default_chat_template="{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}";constructor(e,t){super(),this._tokenizer_config=t,this.normalizer=M.fromConfig(e.normalizer),this.pre_tokenizer=N.fromConfig(e.pre_tokenizer),this.model=b.fromConfig(e.model,t),this.post_processor=V.fromConfig(e.post_processor),this.decoder=X.fromConfig(e.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const t of e.added_tokens){const e=new g(t);this.added_tokens.push(e),this.model.tokens_to_ids.set(e.content,e.id),this.model.vocab[e.id]=e.content,e.special&&(this.special_tokens.push(e.content),this.all_special_ids.push(e.id))}if(this.additional_special_tokens=t.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_regex=this.added_tokens.length>0?new RegExp(this.added_tokens.map((e=>`${e.lstrip?"\\s*":""}(${(0,r.escapeRegExp)(e.content)})${e.rstrip?"\\s*":""}`)).join("|")):null,this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.model_max_length=t.model_max_length,this.remove_space=t.remove_space,this.clean_up_tokenization_spaces=t.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=t.do_lowercase_and_remove_accent??!1,this.padding_side="right",this.legacy=!1,this.chat_template=t.chat_template??null,Array.isArray(this.chat_template)){const e=Object.create(null);for(const{name:t,template:n}of this.chat_template){if("string"!=typeof t||"string"!=typeof n)throw new Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=n}this.chat_template=e}this._compiled_template_cache=new Map}getToken(...e){for(const t of e){const e=this._tokenizer_config[t];if(e){if("object"==typeof e){if("AddedToken"===e.__type)return e.content;throw Error(`Unknown token: ${e}`)}return e}}return null}static async from_pretrained(e,{progress_callback:t=null,config:n=null,cache_dir:r=null,local_files_only:o=!1,revision:i="main",legacy:s=null}={}){return new this(...await c(e,{progress_callback:t,config:n,cache_dir:r,local_files_only:o,revision:i,legacy:s}))}_call(e,{text_pair:t=null,add_special_tokens:n=!0,padding:r=!1,truncation:o=null,max_length:a=null,return_tensor:l=!0,return_token_type_ids:c=null}={}){const u=Array.isArray(e);let p;if(u){if(0===e.length)throw Error("text array must be non-empty");if(null!==t){if(!Array.isArray(t))throw Error("text_pair must also be an array");if(e.length!==t.length)throw Error("text and text_pair must have the same length");p=e.map(((e,r)=>this._encode_plus(e,t[r],{add_special_tokens:n,return_token_type_ids:c})))}else p=e.map((e=>this._encode_plus(e,null,{add_special_tokens:n,return_token_type_ids:c})))}else{if(null==e)throw Error("text may not be null or undefined");if(Array.isArray(t))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");p=[this._encode_plus(e,t,{add_special_tokens:n,return_token_type_ids:c})]}if(null===a?a="max_length"===r?this.model_max_length:(0,i.max)(p.map((e=>e.input_ids.length)))[0]:o||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),a=Math.min(a,this.model_max_length),r||o)for(let e=0;e<p.length;++e)p[e].input_ids.length!==a&&(p[e].input_ids.length>a?o&&he(p[e],a):r&&_e(p[e],a,(e=>"input_ids"===e?this.pad_token_id:0),this.padding_side));const d={};if(l){if((!r||!o)&&p.some((e=>{for(const t of Object.keys(e))if(e[t].length!==p[0][t]?.length)return!0;return!1})))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const e=[p.length,p[0].input_ids.length];for(const t of Object.keys(p[0]))d[t]=new s.Tensor("int64",BigInt64Array.from(p.flatMap((e=>e[t])).map(BigInt)),e)}else{for(const e of Object.keys(p[0]))d[e]=p.map((t=>t[e]));if(!u)for(const e of Object.keys(d))d[e]=d[e][0]}return d}_encode_text(e){if(null===e)return null;const t=(this.added_tokens_regex?e.split(this.added_tokens_regex).filter((e=>e)):[e]).map(((e,t)=>{if(void 0!==this.added_tokens.find((t=>t.content===e)))return e;{if(!0===this.remove_space&&(e=e.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(e=function(e){return h(e.toLowerCase())}(e)),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];const n=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(n)}})).flat();return t}_encode_plus(e,t=null,{add_special_tokens:n=!0,return_token_type_ids:o=null}={}){const i=this._encode_text(e),s=this._encode_text(t),a=this.post_processor?this.post_processor(i,s,{add_special_tokens:n}):{tokens:(0,r.mergeArrays)(i??[],s??[])},l=this.model.convert_tokens_to_ids(a.tokens),c={input_ids:l,attention_mask:new Array(l.length).fill(1)};return(o??this.return_token_type_ids)&&a.token_type_ids&&(c.token_type_ids=a.token_type_ids),c}encode(e,t=null,{add_special_tokens:n=!0,return_token_type_ids:r=null}={}){const{input_ids:o}=this._encode_plus(e,t,{add_special_tokens:n,return_token_type_ids:r});return o}batch_decode(e,t={}){return e instanceof s.Tensor&&(e=e.tolist()),e.map((e=>this.decode(e,t)))}decode(e,t={}){if(e instanceof s.Tensor&&(e=d(e)),!Array.isArray(e)||0===e.length||!(0,r.isIntegralNumber)(e[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(e,t)}decode_single(e,{skip_special_tokens:t=!1,clean_up_tokenization_spaces:n=null}){let r=this.model.convert_ids_to_tokens(e);t&&(r=r.filter((e=>!this.special_tokens.includes(e))));let o=this.decoder?this.decoder(r):r.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(o=o.replaceAll(this.decoder.end_of_word_suffix," "),t&&(o=o.trim())),(n??this.clean_up_tokenization_spaces)&&(o=_(o)),o}get default_chat_template(){return this._warned_about_chat_template||(console.warn("No chat template is defined for this tokenizer - using a default chat template that implements the ChatML format. If the default is not appropriate for your model, please set `tokenizer.chat_template` to an appropriate template. See https://huggingface.co/docs/transformers/main/chat_templating for more information."),this._warned_about_chat_template=!0),this._default_chat_template}apply_chat_template(e,{chat_template:t=null,add_generation_prompt:n=!1,tokenize:r=!0,padding:o=!1,truncation:i=!1,max_length:s=null,return_tensor:a=!0,tokenizer_kwargs:c={},...u}={}){if(this.chat_template&&"object"==typeof this.chat_template||null===this.chat_template&&this.default_chat_template&&"object"==typeof this.default_chat_template){const e=this.chat_template??this.default_chat_template;if(null!==t&&Object.hasOwn(e,t))t=e[t];else if(null===t&&"default"in e)t=e.default;else if(null===t)throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(e).sort()}.`)}else t??=this.chat_template??this.default_chat_template;if("string"!=typeof t)throw Error("chat_template must be a string, but got "+typeof t);let p=this._compiled_template_cache.get(t);void 0===p&&(p=new l.Template(t),this._compiled_template_cache.set(t,p));const d=Object.create(null);for(const e of de){const t=this.getToken(e);t&&(d[e]=t)}const _=p.render({messages:e,add_generation_prompt:n,...d,...u});return r?this._call(_,{add_special_tokens:!1,padding:o,truncation:i,max_length:s,return_tensor:a,...c}).input_ids:_}}class me extends fe{return_token_type_ids=!0}class ge extends fe{return_token_type_ids=!0}class be extends fe{return_token_type_ids=!0}class we extends fe{return_token_type_ids=!0}class xe extends fe{return_token_type_ids=!0}class ye extends fe{return_token_type_ids=!0}class Te extends fe{return_token_type_ids=!0}class ve extends fe{return_token_type_ids=!0}class ke extends fe{return_token_type_ids=!0}class Me extends fe{}class Se extends fe{}class Pe extends fe{return_token_type_ids=!0;constructor(e,t){super(e,t),console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class Ae extends fe{return_token_type_ids=!0}class Fe extends fe{}class Ce extends fe{_default_chat_template='{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}'}class Ee extends fe{}class Oe extends fe{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,n){return He(this,e,t,n)}}class Ie extends Oe{}class De extends fe{}class Le extends Ce{constructor(e,t){const n=".,!?…。,、।۔،",r=e.pre_tokenizer?.pretokenizers[0]?.pattern;r&&r.Regex===` ?[^(\\s|[${n}])]+`&&(r.Regex=` ?[^\\s${n}]+`),super(e,t)}}const Ne="▁";class $e extends fe{_default_chat_template="{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif USE_DEFAULT_PROMPT == true and not '<<SYS>>' in messages[0]['content'] %}{% set loop_messages = messages %}{% set system_message = 'DEFAULT_SYSTEM_MESSAGE' %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\n' + system_message + '\n<</SYS>>\n\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'system' %}{{ '<<SYS>>\n' + content.strip() + '\n<</SYS>>\n\n' }}{% elif message['role'] == 'assistant' %}{{ ' '  + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}";DEFAULT_SYSTEM_PROMPT="You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.";constructor(e,t){super(e,t),this.use_default_system_prompt=t.use_default_system_prompt??!1,this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new ie({replacement:Ne,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(e){if(null===e)return null;if(this.legacy||0===e.length)return super._encode_text(e);let t=super._encode_text(Ne+e.replaceAll(Ne," "));return t.length>1&&t[0]===Ne&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}get default_chat_template(){return super.default_chat_template.replaceAll("USE_DEFAULT_PROMPT",this.use_default_system_prompt?"true":"false").replaceAll("DEFAULT_SYSTEM_MESSAGE",this.DEFAULT_SYSTEM_PROMPT.replaceAll("\n","\\n").replaceAll("'","\\'"))}}class Be extends $e{}class ze extends fe{}class Re extends fe{}class je extends fe{}class Ve extends fe{}class Ue extends fe{}class Ge extends fe{}class qe extends fe{_default_chat_template="{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '\n' + message['content'] | trim + '<end_of_turn>\n' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model\n'}}{% endif %}"}class We extends fe{}function He(e,t,n,r){if(!("language_codes"in e)||!Array.isArray(e.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in e&&e.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in e)||"function"!=typeof e.lang_to_token)throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const o=r.src_lang,i=r.tgt_lang;if(!e.language_codes.includes(i))throw new Error(`Target language code "${i}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==o){if(!e.language_codes.includes(o))throw new Error(`Source language code "${o}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);for(const t of e.post_processor.config.single)if("SpecialToken"in t&&e.languageRegex.test(t.SpecialToken.id)){t.SpecialToken.id=e.lang_to_token(o);break}}return r.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(i)])[0],e._call(t,n)}class Xe extends fe{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,n){return He(this,e,t,n)}}class Qe extends fe{constructor(e,t){super(e,t),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))).map((e=>e.slice(2,-2))),this.lang_to_token=e=>`__${e}__`}_build_translation_inputs(e,t,n){return He(this,e,t,n)}}const Ye=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],Ke=new Map(Ye),Ze=new Map([...Ye.map((([e,t])=>[t,e])),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);class Je extends fe{_default_chat_template='{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}';_decode_asr(e,{return_timestamps:t=!1,return_language:n=!1,time_precision:r=null,force_full_sequences:o=!0}={}){if(null===r)throw Error("Must specify time_precision");let s=null;const a="word"===t;function l(){return{language:s,timestamp:[null,null],text:""}}const c=[];let u=l(),p=0;const d=this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1;let _=[],h=[],f=!1,m=null;const g=new Set(this.all_special_ids);for(const n of e){const e=n.tokens,o=a?n.token_timestamps:null;let b=null,w=d;if("stride"in n){const[t,o,i]=n.stride;if(p-=o,m=t-i,o&&(w=o/r+d),i)for(let t=e.length-1;t>=0;--t){const n=e[t];if(n>=d){if(null!==b&&(n-d)*r<m)break;b=n}}}let x=[],y=[];for(let n=0;n<e.length;++n){const m=e[n];if(g.has(m)){const e=this.decode([m]),n=Ke.get(e.slice(2,-2));if(void 0!==n){if(null!==s&&n!==s&&!t){_.push(x);const e=this.findLongestCommonSequence(_)[0],t=this.decode(e);u.text=t,c.push(u),_=[],x=[],u=l()}s=u.language=n}}else if(m>=d){const e=(m-d)*r+p,t=(0,i.round)(e,2);if(null!==b&&m>=b)f=!0;else if(f||_.length>0&&m<w)f=!1;else if(null===u.timestamp[0])u.timestamp[0]=t;else if(t===u.timestamp[0]);else{u.timestamp[1]=t,_.push(x),a&&h.push(y);const[e,n]=this.findLongestCommonSequence(_,h),r=this.decode(e);u.text=r,a&&(u.words=this.collateWordTimestamps(e,n,s)),c.push(u),_=[],x=[],h=[],y=[],u=l()}}else if(x.push(m),a){let e,t=(0,i.round)(o[n]+p,2);e=n+1<o.length?(0,i.round)(o[n+1]+p,2):null,y.push([t,e])}}if("stride"in n){const[e,t,r]=n.stride;p+=e-r}x.length>0?(_.push(x),a&&h.push(y)):_.every((e=>0===e.length))&&(u=l(),_=[],x=[],h=[],y=[])}if(_.length>0){if(o&&t)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[e,n]=this.findLongestCommonSequence(_,h),r=this.decode(e);u.text=r,a&&(u.words=this.collateWordTimestamps(e,n,s)),c.push(u)}let b=Object.create(null);const w=c.map((e=>e.text)).join("");if(t||n){for(let e=0;e<c.length;++e){const r=c[e];t||delete r.timestamp,n||delete r.language}if(a){const e=[];for(const t of c)for(const n of t.words)e.push(n);b={chunks:e}}else b={chunks:c}}return[w,b]}findLongestCommonSequence(e,t=null){let n=e[0],r=n.length,o=[];const i=Array.isArray(t)&&t.length>0;let s=i?[]:null,a=i?t[0]:null;for(let l=1;l<e.length;++l){const c=e[l];let u=0,p=[r,r,0,0];const d=c.length;for(let e=1;e<r+d;++e){const t=e/1e4,o=Math.max(0,r-e),i=Math.min(r,r+d-e),s=n.slice(o,i),a=Math.max(0,e-r),l=Math.min(d,e),_=c.slice(a,l);if(s.length!==_.length)throw new Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");const h=s.filter(((e,t)=>e===_[t])).length,f=h/e+t;h>1&&f>u&&(u=f,p=[o,i,a,l])}const[_,h,f,m]=p,g=Math.floor((h+_)/2),b=Math.floor((m+f)/2);o.push(...n.slice(0,g)),n=c.slice(b),r=n.length,i&&(s.push(...a.slice(0,g)),a=t[l].slice(b))}return o.push(...n),i?(s.push(...a),[o,s]):[o,[]]}collateWordTimestamps(e,t,n){const[r,o,i]=this.combineTokensIntoWords(e,n),s=[];for(let e=0;e<r.length;++e){const n=i[e];s.push({text:r[e],timestamp:[t[n.at(0)][0],t[n.at(-1)][1]]})}return s}combineTokensIntoWords(e,t,n="\"'“¡¿([{-",r="\"'.。,,!!??::”)]}、"){let o,i,s;return["chinese","japanese","thai","lao","myanmar"].includes(t=t??"english")?[o,i,s]=this.splitTokensOnUnicode(e):[o,i,s]=this.splitTokensOnSpaces(e),this.mergePunctuations(o,i,s,n,r)}decode(e,t){let n;return t&&t.decode_with_timestamps?(e instanceof s.Tensor&&(e=d(e)),n=this.decodeWithTimestamps(e,t)):n=super.decode(e,t),n}decodeWithTimestamps(e,t){const n=t?.time_precision??.02,r=Array.from(this.all_special_ids).at(-1)+1;let o=[[]];for(const t of e)if(t>=r){const e=(0,i.round)((t-r)*n,2);o.push(`<|${e}|>`),o.push([])}else o[o.length-1].push(t);return o=o.map((e=>"string"==typeof e?e:super.decode(e,t))),o.join("")}splitTokensOnUnicode(e){const t=this.decode(e,{decode_with_timestamps:!0}),n=[],r=[],o=[];let i=[],s=[],a=0;for(let l=0;l<e.length;++l){const c=e[l];i.push(c),s.push(l);const u=this.decode(i,{decode_with_timestamps:!0});u.includes("�")&&"�"!==t[a+u.indexOf("�")]||(n.push(u),r.push(i),o.push(s),i=[],s=[],a+=u.length)}return[n,r,o]}splitTokensOnSpaces(e){const[t,n,r]=this.splitTokensOnUnicode(e),o=[],i=[],s=[],a=new RegExp(`^[${f}]$`,"gu");for(let e=0;e<t.length;++e){const l=t[e],c=n[e],u=r[e],p=c[0]>=this.model.tokens_to_ids.get("<|endoftext|>"),d=l.startsWith(" "),_=l.trim(),h=a.test(_);if(p||d||h||0===o.length)o.push(l),i.push(c),s.push(u);else{const e=o.length-1;o[e]+=l,i[e].push(...c),s[e].push(...u)}}return[o,i,s]}mergePunctuations(e,t,n,o,i){const s=structuredClone(e),a=structuredClone(t),l=structuredClone(n);let c=s.length-2,u=s.length-1;for(;c>=0;)s[c].startsWith(" ")&&o.includes(s[c].trim())?(s[u]=s[c]+s[u],a[u]=(0,r.mergeArrays)(a[c],a[u]),l[u]=(0,r.mergeArrays)(l[c],l[u]),s[c]="",a[c]=[],l[c]=[]):u=c,--c;for(c=0,u=1;u<s.length;)!s[c].endsWith(" ")&&i.includes(s[u])?(s[c]+=s[u],a[c]=(0,r.mergeArrays)(a[c],a[u]),l[c]=(0,r.mergeArrays)(l[c],l[u]),s[u]="",a[u]=[],l[u]=[]):c=u,++u;return[s.filter((e=>e)),a.filter((e=>e.length>0)),l.filter((e=>e.length>0))]}get_decoder_prompt_ids({language:e=null,task:t=null,no_timestamps:n=!0}={}){const r=[];if(e){e=e.toLowerCase();let t=Ze.get(e);if(void 0===t){if(!Ke.has(e)){const t=2===e.length?Ke.keys():Ke.values();throw new Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(t)}`)}t=e}const n=this.model.tokens_to_ids.get(`<|${t}|>`);if(void 0===n)throw new Error(`Unable to find language "${t}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);r.push(n)}else r.push(null);if(t){if("transcribe"!==(t=t.toLowerCase())&&"translate"!==t)throw new Error(`Task "${t}" is not supported. Must be one of: ["transcribe", "translate"]`);const e=this.model.tokens_to_ids.get(`<|${t}|>`);if(void 0===e)throw new Error(`Unable to find task "${t}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);r.push(e)}else r.push(null);if(n){const e=this.model.tokens_to_ids.get("<|notimestamps|>");if(void 0===e)throw new Error('Unable to find "<|notimestamps|>" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.');r.push(e)}return r.map(((e,t)=>[t+1,e])).filter((e=>null!==e[1]))}}class et extends fe{}class tt extends fe{}class nt extends fe{}class rt extends fe{constructor(e,t){super(e,t),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter((e=>this.languageRegex.test(e))),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(e){if(null===e)return null;const[t,...n]=e.trim().split(this.languageRegex);if(0===n.length)return super._encode_text(t);if(2===n.length){const[e,t]=n;return this.supported_language_codes.includes(e)||console.warn(`Unsupported language code "${e}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,r.mergeArrays)([e],super._encode_text(t))}}}class ot extends fe{}class it extends fe{_default_chat_template="{% for message in messages %}{% if message['role'] == 'user' %}{{ ' ' }}{% endif %}{{ message['content'] }}{% if not loop.last %}{{ '  ' }}{% endif %}{% endfor %}{{ eos_token }}"}class st extends it{}class at extends fe{}class lt extends fe{}class ct extends fe{constructor(e,t){super(e,t),this.decoder=new oe({})}}class ut extends fe{}class pt{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:Fe,DistilBertTokenizer:Me,CamembertTokenizer:Se,DebertaTokenizer:xe,DebertaV2Tokenizer:ye,BertTokenizer:me,HerbertTokenizer:Te,ConvBertTokenizer:ve,RoFormerTokenizer:ke,XLMTokenizer:Pe,ElectraTokenizer:Ae,MobileBertTokenizer:be,SqueezeBertTokenizer:we,AlbertTokenizer:ge,GPT2Tokenizer:Ce,BartTokenizer:Ee,MBartTokenizer:Oe,MBart50Tokenizer:Ie,RobertaTokenizer:De,WhisperTokenizer:Je,CodeGenTokenizer:et,CLIPTokenizer:tt,SiglipTokenizer:nt,MarianTokenizer:rt,BloomTokenizer:Le,NllbTokenizer:Xe,M2M100Tokenizer:Qe,LlamaTokenizer:$e,CodeLlamaTokenizer:Be,XLMRobertaTokenizer:ze,MPNetTokenizer:Re,FalconTokenizer:je,GPTNeoXTokenizer:Ve,EsmTokenizer:Ue,Wav2Vec2CTCTokenizer:ot,BlenderbotTokenizer:it,BlenderbotSmallTokenizer:st,SpeechT5Tokenizer:at,NougatTokenizer:lt,VitsTokenizer:ct,Qwen2Tokenizer:Ge,GemmaTokenizer:qe,Grok1Tokenizer:We,CohereTokenizer:ut,PreTrainedTokenizer:fe};static async from_pretrained(e,{quantized:t=!0,progress_callback:n=null,config:r=null,cache_dir:o=null,local_files_only:i=!1,revision:s="main",legacy:a=null}={}){const[l,u]=await c(e,{quantized:t,progress_callback:n,config:r,cache_dir:o,local_files_only:i,revision:s,legacy:a}),p=u.tokenizer_class?.replace(/Fast$/,"")??"PreTrainedTokenizer";let d=this.TOKENIZER_CLASS_MAPPING[p];return d||(console.warn(`Unknown tokenizer class "${p}", attempting to construct from base class.`),d=fe),new d(l,u)}}},"./src/transformers.js":
+/*!*****************************!*\
+  !*** ./src/transformers.js ***!
+  \*****************************/(e,t,n)=>{n.r(t),n.d(t,{ASTFeatureExtractor:()=>a.ASTFeatureExtractor,ASTForAudioClassification:()=>i.ASTForAudioClassification,ASTModel:()=>i.ASTModel,ASTPreTrainedModel:()=>i.ASTPreTrainedModel,AlbertForMaskedLM:()=>i.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>i.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>i.AlbertForSequenceClassification,AlbertModel:()=>i.AlbertModel,AlbertPreTrainedModel:()=>i.AlbertPreTrainedModel,AlbertTokenizer:()=>s.AlbertTokenizer,AudioClassificationPipeline:()=>r.AudioClassificationPipeline,AutoConfig:()=>l.AutoConfig,AutoModel:()=>i.AutoModel,AutoModelForAudioClassification:()=>i.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>i.AutoModelForAudioFrameClassification,AutoModelForCTC:()=>i.AutoModelForCTC,AutoModelForCausalLM:()=>i.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>i.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>i.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>i.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>i.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>i.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>i.AutoModelForImageSegmentation,AutoModelForImageToImage:()=>i.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>i.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>i.AutoModelForMaskedLM,AutoModelForObjectDetection:()=>i.AutoModelForObjectDetection,AutoModelForQuestionAnswering:()=>i.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>i.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>i.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>i.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>i.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>i.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>i.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>i.AutoModelForTokenClassification,AutoModelForVision2Seq:()=>i.AutoModelForVision2Seq,AutoModelForXVector:()=>i.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>i.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>a.AutoProcessor,AutoTokenizer:()=>s.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>r.AutomaticSpeechRecognitionPipeline,BartForConditionalGeneration:()=>i.BartForConditionalGeneration,BartForSequenceClassification:()=>i.BartForSequenceClassification,BartModel:()=>i.BartModel,BartPretrainedModel:()=>i.BartPretrainedModel,BartTokenizer:()=>s.BartTokenizer,BaseModelOutput:()=>i.BaseModelOutput,BeitFeatureExtractor:()=>a.BeitFeatureExtractor,BeitForImageClassification:()=>i.BeitForImageClassification,BeitModel:()=>i.BeitModel,BeitPreTrainedModel:()=>i.BeitPreTrainedModel,BertForMaskedLM:()=>i.BertForMaskedLM,BertForQuestionAnswering:()=>i.BertForQuestionAnswering,BertForSequenceClassification:()=>i.BertForSequenceClassification,BertForTokenClassification:()=>i.BertForTokenClassification,BertModel:()=>i.BertModel,BertPreTrainedModel:()=>i.BertPreTrainedModel,BertTokenizer:()=>s.BertTokenizer,BitImageProcessor:()=>a.BitImageProcessor,BlenderbotForConditionalGeneration:()=>i.BlenderbotForConditionalGeneration,BlenderbotModel:()=>i.BlenderbotModel,BlenderbotPreTrainedModel:()=>i.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>i.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>i.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>i.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>s.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>s.BlenderbotTokenizer,BloomForCausalLM:()=>i.BloomForCausalLM,BloomModel:()=>i.BloomModel,BloomPreTrainedModel:()=>i.BloomPreTrainedModel,BloomTokenizer:()=>s.BloomTokenizer,CLIPFeatureExtractor:()=>a.CLIPFeatureExtractor,CLIPModel:()=>i.CLIPModel,CLIPPreTrainedModel:()=>i.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>i.CLIPSegForImageSegmentation,CLIPSegModel:()=>i.CLIPSegModel,CLIPSegPreTrainedModel:()=>i.CLIPSegPreTrainedModel,CLIPTextModelWithProjection:()=>i.CLIPTextModelWithProjection,CLIPTokenizer:()=>s.CLIPTokenizer,CLIPVisionModelWithProjection:()=>i.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>i.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>i.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>i.CamembertForSequenceClassification,CamembertForTokenClassification:()=>i.CamembertForTokenClassification,CamembertModel:()=>i.CamembertModel,CamembertPreTrainedModel:()=>i.CamembertPreTrainedModel,CamembertTokenizer:()=>s.CamembertTokenizer,CausalLMOutput:()=>i.CausalLMOutput,CausalLMOutputWithPast:()=>i.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>a.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>i.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>i.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>i.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>a.ClapFeatureExtractor,ClapModel:()=>i.ClapModel,ClapPreTrainedModel:()=>i.ClapPreTrainedModel,ClapTextModelWithProjection:()=>i.ClapTextModelWithProjection,CodeGenForCausalLM:()=>i.CodeGenForCausalLM,CodeGenModel:()=>i.CodeGenModel,CodeGenPreTrainedModel:()=>i.CodeGenPreTrainedModel,CodeGenTokenizer:()=>s.CodeGenTokenizer,CodeLlamaTokenizer:()=>s.CodeLlamaTokenizer,CohereTokenizer:()=>s.CohereTokenizer,ConvBertForMaskedLM:()=>i.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>i.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>i.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>i.ConvBertForTokenClassification,ConvBertModel:()=>i.ConvBertModel,ConvBertPreTrainedModel:()=>i.ConvBertPreTrainedModel,ConvBertTokenizer:()=>s.ConvBertTokenizer,ConvNextFeatureExtractor:()=>a.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>i.ConvNextForImageClassification,ConvNextImageProcessor:()=>a.ConvNextImageProcessor,ConvNextModel:()=>i.ConvNextModel,ConvNextPreTrainedModel:()=>i.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>i.ConvNextV2ForImageClassification,ConvNextV2Model:()=>i.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>i.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>a.DPTFeatureExtractor,DPTForDepthEstimation:()=>i.DPTForDepthEstimation,DPTImageProcessor:()=>a.DPTImageProcessor,DPTModel:()=>i.DPTModel,DPTPreTrainedModel:()=>i.DPTPreTrainedModel,DebertaForMaskedLM:()=>i.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>i.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>i.DebertaForSequenceClassification,DebertaForTokenClassification:()=>i.DebertaForTokenClassification,DebertaModel:()=>i.DebertaModel,DebertaPreTrainedModel:()=>i.DebertaPreTrainedModel,DebertaTokenizer:()=>s.DebertaTokenizer,DebertaV2ForMaskedLM:()=>i.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>i.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>i.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>i.DebertaV2ForTokenClassification,DebertaV2Model:()=>i.DebertaV2Model,DebertaV2PreTrainedModel:()=>i.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>s.DebertaV2Tokenizer,DeiTFeatureExtractor:()=>a.DeiTFeatureExtractor,DeiTForImageClassification:()=>i.DeiTForImageClassification,DeiTModel:()=>i.DeiTModel,DeiTPreTrainedModel:()=>i.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>i.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>i.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>r.DepthEstimationPipeline,DetrFeatureExtractor:()=>a.DetrFeatureExtractor,DetrForObjectDetection:()=>i.DetrForObjectDetection,DetrForSegmentation:()=>i.DetrForSegmentation,DetrModel:()=>i.DetrModel,DetrObjectDetectionOutput:()=>i.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>i.DetrPreTrainedModel,DetrSegmentationOutput:()=>i.DetrSegmentationOutput,Dinov2ForImageClassification:()=>i.Dinov2ForImageClassification,Dinov2Model:()=>i.Dinov2Model,Dinov2PreTrainedModel:()=>i.Dinov2PreTrainedModel,DistilBertForMaskedLM:()=>i.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>i.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>i.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>i.DistilBertForTokenClassification,DistilBertModel:()=>i.DistilBertModel,DistilBertPreTrainedModel:()=>i.DistilBertPreTrainedModel,DistilBertTokenizer:()=>s.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>r.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>a.DonutFeatureExtractor,DonutSwinModel:()=>i.DonutSwinModel,DonutSwinPreTrainedModel:()=>i.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>i.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>a.EfficientNetImageProcessor,EfficientNetModel:()=>i.EfficientNetModel,EfficientNetPreTrainedModel:()=>i.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>i.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>i.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>i.ElectraForSequenceClassification,ElectraForTokenClassification:()=>i.ElectraForTokenClassification,ElectraModel:()=>i.ElectraModel,ElectraPreTrainedModel:()=>i.ElectraPreTrainedModel,ElectraTokenizer:()=>s.ElectraTokenizer,EsmForMaskedLM:()=>i.EsmForMaskedLM,EsmForSequenceClassification:()=>i.EsmForSequenceClassification,EsmForTokenClassification:()=>i.EsmForTokenClassification,EsmModel:()=>i.EsmModel,EsmPreTrainedModel:()=>i.EsmPreTrainedModel,EsmTokenizer:()=>s.EsmTokenizer,FFT:()=>d.FFT,FalconForCausalLM:()=>i.FalconForCausalLM,FalconModel:()=>i.FalconModel,FalconPreTrainedModel:()=>i.FalconPreTrainedModel,FalconTokenizer:()=>s.FalconTokenizer,FastViTForImageClassification:()=>i.FastViTForImageClassification,FastViTModel:()=>i.FastViTModel,FastViTPreTrainedModel:()=>i.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>r.FeatureExtractionPipeline,FeatureExtractor:()=>a.FeatureExtractor,FillMaskPipeline:()=>r.FillMaskPipeline,GLPNFeatureExtractor:()=>a.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>i.GLPNForDepthEstimation,GLPNModel:()=>i.GLPNModel,GLPNPreTrainedModel:()=>i.GLPNPreTrainedModel,GPT2LMHeadModel:()=>i.GPT2LMHeadModel,GPT2Model:()=>i.GPT2Model,GPT2PreTrainedModel:()=>i.GPT2PreTrainedModel,GPT2Tokenizer:()=>s.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>i.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>i.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>i.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>i.GPTJForCausalLM,GPTJModel:()=>i.GPTJModel,GPTJPreTrainedModel:()=>i.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>i.GPTNeoForCausalLM,GPTNeoModel:()=>i.GPTNeoModel,GPTNeoPreTrainedModel:()=>i.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>i.GPTNeoXForCausalLM,GPTNeoXModel:()=>i.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>i.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>s.GPTNeoXTokenizer,GemmaTokenizer:()=>s.GemmaTokenizer,Grok1Tokenizer:()=>s.Grok1Tokenizer,HerbertTokenizer:()=>s.HerbertTokenizer,HubertForCTC:()=>i.HubertForCTC,HubertForSequenceClassification:()=>i.HubertForSequenceClassification,HubertModel:()=>i.HubertModel,HubertPreTrainedModel:()=>i.HubertPreTrainedModel,ImageClassificationPipeline:()=>r.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>r.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>a.ImageFeatureExtractor,ImageMattingOutput:()=>i.ImageMattingOutput,ImageSegmentationPipeline:()=>r.ImageSegmentationPipeline,ImageToImagePipeline:()=>r.ImageToImagePipeline,ImageToTextPipeline:()=>r.ImageToTextPipeline,LlamaForCausalLM:()=>i.LlamaForCausalLM,LlamaModel:()=>i.LlamaModel,LlamaPreTrainedModel:()=>i.LlamaPreTrainedModel,LlamaTokenizer:()=>s.LlamaTokenizer,LongT5ForConditionalGeneration:()=>i.LongT5ForConditionalGeneration,LongT5Model:()=>i.LongT5Model,LongT5PreTrainedModel:()=>i.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>i.M2M100ForConditionalGeneration,M2M100Model:()=>i.M2M100Model,M2M100PreTrainedModel:()=>i.M2M100PreTrainedModel,M2M100Tokenizer:()=>s.M2M100Tokenizer,MBart50Tokenizer:()=>s.MBart50Tokenizer,MBartForCausalLM:()=>i.MBartForCausalLM,MBartForConditionalGeneration:()=>i.MBartForConditionalGeneration,MBartForSequenceClassification:()=>i.MBartForSequenceClassification,MBartModel:()=>i.MBartModel,MBartPreTrainedModel:()=>i.MBartPreTrainedModel,MBartTokenizer:()=>s.MBartTokenizer,MPNetForMaskedLM:()=>i.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>i.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>i.MPNetForSequenceClassification,MPNetForTokenClassification:()=>i.MPNetForTokenClassification,MPNetModel:()=>i.MPNetModel,MPNetPreTrainedModel:()=>i.MPNetPreTrainedModel,MPNetTokenizer:()=>s.MPNetTokenizer,MT5ForConditionalGeneration:()=>i.MT5ForConditionalGeneration,MT5Model:()=>i.MT5Model,MT5PreTrainedModel:()=>i.MT5PreTrainedModel,MarianMTModel:()=>i.MarianMTModel,MarianModel:()=>i.MarianModel,MarianPreTrainedModel:()=>i.MarianPreTrainedModel,MarianTokenizer:()=>s.MarianTokenizer,MaskedLMOutput:()=>i.MaskedLMOutput,MistralForCausalLM:()=>i.MistralForCausalLM,MistralModel:()=>i.MistralModel,MistralPreTrainedModel:()=>i.MistralPreTrainedModel,MobileBertForMaskedLM:()=>i.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>i.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>i.MobileBertForSequenceClassification,MobileBertModel:()=>i.MobileBertModel,MobileBertPreTrainedModel:()=>i.MobileBertPreTrainedModel,MobileBertTokenizer:()=>s.MobileBertTokenizer,MobileViTFeatureExtractor:()=>a.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>i.MobileViTForImageClassification,MobileViTImageProcessor:()=>a.MobileViTImageProcessor,MobileViTModel:()=>i.MobileViTModel,MobileViTPreTrainedModel:()=>i.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>i.MobileViTV2ForImageClassification,MobileViTV2Model:()=>i.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>i.MobileViTV2PreTrainedModel,ModelOutput:()=>i.ModelOutput,MptForCausalLM:()=>i.MptForCausalLM,MptModel:()=>i.MptModel,MptPreTrainedModel:()=>i.MptPreTrainedModel,NllbTokenizer:()=>s.NllbTokenizer,NomicBertModel:()=>i.NomicBertModel,NomicBertPreTrainedModel:()=>i.NomicBertPreTrainedModel,NougatImageProcessor:()=>a.NougatImageProcessor,NougatTokenizer:()=>s.NougatTokenizer,OPTForCausalLM:()=>i.OPTForCausalLM,OPTModel:()=>i.OPTModel,OPTPreTrainedModel:()=>i.OPTPreTrainedModel,ObjectDetectionPipeline:()=>r.ObjectDetectionPipeline,OwlViTFeatureExtractor:()=>a.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>i.OwlViTForObjectDetection,OwlViTModel:()=>i.OwlViTModel,OwlViTPreTrainedModel:()=>i.OwlViTPreTrainedModel,OwlViTProcessor:()=>a.OwlViTProcessor,Owlv2ForObjectDetection:()=>i.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>a.Owlv2ImageProcessor,Owlv2Model:()=>i.Owlv2Model,Owlv2PreTrainedModel:()=>i.Owlv2PreTrainedModel,PhiForCausalLM:()=>i.PhiForCausalLM,PhiModel:()=>i.PhiModel,PhiPreTrainedModel:()=>i.PhiPreTrainedModel,Pipeline:()=>r.Pipeline,PreTrainedModel:()=>i.PreTrainedModel,PreTrainedTokenizer:()=>s.PreTrainedTokenizer,PretrainedConfig:()=>l.PretrainedConfig,PretrainedMixin:()=>i.PretrainedMixin,Processor:()=>a.Processor,QuestionAnsweringModelOutput:()=>i.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>r.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>i.Qwen2ForCausalLM,Qwen2Model:()=>i.Qwen2Model,Qwen2PreTrainedModel:()=>i.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>s.Qwen2Tokenizer,RawImage:()=>u.RawImage,ResNetForImageClassification:()=>i.ResNetForImageClassification,ResNetModel:()=>i.ResNetModel,ResNetPreTrainedModel:()=>i.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>i.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>i.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>i.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>i.RoFormerForTokenClassification,RoFormerModel:()=>i.RoFormerModel,RoFormerPreTrainedModel:()=>i.RoFormerPreTrainedModel,RoFormerTokenizer:()=>s.RoFormerTokenizer,RobertaForMaskedLM:()=>i.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>i.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>i.RobertaForSequenceClassification,RobertaForTokenClassification:()=>i.RobertaForTokenClassification,RobertaModel:()=>i.RobertaModel,RobertaPreTrainedModel:()=>i.RobertaPreTrainedModel,RobertaTokenizer:()=>s.RobertaTokenizer,SamImageProcessor:()=>a.SamImageProcessor,SamImageSegmentationOutput:()=>i.SamImageSegmentationOutput,SamModel:()=>i.SamModel,SamPreTrainedModel:()=>i.SamPreTrainedModel,SamProcessor:()=>a.SamProcessor,SeamlessM4TFeatureExtractor:()=>a.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>a.SegformerFeatureExtractor,SegformerForImageClassification:()=>i.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>i.SegformerForSemanticSegmentation,SegformerModel:()=>i.SegformerModel,SegformerPreTrainedModel:()=>i.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>i.Seq2SeqLMOutput,SequenceClassifierOutput:()=>i.SequenceClassifierOutput,SiglipImageProcessor:()=>a.SiglipImageProcessor,SiglipModel:()=>i.SiglipModel,SiglipPreTrainedModel:()=>i.SiglipPreTrainedModel,SiglipTextModel:()=>i.SiglipTextModel,SiglipTokenizer:()=>s.SiglipTokenizer,SiglipVisionModel:()=>i.SiglipVisionModel,SpeechT5FeatureExtractor:()=>a.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>i.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>i.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>i.SpeechT5HifiGan,SpeechT5Model:()=>i.SpeechT5Model,SpeechT5PreTrainedModel:()=>i.SpeechT5PreTrainedModel,SpeechT5Processor:()=>a.SpeechT5Processor,SpeechT5Tokenizer:()=>s.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>i.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>i.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>i.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>i.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>i.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>s.SqueezeBertTokenizer,StableLmForCausalLM:()=>i.StableLmForCausalLM,StableLmModel:()=>i.StableLmModel,StableLmPreTrainedModel:()=>i.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>i.Starcoder2ForCausalLM,Starcoder2Model:()=>i.Starcoder2Model,Starcoder2PreTrainedModel:()=>i.Starcoder2PreTrainedModel,SummarizationPipeline:()=>r.SummarizationPipeline,Swin2SRForImageSuperResolution:()=>i.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>a.Swin2SRImageProcessor,Swin2SRModel:()=>i.Swin2SRModel,Swin2SRPreTrainedModel:()=>i.Swin2SRPreTrainedModel,SwinForImageClassification:()=>i.SwinForImageClassification,SwinModel:()=>i.SwinModel,SwinPreTrainedModel:()=>i.SwinPreTrainedModel,T5ForConditionalGeneration:()=>i.T5ForConditionalGeneration,T5Model:()=>i.T5Model,T5PreTrainedModel:()=>i.T5PreTrainedModel,T5Tokenizer:()=>s.T5Tokenizer,TableTransformerForObjectDetection:()=>i.TableTransformerForObjectDetection,TableTransformerModel:()=>i.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>i.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>i.TableTransformerPreTrainedModel,Tensor:()=>p.Tensor,Text2TextGenerationPipeline:()=>r.Text2TextGenerationPipeline,TextClassificationPipeline:()=>r.TextClassificationPipeline,TextGenerationPipeline:()=>r.TextGenerationPipeline,TextToAudioPipeline:()=>r.TextToAudioPipeline,TokenClassificationPipeline:()=>r.TokenClassificationPipeline,TokenClassifierOutput:()=>i.TokenClassifierOutput,TokenizerModel:()=>s.TokenizerModel,TrOCRForCausalLM:()=>i.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>i.TrOCRPreTrainedModel,TranslationPipeline:()=>r.TranslationPipeline,UniSpeechForCTC:()=>i.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>i.UniSpeechForSequenceClassification,UniSpeechModel:()=>i.UniSpeechModel,UniSpeechPreTrainedModel:()=>i.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>i.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>i.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>i.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>i.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>i.UniSpeechSatPreTrainedModel,ViTFeatureExtractor:()=>a.ViTFeatureExtractor,ViTForImageClassification:()=>i.ViTForImageClassification,ViTImageProcessor:()=>a.ViTImageProcessor,ViTModel:()=>i.ViTModel,ViTPreTrainedModel:()=>i.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>i.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>i.VitMatteForImageMatting,VitMatteImageProcessor:()=>a.VitMatteImageProcessor,VitMattePreTrainedModel:()=>i.VitMattePreTrainedModel,VitsModel:()=>i.VitsModel,VitsModelOutput:()=>i.VitsModelOutput,VitsPreTrainedModel:()=>i.VitsPreTrainedModel,VitsTokenizer:()=>s.VitsTokenizer,Wav2Vec2BertForCTC:()=>i.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>i.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>i.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>i.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>s.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>a.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>i.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>i.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>i.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>i.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>i.Wav2Vec2PreTrainedModel,Wav2Vec2ProcessorWithLM:()=>a.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>i.WavLMForAudioFrameClassification,WavLMForCTC:()=>i.WavLMForCTC,WavLMForSequenceClassification:()=>i.WavLMForSequenceClassification,WavLMForXVector:()=>i.WavLMForXVector,WavLMModel:()=>i.WavLMModel,WavLMPreTrainedModel:()=>i.WavLMPreTrainedModel,WhisperFeatureExtractor:()=>a.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>i.WhisperForConditionalGeneration,WhisperModel:()=>i.WhisperModel,WhisperPreTrainedModel:()=>i.WhisperPreTrainedModel,WhisperProcessor:()=>a.WhisperProcessor,WhisperTokenizer:()=>s.WhisperTokenizer,XLMForQuestionAnswering:()=>i.XLMForQuestionAnswering,XLMForSequenceClassification:()=>i.XLMForSequenceClassification,XLMForTokenClassification:()=>i.XLMForTokenClassification,XLMModel:()=>i.XLMModel,XLMPreTrainedModel:()=>i.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>i.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>i.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>i.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>i.XLMRobertaForTokenClassification,XLMRobertaModel:()=>i.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>i.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>s.XLMRobertaTokenizer,XLMTokenizer:()=>s.XLMTokenizer,XLMWithLMHeadModel:()=>i.XLMWithLMHeadModel,XVectorOutput:()=>i.XVectorOutput,YolosFeatureExtractor:()=>a.YolosFeatureExtractor,YolosForObjectDetection:()=>i.YolosForObjectDetection,YolosModel:()=>i.YolosModel,YolosObjectDetectionOutput:()=>i.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>i.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>r.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>r.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>r.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>r.ZeroShotObjectDetectionPipeline,bankers_round:()=>d.bankers_round,cat:()=>p.cat,cos_sim:()=>d.cos_sim,dot:()=>d.dot,dynamicTimeWarping:()=>p.dynamicTimeWarping,env:()=>o.env,getTopItems:()=>d.getTopItems,hanning:()=>c.hanning,interpolate:()=>p.interpolate,interpolate_data:()=>d.interpolate_data,layer_norm:()=>p.layer_norm,log_softmax:()=>d.log_softmax,magnitude:()=>d.magnitude,max:()=>d.max,mean:()=>p.mean,mean_pooling:()=>p.mean_pooling,medianFilter:()=>d.medianFilter,mel_filter_bank:()=>c.mel_filter_bank,min:()=>d.min,ones:()=>p.ones,ones_like:()=>p.ones_like,permute:()=>p.permute,permute_data:()=>d.permute_data,pipeline:()=>r.pipeline,quantize_embeddings:()=>p.quantize_embeddings,read_audio:()=>c.read_audio,round:()=>d.round,softmax:()=>d.softmax,spectrogram:()=>c.spectrogram,stack:()=>p.stack,std_mean:()=>p.std_mean,window_function:()=>c.window_function});var r=n(/*! ./pipelines.js */"./src/pipelines.js"),o=n(/*! ./env.js */"./src/env.js"),i=n(/*! ./models.js */"./src/models.js"),s=n(/*! ./tokenizers.js */"./src/tokenizers.js"),a=n(/*! ./processors.js */"./src/processors.js"),l=n(/*! ./configs.js */"./src/configs.js"),c=n(/*! ./utils/audio.js */"./src/utils/audio.js"),u=n(/*! ./utils/image.js */"./src/utils/image.js"),p=n(/*! ./utils/tensor.js */"./src/utils/tensor.js"),d=n(/*! ./utils/maths.js */"./src/utils/maths.js")},"./src/utils/audio.js":
+/*!****************************!*\
+  !*** ./src/utils/audio.js ***!
+  \****************************/(e,t,n)=>{n.r(t),n.d(t,{hanning:()=>a,mel_filter_bank:()=>d,read_audio:()=>s,spectrogram:()=>h,window_function:()=>f});var r=n(/*! ./hub.js */"./src/utils/hub.js"),o=n(/*! ./maths.js */"./src/utils/maths.js"),i=n(/*! ./core.js */"./src/utils/core.js");async function s(e,t){if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const n=await(await(0,r.getFile)(e)).arrayBuffer(),o=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${o.sampleRate}Hz.`);const i=await o.decodeAudioData(n);let s;if(2===i.numberOfChannels){const e=Math.sqrt(2),t=i.getChannelData(0),n=i.getChannelData(1);s=new Float32Array(t.length);for(let r=0;r<i.length;++r)s[r]=e*(t[r]+n[r])/2}else s=i.getChannelData(0);return s}function a(e){if(e<1)return new Float64Array;if(1===e)return new Float64Array([1]);const t=e-1,n=Math.PI/t,r=new Float64Array(e);for(let o=0;o<e;++o){const e=2*o-t;r[o]=.5+.5*Math.cos(n*e)}return r}const l={htk:e=>2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,n=15,r=27/Math.log(6.4))=>e>=t?n+Math.log(e/t)*r:3*e/200};function c(e,t="htk"){const n=l[t];if(!n)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?n(e):e.map((e=>n(e)))}const u={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,n=15,r=Math.log(6.4)/27)=>e>=n?t*Math.exp(r*(e-n)):200*e/3};function p(e,t,n){const r=(t-e)/(n-1);return Float64Array.from({length:n},((t,n)=>e+r*n))}function d(e,t,n,r,o,i=null,s="htk",a=!1){if(null!==i&&"slaney"!==i)throw new Error('norm must be one of null or "slaney"');const l=p(c(n,s),c(r,s),t+2);let d,_=function(e,t="htk"){const n=u[t];if(!n)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?n(e):e.map((e=>n(e)))}(l,s);if(a){const t=o/(2*e);d=c(Float64Array.from({length:e},((e,n)=>n*t)),s),_=l}else d=p(0,Math.floor(o/2),e);const h=function(e,t){const n=Float64Array.from({length:t.length-1},((e,n)=>t[n+1]-t[n])),r=Array.from({length:e.length},(()=>new Array(t.length)));for(let n=0;n<e.length;++n){const o=r[n];for(let r=0;r<t.length;++r)o[r]=t[r]-e[n]}const o=t.length-2,i=Array.from({length:o},(()=>new Array(e.length)));for(let t=0;t<e.length;++t){const e=r[t];for(let r=0;r<o;++r){const o=-e[r]/n[r],s=e[r+2]/n[r+1];i[r][t]=Math.max(0,Math.min(o,s))}}return i}(d,_);if(null!==i&&"slaney"===i)for(let n=0;n<t;++n){const t=h[n],r=2/(_[n+2]-_[n]);for(let n=0;n<e;++n)t[n]*=r}return h}function _(e,t,n,r,i){if(n<=0)throw new Error("reference must be greater than zero");if(r<=0)throw new Error("min_value must be greater than zero");n=Math.max(r,n);const s=Math.log10(n);for(let n=0;n<e.length;++n)e[n]=t*Math.log10(Math.max(r,e[n])-s);if(null!==i){if(i<=0)throw new Error("db_range must be greater than zero");const t=(0,o.max)(e)[0]-i;for(let n=0;n<e.length;++n)e[n]=Math.max(e[n],t)}return e}function h(e,t,n,r,{fft_length:s=null,power:a=1,center:l=!0,pad_mode:c="reflect",onesided:u=!0,preemphasis:p=null,mel_filters:d=null,mel_floor:h=1e-10,log_mel:f=null,reference:m=1,min_value:g=1e-10,db_range:b=null,remove_dc_offset:w=null,max_num_frames:x=null,do_pad:y=!0,transpose:T=!1}={}){const v=t.length;if(null===s&&(s=n),n>s)throw Error(`frame_length (${n}) may not be larger than fft_length (${s})`);if(v!==n)throw new Error(`Length of the window (${v}) must equal frame_length (${n})`);if(r<=0)throw new Error("hop_length must be greater than zero");if(null===a&&null!==d)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(l){if("reflect"!==c)throw new Error(`pad_mode="${c}" not implemented yet.`);const t=Math.floor((s-1)/2)+1;e=function(e,t,n){const r=new e.constructor(e.length+t+n),o=e.length-1;for(let n=0;n<e.length;++n)r[t+n]=e[n];for(let n=1;n<=t;++n)r[t-n]=e[(0,i.calculateReflectOffset)(n,o)];for(let s=1;s<=n;++s)r[o+t+s]=e[(0,i.calculateReflectOffset)(o-s,o)];return r}(e,t,t)}const k=Math.floor(1+Math.floor((e.length-n)/r)),M=u?Math.floor(s/2)+1:s;let S=k,P=k;null!==x&&(x>k?y&&(P=x):P=S=x);const A=new o.FFT(s),F=new Float64Array(s),C=new Float64Array(A.outputBufferSize),E=new Array(S);for(let o=0;o<S;++o){const i=o*r;for(let t=0;t<n;++t)F[t]=e[i+t];if(w){let e=0;for(let t=0;t<n;++t)e+=F[t];const t=e/n;for(let e=0;e<n;++e)F[e]-=t}if(null!==p){for(let e=n-1;e>=1;--e)F[e]-=p*F[e-1];F[0]*=1-p}for(let e=0;e<t.length;++e)F[e]*=t[e];A.realTransform(C,F);const s=new Array(M);for(let e=0;e<s.length;++e){const t=e<<1;s[e]=C[t]**2+C[t+1]**2}E[o]=s}if(null!==a&&2!==a){const e=2/a;for(let t=0;t<E.length;++t){const n=E[t];for(let t=0;t<n.length;++t)n[t]**=e}}const O=d.length,I=new Float32Array(O*P),D=T?[P,O]:[O,P];for(let e=0;e<O;++e){const t=d[e];for(let n=0;n<S;++n){const r=E[n];let o=0;for(let e=0;e<M;++e)o+=t[e]*r[e];I[T?n*O+e:e*S+n]=Math.max(h,o)}}if(null!==a&&null!==f){const e=Math.min(I.length,S*O);switch(f){case"log":for(let t=0;t<e;++t)I[t]=Math.log(I[t]);break;case"log10":for(let t=0;t<e;++t)I[t]=Math.log10(I[t]);break;case"dB":if(1===a)!function(e,t=1,n=1e-5,r=null){_(e,20,t,n,r)}(I,m,g,b);else{if(2!==a)throw new Error(`Cannot use log_mel option '${f}' with power ${a}`);!function(e,t=1,n=1e-10,r=null){_(e,10,t,n,r)}(I,m,g,b)}break;default:throw new Error(`log_mel must be one of null, 'log', 'log10' or 'dB'. Got '${f}'`)}}return{data:I,dims:D}}function f(e,t,{periodic:n=!0,frame_length:r=null,center:o=!0}={}){const i=n?e+1:e;let s;switch(t){case"boxcar":s=new Float64Array(i).fill(1);break;case"hann":case"hann_window":s=a(i);break;case"povey":s=a(i).map((e=>Math.pow(e,.85)));break;default:throw new Error(`Unknown window type ${t}.`)}if(n&&(s=s.subarray(0,e)),null===r)return s;if(e>r)throw new Error(`Length of the window (${e}) may not be larger than frame_length (${r})`);return s}},"./src/utils/core.js":
+/*!***************************!*\
+  !*** ./src/utils/core.js ***!
+  \***************************/(e,t,n)=>{function r(e,t){e&&e(t)}function o(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e])))}function i(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}n.r(t),n.d(t,{Callable:()=>s,calculateDimensions:()=>u,calculateReflectOffset:()=>h,dispatchCallback:()=>r,escapeRegExp:()=>i,exists:()=>c,isIntegralNumber:()=>l,isTypedArray:()=>a,mergeArrays:()=>d,pop:()=>p,product:()=>_,reverseDictionary:()=>o});const s=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}};function a(e){return"TypedArray"===e?.prototype?.__proto__?.constructor?.name}function l(e){return Number.isInteger(e)||"bigint"==typeof e}function c(e){return null!=e}function u(e){const t=[];let n=e;for(;Array.isArray(n);)t.push(n.length),n=n[0];return t}function p(e,t,n=void 0){const r=e[t];if(void 0!==r)return delete e[t],r;if(void 0===n)throw Error(`Key ${t} does not exist in object.`);return n}function d(...e){return Array.prototype.concat.apply([],e)}function _(...e){return e.reduce(((e,t)=>e.flatMap((e=>t.map((t=>[e,t]))))))}function h(e,t){return Math.abs((e+t)%(2*t)-t)}},"./src/utils/data-structures.js":
+/*!**************************************!*\
+  !*** ./src/utils/data-structures.js ***!
+  \**************************************/(e,t,n)=>{n.r(t),n.d(t,{CharTrie:()=>o,PriorityQueue:()=>r,TokenLattice:()=>s});class r{constructor(e=((e,t)=>e>t)){this._heap=[],this._comparator=e}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(const t of e)this._heap.push(t),this._siftUp();return this.size}pop(){const e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){const t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return 1+(e<<1)}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){const n=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=n}_siftUp(){let e=this.size-1;for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)<this.size&&this._greater(this._left(e),e)||this._right(e)<this.size&&this._greater(this._right(e),e);){const t=this._right(e)<this.size&&this._greater(this._right(e),this._left(e))?this._right(e):this._left(e);this._swap(e,t),e=t}}}class o{constructor(){this.root=i.default()}extend(e){for(let t of e)this.push(t)}push(e){let t=this.root;for(let n of e){let e=t.children.get(n);void 0===e&&(e=i.default(),t.children.set(n,e)),t=e}t.isLeaf=!0}*commonPrefixSearch(e){let t=this.root,n="";for(let r=0;r<e.length&&void 0!==t;++r){const o=e[r];n+=o,t=t.children.get(o),void 0!==t&&t.isLeaf&&(yield n)}}}class i{constructor(e,t){this.isLeaf=e,this.children=t}static default(){return new i(!1,new Map)}}class s{constructor(e,t,n){this.sentence=e,this.len=e.length,this.bosTokenId=t,this.eosTokenId=n,this.nodes=[],this.beginNodes=Array.from({length:this.len+1},(()=>[])),this.endNodes=Array.from({length:this.len+1},(()=>[]));const r=new a(this.bosTokenId,0,0,0,0),o=new a(this.eosTokenId,1,this.len,0,0);this.nodes.push(r.clone()),this.nodes.push(o.clone()),this.beginNodes[this.len].push(o),this.endNodes[0].push(r)}insert(e,t,n,r){const o=this.nodes.length,i=new a(r,o,e,t,n);this.beginNodes[e].push(i),this.endNodes[e+t].push(i),this.nodes.push(i)}viterbi(){const e=this.len;let t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let n=0,r=null;for(let o of this.endNodes[t]){const t=o.backtraceScore+e.score;(null===r||t>n)&&(r=o.clone(),n=t)}if(null===r)return[];e.prev=r,e.backtraceScore=n}++t}const n=[],r=this.beginNodes[e][0].prev;if(null===r)return[];let o=r.clone();for(;null!==o.prev;){n.push(o.clone());const e=o.clone();o=e.prev.clone()}return n.reverse(),n}piece(e){return this.sentence.slice(e.pos,e.pos+e.length)}tokens(){return this.viterbi().map((e=>this.piece(e)))}tokenIds(){return this.viterbi().map((e=>e.tokenId))}}class a{constructor(e,t,n,r,o){this.tokenId=e,this.nodeId=t,this.pos=n,this.length=r,this.score=o,this.prev=null,this.backtraceScore=0}clone(){const e=new a(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}},"./src/utils/generation.js":
+/*!*********************************!*\
+  !*** ./src/utils/generation.js ***!
+  \*********************************/(e,t,n)=>{n.r(t),n.d(t,{ForceTokensLogitsProcessor:()=>a,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,GenerationConfig:()=>g,LogitsProcessor:()=>s,LogitsProcessorList:()=>i,MinLengthLogitsProcessor:()=>h,MinNewTokensLengthLogitsProcessor:()=>f,NoBadWordsLogitsProcessor:()=>m,NoRepeatNGramLogitsProcessor:()=>d,RepetitionPenaltyLogitsProcessor:()=>_,Sampler:()=>b,SuppressTokensAtBeginLogitsProcessor:()=>u,WhisperTimeStampLogitsProcessor:()=>p});n(/*! ./tensor.js */"./src/utils/tensor.js");var r=n(/*! ./core.js */"./src/utils/core.js"),o=n(/*! ./maths.js */"./src/utils/maths.js");class i extends r.Callable{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){for(let n of t)this.processors.forEach((t=>t(e,n)))}[Symbol.iterator](){return this.processors.values()}}class s extends r.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class a extends s{constructor(e){super(),this.force_token_map=Object.fromEntries(e??[])}_call(e,t){let n=this.force_token_map[e.length];return(0,r.exists)(n)&&(t.data.fill(-1/0),t.data[n]=0),t}}class l extends s{constructor(e){super(),this.bos_token_id=e}_call(e,t){return 1===e.length&&(t.data.fill(-1/0),t.data[this.bos_token_id]=0),t}}class c extends s{constructor(e,t){super(),this.max_length=e,this.forced_eos_token_id=t}_call(e,t){}}class u extends s{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){if(e.length===this.begin_index)for(let e of this.begin_suppress_tokens)t.data[e]=-1/0;return t}}class p extends s{constructor(e){super(),this.eos_token_id=e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(e.forced_decoder_ids||[]).length+2,e.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){const n=t.data;if(n[this.no_timestamps_token_id]=-1/0,e.length===this.begin_index-1)return n.fill(-1/0),n[this.timestamp_begin]=0,t;const r=e.slice(this.begin_index),i=r.length>=1&&r[r.length-1]>=this.timestamp_begin,s=r.length<2||r[r.length-2]>=this.timestamp_begin;if(i&&(s?n.subarray(this.timestamp_begin).fill(-1/0):n.subarray(0,this.eos_token_id).fill(-1/0)),e.length===this.begin_index&&null!==this.max_initial_timestamp_index){const e=this.timestamp_begin+this.max_initial_timestamp_index;n.subarray(e+1).fill(-1/0)}const a=(0,o.log_softmax)(n);return Math.log(a.subarray(this.timestamp_begin).map(Math.exp).reduce(((e,t)=>e+t)))>(0,o.max)(a.subarray(0,this.timestamp_begin))[0]&&n.subarray(0,this.timestamp_begin).fill(-1/0),t}}class d extends s{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){const t=e.length,n=[];for(let r=0;r<t+1-this.no_repeat_ngram_size;++r){const t=[];for(let n=0;n<this.no_repeat_ngram_size;++n)t.push(e[r+n]);n.push(t)}const r=new Map;for(const e of n){const t=e.slice(0,e.length-1),n=JSON.stringify(t),o=r.get(n)??[];o.push(e[e.length-1]),r.set(n,o)}return r}getGeneratedNgrams(e,t){const n=t.slice(t.length+1-this.no_repeat_ngram_size,t.length);return e.get(JSON.stringify(n))??[]}calcBannedNgramTokens(e){const t=[];if(e.length+1<this.no_repeat_ngram_size)return t;{const t=this.getNgrams(e);return this.getGeneratedNgrams(t,e)}}_call(e,t){const n=this.calcBannedNgramTokens(e);for(const e of n)t.data[e]=-1/0;return t}}class _ extends s{constructor(e){super(),this.penalty=e}_call(e,t){for(const n of e)t.data[n]<0?t.data[n]*=this.penalty:t.data[n]/=this.penalty;return t}}class h extends s{constructor(e,t){super(),this.min_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){if(e.length<this.min_length)for(const e of this.eos_token_id)t.data[e]=-1/0;return t}}class f extends s{constructor(e,t,n){super(),this.prompt_length_to_skip=e,this.min_new_tokens=t,this.eos_token_id=Array.isArray(n)?n:[n]}_call(e,t){if(e.length-this.prompt_length_to_skip<this.min_new_tokens)for(const e of this.eos_token_id)t.data[e]=-1/0;return t}}class m extends s{constructor(e,t){super(),this.bad_words_ids=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(const n of this.bad_words_ids){let r=!0;for(let t=1;t<=n.length-1&&n.length<e.length;++t)if(n.at(-t-1)!==e.at(-t)){r=!1;break}r&&(t.data[n.at(-1)]=-1/0)}return t}}const g=class{constructor(e={}){this.max_length=e.max_length??20,this.max_new_tokens=e.max_new_tokens??null,this.min_length=e.min_length??0,this.min_new_tokens=e.min_new_tokens??null,this.early_stopping=e.early_stopping??!1,this.max_time=e.max_time??null,this.do_sample=e.do_sample??!1,this.num_beams=e.num_beams??1,this.num_beam_groups=e.num_beam_groups??1,this.penalty_alpha=e.penalty_alpha??null,this.use_cache=e.use_cache??!0,this.temperature=e.temperature??1,this.top_k=e.top_k??50,this.top_p=e.top_p??1,this.typical_p=e.typical_p??1,this.epsilon_cutoff=e.epsilon_cutoff??0,this.eta_cutoff=e.eta_cutoff??0,this.diversity_penalty=e.diversity_penalty??0,this.repetition_penalty=e.repetition_penalty??1,this.encoder_repetition_penalty=e.encoder_repetition_penalty??1,this.length_penalty=e.length_penalty??1,this.no_repeat_ngram_size=e.no_repeat_ngram_size??0,this.bad_words_ids=e.bad_words_ids??null,this.force_words_ids=e.force_words_ids??null,this.renormalize_logits=e.renormalize_logits??!1,this.constraints=e.constraints??null,this.forced_bos_token_id=e.forced_bos_token_id??null,this.forced_eos_token_id=e.forced_eos_token_id??null,this.remove_invalid_values=e.remove_invalid_values??!1,this.exponential_decay_length_penalty=e.exponential_decay_length_penalty??null,this.suppress_tokens=e.suppress_tokens??null,this.begin_suppress_tokens=e.begin_suppress_tokens??null,this.forced_decoder_ids=e.forced_decoder_ids??null,this.num_return_sequences=e.num_return_sequences??1,this.output_attentions=e.output_attentions??!1,this.output_hidden_states=e.output_hidden_states??!1,this.output_scores=e.output_scores??!1,this.return_dict_in_generate=e.return_dict_in_generate??!1,this.pad_token_id=e.pad_token_id??null,this.bos_token_id=e.bos_token_id??null,this.eos_token_id=e.eos_token_id??null,this.encoder_no_repeat_ngram_size=e.encoder_no_repeat_ngram_size??0,this.decoder_start_token_id=e.decoder_start_token_id??null,this.generation_kwargs=e.generation_kwargs??{}}};class b extends r.Callable{constructor(e){super(),this.generation_config=e}_call(e,t=-1){return this.sample(e,t)}sample(e,t){throw Error("sample should be implemented in subclasses.")}getLogits(e,t){let n=e.dims.at(-1),r=e.data;if(-1===t)r=r.slice(-n);else{let e=t*n;r=r.slice(e,e+n)}return this.generation_config.temperature>0&&(r=r.map((e=>e/this.generation_config.temperature))),r}randomSelect(e){let t=e.reduce(((e,t)=>e+t),0),n=Math.random()*t;for(let t=0;t<e.length;++t)if(n-=e[t],n<=0)return t;return 0}static getSampler(e){if(e.do_sample)return new x(e);if(e.num_beams>1)return new y(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new w(e)}}class w extends b{sample(e,t=-1){let n=this.getLogits(e,t);return[[(0,o.max)(n)[1],0]]}}class x extends b{sample(e,t=-1){let n=e.dims.at(-1);this.generation_config.top_k>0&&(n=Math.min(this.generation_config.top_k,n));const r=this.getLogits(e,t),i=(0,o.getTopItems)(r,n),s=(0,o.softmax)(i.map((e=>e[1])));return Array.from({length:this.generation_config.num_beams},(()=>{const e=this.randomSelect(s);return[i[e][0],Math.log(s[e])]}))}}class y extends b{sample(e,t=-1){let n=e.dims.at(-1);this.generation_config.top_k>0&&(n=Math.min(this.generation_config.top_k,n));const r=this.getLogits(e,t),i=(0,o.getTopItems)(r,n),s=(0,o.softmax)(i.map((e=>e[1])));return Array.from({length:this.generation_config.num_beams},((e,t)=>[i[t][0],Math.log(s[t])]))}}},"./src/utils/hub.js":
+/*!**************************!*\
+  !*** ./src/utils/hub.js ***!
+  \**************************/(e,t,n)=>{n.r(t),n.d(t,{getFile:()=>c,getModelFile:()=>d,getModelJSON:()=>_});var r=n(/*! fs */"?7a2c"),o=n(/*! path */"?a42a"),i=n(/*! ../env.js */"./src/env.js"),s=n(/*! ./core.js */"./src/utils/core.js");class a{_CONTENT_TYPE_MAP={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=r.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=r.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();let n=this;this.body=new ReadableStream({start(e){n.arrayBuffer().then((t=>{e.enqueue(new Uint8Array(t)),e.close()}))}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[e]??"application/octet-stream")}clone(){let e=new a(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await r.promises.readFile(this.filePath)).buffer}async blob(){const e=await r.promises.readFile(this.filePath);return new Blob([e],{type:this.headers.get("content-type")})}async text(){return await r.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function l(e,t=null,n=null){let r;try{r=new URL(e)}catch(e){return!1}return!(t&&!t.includes(r.protocol))&&!(n&&!n.includes(r.hostname))}async function c(e){if(i.env.useFS&&!l(e,["http:","https:","blob:"]))return new a(e);if("undefined"!=typeof process&&"node"===process?.release?.name){const t=!!process.env?.TESTING_REMOTELY,n=i.env.version,r=new Headers;r.set("User-Agent",`transformers.js/${n}; is_ci/${t};`);if(l(e,["http:","https:"],["huggingface.co","hf.co"])){const e=process.env?.HF_TOKEN??process.env?.HF_ACCESS_TOKEN;e&&r.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:r})}return fetch(e)}const u={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class p{constructor(e){this.path=e}async match(e){let t=o.join(this.path,e),n=new a(t);return n.exists?n:void 0}async put(e,t){const n=Buffer.from(await t.arrayBuffer());let i=o.join(this.path,e);try{await r.promises.mkdir(o.dirname(i),{recursive:!0}),await r.promises.writeFile(i,n)}catch(e){console.warn("An error occurred while writing the file to cache:",e)}}}async function d(e,t,n=!0,r={}){if(!i.env.allowLocalModels){if(r.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!i.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}let o;if((0,s.dispatchCallback)(r.progress_callback,{status:"initiate",name:e,file:t}),!o&&i.env.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{o=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!o&&i.env.useFSCache&&(o=new p(r.cache_dir??i.env.cacheDir)),!o&&i.env.useCustomCache){if(!i.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!i.env.customCache.match||!i.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");o=i.env.customCache}const a=r.revision??"main";let d,_,f=h(e,t),m=h(i.env.localModelPath,f),g=h(i.env.remoteHost,i.env.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(a)),t),b="main"===a?f:h(e,a,t),w=o instanceof p?b:g,x=!1;o&&(_=await async function(e,...t){for(let n of t)try{let t=await e.match(n);if(t)return t}catch(e){continue}}(o,m,w));const y=void 0!==_;if(void 0===_){if(i.env.allowLocalModels){if(l(f,["http:","https:"])){if(r.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${f}.`);if(!i.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${f}.`)}else try{_=await c(m),d=m}catch(e){console.warn(`Unable to load from local path "${m}": "${e}"`)}}if(void 0===_||404===_.status){if(r.local_files_only||!i.env.allowRemoteModels){if(n)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${m}".`);return null}if(_=await c(g),200!==_.status)return function(e,t,n){if(!n)return null;const r=u[e]??`Error (${e}) occurred while trying to load file`;throw Error(`${r}: "${t}".`)}(_.status,g,n);d=w}x=o&&"undefined"!=typeof Response&&_ instanceof Response&&200===_.status}(0,s.dispatchCallback)(r.progress_callback,{status:"download",name:e,file:t});const T={status:"progress",name:e,file:t};let v;return r.progress_callback?y&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(v=new Uint8Array(await _.arrayBuffer()),(0,s.dispatchCallback)(r.progress_callback,{...T,progress:100,loaded:v.length,total:v.length})):v=await async function(e,t){const n=e.headers.get("Content-Length");null===n&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let r=parseInt(n??"0"),o=new Uint8Array(r),i=0;const s=e.body.getReader();async function a(){const{done:e,value:n}=await s.read();if(e)return;let l=i+n.length;if(l>r){r=l;let e=new Uint8Array(r);e.set(o),o=e}o.set(n,i),i=l;return t({progress:i/r*100,loaded:i,total:r}),a()}return await a(),o}(_,(e=>{(0,s.dispatchCallback)(r.progress_callback,{...T,...e})})):v=new Uint8Array(await _.arrayBuffer()),x&&d&&void 0===await o.match(d)&&await o.put(d,new Response(v,{headers:_.headers})).catch((e=>{console.warn(`Unable to add response to browser cache: ${e}.`)})),(0,s.dispatchCallback)(r.progress_callback,{status:"done",name:e,file:t}),v}async function _(e,t,n=!0,r={}){let o=await d(e,t,n,r);if(null===o)return{};let i=new TextDecoder("utf-8").decode(o);return JSON.parse(i)}function h(...e){return(e=e.map(((t,n)=>(n&&(t=t.replace(new RegExp("^/"),"")),n!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t)))).join("/")}},"./src/utils/image.js":
+/*!****************************!*\
+  !*** ./src/utils/image.js ***!
+  \****************************/(e,t,n)=>{n.r(t),n.d(t,{RawImage:()=>h});var r=n(/*! ./hub.js */"./src/utils/hub.js"),o=n(/*! ../env.js */"./src/env.js"),i=n(/*! ./tensor.js */"./src/utils/tensor.js"),s=n(/*! sharp */"?2b25");const a="undefined"!=typeof self,l=a&&"DedicatedWorkerGlobalScope"===self.constructor.name;let c,u,p;if(a)c=(e,t)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},p=self.createImageBitmap,u=self.ImageData;else{if(!s)throw new Error("Unable to load image processing library.");p=async e=>{const t=(await e.metadata()).channels;let{data:n,info:r}=await e.rotate().raw().toBuffer({resolveWithObject:!0});const o=new h(new Uint8ClampedArray(n),r.width,r.height,r.channels);return void 0!==t&&t!==r.channels&&o.convert(t),o}}const d={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},_=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class h{constructor(e,t,n,r){this.data=e,this.width=t,this.height=n,this.channels=r}get size(){return[this.width,this.height]}static async read(e){if(e instanceof h)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);throw new Error("Unsupported input type: "+typeof e)}static async fromURL(e){let t=await(0,r.getFile)(e);if(200!==t.status)throw new Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);let n=await t.blob();return this.fromBlob(n)}static async fromBlob(e){if(a){let t=await p(e);const n=c(t.width,t.height).getContext("2d");return n.drawImage(t,0,0),new this(n.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{let t=s(await e.arrayBuffer());return await p(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw new Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"!==t)throw new Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new h(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw new Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,n=0;t<this.data.length;t+=this.channels){const r=this.data[t],o=this.data[t+1],i=this.data[t+2];e[n++]=Math.round(.2989*r+.587*o+.114*i)}break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,1)}rgb(){if(3===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*3);switch(this.channels){case 1:for(let t=0,n=0;t<this.data.length;++t)e[n++]=this.data[t],e[n++]=this.data[t],e[n++]=this.data[t];break;case 4:for(let t=0,n=0;t<this.data.length;t+=4)e[n++]=this.data[t],e[n++]=this.data[t+1],e[n++]=this.data[t+2];break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,3)}rgba(){if(4===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*4);switch(this.channels){case 1:for(let t=0,n=0;t<this.data.length;++t)e[n++]=this.data[t],e[n++]=this.data[t],e[n++]=this.data[t],e[n++]=255;break;case 3:for(let t=0,n=0;t<this.data.length;t+=3)e[n++]=this.data[t],e[n++]=this.data[t+1],e[n++]=this.data[t+2],e[n++]=255;break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,4)}async resize(e,t,{resample:n=2}={}){let r=d[n]??n;if(a){let n=this.channels,r=this.toCanvas();const o=c(e,t).getContext("2d");return o.drawImage(r,0,0,e,t),new h(o.getImageData(0,0,e,t).data,e,t,4).convert(n)}{let n=this.toSharp();switch(r){case"box":case"hamming":"box"!==r&&"hamming"!==r||(console.warn(`Resampling method ${r} is not yet supported. Using bilinear instead.`),r="bilinear");case"nearest":case"bilinear":case"bicubic":n=n.affine([e/this.width,0,0,t/this.height],{interpolator:r});break;case"lanczos":n=n.resize({width:e,height:t,fit:"fill",kernel:"lanczos3"});break;default:throw new Error(`Resampling method ${r} is not supported.`)}return await p(n)}}async pad([e,t,n,r]){if(e=Math.max(e,0),t=Math.max(t,0),n=Math.max(n,0),r=Math.max(r,0),0===e&&0===t&&0===n&&0===r)return this;if(a){let o=this.channels,i=this.toCanvas(),s=this.width+e+t,a=this.height+n+r;const l=c(s,a).getContext("2d");return l.drawImage(i,0,0,this.width,this.height,e,n,s,a),new h(l.getImageData(0,0,s,a).data,s,a,4).convert(o)}{let o=this.toSharp().extend({left:e,right:t,top:n,bottom:r});return await p(o)}}async crop([e,t,n,r]){if(e=Math.max(e,0),t=Math.max(t,0),n=Math.min(n,this.width-1),r=Math.min(r,this.height-1),0===e&&0===t&&n===this.width-1&&r===this.height-1)return this;const o=n-e+1,i=r-t+1;if(a){const n=this.channels,r=this.toCanvas(),s=c(o,i).getContext("2d");s.drawImage(r,e,t,o,i,0,0,o,i);return new h(s.getImageData(0,0,o,i).data,o,i,4).convert(n)}{const n=this.toSharp().extract({left:e,top:t,width:o,height:i});return await p(n)}}async center_crop(e,t){if(this.width===e&&this.height===t)return this;let n=(this.width-e)/2,r=(this.height-t)/2;if(a){let o=this.channels,i=this.toCanvas();const s=c(e,t).getContext("2d");let a=0,l=0,u=0,p=0;return n>=0?a=n:u=-n,r>=0?l=r:p=-r,s.drawImage(i,a,l,e,t,u,p,e,t),new h(s.getImageData(0,0,e,t).data,e,t,4).convert(o)}{let o=this.toSharp();if(n>=0&&r>=0)o=o.extract({left:Math.floor(n),top:Math.floor(r),width:e,height:t});else if(n<=0&&r<=0){let i=Math.floor(-r),s=Math.floor(-n);o=o.extend({top:i,left:s,right:e-this.width-s,bottom:t-this.height-i})}else{let i=[0,0],s=0;r<0?(i[0]=Math.floor(-r),i[1]=t-this.height-i[0]):s=Math.floor(r);let a=[0,0],l=0;n<0?(a[0]=Math.floor(-n),a[1]=e-this.width-a[0]):l=Math.floor(n),o=o.extend({top:i[0],bottom:i[1],left:a[0],right:a[1]}).extract({left:l,top:s,width:e,height:t})}return await p(o)}}async toBlob(e="image/png",t=1){if(!a)throw new Error("toBlob() is only supported in browser environments.");const n=this.toCanvas();return await n.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new i.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else{if("CHW"!==e)throw new Error(`Unsupported channel format: ${e}`);t=t.permute(2,0,1)}return t}toCanvas(){if(!a)throw new Error("toCanvas() is only supported in browser environments.");let e=this.clone().rgba(),t=c(e.width,e.height),n=new u(e.data,e.width,e.height);return t.getContext("2d").putImageData(n,0,0),t}_update(e,t,n,r=null){return this.data=e,this.width=t,this.height=n,null!==r&&(this.channels=r),this}clone(){return new h(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(!a){if(o.env.useFS){const t=this.toSharp();return await t.toFile(e)}throw new Error("Unable to save the image because filesystem is disabled in this environment.")}{if(l)throw new Error("Unable to save an image from a Web Worker.");const t=e.split(".").pop().toLowerCase(),n=_.get(t)??"image/png",r=await this.toBlob(n),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=e,i.click(),i.remove()}}toSharp(){if(a)throw new Error("toSharp() is only supported in server-side environments.");return s(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}},"./src/utils/maths.js":
+/*!****************************!*\
+  !*** ./src/utils/maths.js ***!
+  \****************************/(e,t,n)=>{function r(e,[t,n,r],[o,i],s="bilinear",a=!1){const l=i/r,c=o/n,u=new e.constructor(o*i*t),p=n*r,d=o*i;for(let s=0;s<o;++s)for(let o=0;o<i;++o){const a=s*i+o,_=(o+.5)/l-.5,h=(s+.5)/c-.5;let f=Math.floor(_),m=Math.floor(h);const g=Math.min(f+1,r-1),b=Math.min(m+1,n-1);f=Math.max(f,0),m=Math.max(m,0);const w=_-f,x=h-m,y=(1-w)*(1-x),T=w*(1-x),v=(1-w)*x,k=w*x,M=m*r,S=b*r,P=M+f,A=M+g,F=S+f,C=S+g;for(let n=0;n<t;++n){const t=n*p;u[n*d+a]=y*e[t+P]+T*e[t+A]+v*e[t+F]+k*e[t+C]}}return u}function o(e,t,n){const r=new Array(n.length),o=new Array(n.length);for(let e=n.length-1,i=1;e>=0;--e)o[e]=i,r[e]=t[n[e]],i*=r[e];const i=n.map(((e,t)=>o[n.indexOf(t)])),s=new e.constructor(e.length);for(let n=0;n<e.length;++n){let r=0;for(let e=t.length-1,o=n;e>=0;--e)r+=o%t[e]*i[e],o=Math.floor(o/t[e]);s[r]=e[n]}return[s,r]}function i(e){const t=d(e)[0],n=e.map((e=>Math.exp(e-t))),r=n.reduce(((e,t)=>e+t),0);return n.map((e=>e/r))}function s(e){return i(e).map((e=>Math.log(e)))}function a(e,t){let n=0;for(let r=0;r<e.length;++r)n+=e[r]*t[r];return n}function l(e,t=0){return e=Array.from(e).map(((e,t)=>[t,e])).sort(((e,t)=>t[1]-e[1])),null!==t&&t>0&&(e=e.slice(0,t)),e}function c(e,t){return a(e,t)/(u(e)*u(t))}function u(e){return Math.sqrt(e.reduce(((e,t)=>e+t*t),0))}function p(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],n=0;for(let r=1;r<e.length;++r)e[r]<t&&(t=e[r],n=r);return[t,n]}function d(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],n=0;for(let r=1;r<e.length;++r)e[r]>t&&(t=e[r],n=r);return[Number(t),n]}function _(e){return e>0&&0==(e&e-1)}n.r(t),n.d(t,{FFT:()=>m,bankers_round:()=>w,cos_sim:()=>c,dot:()=>a,getTopItems:()=>l,interpolate_data:()=>r,log_softmax:()=>s,magnitude:()=>u,max:()=>d,medianFilter:()=>g,min:()=>p,permute_data:()=>o,round:()=>b,softmax:()=>i});class h{constructor(e){if(this.size=0|e,this.size<=1||!_(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;e<this.table.length;e+=2){const t=Math.PI*e/this.size;this.table[e]=Math.cos(t),this.table[e+1]=-Math.sin(t)}let t=0;for(let e=1;this.size>e;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<<this._width);for(let e=0;e<this._bitrev.length;++e){this._bitrev[e]=0;for(let t=0;t<this._width;t+=2){const n=this._width-t-2;this._bitrev[e]|=(e>>>t&3)<<n}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(e,t){const n=t||new Array(e.length>>>1);for(let t=0;t<e.length;t+=2)n[t>>>1]=e[t];return n}toComplexArray(e,t){const n=t||this.createComplexArray();for(let t=0;t<n.length;t+=2)n[t]=e[t>>>1],n[t+1]=0;return n}transform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,1)}realTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._realTransform4(e,t,1)}inverseTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,-1);for(let t=0;t<e.length;++t)e[t]/=this.size}_transform4(e,t,n){const r=this._csize;let o,i,s=1<<this._width,a=r/s<<1;const l=this._bitrev;if(4===a)for(o=0,i=0;o<r;o+=a,++i){const n=l[i];this._singleTransform2(t,e,o,n,s)}else for(o=0,i=0;o<r;o+=a,++i){const r=l[i];this._singleTransform4(t,e,o,r,s,n)}const c=this.table;for(s>>=2;s>=2;s>>=2){a=r/s<<1;const t=a>>>2;for(o=0;o<r;o+=a){const r=o+t-1;for(let i=o,a=0;i<r;i+=2,a+=s){const r=i,o=r+t,s=o+t,l=s+t,u=e[r],p=e[r+1],d=e[o],_=e[o+1],h=e[s],f=e[s+1],m=e[l],g=e[l+1],b=c[a],w=n*c[a+1],x=d*b-_*w,y=d*w+_*b,T=c[2*a],v=n*c[2*a+1],k=h*T-f*v,M=h*v+f*T,S=c[3*a],P=n*c[3*a+1],A=m*S-g*P,F=m*P+g*S,C=u+k,E=p+M,O=u-k,I=p-M,D=x+A,L=y+F,N=n*(x-A),$=n*(y-F);e[r]=C+D,e[r+1]=E+L,e[o]=O+$,e[o+1]=I-N,e[s]=C-D,e[s+1]=E-L,e[l]=O-$,e[l+1]=I+N}}}}_singleTransform2(e,t,n,r,o){const i=e[r],s=e[r+1],a=e[r+o],l=e[r+o+1];t[n]=i+a,t[n+1]=s+l,t[n+2]=i-a,t[n+3]=s-l}_singleTransform4(e,t,n,r,o,i){const s=2*o,a=3*o,l=e[r],c=e[r+1],u=e[r+o],p=e[r+o+1],d=e[r+s],_=e[r+s+1],h=e[r+a],f=e[r+a+1],m=l+d,g=c+_,b=l-d,w=c-_,x=u+h,y=p+f,T=i*(u-h),v=i*(p-f);t[n]=m+x,t[n+1]=g+y,t[n+2]=b+v,t[n+3]=w-T,t[n+4]=m-x,t[n+5]=g-y,t[n+6]=b-v,t[n+7]=w+T}_realTransform4(e,t,n){const r=this._csize;let o,i,s=1<<this._width,a=r/s<<1;const l=this._bitrev;if(4===a)for(o=0,i=0;o<r;o+=a,++i){const n=l[i];this._singleRealTransform2(t,e,o,n>>>1,s>>>1)}else for(o=0,i=0;o<r;o+=a,++i){const r=l[i];this._singleRealTransform4(t,e,o,r>>>1,s>>>1,n)}const c=this.table;for(s>>=2;s>=2;s>>=2){a=r/s<<1;const t=a>>>1,i=t>>>1,l=i>>>1;for(o=0;o<r;o+=a)for(let r=0,a=0;r<=l;r+=2,a+=s){const s=o+r,u=s+i,p=u+i,d=p+i,_=e[s],h=e[s+1],f=e[u],m=e[u+1],g=e[p],b=e[p+1],w=e[d],x=e[d+1],y=_,T=h,v=c[a],k=n*c[a+1],M=f*v-m*k,S=f*k+m*v,P=c[2*a],A=n*c[2*a+1],F=g*P-b*A,C=g*A+b*P,E=c[3*a],O=n*c[3*a+1],I=w*E-x*O,D=w*O+x*E,L=y+F,N=T+C,$=y-F,B=T-C,z=M+I,R=S+D,j=n*(M-I),V=n*(S-D);if(e[s]=L+z,e[s+1]=N+R,e[u]=$+V,e[u+1]=B-j,0===r){e[p]=L-z,e[p+1]=N-R;continue}if(r===l)continue;const U=o+i-r,G=o+t-r;e[U]=$-n*V,e[U+1]=-B-n*j,e[G]=L-n*z,e[G+1]=n*R-N}}const u=r>>>1;for(let t=2;t<u;t+=2)e[r-t]=e[t],e[r-t+1]=-e[t+1]}_singleRealTransform2(e,t,n,r,o){const i=e[r],s=e[r+o];t[n]=i+s,t[n+1]=0,t[n+2]=i-s,t[n+3]=0}_singleRealTransform4(e,t,n,r,o,i){const s=2*o,a=3*o,l=e[r],c=e[r+o],u=e[r+s],p=e[r+a],d=l+u,_=l-u,h=c+p,f=i*(c-p);t[n]=d+h,t[n+1]=0,t[n+2]=_,t[n+3]=-f,t[n+4]=d-h,t[n+5]=0,t[n+6]=_,t[n+7]=f}}class f{constructor(e){const t=2*(e-1),n=2*(2*e-1),r=2**Math.ceil(Math.log2(n));this.bufferSize=r,this._a=t;const o=new Float64Array(n),i=new Float64Array(r);this._chirpBuffer=new Float64Array(r),this._buffer1=new Float64Array(r),this._buffer2=new Float64Array(r),this._outBuffer1=new Float64Array(r),this._outBuffer2=new Float64Array(r);const s=-2*Math.PI/e,a=Math.cos(s),l=Math.sin(s);for(let t=0;t<n>>1;++t){const n=(t+1-e)**2/2,r=Math.sqrt(a**2+l**2)**n,s=n*Math.atan2(l,a),c=2*t;o[c]=r*Math.cos(s),o[c+1]=r*Math.sin(s),i[c]=o[c],i[c+1]=-o[c+1]}this._slicedChirpBuffer=o.subarray(t,n),this._f=new h(r>>1),this._f.transform(this._chirpBuffer,i)}_transform(e,t,n){const r=this._buffer1,o=this._buffer2,i=this._outBuffer1,s=this._outBuffer2,a=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(n)for(let e=0;e<l.length;e+=2){const n=e+1,o=t[e>>1];r[e]=o*l[e],r[n]=o*l[n]}else for(let e=0;e<l.length;e+=2){const n=e+1;r[e]=t[e]*l[e]-t[n]*l[n],r[n]=t[e]*l[n]+t[n]*l[e]}this._f.transform(i,r);for(let e=0;e<a.length;e+=2){const t=e+1;o[e]=i[e]*a[e]-i[t]*a[t],o[t]=i[e]*a[t]+i[t]*a[e]}this._f.inverseTransform(s,o);for(let t=0;t<s.length;t+=2){const n=s[t+c],r=s[t+c+1],o=l[t],i=l[t+1];e[t]=n*o-r*i,e[t+1]=n*i+r*o}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class m{constructor(e){this.fft_length=e,this.isPowerOfTwo=_(e),this.isPowerOfTwo?(this.fft=new h(e),this.outputBufferSize=2*e):(this.fft=new f(e),this.outputBufferSize=this.fft.bufferSize)}realTransform(e,t){this.fft.realTransform(e,t)}transform(e,t){this.fft.transform(e,t)}}function g(e,t){if(t%2==0||t<=0)throw new Error("Window size must be a positive odd number");const n=new e.constructor(e.length),r=new e.constructor(t),o=Math.floor(t/2);for(let t=0;t<e.length;++t){let i=0;for(let n=-o;n<=o;++n){let o=t+n;o<0?o=Math.abs(o):o>=e.length&&(o=2*(e.length-1)-o),r[i++]=e[o]}r.sort(),n[t]=r[o]}return n}function b(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}function w(e){const t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}},"./src/utils/tensor.js":
+/*!*****************************!*\
+  !*** ./src/utils/tensor.js ***!
+  \*****************************/(e,t,n)=>{n.r(t),n.d(t,{Tensor:()=>a,cat:()=>f,dynamicTimeWarping:()=>w,interpolate:()=>c,layer_norm:()=>p,mean:()=>b,mean_pooling:()=>u,ones:()=>x,ones_like:()=>y,permute:()=>l,quantize_embeddings:()=>T,stack:()=>m,std_mean:()=>g});var r=n(/*! ../backends/onnx.js */"./src/backends/onnx.js"),o=n(/*! ./maths.js */"./src/utils/maths.js");const i=Object.freeze({float32:Float32Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array}),s=r.ONNX.Tensor;class a{dims;type;data;size;constructor(...e){return e[0]instanceof s?Object.assign(this,e[0]):Object.assign(this,new s(e[0],e[1],e[2])),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let n=Number(t);if(Number.isInteger(n))return e._getitem(n)}return e[t]},set:(e,t,n)=>e[t]=n})}*[Symbol.iterator](){const[e,...t]=this.dims;if(t.length>0){const n=t.reduce(((e,t)=>e*t));for(let r=0;r<e;++r)yield this._subarray(r,n,t)}else yield*this.data}_getitem(e){const[t,...n]=this.dims;if(e=h(e,t),n.length>0){const t=n.reduce(((e,t)=>e*t));return this._subarray(e,t,n)}return new a(this.type,[this.data[e]],n)}indexOf(e){for(let t=0;t<this.data.length;++t)if(this.data[t]==e)return t;return-1}_subarray(e,t,n){const r=e*t,o=(e+1)*t,i="subarray"in this.data?this.data.subarray(r,o):this.data.slice(r,o);return new a(this.type,i,n)}item(){if(1!==this.data.length)throw new Error(`a Tensor with ${this.data.length} elements cannot be converted to Scalar`);return this.data[0]}tolist(){return function(e,t){const n=e.length,r=t.reduce(((e,t)=>e*t));if(n!==r)throw Error(`cannot reshape array of size ${n} into shape (${t})`);let o=e;for(let e=t.length-1;e>=0;e--)o=o.reduce(((n,r)=>{let o=n[n.length-1];return o.length<t[e]?o.push(r):n.push([r]),n}),[[]]);return o[0]}(this.data,this.dims)}sigmoid(){return this.clone().sigmoid_()}sigmoid_(){for(let e=0;e<this.data.length;++e)this.data[e]=1/(1+Math.exp(-this.data[e]));return this}mul(e){return this.clone().mul_(e)}mul_(e){for(let t=0;t<this.data.length;++t)this.data[t]*=e;return this}add(e){return this.clone().add_(e)}add_(e){for(let t=0;t<this.data.length;++t)this.data[t]+=e;return this}clone(){return new a(this.type,this.data.slice(),this.dims.slice())}slice(...e){let t=[],n=[];for(let r=0;r<this.dims.length;++r){let o=e[r];if(null==o)n.push([0,this.dims[r]]),t.push(this.dims[r]);else if("number"==typeof o)o=h(o,this.dims[r],r),n.push([o,o+1]);else{if(!Array.isArray(o)||2!==o.length)throw new Error(`Invalid slice: ${o}`);{if(o[0]>o[1])throw new Error(`Invalid slice: ${o}`);let e=[Math.max(o[0],0),Math.min(o[1],this.dims[r])];n.push(e),t.push(e[1]-e[0])}}}let r=n.map((([e,t])=>t-e)),o=r.reduce(((e,t)=>e*t)),i=new this.data.constructor(o);const s=this.stride();for(let e=0;e<o;++e){let t=0;for(let o=r.length-1,i=e;o>=0;--o){const e=r[o];t+=(i%e+n[o][0])*s[o],i=Math.floor(i/e)}i[e]=this.data[t]}return new a(this.type,i,t)}permute(...e){return l(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,n=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);if(null===t){let t=this.data.reduce(((t,n)=>t+n**e),0)**(1/e);return new a(this.type,[t],[])}t=h(t,this.dims.length);const r=this.dims.slice();r[t]=1;const o=new this.data.constructor(this.data.length/this.dims[t]);for(let n=0;n<this.data.length;++n){let i=0;for(let e=this.dims.length-1,o=n,s=1;e>=0;--e){const n=this.dims[e];if(e!==t){i+=o%n*s,s*=r[e]}o=Math.floor(o/n)}o[i]+=this.data[n]**e}if(1!==e)for(let t=0;t<o.length;++t)o[t]=o[t]**(1/e);return n||r.splice(t,1),new a(this.type,o,r)}normalize_(e=2,t=1){t=h(t,this.dims.length);const n=this.norm(e,t,!0);for(let e=0;e<this.data.length;++e){let r=0;for(let n=this.dims.length-1,o=e,i=1;n>=0;--n){const e=this.dims[n];if(n!==t){r+=o%e*i,i*=this.dims[n]}o=Math.floor(o/e)}this.data[e]/=n.data[r]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){const t=new Array(e.length);for(let n=e.length-1,r=1;n>=0;--n)t[n]=r,r*=e[n];return t}(this.dims)}squeeze(e=null){return new a(this.type,this.data,d(this.dims,e))}squeeze_(e=null){return this.dims=d(this.dims,e),this}unsqueeze(e=null){return new a(this.type,this.data,_(this.dims,e))}unsqueeze_(e=null){return this.dims=_(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let n=this.dims.slice(0,e),r=this.dims.slice(e,t+1),o=this.dims.slice(t+1);return this.dims=[...n,r.reduce(((e,t)=>e*t),1),...o],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let n=0;n<e.length;++n)if(-1===e[n]){if(-1!==t)throw new Error("Only one dimension can be inferred");t=n}if(-1!==t){const n=e.reduce(((e,n,r)=>r!==t?e*n:e),1);e[t]=this.data.length/n}return new a(this.type,this.data,e)}neg_(){for(let e=0;e<this.data.length;++e)this.data[e]=-this.data[e];return this}neg(){return this.clone().neg_()}clamp_(e,t){for(let n=0;n<this.data.length;++n)this.data[n]=Math.min(Math.max(this.data[n],e),t);return this}clamp(e,t){return this.clone().clamp_(e,t)}round_(){for(let e=0;e<this.data.length;++e)this.data[e]=Math.round(this.data[e]);return this}round(){return this.clone().round_()}to(e){if(this.type===e)return this;if(!i.hasOwnProperty(e))throw new Error(`Unsupported type: ${e}`);return new a(e,i[e].from(this.data),this.dims)}}function l(e,t){const[n,r]=(0,o.permute_data)(e.data,e.dims,t);return new a(e.type,n,r)}function c(e,[t,n],r="bilinear",i=!1){const s=e.dims.at(-3)??1,l=e.dims.at(-2),c=e.dims.at(-1);let u=(0,o.interpolate_data)(e.data,[s,l,c],[t,n],r,i);return new a(e.type,u,[s,t,n])}function u(e,t){let n=[e.dims[0],e.dims[2]],r=new e.data.constructor(n[0]*n[1]),[o,i,s]=e.dims,l=0;for(let n=0;n<o;++n){let o=n*s*i;for(let a=0;a<s;++a){let c=0,u=0,p=n*i,d=o+a;for(let n=0;n<i;++n){let r=Number(t.data[p+n]);u+=r,c+=e.data[d+n*s]*r}let _=c/u;r[l++]=_}}return new a(e.type,r,n)}function p(e,t,{eps:n=1e-5}={}){if(2!==e.dims.length)throw new Error("`layer_norm` currently only supports 2D input.");const[r,o]=e.dims;if(1!==t.length&&t[0]!==o)throw new Error("`normalized_shape` must be a 1D array with shape `[input.dims[1]]`.");const[i,s]=g(e,1,0,!0),l=new e.data.constructor(e.data.length);for(let t=0;t<r;++t){const r=t*o;for(let a=0;a<o;++a){const o=r+a;l[o]=(e.data[o]-s.data[t])/(i.data[t]+n)}}return new a(e.type,l,e.dims)}function d(e,t){return e=e.slice(),null===t?e=e.filter((e=>1!==e)):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter(((e,n)=>1!==e||!t.includes(n)))),e}function _(e,t){return t=h(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function h(e,t,n=null){if(e<-t||e>=t)throw new Error(`IndexError: index ${e} is out of bounds for dimension${null===n?"":" "+n} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function f(e,t=0){t=h(t,e[0].dims.length);const n=e[0].dims.slice();n[t]=e.reduce(((e,n)=>e+n.dims[t]),0);const r=n.reduce(((e,t)=>e*t),1),o=new e[0].data.constructor(r),i=e[0].type;if(0===t){let t=0;for(let n of e)o.set(n.data,t),t+=n.data.length}else{let r=0;for(let i=0;i<e.length;++i){let s=e[i];for(let e=0;e<s.data.length;++e){let i=0;for(let o=s.dims.length-1,a=e,l=1;o>=0;--o){const e=s.dims[o];let c=a%e;o===t&&(c+=r),i+=c*l,l*=n[o],a=Math.floor(a/e)}o[i]=s.data[e]}r+=s.dims[t]}}return new a(i,o,n)}function m(e,t=0){return f(e.map((e=>e.unsqueeze(t))),t)}function g(e,t=null,n=1,r=!1){if(null===t){const t=e.data.reduce(((e,t)=>e+t),0)/e.data.length,r=Math.sqrt(e.data.reduce(((e,n)=>e+(n-t)**2),0)/(e.data.length-n)),o=new a(e.type,[t],[]);return[new a(e.type,[r],[]),o]}const o=b(e,t=h(t,e.dims.length),r),i=e.dims.slice();i[t]=1;const s=new e.data.constructor(e.data.length/e.dims[t]);for(let n=0;n<e.data.length;++n){let r=0;for(let o=e.dims.length-1,s=n,a=1;o>=0;--o){const n=e.dims[o];if(o!==t){r+=s%n*a,a*=i[o]}s=Math.floor(s/n)}s[r]+=(e.data[n]-o.data[r])**2}for(let r=0;r<s.length;++r)s[r]=Math.sqrt(s[r]/(e.dims[t]-n));r||i.splice(t,1);return[new a(e.type,s,i),o]}function b(e,t=null,n=!1){if(null===t){let t=e.data.reduce(((e,t)=>e+t),0);return new a(e.type,[t/e.data.length],[])}t=h(t,e.dims.length);const r=e.dims.slice();r[t]=1;const o=new e.data.constructor(e.data.length/e.dims[t]);for(let n=0;n<e.data.length;++n){let i=0;for(let o=e.dims.length-1,s=n,a=1;o>=0;--o){const n=e.dims[o];if(o!==t){i+=s%n*a,a*=r[o]}s=Math.floor(s/n)}o[i]+=e.data[n]}if(1!==e.dims[t])for(let n=0;n<o.length;++n)o[n]=o[n]/e.dims[t];return n||r.splice(t,1),new a(e.type,o,r)}function w(e){const[t,n]=e.dims,r=[t+1,n+1],o=new a("float32",new Float32Array(r[0]*r[1]).fill(1/0),r),i=new a("float32",new Float32Array(r[0]*r[1]).fill(-1),r);o[0].data[0]=0;for(let r=1;r<n+1;++r)for(let n=1;n<t+1;++n){const t=o[n-1][r-1].item(),s=o[n-1][r].item(),a=o[n][r-1].item();let l,c;t<s&&t<a?(l=t,c=0):s<t&&s<a?(l=s,c=1):(l=a,c=2),o[n].data[r]=e[n-1][r-1].item()+l,i[n].data[r]=c}let s=t,l=n;i.data.fill(2,0,r[1]);for(let e=0;e<r[0];++e)i[e].data[0]=1;let c=[],u=[];for(;s>0||l>0;){c.push(s-1),u.push(l-1);switch(i[s][l].item()){case 0:--s,--l;break;case 1:--s;break;case 2:--l;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${s}, ${l}]. Please file a bug report.`)}}return c.reverse(),u.reverse(),[c,u]}function x(e){const t=e.reduce(((e,t)=>e*t),1);return new a("int64",new BigInt64Array(t).fill(1n),e)}function y(e){return x(e.dims)}function T(e,t){if(2!==e.dims.length)throw new Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw new Error("The precision must be either 'binary' or 'ubinary'");const n="binary"===t,r=n?"int8":"uint8",o=n?Int8Array:Uint8Array,i=e.data,s=new o(i.length/8);for(let e=0;e<i.length;++e){const t=i[e]>0?1:0,r=Math.floor(e/8),o=e%8;s[r]|=t<<7-o,n&&0===o&&(s[r]-=128)}return new a(r,s,[e.dims[0],e.dims[1]/8])}}},__webpack_module_cache__={},leafPrototypes,getProto;function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}getProto=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,__webpack_require__.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var n=Object.create(null);__webpack_require__.r(n);var r={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var o=2&t&&e;"object"==typeof o&&!~leafPrototypes.indexOf(o);o=getProto(o))Object.getOwnPropertyNames(o).forEach((t=>r[t]=()=>e[t]));return r.default=()=>e,__webpack_require__.d(n,r),n},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__("./src/transformers.js"),__webpack_exports__ASTFeatureExtractor=__webpack_exports__.ASTFeatureExtractor,__webpack_exports__ASTForAudioClassification=__webpack_exports__.ASTForAudioClassification,__webpack_exports__ASTModel=__webpack_exports__.ASTModel,__webpack_exports__ASTPreTrainedModel=__webpack_exports__.ASTPreTrainedModel,__webpack_exports__AlbertForMaskedLM=__webpack_exports__.AlbertForMaskedLM,__webpack_exports__AlbertForQuestionAnswering=__webpack_exports__.AlbertForQuestionAnswering,__webpack_exports__AlbertForSequenceClassification=__webpack_exports__.AlbertForSequenceClassification,__webpack_exports__AlbertModel=__webpack_exports__.AlbertModel,__webpack_exports__AlbertPreTrainedModel=__webpack_exports__.AlbertPreTrainedModel,__webpack_exports__AlbertTokenizer=__webpack_exports__.AlbertTokenizer,__webpack_exports__AudioClassificationPipeline=__webpack_exports__.AudioClassificationPipeline,__webpack_exports__AutoConfig=__webpack_exports__.AutoConfig,__webpack_exports__AutoModel=__webpack_exports__.AutoModel,__webpack_exports__AutoModelForAudioClassification=__webpack_exports__.AutoModelForAudioClassification,__webpack_exports__AutoModelForAudioFrameClassification=__webpack_exports__.AutoModelForAudioFrameClassification,__webpack_exports__AutoModelForCTC=__webpack_exports__.AutoModelForCTC,__webpack_exports__AutoModelForCausalLM=__webpack_exports__.AutoModelForCausalLM,__webpack_exports__AutoModelForDepthEstimation=__webpack_exports__.AutoModelForDepthEstimation,__webpack_exports__AutoModelForDocumentQuestionAnswering=__webpack_exports__.AutoModelForDocumentQuestionAnswering,__webpack_exports__AutoModelForImageClassification=__webpack_exports__.AutoModelForImageClassification,__webpack_exports__AutoModelForImageFeatureExtraction=__webpack_exports__.AutoModelForImageFeatureExtraction,__webpack_exports__AutoModelForImageMatting=__webpack_exports__.AutoModelForImageMatting,__webpack_exports__AutoModelForImageSegmentation=__webpack_exports__.AutoModelForImageSegmentation,__webpack_exports__AutoModelForImageToImage=__webpack_exports__.AutoModelForImageToImage,__webpack_exports__AutoModelForMaskGeneration=__webpack_exports__.AutoModelForMaskGeneration,__webpack_exports__AutoModelForMaskedLM=__webpack_exports__.AutoModelForMaskedLM,__webpack_exports__AutoModelForObjectDetection=__webpack_exports__.AutoModelForObjectDetection,__webpack_exports__AutoModelForQuestionAnswering=__webpack_exports__.AutoModelForQuestionAnswering,__webpack_exports__AutoModelForSemanticSegmentation=__webpack_exports__.AutoModelForSemanticSegmentation,__webpack_exports__AutoModelForSeq2SeqLM=__webpack_exports__.AutoModelForSeq2SeqLM,__webpack_exports__AutoModelForSequenceClassification=__webpack_exports__.AutoModelForSequenceClassification,__webpack_exports__AutoModelForSpeechSeq2Seq=__webpack_exports__.AutoModelForSpeechSeq2Seq,__webpack_exports__AutoModelForTextToSpectrogram=__webpack_exports__.AutoModelForTextToSpectrogram,__webpack_exports__AutoModelForTextToWaveform=__webpack_exports__.AutoModelForTextToWaveform,__webpack_exports__AutoModelForTokenClassification=__webpack_exports__.AutoModelForTokenClassification,__webpack_exports__AutoModelForVision2Seq=__webpack_exports__.AutoModelForVision2Seq,__webpack_exports__AutoModelForXVector=__webpack_exports__.AutoModelForXVector,__webpack_exports__AutoModelForZeroShotObjectDetection=__webpack_exports__.AutoModelForZeroShotObjectDetection,__webpack_exports__AutoProcessor=__webpack_exports__.AutoProcessor,__webpack_exports__AutoTokenizer=__webpack_exports__.AutoTokenizer,__webpack_exports__AutomaticSpeechRecognitionPipeline=__webpack_exports__.AutomaticSpeechRecognitionPipeline,__webpack_exports__BartForConditionalGeneration=__webpack_exports__.BartForConditionalGeneration,__webpack_exports__BartForSequenceClassification=__webpack_exports__.BartForSequenceClassification,__webpack_exports__BartModel=__webpack_exports__.BartModel,__webpack_exports__BartPretrainedModel=__webpack_exports__.BartPretrainedModel,__webpack_exports__BartTokenizer=__webpack_exports__.BartTokenizer,__webpack_exports__BaseModelOutput=__webpack_exports__.BaseModelOutput,__webpack_exports__BeitFeatureExtractor=__webpack_exports__.BeitFeatureExtractor,__webpack_exports__BeitForImageClassification=__webpack_exports__.BeitForImageClassification,__webpack_exports__BeitModel=__webpack_exports__.BeitModel,__webpack_exports__BeitPreTrainedModel=__webpack_exports__.BeitPreTrainedModel,__webpack_exports__BertForMaskedLM=__webpack_exports__.BertForMaskedLM,__webpack_exports__BertForQuestionAnswering=__webpack_exports__.BertForQuestionAnswering,__webpack_exports__BertForSequenceClassification=__webpack_exports__.BertForSequenceClassification,__webpack_exports__BertForTokenClassification=__webpack_exports__.BertForTokenClassification,__webpack_exports__BertModel=__webpack_exports__.BertModel,__webpack_exports__BertPreTrainedModel=__webpack_exports__.BertPreTrainedModel,__webpack_exports__BertTokenizer=__webpack_exports__.BertTokenizer,__webpack_exports__BitImageProcessor=__webpack_exports__.BitImageProcessor,__webpack_exports__BlenderbotForConditionalGeneration=__webpack_exports__.BlenderbotForConditionalGeneration,__webpack_exports__BlenderbotModel=__webpack_exports__.BlenderbotModel,__webpack_exports__BlenderbotPreTrainedModel=__webpack_exports__.BlenderbotPreTrainedModel,__webpack_exports__BlenderbotSmallForConditionalGeneration=__webpack_exports__.BlenderbotSmallForConditionalGeneration,__webpack_exports__BlenderbotSmallModel=__webpack_exports__.BlenderbotSmallModel,__webpack_exports__BlenderbotSmallPreTrainedModel=__webpack_exports__.BlenderbotSmallPreTrainedModel,__webpack_exports__BlenderbotSmallTokenizer=__webpack_exports__.BlenderbotSmallTokenizer,__webpack_exports__BlenderbotTokenizer=__webpack_exports__.BlenderbotTokenizer,__webpack_exports__BloomForCausalLM=__webpack_exports__.BloomForCausalLM,__webpack_exports__BloomModel=__webpack_exports__.BloomModel,__webpack_exports__BloomPreTrainedModel=__webpack_exports__.BloomPreTrainedModel,__webpack_exports__BloomTokenizer=__webpack_exports__.BloomTokenizer,__webpack_exports__CLIPFeatureExtractor=__webpack_exports__.CLIPFeatureExtractor,__webpack_exports__CLIPModel=__webpack_exports__.CLIPModel,__webpack_exports__CLIPPreTrainedModel=__webpack_exports__.CLIPPreTrainedModel,__webpack_exports__CLIPSegForImageSegmentation=__webpack_exports__.CLIPSegForImageSegmentation,__webpack_exports__CLIPSegModel=__webpack_exports__.CLIPSegModel,__webpack_exports__CLIPSegPreTrainedModel=__webpack_exports__.CLIPSegPreTrainedModel,__webpack_exports__CLIPTextModelWithProjection=__webpack_exports__.CLIPTextModelWithProjection,__webpack_exports__CLIPTokenizer=__webpack_exports__.CLIPTokenizer,__webpack_exports__CLIPVisionModelWithProjection=__webpack_exports__.CLIPVisionModelWithProjection,__webpack_exports__CamembertForMaskedLM=__webpack_exports__.CamembertForMaskedLM,__webpack_exports__CamembertForQuestionAnswering=__webpack_exports__.CamembertForQuestionAnswering,__webpack_exports__CamembertForSequenceClassification=__webpack_exports__.CamembertForSequenceClassification,__webpack_exports__CamembertForTokenClassification=__webpack_exports__.CamembertForTokenClassification,__webpack_exports__CamembertModel=__webpack_exports__.CamembertModel,__webpack_exports__CamembertPreTrainedModel=__webpack_exports__.CamembertPreTrainedModel,__webpack_exports__CamembertTokenizer=__webpack_exports__.CamembertTokenizer,__webpack_exports__CausalLMOutput=__webpack_exports__.CausalLMOutput,__webpack_exports__CausalLMOutputWithPast=__webpack_exports__.CausalLMOutputWithPast,__webpack_exports__ChineseCLIPFeatureExtractor=__webpack_exports__.ChineseCLIPFeatureExtractor,__webpack_exports__ChineseCLIPModel=__webpack_exports__.ChineseCLIPModel,__webpack_exports__ChineseCLIPPreTrainedModel=__webpack_exports__.ChineseCLIPPreTrainedModel,__webpack_exports__ClapAudioModelWithProjection=__webpack_exports__.ClapAudioModelWithProjection,__webpack_exports__ClapFeatureExtractor=__webpack_exports__.ClapFeatureExtractor,__webpack_exports__ClapModel=__webpack_exports__.ClapModel,__webpack_exports__ClapPreTrainedModel=__webpack_exports__.ClapPreTrainedModel,__webpack_exports__ClapTextModelWithProjection=__webpack_exports__.ClapTextModelWithProjection,__webpack_exports__CodeGenForCausalLM=__webpack_exports__.CodeGenForCausalLM,__webpack_exports__CodeGenModel=__webpack_exports__.CodeGenModel,__webpack_exports__CodeGenPreTrainedModel=__webpack_exports__.CodeGenPreTrainedModel,__webpack_exports__CodeGenTokenizer=__webpack_exports__.CodeGenTokenizer,__webpack_exports__CodeLlamaTokenizer=__webpack_exports__.CodeLlamaTokenizer,__webpack_exports__CohereTokenizer=__webpack_exports__.CohereTokenizer,__webpack_exports__ConvBertForMaskedLM=__webpack_exports__.ConvBertForMaskedLM,__webpack_exports__ConvBertForQuestionAnswering=__webpack_exports__.ConvBertForQuestionAnswering,__webpack_exports__ConvBertForSequenceClassification=__webpack_exports__.ConvBertForSequenceClassification,__webpack_exports__ConvBertForTokenClassification=__webpack_exports__.ConvBertForTokenClassification,__webpack_exports__ConvBertModel=__webpack_exports__.ConvBertModel,__webpack_exports__ConvBertPreTrainedModel=__webpack_exports__.ConvBertPreTrainedModel,__webpack_exports__ConvBertTokenizer=__webpack_exports__.ConvBertTokenizer,__webpack_exports__ConvNextFeatureExtractor=__webpack_exports__.ConvNextFeatureExtractor,__webpack_exports__ConvNextForImageClassification=__webpack_exports__.ConvNextForImageClassification,__webpack_exports__ConvNextImageProcessor=__webpack_exports__.ConvNextImageProcessor,__webpack_exports__ConvNextModel=__webpack_exports__.ConvNextModel,__webpack_exports__ConvNextPreTrainedModel=__webpack_exports__.ConvNextPreTrainedModel,__webpack_exports__ConvNextV2ForImageClassification=__webpack_exports__.ConvNextV2ForImageClassification,__webpack_exports__ConvNextV2Model=__webpack_exports__.ConvNextV2Model,__webpack_exports__ConvNextV2PreTrainedModel=__webpack_exports__.ConvNextV2PreTrainedModel,__webpack_exports__DPTFeatureExtractor=__webpack_exports__.DPTFeatureExtractor,__webpack_exports__DPTForDepthEstimation=__webpack_exports__.DPTForDepthEstimation,__webpack_exports__DPTImageProcessor=__webpack_exports__.DPTImageProcessor,__webpack_exports__DPTModel=__webpack_exports__.DPTModel,__webpack_exports__DPTPreTrainedModel=__webpack_exports__.DPTPreTrainedModel,__webpack_exports__DebertaForMaskedLM=__webpack_exports__.DebertaForMaskedLM,__webpack_exports__DebertaForQuestionAnswering=__webpack_exports__.DebertaForQuestionAnswering,__webpack_exports__DebertaForSequenceClassification=__webpack_exports__.DebertaForSequenceClassification,__webpack_exports__DebertaForTokenClassification=__webpack_exports__.DebertaForTokenClassification,__webpack_exports__DebertaModel=__webpack_exports__.DebertaModel,__webpack_exports__DebertaPreTrainedModel=__webpack_exports__.DebertaPreTrainedModel,__webpack_exports__DebertaTokenizer=__webpack_exports__.DebertaTokenizer,__webpack_exports__DebertaV2ForMaskedLM=__webpack_exports__.DebertaV2ForMaskedLM,__webpack_exports__DebertaV2ForQuestionAnswering=__webpack_exports__.DebertaV2ForQuestionAnswering,__webpack_exports__DebertaV2ForSequenceClassification=__webpack_exports__.DebertaV2ForSequenceClassification,__webpack_exports__DebertaV2ForTokenClassification=__webpack_exports__.DebertaV2ForTokenClassification,__webpack_exports__DebertaV2Model=__webpack_exports__.DebertaV2Model,__webpack_exports__DebertaV2PreTrainedModel=__webpack_exports__.DebertaV2PreTrainedModel,__webpack_exports__DebertaV2Tokenizer=__webpack_exports__.DebertaV2Tokenizer,__webpack_exports__DeiTFeatureExtractor=__webpack_exports__.DeiTFeatureExtractor,__webpack_exports__DeiTForImageClassification=__webpack_exports__.DeiTForImageClassification,__webpack_exports__DeiTModel=__webpack_exports__.DeiTModel,__webpack_exports__DeiTPreTrainedModel=__webpack_exports__.DeiTPreTrainedModel,__webpack_exports__DepthAnythingForDepthEstimation=__webpack_exports__.DepthAnythingForDepthEstimation,__webpack_exports__DepthAnythingPreTrainedModel=__webpack_exports__.DepthAnythingPreTrainedModel,__webpack_exports__DepthEstimationPipeline=__webpack_exports__.DepthEstimationPipeline,__webpack_exports__DetrFeatureExtractor=__webpack_exports__.DetrFeatureExtractor,__webpack_exports__DetrForObjectDetection=__webpack_exports__.DetrForObjectDetection,__webpack_exports__DetrForSegmentation=__webpack_exports__.DetrForSegmentation,__webpack_exports__DetrModel=__webpack_exports__.DetrModel,__webpack_exports__DetrObjectDetectionOutput=__webpack_exports__.DetrObjectDetectionOutput,__webpack_exports__DetrPreTrainedModel=__webpack_exports__.DetrPreTrainedModel,__webpack_exports__DetrSegmentationOutput=__webpack_exports__.DetrSegmentationOutput,__webpack_exports__Dinov2ForImageClassification=__webpack_exports__.Dinov2ForImageClassification,__webpack_exports__Dinov2Model=__webpack_exports__.Dinov2Model,__webpack_exports__Dinov2PreTrainedModel=__webpack_exports__.Dinov2PreTrainedModel,__webpack_exports__DistilBertForMaskedLM=__webpack_exports__.DistilBertForMaskedLM,__webpack_exports__DistilBertForQuestionAnswering=__webpack_exports__.DistilBertForQuestionAnswering,__webpack_exports__DistilBertForSequenceClassification=__webpack_exports__.DistilBertForSequenceClassification,__webpack_exports__DistilBertForTokenClassification=__webpack_exports__.DistilBertForTokenClassification,__webpack_exports__DistilBertModel=__webpack_exports__.DistilBertModel,__webpack_exports__DistilBertPreTrainedModel=__webpack_exports__.DistilBertPreTrainedModel,__webpack_exports__DistilBertTokenizer=__webpack_exports__.DistilBertTokenizer,__webpack_exports__DocumentQuestionAnsweringPipeline=__webpack_exports__.DocumentQuestionAnsweringPipeline,__webpack_exports__DonutFeatureExtractor=__webpack_exports__.DonutFeatureExtractor,__webpack_exports__DonutSwinModel=__webpack_exports__.DonutSwinModel,__webpack_exports__DonutSwinPreTrainedModel=__webpack_exports__.DonutSwinPreTrainedModel,__webpack_exports__EfficientNetForImageClassification=__webpack_exports__.EfficientNetForImageClassification,__webpack_exports__EfficientNetImageProcessor=__webpack_exports__.EfficientNetImageProcessor,__webpack_exports__EfficientNetModel=__webpack_exports__.EfficientNetModel,__webpack_exports__EfficientNetPreTrainedModel=__webpack_exports__.EfficientNetPreTrainedModel,__webpack_exports__ElectraForMaskedLM=__webpack_exports__.ElectraForMaskedLM,__webpack_exports__ElectraForQuestionAnswering=__webpack_exports__.ElectraForQuestionAnswering,__webpack_exports__ElectraForSequenceClassification=__webpack_exports__.ElectraForSequenceClassification,__webpack_exports__ElectraForTokenClassification=__webpack_exports__.ElectraForTokenClassification,__webpack_exports__ElectraModel=__webpack_exports__.ElectraModel,__webpack_exports__ElectraPreTrainedModel=__webpack_exports__.ElectraPreTrainedModel,__webpack_exports__ElectraTokenizer=__webpack_exports__.ElectraTokenizer,__webpack_exports__EsmForMaskedLM=__webpack_exports__.EsmForMaskedLM,__webpack_exports__EsmForSequenceClassification=__webpack_exports__.EsmForSequenceClassification,__webpack_exports__EsmForTokenClassification=__webpack_exports__.EsmForTokenClassification,__webpack_exports__EsmModel=__webpack_exports__.EsmModel,__webpack_exports__EsmPreTrainedModel=__webpack_exports__.EsmPreTrainedModel,__webpack_exports__EsmTokenizer=__webpack_exports__.EsmTokenizer,__webpack_exports__FFT=__webpack_exports__.FFT,__webpack_exports__FalconForCausalLM=__webpack_exports__.FalconForCausalLM,__webpack_exports__FalconModel=__webpack_exports__.FalconModel,__webpack_exports__FalconPreTrainedModel=__webpack_exports__.FalconPreTrainedModel,__webpack_exports__FalconTokenizer=__webpack_exports__.FalconTokenizer,__webpack_exports__FastViTForImageClassification=__webpack_exports__.FastViTForImageClassification,__webpack_exports__FastViTModel=__webpack_exports__.FastViTModel,__webpack_exports__FastViTPreTrainedModel=__webpack_exports__.FastViTPreTrainedModel,__webpack_exports__FeatureExtractionPipeline=__webpack_exports__.FeatureExtractionPipeline,__webpack_exports__FeatureExtractor=__webpack_exports__.FeatureExtractor,__webpack_exports__FillMaskPipeline=__webpack_exports__.FillMaskPipeline,__webpack_exports__GLPNFeatureExtractor=__webpack_exports__.GLPNFeatureExtractor,__webpack_exports__GLPNForDepthEstimation=__webpack_exports__.GLPNForDepthEstimation,__webpack_exports__GLPNModel=__webpack_exports__.GLPNModel,__webpack_exports__GLPNPreTrainedModel=__webpack_exports__.GLPNPreTrainedModel,__webpack_exports__GPT2LMHeadModel=__webpack_exports__.GPT2LMHeadModel,__webpack_exports__GPT2Model=__webpack_exports__.GPT2Model,__webpack_exports__GPT2PreTrainedModel=__webpack_exports__.GPT2PreTrainedModel,__webpack_exports__GPT2Tokenizer=__webpack_exports__.GPT2Tokenizer,__webpack_exports__GPTBigCodeForCausalLM=__webpack_exports__.GPTBigCodeForCausalLM,__webpack_exports__GPTBigCodeModel=__webpack_exports__.GPTBigCodeModel,__webpack_exports__GPTBigCodePreTrainedModel=__webpack_exports__.GPTBigCodePreTrainedModel,__webpack_exports__GPTJForCausalLM=__webpack_exports__.GPTJForCausalLM,__webpack_exports__GPTJModel=__webpack_exports__.GPTJModel,__webpack_exports__GPTJPreTrainedModel=__webpack_exports__.GPTJPreTrainedModel,__webpack_exports__GPTNeoForCausalLM=__webpack_exports__.GPTNeoForCausalLM,__webpack_exports__GPTNeoModel=__webpack_exports__.GPTNeoModel,__webpack_exports__GPTNeoPreTrainedModel=__webpack_exports__.GPTNeoPreTrainedModel,__webpack_exports__GPTNeoXForCausalLM=__webpack_exports__.GPTNeoXForCausalLM,__webpack_exports__GPTNeoXModel=__webpack_exports__.GPTNeoXModel,__webpack_exports__GPTNeoXPreTrainedModel=__webpack_exports__.GPTNeoXPreTrainedModel,__webpack_exports__GPTNeoXTokenizer=__webpack_exports__.GPTNeoXTokenizer,__webpack_exports__GemmaTokenizer=__webpack_exports__.GemmaTokenizer,__webpack_exports__Grok1Tokenizer=__webpack_exports__.Grok1Tokenizer,__webpack_exports__HerbertTokenizer=__webpack_exports__.HerbertTokenizer,__webpack_exports__HubertForCTC=__webpack_exports__.HubertForCTC,__webpack_exports__HubertForSequenceClassification=__webpack_exports__.HubertForSequenceClassification,__webpack_exports__HubertModel=__webpack_exports__.HubertModel,__webpack_exports__HubertPreTrainedModel=__webpack_exports__.HubertPreTrainedModel,__webpack_exports__ImageClassificationPipeline=__webpack_exports__.ImageClassificationPipeline,__webpack_exports__ImageFeatureExtractionPipeline=__webpack_exports__.ImageFeatureExtractionPipeline,__webpack_exports__ImageFeatureExtractor=__webpack_exports__.ImageFeatureExtractor,__webpack_exports__ImageMattingOutput=__webpack_exports__.ImageMattingOutput,__webpack_exports__ImageSegmentationPipeline=__webpack_exports__.ImageSegmentationPipeline,__webpack_exports__ImageToImagePipeline=__webpack_exports__.ImageToImagePipeline,__webpack_exports__ImageToTextPipeline=__webpack_exports__.ImageToTextPipeline,__webpack_exports__LlamaForCausalLM=__webpack_exports__.LlamaForCausalLM,__webpack_exports__LlamaModel=__webpack_exports__.LlamaModel,__webpack_exports__LlamaPreTrainedModel=__webpack_exports__.LlamaPreTrainedModel,__webpack_exports__LlamaTokenizer=__webpack_exports__.LlamaTokenizer,__webpack_exports__LongT5ForConditionalGeneration=__webpack_exports__.LongT5ForConditionalGeneration,__webpack_exports__LongT5Model=__webpack_exports__.LongT5Model,__webpack_exports__LongT5PreTrainedModel=__webpack_exports__.LongT5PreTrainedModel,__webpack_exports__M2M100ForConditionalGeneration=__webpack_exports__.M2M100ForConditionalGeneration,__webpack_exports__M2M100Model=__webpack_exports__.M2M100Model,__webpack_exports__M2M100PreTrainedModel=__webpack_exports__.M2M100PreTrainedModel,__webpack_exports__M2M100Tokenizer=__webpack_exports__.M2M100Tokenizer,__webpack_exports__MBart50Tokenizer=__webpack_exports__.MBart50Tokenizer,__webpack_exports__MBartForCausalLM=__webpack_exports__.MBartForCausalLM,__webpack_exports__MBartForConditionalGeneration=__webpack_exports__.MBartForConditionalGeneration,__webpack_exports__MBartForSequenceClassification=__webpack_exports__.MBartForSequenceClassification,__webpack_exports__MBartModel=__webpack_exports__.MBartModel,__webpack_exports__MBartPreTrainedModel=__webpack_exports__.MBartPreTrainedModel,__webpack_exports__MBartTokenizer=__webpack_exports__.MBartTokenizer,__webpack_exports__MPNetForMaskedLM=__webpack_exports__.MPNetForMaskedLM,__webpack_exports__MPNetForQuestionAnswering=__webpack_exports__.MPNetForQuestionAnswering,__webpack_exports__MPNetForSequenceClassification=__webpack_exports__.MPNetForSequenceClassification,__webpack_exports__MPNetForTokenClassification=__webpack_exports__.MPNetForTokenClassification,__webpack_exports__MPNetModel=__webpack_exports__.MPNetModel,__webpack_exports__MPNetPreTrainedModel=__webpack_exports__.MPNetPreTrainedModel,__webpack_exports__MPNetTokenizer=__webpack_exports__.MPNetTokenizer,__webpack_exports__MT5ForConditionalGeneration=__webpack_exports__.MT5ForConditionalGeneration,__webpack_exports__MT5Model=__webpack_exports__.MT5Model,__webpack_exports__MT5PreTrainedModel=__webpack_exports__.MT5PreTrainedModel,__webpack_exports__MarianMTModel=__webpack_exports__.MarianMTModel,__webpack_exports__MarianModel=__webpack_exports__.MarianModel,__webpack_exports__MarianPreTrainedModel=__webpack_exports__.MarianPreTrainedModel,__webpack_exports__MarianTokenizer=__webpack_exports__.MarianTokenizer,__webpack_exports__MaskedLMOutput=__webpack_exports__.MaskedLMOutput,__webpack_exports__MistralForCausalLM=__webpack_exports__.MistralForCausalLM,__webpack_exports__MistralModel=__webpack_exports__.MistralModel,__webpack_exports__MistralPreTrainedModel=__webpack_exports__.MistralPreTrainedModel,__webpack_exports__MobileBertForMaskedLM=__webpack_exports__.MobileBertForMaskedLM,__webpack_exports__MobileBertForQuestionAnswering=__webpack_exports__.MobileBertForQuestionAnswering,__webpack_exports__MobileBertForSequenceClassification=__webpack_exports__.MobileBertForSequenceClassification,__webpack_exports__MobileBertModel=__webpack_exports__.MobileBertModel,__webpack_exports__MobileBertPreTrainedModel=__webpack_exports__.MobileBertPreTrainedModel,__webpack_exports__MobileBertTokenizer=__webpack_exports__.MobileBertTokenizer,__webpack_exports__MobileViTFeatureExtractor=__webpack_exports__.MobileViTFeatureExtractor,__webpack_exports__MobileViTForImageClassification=__webpack_exports__.MobileViTForImageClassification,__webpack_exports__MobileViTImageProcessor=__webpack_exports__.MobileViTImageProcessor,__webpack_exports__MobileViTModel=__webpack_exports__.MobileViTModel,__webpack_exports__MobileViTPreTrainedModel=__webpack_exports__.MobileViTPreTrainedModel,__webpack_exports__MobileViTV2ForImageClassification=__webpack_exports__.MobileViTV2ForImageClassification,__webpack_exports__MobileViTV2Model=__webpack_exports__.MobileViTV2Model,__webpack_exports__MobileViTV2PreTrainedModel=__webpack_exports__.MobileViTV2PreTrainedModel,__webpack_exports__ModelOutput=__webpack_exports__.ModelOutput,__webpack_exports__MptForCausalLM=__webpack_exports__.MptForCausalLM,__webpack_exports__MptModel=__webpack_exports__.MptModel,__webpack_exports__MptPreTrainedModel=__webpack_exports__.MptPreTrainedModel,__webpack_exports__NllbTokenizer=__webpack_exports__.NllbTokenizer,__webpack_exports__NomicBertModel=__webpack_exports__.NomicBertModel,__webpack_exports__NomicBertPreTrainedModel=__webpack_exports__.NomicBertPreTrainedModel,__webpack_exports__NougatImageProcessor=__webpack_exports__.NougatImageProcessor,__webpack_exports__NougatTokenizer=__webpack_exports__.NougatTokenizer,__webpack_exports__OPTForCausalLM=__webpack_exports__.OPTForCausalLM,__webpack_exports__OPTModel=__webpack_exports__.OPTModel,__webpack_exports__OPTPreTrainedModel=__webpack_exports__.OPTPreTrainedModel,__webpack_exports__ObjectDetectionPipeline=__webpack_exports__.ObjectDetectionPipeline,__webpack_exports__OwlViTFeatureExtractor=__webpack_exports__.OwlViTFeatureExtractor,__webpack_exports__OwlViTForObjectDetection=__webpack_exports__.OwlViTForObjectDetection,__webpack_exports__OwlViTModel=__webpack_exports__.OwlViTModel,__webpack_exports__OwlViTPreTrainedModel=__webpack_exports__.OwlViTPreTrainedModel,__webpack_exports__OwlViTProcessor=__webpack_exports__.OwlViTProcessor,__webpack_exports__Owlv2ForObjectDetection=__webpack_exports__.Owlv2ForObjectDetection,__webpack_exports__Owlv2ImageProcessor=__webpack_exports__.Owlv2ImageProcessor,__webpack_exports__Owlv2Model=__webpack_exports__.Owlv2Model,__webpack_exports__Owlv2PreTrainedModel=__webpack_exports__.Owlv2PreTrainedModel,__webpack_exports__PhiForCausalLM=__webpack_exports__.PhiForCausalLM,__webpack_exports__PhiModel=__webpack_exports__.PhiModel,__webpack_exports__PhiPreTrainedModel=__webpack_exports__.PhiPreTrainedModel,__webpack_exports__Pipeline=__webpack_exports__.Pipeline,__webpack_exports__PreTrainedModel=__webpack_exports__.PreTrainedModel,__webpack_exports__PreTrainedTokenizer=__webpack_exports__.PreTrainedTokenizer,__webpack_exports__PretrainedConfig=__webpack_exports__.PretrainedConfig,__webpack_exports__PretrainedMixin=__webpack_exports__.PretrainedMixin,__webpack_exports__Processor=__webpack_exports__.Processor,__webpack_exports__QuestionAnsweringModelOutput=__webpack_exports__.QuestionAnsweringModelOutput,__webpack_exports__QuestionAnsweringPipeline=__webpack_exports__.QuestionAnsweringPipeline,__webpack_exports__Qwen2ForCausalLM=__webpack_exports__.Qwen2ForCausalLM,__webpack_exports__Qwen2Model=__webpack_exports__.Qwen2Model,__webpack_exports__Qwen2PreTrainedModel=__webpack_exports__.Qwen2PreTrainedModel,__webpack_exports__Qwen2Tokenizer=__webpack_exports__.Qwen2Tokenizer,__webpack_exports__RawImage=__webpack_exports__.RawImage,__webpack_exports__ResNetForImageClassification=__webpack_exports__.ResNetForImageClassification,__webpack_exports__ResNetModel=__webpack_exports__.ResNetModel,__webpack_exports__ResNetPreTrainedModel=__webpack_exports__.ResNetPreTrainedModel,__webpack_exports__RoFormerForMaskedLM=__webpack_exports__.RoFormerForMaskedLM,__webpack_exports__RoFormerForQuestionAnswering=__webpack_exports__.RoFormerForQuestionAnswering,__webpack_exports__RoFormerForSequenceClassification=__webpack_exports__.RoFormerForSequenceClassification,__webpack_exports__RoFormerForTokenClassification=__webpack_exports__.RoFormerForTokenClassification,__webpack_exports__RoFormerModel=__webpack_exports__.RoFormerModel,__webpack_exports__RoFormerPreTrainedModel=__webpack_exports__.RoFormerPreTrainedModel,__webpack_exports__RoFormerTokenizer=__webpack_exports__.RoFormerTokenizer,__webpack_exports__RobertaForMaskedLM=__webpack_exports__.RobertaForMaskedLM,__webpack_exports__RobertaForQuestionAnswering=__webpack_exports__.RobertaForQuestionAnswering,__webpack_exports__RobertaForSequenceClassification=__webpack_exports__.RobertaForSequenceClassification,__webpack_exports__RobertaForTokenClassification=__webpack_exports__.RobertaForTokenClassification,__webpack_exports__RobertaModel=__webpack_exports__.RobertaModel,__webpack_exports__RobertaPreTrainedModel=__webpack_exports__.RobertaPreTrainedModel,__webpack_exports__RobertaTokenizer=__webpack_exports__.RobertaTokenizer,__webpack_exports__SamImageProcessor=__webpack_exports__.SamImageProcessor,__webpack_exports__SamImageSegmentationOutput=__webpack_exports__.SamImageSegmentationOutput,__webpack_exports__SamModel=__webpack_exports__.SamModel,__webpack_exports__SamPreTrainedModel=__webpack_exports__.SamPreTrainedModel,__webpack_exports__SamProcessor=__webpack_exports__.SamProcessor,__webpack_exports__SeamlessM4TFeatureExtractor=__webpack_exports__.SeamlessM4TFeatureExtractor,__webpack_exports__SegformerFeatureExtractor=__webpack_exports__.SegformerFeatureExtractor,__webpack_exports__SegformerForImageClassification=__webpack_exports__.SegformerForImageClassification,__webpack_exports__SegformerForSemanticSegmentation=__webpack_exports__.SegformerForSemanticSegmentation,__webpack_exports__SegformerModel=__webpack_exports__.SegformerModel,__webpack_exports__SegformerPreTrainedModel=__webpack_exports__.SegformerPreTrainedModel,__webpack_exports__Seq2SeqLMOutput=__webpack_exports__.Seq2SeqLMOutput,__webpack_exports__SequenceClassifierOutput=__webpack_exports__.SequenceClassifierOutput,__webpack_exports__SiglipImageProcessor=__webpack_exports__.SiglipImageProcessor,__webpack_exports__SiglipModel=__webpack_exports__.SiglipModel,__webpack_exports__SiglipPreTrainedModel=__webpack_exports__.SiglipPreTrainedModel,__webpack_exports__SiglipTextModel=__webpack_exports__.SiglipTextModel,__webpack_exports__SiglipTokenizer=__webpack_exports__.SiglipTokenizer,__webpack_exports__SiglipVisionModel=__webpack_exports__.SiglipVisionModel,__webpack_exports__SpeechT5FeatureExtractor=__webpack_exports__.SpeechT5FeatureExtractor,__webpack_exports__SpeechT5ForSpeechToText=__webpack_exports__.SpeechT5ForSpeechToText,__webpack_exports__SpeechT5ForTextToSpeech=__webpack_exports__.SpeechT5ForTextToSpeech,__webpack_exports__SpeechT5HifiGan=__webpack_exports__.SpeechT5HifiGan,__webpack_exports__SpeechT5Model=__webpack_exports__.SpeechT5Model,__webpack_exports__SpeechT5PreTrainedModel=__webpack_exports__.SpeechT5PreTrainedModel,__webpack_exports__SpeechT5Processor=__webpack_exports__.SpeechT5Processor,__webpack_exports__SpeechT5Tokenizer=__webpack_exports__.SpeechT5Tokenizer,__webpack_exports__SqueezeBertForMaskedLM=__webpack_exports__.SqueezeBertForMaskedLM,__webpack_exports__SqueezeBertForQuestionAnswering=__webpack_exports__.SqueezeBertForQuestionAnswering,__webpack_exports__SqueezeBertForSequenceClassification=__webpack_exports__.SqueezeBertForSequenceClassification,__webpack_exports__SqueezeBertModel=__webpack_exports__.SqueezeBertModel,__webpack_exports__SqueezeBertPreTrainedModel=__webpack_exports__.SqueezeBertPreTrainedModel,__webpack_exports__SqueezeBertTokenizer=__webpack_exports__.SqueezeBertTokenizer,__webpack_exports__StableLmForCausalLM=__webpack_exports__.StableLmForCausalLM,__webpack_exports__StableLmModel=__webpack_exports__.StableLmModel,__webpack_exports__StableLmPreTrainedModel=__webpack_exports__.StableLmPreTrainedModel,__webpack_exports__Starcoder2ForCausalLM=__webpack_exports__.Starcoder2ForCausalLM,__webpack_exports__Starcoder2Model=__webpack_exports__.Starcoder2Model,__webpack_exports__Starcoder2PreTrainedModel=__webpack_exports__.Starcoder2PreTrainedModel,__webpack_exports__SummarizationPipeline=__webpack_exports__.SummarizationPipeline,__webpack_exports__Swin2SRForImageSuperResolution=__webpack_exports__.Swin2SRForImageSuperResolution,__webpack_exports__Swin2SRImageProcessor=__webpack_exports__.Swin2SRImageProcessor,__webpack_exports__Swin2SRModel=__webpack_exports__.Swin2SRModel,__webpack_exports__Swin2SRPreTrainedModel=__webpack_exports__.Swin2SRPreTrainedModel,__webpack_exports__SwinForImageClassification=__webpack_exports__.SwinForImageClassification,__webpack_exports__SwinModel=__webpack_exports__.SwinModel,__webpack_exports__SwinPreTrainedModel=__webpack_exports__.SwinPreTrainedModel,__webpack_exports__T5ForConditionalGeneration=__webpack_exports__.T5ForConditionalGeneration,__webpack_exports__T5Model=__webpack_exports__.T5Model,__webpack_exports__T5PreTrainedModel=__webpack_exports__.T5PreTrainedModel,__webpack_exports__T5Tokenizer=__webpack_exports__.T5Tokenizer,__webpack_exports__TableTransformerForObjectDetection=__webpack_exports__.TableTransformerForObjectDetection,__webpack_exports__TableTransformerModel=__webpack_exports__.TableTransformerModel,__webpack_exports__TableTransformerObjectDetectionOutput=__webpack_exports__.TableTransformerObjectDetectionOutput,__webpack_exports__TableTransformerPreTrainedModel=__webpack_exports__.TableTransformerPreTrainedModel,__webpack_exports__Tensor=__webpack_exports__.Tensor,__webpack_exports__Text2TextGenerationPipeline=__webpack_exports__.Text2TextGenerationPipeline,__webpack_exports__TextClassificationPipeline=__webpack_exports__.TextClassificationPipeline,__webpack_exports__TextGenerationPipeline=__webpack_exports__.TextGenerationPipeline,__webpack_exports__TextToAudioPipeline=__webpack_exports__.TextToAudioPipeline,__webpack_exports__TokenClassificationPipeline=__webpack_exports__.TokenClassificationPipeline,__webpack_exports__TokenClassifierOutput=__webpack_exports__.TokenClassifierOutput,__webpack_exports__TokenizerModel=__webpack_exports__.TokenizerModel,__webpack_exports__TrOCRForCausalLM=__webpack_exports__.TrOCRForCausalLM,__webpack_exports__TrOCRPreTrainedModel=__webpack_exports__.TrOCRPreTrainedModel,__webpack_exports__TranslationPipeline=__webpack_exports__.TranslationPipeline,__webpack_exports__UniSpeechForCTC=__webpack_exports__.UniSpeechForCTC,__webpack_exports__UniSpeechForSequenceClassification=__webpack_exports__.UniSpeechForSequenceClassification,__webpack_exports__UniSpeechModel=__webpack_exports__.UniSpeechModel,__webpack_exports__UniSpeechPreTrainedModel=__webpack_exports__.UniSpeechPreTrainedModel,__webpack_exports__UniSpeechSatForAudioFrameClassification=__webpack_exports__.UniSpeechSatForAudioFrameClassification,__webpack_exports__UniSpeechSatForCTC=__webpack_exports__.UniSpeechSatForCTC,__webpack_exports__UniSpeechSatForSequenceClassification=__webpack_exports__.UniSpeechSatForSequenceClassification,__webpack_exports__UniSpeechSatModel=__webpack_exports__.UniSpeechSatModel,__webpack_exports__UniSpeechSatPreTrainedModel=__webpack_exports__.UniSpeechSatPreTrainedModel,__webpack_exports__ViTFeatureExtractor=__webpack_exports__.ViTFeatureExtractor,__webpack_exports__ViTForImageClassification=__webpack_exports__.ViTForImageClassification,__webpack_exports__ViTImageProcessor=__webpack_exports__.ViTImageProcessor,__webpack_exports__ViTModel=__webpack_exports__.ViTModel,__webpack_exports__ViTPreTrainedModel=__webpack_exports__.ViTPreTrainedModel,__webpack_exports__VisionEncoderDecoderModel=__webpack_exports__.VisionEncoderDecoderModel,__webpack_exports__VitMatteForImageMatting=__webpack_exports__.VitMatteForImageMatting,__webpack_exports__VitMatteImageProcessor=__webpack_exports__.VitMatteImageProcessor,__webpack_exports__VitMattePreTrainedModel=__webpack_exports__.VitMattePreTrainedModel,__webpack_exports__VitsModel=__webpack_exports__.VitsModel,__webpack_exports__VitsModelOutput=__webpack_exports__.VitsModelOutput,__webpack_exports__VitsPreTrainedModel=__webpack_exports__.VitsPreTrainedModel,__webpack_exports__VitsTokenizer=__webpack_exports__.VitsTokenizer,__webpack_exports__Wav2Vec2BertForCTC=__webpack_exports__.Wav2Vec2BertForCTC,__webpack_exports__Wav2Vec2BertForSequenceClassification=__webpack_exports__.Wav2Vec2BertForSequenceClassification,__webpack_exports__Wav2Vec2BertModel=__webpack_exports__.Wav2Vec2BertModel,__webpack_exports__Wav2Vec2BertPreTrainedModel=__webpack_exports__.Wav2Vec2BertPreTrainedModel,__webpack_exports__Wav2Vec2CTCTokenizer=__webpack_exports__.Wav2Vec2CTCTokenizer,__webpack_exports__Wav2Vec2FeatureExtractor=__webpack_exports__.Wav2Vec2FeatureExtractor,__webpack_exports__Wav2Vec2ForAudioFrameClassification=__webpack_exports__.Wav2Vec2ForAudioFrameClassification,__webpack_exports__Wav2Vec2ForCTC=__webpack_exports__.Wav2Vec2ForCTC,__webpack_exports__Wav2Vec2ForSequenceClassification=__webpack_exports__.Wav2Vec2ForSequenceClassification,__webpack_exports__Wav2Vec2Model=__webpack_exports__.Wav2Vec2Model,__webpack_exports__Wav2Vec2PreTrainedModel=__webpack_exports__.Wav2Vec2PreTrainedModel,__webpack_exports__Wav2Vec2ProcessorWithLM=__webpack_exports__.Wav2Vec2ProcessorWithLM,__webpack_exports__WavLMForAudioFrameClassification=__webpack_exports__.WavLMForAudioFrameClassification,__webpack_exports__WavLMForCTC=__webpack_exports__.WavLMForCTC,__webpack_exports__WavLMForSequenceClassification=__webpack_exports__.WavLMForSequenceClassification,__webpack_exports__WavLMForXVector=__webpack_exports__.WavLMForXVector,__webpack_exports__WavLMModel=__webpack_exports__.WavLMModel,__webpack_exports__WavLMPreTrainedModel=__webpack_exports__.WavLMPreTrainedModel,__webpack_exports__WhisperFeatureExtractor=__webpack_exports__.WhisperFeatureExtractor,__webpack_exports__WhisperForConditionalGeneration=__webpack_exports__.WhisperForConditionalGeneration,__webpack_exports__WhisperModel=__webpack_exports__.WhisperModel,__webpack_exports__WhisperPreTrainedModel=__webpack_exports__.WhisperPreTrainedModel,__webpack_exports__WhisperProcessor=__webpack_exports__.WhisperProcessor,__webpack_exports__WhisperTokenizer=__webpack_exports__.WhisperTokenizer,__webpack_exports__XLMForQuestionAnswering=__webpack_exports__.XLMForQuestionAnswering,__webpack_exports__XLMForSequenceClassification=__webpack_exports__.XLMForSequenceClassification,__webpack_exports__XLMForTokenClassification=__webpack_exports__.XLMForTokenClassification,__webpack_exports__XLMModel=__webpack_exports__.XLMModel,__webpack_exports__XLMPreTrainedModel=__webpack_exports__.XLMPreTrainedModel,__webpack_exports__XLMRobertaForMaskedLM=__webpack_exports__.XLMRobertaForMaskedLM,__webpack_exports__XLMRobertaForQuestionAnswering=__webpack_exports__.XLMRobertaForQuestionAnswering,__webpack_exports__XLMRobertaForSequenceClassification=__webpack_exports__.XLMRobertaForSequenceClassification,__webpack_exports__XLMRobertaForTokenClassification=__webpack_exports__.XLMRobertaForTokenClassification,__webpack_exports__XLMRobertaModel=__webpack_exports__.XLMRobertaModel,__webpack_exports__XLMRobertaPreTrainedModel=__webpack_exports__.XLMRobertaPreTrainedModel,__webpack_exports__XLMRobertaTokenizer=__webpack_exports__.XLMRobertaTokenizer,__webpack_exports__XLMTokenizer=__webpack_exports__.XLMTokenizer,__webpack_exports__XLMWithLMHeadModel=__webpack_exports__.XLMWithLMHeadModel,__webpack_exports__XVectorOutput=__webpack_exports__.XVectorOutput,__webpack_exports__YolosFeatureExtractor=__webpack_exports__.YolosFeatureExtractor,__webpack_exports__YolosForObjectDetection=__webpack_exports__.YolosForObjectDetection,__webpack_exports__YolosModel=__webpack_exports__.YolosModel,__webpack_exports__YolosObjectDetectionOutput=__webpack_exports__.YolosObjectDetectionOutput,__webpack_exports__YolosPreTrainedModel=__webpack_exports__.YolosPreTrainedModel,__webpack_exports__ZeroShotAudioClassificationPipeline=__webpack_exports__.ZeroShotAudioClassificationPipeline,__webpack_exports__ZeroShotClassificationPipeline=__webpack_exports__.ZeroShotClassificationPipeline,__webpack_exports__ZeroShotImageClassificationPipeline=__webpack_exports__.ZeroShotImageClassificationPipeline,__webpack_exports__ZeroShotObjectDetectionPipeline=__webpack_exports__.ZeroShotObjectDetectionPipeline,__webpack_exports__bankers_round=__webpack_exports__.bankers_round,__webpack_exports__cat=__webpack_exports__.cat,__webpack_exports__cos_sim=__webpack_exports__.cos_sim,__webpack_exports__dot=__webpack_exports__.dot,__webpack_exports__dynamicTimeWarping=__webpack_exports__.dynamicTimeWarping,__webpack_exports__env=__webpack_exports__.env,__webpack_exports__getTopItems=__webpack_exports__.getTopItems,__webpack_exports__hanning=__webpack_exports__.hanning,__webpack_exports__interpolate=__webpack_exports__.interpolate,__webpack_exports__interpolate_data=__webpack_exports__.interpolate_data,__webpack_exports__layer_norm=__webpack_exports__.layer_norm,__webpack_exports__log_softmax=__webpack_exports__.log_softmax,__webpack_exports__magnitude=__webpack_exports__.magnitude,__webpack_exports__max=__webpack_exports__.max,__webpack_exports__mean=__webpack_exports__.mean,__webpack_exports__mean_pooling=__webpack_exports__.mean_pooling,__webpack_exports__medianFilter=__webpack_exports__.medianFilter,__webpack_exports__mel_filter_bank=__webpack_exports__.mel_filter_bank,__webpack_exports__min=__webpack_exports__.min,__webpack_exports__ones=__webpack_exports__.ones,__webpack_exports__ones_like=__webpack_exports__.ones_like,__webpack_exports__permute=__webpack_exports__.permute,__webpack_exports__permute_data=__webpack_exports__.permute_data,__webpack_exports__pipeline=__webpack_exports__.pipeline,__webpack_exports__quantize_embeddings=__webpack_exports__.quantize_embeddings,__webpack_exports__read_audio=__webpack_exports__.read_audio,__webpack_exports__round=__webpack_exports__.round,__webpack_exports__softmax=__webpack_exports__.softmax,__webpack_exports__spectrogram=__webpack_exports__.spectrogram,__webpack_exports__stack=__webpack_exports__.stack,__webpack_exports__std_mean=__webpack_exports__.std_mean,__webpack_exports__window_function=__webpack_exports__.window_function;export{__webpack_exports__ASTFeatureExtractor as ASTFeatureExtractor,__webpack_exports__ASTForAudioClassification as ASTForAudioClassification,__webpack_exports__ASTModel as ASTModel,__webpack_exports__ASTPreTrainedModel as ASTPreTrainedModel,__webpack_exports__AlbertForMaskedLM as AlbertForMaskedLM,__webpack_exports__AlbertForQuestionAnswering as AlbertForQuestionAnswering,__webpack_exports__AlbertForSequenceClassification as AlbertForSequenceClassification,__webpack_exports__AlbertModel as AlbertModel,__webpack_exports__AlbertPreTrainedModel as AlbertPreTrainedModel,__webpack_exports__AlbertTokenizer as AlbertTokenizer,__webpack_exports__AudioClassificationPipeline as AudioClassificationPipeline,__webpack_exports__AutoConfig as AutoConfig,__webpack_exports__AutoModel as AutoModel,__webpack_exports__AutoModelForAudioClassification as AutoModelForAudioClassification,__webpack_exports__AutoModelForAudioFrameClassification as AutoModelForAudioFrameClassification,__webpack_exports__AutoModelForCTC as AutoModelForCTC,__webpack_exports__AutoModelForCausalLM as AutoModelForCausalLM,__webpack_exports__AutoModelForDepthEstimation as AutoModelForDepthEstimation,__webpack_exports__AutoModelForDocumentQuestionAnswering as AutoModelForDocumentQuestionAnswering,__webpack_exports__AutoModelForImageClassification as AutoModelForImageClassification,__webpack_exports__AutoModelForImageFeatureExtraction as AutoModelForImageFeatureExtraction,__webpack_exports__AutoModelForImageMatting as AutoModelForImageMatting,__webpack_exports__AutoModelForImageSegmentation as AutoModelForImageSegmentation,__webpack_exports__AutoModelForImageToImage as AutoModelForImageToImage,__webpack_exports__AutoModelForMaskGeneration as AutoModelForMaskGeneration,__webpack_exports__AutoModelForMaskedLM as AutoModelForMaskedLM,__webpack_exports__AutoModelForObjectDetection as AutoModelForObjectDetection,__webpack_exports__AutoModelForQuestionAnswering as AutoModelForQuestionAnswering,__webpack_exports__AutoModelForSemanticSegmentation as AutoModelForSemanticSegmentation,__webpack_exports__AutoModelForSeq2SeqLM as AutoModelForSeq2SeqLM,__webpack_exports__AutoModelForSequenceClassification as AutoModelForSequenceClassification,__webpack_exports__AutoModelForSpeechSeq2Seq as AutoModelForSpeechSeq2Seq,__webpack_exports__AutoModelForTextToSpectrogram as AutoModelForTextToSpectrogram,__webpack_exports__AutoModelForTextToWaveform as AutoModelForTextToWaveform,__webpack_exports__AutoModelForTokenClassification as AutoModelForTokenClassification,__webpack_exports__AutoModelForVision2Seq as AutoModelForVision2Seq,__webpack_exports__AutoModelForXVector as AutoModelForXVector,__webpack_exports__AutoModelForZeroShotObjectDetection as AutoModelForZeroShotObjectDetection,__webpack_exports__AutoProcessor as AutoProcessor,__webpack_exports__AutoTokenizer as AutoTokenizer,__webpack_exports__AutomaticSpeechRecognitionPipeline as AutomaticSpeechRecognitionPipeline,__webpack_exports__BartForConditionalGeneration as BartForConditionalGeneration,__webpack_exports__BartForSequenceClassification as BartForSequenceClassification,__webpack_exports__BartModel as BartModel,__webpack_exports__BartPretrainedModel as BartPretrainedModel,__webpack_exports__BartTokenizer as BartTokenizer,__webpack_exports__BaseModelOutput as BaseModelOutput,__webpack_exports__BeitFeatureExtractor as BeitFeatureExtractor,__webpack_exports__BeitForImageClassification as BeitForImageClassification,__webpack_exports__BeitModel as BeitModel,__webpack_exports__BeitPreTrainedModel as BeitPreTrainedModel,__webpack_exports__BertForMaskedLM as BertForMaskedLM,__webpack_exports__BertForQuestionAnswering as BertForQuestionAnswering,__webpack_exports__BertForSequenceClassification as BertForSequenceClassification,__webpack_exports__BertForTokenClassification as BertForTokenClassification,__webpack_exports__BertModel as BertModel,__webpack_exports__BertPreTrainedModel as BertPreTrainedModel,__webpack_exports__BertTokenizer as BertTokenizer,__webpack_exports__BitImageProcessor as BitImageProcessor,__webpack_exports__BlenderbotForConditionalGeneration as BlenderbotForConditionalGeneration,__webpack_exports__BlenderbotModel as BlenderbotModel,__webpack_exports__BlenderbotPreTrainedModel as BlenderbotPreTrainedModel,__webpack_exports__BlenderbotSmallForConditionalGeneration as BlenderbotSmallForConditionalGeneration,__webpack_exports__BlenderbotSmallModel as BlenderbotSmallModel,__webpack_exports__BlenderbotSmallPreTrainedModel as BlenderbotSmallPreTrainedModel,__webpack_exports__BlenderbotSmallTokenizer as BlenderbotSmallTokenizer,__webpack_exports__BlenderbotTokenizer as BlenderbotTokenizer,__webpack_exports__BloomForCausalLM as BloomForCausalLM,__webpack_exports__BloomModel as BloomModel,__webpack_exports__BloomPreTrainedModel as BloomPreTrainedModel,__webpack_exports__BloomTokenizer as BloomTokenizer,__webpack_exports__CLIPFeatureExtractor as CLIPFeatureExtractor,__webpack_exports__CLIPModel as CLIPModel,__webpack_exports__CLIPPreTrainedModel as CLIPPreTrainedModel,__webpack_exports__CLIPSegForImageSegmentation as CLIPSegForImageSegmentation,__webpack_exports__CLIPSegModel as CLIPSegModel,__webpack_exports__CLIPSegPreTrainedModel as CLIPSegPreTrainedModel,__webpack_exports__CLIPTextModelWithProjection as CLIPTextModelWithProjection,__webpack_exports__CLIPTokenizer as CLIPTokenizer,__webpack_exports__CLIPVisionModelWithProjection as CLIPVisionModelWithProjection,__webpack_exports__CamembertForMaskedLM as CamembertForMaskedLM,__webpack_exports__CamembertForQuestionAnswering as CamembertForQuestionAnswering,__webpack_exports__CamembertForSequenceClassification as CamembertForSequenceClassification,__webpack_exports__CamembertForTokenClassification as CamembertForTokenClassification,__webpack_exports__CamembertModel as CamembertModel,__webpack_exports__CamembertPreTrainedModel as CamembertPreTrainedModel,__webpack_exports__CamembertTokenizer as CamembertTokenizer,__webpack_exports__CausalLMOutput as CausalLMOutput,__webpack_exports__CausalLMOutputWithPast as CausalLMOutputWithPast,__webpack_exports__ChineseCLIPFeatureExtractor as ChineseCLIPFeatureExtractor,__webpack_exports__ChineseCLIPModel as ChineseCLIPModel,__webpack_exports__ChineseCLIPPreTrainedModel as ChineseCLIPPreTrainedModel,__webpack_exports__ClapAudioModelWithProjection as ClapAudioModelWithProjection,__webpack_exports__ClapFeatureExtractor as ClapFeatureExtractor,__webpack_exports__ClapModel as ClapModel,__webpack_exports__ClapPreTrainedModel as ClapPreTrainedModel,__webpack_exports__ClapTextModelWithProjection as ClapTextModelWithProjection,__webpack_exports__CodeGenForCausalLM as CodeGenForCausalLM,__webpack_exports__CodeGenModel as CodeGenModel,__webpack_exports__CodeGenPreTrainedModel as CodeGenPreTrainedModel,__webpack_exports__CodeGenTokenizer as CodeGenTokenizer,__webpack_exports__CodeLlamaTokenizer as CodeLlamaTokenizer,__webpack_exports__CohereTokenizer as CohereTokenizer,__webpack_exports__ConvBertForMaskedLM as ConvBertForMaskedLM,__webpack_exports__ConvBertForQuestionAnswering as ConvBertForQuestionAnswering,__webpack_exports__ConvBertForSequenceClassification as ConvBertForSequenceClassification,__webpack_exports__ConvBertForTokenClassification as ConvBertForTokenClassification,__webpack_exports__ConvBertModel as ConvBertModel,__webpack_exports__ConvBertPreTrainedModel as ConvBertPreTrainedModel,__webpack_exports__ConvBertTokenizer as ConvBertTokenizer,__webpack_exports__ConvNextFeatureExtractor as ConvNextFeatureExtractor,__webpack_exports__ConvNextForImageClassification as ConvNextForImageClassification,__webpack_exports__ConvNextImageProcessor as ConvNextImageProcessor,__webpack_exports__ConvNextModel as ConvNextModel,__webpack_exports__ConvNextPreTrainedModel as ConvNextPreTrainedModel,__webpack_exports__ConvNextV2ForImageClassification as ConvNextV2ForImageClassification,__webpack_exports__ConvNextV2Model as ConvNextV2Model,__webpack_exports__ConvNextV2PreTrainedModel as ConvNextV2PreTrainedModel,__webpack_exports__DPTFeatureExtractor as DPTFeatureExtractor,__webpack_exports__DPTForDepthEstimation as DPTForDepthEstimation,__webpack_exports__DPTImageProcessor as DPTImageProcessor,__webpack_exports__DPTModel as DPTModel,__webpack_exports__DPTPreTrainedModel as DPTPreTrainedModel,__webpack_exports__DebertaForMaskedLM as DebertaForMaskedLM,__webpack_exports__DebertaForQuestionAnswering as DebertaForQuestionAnswering,__webpack_exports__DebertaForSequenceClassification as DebertaForSequenceClassification,__webpack_exports__DebertaForTokenClassification as DebertaForTokenClassification,__webpack_exports__DebertaModel as DebertaModel,__webpack_exports__DebertaPreTrainedModel as DebertaPreTrainedModel,__webpack_exports__DebertaTokenizer as DebertaTokenizer,__webpack_exports__DebertaV2ForMaskedLM as DebertaV2ForMaskedLM,__webpack_exports__DebertaV2ForQuestionAnswering as DebertaV2ForQuestionAnswering,__webpack_exports__DebertaV2ForSequenceClassification as DebertaV2ForSequenceClassification,__webpack_exports__DebertaV2ForTokenClassification as DebertaV2ForTokenClassification,__webpack_exports__DebertaV2Model as DebertaV2Model,__webpack_exports__DebertaV2PreTrainedModel as DebertaV2PreTrainedModel,__webpack_exports__DebertaV2Tokenizer as DebertaV2Tokenizer,__webpack_exports__DeiTFeatureExtractor as DeiTFeatureExtractor,__webpack_exports__DeiTForImageClassification as DeiTForImageClassification,__webpack_exports__DeiTModel as DeiTModel,__webpack_exports__DeiTPreTrainedModel as DeiTPreTrainedModel,__webpack_exports__DepthAnythingForDepthEstimation as DepthAnythingForDepthEstimation,__webpack_exports__DepthAnythingPreTrainedModel as DepthAnythingPreTrainedModel,__webpack_exports__DepthEstimationPipeline as DepthEstimationPipeline,__webpack_exports__DetrFeatureExtractor as DetrFeatureExtractor,__webpack_exports__DetrForObjectDetection as DetrForObjectDetection,__webpack_exports__DetrForSegmentation as DetrForSegmentation,__webpack_exports__DetrModel as DetrModel,__webpack_exports__DetrObjectDetectionOutput as DetrObjectDetectionOutput,__webpack_exports__DetrPreTrainedModel as DetrPreTrainedModel,__webpack_exports__DetrSegmentationOutput as DetrSegmentationOutput,__webpack_exports__Dinov2ForImageClassification as Dinov2ForImageClassification,__webpack_exports__Dinov2Model as Dinov2Model,__webpack_exports__Dinov2PreTrainedModel as Dinov2PreTrainedModel,__webpack_exports__DistilBertForMaskedLM as DistilBertForMaskedLM,__webpack_exports__DistilBertForQuestionAnswering as DistilBertForQuestionAnswering,__webpack_exports__DistilBertForSequenceClassification as DistilBertForSequenceClassification,__webpack_exports__DistilBertForTokenClassification as DistilBertForTokenClassification,__webpack_exports__DistilBertModel as DistilBertModel,__webpack_exports__DistilBertPreTrainedModel as DistilBertPreTrainedModel,__webpack_exports__DistilBertTokenizer as DistilBertTokenizer,__webpack_exports__DocumentQuestionAnsweringPipeline as DocumentQuestionAnsweringPipeline,__webpack_exports__DonutFeatureExtractor as DonutFeatureExtractor,__webpack_exports__DonutSwinModel as DonutSwinModel,__webpack_exports__DonutSwinPreTrainedModel as DonutSwinPreTrainedModel,__webpack_exports__EfficientNetForImageClassification as EfficientNetForImageClassification,__webpack_exports__EfficientNetImageProcessor as EfficientNetImageProcessor,__webpack_exports__EfficientNetModel as EfficientNetModel,__webpack_exports__EfficientNetPreTrainedModel as EfficientNetPreTrainedModel,__webpack_exports__ElectraForMaskedLM as ElectraForMaskedLM,__webpack_exports__ElectraForQuestionAnswering as ElectraForQuestionAnswering,__webpack_exports__ElectraForSequenceClassification as ElectraForSequenceClassification,__webpack_exports__ElectraForTokenClassification as ElectraForTokenClassification,__webpack_exports__ElectraModel as ElectraModel,__webpack_exports__ElectraPreTrainedModel as ElectraPreTrainedModel,__webpack_exports__ElectraTokenizer as ElectraTokenizer,__webpack_exports__EsmForMaskedLM as EsmForMaskedLM,__webpack_exports__EsmForSequenceClassification as EsmForSequenceClassification,__webpack_exports__EsmForTokenClassification as EsmForTokenClassification,__webpack_exports__EsmModel as EsmModel,__webpack_exports__EsmPreTrainedModel as EsmPreTrainedModel,__webpack_exports__EsmTokenizer as EsmTokenizer,__webpack_exports__FFT as FFT,__webpack_exports__FalconForCausalLM as FalconForCausalLM,__webpack_exports__FalconModel as FalconModel,__webpack_exports__FalconPreTrainedModel as FalconPreTrainedModel,__webpack_exports__FalconTokenizer as FalconTokenizer,__webpack_exports__FastViTForImageClassification as FastViTForImageClassification,__webpack_exports__FastViTModel as FastViTModel,__webpack_exports__FastViTPreTrainedModel as FastViTPreTrainedModel,__webpack_exports__FeatureExtractionPipeline as FeatureExtractionPipeline,__webpack_exports__FeatureExtractor as FeatureExtractor,__webpack_exports__FillMaskPipeline as FillMaskPipeline,__webpack_exports__GLPNFeatureExtractor as GLPNFeatureExtractor,__webpack_exports__GLPNForDepthEstimation as GLPNForDepthEstimation,__webpack_exports__GLPNModel as GLPNModel,__webpack_exports__GLPNPreTrainedModel as GLPNPreTrainedModel,__webpack_exports__GPT2LMHeadModel as GPT2LMHeadModel,__webpack_exports__GPT2Model as GPT2Model,__webpack_exports__GPT2PreTrainedModel as GPT2PreTrainedModel,__webpack_exports__GPT2Tokenizer as GPT2Tokenizer,__webpack_exports__GPTBigCodeForCausalLM as GPTBigCodeForCausalLM,__webpack_exports__GPTBigCodeModel as GPTBigCodeModel,__webpack_exports__GPTBigCodePreTrainedModel as GPTBigCodePreTrainedModel,__webpack_exports__GPTJForCausalLM as GPTJForCausalLM,__webpack_exports__GPTJModel as GPTJModel,__webpack_exports__GPTJPreTrainedModel as GPTJPreTrainedModel,__webpack_exports__GPTNeoForCausalLM as GPTNeoForCausalLM,__webpack_exports__GPTNeoModel as GPTNeoModel,__webpack_exports__GPTNeoPreTrainedModel as GPTNeoPreTrainedModel,__webpack_exports__GPTNeoXForCausalLM as GPTNeoXForCausalLM,__webpack_exports__GPTNeoXModel as GPTNeoXModel,__webpack_exports__GPTNeoXPreTrainedModel as GPTNeoXPreTrainedModel,__webpack_exports__GPTNeoXTokenizer as GPTNeoXTokenizer,__webpack_exports__GemmaTokenizer as GemmaTokenizer,__webpack_exports__Grok1Tokenizer as Grok1Tokenizer,__webpack_exports__HerbertTokenizer as HerbertTokenizer,__webpack_exports__HubertForCTC as HubertForCTC,__webpack_exports__HubertForSequenceClassification as HubertForSequenceClassification,__webpack_exports__HubertModel as HubertModel,__webpack_exports__HubertPreTrainedModel as HubertPreTrainedModel,__webpack_exports__ImageClassificationPipeline as ImageClassificationPipeline,__webpack_exports__ImageFeatureExtractionPipeline as ImageFeatureExtractionPipeline,__webpack_exports__ImageFeatureExtractor as ImageFeatureExtractor,__webpack_exports__ImageMattingOutput as ImageMattingOutput,__webpack_exports__ImageSegmentationPipeline as ImageSegmentationPipeline,__webpack_exports__ImageToImagePipeline as ImageToImagePipeline,__webpack_exports__ImageToTextPipeline as ImageToTextPipeline,__webpack_exports__LlamaForCausalLM as LlamaForCausalLM,__webpack_exports__LlamaModel as LlamaModel,__webpack_exports__LlamaPreTrainedModel as LlamaPreTrainedModel,__webpack_exports__LlamaTokenizer as LlamaTokenizer,__webpack_exports__LongT5ForConditionalGeneration as LongT5ForConditionalGeneration,__webpack_exports__LongT5Model as LongT5Model,__webpack_exports__LongT5PreTrainedModel as LongT5PreTrainedModel,__webpack_exports__M2M100ForConditionalGeneration as M2M100ForConditionalGeneration,__webpack_exports__M2M100Model as M2M100Model,__webpack_exports__M2M100PreTrainedModel as M2M100PreTrainedModel,__webpack_exports__M2M100Tokenizer as M2M100Tokenizer,__webpack_exports__MBart50Tokenizer as MBart50Tokenizer,__webpack_exports__MBartForCausalLM as MBartForCausalLM,__webpack_exports__MBartForConditionalGeneration as MBartForConditionalGeneration,__webpack_exports__MBartForSequenceClassification as MBartForSequenceClassification,__webpack_exports__MBartModel as MBartModel,__webpack_exports__MBartPreTrainedModel as MBartPreTrainedModel,__webpack_exports__MBartTokenizer as MBartTokenizer,__webpack_exports__MPNetForMaskedLM as MPNetForMaskedLM,__webpack_exports__MPNetForQuestionAnswering as MPNetForQuestionAnswering,__webpack_exports__MPNetForSequenceClassification as MPNetForSequenceClassification,__webpack_exports__MPNetForTokenClassification as MPNetForTokenClassification,__webpack_exports__MPNetModel as MPNetModel,__webpack_exports__MPNetPreTrainedModel as MPNetPreTrainedModel,__webpack_exports__MPNetTokenizer as MPNetTokenizer,__webpack_exports__MT5ForConditionalGeneration as MT5ForConditionalGeneration,__webpack_exports__MT5Model as MT5Model,__webpack_exports__MT5PreTrainedModel as MT5PreTrainedModel,__webpack_exports__MarianMTModel as MarianMTModel,__webpack_exports__MarianModel as MarianModel,__webpack_exports__MarianPreTrainedModel as MarianPreTrainedModel,__webpack_exports__MarianTokenizer as MarianTokenizer,__webpack_exports__MaskedLMOutput as MaskedLMOutput,__webpack_exports__MistralForCausalLM as MistralForCausalLM,__webpack_exports__MistralModel as MistralModel,__webpack_exports__MistralPreTrainedModel as MistralPreTrainedModel,__webpack_exports__MobileBertForMaskedLM as MobileBertForMaskedLM,__webpack_exports__MobileBertForQuestionAnswering as MobileBertForQuestionAnswering,__webpack_exports__MobileBertForSequenceClassification as MobileBertForSequenceClassification,__webpack_exports__MobileBertModel as MobileBertModel,__webpack_exports__MobileBertPreTrainedModel as MobileBertPreTrainedModel,__webpack_exports__MobileBertTokenizer as MobileBertTokenizer,__webpack_exports__MobileViTFeatureExtractor as MobileViTFeatureExtractor,__webpack_exports__MobileViTForImageClassification as MobileViTForImageClassification,__webpack_exports__MobileViTImageProcessor as MobileViTImageProcessor,__webpack_exports__MobileViTModel as MobileViTModel,__webpack_exports__MobileViTPreTrainedModel as MobileViTPreTrainedModel,__webpack_exports__MobileViTV2ForImageClassification as MobileViTV2ForImageClassification,__webpack_exports__MobileViTV2Model as MobileViTV2Model,__webpack_exports__MobileViTV2PreTrainedModel as MobileViTV2PreTrainedModel,__webpack_exports__ModelOutput as ModelOutput,__webpack_exports__MptForCausalLM as MptForCausalLM,__webpack_exports__MptModel as MptModel,__webpack_exports__MptPreTrainedModel as MptPreTrainedModel,__webpack_exports__NllbTokenizer as NllbTokenizer,__webpack_exports__NomicBertModel as NomicBertModel,__webpack_exports__NomicBertPreTrainedModel as NomicBertPreTrainedModel,__webpack_exports__NougatImageProcessor as NougatImageProcessor,__webpack_exports__NougatTokenizer as NougatTokenizer,__webpack_exports__OPTForCausalLM as OPTForCausalLM,__webpack_exports__OPTModel as OPTModel,__webpack_exports__OPTPreTrainedModel as OPTPreTrainedModel,__webpack_exports__ObjectDetectionPipeline as ObjectDetectionPipeline,__webpack_exports__OwlViTFeatureExtractor as OwlViTFeatureExtractor,__webpack_exports__OwlViTForObjectDetection as OwlViTForObjectDetection,__webpack_exports__OwlViTModel as OwlViTModel,__webpack_exports__OwlViTPreTrainedModel as OwlViTPreTrainedModel,__webpack_exports__OwlViTProcessor as OwlViTProcessor,__webpack_exports__Owlv2ForObjectDetection as Owlv2ForObjectDetection,__webpack_exports__Owlv2ImageProcessor as Owlv2ImageProcessor,__webpack_exports__Owlv2Model as Owlv2Model,__webpack_exports__Owlv2PreTrainedModel as Owlv2PreTrainedModel,__webpack_exports__PhiForCausalLM as PhiForCausalLM,__webpack_exports__PhiModel as PhiModel,__webpack_exports__PhiPreTrainedModel as PhiPreTrainedModel,__webpack_exports__Pipeline as Pipeline,__webpack_exports__PreTrainedModel as PreTrainedModel,__webpack_exports__PreTrainedTokenizer as PreTrainedTokenizer,__webpack_exports__PretrainedConfig as PretrainedConfig,__webpack_exports__PretrainedMixin as PretrainedMixin,__webpack_exports__Processor as Processor,__webpack_exports__QuestionAnsweringModelOutput as QuestionAnsweringModelOutput,__webpack_exports__QuestionAnsweringPipeline as QuestionAnsweringPipeline,__webpack_exports__Qwen2ForCausalLM as Qwen2ForCausalLM,__webpack_exports__Qwen2Model as Qwen2Model,__webpack_exports__Qwen2PreTrainedModel as Qwen2PreTrainedModel,__webpack_exports__Qwen2Tokenizer as Qwen2Tokenizer,__webpack_exports__RawImage as RawImage,__webpack_exports__ResNetForImageClassification as ResNetForImageClassification,__webpack_exports__ResNetModel as ResNetModel,__webpack_exports__ResNetPreTrainedModel as ResNetPreTrainedModel,__webpack_exports__RoFormerForMaskedLM as RoFormerForMaskedLM,__webpack_exports__RoFormerForQuestionAnswering as RoFormerForQuestionAnswering,__webpack_exports__RoFormerForSequenceClassification as RoFormerForSequenceClassification,__webpack_exports__RoFormerForTokenClassification as RoFormerForTokenClassification,__webpack_exports__RoFormerModel as RoFormerModel,__webpack_exports__RoFormerPreTrainedModel as RoFormerPreTrainedModel,__webpack_exports__RoFormerTokenizer as RoFormerTokenizer,__webpack_exports__RobertaForMaskedLM as RobertaForMaskedLM,__webpack_exports__RobertaForQuestionAnswering as RobertaForQuestionAnswering,__webpack_exports__RobertaForSequenceClassification as RobertaForSequenceClassification,__webpack_exports__RobertaForTokenClassification as RobertaForTokenClassification,__webpack_exports__RobertaModel as RobertaModel,__webpack_exports__RobertaPreTrainedModel as RobertaPreTrainedModel,__webpack_exports__RobertaTokenizer as RobertaTokenizer,__webpack_exports__SamImageProcessor as SamImageProcessor,__webpack_exports__SamImageSegmentationOutput as SamImageSegmentationOutput,__webpack_exports__SamModel as SamModel,__webpack_exports__SamPreTrainedModel as SamPreTrainedModel,__webpack_exports__SamProcessor as SamProcessor,__webpack_exports__SeamlessM4TFeatureExtractor as SeamlessM4TFeatureExtractor,__webpack_exports__SegformerFeatureExtractor as SegformerFeatureExtractor,__webpack_exports__SegformerForImageClassification as SegformerForImageClassification,__webpack_exports__SegformerForSemanticSegmentation as SegformerForSemanticSegmentation,__webpack_exports__SegformerModel as SegformerModel,__webpack_exports__SegformerPreTrainedModel as SegformerPreTrainedModel,__webpack_exports__Seq2SeqLMOutput as Seq2SeqLMOutput,__webpack_exports__SequenceClassifierOutput as SequenceClassifierOutput,__webpack_exports__SiglipImageProcessor as SiglipImageProcessor,__webpack_exports__SiglipModel as SiglipModel,__webpack_exports__SiglipPreTrainedModel as SiglipPreTrainedModel,__webpack_exports__SiglipTextModel as SiglipTextModel,__webpack_exports__SiglipTokenizer as SiglipTokenizer,__webpack_exports__SiglipVisionModel as SiglipVisionModel,__webpack_exports__SpeechT5FeatureExtractor as SpeechT5FeatureExtractor,__webpack_exports__SpeechT5ForSpeechToText as SpeechT5ForSpeechToText,__webpack_exports__SpeechT5ForTextToSpeech as SpeechT5ForTextToSpeech,__webpack_exports__SpeechT5HifiGan as SpeechT5HifiGan,__webpack_exports__SpeechT5Model as SpeechT5Model,__webpack_exports__SpeechT5PreTrainedModel as SpeechT5PreTrainedModel,__webpack_exports__SpeechT5Processor as SpeechT5Processor,__webpack_exports__SpeechT5Tokenizer as SpeechT5Tokenizer,__webpack_exports__SqueezeBertForMaskedLM as SqueezeBertForMaskedLM,__webpack_exports__SqueezeBertForQuestionAnswering as SqueezeBertForQuestionAnswering,__webpack_exports__SqueezeBertForSequenceClassification as SqueezeBertForSequenceClassification,__webpack_exports__SqueezeBertModel as SqueezeBertModel,__webpack_exports__SqueezeBertPreTrainedModel as SqueezeBertPreTrainedModel,__webpack_exports__SqueezeBertTokenizer as SqueezeBertTokenizer,__webpack_exports__StableLmForCausalLM as StableLmForCausalLM,__webpack_exports__StableLmModel as StableLmModel,__webpack_exports__StableLmPreTrainedModel as StableLmPreTrainedModel,__webpack_exports__Starcoder2ForCausalLM as Starcoder2ForCausalLM,__webpack_exports__Starcoder2Model as Starcoder2Model,__webpack_exports__Starcoder2PreTrainedModel as Starcoder2PreTrainedModel,__webpack_exports__SummarizationPipeline as SummarizationPipeline,__webpack_exports__Swin2SRForImageSuperResolution as Swin2SRForImageSuperResolution,__webpack_exports__Swin2SRImageProcessor as Swin2SRImageProcessor,__webpack_exports__Swin2SRModel as Swin2SRModel,__webpack_exports__Swin2SRPreTrainedModel as Swin2SRPreTrainedModel,__webpack_exports__SwinForImageClassification as SwinForImageClassification,__webpack_exports__SwinModel as SwinModel,__webpack_exports__SwinPreTrainedModel as SwinPreTrainedModel,__webpack_exports__T5ForConditionalGeneration as T5ForConditionalGeneration,__webpack_exports__T5Model as T5Model,__webpack_exports__T5PreTrainedModel as T5PreTrainedModel,__webpack_exports__T5Tokenizer as T5Tokenizer,__webpack_exports__TableTransformerForObjectDetection as TableTransformerForObjectDetection,__webpack_exports__TableTransformerModel as TableTransformerModel,__webpack_exports__TableTransformerObjectDetectionOutput as TableTransformerObjectDetectionOutput,__webpack_exports__TableTransformerPreTrainedModel as TableTransformerPreTrainedModel,__webpack_exports__Tensor as Tensor,__webpack_exports__Text2TextGenerationPipeline as Text2TextGenerationPipeline,__webpack_exports__TextClassificationPipeline as TextClassificationPipeline,__webpack_exports__TextGenerationPipeline as TextGenerationPipeline,__webpack_exports__TextToAudioPipeline as TextToAudioPipeline,__webpack_exports__TokenClassificationPipeline as TokenClassificationPipeline,__webpack_exports__TokenClassifierOutput as TokenClassifierOutput,__webpack_exports__TokenizerModel as TokenizerModel,__webpack_exports__TrOCRForCausalLM as TrOCRForCausalLM,__webpack_exports__TrOCRPreTrainedModel as TrOCRPreTrainedModel,__webpack_exports__TranslationPipeline as TranslationPipeline,__webpack_exports__UniSpeechForCTC as UniSpeechForCTC,__webpack_exports__UniSpeechForSequenceClassification as UniSpeechForSequenceClassification,__webpack_exports__UniSpeechModel as UniSpeechModel,__webpack_exports__UniSpeechPreTrainedModel as UniSpeechPreTrainedModel,__webpack_exports__UniSpeechSatForAudioFrameClassification as UniSpeechSatForAudioFrameClassification,__webpack_exports__UniSpeechSatForCTC as UniSpeechSatForCTC,__webpack_exports__UniSpeechSatForSequenceClassification as UniSpeechSatForSequenceClassification,__webpack_exports__UniSpeechSatModel as UniSpeechSatModel,__webpack_exports__UniSpeechSatPreTrainedModel as UniSpeechSatPreTrainedModel,__webpack_exports__ViTFeatureExtractor as ViTFeatureExtractor,__webpack_exports__ViTForImageClassification as ViTForImageClassification,__webpack_exports__ViTImageProcessor as ViTImageProcessor,__webpack_exports__ViTModel as ViTModel,__webpack_exports__ViTPreTrainedModel as ViTPreTrainedModel,__webpack_exports__VisionEncoderDecoderModel as VisionEncoderDecoderModel,__webpack_exports__VitMatteForImageMatting as VitMatteForImageMatting,__webpack_exports__VitMatteImageProcessor as VitMatteImageProcessor,__webpack_exports__VitMattePreTrainedModel as VitMattePreTrainedModel,__webpack_exports__VitsModel as VitsModel,__webpack_exports__VitsModelOutput as VitsModelOutput,__webpack_exports__VitsPreTrainedModel as VitsPreTrainedModel,__webpack_exports__VitsTokenizer as VitsTokenizer,__webpack_exports__Wav2Vec2BertForCTC as Wav2Vec2BertForCTC,__webpack_exports__Wav2Vec2BertForSequenceClassification as Wav2Vec2BertForSequenceClassification,__webpack_exports__Wav2Vec2BertModel as Wav2Vec2BertModel,__webpack_exports__Wav2Vec2BertPreTrainedModel as Wav2Vec2BertPreTrainedModel,__webpack_exports__Wav2Vec2CTCTokenizer as Wav2Vec2CTCTokenizer,__webpack_exports__Wav2Vec2FeatureExtractor as Wav2Vec2FeatureExtractor,__webpack_exports__Wav2Vec2ForAudioFrameClassification as Wav2Vec2ForAudioFrameClassification,__webpack_exports__Wav2Vec2ForCTC as Wav2Vec2ForCTC,__webpack_exports__Wav2Vec2ForSequenceClassification as Wav2Vec2ForSequenceClassification,__webpack_exports__Wav2Vec2Model as Wav2Vec2Model,__webpack_exports__Wav2Vec2PreTrainedModel as Wav2Vec2PreTrainedModel,__webpack_exports__Wav2Vec2ProcessorWithLM as Wav2Vec2ProcessorWithLM,__webpack_exports__WavLMForAudioFrameClassification as WavLMForAudioFrameClassification,__webpack_exports__WavLMForCTC as WavLMForCTC,__webpack_exports__WavLMForSequenceClassification as WavLMForSequenceClassification,__webpack_exports__WavLMForXVector as WavLMForXVector,__webpack_exports__WavLMModel as WavLMModel,__webpack_exports__WavLMPreTrainedModel as WavLMPreTrainedModel,__webpack_exports__WhisperFeatureExtractor as WhisperFeatureExtractor,__webpack_exports__WhisperForConditionalGeneration as WhisperForConditionalGeneration,__webpack_exports__WhisperModel as WhisperModel,__webpack_exports__WhisperPreTrainedModel as WhisperPreTrainedModel,__webpack_exports__WhisperProcessor as WhisperProcessor,__webpack_exports__WhisperTokenizer as WhisperTokenizer,__webpack_exports__XLMForQuestionAnswering as XLMForQuestionAnswering,__webpack_exports__XLMForSequenceClassification as XLMForSequenceClassification,__webpack_exports__XLMForTokenClassification as XLMForTokenClassification,__webpack_exports__XLMModel as XLMModel,__webpack_exports__XLMPreTrainedModel as XLMPreTrainedModel,__webpack_exports__XLMRobertaForMaskedLM as XLMRobertaForMaskedLM,__webpack_exports__XLMRobertaForQuestionAnswering as XLMRobertaForQuestionAnswering,__webpack_exports__XLMRobertaForSequenceClassification as XLMRobertaForSequenceClassification,__webpack_exports__XLMRobertaForTokenClassification as XLMRobertaForTokenClassification,__webpack_exports__XLMRobertaModel as XLMRobertaModel,__webpack_exports__XLMRobertaPreTrainedModel as XLMRobertaPreTrainedModel,__webpack_exports__XLMRobertaTokenizer as XLMRobertaTokenizer,__webpack_exports__XLMTokenizer as XLMTokenizer,__webpack_exports__XLMWithLMHeadModel as XLMWithLMHeadModel,__webpack_exports__XVectorOutput as XVectorOutput,__webpack_exports__YolosFeatureExtractor as YolosFeatureExtractor,__webpack_exports__YolosForObjectDetection as YolosForObjectDetection,__webpack_exports__YolosModel as YolosModel,__webpack_exports__YolosObjectDetectionOutput as YolosObjectDetectionOutput,__webpack_exports__YolosPreTrainedModel as YolosPreTrainedModel,__webpack_exports__ZeroShotAudioClassificationPipeline as ZeroShotAudioClassificationPipeline,__webpack_exports__ZeroShotClassificationPipeline as ZeroShotClassificationPipeline,__webpack_exports__ZeroShotImageClassificationPipeline as ZeroShotImageClassificationPipeline,__webpack_exports__ZeroShotObjectDetectionPipeline as ZeroShotObjectDetectionPipeline,__webpack_exports__bankers_round as bankers_round,__webpack_exports__cat as cat,__webpack_exports__cos_sim as cos_sim,__webpack_exports__dot as dot,__webpack_exports__dynamicTimeWarping as dynamicTimeWarping,__webpack_exports__env as env,__webpack_exports__getTopItems as getTopItems,__webpack_exports__hanning as hanning,__webpack_exports__interpolate as interpolate,__webpack_exports__interpolate_data as interpolate_data,__webpack_exports__layer_norm as layer_norm,__webpack_exports__log_softmax as log_softmax,__webpack_exports__magnitude as magnitude,__webpack_exports__max as max,__webpack_exports__mean as mean,__webpack_exports__mean_pooling as mean_pooling,__webpack_exports__medianFilter as medianFilter,__webpack_exports__mel_filter_bank as mel_filter_bank,__webpack_exports__min as min,__webpack_exports__ones as ones,__webpack_exports__ones_like as ones_like,__webpack_exports__permute as permute,__webpack_exports__permute_data as permute_data,__webpack_exports__pipeline as pipeline,__webpack_exports__quantize_embeddings as quantize_embeddings,__webpack_exports__read_audio as read_audio,__webpack_exports__round as round,__webpack_exports__softmax as softmax,__webpack_exports__spectrogram as spectrogram,__webpack_exports__stack as stack,__webpack_exports__std_mean as std_mean,__webpack_exports__window_function as window_function};
+//# sourceMappingURL=transformers.min.js.map
\ No newline at end of file
diff --git a/modules/ui.js b/modules/ui.js
new file mode 100644
index 0000000000000000000000000000000000000000..43050d4cf481a7094843919ba8296710750bdbf2
--- /dev/null
+++ b/modules/ui.js
@@ -0,0 +1,109 @@
+import { highlightText } from "./highlightText.js";
+import { submitFeedback } from "./feedback.js";
+
+/** handle what needs to be displayed in chat container */
+export function appendMessage(content, className, linkId = null, akkordeonId = null, bestToken = null, query = null) {
+  const messageContainer = document.createElement('div');
+  
+  if (className === 'user-message') {
+
+    const messageDiv = document.createElement('div');
+    messageDiv.textContent = content;
+    messageDiv.className = className;
+    messageContainer.appendChild(messageDiv);
+
+  } else {
+
+    /** drawing what chat response looks like */
+    messageContainer.className = 'bot-message-container';
+
+    const numberBox = document.createElement('div');
+    numberBox.textContent = "⦿";
+    numberBox.className = 'number-box';
+    
+    const messageDiv = document.createElement('div');
+    messageDiv.textContent = content;
+    messageDiv.className = className;
+    
+    const panelDiv = document.createElement('div');
+    panelDiv.textContent = '➜';
+    panelDiv.className = 'info-panel';
+    panelDiv.onclick = function () {
+
+      linkToPanel(linkId, akkordeonId, bestToken);
+    };
+
+    const feedbackContainer = document.createElement('div');
+    feedbackContainer.className = 'feedback-container';
+    
+    const plusButton = document.createElement('button');
+    plusButton.innerHTML = '+';
+    plusButton.className = 'feedback-button thumbs-up';
+    plusButton.onclick = function () {
+      
+      submitFeedback(query, bestToken, 'up');
+    };
+    
+    const minusButton = document.createElement('button');
+    minusButton.innerHTML = '-';
+    minusButton.className = 'feedback-button thumbs-down';
+    minusButton.onclick = function () {
+      
+      submitFeedback(query, bestToken, 'down');
+    };
+    
+    messageContainer.appendChild(numberBox);
+    messageContainer.appendChild(messageDiv);
+    messageContainer.appendChild(panelDiv);
+
+    feedbackContainer.appendChild(plusButton);
+    feedbackContainer.appendChild(minusButton);
+    messageContainer.appendChild(feedbackContainer);
+  }
+  
+  const messagesDiv = document.getElementById('messages');
+  messagesDiv.appendChild(messageContainer);
+  messagesDiv.scrollTop = messagesDiv.scrollHeight;
+}
+
+/** gets query from input field and performs search*/
+export function sendMessage(worker) {
+
+  const userInput = document.getElementById('user-input');
+  const message = userInput.value.trim();
+
+
+  if (message !== "") {
+    appendMessage(message, 'user-message');
+    userInput.value = '';
+    worker.postMessage({
+      act: 'semanticSearch',
+      query: message,
+    });
+  }
+}
+
+/** scrolls to the relavant panel and shows hidden answer text */
+export function linkToPanel(buttonId, akkordeonId, bestToken) {
+  
+  const selector = (window !== window.parent.parent) ? window.parent.parent.document : document;
+  
+  const parentContainer = selector.querySelector(`#${akkordeonId}`);
+  const panelButton = parentContainer.querySelector(`#${buttonId}`);
+  if (panelButton.classList.contains('collapsed')) {
+    panelButton.click();
+  }
+  
+  panelButton.scrollIntoView({ behavior: 'smooth', block: 'center' });
+  /** might leave highlighing out; works, but highlights are persistent until DOM is reloaded */
+  setTimeout(() => { highlightText(bestToken); }, 1000);
+}
+
+/** lets results in results iframe scroll to right panel */
+window.linkToPanel = linkToPanel;
+
+
+
+
+
+
diff --git a/modules/workerInterface.js b/modules/workerInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..9144b303d5e32605ff04da38a39c72e7a8e3a6a2
--- /dev/null
+++ b/modules/workerInterface.js
@@ -0,0 +1,59 @@
+import { appendMessage } from './ui.js';
+
+
+let processQueryCache = null;
+
+export function handleWorker(events){
+
+    const { act, results, embeddingCache: updatedCache, tokenEmbeddingCache: updatedTokenCache, query } = events.data;
+      
+      switch (act) {
+        case 'initialized':
+          localStorage.setItem('largeEmbedding', JSON.stringify(updatedCache));
+          
+          break;
+          
+        case 'tokeninit':
+          localStorage.setItem('smallEmbedding', JSON.stringify(updatedTokenCache));
+          
+          break;
+    
+        case 'searchResults':
+          /** pass our three results to ui so they can be displayed and worked with in chat */
+          results.forEach(result => {
+            appendMessage(
+              result.question,
+              'bot-message',
+              result.buttonId,
+              result.akkordeonId,
+              result.bestToken,
+              query
+            );
+          });
+          break;
+    
+        case 'topResults':
+          /** show results live in result iframe */
+          if (processQueryCache) {
+            const outputs = results.slice(0, 3).map(result => ({
+              question: result.question,
+              bestToken: result.bestToken,
+              buttonId: result.buttonId,
+              akkordeonId: result.akkordeonId,
+            }));
+
+            processQueryCache(outputs);
+            processQueryCache = null;
+          }
+          break;
+      }
+}
+
+export function processQuery(query, worker, cache) {
+  processQueryCache = cache;
+  worker.postMessage({
+    act: 'resultsSemantic',
+    query: query,
+  });
+}
+